From owner-svn-src-head@FreeBSD.ORG Sun Feb 24 02:04:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 90A77F8D; Sun, 24 Feb 2013 02:04:44 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-we0-x233.google.com (mail-we0-x233.google.com [IPv6:2a00:1450:400c:c03::233]) by mx1.freebsd.org (Postfix) with ESMTP id 86B0DE64; Sun, 24 Feb 2013 02:04:43 +0000 (UTC) Received: by mail-we0-f179.google.com with SMTP id p43so1547446wea.24 for ; Sat, 23 Feb 2013 18:04:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=qcJIH6mBzvZPI07rc8M1/wwEmNi3L/E8HCxe0/pO3es=; b=ABqBr1awGL8YRzqvYczzyj9zMbKB/YreLHbu0+QCgSLOYc7Eo1UGg7tCrBLcsw4LJT K+2y/whS1oP+CL0M+DN+CgGfUXiA65rgsHbhK6TfZyXwthZSnOtfv+nEDEH/3IwEfmXD jn1e1eLggkJwU+IG9eZsiQdLK1VEnNUW92IonNyWIE/BBK7GY5PXsvIIVGuY3t48ATx/ vKK/8hAQOAXjUY3VFQTlefjIIcz4WBys7G/1nFBmLt/lHxo7DMp7ZIxgL4k8sFJqGdgl FNIZXlXR1OANwy9vjKDNjcKIU/MoC9kZL0IROFuuhbEoint3ryc7clD5AWzssbY8GiuP VlgQ== MIME-Version: 1.0 X-Received: by 10.194.90.168 with SMTP id bx8mr11224960wjb.59.1361671481927; Sat, 23 Feb 2013 18:04:41 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.216.74.194 with HTTP; Sat, 23 Feb 2013 18:04:41 -0800 (PST) In-Reply-To: <51294081.1060505@FreeBSD.org> References: <201302222240.r1MMeAsu042087@svn.freebsd.org> <20130222235332.GB2454@kib.kiev.ua> <5128AED6.2020906@FreeBSD.org> <20130223201857.GD2454@kib.kiev.ua> <51294081.1060505@FreeBSD.org> Date: Sat, 23 Feb 2013 18:04:41 -0800 X-Google-Sender-Auth: AysyGa2R7OPj6__8xDAFFHs5Sug Message-ID: Subject: Re: svn commit: r247166 - head/contrib/llvm/tools/clang/lib/Driver From: Adrian Chadd To: Dimitry Andric Content-Type: text/plain; charset=ISO-8859-1 Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 02:04:44 -0000 Just curious about the OS detection - is the default platform detection based on the currently running OS, or the cross-built target OS? eg, if I were cross-compiling FreeBSD on (say) haiku, which has different CPU defaults, what would the default CPU output be? Adrian From owner-svn-src-head@FreeBSD.ORG Sun Feb 24 06:44:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id ABB4A9C5; Sun, 24 Feb 2013 06:44:31 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8608F170C; Sun, 24 Feb 2013 06:44:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1O6iV5f026862; Sun, 24 Feb 2013 06:44:31 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1O6iU12026849; Sun, 24 Feb 2013 06:44:30 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201302240644.r1O6iU12026849@svn.freebsd.org> From: Kirk McKusick Date: Sun, 24 Feb 2013 06:44:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247212 - head/sbin/fsck_ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 06:44:31 -0000 Author: mckusick Date: Sun Feb 24 06:44:29 2013 New Revision: 247212 URL: http://svnweb.freebsd.org/changeset/base/247212 Log: When running with the -d option, instrument fsck_ffs to track the number, data type, and running time of its I/O operations. No functional changes. Modified: head/sbin/fsck_ffs/dir.c head/sbin/fsck_ffs/ea.c head/sbin/fsck_ffs/fsck.h head/sbin/fsck_ffs/fsutil.c head/sbin/fsck_ffs/inode.c head/sbin/fsck_ffs/main.c head/sbin/fsck_ffs/setup.c Modified: head/sbin/fsck_ffs/dir.c ============================================================================== --- head/sbin/fsck_ffs/dir.c Sun Feb 24 05:48:59 2013 (r247211) +++ head/sbin/fsck_ffs/dir.c Sun Feb 24 06:44:29 2013 (r247212) @@ -708,6 +708,6 @@ getdirblk(ufs2_daddr_t blkno, long size) if (pdirbp != 0) pdirbp->b_flags &= ~B_INUSE; - pdirbp = getdatablk(blkno, size); + pdirbp = getdatablk(blkno, size, BT_DIRDATA); return (pdirbp); } Modified: head/sbin/fsck_ffs/ea.c ============================================================================== --- head/sbin/fsck_ffs/ea.c Sun Feb 24 05:48:59 2013 (r247211) +++ head/sbin/fsck_ffs/ea.c Sun Feb 24 06:44:29 2013 (r247212) @@ -73,7 +73,7 @@ eascan(struct inodesc *idesc, struct ufs else blksiz = sblock.fs_bsize; printf("blksiz = %ju\n", (intmax_t)blksiz); - bp = getdatablk(dp->di_extb[0], blksiz); + bp = getdatablk(dp->di_extb[0], blksiz, BT_EXTATTR); cp = (u_char *)bp->b_un.b_buf; for (n = 0; n < blksiz; n++) { printf("%02x", cp[n]); Modified: head/sbin/fsck_ffs/fsck.h ============================================================================== --- head/sbin/fsck_ffs/fsck.h Sun Feb 24 05:48:59 2013 (r247211) +++ head/sbin/fsck_ffs/fsck.h Sun Feb 24 06:44:29 2013 (r247212) @@ -138,6 +138,7 @@ struct bufarea { int b_size; int b_errs; int b_flags; + int b_type; union { char *b_buf; /* buffer space */ ufs1_daddr_t *b_indir1; /* UFS1 indirect block */ @@ -165,6 +166,36 @@ struct bufarea { * Buffer flags */ #define B_INUSE 0x00000001 /* Buffer is in use */ +/* + * Type of data in buffer + */ +#define BT_UNKNOWN 0 /* Buffer holds a superblock */ +#define BT_SUPERBLK 1 /* Buffer holds a superblock */ +#define BT_CYLGRP 2 /* Buffer holds a cylinder group map */ +#define BT_LEVEL1 3 /* Buffer holds single level indirect */ +#define BT_LEVEL2 4 /* Buffer holds double level indirect */ +#define BT_LEVEL3 5 /* Buffer holds triple level indirect */ +#define BT_EXTATTR 6 /* Buffer holds external attribute data */ +#define BT_INODES 7 /* Buffer holds external attribute data */ +#define BT_DIRDATA 8 /* Buffer holds directory data */ +#define BT_DATA 9 /* Buffer holds user data */ +#define BT_NUMBUFTYPES 10 +#define BT_NAMES { \ + "unknown", \ + "Superblock", \ + "Cylinder Group", \ + "Single Level Indirect", \ + "Double Level Indirect", \ + "Triple Level Indirect", \ + "External Attribute", \ + "Inode Block", \ + "Directory Contents", \ + "User Data" } +long readcnt[BT_NUMBUFTYPES]; +long totalreadcnt[BT_NUMBUFTYPES]; +struct timespec readtime[BT_NUMBUFTYPES]; +struct timespec totalreadtime[BT_NUMBUFTYPES]; +struct timespec startprog; struct bufarea sblk; /* file system superblock */ struct bufarea cgblk; /* cylinder group blocks */ @@ -177,10 +208,11 @@ struct bufarea *pbp; /* current inode b else \ (bp)->b_dirty = 1; \ } while (0) -#define initbarea(bp) do { \ +#define initbarea(bp, type) do { \ (bp)->b_dirty = 0; \ (bp)->b_bno = (ufs2_daddr_t)-1; \ (bp)->b_flags = 0; \ + (bp)->b_type = type; \ } while (0) #define sbdirty() dirty(&sblk) @@ -357,6 +389,7 @@ int dirscan(struct inodesc *); int dofix(struct inodesc *, const char *msg); int eascan(struct inodesc *, struct ufs2_dinode *dp); void fileerror(ino_t cwd, ino_t ino, const char *errmesg); +void finalIOstats(void); int findino(struct inodesc *); int findname(struct inodesc *); void flush(int fd, struct bufarea *bp); @@ -365,7 +398,7 @@ void freeino(ino_t ino); void freeinodebuf(void); int ftypeok(union dinode *dp); void getblk(struct bufarea *bp, ufs2_daddr_t blk, long size); -struct bufarea *getdatablk(ufs2_daddr_t blkno, long size); +struct bufarea *getdatablk(ufs2_daddr_t blkno, long size, int type); struct inoinfo *getinoinfo(ino_t inumber); union dinode *getnextinode(ino_t inumber, int rebuildcg); void getpathname(char *namebuf, ino_t curdir, ino_t ino); @@ -375,6 +408,7 @@ void alarmhandler(int sig); void inocleanup(void); void inodirty(void); struct inostat *inoinfo(ino_t inum); +void IOstats(char *what); int linkup(ino_t orphan, ino_t parentdir, char *name); int makeentry(ino_t parent, ino_t ino, const char *name); void panic(const char *fmt, ...) __printflike(1, 2); Modified: head/sbin/fsck_ffs/fsutil.c ============================================================================== --- head/sbin/fsck_ffs/fsutil.c Sun Feb 24 05:48:59 2013 (r247211) +++ head/sbin/fsck_ffs/fsutil.c Sun Feb 24 06:44:29 2013 (r247212) @@ -56,19 +56,23 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "fsck.h" static void slowio_start(void); static void slowio_end(void); +static void printIOstats(void); -long diskreads, totalreads; /* Disk cache statistics */ +static long diskreads, totaldiskreads, totalreads; /* Disk cache statistics */ +static struct timespec startpass, finishpass; struct timeval slowio_starttime; int slowio_delay_usec = 10000; /* Initial IO delay for background fsck */ int slowio_pollcnt; static TAILQ_HEAD(buflist, bufarea) bufhead; /* head of buffer cache list */ static int numbufs; /* size of buffer cache */ +static char *buftype[BT_NUMBUFTYPES] = BT_NAMES; int ftypeok(union dinode *dp) @@ -163,7 +167,7 @@ bufinit(void) if (bufp == 0) errx(EEXIT, "cannot allocate buffer pool"); cgblk.b_un.b_buf = bufp; - initbarea(&cgblk); + initbarea(&cgblk, BT_CYLGRP); TAILQ_INIT(&bufhead); bufcnt = MAXBUFS; if (bufcnt < MINBUFS) @@ -178,16 +182,21 @@ bufinit(void) } bp->b_un.b_buf = bufp; TAILQ_INSERT_HEAD(&bufhead, bp, b_list); - initbarea(bp); + initbarea(bp, BT_UNKNOWN); } numbufs = i; /* save number of buffers */ + for (i = 0; i < BT_NUMBUFTYPES; i++) { + readtime[i].tv_sec = totalreadtime[i].tv_sec = 0; + readtime[i].tv_nsec = totalreadtime[i].tv_nsec = 0; + readcnt[i] = totalreadcnt[i] = 0; + } } /* * Manage a cache of directory blocks. */ struct bufarea * -getdatablk(ufs2_daddr_t blkno, long size) +getdatablk(ufs2_daddr_t blkno, long size, int type) { struct bufarea *bp; @@ -199,26 +208,62 @@ getdatablk(ufs2_daddr_t blkno, long size break; if (bp == NULL) errx(EEXIT, "deadlocked buffer pool"); + bp->b_type = type; getblk(bp, blkno, size); /* fall through */ foundit: + if (debug && bp->b_type != type) + printf("Buffer type changed from %s to %s\n", + buftype[bp->b_type], buftype[type]); TAILQ_REMOVE(&bufhead, bp, b_list); TAILQ_INSERT_HEAD(&bufhead, bp, b_list); bp->b_flags |= B_INUSE; return (bp); } +/* + * Timespec operations (from ). + */ +#define timespecsub(vvp, uvp) \ + do { \ + (vvp)->tv_sec -= (uvp)->tv_sec; \ + (vvp)->tv_nsec -= (uvp)->tv_nsec; \ + if ((vvp)->tv_nsec < 0) { \ + (vvp)->tv_sec--; \ + (vvp)->tv_nsec += 1000000000; \ + } \ + } while (0) +#define timespecadd(vvp, uvp) \ + do { \ + (vvp)->tv_sec += (uvp)->tv_sec; \ + (vvp)->tv_nsec += (uvp)->tv_nsec; \ + if ((vvp)->tv_nsec >= 1000000000) { \ + (vvp)->tv_sec++; \ + (vvp)->tv_nsec -= 1000000000; \ + } \ + } while (0) + void getblk(struct bufarea *bp, ufs2_daddr_t blk, long size) { ufs2_daddr_t dblk; + struct timespec start, finish; - totalreads++; dblk = fsbtodb(&sblock, blk); - if (bp->b_bno != dblk) { + if (bp->b_bno == dblk) { + totalreads++; + } else { flush(fswritefd, bp); - diskreads++; + if (debug) { + readcnt[bp->b_type]++; + clock_gettime(CLOCK_REALTIME_PRECISE, &start); + } bp->b_errs = blread(fsreadfd, bp->b_un.b_buf, dblk, size); + if (debug) { + clock_gettime(CLOCK_REALTIME_PRECISE, &finish); + timespecsub(&finish, &start); + timespecadd(&readtime[bp->b_type], &finish); + } bp->b_bno = dblk; bp->b_size = size; } @@ -292,8 +337,8 @@ ckfini(int markclean) } if (debug && totalreads > 0) printf("cache with %d buffers missed %ld of %ld (%d%%)\n", - numbufs, diskreads, totalreads, - (int)(diskreads * 100 / totalreads)); + numbufs, totaldiskreads, totalreads, + (int)(totaldiskreads * 100 / totalreads)); if (fswritefd < 0) { (void)close(fsreadfd); return; @@ -347,6 +392,82 @@ ckfini(int markclean) (void)close(fswritefd); } +/* + * Print out I/O statistics. + */ +void +IOstats(char *what) +{ + int i; + + if (debug == 0) + return; + if (diskreads == 0) { + printf("%s: no I/O\n\n", what); + return; + } + if (startpass.tv_sec == 0) + startpass = startprog; + printf("%s: I/O statistics\n", what); + printIOstats(); + totaldiskreads += diskreads; + diskreads = 0; + for (i = 0; i < BT_NUMBUFTYPES; i++) { + timespecadd(&totalreadtime[i], &readtime[i]); + totalreadcnt[i] += readcnt[i]; + readtime[i].tv_sec = readtime[i].tv_nsec = 0; + readcnt[i] = 0; + } + clock_gettime(CLOCK_REALTIME_PRECISE, &startpass); +} + +void +finalIOstats(void) +{ + int i; + + if (debug == 0) + return; + printf("Final I/O statistics\n"); + totaldiskreads += diskreads; + diskreads = totaldiskreads; + startpass = startprog; + for (i = 0; i < BT_NUMBUFTYPES; i++) { + timespecadd(&totalreadtime[i], &readtime[i]); + totalreadcnt[i] += readcnt[i]; + readtime[i] = totalreadtime[i]; + readcnt[i] = totalreadcnt[i]; + } + printIOstats(); +} + +static void printIOstats(void) +{ + long long msec, totalmsec; + int i; + + clock_gettime(CLOCK_REALTIME_PRECISE, &finishpass); + timespecsub(&finishpass, &startpass); + printf("Running time: %ld msec\n", + finishpass.tv_sec * 1000 + finishpass.tv_nsec / 1000000); + printf("buffer reads by type:\n"); + for (totalmsec = 0, i = 0; i < BT_NUMBUFTYPES; i++) + totalmsec += readtime[i].tv_sec * 1000 + + readtime[i].tv_nsec / 1000000; + if (totalmsec == 0) + totalmsec = 1; + for (i = 0; i < BT_NUMBUFTYPES; i++) { + if (readcnt[i] == 0) + continue; + msec = readtime[i].tv_sec * 1000 + readtime[i].tv_nsec / 1000000; + printf("%21s:%8ld %2ld.%ld%% %8lld msec %2lld.%lld%%\n", + buftype[i], readcnt[i], readcnt[i] * 100 / diskreads, + (readcnt[i] * 1000 / diskreads) % 10, msec, + msec * 100 / totalmsec, (msec * 1000 / totalmsec) % 10); + } + printf("\n"); +} + int blread(int fd, char *buf, ufs2_daddr_t blk, long size) { @@ -358,6 +479,8 @@ blread(int fd, char *buf, ufs2_daddr_t b offset *= dev_bsize; if (bkgrdflag) slowio_start(); + totalreads++; + diskreads++; if (lseek(fd, offset, 0) < 0) rwerror("SEEK BLK", blk); else if (read(fd, buf, (int)size) == size) { Modified: head/sbin/fsck_ffs/inode.c ============================================================================== --- head/sbin/fsck_ffs/inode.c Sun Feb 24 05:48:59 2013 (r247211) +++ head/sbin/fsck_ffs/inode.c Sun Feb 24 06:44:29 2013 (r247212) @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); static ino_t startinum; -static int iblock(struct inodesc *, long ilevel, off_t isize); +static int iblock(struct inodesc *, long ilevel, off_t isize, int type); int ckinode(union dinode *dp, struct inodesc *idesc) @@ -121,7 +121,7 @@ ckinode(union dinode *dp, struct inodesc sizepb *= NINDIR(&sblock); if (DIP(&dino, di_ib[i])) { idesc->id_blkno = DIP(&dino, di_ib[i]); - ret = iblock(idesc, i + 1, remsize); + ret = iblock(idesc, i + 1, remsize, BT_LEVEL1 + i); if (ret & STOP) return (ret); } else { @@ -151,7 +151,7 @@ ckinode(union dinode *dp, struct inodesc } static int -iblock(struct inodesc *idesc, long ilevel, off_t isize) +iblock(struct inodesc *idesc, long ilevel, off_t isize, int type) { struct bufarea *bp; int i, n, (*func)(struct inodesc *), nif; @@ -168,7 +168,7 @@ iblock(struct inodesc *idesc, long ileve func = dirscan; if (chkrange(idesc->id_blkno, idesc->id_numfrags)) return (SKIP); - bp = getdatablk(idesc->id_blkno, sblock.fs_bsize); + bp = getdatablk(idesc->id_blkno, sblock.fs_bsize, type); ilevel--; for (sizepb = sblock.fs_bsize, i = 0; i < ilevel; i++) sizepb *= NINDIR(&sblock); @@ -199,7 +199,7 @@ iblock(struct inodesc *idesc, long ileve if (ilevel == 0) n = (*func)(idesc); else - n = iblock(idesc, ilevel, isize); + n = iblock(idesc, ilevel, isize, type); if (n & STOP) { bp->b_flags &= ~B_INUSE; return (n); @@ -292,7 +292,7 @@ ginode(ino_t inumber) iblk = ino_to_fsba(&sblock, inumber); if (pbp != 0) pbp->b_flags &= ~B_INUSE; - pbp = getdatablk(iblk, sblock.fs_bsize); + pbp = getdatablk(iblk, sblock.fs_bsize, BT_INODES); startinum = (inumber / INOPB(&sblock)) * INOPB(&sblock); } if (sblock.fs_magic == FS_UFS1_MAGIC) @@ -306,8 +306,8 @@ ginode(ino_t inumber) * over all the inodes in numerical order. */ static ino_t nextino, lastinum, lastvalidinum; -static long readcnt, readpercg, fullcnt, inobufsize, partialcnt, partialsize; -static caddr_t inodebuf; +static long readcount, readpercg, fullcnt, inobufsize, partialcnt, partialsize; +static struct bufarea inobuf; union dinode * getnextinode(ino_t inumber, int rebuildcg) @@ -315,7 +315,7 @@ getnextinode(ino_t inumber, int rebuildc int j; long size; mode_t mode; - ufs2_daddr_t ndb, dblk; + ufs2_daddr_t ndb, blk; union dinode *dp; static caddr_t nextinop; @@ -323,9 +323,9 @@ getnextinode(ino_t inumber, int rebuildc errx(EEXIT, "bad inode number %ju to nextinode", (uintmax_t)inumber); if (inumber >= lastinum) { - readcnt++; - dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum)); - if (readcnt % readpercg == 0) { + readcount++; + blk = ino_to_fsba(&sblock, lastinum); + if (readcount % readpercg == 0) { size = partialsize; lastinum += partialcnt; } else { @@ -333,14 +333,14 @@ getnextinode(ino_t inumber, int rebuildc lastinum += fullcnt; } /* - * If blread returns an error, it will already have zeroed + * If getblk encounters an error, it will already have zeroed * out the buffer, so we do not need to do so here. */ - (void)blread(fsreadfd, inodebuf, dblk, size); - nextinop = inodebuf; + getblk(&inobuf, blk, size); + nextinop = inobuf.b_un.b_buf; } dp = (union dinode *)nextinop; - if (rebuildcg && nextinop == inodebuf) { + if (rebuildcg && nextinop == inobuf.b_un.b_buf) { /* * Try to determine if we have reached the end of the * allocated inodes. @@ -406,8 +406,8 @@ setinodebuf(ino_t inum) startinum = 0; nextino = inum; lastinum = inum; - readcnt = 0; - if (inodebuf != NULL) + readcount = 0; + if (inobuf.b_un.b_buf != NULL) return; inobufsize = blkroundup(&sblock, INOBUFSIZE); fullcnt = inobufsize / ((sblock.fs_magic == FS_UFS1_MAGIC) ? @@ -422,7 +422,8 @@ setinodebuf(ino_t inum) partialcnt = fullcnt; partialsize = inobufsize; } - if ((inodebuf = malloc((unsigned)inobufsize)) == NULL) + initbarea(&inobuf, BT_INODES); + if ((inobuf.b_un.b_buf = malloc((unsigned)inobufsize)) == NULL) errx(EEXIT, "cannot allocate space for inode buffer"); } @@ -430,9 +431,9 @@ void freeinodebuf(void) { - if (inodebuf != NULL) - free((char *)inodebuf); - inodebuf = NULL; + if (inobuf.b_un.b_buf != NULL) + free((char *)inobuf.b_un.b_buf); + inobuf.b_un.b_buf = NULL; } /* Modified: head/sbin/fsck_ffs/main.c ============================================================================== --- head/sbin/fsck_ffs/main.c Sun Feb 24 05:48:59 2013 (r247211) +++ head/sbin/fsck_ffs/main.c Sun Feb 24 06:44:29 2013 (r247212) @@ -424,7 +424,9 @@ checkfilesys(char *filesys) printf("** Root file system\n"); printf("** Phase 1 - Check Blocks and Sizes\n"); } + clock_gettime(CLOCK_REALTIME_PRECISE, &startprog); pass1(); + IOstats("Pass1"); /* * 1b: locate first references to duplicates, if any @@ -437,6 +439,7 @@ checkfilesys(char *filesys) usedsoftdep ? "softupdates" : ""); printf("** Phase 1b - Rescan For More DUPS\n"); pass1b(); + IOstats("Pass1b"); } /* @@ -445,6 +448,7 @@ checkfilesys(char *filesys) if (preen == 0) printf("** Phase 2 - Check Pathnames\n"); pass2(); + IOstats("Pass2"); /* * 3: scan inodes looking for disconnected directories @@ -452,6 +456,7 @@ checkfilesys(char *filesys) if (preen == 0) printf("** Phase 3 - Check Connectivity\n"); pass3(); + IOstats("Pass3"); /* * 4: scan inodes looking for disconnected files; check reference counts @@ -459,6 +464,7 @@ checkfilesys(char *filesys) if (preen == 0) printf("** Phase 4 - Check Reference Counts\n"); pass4(); + IOstats("Pass4"); /* * 5: check and repair resource counts in cylinder groups @@ -466,6 +472,7 @@ checkfilesys(char *filesys) if (preen == 0) printf("** Phase 5 - Check Cyl groups\n"); pass5(); + IOstats("Pass5"); /* * print out summary statistics @@ -519,6 +526,7 @@ checkfilesys(char *filesys) } if (rerun) resolved = 0; + finalIOstats(); /* * Check to see if the file system is mounted read-write. Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Sun Feb 24 05:48:59 2013 (r247211) +++ head/sbin/fsck_ffs/setup.c Sun Feb 24 06:44:29 2013 (r247212) @@ -249,6 +249,7 @@ setup(char *dev) for (i = 0, j = 0; i < sblock.fs_cssize; i += sblock.fs_bsize, j++) { size = sblock.fs_cssize - i < sblock.fs_bsize ? sblock.fs_cssize - i : sblock.fs_bsize; + readcnt[sblk.b_type]++; if (blread(fsreadfd, (char *)sblock.fs_csp + i, fsbtodb(&sblock, sblock.fs_csaddr + j * sblock.fs_frag), size) != 0 && !asked) { @@ -322,6 +323,7 @@ readsb(int listerr) if (bflag) { super = bflag; + readcnt[sblk.b_type]++; if ((blread(fsreadfd, (char *)&sblock, super, (long)SBLOCKSIZE))) return (0); if (sblock.fs_magic == FS_BAD_MAGIC) { @@ -337,6 +339,7 @@ readsb(int listerr) } else { for (i = 0; sblock_try[i] != -1; i++) { super = sblock_try[i] / dev_bsize; + readcnt[sblk.b_type]++; if ((blread(fsreadfd, (char *)&sblock, super, (long)SBLOCKSIZE))) return (0); @@ -439,8 +442,8 @@ sblock_init(void) fswritefd = -1; fsmodified = 0; lfdir = 0; - initbarea(&sblk); - initbarea(&asblk); + initbarea(&sblk, BT_SUPERBLK); + initbarea(&asblk, BT_SUPERBLK); sblk.b_un.b_buf = malloc(SBLOCKSIZE); asblk.b_un.b_buf = malloc(SBLOCKSIZE); if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL) From owner-svn-src-head@FreeBSD.ORG Sun Feb 24 15:15:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5EF4DC4E; Sun, 24 Feb 2013 15:15:51 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 422DE689; Sun, 24 Feb 2013 15:15:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1OFFpPW079550; Sun, 24 Feb 2013 15:15:51 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1OFFpWh079548; Sun, 24 Feb 2013 15:15:51 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201302241515.r1OFFpWh079548@svn.freebsd.org> From: Mark Johnston Date: Sun, 24 Feb 2013 15:15:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247221 - head/lib/libelf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 15:15:51 -0000 Author: markj Date: Sun Feb 24 15:15:50 2013 New Revision: 247221 URL: http://svnweb.freebsd.org/changeset/base/247221 Log: Merge part of r1712 from elftoolchain, making it possible to resize ELF sections and indirectly change the layout of an ELF file when ELF_F_LAYOUT is not set. PR: bin/167103 Approved by: rstone (co-mentor) Obtained from: elftoolchain MFC after: 2 weeks Modified: head/lib/libelf/elf_update.c Modified: head/lib/libelf/elf_update.c ============================================================================== --- head/lib/libelf/elf_update.c Sun Feb 24 11:32:45 2013 (r247220) +++ head/lib/libelf/elf_update.c Sun Feb 24 15:15:50 2013 (r247221) @@ -41,89 +41,79 @@ __FBSDID("$FreeBSD$"); #include "_libelf.h" /* - * Update the internal data structures associated with an ELF object. - * Returns the size in bytes the ELF object would occupy in its file - * representation. + * Layout strategy: * - * After a successful call to this function, the following structures - * are updated: + * - Case 1: ELF_F_LAYOUT is asserted + * In this case the application has full control over where the + * section header table, program header table, and section data + * will reside. The library only perform error checks. * - * - The ELF header is updated. - * - All sections are sorted in order of ascending addresses and their - * section header table entries updated. An error is signalled - * if an overlap was detected among sections. - * - All data descriptors associated with a section are sorted in order - * of ascending addresses. Overlaps, if detected, are signalled as - * errors. Other sanity checks for alignments, section types etc. are - * made. + * - Case 2: ELF_F_LAYOUT is not asserted * - * After a resync_elf() successfully returns, the ELF descriptor is - * ready for being handed over to _libelf_write_elf(). + * The library will do the object layout using the following + * ordering: + * - The executable header is placed first, are required by the + * ELF specification. + * - The program header table is placed immediately following the + * executable header. + * - Section data, if any, is placed after the program header + * table, aligned appropriately. + * - The section header table, if needed, is placed last. * - * File alignments: - * PHDR - Addr - * SHDR - Addr + * There are two sub-cases to be taken care of: * - * XXX: how do we handle 'flags'. + * - Case 2a: e->e_cmd == ELF_C_READ or ELF_C_RDWR + * + * In this sub-case, the underlying ELF object may already have + * content in it, which the application may have modified. The + * library will retrieve content from the existing object as + * needed. + * + * - Case 2b: e->e_cmd == ELF_C_WRITE + * + * The ELF object is being created afresh in this sub-case; + * there is no pre-existing content in the underlying ELF + * object. */ /* * Compute the extents of a section, by looking at the data - * descriptors associated with it. The function returns zero if an - * error was detected. `*rc' holds the maximum file extent seen so - * far. + * descriptors associated with it. The function returns 1 if + * successful, or zero if an error was detected. */ static int -_libelf_compute_section_extents(Elf *e, Elf_Scn *s, off_t *rc) +_libelf_compute_section_extents(Elf *e, Elf_Scn *s, off_t rc) { int ec; - Elf_Data *d, *td; + size_t fsz, msz; + Elf_Data *d; + Elf32_Shdr *shdr32; + Elf64_Shdr *shdr64; unsigned int elftype; uint32_t sh_type; uint64_t d_align; uint64_t sh_align, sh_entsize, sh_offset, sh_size; uint64_t scn_size, scn_alignment; - /* - * We need to recompute library private data structures if one - * or more of the following is true: - * - The underlying Shdr structure has been marked `dirty'. Significant - * fields include: `sh_offset', `sh_type', `sh_size', `sh_addralign'. - * - The Elf_Data structures part of this section have been marked - * `dirty'. Affected members include `d_align', `d_offset', `d_type', - * and `d_size'. - * - The section as a whole is `dirty', e.g., it has been allocated - * using elf_newscn(), or if a new Elf_Data structure was added using - * elf_newdata(). - * - * Each of these conditions would result in the ELF_F_DIRTY bit being - * set on the section descriptor's `s_flags' field. - */ - ec = e->e_class; + shdr32 = &s->s_shdr.s_shdr32; + shdr64 = &s->s_shdr.s_shdr64; if (ec == ELFCLASS32) { - sh_type = s->s_shdr.s_shdr32.sh_type; - sh_align = (uint64_t) s->s_shdr.s_shdr32.sh_addralign; - sh_entsize = (uint64_t) s->s_shdr.s_shdr32.sh_entsize; - sh_offset = (uint64_t) s->s_shdr.s_shdr32.sh_offset; - sh_size = (uint64_t) s->s_shdr.s_shdr32.sh_size; + sh_type = shdr32->sh_type; + sh_align = (uint64_t) shdr32->sh_addralign; + sh_entsize = (uint64_t) shdr32->sh_entsize; + sh_offset = (uint64_t) shdr32->sh_offset; + sh_size = (uint64_t) shdr32->sh_size; } else { - sh_type = s->s_shdr.s_shdr64.sh_type; - sh_align = s->s_shdr.s_shdr64.sh_addralign; - sh_entsize = s->s_shdr.s_shdr64.sh_entsize; - sh_offset = s->s_shdr.s_shdr64.sh_offset; - sh_size = s->s_shdr.s_shdr64.sh_size; + sh_type = shdr64->sh_type; + sh_align = shdr64->sh_addralign; + sh_entsize = shdr64->sh_entsize; + sh_offset = shdr64->sh_offset; + sh_size = shdr64->sh_size; } - if (sh_type == SHT_NULL || sh_type == SHT_NOBITS) - return (1); - - if ((s->s_flags & ELF_F_DIRTY) == 0) { - if ((size_t) *rc < sh_offset + sh_size) - *rc = sh_offset + sh_size; - return (1); - } + assert(sh_type != SHT_NULL && sh_type != SHT_NOBITS); elftype = _libelf_xlate_shtype(sh_type); if (elftype > ELF_T_LAST) { @@ -131,15 +121,52 @@ _libelf_compute_section_extents(Elf *e, return (0); } - /* - * Compute the extent of the data descriptors associated with - * this section. - */ - scn_alignment = 0; if (sh_align == 0) sh_align = _libelf_falign(elftype, ec); - /* Compute the section alignment. */ + /* + * Check the section's data buffers for sanity and compute the + * section's alignment. + * Compute the section's size and alignment using the data + * descriptors associated with the section. + */ + if (STAILQ_EMPTY(&s->s_data)) { + /* + * The section's content (if any) has not been read in + * yet. If section is not dirty marked dirty, we can + * reuse the values in the 'sh_size' and 'sh_offset' + * fields of the section header. + */ + if ((s->s_flags & ELF_F_DIRTY) == 0) { + /* + * If the library is doing the layout, then we + * compute the new start offset for the + * section based on the current offset and the + * section's alignment needs. + * + * If the application is doing the layout, we + * can use the value in the 'sh_offset' field + * in the section header directly. + */ + if (e->e_flags & ELF_F_LAYOUT) + goto updatedescriptor; + else + goto computeoffset; + } + + /* + * Otherwise, we need to bring in the section's data + * from the underlying ELF object. + */ + if (e->e_cmd != ELF_C_WRITE && elf_getdata(s, NULL) == NULL) + return (0); + } + + /* + * Loop through the section's data descriptors. + */ + scn_size = 0L; + scn_alignment = 0L; STAILQ_FOREACH(d, &s->s_data, d_next) { if (d->d_type > ELF_T_LAST) { LIBELF_SET_ERROR(DATA, 0); @@ -153,23 +180,40 @@ _libelf_compute_section_extents(Elf *e, LIBELF_SET_ERROR(DATA, 0); return (0); } - if (d_align > scn_alignment) - scn_alignment = d_align; - } - scn_size = 0L; + /* + * The buffer's size should be a multiple of the + * memory size of the underlying type. + */ + msz = _libelf_msize(d->d_type, ec, e->e_version); + if (d->d_size % msz) { + LIBELF_SET_ERROR(DATA, 0); + return (0); + } - STAILQ_FOREACH_SAFE(d, &s->s_data, d_next, td) { + /* + * Compute the section's size. + */ if (e->e_flags & ELF_F_LAYOUT) { if ((uint64_t) d->d_off + d->d_size > scn_size) scn_size = d->d_off + d->d_size; } else { scn_size = roundup2(scn_size, d->d_align); d->d_off = scn_size; - scn_size += d->d_size; + fsz = _libelf_fsize(d->d_type, ec, d->d_version, + d->d_size / msz); + scn_size += fsz; } + + /* + * The section's alignment is the maximum alignment + * needed for its data buffers. + */ + if (d_align > scn_alignment) + scn_alignment = d_align; } + /* * If the application is requesting full control over the layout * of the section, check its values for sanity. @@ -180,46 +224,60 @@ _libelf_compute_section_extents(Elf *e, LIBELF_SET_ERROR(LAYOUT, 0); return (0); } - } else { - /* - * Otherwise compute the values in the section header. - */ + goto updatedescriptor; + } - if (scn_alignment > sh_align) - sh_align = scn_alignment; + /* + * Otherwise compute the values in the section header. + * + * The section alignment is the maximum alignment for any of + * its contained data descriptors. + */ + if (scn_alignment > sh_align) + sh_align = scn_alignment; - /* - * If the section entry size is zero, try and fill in an - * appropriate entry size. Per the elf(5) manual page - * sections without fixed-size entries should have their - * 'sh_entsize' field set to zero. - */ - if (sh_entsize == 0 && - (sh_entsize = _libelf_fsize(elftype, ec, e->e_version, - (size_t) 1)) == 1) - sh_entsize = 0; + /* + * If the section entry size is zero, try and fill in an + * appropriate entry size. Per the elf(5) manual page + * sections without fixed-size entries should have their + * 'sh_entsize' field set to zero. + */ + if (sh_entsize == 0 && + (sh_entsize = _libelf_fsize(elftype, ec, e->e_version, + (size_t) 1)) == 1) + sh_entsize = 0; - sh_size = scn_size; - sh_offset = roundup(*rc, sh_align); + sh_size = scn_size; - if (ec == ELFCLASS32) { - s->s_shdr.s_shdr32.sh_addralign = (uint32_t) sh_align; - s->s_shdr.s_shdr32.sh_entsize = (uint32_t) sh_entsize; - s->s_shdr.s_shdr32.sh_offset = (uint32_t) sh_offset; - s->s_shdr.s_shdr32.sh_size = (uint32_t) sh_size; - } else { - s->s_shdr.s_shdr64.sh_addralign = sh_align; - s->s_shdr.s_shdr64.sh_entsize = sh_entsize; - s->s_shdr.s_shdr64.sh_offset = sh_offset; - s->s_shdr.s_shdr64.sh_size = sh_size; - } - } +computeoffset: + /* + * Compute the new offset for the section based on + * the section's alignment needs. + */ + sh_offset = roundup(rc, sh_align); - if ((size_t) *rc < sh_offset + sh_size) - *rc = sh_offset + sh_size; + /* + * Update the section header. + */ + if (ec == ELFCLASS32) { + shdr32->sh_addralign = (uint32_t) sh_align; + shdr32->sh_entsize = (uint32_t) sh_entsize; + shdr32->sh_offset = (uint32_t) sh_offset; + shdr32->sh_size = (uint32_t) sh_size; + } else { + shdr64->sh_addralign = sh_align; + shdr64->sh_entsize = sh_entsize; + shdr64->sh_offset = sh_offset; + shdr64->sh_size = sh_size; + } +updatedescriptor: + /* + * Update the section descriptor. + */ s->s_size = sh_size; s->s_offset = sh_offset; + return (1); } @@ -267,13 +325,16 @@ _libelf_insert_section(Elf *e, Elf_Scn * return (1); } +/* + * Recompute section layout. + */ + static off_t _libelf_resync_sections(Elf *e, off_t rc) { int ec; - off_t nrc; + Elf_Scn *s; size_t sh_type, shdr_start, shdr_end; - Elf_Scn *s, *ts; ec = e->e_class; @@ -281,13 +342,7 @@ _libelf_resync_sections(Elf *e, off_t rc * Make a pass through sections, computing the extent of each * section. Order in increasing order of addresses. */ - - nrc = rc; - STAILQ_FOREACH(s, &e->e_u.e_elf.e_scn, s_next) - if (_libelf_compute_section_extents(e, s, &nrc) == 0) - return ((off_t) -1); - - STAILQ_FOREACH_SAFE(s, &e->e_u.e_elf.e_scn, s_next, ts) { + STAILQ_FOREACH(s, &e->e_u.e_elf.e_scn, s_next) { if (ec == ELFCLASS32) sh_type = s->s_shdr.s_shdr32.sh_type; else @@ -296,21 +351,22 @@ _libelf_resync_sections(Elf *e, off_t rc if (sh_type == SHT_NOBITS || sh_type == SHT_NULL) continue; - if (s->s_offset < (uint64_t) rc) { - if (s->s_offset + s->s_size < (uint64_t) rc) { - /* - * Try insert this section in the - * correct place in the list, - * detecting overlaps if any. - */ - STAILQ_REMOVE(&e->e_u.e_elf.e_scn, s, _Elf_Scn, - s_next); - if (_libelf_insert_section(e, s) == 0) - return ((off_t) -1); - } else { - LIBELF_SET_ERROR(LAYOUT, 0); + if (_libelf_compute_section_extents(e, s, rc) == 0) + return ((off_t) -1); + + if (s->s_size == 0) + continue; + + if (s->s_offset + s->s_size < (size_t) rc) { + /* + * Try insert this section in the + * correct place in the list, + * detecting overlaps if any. + */ + STAILQ_REMOVE(&e->e_u.e_elf.e_scn, s, _Elf_Scn, + s_next); + if (_libelf_insert_section(e, s) == 0) return ((off_t) -1); - } } else rc = s->s_offset + s->s_size; } @@ -338,8 +394,6 @@ _libelf_resync_sections(Elf *e, off_t rc } } - assert(nrc == rc); - return (rc); } From owner-svn-src-head@FreeBSD.ORG Sun Feb 24 18:11:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9465991E; Sun, 24 Feb 2013 18:11:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) by mx1.freebsd.org (Postfix) with ESMTP id 4CC61CD5; Sun, 24 Feb 2013 18:11:36 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:204:4bff:fe01:de8a] (spaceball.andric.com [IPv6:2001:7b8:3a7:0:204:4bff:fe01:de8a]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id AB7455C43; Sun, 24 Feb 2013 19:11:32 +0100 (CET) Message-ID: <512A57D1.6050006@FreeBSD.org> Date: Sun, 24 Feb 2013 19:11:29 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20130117 Thunderbird/19.0 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r247166 - head/contrib/llvm/tools/clang/lib/Driver References: <201302222240.r1MMeAsu042087@svn.freebsd.org> <20130222235332.GB2454@kib.kiev.ua> <5128AED6.2020906@FreeBSD.org> <20130223201857.GD2454@kib.kiev.ua> <51294081.1060505@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 18:11:36 -0000 On 2013-02-24 03:04, Adrian Chadd wrote: > Just curious about the OS detection - is the default platform > detection based on the currently running OS, or the cross-built target > OS? > > eg, if I were cross-compiling FreeBSD on (say) haiku, which has > different CPU defaults, what would the default CPU output be? When you are cross-compiling, you usually specify -target $target_triple, e.g.: clang -target amd64-unknown-freebsd10.0 -c foo.c or you make a link or symlink from clang to ${target_triple}-clang, like so: amd64-unknown-freebsd10.0-clang -c foo.c In either case, the default CPU is whatever the default CPU is for that target triple. So for the amd64-unknown-freebsd triple, it would be x86_64, for i386-unknown-freebsd it would be i486, etc. From owner-svn-src-head@FreeBSD.ORG Sun Feb 24 19:32:43 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E184D29B; Sun, 24 Feb 2013 19:32:43 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D16BEFB9; Sun, 24 Feb 2013 19:32:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1OJWhen058660; Sun, 24 Feb 2013 19:32:43 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1OJWhdF058658; Sun, 24 Feb 2013 19:32:43 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201302241932.r1OJWhdF058658@svn.freebsd.org> From: Sergey Kandaurov Date: Sun, 24 Feb 2013 19:32:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247234 - head/sbin/fsdb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 19:32:44 -0000 Author: pluknet Date: Sun Feb 24 19:32:43 2013 New Revision: 247234 URL: http://svnweb.freebsd.org/changeset/base/247234 Log: Catch up with internal API changes for initbarea() and getdatablk() of fsck_ffs introduced with r247212. Submitted by: David Wolfskill Modified: head/sbin/fsdb/fsdbutil.c Modified: head/sbin/fsdb/fsdbutil.c ============================================================================== --- head/sbin/fsdb/fsdbutil.c Sun Feb 24 19:10:16 2013 (r247233) +++ head/sbin/fsdb/fsdbutil.c Sun Feb 24 19:32:43 2013 (r247234) @@ -239,11 +239,11 @@ printindir(ufs2_daddr_t blk, int level, /* for the final indirect level, don't use the cache */ bp = &buf; bp->b_un.b_buf = bufp; - initbarea(bp); + initbarea(bp, BT_UNKNOWN); getblk(bp, blk, sblock.fs_bsize); } else - bp = getdatablk(blk, sblock.fs_bsize); + bp = getdatablk(blk, sblock.fs_bsize, BT_UNKNOWN); cpl = charsperline(); for (i = charssofar = 0; i < NINDIR(&sblock); i++) { From owner-svn-src-head@FreeBSD.ORG Sun Feb 24 20:53:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8FC117EA; Sun, 24 Feb 2013 20:53:33 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 775BC34F; Sun, 24 Feb 2013 20:53:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1OKrXZk082508; Sun, 24 Feb 2013 20:53:33 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1OKrX44082507; Sun, 24 Feb 2013 20:53:33 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201302242053.r1OKrX44082507@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 24 Feb 2013 20:53:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247236 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 20:53:33 -0000 Author: jilles Date: Sun Feb 24 20:53:32 2013 New Revision: 247236 URL: http://svnweb.freebsd.org/changeset/base/247236 Log: libc/opendir: Improve behaviour of union uniquifier: * Reopen the directory using openat(fd, ".", ...) instead of opening the pathname again. This fixes a race condition where the meaning of the pathname changes and allows a reopen with fdopendir(). * Always reopen the directory for union stacks, not only when DTF_REWIND is passed. Applications should be able to fchdir(dirfd(dir)) and *at(dirfd(dir), ...). DTF_REWIND now does nothing. Modified: head/lib/libc/gen/opendir.c Modified: head/lib/libc/gen/opendir.c ============================================================================== --- head/lib/libc/gen/opendir.c Sun Feb 24 19:49:02 2013 (r247235) +++ head/lib/libc/gen/opendir.c Sun Feb 24 20:53:32 2013 (r247236) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include "gen-private.h" #include "telldir.h" -static DIR * __opendir_common(int, const char *, int); +static DIR * __opendir_common(int, int); /* * Open a directory. @@ -78,7 +78,7 @@ fdopendir(int fd) } if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) return (NULL); - return (__opendir_common(fd, NULL, DTF_HIDEW|DTF_NODUP)); + return (__opendir_common(fd, DTF_HIDEW|DTF_NODUP)); } DIR * @@ -92,7 +92,7 @@ __opendir2(const char *name, int flags) O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC)) == -1) return (NULL); - dir = __opendir_common(fd, name, flags); + dir = __opendir_common(fd, flags); if (dir == NULL) { saved_errno = errno; _close(fd); @@ -113,7 +113,7 @@ opendir_compar(const void *p1, const voi * Common routine for opendir(3), __opendir2(3) and fdopendir(3). */ static DIR * -__opendir_common(int fd, const char *name, int flags) +__opendir_common(int fd, int flags) { DIR *dirp; int incr; @@ -121,6 +121,8 @@ __opendir_common(int fd, const char *nam int unionstack; int fd2; + fd2 = -1; + if ((dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL) return (NULL); @@ -165,7 +167,22 @@ __opendir_common(int fd, const char *nam * entries into a buffer, sort the buffer, and * remove duplicate entries by setting the inode * number to zero. + * + * We reopen the directory because _getdirentries() + * on a MNT_UNION mount modifies the open directory, + * making it refer to the lower directory after the + * upper directory's entries are exhausted. + * This would otherwise break software that uses + * the directory descriptor for fchdir or *at + * functions, such as fts.c. */ + if ((fd2 = _openat(fd, ".", O_RDONLY | O_CLOEXEC)) == -1) { + saved_errno = errno; + free(buf); + free(dirp); + errno = saved_errno; + return (NULL); + } do { /* @@ -181,7 +198,7 @@ __opendir_common(int fd, const char *nam ddptr = buf + (len - space); } - n = _getdirentries(fd, ddptr, space, &dirp->dd_seek); + n = _getdirentries(fd2, ddptr, space, &dirp->dd_seek); if (n > 0) { ddptr += n; space -= n; @@ -191,25 +208,8 @@ __opendir_common(int fd, const char *nam ddeptr = ddptr; flags |= __DTF_READALL; - /* - * Re-open the directory. - * This has the effect of rewinding back to the - * top of the union stack and is needed by - * programs which plan to fchdir to a descriptor - * which has also been read -- see fts.c. - */ - if (flags & DTF_REWIND) { - if ((fd2 = _open(name, O_RDONLY | O_DIRECTORY | - O_CLOEXEC)) == -1) { - saved_errno = errno; - free(buf); - free(dirp); - errno = saved_errno; - return (NULL); - } - (void)_dup2(fd2, fd); - _close(fd2); - } + _close(fd2); + fd2 = -1; /* * There is now a buffer full of (possibly) duplicate @@ -293,7 +293,6 @@ __opendir_common(int fd, const char *nam if (dirp->dd_buf == NULL) goto fail; dirp->dd_seek = 0; - flags &= ~DTF_REWIND; } dirp->dd_loc = 0; @@ -310,6 +309,8 @@ __opendir_common(int fd, const char *nam fail: saved_errno = errno; + if (fd2 != -1) + _close(fd2); free(dirp); errno = saved_errno; return (NULL); From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 01:50:05 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C489631D; Mon, 25 Feb 2013 01:50:05 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A8B4533F; Mon, 25 Feb 2013 01:50:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1P1o5TK070969; Mon, 25 Feb 2013 01:50:05 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1P1o4TR070963; Mon, 25 Feb 2013 01:50:04 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201302250150.r1P1o4TR070963@svn.freebsd.org> From: Tim Kientzle Date: Mon, 25 Feb 2013 01:50:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247250 - in head/sys/boot: common fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 01:50:05 -0000 Author: kientzle Date: Mon Feb 25 01:50:04 2013 New Revision: 247250 URL: http://svnweb.freebsd.org/changeset/base/247250 Log: Fix the bug I introduced in r247045. After digging through more carefully, it looks like there's no real need to have the DTB in the module directory. So we can simplify a lot: Just copy DTB into local heap for "fdt addr" and U-Boot integration, drop all the extra COPYIN() calls. I've left one final COPYIN() to update the in-kernel DTB for consistency with how this code used to work, but I'm no longer convinced it's appropriate here. I've also remove the mem_load_raw() utility that I added to boot/common/module.c with r247045 since it's no longer necessary. Modified: head/sys/boot/common/bootstrap.h head/sys/boot/common/module.c head/sys/boot/fdt/fdt_loader_cmd.c Modified: head/sys/boot/common/bootstrap.h ============================================================================== --- head/sys/boot/common/bootstrap.h Mon Feb 25 00:08:28 2013 (r247249) +++ head/sys/boot/common/bootstrap.h Mon Feb 25 01:50:04 2013 (r247250) @@ -237,8 +237,6 @@ void file_discard(struct preloaded_file void file_addmetadata(struct preloaded_file *fp, int type, size_t size, void *p); int file_addmodule(struct preloaded_file *fp, char *modname, int version, struct kernel_module **newmp); -/* Load from a buffer in memory. */ -struct preloaded_file *mem_load_raw(char *type, char *name, const void *p, size_t len); /* MI module loaders */ #ifdef __elfN Modified: head/sys/boot/common/module.c ============================================================================== --- head/sys/boot/common/module.c Mon Feb 25 00:08:28 2013 (r247249) +++ head/sys/boot/common/module.c Mon Feb 25 01:50:04 2013 (r247250) @@ -422,42 +422,6 @@ file_loadraw(char *type, char *name) } /* - * Load a chunk of data as if it had been read from a file. - */ -struct preloaded_file * -mem_load_raw(char *type, char *name, const void *p, size_t len) -{ - struct preloaded_file *fp; - - /* We can't load first */ - if ((file_findfile(NULL, NULL)) == NULL) { - command_errmsg = "can't load file before kernel"; - return(NULL); - } - - if (archsw.arch_loadaddr != NULL) - loadaddr = archsw.arch_loadaddr(LOAD_RAW, name, loadaddr); - archsw.arch_copyin(p, loadaddr, len); - - /* Looks OK so far; create & populate control structure */ - fp = file_alloc(); - fp->f_name = strdup(name); - fp->f_type = strdup(type); - fp->f_args = NULL; - fp->f_metadata = NULL; - fp->f_loader = -1; - fp->f_addr = loadaddr; - fp->f_size = len; - - /* recognise space consumption */ - loadaddr += len; - - /* Add to the list of loaded files */ - file_insert_tail(fp); - return fp; -} - -/* * Load the module (name), pass it (argc),(argv), add container file * to the list of loaded files. * If module is already loaded just assign new argc/argv. Modified: head/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- head/sys/boot/fdt/fdt_loader_cmd.c Mon Feb 25 00:08:28 2013 (r247249) +++ head/sys/boot/fdt/fdt_loader_cmd.c Mon Feb 25 01:50:04 2013 (r247250) @@ -63,12 +63,16 @@ __FBSDID("$FreeBSD$"); #define CMD_REQUIRES_BLOB 0x01 /* Location of FDT yet to be loaded. */ +/* This may be in read-only memory, so can't be manipulated directly. */ static struct fdt_header *fdt_to_load = NULL; -/* Local copy of FDT on heap. */ +/* Location of FDT on heap. */ +/* This is the copy we actually manipulate. */ static struct fdt_header *fdtp = NULL; /* Size of FDT blob */ static size_t fdtp_size = 0; -/* Location of FDT in kernel or module */ +/* Location of FDT in kernel or module. */ +/* This won't be set if FDT is loaded from disk or memory. */ +/* If it is set, we'll update it when fdt_copy() gets called. */ static vm_offset_t fdtp_va = 0; static int fdt_load_dtb(vm_offset_t va); @@ -191,7 +195,6 @@ fdt_find_static_dtb() fdt_start = (vm_offset_t)sym.st_value + offs; free(strp); } - printf("fdt_start: 0x%08jX\n", (intmax_t)fdt_start); return (fdt_start); } @@ -239,14 +242,19 @@ fdt_load_dtb(vm_offset_t va) static int fdt_load_dtb_addr(struct fdt_header *header) { - struct preloaded_file *bfp; - bfp = mem_load_raw("dtb", "memory.dtb", header, fdt_totalsize(header)); - if (bfp == NULL) { - command_errmsg = "unable to copy DTB into module directory"; + // TODO: Verify that there really is an FDT at + // the specified location. + fdtp_size = fdt_totalsize(header); + free(fdtp); + if ((fdtp = malloc(fdtp_size)) == NULL) { + command_errmsg = "can't allocate memory for device tree copy"; return (1); } - return fdt_load_dtb(bfp->f_addr); + + fdtp_va = 0; // Don't write this back into module or kernel. + bcopy(header, fdtp, fdtp_size); + return (0); } static int @@ -339,7 +347,7 @@ _fdt_strtovect(char *str, void *cellbuf, #define TMP_MAX_ETH 8 -void +static void fixup_ethernet(const char *env, char *ethstr, int *eth_no, int len) { char *end, *str; @@ -376,7 +384,7 @@ fixup_ethernet(const char *env, char *et *eth_no = n + 1; } -void +static void fixup_cpubusfreqs(unsigned long cpufreq, unsigned long busfreq) { int lo, o = 0, o2, maxo = 0, depth; @@ -424,7 +432,7 @@ fixup_cpubusfreqs(unsigned long cpufreq, } } -int +static int fdt_reg_valid(uint32_t *reg, int len, int addr_cells, int size_cells) { int cells_in_tuple, i, tuples, tuple_size; @@ -456,7 +464,7 @@ fdt_reg_valid(uint32_t *reg, int len, in return (0); } -void +static void fixup_memory(struct sys_info *si) { struct mem_region *curmr; @@ -611,7 +619,7 @@ fixup_memory(struct sys_info *si) free(sb); } -void +static void fixup_stdout(const char *env) { const char *str; @@ -664,7 +672,7 @@ fixup_stdout(const char *env) /* * Locate the blob, fix it up and return its location. */ -static vm_offset_t +static int fdt_fixup(void) { const char *env; @@ -692,7 +700,7 @@ fdt_fixup(void) /* Value assigned to fixup-applied does not matter. */ if (fdt_getprop(fdtp, chosen, "fixup-applied", NULL)) - goto success; + return (1); /* Acquire sys_info */ si = ub_get_sys_info(); @@ -735,15 +743,11 @@ fdt_fixup(void) fixup_memory(si); fdt_setprop(fdtp, chosen, "fixup-applied", NULL, 0); - -success: - /* Overwrite the FDT with the fixed version. */ - COPYIN(fdtp, fdtp_va, fdtp_size); - return (fdtp_va); + return (1); } /* - * Copy DTB blob to specified location and its return size + * Copy DTB blob to specified location and return size */ int fdt_copy(vm_offset_t va) @@ -761,6 +765,11 @@ fdt_copy(vm_offset_t va) if (fdt_fixup() == 0) return (0); + if (fdtp_va != 0) { + /* Overwrite the FDT with the fixed version. */ + /* XXX Is this really appropriate? */ + COPYIN(fdtp, fdtp_va, fdtp_size); + } COPYIN(fdtp, va, fdtp_size); return (fdtp_size); } @@ -1334,8 +1343,6 @@ fdt_modprop(int nodeoff, char *propname, else sprintf(command_errbuf, "Could not add/modify property!\n"); - } else { - COPYIN(fdtp, fdtp_va, fdtp_size); } return (rv); } @@ -1520,7 +1527,6 @@ fdt_cmd_mkprop(int argc, char *argv[]) if (fdt_modprop(o, propname, value, 1)) return (CMD_ERROR); - COPYIN(fdtp, fdtp_va, fdtp_size); return (CMD_OK); } @@ -1557,8 +1563,6 @@ fdt_cmd_rm(int argc, char *argv[]) if (rv) { sprintf(command_errbuf, "could not delete node"); return (CMD_ERROR); - } else { - COPYIN(fdtp, fdtp_va, fdtp_size); } return (CMD_OK); } @@ -1589,8 +1593,6 @@ fdt_cmd_mknode(int argc, char *argv[]) sprintf(command_errbuf, "Could not add node!\n"); return (CMD_ERROR); - } else { - COPYIN(fdtp, fdtp_va, fdtp_size); } return (CMD_OK); } From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 02:41:39 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D26C7BC8; Mon, 25 Feb 2013 02:41:39 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3B4C2705; Mon, 25 Feb 2013 02:41:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1P2fdsE088248; Mon, 25 Feb 2013 02:41:39 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1P2fc2h088244; Mon, 25 Feb 2013 02:41:38 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201302250241.r1P2fc2h088244@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 25 Feb 2013 02:41:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247251 - in head/sys/ia64: ia64 include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 02:41:39 -0000 Author: marcel Date: Mon Feb 25 02:41:38 2013 New Revision: 247251 URL: http://svnweb.freebsd.org/changeset/base/247251 Log: kernacc() expects all KVAs to be covered in the kernel map. With the introduction of the PBVM, this stopped being the case. Redefine the VM parameters so that the PBVM is included in the kernel map. In particular this introduces VM_INIT_KERNEL_ADDRESS to point to the base of region 5 now that VM_MIN_KERNEL_ADDRESS points to the base of region 4 to include the PBVM. While here define KERNBASE to the actual link address of the kernel as is intended. PR: 169926 Modified: head/sys/ia64/ia64/pmap.c head/sys/ia64/include/vmparam.h Modified: head/sys/ia64/ia64/pmap.c ============================================================================== --- head/sys/ia64/ia64/pmap.c Mon Feb 25 01:50:04 2013 (r247250) +++ head/sys/ia64/ia64/pmap.c Mon Feb 25 02:41:38 2013 (r247251) @@ -387,7 +387,7 @@ pmap_bootstrap() */ ia64_kptdir = ia64_physmem_alloc(PAGE_SIZE, PAGE_SIZE); nkpt = 0; - kernel_vm_end = VM_MIN_KERNEL_ADDRESS; + kernel_vm_end = VM_INIT_KERNEL_ADDRESS; /* * Determine a valid (mappable) VHPT size. @@ -425,7 +425,7 @@ pmap_bootstrap() ia64_set_pta(base + (1 << 8) + (pmap_vhpt_log2size << 2) + 1); ia64_srlz_i(); - virtual_avail = VM_MIN_KERNEL_ADDRESS; + virtual_avail = VM_INIT_KERNEL_ADDRESS; virtual_end = VM_MAX_KERNEL_ADDRESS; /* @@ -1383,7 +1383,7 @@ pmap_kextract(vm_offset_t va) /* Region 5 is our KVA. Bail out if the VA is beyond our limits. */ if (va >= kernel_vm_end) goto err_out; - if (va >= VM_MIN_KERNEL_ADDRESS) { + if (va >= VM_INIT_KERNEL_ADDRESS) { pte = pmap_find_kpte(va); pa = pmap_present(pte) ? pmap_ppn(pte) | (va & PAGE_MASK) : 0; goto out; @@ -2746,7 +2746,7 @@ DB_COMMAND(kpte, db_kpte) db_printf("usage: kpte \n"); return; } - if (addr < VM_MIN_KERNEL_ADDRESS) { + if (addr < VM_INIT_KERNEL_ADDRESS) { db_printf("kpte: error: invalid \n"); return; } Modified: head/sys/ia64/include/vmparam.h ============================================================================== --- head/sys/ia64/include/vmparam.h Mon Feb 25 01:50:04 2013 (r247250) +++ head/sys/ia64/include/vmparam.h Mon Feb 25 02:41:38 2013 (r247251) @@ -181,12 +181,13 @@ /* user/kernel map constants */ #define VM_MIN_ADDRESS 0 #define VM_MAXUSER_ADDRESS IA64_RR_BASE(IA64_VM_MINKERN_REGION) -#define VM_MIN_KERNEL_ADDRESS IA64_RR_BASE(IA64_VM_MINKERN_REGION + 1) -#define VM_MAX_KERNEL_ADDRESS \ - (VM_MIN_KERNEL_ADDRESS + IA64_REGION_GAP_START - 1) +#define VM_MIN_KERNEL_ADDRESS VM_MAXUSER_ADDRESS +#define VM_INIT_KERNEL_ADDRESS IA64_RR_BASE(IA64_VM_MINKERN_REGION + 1) +#define VM_MAX_KERNEL_ADDRESS (IA64_RR_BASE(IA64_VM_MINKERN_REGION + 2) - 1) #define VM_MAX_ADDRESS ~0UL -#define KERNBASE VM_MAXUSER_ADDRESS +/* We link the kernel at IA64_PBVM_BASE. */ +#define KERNBASE IA64_PBVM_BASE /* * USRSTACK is the top (end) of the user stack. Immediately above the user From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 07:13:38 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BF626F9; Mon, 25 Feb 2013 07:13:38 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from smtp4.clear.net.nz (smtp4.clear.net.nz [203.97.37.64]) by mx1.freebsd.org (Postfix) with ESMTP id 706B2164; Mon, 25 Feb 2013 07:13:38 +0000 (UTC) Received: from mxin3-orange.clear.net.nz (lb2-srcnat.clear.net.nz [203.97.32.237]) by smtp4.clear.net.nz (CLEAR Net Mail) with ESMTP id <0MIR00HJSLA7LZ20@smtp4.clear.net.nz>; Mon, 25 Feb 2013 20:13:34 +1300 (NZDT) Received: from 202-0-48-19.paradise.net.nz (HELO bender) ([202.0.48.19]) by smtpin32.paradise.net.nz with ESMTP; Mon, 25 Feb 2013 20:13:32 +1300 Date: Mon, 25 Feb 2013 20:13:13 +1300 From: Andrew Turner Subject: Re: svn commit: r247116 - in head/sys: fs/nfs fs/nfsclient kern nfsclient sys tools In-reply-to: <201302211902.r1LJ2o5T033708@svn.freebsd.org> To: John Baldwin Message-id: <20130225201313.2050da18@bender> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit References: <201302211902.r1LJ2o5T033708@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 07:13:38 -0000 On Thu, 21 Feb 2013 19:02:50 +0000 (UTC) John Baldwin wrote: > Author: jhb > Date: Thu Feb 21 19:02:50 2013 > New Revision: 247116 > URL: http://svnweb.freebsd.org/changeset/base/247116 > > Log: > Further refine the handling of stop signals in the NFS client. The > changes in r246417 were incomplete as they did not add explicit > calls to sigdeferstop() around all the places that previously passed > SBDRY to _sleep(). In addition, nfs_getcacheblk() could trigger a > write RPC from getblk() resulting in sigdeferstop() recursing. > Rather than manually deferring stop signals in specific places, > change the VFS_*() and VOP_*() methods to defer stop signals for > filesystems which request this behavior via a new VFCF_SBDRY flag. > Note that this has to be a VFC flag rather than a MNTK flag so that > it works properly with VFS_MOUNT() when the mount is not yet fully > constructed. For now, only the NFS clients are set this new flag in > VFS_SET(). > A few other related changes: > - Add an assertion to ensure that TDF_SBDRY doesn't leak to > userland. > - When a lookup request uses VOP_READLINK() to follow a symlink, > mark the request as being on behalf of the thread performing the > lookup (cnp_thread) rather than using a NULL thread pointer. This > causes NFS to properly handle signals during this VOP on an > interruptible mount. > > PR: kern/176179 > Reported by: Russell Cattelan (sigdeferstop() recursion) > Reviewed by: kib > MFC after: 1 month This change is causing init to crash for me on armv6. I'm netbooting a PandaBoard and it appears init is receiving a SIGABRT before it gets into main(). Do you have any idea where I could look to track down why it is doing this? Andrew From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 08:04:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 82D91AE4; Mon, 25 Feb 2013 08:04:48 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 73B3A31B; Mon, 25 Feb 2013 08:04:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1P84miA085539; Mon, 25 Feb 2013 08:04:48 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1P84mLu085538; Mon, 25 Feb 2013 08:04:48 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201302250804.r1P84mLu085538@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Mon, 25 Feb 2013 08:04:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247252 - head/sys/arm/ti X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 08:04:48 -0000 Author: gonzo Date: Mon Feb 25 08:04:47 2013 New Revision: 247252 URL: http://svnweb.freebsd.org/changeset/base/247252 Log: - Fix off-by-one error when returning max pin number - Fix GPIOGET for output pins. Requesting state for output pin is valid operation, get the state from TI_GPIO_DATAOUTX register Modified: head/sys/arm/ti/ti_gpio.c Modified: head/sys/arm/ti/ti_gpio.c ============================================================================== --- head/sys/arm/ti/ti_gpio.c Mon Feb 25 02:41:38 2013 (r247251) +++ head/sys/arm/ti/ti_gpio.c Mon Feb 25 08:04:47 2013 (r247252) @@ -281,7 +281,7 @@ ti_gpio_pin_max(device_t dev, int *maxpi banks++; } - *maxpin = (banks * PINS_PER_BANK); + *maxpin = (banks * PINS_PER_BANK) - 1; TI_GPIO_UNLOCK(sc); @@ -541,13 +541,11 @@ ti_gpio_pin_get(device_t dev, uint32_t p /* Sanity check the pin is not configured as an output */ val = ti_gpio_read_4(sc, bank, TI_GPIO_OE); - if ((val & mask) == mask) { - TI_GPIO_UNLOCK(sc); - return (EINVAL); - } - /* Read the value on the pin */ - *value = (ti_gpio_read_4(sc, bank, TI_GPIO_DATAIN) & mask) ? 1 : 0; + if (val & mask) + *value = (ti_gpio_read_4(sc, bank, TI_GPIO_DATAOUT) & mask) ? 1 : 0; + else + *value = (ti_gpio_read_4(sc, bank, TI_GPIO_DATAIN) & mask) ? 1 : 0; TI_GPIO_UNLOCK(sc); @@ -728,6 +726,7 @@ ti_gpio_attach(device_t dev) /* Finish of the probe call */ device_add_child(dev, "gpioc", device_get_unit(dev)); device_add_child(dev, "gpiobus", device_get_unit(dev)); + return (bus_generic_attach(dev)); } From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 08:24:22 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 69229581; Mon, 25 Feb 2013 08:24:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5B49362B; Mon, 25 Feb 2013 08:24:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1P8OMU4092087; Mon, 25 Feb 2013 08:24:22 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1P8OMG1092086; Mon, 25 Feb 2013 08:24:22 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201302250824.r1P8OMG1092086@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 25 Feb 2013 08:24:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247255 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 08:24:22 -0000 Author: hselasky Date: Mon Feb 25 08:24:21 2013 New Revision: 247255 URL: http://svnweb.freebsd.org/changeset/base/247255 Log: Add new USB ID. Submitted by: Dmitry Luhtionov Modified: head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Mon Feb 25 08:14:07 2013 (r247254) +++ head/sys/dev/usb/usbdevs Mon Feb 25 08:24:21 2013 (r247255) @@ -650,6 +650,7 @@ vendor OWEN 0x1555 Owen vendor OQO 0x1557 OQO vendor UMEDIA 0x157e U-MEDIA Communications vendor FIBERLINE 0x1582 Fiberline +vendor AFATECH 0x15a4 Afatech Technologies, Inc. vendor SPARKLAN 0x15a9 SparkLAN vendor OLIMEX 0x15ba Olimex vendor SOUNDGRAPH 0x15c2 Soundgraph, Inc. @@ -916,6 +917,9 @@ product ADS UBS10BTX 0x0009 UBS-10BT Et /* AEI products */ product AEI FASTETHERNET 0x1701 Fast Ethernet +/* Afatech Technologies, Inc. */ +product AFATECH AFATECH1336 0x1336 Flash Card Reader + /* Agate Technologies products */ product AGATE QDRIVE 0x0378 Q-Drive From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 08:50:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 35C16C7C; Mon, 25 Feb 2013 08:50:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 86831745; Mon, 25 Feb 2013 08:50:30 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r1P8oJB7025501; Mon, 25 Feb 2013 10:50:19 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.4 kib.kiev.ua r1P8oJB7025501 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r1P8oJAC025500; Mon, 25 Feb 2013 10:50:19 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 25 Feb 2013 10:50:19 +0200 From: Konstantin Belousov To: Andrew Turner Subject: Re: svn commit: r247116 - in head/sys: fs/nfs fs/nfsclient kern nfsclient sys tools Message-ID: <20130225085019.GU2454@kib.kiev.ua> References: <201302211902.r1LJ2o5T033708@svn.freebsd.org> <20130225201313.2050da18@bender> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eHrxbAcqt/LxKPZN" Content-Disposition: inline In-Reply-To: <20130225201313.2050da18@bender> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 08:50:31 -0000 --eHrxbAcqt/LxKPZN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 25, 2013 at 08:13:13PM +1300, Andrew Turner wrote: > On Thu, 21 Feb 2013 19:02:50 +0000 (UTC) > John Baldwin wrote: >=20 > > Author: jhb > > Date: Thu Feb 21 19:02:50 2013 > > New Revision: 247116 > > URL: http://svnweb.freebsd.org/changeset/base/247116 > >=20 > > Log: > > Further refine the handling of stop signals in the NFS client. The > > changes in r246417 were incomplete as they did not add explicit > > calls to sigdeferstop() around all the places that previously passed > > SBDRY to _sleep(). In addition, nfs_getcacheblk() could trigger a > > write RPC from getblk() resulting in sigdeferstop() recursing. > > Rather than manually deferring stop signals in specific places, > > change the VFS_*() and VOP_*() methods to defer stop signals for > > filesystems which request this behavior via a new VFCF_SBDRY flag. > > Note that this has to be a VFC flag rather than a MNTK flag so that > > it works properly with VFS_MOUNT() when the mount is not yet fully > > constructed. For now, only the NFS clients are set this new flag in > > VFS_SET().=20 > > A few other related changes: > > - Add an assertion to ensure that TDF_SBDRY doesn't leak to > > userland. > > - When a lookup request uses VOP_READLINK() to follow a symlink, > > mark the request as being on behalf of the thread performing the > > lookup (cnp_thread) rather than using a NULL thread pointer. This > > causes NFS to properly handle signals during this VOP on an > > interruptible mount. > > =20 > > PR: kern/176179 > > Reported by: Russell Cattelan (sigdeferstop() recursion) > > Reviewed by: kib > > MFC after: 1 month >=20 > This change is causing init to crash for me on armv6. I'm netbooting a > PandaBoard and it appears init is receiving a SIGABRT before it gets > into main(). >=20 > Do you have any idea where I could look to track down why it is doing > this? It is weird. SIGABRT sent by the kernel usually means that execve(2) already destroyed the previous address space of the process, but the new image cannot be activated, most likely due to image format error discovered too late, or resource shortage. Could it be that some NFS RPC fails after the patch, but I cannot imagine why. You would need to track this. Also, verify that the init binary is correct. I tried amd64 netboot, and it worked fine. --eHrxbAcqt/LxKPZN Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRKyXKAAoJEJDCuSvBvK1BrzUQAKJaikkGdd3UCBbUCrf02xkq Fk5bIQGS6EAVwS+2LHH+CAjN9cSZE8QFsTdcZrcpPT7hKpbkjyrSo8vDD3RviERT 11mBtepm7JA8UQOnprnIUMCJny+JOLj9CRiG1+oGPp6Acm1/248wJwShqFC28O4W ApzoxsTacOZ9RO1/jpeR2WGkeB8ypjIsGh+TuFStVfBdkGQihuFl2eaRJPanQn9O esQ1eNkaokWfJD4nXQ0vAtyi6c3HyP1UwLJ4EohcpltIvKUMBWaT6CMwrOYBmLOs Xf9iYpBEsgMqww0ECpIExDIeN326njO36v9AndMsBiYdCfGZ+3eEmcBoohSqQZ8y dJRVIW2YJLN0zWc1c1UC5JnagxdrYzrB6ms2ZCTWdhh59HiTXqQXm+/6vO49I0Gb gWnD6H13JEzfv0sfBe/ZaIb3VFstRmCqtdDAOC9PYyF6t7dc+mzZd+CfkC6ShJbp /2C9nT+E8FbWdwHZ2Y7VOTmm2IZYs3M2P0nOKOfkfQMkAZ1OBrWLwJtclslIA+2e cS1enDYZ6DTmGNDKMqv10qqyOqpFhEnneTvwvRldtpSw76A5SgHJjncfpAEc1i34 qEJXKkMfCMvMzZFEj1kGu7gFcXmWGrRk25jSpMWFraBQ2g1jqiOOdT5MHAZe5AKi pRYiLhYfc70IvI4b3+YX =k2Fp -----END PGP SIGNATURE----- --eHrxbAcqt/LxKPZN-- From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 09:33:49 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BDE28726; Mon, 25 Feb 2013 09:33:49 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 807CB890; Mon, 25 Feb 2013 09:33:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1P9XnOo013019; Mon, 25 Feb 2013 09:33:49 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1P9XnsE013018; Mon, 25 Feb 2013 09:33:49 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201302250933.r1P9XnsE013018@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Mon, 25 Feb 2013 09:33:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247259 - head/sys/arm/ti X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 09:33:49 -0000 Author: gonzo Date: Mon Feb 25 09:33:48 2013 New Revision: 247259 URL: http://svnweb.freebsd.org/changeset/base/247259 Log: Fix off-by-one error in sanity checks Modified: head/sys/arm/ti/ti_gpio.c Modified: head/sys/arm/ti/ti_gpio.c ============================================================================== --- head/sys/arm/ti/ti_gpio.c Mon Feb 25 09:22:36 2013 (r247258) +++ head/sys/arm/ti/ti_gpio.c Mon Feb 25 09:33:48 2013 (r247259) @@ -315,7 +315,7 @@ ti_gpio_pin_getcaps(device_t dev, uint32 TI_GPIO_LOCK(sc); /* Sanity check the pin number is valid */ - if ((bank > MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { + if ((bank >= MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { TI_GPIO_UNLOCK(sc); return (EINVAL); } @@ -353,7 +353,7 @@ ti_gpio_pin_getflags(device_t dev, uint3 TI_GPIO_LOCK(sc); /* Sanity check the pin number is valid */ - if ((bank > MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { + if ((bank >= MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { TI_GPIO_UNLOCK(sc); return (EINVAL); } @@ -390,7 +390,7 @@ ti_gpio_pin_getname(device_t dev, uint32 TI_GPIO_LOCK(sc); /* Sanity check the pin number is valid */ - if ((bank > MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { + if ((bank >= MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { TI_GPIO_UNLOCK(sc); return (EINVAL); } @@ -445,7 +445,7 @@ ti_gpio_pin_setflags(device_t dev, uint3 TI_GPIO_LOCK(sc); /* Sanity check the pin number is valid */ - if ((bank > MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { + if ((bank >= MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { TI_GPIO_UNLOCK(sc); return (EINVAL); } @@ -494,7 +494,7 @@ ti_gpio_pin_set(device_t dev, uint32_t p TI_GPIO_LOCK(sc); /* Sanity check the pin number is valid */ - if ((bank > MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { + if ((bank >= MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { TI_GPIO_UNLOCK(sc); return (EINVAL); } @@ -533,7 +533,7 @@ ti_gpio_pin_get(device_t dev, uint32_t p TI_GPIO_LOCK(sc); /* Sanity check the pin number is valid */ - if ((bank > MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { + if ((bank >= MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { TI_GPIO_UNLOCK(sc); return (EINVAL); } @@ -575,7 +575,7 @@ ti_gpio_pin_toggle(device_t dev, uint32_ TI_GPIO_LOCK(sc); /* Sanity check the pin number is valid */ - if ((bank > MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { + if ((bank >= MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { TI_GPIO_UNLOCK(sc); return (EINVAL); } From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 10:36:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A52CA6E1; Mon, 25 Feb 2013 10:36:31 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from smtp3.clear.net.nz (smtp3.clear.net.nz [203.97.33.64]) by mx1.freebsd.org (Postfix) with ESMTP id 74667B7E; Mon, 25 Feb 2013 10:36:31 +0000 (UTC) Received: from mxin1-orange.clear.net.nz (lb2-srcnat.clear.net.nz [203.97.32.237]) by smtp3.clear.net.nz (CLEAR Net Mail) with ESMTP id <0MIR0071RUSMEK00@smtp3.clear.net.nz>; Mon, 25 Feb 2013 23:36:23 +1300 (NZDT) Received: from 202-0-48-19.paradise.net.nz (HELO bender) ([202.0.48.19]) by smtpin1.paradise.net.nz with ESMTP; Mon, 25 Feb 2013 23:36:22 +1300 Date: Mon, 25 Feb 2013 23:36:03 +1300 From: Andrew Turner Subject: Re: svn commit: r247116 - in head/sys: fs/nfs fs/nfsclient kern nfsclient sys tools In-reply-to: <20130225085019.GU2454@kib.kiev.ua> To: Konstantin Belousov Message-id: <20130225233603.49a5d4a5@bender> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit References: <201302211902.r1LJ2o5T033708@svn.freebsd.org> <20130225201313.2050da18@bender> <20130225085019.GU2454@kib.kiev.ua> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 10:36:31 -0000 On Mon, 25 Feb 2013 10:50:19 +0200 Konstantin Belousov wrote: > On Mon, Feb 25, 2013 at 08:13:13PM +1300, Andrew Turner wrote: > > On Thu, 21 Feb 2013 19:02:50 +0000 (UTC) > > John Baldwin wrote: > > > > > Author: jhb > > > Date: Thu Feb 21 19:02:50 2013 > > > New Revision: 247116 > > > URL: http://svnweb.freebsd.org/changeset/base/247116 > > > > > > Log: > > > Further refine the handling of stop signals in the NFS client. > > > The changes in r246417 were incomplete as they did not add > > > explicit calls to sigdeferstop() around all the places that > > > previously passed SBDRY to _sleep(). In addition, > > > nfs_getcacheblk() could trigger a write RPC from getblk() > > > resulting in sigdeferstop() recursing. Rather than manually > > > deferring stop signals in specific places, change the VFS_*() and > > > VOP_*() methods to defer stop signals for filesystems which > > > request this behavior via a new VFCF_SBDRY flag. Note that this > > > has to be a VFC flag rather than a MNTK flag so that it works > > > properly with VFS_MOUNT() when the mount is not yet fully > > > constructed. For now, only the NFS clients are set this new flag > > > in VFS_SET(). A few other related changes: > > > - Add an assertion to ensure that TDF_SBDRY doesn't leak to > > > userland. > > > - When a lookup request uses VOP_READLINK() to follow a symlink, > > > mark the request as being on behalf of the thread performing the > > > lookup (cnp_thread) rather than using a NULL thread pointer. This > > > causes NFS to properly handle signals during this VOP on an > > > interruptible mount. > > > > > > PR: kern/176179 > > > Reported by: Russell Cattelan (sigdeferstop() recursion) > > > Reviewed by: kib > > > MFC after: 1 month > > > > This change is causing init to crash for me on armv6. I'm > > netbooting a PandaBoard and it appears init is receiving a SIGABRT > > before it gets into main(). > > > > Do you have any idea where I could look to track down why it is > > doing this? > > It is weird. SIGABRT sent by the kernel usually means that execve(2) > already destroyed the previous address space of the process, but the > new image cannot be activated, most likely due to image format error > discovered too late, or resource shortage. > > Could it be that some NFS RPC fails after the patch, but I cannot > imagine why. You would need to track this. Also, verify that the init > binary is correct. > > I tried amd64 netboot, and it worked fine. It looks like this change is not the issue, it just changed the symptom enough for me to not realise I was seeing an issue where it would crash the kernel before. I reinstated this change but only allowed the kernel to access half the memory and it booted correctly. The real issue appears to be related to something in the vm layer not working on ARM boards with too much memory (somewhere between 512MiB and 1GiB). Andrew From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 10:57:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 66361C4C; Mon, 25 Feb 2013 10:57:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5A272D6F; Mon, 25 Feb 2013 10:57:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PAvaOp037642; Mon, 25 Feb 2013 10:57:36 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PAvadM037641; Mon, 25 Feb 2013 10:57:36 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201302251057.r1PAvadM037641@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 25 Feb 2013 10:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247263 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 10:57:36 -0000 Author: hselasky Date: Mon Feb 25 10:57:35 2013 New Revision: 247263 URL: http://svnweb.freebsd.org/changeset/base/247263 Log: Fix init/uninit function type. Modified: head/sys/dev/usb/usb_pf.c Modified: head/sys/dev/usb/usb_pf.c ============================================================================== --- head/sys/dev/usb/usb_pf.c Mon Feb 25 10:52:01 2013 (r247262) +++ head/sys/dev/usb/usb_pf.c Mon Feb 25 10:57:35 2013 (r247263) @@ -63,8 +63,8 @@ #include #endif /* USB_GLOBAL_INCLUDE_FILE */ -static void usbpf_init(void); -static void usbpf_uninit(void); +static void usbpf_init(void *); +static void usbpf_uninit(void *); static int usbpf_ioctl(struct ifnet *, u_long, caddr_t); static int usbpf_clone_match(struct if_clone *, const char *); static int usbpf_clone_create(struct if_clone *, char *, size_t, caddr_t); @@ -82,7 +82,7 @@ SYSINIT(usbpf_init, SI_SUB_PSEUDO, SI_OR SYSUNINIT(usbpf_uninit, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, usbpf_uninit, NULL); static void -usbpf_init(void) +usbpf_init(void *arg) { usbpf_cloner = if_clone_advanced(usbusname, 0, usbpf_clone_match, @@ -90,7 +90,7 @@ usbpf_init(void) } static void -usbpf_uninit(void) +usbpf_uninit(void *arg) { int devlcnt; device_t *devlp; From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 11:22:55 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 841CB154; Mon, 25 Feb 2013 11:22:55 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 788451AF; Mon, 25 Feb 2013 11:22:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PBMsmJ046418; Mon, 25 Feb 2013 11:22:54 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PBMsTR046416; Mon, 25 Feb 2013 11:22:54 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201302251122.r1PBMsTR046416@svn.freebsd.org> From: Matt Jacob Date: Mon, 25 Feb 2013 11:22:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247264 - head/sys/dev/isp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 11:22:55 -0000 Author: mjacob Date: Mon Feb 25 11:22:54 2013 New Revision: 247264 URL: http://svnweb.freebsd.org/changeset/base/247264 Log: Turn off fast posting for the ISP2100- I'd forgotten that it actually might have been enabled for them- now that we use all 32 bits of handle. Fast Posting doesn't pass the full 32 bits. Noticed by: Bugs in NetBSD. Only a NetBSD user might actually still use such old hardware. MFC after: 1 week Modified: head/sys/dev/isp/isp.c Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Mon Feb 25 10:57:35 2013 (r247263) +++ head/sys/dev/isp/isp.c Mon Feb 25 11:22:54 2013 (r247264) @@ -1709,7 +1709,13 @@ isp_fibre_init(ispsoftc_t *isp) * * NB: for the 2300, ICBOPT_EXTENDED is required. */ - if (IS_2200(isp) || IS_23XX(isp)) { + if (IS_2100(isp)) { + /* + * We can't have Fast Posting any more- we now + * have 32 bit handles. + */ + icbp->icb_fwoptions &= ~ICBOPT_FAST_POST; + } else if (IS_2200(isp) || IS_23XX(isp)) { icbp->icb_fwoptions |= ICBOPT_EXTENDED; icbp->icb_xfwoptions = fcp->isp_xfwoptions; From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 11:55:07 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3FB4C629; Mon, 25 Feb 2013 11:55:07 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 8E98A341; Mon, 25 Feb 2013 11:55:06 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r1PBt1Il056992; Mon, 25 Feb 2013 13:55:01 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.4 kib.kiev.ua r1PBt1Il056992 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r1PBt01x056975; Mon, 25 Feb 2013 13:55:00 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 25 Feb 2013 13:55:00 +0200 From: Konstantin Belousov To: Andrew Turner Subject: Re: svn commit: r247116 - in head/sys: fs/nfs fs/nfsclient kern nfsclient sys tools Message-ID: <20130225115500.GW2454@kib.kiev.ua> References: <201302211902.r1LJ2o5T033708@svn.freebsd.org> <20130225201313.2050da18@bender> <20130225085019.GU2454@kib.kiev.ua> <20130225233603.49a5d4a5@bender> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GVLQrlG8+/jMfW4X" Content-Disposition: inline In-Reply-To: <20130225233603.49a5d4a5@bender> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 11:55:07 -0000 --GVLQrlG8+/jMfW4X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 25, 2013 at 11:36:03PM +1300, Andrew Turner wrote: > On Mon, 25 Feb 2013 10:50:19 +0200 > Konstantin Belousov wrote: >=20 > > On Mon, Feb 25, 2013 at 08:13:13PM +1300, Andrew Turner wrote: > > > On Thu, 21 Feb 2013 19:02:50 +0000 (UTC) > > > John Baldwin wrote: > > >=20 > > > > Author: jhb > > > > Date: Thu Feb 21 19:02:50 2013 > > > > New Revision: 247116 > > > > URL: http://svnweb.freebsd.org/changeset/base/247116 > > > >=20 > > > > Log: > > > > Further refine the handling of stop signals in the NFS client. > > > > The changes in r246417 were incomplete as they did not add > > > > explicit calls to sigdeferstop() around all the places that > > > > previously passed SBDRY to _sleep(). In addition, > > > > nfs_getcacheblk() could trigger a write RPC from getblk() > > > > resulting in sigdeferstop() recursing. Rather than manually > > > > deferring stop signals in specific places, change the VFS_*() and > > > > VOP_*() methods to defer stop signals for filesystems which > > > > request this behavior via a new VFCF_SBDRY flag. Note that this > > > > has to be a VFC flag rather than a MNTK flag so that it works > > > > properly with VFS_MOUNT() when the mount is not yet fully > > > > constructed. For now, only the NFS clients are set this new flag > > > > in VFS_SET(). A few other related changes: > > > > - Add an assertion to ensure that TDF_SBDRY doesn't leak to > > > > userland. > > > > - When a lookup request uses VOP_READLINK() to follow a symlink, > > > > mark the request as being on behalf of the thread performing the > > > > lookup (cnp_thread) rather than using a NULL thread pointer. This > > > > causes NFS to properly handle signals during this VOP on an > > > > interruptible mount. > > > > =20 > > > > PR: kern/176179 > > > > Reported by: Russell Cattelan (sigdeferstop() recursion) > > > > Reviewed by: kib > > > > MFC after: 1 month > > >=20 > > > This change is causing init to crash for me on armv6. I'm > > > netbooting a PandaBoard and it appears init is receiving a SIGABRT > > > before it gets into main(). > > >=20 > > > Do you have any idea where I could look to track down why it is > > > doing this? > >=20 > > It is weird. SIGABRT sent by the kernel usually means that execve(2) > > already destroyed the previous address space of the process, but the > > new image cannot be activated, most likely due to image format error > > discovered too late, or resource shortage. > >=20 > > Could it be that some NFS RPC fails after the patch, but I cannot > > imagine why. You would need to track this. Also, verify that the init > > binary is correct. > >=20 > > I tried amd64 netboot, and it worked fine. >=20 > It looks like this change is not the issue, it just changed the > symptom enough for me to not realise I was seeing an issue where > it would crash the kernel before. I reinstated this change but only > allowed the kernel to access half the memory and it booted correctly. >=20 > The real issue appears to be related to something in the vm layer not > working on ARM boards with too much memory (somewhere between 512MiB > and 1GiB). Hm, do you have r246926, r246929 and r247046 ? --GVLQrlG8+/jMfW4X Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRK1ETAAoJEJDCuSvBvK1Bu9EP/2ymcl0cpBUfw1VGwy3++vJM /A+0ON4aj/5mHCOyp526FUD5OMscS7wWMKWQuFdj4rueYFk7ctJjbmHM3xu4CJQZ xUxCAr13YJvuTwpkMQerM/YtFF9UzeKOkUKag4K4ozfmVeDjuoyLZu3rdSJPzsjl BPDww5dSr3UFUW2yQkMQMlrrhYIU0g79BUQsWgLJWH16dzRuGn4knMbor/l4bhyL 37Sb0huWawU1kaPzrJFahPyeov2AuQsDpGdv7eOdYCGLDtzYbMXAv4mo8b3Th7sX E0ZG1eU/+kObUnI67zpRUl2jl/c5VrVfY21NBePW1PMfzpbze7jFoJtqs45G1NXU fGfg1NLeX3H/8k/qj0BOE1gX+MI+FzRYgCW7M8YUIxQhGk3FyW06LqrGDLDUIaeW E03UAJxhmVw7femVLmvpH+ZCOaBDXximEhIfH4c0DTwH+kSbTR3U+31tCXMrC08r qXWbEAnOTDcWJvhIPmlrP2eI/z0MxYwFSBdClM2s/grPeQatFZbIvBzsdAxthw76 khK0GqmxGyrnYUi5wRrfBz5STpRqZxGiCe0tfOFvGmUj8Ba0xV8G0eDAdUbG9f1f OMDs9jHSZkilDnX3uOTBpohXUS7ioERGCvsrjdyX9Z5duTZC8A2I99ks1VwiuagA C747Nh4J7fKXXIVo0r8x =STI5 -----END PGP SIGNATURE----- --GVLQrlG8+/jMfW4X-- From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 12:33:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C48003E3; Mon, 25 Feb 2013 12:33:35 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 993377AE; Mon, 25 Feb 2013 12:33:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PCXZgP067420; Mon, 25 Feb 2013 12:33:35 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PCXWD0067392; Mon, 25 Feb 2013 12:33:32 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201302251233.r1PCXWD0067392@svn.freebsd.org> From: Martin Matuska Date: Mon, 25 Feb 2013 12:33:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247265 - in head: cddl/contrib/opensolaris/cmd/zinject cddl/contrib/opensolaris/lib/libzpool/common cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/compat/opensolaris/sys sys... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 12:33:35 -0000 Author: mm Date: Mon Feb 25 12:33:31 2013 New Revision: 247265 URL: http://svnweb.freebsd.org/changeset/base/247265 Log: MFV v242732: Merge the ZFS I/O deadman thread from vendor (illumos). This feature panics the system on hanging ZFS I/O, helps debugging and resumes failed service. The panic behavior can be controlled with the loader-only tunables: vfs.zfs.deadman_enabled (enable or disable panic on stalled ZFS I/O) vfs.zfs.deadman_synctime (expiration time for stalled ZFS I/O) By default, ZFS I/O deadman is enabled by default on amd64 and i386 excluding virtual guest machines. Illumos ZFS issues: 3246 ZFS I/O deadman thread References: https://www.illumos.org/issues/3246 MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zinject/translate.c head/cddl/contrib/opensolaris/cmd/zinject/zinject.c head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h head/sys/cddl/compat/opensolaris/sys/time.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_boot.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zinject/translate.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zinject/translate.c Mon Feb 25 11:22:54 2013 (r247264) +++ head/cddl/contrib/opensolaris/cmd/zinject/translate.c Mon Feb 25 12:33:31 2013 (r247265) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -455,6 +456,20 @@ translate_device(const char *pool, const &record->zi_guid) == 0); } + /* + * Device faults can take on three different forms: + * 1). delayed or hanging I/O + * 2). zfs label faults + * 3). generic disk faults + */ + if (record->zi_timer != 0) { + record->zi_cmd = ZINJECT_DELAY_IO; + } else if (label_type != TYPE_INVAL) { + record->zi_cmd = ZINJECT_LABEL_FAULT; + } else { + record->zi_cmd = ZINJECT_DEVICE_FAULT; + } + switch (label_type) { case TYPE_LABEL_UBERBLOCK: record->zi_start = offsetof(vdev_label_t, vl_uberblock[0]); Modified: head/cddl/contrib/opensolaris/cmd/zinject/zinject.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zinject/zinject.c Mon Feb 25 11:22:54 2013 (r247264) +++ head/cddl/contrib/opensolaris/cmd/zinject/zinject.c Mon Feb 25 12:33:31 2013 (r247265) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ /* @@ -603,7 +604,7 @@ main(int argc, char **argv) } while ((c = getopt(argc, argv, - ":aA:b:d:f:Fg:qhIc:t:T:l:mr:s:e:uL:p:")) != -1) { + ":aA:b:d:D:f:Fg:qhIc:t:T:l:mr:s:e:uL:p:")) != -1) { switch (c) { case 'a': flags |= ZINJECT_FLUSH_ARC; @@ -629,6 +630,15 @@ main(int argc, char **argv) case 'd': device = optarg; break; + case 'D': + record.zi_timer = strtoull(optarg, &end, 10); + if (errno != 0 || *end != '\0') { + (void) fprintf(stderr, "invalid i/o delay " + "value: '%s'\n", optarg); + usage(); + return (1); + } + break; case 'e': if (strcasecmp(optarg, "io") == 0) { error = EIO; @@ -693,6 +703,7 @@ main(int argc, char **argv) case 'p': (void) strlcpy(record.zi_func, optarg, sizeof (record.zi_func)); + record.zi_cmd = ZINJECT_PANIC; break; case 'q': quiet = 1; @@ -766,13 +777,15 @@ main(int argc, char **argv) argc -= optind; argv += optind; + if (record.zi_duration != 0) + record.zi_cmd = ZINJECT_IGNORED_WRITES; + if (cancel != NULL) { /* * '-c' is invalid with any other options. */ if (raw != NULL || range != NULL || type != TYPE_INVAL || - level != 0 || record.zi_func[0] != '\0' || - record.zi_duration != 0) { + level != 0 || record.zi_cmd != ZINJECT_UNINITIALIZED) { (void) fprintf(stderr, "cancel (-c) incompatible with " "any other options\n"); usage(); @@ -804,8 +817,7 @@ main(int argc, char **argv) * for doing injection, so handle it separately here. */ if (raw != NULL || range != NULL || type != TYPE_INVAL || - level != 0 || record.zi_func[0] != '\0' || - record.zi_duration != 0) { + level != 0 || record.zi_cmd != ZINJECT_UNINITIALIZED) { (void) fprintf(stderr, "device (-d) incompatible with " "data error injection\n"); usage(); @@ -839,7 +851,7 @@ main(int argc, char **argv) } else if (raw != NULL) { if (range != NULL || type != TYPE_INVAL || level != 0 || - record.zi_func[0] != '\0' || record.zi_duration != 0) { + record.zi_cmd != ZINJECT_UNINITIALIZED) { (void) fprintf(stderr, "raw (-b) format with " "any other options\n"); usage(); @@ -862,13 +874,14 @@ main(int argc, char **argv) return (1); } + record.zi_cmd = ZINJECT_DATA_FAULT; if (translate_raw(raw, &record) != 0) return (1); if (!error) error = EIO; - } else if (record.zi_func[0] != '\0') { + } else if (record.zi_cmd == ZINJECT_PANIC) { if (raw != NULL || range != NULL || type != TYPE_INVAL || - level != 0 || device != NULL || record.zi_duration != 0) { + level != 0 || device != NULL) { (void) fprintf(stderr, "panic (-p) incompatible with " "other options\n"); usage(); @@ -886,7 +899,7 @@ main(int argc, char **argv) if (argv[1] != NULL) record.zi_type = atoi(argv[1]); dataset[0] = '\0'; - } else if (record.zi_duration != 0) { + } else if (record.zi_cmd == ZINJECT_IGNORED_WRITES) { if (nowrites == 0) { (void) fprintf(stderr, "-s or -g meaningless " "without -I (ignore writes)\n"); @@ -940,6 +953,7 @@ main(int argc, char **argv) return (1); } + record.zi_cmd = ZINJECT_DATA_FAULT; if (translate_record(type, argv[0], range, level, &record, pool, dataset) != 0) return (1); Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Mon Feb 25 11:22:54 2013 (r247264) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Mon Feb 25 12:33:31 2013 (r247265) @@ -45,6 +45,9 @@ int aok; uint64_t physmem; vnode_t *rootdir = (vnode_t *)0xabcd1234; char hw_serial[HW_HOSTID_LEN]; +#ifdef illumos +kmutex_t cpu_lock; +#endif struct utsname utsname = { "userland", "libzpool", "1", "1", "na" @@ -842,6 +845,28 @@ ddi_strtoull(const char *str, char **npt return (0); } +#ifdef illumos +/* ARGSUSED */ +cyclic_id_t +cyclic_add(cyc_handler_t *hdlr, cyc_time_t *when) +{ + return (1); +} + +/* ARGSUSED */ +void +cyclic_remove(cyclic_id_t id) +{ +} + +/* ARGSUSED */ +int +cyclic_reprogram(cyclic_id_t id, hrtime_t expiration) +{ + return (1); +} +#endif + /* * ========================================================================= * kernel emulation setup & teardown @@ -875,6 +900,10 @@ kernel_init(int mode) system_taskq_init(); +#ifdef illumos + mutex_init(&cpu_lock, NULL, MUTEX_DEFAULT, NULL); +#endif + spa_init(mode); } Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Mon Feb 25 11:22:54 2013 (r247264) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Mon Feb 25 12:33:31 2013 (r247265) @@ -457,6 +457,9 @@ extern vnode_t *rootdir; extern void delay(clock_t ticks); +#define SEC_TO_TICK(sec) ((sec) * hz) +#define NSEC_TO_TICK(usec) ((usec) / (NANOSEC / hz)) + #define gethrestime_sec() time(NULL) #define gethrestime(t) \ do {\ @@ -624,6 +627,36 @@ typedef uint32_t idmap_rid_t; #define ERESTART (-1) #endif +#ifdef illumos +/* + * Cyclic information + */ +extern kmutex_t cpu_lock; + +typedef uintptr_t cyclic_id_t; +typedef uint16_t cyc_level_t; +typedef void (*cyc_func_t)(void *); + +#define CY_LOW_LEVEL 0 +#define CY_INFINITY INT64_MAX +#define CYCLIC_NONE ((cyclic_id_t)0) + +typedef struct cyc_time { + hrtime_t cyt_when; + hrtime_t cyt_interval; +} cyc_time_t; + +typedef struct cyc_handler { + cyc_func_t cyh_func; + void *cyh_arg; + cyc_level_t cyh_level; +} cyc_handler_t; + +extern cyclic_id_t cyclic_add(cyc_handler_t *, cyc_time_t *); +extern void cyclic_remove(cyclic_id_t); +extern int cyclic_reprogram(cyclic_id_t, hrtime_t); +#endif /* illumos */ + #ifdef __cplusplus } #endif Modified: head/sys/cddl/compat/opensolaris/sys/time.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/time.h Mon Feb 25 11:22:54 2013 (r247264) +++ head/sys/cddl/compat/opensolaris/sys/time.h Mon Feb 25 12:33:31 2013 (r247265) @@ -46,6 +46,9 @@ typedef longlong_t hrtime_t; ((ts)->tv_sec < INT64_MIN || (ts)->tv_sec > INT64_MAX) #endif +#define SEC_TO_TICK(sec) ((sec) * hz) +#define NSEC_TO_TICK(usec) ((usec) / (NANOSEC / hz)) + #ifdef _KERNEL static __inline hrtime_t gethrtime(void) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Feb 25 11:22:54 2013 (r247264) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Feb 25 12:33:31 2013 (r247265) @@ -22,6 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 Martin Matuska . All rights reserved. */ /* @@ -141,6 +142,10 @@ uint_t zio_taskq_basedc = 80; /* base boolean_t spa_create_process = B_TRUE; /* no process ==> no sysdc */ extern int zfs_sync_pass_deferred_free; +#ifndef illumos +extern void spa_deadman(void *arg); +#endif + /* * This (illegal) pool name is used when temporarily importing a spa_t in order * to get the vdev stats associated with the imported devices. @@ -6258,6 +6263,17 @@ spa_sync(spa_t *spa, uint64_t txg) tx = dmu_tx_create_assigned(dp, txg); + spa->spa_sync_starttime = gethrtime(); +#ifdef illumos + VERIFY(cyclic_reprogram(spa->spa_deadman_cycid, + spa->spa_sync_starttime + spa->spa_deadman_synctime)); +#else /* FreeBSD */ +#ifdef _KERNEL + callout_reset(&spa->spa_deadman_cycid, + hz * spa->spa_deadman_synctime / NANOSEC, spa_deadman, spa); +#endif +#endif + /* * If we are upgrading to SPA_VERSION_RAIDZ_DEFLATE this txg, * set spa_deflate if we have no raid-z vdevs. @@ -6386,6 +6402,14 @@ spa_sync(spa_t *spa, uint64_t txg) } dmu_tx_commit(tx); +#ifdef illumos + VERIFY(cyclic_reprogram(spa->spa_deadman_cycid, CY_INFINITY)); +#else /* FreeBSD */ +#ifdef _KERNEL + callout_drain(&spa->spa_deadman_cycid); +#endif +#endif + /* * Clear the dirty config list. */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Mon Feb 25 11:22:54 2013 (r247264) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Mon Feb 25 12:33:31 2013 (r247265) @@ -22,10 +22,12 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright 2013 Martin Matuska . All rights reserved. */ #include #include +#include #include #include #include @@ -253,6 +255,52 @@ TUNABLE_INT("vfs.zfs.recover", &zfs_reco SYSCTL_INT(_vfs_zfs, OID_AUTO, recover, CTLFLAG_RDTUN, &zfs_recover, 0, "Try to recover from otherwise-fatal errors."); +extern int zfs_txg_synctime_ms; + +/* + * Expiration time in units of zfs_txg_synctime_ms. This value has two + * meanings. First it is used to determine when the spa_deadman logic + * should fire. By default the spa_deadman will fire if spa_sync has + * not completed in 1000 * zfs_txg_synctime_ms (i.e. 1000 seconds). + * Secondly, the value determines if an I/O is considered "hung". + * Any I/O that has not completed in zfs_deadman_synctime is considered + * "hung" resulting in a system panic. + * 1000 zfs_txg_synctime_ms (i.e. 1000 seconds). + */ +uint64_t zfs_deadman_synctime = 1000ULL; +TUNABLE_QUAD("vfs.zfs.deadman_synctime", &zfs_deadman_synctime); +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_synctime, CTLFLAG_RDTUN, + &zfs_deadman_synctime, 0, + "Stalled ZFS I/O expiration time in units of vfs.zfs.txg_synctime_ms"); + +/* + * Default value of -1 for zfs_deadman_enabled is resolved in + * zfs_deadman_init() + */ +int zfs_deadman_enabled = -1; +TUNABLE_INT("vfs.zfs.deadman_enabled", &zfs_deadman_enabled); +SYSCTL_INT(_vfs_zfs, OID_AUTO, deadman_enabled, CTLFLAG_RDTUN, + &zfs_deadman_enabled, 0, "Kernel panic on stalled ZFS I/O"); + +#ifndef illumos +#ifdef _KERNEL +static void +zfs_deadman_init() +{ + /* + * If we are not i386 or amd64 or in a virtual machine, + * disable ZFS deadman thread by default + */ + if (zfs_deadman_enabled == -1) { +#if defined(__amd64__) || defined(__i386__) + zfs_deadman_enabled = (vm_guest == VM_GUEST_NO) ? 1 : 0; +#else + zfs_deadman_enabled = 0; +#endif + } +} +#endif /* _KERNEL */ +#endif /* !illumos */ /* * ========================================================================== @@ -422,6 +470,23 @@ spa_lookup(const char *name) } /* + * Fires when spa_sync has not completed within zfs_deadman_synctime_ms. + * If the zfs_deadman_enabled flag is set then it inspects all vdev queues + * looking for potentially hung I/Os. + */ +void +spa_deadman(void *arg) +{ + spa_t *spa = arg; + + zfs_dbgmsg("slow spa_sync: started %llu seconds ago, calls %llu", + (gethrtime() - spa->spa_sync_starttime) / NANOSEC, + ++spa->spa_deadman_calls); + if (zfs_deadman_enabled) + vdev_deadman(spa->spa_root_vdev); +} + +/* * Create an uninitialized spa_t with the given name. Requires * spa_namespace_lock. The caller must ensure that the spa_t doesn't already * exist by calling spa_lookup() first. @@ -431,6 +496,10 @@ spa_add(const char *name, nvlist_t *conf { spa_t *spa; spa_config_dirent_t *dp; +#ifdef illumos + cyc_handler_t hdlr; + cyc_time_t when; +#endif ASSERT(MUTEX_HELD(&spa_namespace_lock)); @@ -462,6 +531,32 @@ spa_add(const char *name, nvlist_t *conf spa->spa_proc = &p0; spa->spa_proc_state = SPA_PROC_NONE; +#ifdef illumos + hdlr.cyh_func = spa_deadman; + hdlr.cyh_arg = spa; + hdlr.cyh_level = CY_LOW_LEVEL; +#endif + + spa->spa_deadman_synctime = zfs_deadman_synctime * + zfs_txg_synctime_ms * MICROSEC; + +#ifdef illumos + /* + * This determines how often we need to check for hung I/Os after + * the cyclic has already fired. Since checking for hung I/Os is + * an expensive operation we don't want to check too frequently. + * Instead wait for 5 synctimes before checking again. + */ + when.cyt_interval = 5ULL * zfs_txg_synctime_ms * MICROSEC; + when.cyt_when = CY_INFINITY; + mutex_enter(&cpu_lock); + spa->spa_deadman_cycid = cyclic_add(&hdlr, &when); + mutex_exit(&cpu_lock); +#else /* !illumos */ +#ifdef _KERNEL + callout_init(&spa->spa_deadman_cycid, CALLOUT_MPSAFE); +#endif +#endif refcount_create(&spa->spa_refcount); spa_config_lock_init(spa); @@ -544,6 +639,18 @@ spa_remove(spa_t *spa) nvlist_free(spa->spa_load_info); spa_config_set(spa, NULL); +#ifdef illumos + mutex_enter(&cpu_lock); + if (spa->spa_deadman_cycid != CYCLIC_NONE) + cyclic_remove(spa->spa_deadman_cycid); + mutex_exit(&cpu_lock); + spa->spa_deadman_cycid = CYCLIC_NONE; +#else /* !illumos */ +#ifdef _KERNEL + callout_drain(&spa->spa_deadman_cycid); +#endif +#endif + refcount_destroy(&spa->spa_refcount); spa_config_lock_destroy(spa); @@ -1511,6 +1618,12 @@ spa_prev_software_version(spa_t *spa) } uint64_t +spa_deadman_synctime(spa_t *spa) +{ + return (spa->spa_deadman_synctime); +} + +uint64_t dva_get_dsize_sync(spa_t *spa, const dva_t *dva) { uint64_t asize = DVA_GET_ASIZE(dva); @@ -1605,7 +1718,9 @@ spa_init(int mode) spa_mode_global = mode; #ifdef illumos -#ifndef _KERNEL +#ifdef _KERNEL + spa_arch_init(); +#else if (spa_mode_global != FREAD && dprintf_find_string("watch")) { arc_procfd = open("/proc/self/ctl", O_WRONLY); if (arc_procfd == -1) { @@ -1629,6 +1744,11 @@ spa_init(int mode) zpool_feature_init(); spa_config_load(); l2arc_start(); +#ifndef illumos +#ifdef _KERNEL + zfs_deadman_init(); +#endif +#endif /* !illumos */ } void Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Mon Feb 25 11:22:54 2013 (r247264) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Mon Feb 25 12:33:31 2013 (r247265) @@ -599,6 +599,7 @@ extern boolean_t spa_suspended(spa_t *sp extern uint64_t spa_bootfs(spa_t *spa); extern uint64_t spa_delegation(spa_t *spa); extern objset_t *spa_meta_objset(spa_t *spa); +extern uint64_t spa_deadman_synctime(spa_t *spa); /* Miscellaneous support routines */ extern void spa_activate_mos_feature(spa_t *spa, const char *feature); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_boot.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_boot.h Mon Feb 25 11:22:54 2013 (r247264) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_boot.h Mon Feb 25 12:33:31 2013 (r247265) @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + #ifndef _SYS_SPA_BOOT_H #define _SYS_SPA_BOOT_H @@ -35,6 +39,8 @@ extern "C" { extern char *spa_get_bootprop(char *prop); extern void spa_free_bootprop(char *prop); +extern void spa_arch_init(void); + #ifdef __cplusplus } #endif Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Mon Feb 25 11:22:54 2013 (r247264) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Mon Feb 25 12:33:31 2013 (r247265) @@ -22,6 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright 2013 Martin Matuska . All rights reserved. */ #ifndef _SYS_SPA_IMPL_H @@ -230,6 +231,16 @@ struct spa { uint64_t spa_feat_for_write_obj; /* required to write to pool */ uint64_t spa_feat_for_read_obj; /* required to read from pool */ uint64_t spa_feat_desc_obj; /* Feature descriptions */ +#ifdef illumos + cyclic_id_t spa_deadman_cycid; /* cyclic id */ +#else /* FreeBSD */ +#ifdef _KERNEL + struct callout spa_deadman_cycid; /* callout id */ +#endif +#endif /* illumos */ + uint64_t spa_deadman_calls; /* number of deadman calls */ + uint64_t spa_sync_starttime; /* starting time fo spa_sync */ + uint64_t spa_deadman_synctime; /* deadman expiration timer */ /* * spa_refcnt & spa_config_lock must be the last elements * because refcount_t changes size based on compilation options. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Mon Feb 25 11:22:54 2013 (r247264) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Mon Feb 25 12:33:31 2013 (r247265) @@ -80,6 +80,7 @@ extern void vdev_metaslab_fini(vdev_t *v extern void vdev_metaslab_set_size(vdev_t *); extern void vdev_expand(vdev_t *vd, uint64_t txg); extern void vdev_split(vdev_t *vd); +extern void vdev_deadman(vdev_t *vd); extern void vdev_get_stats(vdev_t *vd, vdev_stat_t *vs); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Mon Feb 25 11:22:54 2013 (r247264) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Mon Feb 25 12:33:31 2013 (r247265) @@ -104,6 +104,8 @@ struct vdev_queue { avl_tree_t vq_read_tree; avl_tree_t vq_write_tree; avl_tree_t vq_pending_tree; + uint64_t vq_io_complete_ts; + uint64_t vq_io_delta_ts; kmutex_t vq_lock; }; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Mon Feb 25 11:22:54 2013 (r247264) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Mon Feb 25 12:33:31 2013 (r247265) @@ -22,6 +22,10 @@ * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. + */ #ifndef _SYS_ZFS_CONTEXT_H #define _SYS_ZFS_CONTEXT_H @@ -88,6 +92,11 @@ extern "C" { #include #include #include +#ifdef illumos +#include +#else /* FreeBSD */ +#include +#endif #include Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Mon Feb 25 11:22:54 2013 (r247264) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Mon Feb 25 12:33:31 2013 (r247265) @@ -246,12 +246,24 @@ typedef struct zinject_record { uint32_t zi_iotype; int32_t zi_duration; uint64_t zi_timer; + uint32_t zi_cmd; + uint32_t zi_pad; } zinject_record_t; #define ZINJECT_NULL 0x1 #define ZINJECT_FLUSH_ARC 0x2 #define ZINJECT_UNLOAD_SPA 0x4 +typedef enum zinject_type { + ZINJECT_UNINITIALIZED, + ZINJECT_DATA_FAULT, + ZINJECT_DEVICE_FAULT, + ZINJECT_LABEL_FAULT, + ZINJECT_IGNORED_WRITES, + ZINJECT_PANIC, + ZINJECT_DELAY_IO, +} zinject_type_t; + typedef struct zfs_share { uint64_t z_exportdata; uint64_t z_sharedata; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Mon Feb 25 11:22:54 2013 (r247264) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Mon Feb 25 12:33:31 2013 (r247265) @@ -443,6 +443,7 @@ struct zio { uint64_t io_offset; uint64_t io_deadline; + uint64_t io_timestamp; avl_node_t io_offset_node; avl_node_t io_deadline_node; avl_tree_t *io_vdev_tree; @@ -596,6 +597,7 @@ extern int zio_handle_fault_injection(zi extern int zio_handle_device_injection(vdev_t *vd, zio_t *zio, int error); extern int zio_handle_label_injection(zio_t *zio, int error); extern void zio_handle_ignored_writes(zio_t *zio); +extern uint64_t zio_handle_io_delay(zio_t *zio); /* * Checksum ereport functions Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Feb 25 11:22:54 2013 (r247264) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Feb 25 12:33:31 2013 (r247265) @@ -3173,3 +3173,41 @@ vdev_split(vdev_t *vd) } vdev_propagate_state(cvd); } + +void +vdev_deadman(vdev_t *vd) +{ + for (int c = 0; c < vd->vdev_children; c++) { + vdev_t *cvd = vd->vdev_child[c]; + + vdev_deadman(cvd); + } + + if (vd->vdev_ops->vdev_op_leaf) { + vdev_queue_t *vq = &vd->vdev_queue; + + mutex_enter(&vq->vq_lock); + if (avl_numnodes(&vq->vq_pending_tree) > 0) { + spa_t *spa = vd->vdev_spa; + zio_t *fio; + uint64_t delta; + + /* + * Look at the head of all the pending queues, + * if any I/O has been outstanding for longer than + * the spa_deadman_synctime we panic the system. + */ + fio = avl_first(&vq->vq_pending_tree); + delta = ddi_get_lbolt64() - fio->io_timestamp; + if (delta > NSEC_TO_TICK(spa_deadman_synctime(spa))) { + zfs_dbgmsg("SLOW IO: zio timestamp %llu, " + "delta %llu, last io %llu", + fio->io_timestamp, delta, + vq->vq_io_complete_ts); + fm_panic("I/O to pool '%s' appears to be " + "hung.", spa_name(spa)); + } + } + mutex_exit(&vq->vq_lock); + } +} Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Mon Feb 25 11:22:54 2013 (r247264) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Mon Feb 25 12:33:31 2013 (r247265) @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + #include #include #include @@ -315,6 +319,7 @@ again: zio_buf_alloc(size), size, fio->io_type, ZIO_PRIORITY_AGG, flags | ZIO_FLAG_DONT_CACHE | ZIO_FLAG_DONT_QUEUE, vdev_queue_agg_io_done, NULL); + aio->io_timestamp = fio->io_timestamp; nio = fio; do { @@ -386,7 +391,8 @@ vdev_queue_io(zio_t *zio) mutex_enter(&vq->vq_lock); - zio->io_deadline = (ddi_get_lbolt64() >> zfs_vdev_time_shift) + + zio->io_timestamp = ddi_get_lbolt64(); + zio->io_deadline = (zio->io_timestamp >> zfs_vdev_time_shift) + zio->io_priority; vdev_queue_io_add(vq, zio); @@ -411,10 +417,16 @@ vdev_queue_io_done(zio_t *zio) { vdev_queue_t *vq = &zio->io_vd->vdev_queue; + if (zio_injection_enabled) + delay(SEC_TO_TICK(zio_handle_io_delay(zio))); + mutex_enter(&vq->vq_lock); avl_remove(&vq->vq_pending_tree, zio); + vq->vq_io_complete_ts = ddi_get_lbolt64(); + vq->vq_io_delta_ts = vq->vq_io_complete_ts - zio->io_timestamp; + for (int i = 0; i < zfs_vdev_ramp_rate; i++) { zio_t *nio = vdev_queue_io_to_issue(vq, zfs_vdev_max_pending); if (nio == NULL) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c Mon Feb 25 11:22:54 2013 (r247264) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c Mon Feb 25 12:33:31 2013 (r247265) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ /* @@ -147,14 +148,8 @@ zio_handle_fault_injection(zio_t *zio, i for (handler = list_head(&inject_handlers); handler != NULL; handler = list_next(&inject_handlers, handler)) { - /* Ignore errors not destined for this pool */ - if (zio->io_spa != handler->zi_spa) - continue; - - /* Ignore device errors and panic injection */ - if (handler->zi_record.zi_guid != 0 || - handler->zi_record.zi_func[0] != '\0' || - handler->zi_record.zi_duration != 0) + if (zio->io_spa != handler->zi_spa || + handler->zi_record.zi_cmd != ZINJECT_DATA_FAULT) continue; /* If this handler matches, return EIO */ @@ -197,10 +192,7 @@ zio_handle_label_injection(zio_t *zio, i uint64_t start = handler->zi_record.zi_start; uint64_t end = handler->zi_record.zi_end; - /* Ignore device only faults or panic injection */ - if (handler->zi_record.zi_start == 0 || - handler->zi_record.zi_func[0] != '\0' || - handler->zi_record.zi_duration != 0) + if (handler->zi_record.zi_cmd != ZINJECT_LABEL_FAULT) continue; /* @@ -246,13 +238,7 @@ zio_handle_device_injection(vdev_t *vd, for (handler = list_head(&inject_handlers); handler != NULL; handler = list_next(&inject_handlers, handler)) { - /* - * Ignore label specific faults, panic injection - * or fake writes - */ - if (handler->zi_record.zi_start != 0 || - handler->zi_record.zi_func[0] != '\0' || - handler->zi_record.zi_duration != 0) + if (handler->zi_record.zi_cmd != ZINJECT_DEVICE_FAULT) continue; if (vd->vdev_guid == handler->zi_record.zi_guid) { @@ -316,10 +302,8 @@ zio_handle_ignored_writes(zio_t *zio) handler = list_next(&inject_handlers, handler)) { /* Ignore errors not destined for this pool */ - if (zio->io_spa != handler->zi_spa) - continue; - - if (handler->zi_record.zi_duration == 0) + if (zio->io_spa != handler->zi_spa || + handler->zi_record.zi_cmd != ZINJECT_IGNORED_WRITES) continue; /* @@ -355,11 +339,8 @@ spa_handle_ignored_writes(spa_t *spa) for (handler = list_head(&inject_handlers); handler != NULL; handler = list_next(&inject_handlers, handler)) { - /* Ignore errors not destined for this pool */ - if (spa != handler->zi_spa) - continue; - - if (handler->zi_record.zi_duration == 0) + if (spa != handler->zi_spa || + handler->zi_record.zi_cmd != ZINJECT_IGNORED_WRITES) continue; if (handler->zi_record.zi_duration > 0) { @@ -379,6 +360,34 @@ spa_handle_ignored_writes(spa_t *spa) rw_exit(&inject_lock); } +uint64_t +zio_handle_io_delay(zio_t *zio) +{ + vdev_t *vd = zio->io_vd; + inject_handler_t *handler; + uint64_t seconds = 0; + + if (zio_injection_enabled == 0) + return (0); + + rw_enter(&inject_lock, RW_READER); + + for (handler = list_head(&inject_handlers); handler != NULL; + handler = list_next(&inject_handlers, handler)) { + + if (handler->zi_record.zi_cmd != ZINJECT_DELAY_IO) + continue; + + if (vd->vdev_guid == handler->zi_record.zi_guid) { + seconds = handler->zi_record.zi_timer; + break; + } + + } + rw_exit(&inject_lock); + return (seconds); +} + /* * Create a new handler for the given record. We add it to the list, adding * a reference to the spa_t in the process. We increment zio_injection_enabled, From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 14:06:25 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 74CFBB55; Mon, 25 Feb 2013 14:06:25 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4E476E81; Mon, 25 Feb 2013 14:06:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PE6PMi094824; Mon, 25 Feb 2013 14:06:25 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PE6P2K094823; Mon, 25 Feb 2013 14:06:25 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201302251406.r1PE6P2K094823@svn.freebsd.org> From: Matt Jacob Date: Mon, 25 Feb 2013 14:06:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247266 - head/sys/dev/sym X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 14:06:25 -0000 Author: mjacob Date: Mon Feb 25 14:06:24 2013 New Revision: 247266 URL: http://svnweb.freebsd.org/changeset/base/247266 Log: Don't try and negotiate sync mode if either period or offset are zero. PR: kern/163064 Partially Submitted by: Peter MFC after: 1 month Modified: head/sys/dev/sym/sym_hipd.c Modified: head/sys/dev/sym/sym_hipd.c ============================================================================== --- head/sys/dev/sym/sym_hipd.c Mon Feb 25 12:33:31 2013 (r247265) +++ head/sys/dev/sym/sym_hipd.c Mon Feb 25 14:06:24 2013 (r247266) @@ -8211,8 +8211,13 @@ static void sym_update_trans(hcb_p np, t * Scale against driver configuration limits. */ if (tip->width > SYM_SETUP_MAX_WIDE) tip->width = SYM_SETUP_MAX_WIDE; - if (tip->offset > SYM_SETUP_MAX_OFFS) tip->offset = SYM_SETUP_MAX_OFFS; - if (tip->period < SYM_SETUP_MIN_SYNC) tip->period = SYM_SETUP_MIN_SYNC; + if (tip->period && tip->offset) { + if (tip->offset > SYM_SETUP_MAX_OFFS) tip->offset = SYM_SETUP_MAX_OFFS; + if (tip->period < SYM_SETUP_MIN_SYNC) tip->period = SYM_SETUP_MIN_SYNC; + } else { + tip->offset = 0; + tip->period = 0; + } /* * Scale against actual controller BUS width. @@ -8231,21 +8236,23 @@ static void sym_update_trans(hcb_p np, t /* * Scale period factor and offset against controller limits. */ - if (tip->options & PPR_OPT_DT) { - if (tip->period < np->minsync_dt) - tip->period = np->minsync_dt; - if (tip->period > np->maxsync_dt) - tip->period = np->maxsync_dt; - if (tip->offset > np->maxoffs_dt) - tip->offset = np->maxoffs_dt; - } - else { - if (tip->period < np->minsync) - tip->period = np->minsync; - if (tip->period > np->maxsync) - tip->period = np->maxsync; - if (tip->offset > np->maxoffs) - tip->offset = np->maxoffs; + if (tip->offset && tip->period) { + if (tip->options & PPR_OPT_DT) { + if (tip->period < np->minsync_dt) + tip->period = np->minsync_dt; + if (tip->period > np->maxsync_dt) + tip->period = np->maxsync_dt; + if (tip->offset > np->maxoffs_dt) + tip->offset = np->maxoffs_dt; + } + else { + if (tip->period < np->minsync) + tip->period = np->minsync; + if (tip->period > np->maxsync) + tip->period = np->maxsync; + if (tip->offset > np->maxoffs) + tip->offset = np->maxoffs; + } } } From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 16:22:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3D292198; Mon, 25 Feb 2013 16:22:41 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1DF5A793; Mon, 25 Feb 2013 16:22:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PGMfTI036451; Mon, 25 Feb 2013 16:22:41 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PGMeSn036450; Mon, 25 Feb 2013 16:22:40 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <201302251622.r1PGMeSn036450@svn.freebsd.org> From: Andrew Gallatin Date: Mon, 25 Feb 2013 16:22:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247268 - head/sys/dev/mxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 16:22:41 -0000 Author: gallatin Date: Mon Feb 25 16:22:40 2013 New Revision: 247268 URL: http://svnweb.freebsd.org/changeset/base/247268 Log: Several cleanups and fixes to mxge: - Remove vestigial null pointer tests after malloc(..., M_WAITOK). - Remove vestigal qualhack union - Use strlcpy() instead of the error-prone strncpy() when parsing EEPROM and copying strings - Check the MAC address in the EEPROM strings more strictly. - Expand the macro MXGE_NEXT_STRING() at its only user. Due to a typo, the macro was very confusing. - Remove unnecessary buffer limit check. The buffer is double-NUL terminated per construction. PR: kern/176369 Submitted by: Christoph Mallon Modified: head/sys/dev/mxge/if_mxge.c Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Mon Feb 25 16:13:21 2013 (r247267) +++ head/sys/dev/mxge/if_mxge.c Mon Feb 25 16:22:40 2013 (r247268) @@ -288,42 +288,43 @@ mxge_dma_free(mxge_dma_t *dma) static int mxge_parse_strings(mxge_softc_t *sc) { -#define MXGE_NEXT_STRING(p) while(ptr < limit && *ptr++) - - char *ptr, *limit; + char *ptr; int i, found_mac, found_sn2; + char *endptr; ptr = sc->eeprom_strings; - limit = sc->eeprom_strings + MXGE_EEPROM_STRINGS_SIZE; found_mac = 0; found_sn2 = 0; - while (ptr < limit && *ptr != '\0') { - if (memcmp(ptr, "MAC=", 4) == 0) { - ptr += 1; - sc->mac_addr_string = ptr; - for (i = 0; i < 6; i++) { - ptr += 3; - if ((ptr + 2) > limit) + while (*ptr != '\0') { + if (strncmp(ptr, "MAC=", 4) == 0) { + ptr += 4; + for (i = 0;;) { + sc->mac_addr[i] = strtoul(ptr, &endptr, 16); + if (endptr - ptr != 2) + goto abort; + ptr = endptr; + if (++i == 6) + break; + if (*ptr++ != ':') goto abort; - sc->mac_addr[i] = strtoul(ptr, NULL, 16); - found_mac = 1; } - } else if (memcmp(ptr, "PC=", 3) == 0) { + found_mac = 1; + } else if (strncmp(ptr, "PC=", 3) == 0) { ptr += 3; - strncpy(sc->product_code_string, ptr, - sizeof (sc->product_code_string) - 1); - } else if (!found_sn2 && (memcmp(ptr, "SN=", 3) == 0)) { + strlcpy(sc->product_code_string, ptr, + sizeof(sc->product_code_string)); + } else if (!found_sn2 && (strncmp(ptr, "SN=", 3) == 0)) { ptr += 3; - strncpy(sc->serial_number_string, ptr, - sizeof (sc->serial_number_string) - 1); - } else if (memcmp(ptr, "SN2=", 4) == 0) { + strlcpy(sc->serial_number_string, ptr, + sizeof(sc->serial_number_string)); + } else if (strncmp(ptr, "SN2=", 4) == 0) { /* SN2 takes precedence over SN */ ptr += 4; found_sn2 = 1; - strncpy(sc->serial_number_string, ptr, - sizeof (sc->serial_number_string) - 1); + strlcpy(sc->serial_number_string, ptr, + sizeof(sc->serial_number_string)); } - MXGE_NEXT_STRING(ptr); + while (*ptr++ != '\0') {} } if (found_mac) @@ -649,12 +650,6 @@ abort: return (mxge_load_firmware(sc, 0)); } -union qualhack -{ - const char *ro_char; - char *rw_char; -}; - static int mxge_validate_firmware(mxge_softc_t *sc, const mcp_gen_header_t *hdr) { @@ -667,7 +662,7 @@ mxge_validate_firmware(mxge_softc_t *sc, } /* save firmware version for sysctl */ - strncpy(sc->fw_version, hdr->version, sizeof (sc->fw_version)); + strlcpy(sc->fw_version, hdr->version, sizeof(sc->fw_version)); if (mxge_verbose) device_printf(sc->dev, "firmware id: %s\n", hdr->version); @@ -3325,8 +3320,6 @@ mxge_alloc_slice_rings(struct mxge_slice size_t bytes; int err, i; - err = ENOMEM; - /* allocate per-slice receive resources */ ss->rx_small.mask = ss->rx_big.mask = rx_ring_entries - 1; @@ -3335,24 +3328,16 @@ mxge_alloc_slice_rings(struct mxge_slice /* allocate the rx shadow rings */ bytes = rx_ring_entries * sizeof (*ss->rx_small.shadow); ss->rx_small.shadow = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK); - if (ss->rx_small.shadow == NULL) - return err; bytes = rx_ring_entries * sizeof (*ss->rx_big.shadow); ss->rx_big.shadow = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK); - if (ss->rx_big.shadow == NULL) - return err; /* allocate the rx host info rings */ bytes = rx_ring_entries * sizeof (*ss->rx_small.info); ss->rx_small.info = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK); - if (ss->rx_small.info == NULL) - return err; bytes = rx_ring_entries * sizeof (*ss->rx_big.info); ss->rx_big.info = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK); - if (ss->rx_big.info == NULL) - return err; /* allocate the rx busdma resources */ err = bus_dma_tag_create(sc->parent_dmat, /* parent */ @@ -3449,8 +3434,6 @@ mxge_alloc_slice_rings(struct mxge_slice bytes = 8 + sizeof (*ss->tx.req_list) * (ss->tx.max_desc + 4); ss->tx.req_bytes = malloc(bytes, M_DEVBUF, M_WAITOK); - if (ss->tx.req_bytes == NULL) - return err; /* ensure req_list entries are aligned to 8 bytes */ ss->tx.req_list = (mcp_kreq_ether_send_t *) ((unsigned long)(ss->tx.req_bytes + 7) & ~7UL); @@ -3459,14 +3442,10 @@ mxge_alloc_slice_rings(struct mxge_slice bytes = sizeof (*ss->tx.seg_list) * ss->tx.max_desc; ss->tx.seg_list = (bus_dma_segment_t *) malloc(bytes, M_DEVBUF, M_WAITOK); - if (ss->tx.seg_list == NULL) - return err; /* allocate the tx host info ring */ bytes = tx_ring_entries * sizeof (*ss->tx.info); ss->tx.info = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK); - if (ss->tx.info == NULL) - return err; /* allocate the tx busdma resources */ err = bus_dma_tag_create(sc->parent_dmat, /* parent */ From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 16:25:39 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2C79550F; Mon, 25 Feb 2013 16:25:39 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1E5CD7C5; Mon, 25 Feb 2013 16:25:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PGPd6S036890; Mon, 25 Feb 2013 16:25:39 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PGPcg4036889; Mon, 25 Feb 2013 16:25:38 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201302251625.r1PGPcg4036889@svn.freebsd.org> From: Tim Kientzle Date: Mon, 25 Feb 2013 16:25:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247269 - head/sbin/fsck_ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 16:25:39 -0000 Author: kientzle Date: Mon Feb 25 16:25:38 2013 New Revision: 247269 URL: http://svnweb.freebsd.org/changeset/base/247269 Log: Fix ARM build by assigning the computed time here to a variable of the right type for printf. Modified: head/sbin/fsck_ffs/fsutil.c Modified: head/sbin/fsck_ffs/fsutil.c ============================================================================== --- head/sbin/fsck_ffs/fsutil.c Mon Feb 25 16:22:40 2013 (r247268) +++ head/sbin/fsck_ffs/fsutil.c Mon Feb 25 16:25:38 2013 (r247269) @@ -448,8 +448,8 @@ static void printIOstats(void) clock_gettime(CLOCK_REALTIME_PRECISE, &finishpass); timespecsub(&finishpass, &startpass); - printf("Running time: %ld msec\n", - finishpass.tv_sec * 1000 + finishpass.tv_nsec / 1000000); + msec = finishpass.tv_sec * 1000 + finishpass.tv_nsec / 1000000; + printf("Running time: %lld msec\n", msec); printf("buffer reads by type:\n"); for (totalmsec = 0, i = 0; i < BT_NUMBUFTYPES; i++) totalmsec += readtime[i].tv_sec * 1000 + From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 16:47:10 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D7A71C0E; Mon, 25 Feb 2013 16:47:10 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9957887B; Mon, 25 Feb 2013 16:47:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PGlAD4043244; Mon, 25 Feb 2013 16:47:10 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PGl9Mr043242; Mon, 25 Feb 2013 16:47:09 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201302251647.r1PGl9Mr043242@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Mon, 25 Feb 2013 16:47:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247270 - head/usr.sbin/rtadvd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 16:47:10 -0000 Author: des Date: Mon Feb 25 16:47:09 2013 New Revision: 247270 URL: http://svnweb.freebsd.org/changeset/base/247270 Log: - Implement and use usage(). - Document the -C option. - Allow rtadvd to be invoked without any interfaces on the command line, and document that possibility. MFC after: 1 week Modified: head/usr.sbin/rtadvd/rtadvd.8 head/usr.sbin/rtadvd/rtadvd.c Modified: head/usr.sbin/rtadvd/rtadvd.8 ============================================================================== --- head/usr.sbin/rtadvd/rtadvd.8 Mon Feb 25 16:25:38 2013 (r247269) +++ head/usr.sbin/rtadvd/rtadvd.8 Mon Feb 25 16:47:09 2013 (r247270) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 14, 2011 +.Dd February 25, 2013 .Dt RTADVD 8 .Os .Sh NAME @@ -39,13 +39,19 @@ .Nm .Op Fl dDfRs .Op Fl c Ar configfile +.Op Fl C Ar ctlsock .Op Fl M Ar ifname .Op Fl p Ar pidfile -.Ar interface ... +.Op Ar interface ... .Sh DESCRIPTION .Nm sends router advertisement packets to the specified .Ar interfaces . +If no interfaces are specified, +.Nm +will still run, but will not advertise any routes until interfaces are +added using +.Xr rtadvctl 8 . .Pp The program will daemonize itself on invocation. It will then send router advertisement packets periodically, as well @@ -121,6 +127,11 @@ for the configuration file. By default, .Pa /etc/rtadvd.conf is used. +.It Fl C +Specify an alternate location for the control socket used by +.Xr rtadvctl 8 . +The default is +.Pa /var/run/rtadvd.sock . .It Fl d Print debugging information. .It Fl D @@ -185,6 +196,7 @@ The default process ID file. .Ex -std .Sh SEE ALSO .Xr rtadvd.conf 5 , +.Xr rtadvctl 8 , .Xr rtsol 8 .Rs .%A Thomas Narten Modified: head/usr.sbin/rtadvd/rtadvd.c ============================================================================== --- head/usr.sbin/rtadvd/rtadvd.c Mon Feb 25 16:25:38 2013 (r247269) +++ head/usr.sbin/rtadvd/rtadvd.c Mon Feb 25 16:47:09 2013 (r247270) @@ -166,6 +166,15 @@ static void rtmsg_input(struct sockinfo static void set_short_delay(struct ifinfo *); static int check_accept_rtadv(int); +static void +usage(void) +{ + + fprintf(stderr, "usage: rtadvd [-dDfRs] " + "[-c configfile] [-C ctlsock] [-M ifname] [-p pidfile]\n"); + exit(1); +} + int main(int argc, char *argv[]) { @@ -177,7 +186,7 @@ main(int argc, char *argv[]) pid_t pid, otherpid; /* get command line options and arguments */ - while ((ch = getopt(argc, argv, "c:C:dDfM:p:Rs")) != -1) { + while ((ch = getopt(argc, argv, "c:C:dDfhM:p:Rs")) != -1) { switch (ch) { case 'c': conffile = optarg; @@ -209,17 +218,12 @@ main(int argc, char *argv[]) case 'p': pidfilename = optarg; break; + default: + usage(); } } argc -= optind; argv += optind; - if (argc == 0) { - fprintf(stderr, - "usage: rtadvd [-dDfRs] [-c conffile] " - "[-C ctrlsockname] [-M ifname] " - "[-p pidfile] interfaces...\n"); - exit(1); - } logopt = LOG_NDELAY | LOG_PID; if (fflag) From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 17:07:43 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C6A7A3B3; Mon, 25 Feb 2013 17:07:43 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 99900989; Mon, 25 Feb 2013 17:07:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PH7hL8049242; Mon, 25 Feb 2013 17:07:43 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PH7heJ049241; Mon, 25 Feb 2013 17:07:43 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201302251707.r1PH7heJ049241@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Mon, 25 Feb 2013 17:07:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247271 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 17:07:43 -0000 Author: des Date: Mon Feb 25 17:07:42 2013 New Revision: 247271 URL: http://svnweb.freebsd.org/changeset/base/247271 Log: If rtadvd_interfaces is set to "none", start rtadvd without listing any interfaces on the command line. MFC after: 1 week Modified: head/etc/rc.d/rtadvd Modified: head/etc/rc.d/rtadvd ============================================================================== --- head/etc/rc.d/rtadvd Mon Feb 25 16:47:09 2013 (r247270) +++ head/etc/rc.d/rtadvd Mon Feb 25 17:07:42 2013 (r247271) @@ -46,6 +46,8 @@ rtadvd_precmd() fi done ;; + [Nn][Oo][Nn][Ee]) + ;; *) command_args="${rtadvd_interfaces}" ;; From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 17:32:11 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 59D3C844; Mon, 25 Feb 2013 17:32:11 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 33D50A58; Mon, 25 Feb 2013 17:32:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PHWBAX057348; Mon, 25 Feb 2013 17:32:11 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PHWB4q057347; Mon, 25 Feb 2013 17:32:11 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201302251732.r1PHWB4q057347@svn.freebsd.org> From: Joel Dahl Date: Mon, 25 Feb 2013 17:32:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247272 - head/usr.bin/systat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 17:32:11 -0000 Author: joel (doc committer) Date: Mon Feb 25 17:32:10 2013 New Revision: 247272 URL: http://svnweb.freebsd.org/changeset/base/247272 Log: Remove EOL whitespace. Modified: head/usr.bin/systat/systat.1 Modified: head/usr.bin/systat/systat.1 ============================================================================== --- head/usr.bin/systat/systat.1 Mon Feb 25 17:07:42 2013 (r247271) +++ head/usr.bin/systat/systat.1 Mon Feb 25 17:32:10 2013 (r247272) @@ -513,12 +513,12 @@ The following units are recognised: kbit mbyte, gbit, gbyte and auto. .It Cm pps Show statistics in packets per second instead of bytes/bits per second. -A subsequent call of -.Ic pps +A subsequent call of +.Ic pps switches this mode off. .It Cm match Op Ar patterns -Display only interfaces that match pattern provided as an argument. -Patterns should be in shell syntax separated by whitespaces or commas. +Display only interfaces that match pattern provided as an argument. +Patterns should be in shell syntax separated by whitespaces or commas. If this command is called without arguments then all interfaces are displayed. For example: .Pp @@ -528,8 +528,8 @@ This will display em0 and bge1 interface .Pp .Dl match em*, bge*, lo0 .Pp -This will display all -.Ic em +This will display all +.Ic em interfaces, all .Ic bge interfaces and the loopback interface. From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 19:05:42 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F098B258; Mon, 25 Feb 2013 19:05:41 +0000 (UTC) (envelope-from peterj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DCF54F8D; Mon, 25 Feb 2013 19:05:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PJ5fTo085182; Mon, 25 Feb 2013 19:05:41 GMT (envelope-from peterj@svn.freebsd.org) Received: (from peterj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PJ5fKF085179; Mon, 25 Feb 2013 19:05:41 GMT (envelope-from peterj@svn.freebsd.org) Message-Id: <201302251905.r1PJ5fKF085179@svn.freebsd.org> From: Peter Jeremy Date: Mon, 25 Feb 2013 19:05:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247274 - in head: bin/test tools/regression/bin/test X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 19:05:42 -0000 Author: peterj Date: Mon Feb 25 19:05:40 2013 New Revision: 247274 URL: http://svnweb.freebsd.org/changeset/base/247274 Log: Enhance test(1) by adding provision to compare any combination of the access, birth, change and modify times of two files, instead of only being able to compare modify times. The builtin test in sh(1) will automagically acquire the same expansion. Approved by: grog MFC after: 2 weeks Modified: head/bin/test/test.1 head/bin/test/test.c head/tools/regression/bin/test/regress.sh Modified: head/bin/test/test.1 ============================================================================== --- head/bin/test/test.1 Mon Feb 25 18:07:20 2013 (r247273) +++ head/bin/test/test.1 Mon Feb 25 19:05:40 2013 (r247274) @@ -169,15 +169,65 @@ True if .Ar file exists and is a socket. .It Ar file1 Fl nt Ar file2 -True if +True if both +.Ar file1 +and +.Ar file2 +exist and +.Ar file1 +is newer than +.Ar file2 . +.It Ar file1 Fl nt Ns Ar X Ns Ar Y Ar file2 +True if both +.Ar file1 +and +.Ar file2 +exist and .Ar file1 -exists and is newer than +has a more recent last access time +.Pq Ar X Ns = Ns Cm a , +inode creation time +.Pq Ar X Ns = Ns Cm b , +change time +.Pq Ar X Ns = Ns Cm c , +or modification time +.Pq Ar X Ns = Ns Cm m +than the last access time +.Pq Ar Y Ns = Ns Cm a , +inode creation time +.Pq Ar Y Ns = Ns Cm b , +change time +.Pq Ar Y Ns = Ns Cm c , +or modification time +.Pq Ar Y Ns = Ns Cm m +of .Ar file2 . +Note that +.Ic -ntmm +is equivalent to +.Ic -nt . .It Ar file1 Fl ot Ar file2 -True if +True if both +.Ar file1 +and +.Ar file2 +exist and .Ar file1 -exists and is older than +is older than .Ar file2 . +Note that +.Ar file1 +.Ic -ot +.Ar file2 +is equivalent to +.Ar file2 +.Ic -nt +.Ar file1 +.It Ar file1 Fl ot Ns Ar X Ns Ar Y Ar file2 +Equivalent to +.Ar file2 +.Ic -nt Ns Ar Y Ns Ar X +.Ar file1 . .It Ar file1 Fl ef Ar file2 True if .Ar file1 Modified: head/bin/test/test.c ============================================================================== --- head/bin/test/test.c Mon Feb 25 18:07:20 2013 (r247273) +++ head/bin/test/test.c Mon Feb 25 19:05:40 2013 (r247274) @@ -63,7 +63,7 @@ error(const char *msg, ...) "-u"|"-g"|"-k"|"-s"|"-t"|"-z"|"-n"|"-o"|"-O"|"-G"|"-L"|"-S"; binary-operator ::= "="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"| - "-nt"|"-ot"|"-ef"; + "-nt"|"-nt[abcm][abcm]"|"-ot"|"-ot[abcm][abcm])"|"-ef"; operand ::= */ @@ -85,8 +85,38 @@ enum token { FILSUID, FILSGID, FILSTCK, - FILNT, - FILOT, + FILNTAA, + FILNTAB, + FILNTAC, + FILNTAM, + FILNTBA, + FILNTBB, + FILNTBC, + FILNTBM, + FILNTCA, + FILNTCB, + FILNTCC, + FILNTCM, + FILNTMA, + FILNTMB, + FILNTMC, + FILNTMM, + FILOTAA, + FILOTAB, + FILOTAC, + FILOTAM, + FILOTBA, + FILOTBB, + FILOTBC, + FILOTBM, + FILOTCA, + FILOTCB, + FILOTCC, + FILOTCM, + FILOTMA, + FILOTMB, + FILOTMC, + FILOTMM, FILEQ, FILUID, FILGID, @@ -118,9 +148,16 @@ enum token_types { PAREN }; +enum time_types { + ATIME, + BTIME, + CTIME, + MTIME +}; + static struct t_op { - char op_text[4]; - short op_num, op_type; + char op_text[6]; + char op_num, op_type; } const ops [] = { {"-r", FILRD, UNOP}, {"-w", FILWR, UNOP}, @@ -154,8 +191,40 @@ static struct t_op { {"-gt", INTGT, BINOP}, {"-le", INTLE, BINOP}, {"-lt", INTLT, BINOP}, - {"-nt", FILNT, BINOP}, - {"-ot", FILOT, BINOP}, + {"-nt", FILNTMM, BINOP}, + {"-ntaa", FILNTAA, BINOP}, + {"-ntab", FILNTAB, BINOP}, + {"-ntac", FILNTAC, BINOP}, + {"-ntam", FILNTAM, BINOP}, + {"-ntba", FILNTBA, BINOP}, + {"-ntbb", FILNTBB, BINOP}, + {"-ntbc", FILNTBC, BINOP}, + {"-ntbm", FILNTBM, BINOP}, + {"-ntca", FILNTCA, BINOP}, + {"-ntcb", FILNTCB, BINOP}, + {"-ntcc", FILNTCC, BINOP}, + {"-ntcm", FILNTCM, BINOP}, + {"-ntma", FILNTMA, BINOP}, + {"-ntmb", FILNTMB, BINOP}, + {"-ntmc", FILNTMC, BINOP}, + {"-ntmm", FILNTMM, BINOP}, + {"-ot", FILOTMM, BINOP}, + {"-otaa", FILOTAA, BINOP}, + {"-otab", FILOTBB, BINOP}, + {"-otac", FILOTAC, BINOP}, + {"-otam", FILOTAM, BINOP}, + {"-otba", FILOTBA, BINOP}, + {"-otbb", FILOTBB, BINOP}, + {"-otbc", FILOTBC, BINOP}, + {"-otbm", FILOTBM, BINOP}, + {"-otca", FILOTCA, BINOP}, + {"-otcb", FILOTCB, BINOP}, + {"-otcc", FILOTCC, BINOP}, + {"-otcm", FILOTCM, BINOP}, + {"-otma", FILOTMA, BINOP}, + {"-otmb", FILOTMB, BINOP}, + {"-otmc", FILOTMC, BINOP}, + {"-otmm", FILOTMM, BINOP}, {"-ef", FILEQ, BINOP}, {"!", UNOT, BUNOP}, {"-a", BAND, BBINOP}, @@ -180,10 +249,10 @@ static int intcmp(const char *, const ch static int isunopoperand(void); static int islparenoperand(void); static int isrparenoperand(void); -static int newerf(const char *, const char *); +static int newerf(const char *, const char *, enum time_types, + enum time_types); static int nexpr(enum token); static int oexpr(enum token); -static int olderf(const char *, const char *); static int primary(enum token); static void syntax(const char *, const char *); static enum token t_lex(char *); @@ -353,10 +422,70 @@ binop(void) return intcmp(opnd1, opnd2) <= 0; case INTLT: return intcmp(opnd1, opnd2) < 0; - case FILNT: - return newerf (opnd1, opnd2); - case FILOT: - return olderf (opnd1, opnd2); + case FILNTAA: + return newerf(opnd1, opnd2, ATIME, ATIME); + case FILNTAB: + return newerf(opnd1, opnd2, ATIME, BTIME); + case FILNTAC: + return newerf(opnd1, opnd2, ATIME, CTIME); + case FILNTAM: + return newerf(opnd1, opnd2, ATIME, MTIME); + case FILNTBA: + return newerf(opnd1, opnd2, BTIME, ATIME); + case FILNTBB: + return newerf(opnd1, opnd2, BTIME, BTIME); + case FILNTBC: + return newerf(opnd1, opnd2, BTIME, CTIME); + case FILNTBM: + return newerf(opnd1, opnd2, BTIME, MTIME); + case FILNTCA: + return newerf(opnd1, opnd2, CTIME, ATIME); + case FILNTCB: + return newerf(opnd1, opnd2, CTIME, BTIME); + case FILNTCC: + return newerf(opnd1, opnd2, CTIME, CTIME); + case FILNTCM: + return newerf(opnd1, opnd2, CTIME, MTIME); + case FILNTMA: + return newerf(opnd1, opnd2, MTIME, ATIME); + case FILNTMB: + return newerf(opnd1, opnd2, MTIME, BTIME); + case FILNTMC: + return newerf(opnd1, opnd2, MTIME, CTIME); + case FILNTMM: + return newerf(opnd1, opnd2, MTIME, MTIME); + case FILOTAA: + return newerf(opnd2, opnd1, ATIME, ATIME); + case FILOTAB: + return newerf(opnd2, opnd1, BTIME, ATIME); + case FILOTAC: + return newerf(opnd2, opnd1, CTIME, ATIME); + case FILOTAM: + return newerf(opnd2, opnd1, MTIME, ATIME); + case FILOTBA: + return newerf(opnd2, opnd1, ATIME, BTIME); + case FILOTBB: + return newerf(opnd2, opnd1, BTIME, BTIME); + case FILOTBC: + return newerf(opnd2, opnd1, CTIME, BTIME); + case FILOTBM: + return newerf(opnd2, opnd1, MTIME, BTIME); + case FILOTCA: + return newerf(opnd2, opnd1, ATIME, CTIME); + case FILOTCB: + return newerf(opnd2, opnd1, BTIME, CTIME); + case FILOTCC: + return newerf(opnd2, opnd1, CTIME, CTIME); + case FILOTCM: + return newerf(opnd2, opnd1, MTIME, CTIME); + case FILOTMA: + return newerf(opnd2, opnd1, ATIME, MTIME); + case FILOTMB: + return newerf(opnd2, opnd1, BTIME, MTIME); + case FILOTMC: + return newerf(opnd2, opnd1, CTIME, MTIME); + case FILOTMM: + return newerf(opnd2, opnd1, MTIME, MTIME); case FILEQ: return equalf (opnd1, opnd2); default: @@ -570,25 +699,34 @@ intcmp (const char *s1, const char *s2) } static int -newerf (const char *f1, const char *f2) +newerf (const char *f1, const char *f2, enum time_types t1, enum time_types t2) { struct stat b1, b2; + struct timespec *ts1, *ts2; if (stat(f1, &b1) != 0 || stat(f2, &b2) != 0) return 0; - if (b1.st_mtim.tv_sec > b2.st_mtim.tv_sec) + switch (t1) { + case ATIME: ts1 = &b1.st_atim; break; + case BTIME: ts1 = &b1.st_birthtim; break; + case CTIME: ts1 = &b1.st_ctim; break; + default: ts1 = &b1.st_mtim; break; + } + + switch (t2) { + case ATIME: ts2 = &b2.st_atim; break; + case BTIME: ts2 = &b2.st_birthtim; break; + case CTIME: ts2 = &b2.st_ctim; break; + default: ts2 = &b2.st_mtim; break; + } + + if (ts1->tv_sec > ts2->tv_sec) return 1; - if (b1.st_mtim.tv_sec < b2.st_mtim.tv_sec) + if (ts1->tv_sec < ts2->tv_sec) return 0; - return (b1.st_mtim.tv_nsec > b2.st_mtim.tv_nsec); -} - -static int -olderf (const char *f1, const char *f2) -{ - return (newerf(f2, f1)); + return (ts1->tv_nsec > ts2->tv_nsec); } static int Modified: head/tools/regression/bin/test/regress.sh ============================================================================== --- head/tools/regression/bin/test/regress.sh Mon Feb 25 18:07:20 2013 (r247273) +++ head/tools/regression/bin/test/regress.sh Mon Feb 25 19:05:40 2013 (r247274) @@ -52,7 +52,7 @@ t () } count=0 -echo "1..130" +echo "1..266" t 0 'b = b' t 0 'b == b' @@ -194,3 +194,66 @@ t 1 '\( ! -a \)' t 0 '\( -n -o \)' t 1 '\( -z -o \)' t 1 '\( ! -o \)' + +# Test all file timestamp comparison operators +s() { + t ${1} "${35} -nt ${36}" + t ${2} "${35} -ntaa ${36}" + t ${3} "${35} -ntab ${36}" + t ${4} "${35} -ntac ${36}" + t ${5} "${35} -ntam ${36}" + t ${6} "${35} -ntba ${36}" + t ${7} "${35} -ntbb ${36}" + t ${8} "${35} -ntbc ${36}" + t ${9} "${35} -ntbm ${36}" + t ${10} "${35} -ntca ${36}" + t ${11} "${35} -ntcb ${36}" + t ${12} "${35} -ntcc ${36}" + t ${13} "${35} -ntcm ${36}" + t ${14} "${35} -ntma ${36}" + t ${15} "${35} -ntmb ${36}" + t ${16} "${35} -ntmc ${36}" + t ${17} "${35} -ntmm ${36}" + t ${18} "${35} -ot ${36}" + t ${19} "${35} -otaa ${36}" + t ${20} "${35} -otab ${36}" + t ${21} "${35} -otac ${36}" + t ${22} "${35} -otam ${36}" + t ${23} "${35} -otba ${36}" + t ${24} "${35} -otbb ${36}" + t ${25} "${35} -otbc ${36}" + t ${26} "${35} -otbm ${36}" + t ${27} "${35} -otca ${36}" + t ${28} "${35} -otcb ${36}" + t ${29} "${35} -otcc ${36}" + t ${30} "${35} -otcm ${36}" + t ${31} "${35} -otma ${36}" + t ${32} "${35} -otmb ${36}" + t ${33} "${35} -otmc ${36}" + t ${34} "${35} -otmm ${36}" +} + +a=/tmp/test$$.1 +b=/tmp/test$$.2 +trap "rm -f $a $b" EXIT + +# Tests 131-164 +s 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 $a $b + +touch $a +# Tests 165-198 +s 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 $a $b + +sleep 2 # Ensure $b is newer than $a +touch $b +# Tests 199-232 +s 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 $a $b + +sleep 2 +echo >$b # Updates mtime & ctime +sleep 2 +touch -A 01 -a $b + +# $b now has ctime > mtime > atime > btime +# Tests 233-266 +s 1 1 0 1 1 1 1 1 1 0 0 1 0 0 0 1 1 1 1 1 0 0 0 1 0 0 1 1 1 1 1 1 0 1 $b $b From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 19:06:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E7D2E3D1; Mon, 25 Feb 2013 19:06:04 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from smtp3.clear.net.nz (smtp3.clear.net.nz [203.97.33.64]) by mx1.freebsd.org (Postfix) with ESMTP id B60D2F97; Mon, 25 Feb 2013 19:06:04 +0000 (UTC) Received: from mxin3-orange.clear.net.nz (lb2-srcnat.clear.net.nz [203.97.32.237]) by smtp3.clear.net.nz (CLEAR Net Mail) with ESMTP id <0MIS002XYIE2BB30@smtp3.clear.net.nz>; Tue, 26 Feb 2013 08:06:03 +1300 (NZDT) Received: from 202-0-48-19.paradise.net.nz (HELO bender) ([202.0.48.19]) by smtpin32.paradise.net.nz with ESMTP; Tue, 26 Feb 2013 08:06:02 +1300 Date: Tue, 26 Feb 2013 08:05:42 +1300 From: Andrew Turner Subject: Re: svn commit: r247116 - in head/sys: fs/nfs fs/nfsclient kern nfsclient sys tools In-reply-to: <20130225115500.GW2454@kib.kiev.ua> To: Konstantin Belousov Message-id: <20130226080542.253c69ea@bender> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit References: <201302211902.r1LJ2o5T033708@svn.freebsd.org> <20130225201313.2050da18@bender> <20130225085019.GU2454@kib.kiev.ua> <20130225233603.49a5d4a5@bender> <20130225115500.GW2454@kib.kiev.ua> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 19:06:05 -0000 On Mon, 25 Feb 2013 13:55:00 +0200 Konstantin Belousov wrote: > On Mon, Feb 25, 2013 at 11:36:03PM +1300, Andrew Turner wrote: > > On Mon, 25 Feb 2013 10:50:19 +0200 > > Konstantin Belousov wrote: > > > > > On Mon, Feb 25, 2013 at 08:13:13PM +1300, Andrew Turner wrote: > > > > On Thu, 21 Feb 2013 19:02:50 +0000 (UTC) > > > > John Baldwin wrote: > > > > > > > > > Author: jhb > > > > > Date: Thu Feb 21 19:02:50 2013 > > > > > New Revision: 247116 > > > > > URL: http://svnweb.freebsd.org/changeset/base/247116 > > > > > > > > > > Log: > > > > > Further refine the handling of stop signals in the NFS > > > > > client. The changes in r246417 were incomplete as they did > > > > > not add explicit calls to sigdeferstop() around all the > > > > > places that previously passed SBDRY to _sleep(). In addition, > > > > > nfs_getcacheblk() could trigger a write RPC from getblk() > > > > > resulting in sigdeferstop() recursing. Rather than manually > > > > > deferring stop signals in specific places, change the VFS_*() > > > > > and VOP_*() methods to defer stop signals for filesystems > > > > > which request this behavior via a new VFCF_SBDRY flag. Note > > > > > that this has to be a VFC flag rather than a MNTK flag so > > > > > that it works properly with VFS_MOUNT() when the mount is not > > > > > yet fully constructed. For now, only the NFS clients are set > > > > > this new flag in VFS_SET(). A few other related changes: > > > > > - Add an assertion to ensure that TDF_SBDRY doesn't leak to > > > > > userland. > > > > > - When a lookup request uses VOP_READLINK() to follow a > > > > > symlink, mark the request as being on behalf of the thread > > > > > performing the lookup (cnp_thread) rather than using a NULL > > > > > thread pointer. This causes NFS to properly handle signals > > > > > during this VOP on an interruptible mount. > > > > > > > > > > PR: kern/176179 > > > > > Reported by: Russell Cattelan (sigdeferstop() > > > > > recursion) Reviewed by: kib > > > > > MFC after: 1 month > > > > > > > > This change is causing init to crash for me on armv6. I'm > > > > netbooting a PandaBoard and it appears init is receiving a > > > > SIGABRT before it gets into main(). > > > > > > > > Do you have any idea where I could look to track down why it is > > > > doing this? > > > > > > It is weird. SIGABRT sent by the kernel usually means that > > > execve(2) already destroyed the previous address space of the > > > process, but the new image cannot be activated, most likely due > > > to image format error discovered too late, or resource shortage. > > > > > > Could it be that some NFS RPC fails after the patch, but I cannot > > > imagine why. You would need to track this. Also, verify that the > > > init binary is correct. > > > > > > I tried amd64 netboot, and it worked fine. > > > > It looks like this change is not the issue, it just changed the > > symptom enough for me to not realise I was seeing an issue where > > it would crash the kernel before. I reinstated this change but only > > allowed the kernel to access half the memory and it booted > > correctly. > > > > The real issue appears to be related to something in the vm layer > > not working on ARM boards with too much memory (somewhere between > > 512MiB and 1GiB). > > Hm, do you have r246926, r246929 and r247046 ? Yes, I've updated the kernel to r247213. Andrew From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 19:14:07 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 52C3DA32; Mon, 25 Feb 2013 19:14:07 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2E63EFFE; Mon, 25 Feb 2013 19:14:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PJE746088370; Mon, 25 Feb 2013 19:14:07 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PJE7iR088369; Mon, 25 Feb 2013 19:14:07 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201302251914.r1PJE7iR088369@svn.freebsd.org> From: Devin Teske Date: Mon, 25 Feb 2013 19:14:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247278 - head/usr.sbin/bsdconfig/startup X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 19:14:07 -0000 Author: dteske Date: Mon Feb 25 19:14:06 2013 New Revision: 247278 URL: http://svnweb.freebsd.org/changeset/base/247278 Log: Fix typo and update copyright. Modified: head/usr.sbin/bsdconfig/startup/rcvar Modified: head/usr.sbin/bsdconfig/startup/rcvar ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcvar Mon Feb 25 19:09:41 2013 (r247277) +++ head/usr.sbin/bsdconfig/startup/rcvar Mon Feb 25 19:14:06 2013 (r247278) @@ -1,6 +1,6 @@ #!/bin/sh #- -# Copyright (c) 2012 Devin Teske +# Copyright (c) 2012-2013 Devin Teske # All Rights Reserved. # # Redistribution and use in source and binary forms, with or without @@ -75,7 +75,7 @@ dialog_menu_main() " # END-QUOTE if [ ! "$_RCVAR_MAP" ]; then - # Genreate RCVAR_MAP of `rcvar dflt script desc ...' per-line + # Generate RCVAR_MAP of `rcvar dflt script desc ...' per-line f_dialog_info "$msg_creating_rcvar_map" RCVAR_MAP=$( f_startup_rcvar_map ) export RCVAR_MAP From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 19:22:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 40BC9DE7; Mon, 25 Feb 2013 19:22:57 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1ABCA105; Mon, 25 Feb 2013 19:22:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PJMun6091517; Mon, 25 Feb 2013 19:22:56 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PJMuDK091516; Mon, 25 Feb 2013 19:22:56 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201302251922.r1PJMuDK091516@svn.freebsd.org> From: Sean Bruno Date: Mon, 25 Feb 2013 19:22:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247279 - head/sys/dev/ciss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 19:22:57 -0000 Author: sbruno Date: Mon Feb 25 19:22:56 2013 New Revision: 247279 URL: http://svnweb.freebsd.org/changeset/base/247279 Log: The 5300 series ciss(4) board does not work in performant mode with our currnet initialization sequence. Set it to simple mode only so that systems can be updated from stable/7 to newer installations. At some point, we should figure out why we cannot initialize performant mode on this board. PR: kern/153361 Reviewed by: scottl Obtained from: Yahoo! Inc. MFC after: 2 weeks Modified: head/sys/dev/ciss/ciss.c Modified: head/sys/dev/ciss/ciss.c ============================================================================== --- head/sys/dev/ciss/ciss.c Mon Feb 25 19:14:06 2013 (r247278) +++ head/sys/dev/ciss/ciss.c Mon Feb 25 19:22:56 2013 (r247279) @@ -282,6 +282,7 @@ TUNABLE_INT("hw.ciss.force_interrupt", & #define CISS_BOARD_SA5 1 #define CISS_BOARD_SA5B 2 #define CISS_BOARD_NOMSI (1<<4) +#define CISS_BOARD_SIMPLE (1<<5) static struct { @@ -290,7 +291,8 @@ static struct int flags; char *desc; } ciss_vendor_data[] = { - { 0x0e11, 0x4070, CISS_BOARD_SA5|CISS_BOARD_NOMSI, "Compaq Smart Array 5300" }, + { 0x0e11, 0x4070, CISS_BOARD_SA5|CISS_BOARD_NOMSI|CISS_BOARD_SIMPLE, + "Compaq Smart Array 5300" }, { 0x0e11, 0x4080, CISS_BOARD_SA5B|CISS_BOARD_NOMSI, "Compaq Smart Array 5i" }, { 0x0e11, 0x4082, CISS_BOARD_SA5B|CISS_BOARD_NOMSI, "Compaq Smart Array 532" }, { 0x0e11, 0x4083, CISS_BOARD_SA5B|CISS_BOARD_NOMSI, "HP Smart Array 5312" }, @@ -682,8 +684,15 @@ ciss_init_pci(struct ciss_softc *sc) supported_methods = CISS_TRANSPORT_METHOD_PERF; break; default: - supported_methods = sc->ciss_cfg->supported_methods; - break; + /* + * Override the capabilities of the BOARD and specify SIMPLE + * MODE + */ + if (ciss_vendor_data[i].flags & CISS_BOARD_SIMPLE) + supported_methods = CISS_TRANSPORT_METHOD_SIMPLE; + else + supported_methods = sc->ciss_cfg->supported_methods; + break; } setup: From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 19:26:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 72DC4FBA; Mon, 25 Feb 2013 19:26:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id DAF65140; Mon, 25 Feb 2013 19:26:45 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r1PJQgjT036548; Mon, 25 Feb 2013 21:26:42 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.4 kib.kiev.ua r1PJQgjT036548 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r1PJQg29036547; Mon, 25 Feb 2013 21:26:42 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 25 Feb 2013 21:26:42 +0200 From: Konstantin Belousov To: Andrew Turner Subject: Re: svn commit: r247116 - in head/sys: fs/nfs fs/nfsclient kern nfsclient sys tools Message-ID: <20130225192642.GB2454@kib.kiev.ua> References: <201302211902.r1LJ2o5T033708@svn.freebsd.org> <20130225201313.2050da18@bender> <20130225085019.GU2454@kib.kiev.ua> <20130225233603.49a5d4a5@bender> <20130225115500.GW2454@kib.kiev.ua> <20130226080542.253c69ea@bender> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="rPF8rPXpDlNr1aSW" Content-Disposition: inline In-Reply-To: <20130226080542.253c69ea@bender> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 19:26:46 -0000 --rPF8rPXpDlNr1aSW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 26, 2013 at 08:05:42AM +1300, Andrew Turner wrote: > On Mon, 25 Feb 2013 13:55:00 +0200 > Konstantin Belousov wrote: >=20 > > On Mon, Feb 25, 2013 at 11:36:03PM +1300, Andrew Turner wrote: > > > The real issue appears to be related to something in the vm layer > > > not working on ARM boards with too much memory (somewhere between > > > 512MiB and 1GiB). > >=20 > > Hm, do you have r246926, r246929 and r247046 ? >=20 > Yes, I've updated the kernel to r247213. It was more the question if reverting all three of them restores the proper operation. --rPF8rPXpDlNr1aSW Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRK7rxAAoJEJDCuSvBvK1BOvMQAKVQRUnbgCUEjMpb8U5AW8HR 02QqrIlFJwzVmxbayobCmFmPgDW4k6VinaHDoUWptUtxfUztmQT4Av/BEu/I0wKJ mXnbE+nvU1JxqS0GqITBO77Ark7CdGafgNOkHRJi4jnEIN7FEQJYX9ejsJTdJ7Ex iK6jRqk48M9aNiqfyHi4QZh7Z9Es1VcXWsKVSqbGoVhFdRw2dO6L3aD/BkVtoO1N lEVfRv6i/04XB7DvkJLE1bqkc7Sr6eAk3USQly/4niObvCQW/9QEgH2AsMOsDQbI UluLARo/54ZxAuh+8feECK7n75JXg0GhU0O7iDLRHv/OklUpDfC+H8WqKeD5KOF6 87pdahY2vvFCdC0ZPbfLchUtiBwFlOCDa7oaQVWvzOAE36F8RYROOS4k4gSWhTxq peQwQpAITSlaq/eYbpr3DA9tJ2f9YC3wEU8hSPJjJggyPypwEH/CbAe9R8byCxvK dTma5N+UwZBdVYkyRkMh0U81MClEnUDfYVEu/5KzHkWxSUrORvZ63pCOpEeOtVHs qMcIhr+9vYnzqg982tezCivYe5vpN56L5zKgTvbUVEAtvmO6mZdTf/cs24zI404D zBZwJ9bo4KxBS5VeN09YFQuFnRN6ECbm3hIh2VRv3XONkjoZRE+rYey5FgJHXPsA 248LGCeX3PVQs9RUJGSY =mhpW -----END PGP SIGNATURE----- --rPF8rPXpDlNr1aSW-- From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 19:55:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 03599622; Mon, 25 Feb 2013 19:55:35 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E80F224F; Mon, 25 Feb 2013 19:55:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PJtYL4000775; Mon, 25 Feb 2013 19:55:34 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PJtWIj000758; Mon, 25 Feb 2013 19:55:32 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201302251955.r1PJtWIj000758@svn.freebsd.org> From: Devin Teske Date: Mon, 25 Feb 2013 19:55:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247280 - in head/usr.sbin/bsdconfig: include networking networking/include networking/share share share/media X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 19:55:35 -0000 Author: dteske Date: Mon Feb 25 19:55:32 2013 New Revision: 247280 URL: http://svnweb.freebsd.org/changeset/base/247280 Log: Import media selection/preparation framework (sysinstall inspired). Makes accessing files from various types of media nice and abstracted away from the wet-work involved in preparing, validating, and initializing those types of media. This will be used for the package management system module and other modules that need access to files and want to allow the user to decide where those files come from (either in a scripted fashion, prompted fashion, or any combination thereof). Heavily inspired by sysinstall and even uses the same reserved words so that scripts are portable. Coded over months, tested continuously through- out, and reviewed several times. Some notes about the changes: - Move network-setting acquisition/validation routines to media/tcpip.subr - The options screen from sysinstall has been converted to a dialog menu - The "UFS" media choice is renamed to "Directory" to reflect how sysinstall treats the choice and a new [true] "UFS" media choice has been added that acts on real UFS partitions (such as external disks with disklabels). - Many more help files have been resurrected from sysinstall (I noticed that some of the content seems a bit dated; I gave them a once-over but they could really use an update). - A total of 10 media choices are presented (via mediaGetType) including: CD/DVD, FTP, FTP Passive, HTTP Proxy, Directory, NFS, DOS, UFS, Floppy, USB - Novel struct/device management layer for managing the issue of passing more information than can comfortably fit in an argument list. Added: head/usr.sbin/bsdconfig/include/media.hlp (contents, props changed) head/usr.sbin/bsdconfig/include/network_device.hlp (contents, props changed) head/usr.sbin/bsdconfig/include/options.hlp (contents, props changed) head/usr.sbin/bsdconfig/include/tcp.hlp - copied unchanged from r245694, head/usr.sbin/bsdconfig/networking/include/tcp.hlp head/usr.sbin/bsdconfig/share/device.subr (contents, props changed) head/usr.sbin/bsdconfig/share/media/ head/usr.sbin/bsdconfig/share/media/Makefile (contents, props changed) head/usr.sbin/bsdconfig/share/media/any.subr (contents, props changed) head/usr.sbin/bsdconfig/share/media/cdrom.subr (contents, props changed) head/usr.sbin/bsdconfig/share/media/common.subr (contents, props changed) head/usr.sbin/bsdconfig/share/media/directory.subr (contents, props changed) head/usr.sbin/bsdconfig/share/media/dos.subr (contents, props changed) head/usr.sbin/bsdconfig/share/media/floppy.subr (contents, props changed) head/usr.sbin/bsdconfig/share/media/ftp.subr (contents, props changed) head/usr.sbin/bsdconfig/share/media/httpproxy.subr (contents, props changed) head/usr.sbin/bsdconfig/share/media/network.subr (contents, props changed) head/usr.sbin/bsdconfig/share/media/nfs.subr (contents, props changed) head/usr.sbin/bsdconfig/share/media/options.subr (contents, props changed) head/usr.sbin/bsdconfig/share/media/tcpip.subr (contents, props changed) head/usr.sbin/bsdconfig/share/media/ufs.subr (contents, props changed) head/usr.sbin/bsdconfig/share/media/usb.subr (contents, props changed) head/usr.sbin/bsdconfig/share/struct.subr (contents, props changed) Deleted: head/usr.sbin/bsdconfig/networking/include/tcp.hlp Modified: head/usr.sbin/bsdconfig/include/Makefile head/usr.sbin/bsdconfig/include/messages.subr head/usr.sbin/bsdconfig/networking/devices head/usr.sbin/bsdconfig/networking/include/Makefile head/usr.sbin/bsdconfig/networking/share/common.subr head/usr.sbin/bsdconfig/networking/share/device.subr head/usr.sbin/bsdconfig/networking/share/hostname.subr head/usr.sbin/bsdconfig/networking/share/ipaddr.subr head/usr.sbin/bsdconfig/networking/share/netmask.subr head/usr.sbin/bsdconfig/networking/share/resolv.subr head/usr.sbin/bsdconfig/networking/share/routing.subr head/usr.sbin/bsdconfig/share/Makefile head/usr.sbin/bsdconfig/share/common.subr head/usr.sbin/bsdconfig/share/script.subr head/usr.sbin/bsdconfig/share/strings.subr head/usr.sbin/bsdconfig/share/variable.subr Modified: head/usr.sbin/bsdconfig/include/Makefile ============================================================================== --- head/usr.sbin/bsdconfig/include/Makefile Mon Feb 25 19:22:56 2013 (r247279) +++ head/usr.sbin/bsdconfig/include/Makefile Mon Feb 25 19:55:32 2013 (r247280) @@ -3,7 +3,8 @@ NO_OBJ= FILESDIR= ${LIBEXECDIR}/bsdconfig/include -FILES= bsdconfig.hlp messages.subr usage.hlp +FILES= bsdconfig.hlp media.hlp messages.subr network_device.hlp \ + options.hlp tcp.hlp usage.hlp beforeinstall: mkdir -p ${DESTDIR}${FILESDIR} Added: head/usr.sbin/bsdconfig/include/media.hlp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdconfig/include/media.hlp Mon Feb 25 19:55:32 2013 (r247280) @@ -0,0 +1,48 @@ +You can install from the following types of media: + + CDROM requires one of the following supported CDROM drives: + ATAPI - Any standard ATAPI CDROM drive hooked to + a supported controller (see Hardware Guide). + SCSI - Any standard SCSI CDROM drive hooked to + a supported controller (see Hardware Guide). + + + DOS A DOS primary partition with the required FreeBSD + distribution files copied onto it (e.g. C:\FREEBSD\) + + + UFS Assuming a disk or partition with an existing + FreeBSD file system and distribution set on it, + get the distribution files from there. + + + Floppy Get distribution files from one or more DOS or UFS + formatted floppies. Such floppies are assumed to + contain the appropriate distribution pieces - see + ABOUT.TXT for more information about making floppy + distribution media. + + + FTP Get the distribution files from an anonymous ftp server + (you will be presented with a list). Please note that + you may invoke FTP in "Active" mode, "Passive" mode, or + via an HTTP proxy. + + Active mode is the standard way of fetching files and + Passive mode is for use when you're behind a firewall or + some other security mechanism that blocks active FTP + connections. Using an HTTP proxy is sometimes necessary + for firewalls which block all FTP connections. + + If you chose to enter your own URL in the FTP menu, please + note that all paths are *relative* to the home directory + of the user being logged in as. By default, this is the + user "ftp" (anonymous ftp) but you may change this in the + Options screen. + + + NFS Get the distribution files from an NFS server somewhere + (make sure that permissions on the server allow this!). + If this install method hangs on you or refuses to work + properly, you may need to set some special options for + your NFS server. See the Options screen for more details. Modified: head/usr.sbin/bsdconfig/include/messages.subr ============================================================================== --- head/usr.sbin/bsdconfig/include/messages.subr Mon Feb 25 19:22:56 2013 (r247279) +++ head/usr.sbin/bsdconfig/include/messages.subr Mon Feb 25 19:55:32 2013 (r247280) @@ -1,5 +1,5 @@ # Copyright (c) 2012 Ron McDowell -# Copyright (c) 2012 Devin Teske +# Copyright (c) 2012-2013 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -27,39 +27,251 @@ field_username="Username:" field_password="Password:" +hline_alnum_arrows_punc_tab_enter="Use alnum, arrows, punctuation, TAB or ENTER" hline_alnum_punc_tab_enter="Use alpha-numeric, punctuation, TAB or ENTER" hline_arrows_tab_enter="Press arrows, TAB or ENTER" +hline_choose_help_for_more_information_on_media_types="Choose Help for more information on the various media types" +msg_accept_continue="Accept/Continue" msg_always_try_sudo_when_run_as="Always try sudo(8) when run as %s" +msg_argentina="Argentina" +msg_assume_network_is_already_configured="Running multi-user, assume that the network is already configured?" +msg_attempt_automatic_dhcp_configuration="Attempt automatic DHCP configuration of interfaces" +msg_attempt_ipv6_configuration_of_interfaces="Attempt IPv6 configuration of interfaces" +msg_australia="Australia" +msg_austria="Austria" msg_becoming_root_via_sudo="Becoming root via sudo(8)..." +msg_brazil="Brazil" +msg_canada="Canada" msg_cancel="Cancel" msg_cancel_exit="Cancel/Exit" msg_cannot_create_permission_denied="%s: cannot create %s: Permission denied" +msg_cannot_resolve_hostname="Cannot resolve \`%s'! Are you sure that your\nname server, gateway and network interface are correctly configured?" +msg_cant_find_distribution="Warning: Can't find the \`%s' distribution on this\nFTP server. You may need to visit a different server for\nthe release you are trying to fetch or go to the Options\nmenu and set the release name to explicitly match what's\navailable on %s (or set to \"any\").\n\nWould you like to select another FTP server?" +msg_cant_seem_to_write_out_resolv_conf="Can't seem to write out %s. Net cannot be used." +msg_cd_dvd="CD/DVD" +msg_cdrom="CDROM" +msg_checking_access_to="Checking access to\n %s" +msg_china="China" +msg_choose_a_cd_dvd_type="Choose a CD/DVD type" +msg_choose_a_dos_partition="Choose a DOS partition" +msg_choose_a_floppy_drive="Choose a Floppy drive" +msg_choose_a_ufs_partition="Choose a UFS partition" +msg_choose_a_usb_partition="Choose a USB drive" +msg_choose_installation_media="Choose Installation Media" +msg_choose_installation_media_description="FreeBSD can be installed from a variety of different installation\nmedia, ranging from floppies to an Internet FTP server. If you're\ninstalling FreeBSD from a supported CD/DVD drive then this is generally\nthe best media to use if you have no overriding reason for using other\nmedia." +msg_client_error="Client error, you could try an other server" msg_command_failed_rest_of_script_aborted="Command \`%s' failed - rest of script aborted." +msg_configuration_for_interface="Configuration for Interface" +msg_could_not_unmount_the_cdrom_dvd="Could not unmount the CDROM/DVD from %s: %s" +msg_could_not_unmount_the_dos_partition="Could not unmount the DOS partition from %s: %s" +msg_could_not_unmount_the_nfs_partition="Could not unmount the NFS partition from %s: %s" +msg_could_not_unmount_the_ufs_partition="Could not unmount the UFS partition from %s: %s" +msg_couldnt_connect_to_proxy="Couldn't connect to proxy" +msg_couldnt_connect_to_ftp_server="Couldn't connect to FTP server" +msg_couldnt_open_ftp_connection="Couldn't open FTP connection to %s:\n %s." msg_created_path="Created %s" +msg_croatia="Croatia" +msg_czech_republic="Czech Republic" +msg_debugging="Debugging" +msg_denmark="Denmark" +msg_device_is_not_configured="The %s device is not configured. You will need to do so\nin the Networking configuration menu before proceeding." +msg_dhcp="DHCP" +msg_dialog_mixedform_navigation_help="Use / arrows to navigate between fields, TAB to focus buttons, and Enter for OK/Cancel." +msg_directory="Directory" msg_directory_not_found="%s: Directory not found." +msg_done="Done" +msg_dos="DOS" +msg_editor="Editor" +msg_emit_extra_debugging_output="Emit extra debugging output" +msg_enter_a_fully_qualified_pathname_for_the_directory="Enter a fully qualified pathname for the directory\ncontaining the FreeBSD distribution files:" +msg_enter_the_device_name_of_a_ufs_formatted_partition="Enter the device-name of a UFS formatted partition" +msg_error="Error" +msg_error_mounting_device="Error mounting %s on %s: %s" +msg_error_mounting_floppy_device="Error mounting floppy %s (%s) on %s: %s" +msg_error_mounting_usb_drive="Error mounting USB drive %s on %s: %s" +msg_error_when_requesting_url="Error when requesting %s, you could try an other server" +msg_estonia="Estonia" msg_exit="Exit" msg_exit_bsdconfig="Exit bsdconfig" +msg_extra_options_to_ifconfig="Extra options to ifconfig (usually empty):" +msg_failed_to_add_default_route="Failed to add a default route; please check your network configuration" +msg_file_system="File System" +msg_finland="Finland" +msg_floppy="Floppy" +msg_france="France" +msg_ftp="FTP" +msg_ftp_passive="FTP Passive" +msg_ftp_username="FTP username" +msg_germany="Germany" +msg_greece="Greece" +msg_help="Help" +msg_host_name_including_domain="Host name (including domain)" +msg_hostname_variable_not_set="WARNING: hostname variable not set and is a non-optional\nparameter. Please add this to your installation script\nor set the netInteractive variable (see bsdconfig man page)" +msg_http="HTTP" +msg_http_proxy="HTTP Proxy" +msg_hungary="Hungary" +msg_iceland="Iceland" +msg_install_from_a_dos_partition="Install from a DOS partition" +msg_install_from_a_floppy_disk_set="Install from a floppy disk set" +msg_install_from_a_freebsd_cd_dvd="Install from a FreeBSD CD/DVD" +msg_install_from_a_usb_drive="Install from a USB drive" +msg_install_from_a_ufs_partition="Install from a UFS partition" +msg_install_from_an_ftp_server="Install from an FTP server" +msg_install_from_an_ftp_server_thru_firewall="Install from an FTP server through a firewall" +msg_install_from_an_ftp_server_thru_proxy="Install from an FTP server through an HTTP proxy" +msg_install_from_the_existing_filesystem="Install from the existing filesystem" +msg_install_over_nfs="Install over NFS" +msg_invalid_gateway_ipv4_address_specified="Invalid gateway IPv4 address specified" +msg_invalid_hostname_value="Invalid hostname value" +msg_invalid_ipv4_address="Invalid IPv4 address" +msg_invalid_name_server_ip_address_specified="Invalid name server IP address specified" +msg_invalid_netmask_value="Invalid netmask value" +msg_invalid_nfs_path_specification="Invalid NFS path specification. Must be of the form:\nhost:/full/pathname/to/FreeBSD/distdir" +msg_ipv4_address="IPv4 Address" +msg_ipv4_gateway="IPv4 Gateway" +msg_ipv6="IPv6" +msg_ipv6_ready="IPv6 ready" +msg_ireland="Ireland" +msg_israel="Israel" +msg_italy="Italy" +msg_japan="Japan" +msg_korea="Korea" +msg_lithuania="Lithuania" +msg_length_of_specified_url_is_too_long="Length of specified URL is %u characters. Allowable maximum is %u." +msg_logging_in_to_user_at_host="Logging in to %s@%s.." +msg_looking_up_host="Looking up host %s" msg_main_menu="Main Menu" +msg_main_site="Main Site" +msg_media_timeout="Media Timeout" +msg_media_type="Media Type" msg_menu_text="If you've already installed FreeBSD, you may use\nthis menu to customize it somewhat to suit your\nparticular configuration. Most importantly, you\ncan use the Packages utility to load extra '3rd\nparty' software not provided in the base\ndistributions." +msg_missing_ftp_host_or_directory="Missing FTP host or directory specification. FTP media not initialized." msg_must_be_root_to_execute="%s: must be root to execute" +msg_must_specify_a_host_name_of_some_sort="Must specify a host name of some sort!" +msg_name_server="Name server" +msg_net_device_init_failed="Net device init failed." +msg_netmask="Netmask" +msg_netherlands="Netherlands" +msg_network_configuration="Network Configuration" +msg_network_interface_information_required="Network interface information required" msg_nfailed_attempts="%u incorrect password attempts" +msg_nfs="NFS" +msg_nfs_secure="NFS Secure" +msg_nfs_server_talks_only_on_a_secure_port="NFS server talks only on a secure port" +msg_nfs_slow="NFS Slow" +msg_nfs_tcp="NFS TCP" +msg_nfs_version_3="NFS version 3" msg_no="No" +msg_no_cd_dvd_devices_found="No CD/DVD devices found! Please check that your system's\nconfiguration is correct and that the CD/DVD drive is of a\nsupported type. For more information, consult the hardware\nguide in the Doc menu." +msg_no_dos_primary_partitions_found="No DOS primary partitions found! This installation method is unavailable" +msg_no_floppy_devices_found="No floppy devices found! Please check that your system's configuration\nis correct. For more information, consult the hardware guide in the Doc\nmenu." +msg_no_gateway_has_been_set="No gateway has been set. You will be unable to access hosts\nnot on your local network" +msg_no_network_devices="No network devices available!" msg_no_such_file_or_directory="%s: %s: No such file or directory" +msg_no_usb_devices_found="No USB devices found (try Options/Re-scan Devices)" msg_no_username="No username provided!" +msg_norway="Norway" +msg_not_a_directory="%s: %s: Not a directory" msg_not_found="not found" +msg_not_yet_set="not yet set" msg_ok="OK" +msg_options="Options" +msg_options_editor="Options Editor" +msg_other="other" msg_permission_denied="%s: %s: Permission denied" +msg_please_check_the_url_and_try_again="No such directory: %s\nplease check the URL and try again." msg_please_enter_password="Please enter your password for sudo(8):" msg_please_enter_username_password="Please enter a username and password for sudo(8):" +msg_please_enter_the_address_of_the_http_proxy="Please enter the address of the HTTP proxy in this format:\n hostname:port (the ':port' is optional, default is 3128)" +msg_please_enter_the_full_nfs_file_specification="Please enter the full NFS file specification for the remote\nhost and directory containing the FreeBSD distribution files.\nThis should be in the format: hostname:/some/freebsd/dir" +msg_please_enter_the_password_for_this_user="Please enter the password for this user:" +msg_please_enter_the_username_you_wish_to_login_as="Please enter the username you wish to login as:" +msg_please_insert_floppy_in_drive="Please insert floppy in %s" +msg_please_insert_floppy_containing="Please insert floppy containing %s in %s" +msg_please_select_a_cd_dvd_drive="FreeBSD can be installed directly from a CD/DVD containing a valid\nFreeBSD distribution. If you are seeing this menu it is because\nmore than one CD/DVD drive was found on your system. Please select\none of the following CD/DVD drives as your installation drive." +msg_please_select_a_floppy_drive="You have more than one floppy drive. Please choose which drive\nyou would like to use." +msg_please_select_a_freebsd_ftp_distribution_site="Please select a FreeBSD FTP distribution site" +msg_please_select_dos_partition="FreeBSD can be installed directly from a DOS partition assuming,\nof course, that you have copied the relevant distributions into\nyour DOS partition before starting this installation. If this is\nnot the case then you should reboot DOS at this time and copy the\ndistributions you wish to install into a \"FREEBSD\" subdirectory\non one of your DOS partitions. Otherwise, please select the DOS\npartition containing the FreeBSD distribution files." +msg_please_select_ufs_partition="FreeBSD can be installed directly from another FreeBSD partition\nthat is UFS formatted assuming, of course, that you have copied\nthe relevant distributions into said partition before starting\ninstallation." +msg_please_select_a_usb_drive="You have more than one USB drive. Please choose which drive\nyou would like to use." +msg_please_select_ethernet_device_to_configure="Please select the ethernet or PLIP device to configure." +msg_please_select_the_site_closest_to_you_or_other="Please select the site closest to you or \"other\" if you'd like to\nspecify a different choice. Also note that not every site listed here\ncarries more than the base distribution kits. Only Primary sites are\nguaranteed to carry the full range of possible distributions." +msg_please_specify_the_name_of_the_text_editor="Please specify the name of the text editor you wish to use:" +msg_please_specify_the_number_of_seconds_to_wait="Please specify the number of seconds to wait for slow media:" +msg_please_specify_the_release_you_wish_to_load="Please specify the release you wish to load or\n\"any\" for a generic release install:" +msg_please_specify_url_of_a_freebsd_distribution="Please specify the URL of a FreeBSD distribution on a\nremote ftp site. This site must accept either anonymous\nftp or you should have set an ftp username and password\nin the Options screen.\n\nA URL looks like this: ftp:///\nWhere is relative to the anonymous ftp directory or the\nhome directory of the user being logged in as." +msg_poland="Poland" +msg_portugal="Portugal" msg_previous_syntax_errors="%s: Not overwriting \`%s' due to previous syntax errors" +msg_primary="Primary" +msg_probing_devices_please_wait_this_can_take_a_while="Probing devices, please wait (this can take a while)..." msg_quick_start_how_to_use_this_menu_system="Quick start - How to use this menu system" +msg_release_name="Release Name" +msg_rerun_bsdconfig_initial_device_probe="Re-run bsdconfig initial device probe" +msg_rescan_devices="Re-scan Devices" +msg_reset="RESET!" +msg_reset_all_values_to_startup_defaults="Reset all values to startup defaults" +msg_reuse_old_ftp_site_selection_values="Re-use old FTP site selection values?" +msg_romania="Romania" +msg_russia="Russia" +msg_scanning_for_dhcp_servers="Scanning for DHCP servers..." +msg_scanning_for_ra_servers="Scanning for RA servers..." msg_secure_mode_requires_x11="Secure-mode requires X11 (use \`-X')!" msg_secure_mode_requires_root="Secure-mode requires root-access!" +msg_select_a_site_thats_close="Select a site that's close!" +msg_server_error_when_requesting_url="Server error when requesting %s, you could try an other server" +msg_singapore="Singapore" +msg_slovak_republic="Slovak Republic" +msg_slovenia="Slovenia" +msg_snapshots_server_japan="Snapshots Server Japan" +msg_snapshots_server_sweden="Snapshots Server Sweden" +msg_sorry_invalid_url="Sorry, %s is an invalid URL!" msg_sorry_try_again="Sorry, try again." +msg_south_africa="South Africa" +msg_spain="Spain" +msg_specify_some_other_ftp_site="Specify some other ftp site by URL" +msg_sweden="Sweden" +msg_switzerland="Switzerland" +msg_taiwan="Taiwan" +msg_the_current_installation_media_type="The current installation media type." +msg_timeout_value_in_seconds_for_slow_media="Timeout value in seconds for slow media." +msg_try_dhcp_configuration="Do you want to try DHCP configuration of the interface?" +msg_try_ipv6_configuration="Do you want to try IPv6 configuration of the interface?" msg_try_sudo_only_this_once="Try sudo(8) only this once" +msg_turkey="Turkey" +msg_ufs="UFS" +msg_uk="UK" +msg_ukraine="Ukraine" +msg_unable_to_configure_device="Unable to configure the %s interface!\nThis installation method cannot be used." +msg_unable_to_get_proper_ftp_path="Unable to get proper FTP path. FTP media not initialized." +msg_unable_to_make_directory_mountpoint="Unable to make %s directory mountpoint for %s!" msg_unable_to_open="Unable to open %s" +msg_unknown="unknown" msg_unknown_user="Unknown user: %s" +msg_url_was_not_found="%s was not found, maybe directory or release-version are wrong?" +msg_usa="USA" msg_usage="Usage" +msg_usb="USB" +msg_use_defaults="Use Defaults" +msg_use_nfs_version_3="Use NFS version 3" +msg_use_tcp_protocol_for_nfs="Use TCP protocol for NFS" msg_user_disallowed="User disallowed: %s" +msg_user_is_using_a_slow_pc_or_ethernet_card="User is using a slow PC or Ethernet card" +msg_username_and_password_to_use="Username and password to use instead of anonymous" +msg_using_interface="Using interface %s" +msg_using_usb_device="Using USB device: %s" +msg_view_set_various_media_options="View/Set various media options" +msg_which_release_to_attempt_to_load="Which release to attempt to load from installation media" +msg_which_text_editor_to_use="Which text editor to use during installation" +msg_would_you_like_to_bring_interface_up="Would you like to bring the %s interface up right now?" msg_yes="Yes" msg_you_are_not_root_but="You are not root but %s can use sudo(8).\nWhat would you like to do?" +msg_you_may_remove_the_floppy="You may remove the floppy from %s" +msg_youve_already_done_the_network_configuration="You've already done the network configuration once,\nwould you like to skip over it now?" +tcplayout_extras_help="Any interface-specific options to ifconfig you would like to add" +tcplayout_extras_help_for_plip="For PLIP configuration, you must enter the peer's IP address here." +tcplayout_gateway_help="IPv4 address of host forwarding packets to non-local destinations" +tcplayout_hostname_help="Your fully-qualified hostname, e.g. foo.example.com" +tcplayout_ipaddr_help="The IPv4 address to be used for this interface" +tcplayout_nameserver_help="IPv4 or IPv6 address of your local DNS server" +tcplayout_netmask_help="The netmask for this interface, e.g. 255.255.255.0 for a class C network" Added: head/usr.sbin/bsdconfig/include/network_device.hlp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdconfig/include/network_device.hlp Mon Feb 25 19:55:32 2013 (r247280) @@ -0,0 +1,58 @@ +You can do network installations over 3 types of communications links: + + Serial port: SLIP / PPP + Parallel port: PLIP (laplink cable) + Ethernet: A standard Ethernet controller (includes some + PCMCIA networking cards). + +SLIP support is rather primitive and limited primarily to directly +connected links, such as a serial cable running between a laptop +computer and another PC. The link must be hard-wired as the SLIP +installation doesn't currently offer a dialing capability (that +facility is offered by the PPP utility, which should be used in +preference to SLIP whenever possible). When you choose the SLIP +option, you'll be given the option of later editing the slattach +command before it's run on the serial line. It is expected that +you'll run slattach (or some equivalent command) on the other end of +the link at that time and bring up the line. FreeBSD will then +install itself at serial speeds of up to 115.2K/baud (the recommended +speed for a hardwired cable). + +If you're using a modem then PPP is almost certainly your only choice. +Make sure that you have your service provider's information handy as +you'll need to know it fairly early in the installation process. You +will need to know your service provider's IP address, the IP address +of your provider's DNS server, and possibly your own IP address unless +your ISP supports dynamic negotiation, most do. If you do not choose +a PAP or CHAP login you will also need to know how to use the various +"AT commands" to dial the ISP with your particular brand of modem as +the PPP dialer provides only a very simple terminal emulator and has no +"modem capabilities database". If you choose a PAP or CHAP login you +can simply enter `dial' (without the quotes) at the ppp prompt if your +modem uses the Hayes compatible AT command set. + +If a hard-wired connection to another FreeBSD (2.0R or later) machine +is available, you might also consider installing over a "laplink" +parallel port cable. The data rate over the parallel port is much +higher than what is typically possible over a serial line, and speeds +of over 50KB/sec are not uncommon. + +Finally, for the fastest possible network installation, an Ethernet +adaptor is always a good choice! FreeBSD supports most common PC +Ethernet cards, a table of which is provided in the FreeBSD Hardware +Guide (see the `Documentation' entry in the main menu). If you are +using one of the supported PCMCIA Ethernet cards, also be sure that +it's plugged in BEFORE the laptop is powered on! Sysinstall does not, +unfortunately, currently support "hot insertion" of PCMCIA cards. + +You will also need to know your IP address on the network, the +"netmask" value for your address class, and the name of your machine. +Your system administrator can tell you which values to use for your +particular network setup. If you will be referring to other hosts by +name rather than IP address, you'll also need a name server and +possibly the address of a gateway (if you're using PPP, it's your +provider's IP address) to use in talking to it. If you do not know +the answers to all or most of these questions then you should really +probably talk to your system administrator FIRST before trying this +type of installation! Choosing the wrong IP address on a busy network +will NOT make you popular with your systems administrator! :-) Added: head/usr.sbin/bsdconfig/include/options.hlp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdconfig/include/options.hlp Mon Feb 25 19:55:32 2013 (r247280) @@ -0,0 +1,98 @@ +The following options may be set from this screen. + +NFS Secure: NFS server talks only on a secure port + + This is most commonly used when talking to Sun workstations, which + will not talk NFS over "non privileged" ports. + + +NFS Slow: User is using a slow PC or Ethernet card + + Use this option if you have a slow PC (386) or an Ethernet card + with poor performance being "fed" by NFS on a higher-performance + workstation. This will throttle the workstation back to prevent + the PC from becoming swamped with data. + + +NFS TCP: Use TCP for the NFS mount + + This option can be used if your NFS server supports TCP + connections; not all do! This may be useful if your NFS server + is at a remote site in which case it may offer some additional + stability. + + +NFS version 3: Use NFS version 3 + + This option forces the use of NFS version 3 and is on by default. + If your NFS server only supports NFS version 2, disable this option. + + +Debugging: Turn on the extra debugging flag + + This turns on a lot of extra noise in between dialogs (unless + debugFile has been set, sending the data to a logfile instead). + Optionally, if debugFile begins with a plus sign (`+'), output will + occur both on standard output and to debugFile (minus leading plus). + If your installation should fail for any reason, PLEASE turn this + flag on when attempting to reproduce the problem. It will provide a + lot of extra debugging at the failure point and may be very helpful + to the developers in tracking such problems down! + + +DHCP: Enable DHCP configuration of interfaces + + This option specifies whether DHCP configuration of interfaces + may be attempted. The default setting is to interactively ask + the user. + + +IPv6: Enable IPv6 router solicitation configuration + + This option specifies whether automatic configuration of IPv6 + interfaces may be attempted. This uses the router solicitation + method of automatic configuration. The default setting is to + interactively ask the user. + + +FTP username: Specify username and password instead of anonymous. + + By default, the installation attempts to log in as the + anonymous user. If you wish to log in as someone else, + specify the username and password with this option. + + +Editor: Specify which screen editor to use. + + At various points during the installation it may be necessary + to customize some text file, at which point the user will be + thrown unceremoniously into a screen editor. A relatively + simplistic editor which shows its command set on-screen is + selected by default, but UNIX purists may wish to change this + setting to `/usr/bin/vi'. + + +Release Name: Which release to attempt to load from installation media. + + You should only change this option if you're really sure you know + what you are doing! This will change the release name used by + bsdconfig when fetching components of any distributions, and + is a useful way of using a more recent installation boot floppy + with an older release (say, on CDROM). + + +Media Type: Which media type is being used. + + This is mostly informational and indicates which media type (if any) + was last selected in the Media menu. It's also a convenient short-cut + to the media menu itself. + + +Re-scan Devices: + + Reprobe the system for devices. + + +Use Defaults: Use default values. + + Reset all options back to their default values. Copied: head/usr.sbin/bsdconfig/include/tcp.hlp (from r245694, head/usr.sbin/bsdconfig/networking/include/tcp.hlp) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdconfig/include/tcp.hlp Mon Feb 25 19:55:32 2013 (r247280, copy of r245694, head/usr.sbin/bsdconfig/networking/include/tcp.hlp) @@ -0,0 +1,33 @@ +This screen allows you to set up your general network parameters +(hostname, domain name, DNS server, etc) as well as the settings for a +given interface (which was selected from the menu before this screen). + +PLIP/SLIP users - please read through to the end of this doc! + +The "options" field is kind of special (read: a hack :-): + +Any valid options to ifconfig can be specified here, so if you need +to do something "special" to get your interface working, then here +is the place to do it. + +If you're running SLIP or PLIP, you also need to use it for specifying +the remote end of the link (simply type the foreign IP address in). +In the specific case where you're running PLIP with a Linux host peer +rather than a FreeBSD one, you also must add the "-link0" flag after the +foreign address. + +If you're dealing with an ethernet adaptor with multiple media +connectors (e.g. AUI, 10BT, 10B2, etc), you can use this field to +specify which one to use. Examples of valid strings include: + + "media 10base5/AUI" - Select the AUI port. + "media 10baseT/UTP" - Select the twisted pair port. + "media 10base2/BNC" - Select the BNC connector. + "media 100baseTX" - Select 100BaseT on a 100/10 dual adaptor. + +If you have a wireless interface and must specify arguments such as a +WEP key here, you may use something like: + + "wepmode on wepkey 0xFEEDFACE" + +When you're done with this form, select OK. Modified: head/usr.sbin/bsdconfig/networking/devices ============================================================================== --- head/usr.sbin/bsdconfig/networking/devices Mon Feb 25 19:22:56 2013 (r247279) +++ head/usr.sbin/bsdconfig/networking/devices Mon Feb 25 19:55:32 2013 (r247280) @@ -1,6 +1,6 @@ #!/bin/sh #- -# Copyright (c) 2006-2012 Devin Teske +# Copyright (c) 2006-2013 Devin Teske # All Rights Reserved. # # Redistribution and use in source and binary forms, with or without @@ -34,6 +34,7 @@ f_dprintf "%s: loading includes..." "$0" f_include $BSDCFG_SHARE/dialog.subr f_include $BSDCFG_SHARE/mustberoot.subr f_include $BSDCFG_SHARE/sysrc.subr +f_include $BSDCFG_SHARE/media/tcpip.subr f_include $BSDCFG_SHARE/networking/device.subr f_include $BSDCFG_SHARE/networking/ipaddr.subr f_include $BSDCFG_SHARE/networking/media.subr Modified: head/usr.sbin/bsdconfig/networking/include/Makefile ============================================================================== --- head/usr.sbin/bsdconfig/networking/include/Makefile Mon Feb 25 19:22:56 2013 (r247279) +++ head/usr.sbin/bsdconfig/networking/include/Makefile Mon Feb 25 19:55:32 2013 (r247280) @@ -3,7 +3,7 @@ NO_OBJ= FILESDIR= ${LIBEXECDIR}/bsdconfig/120.networking/include -FILES= messages.subr tcp.hlp +FILES= messages.subr beforeinstall: mkdir -p ${DESTDIR}${FILESDIR} Modified: head/usr.sbin/bsdconfig/networking/share/common.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/common.subr Mon Feb 25 19:22:56 2013 (r247279) +++ head/usr.sbin/bsdconfig/networking/share/common.subr Mon Feb 25 19:55:32 2013 (r247280) @@ -1,6 +1,6 @@ if [ ! "$_NETWORKING_COMMON_SUBR" ]; then _NETWORKING_COMMON_SUBR=1 # -# Copyright (c) 2006-2012 Devin Teske +# Copyright (c) 2006-2013 Devin Teske # All Rights Reserved. # # Redistribution and use in source and binary forms, with or without @@ -33,17 +33,6 @@ BSDCFG_SHARE="/usr/share/bsdconfig" ############################################################ FUNCTIONS -# f_mounted $local_directory -# -# Return success if a filesystem is mounted on a particular directory. -# -f_mounted() -{ - local dir="$1" - [ -d "$dir" ] || return $FAILURE - mount | grep -Eq " on $dir \([^)]+\)$" -} - # f_jailed # # Returns true if the current process is jail(8)ed. Modified: head/usr.sbin/bsdconfig/networking/share/device.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/device.subr Mon Feb 25 19:22:56 2013 (r247279) +++ head/usr.sbin/bsdconfig/networking/share/device.subr Mon Feb 25 19:55:32 2013 (r247280) @@ -1,6 +1,6 @@ if [ ! "$_NETWORKING_DEVICE_SUBR" ]; then _NETWORKING_DEVICE_SUBR=1 # -# Copyright (c) 2006-2012 Devin Teske +# Copyright (c) 2006-2013 Devin Teske # All Rights Reserved. # # Redistribution and use in source and binary forms, with or without @@ -31,8 +31,10 @@ if [ ! "$_NETWORKING_DEVICE_SUBR" ]; the BSDCFG_SHARE="/usr/share/bsdconfig" . $BSDCFG_SHARE/common.subr || exit 1 f_dprintf "%s: loading includes..." networking/device.subr +f_include $BSDCFG_SHARE/device.subr f_include $BSDCFG_SHARE/dialog.subr f_include $BSDCFG_SHARE/sysrc.subr +f_include $BSDCFG_SHARE/media/tcpip.subr f_include $BSDCFG_SHARE/networking/common.subr f_include $BSDCFG_SHARE/networking/ipaddr.subr f_include $BSDCFG_SHARE/networking/media.subr @@ -43,8 +45,6 @@ f_include $BSDCFG_SHARE/networking/routi BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking" f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr -TCP_HELPFILE=$BSDCFG_LIBE/$APP_DIR/include/tcp.hlp - ############################################################ GLOBALS # @@ -55,133 +55,6 @@ TCP_HELPFILE=$BSDCFG_LIBE/$APP_DIR/inclu ############################################################ FUNCTIONS -# f_device_desc $device_name -# -# Print a description for a device name (eg., `fxp0'). -# -f_device_desc() -{ - local device="$1" d="[1234567890]" desc="" - - # Check variables - [ "$device" ] || return $SUCCESS - - # - # Return sysctl MIB dev.NAME.UNIT.%desc if it exists, - # otherwise fall through to below static list. - # - if f_have sysctl; then - local devname devunit - devname="${device%%$d*}" - devunit="${device#$devname}" - devunit="${devunit%%[a-zA-Z_]*}" - sysctl -n "dev.$devname.$devunit.%desc" 2> /dev/null && - return $SUCCESS - fi - - case "$device" in - # Network devices - ae$d) desc="Attansic/Atheros L2 Fast Ethernet";; - age$d) desc="Attansic/Atheros L1 Gigabit Ethernet";; - alc$d) desc="Atheros AR8131/AR8132 PCIe Ethernet";; - ale$d) desc="Atheros AR8121/AR8113/AR8114 PCIe Ethernet";; - an$d) desc="Aironet 4500/4800 802.11 wireless adapter";; - ath$d) desc="Atheros IEEE 802.11 wireless adapter";; - aue$d) desc="ADMtek USB Ethernet adapter";; - axe$d) desc="ASIX Electronics USB Ethernet adapter";; - bce$d) desc="Broadcom NetXtreme II Gigabit Ethernet card";; - bfe$d) desc="Broadcom BCM440x PCI Ethernet card";; - bge$d) desc="Broadcom BCM570x PCI Gigabit Ethernet card";; - bm$d) desc="Apple BMAC Built-in Ethernet";; - bwn$d) desc="Broadcom BCM43xx IEEE 802.11 wireless adapter";; - cas$d) desc="Sun Cassini/Cassini+ or NS DP83065 Saturn Ethernet";; - cc3i$d) desc="SDL HSSI sync serial PCI card";; - cue$d) desc="CATC USB Ethernet adapter";; - cxgb$d) desc="Chelsio T3 10Gb Ethernet card";; - dc$d) desc="DEC/Intel 21143 (and clones) PCI Fast Ethernet card";; - de$d) desc="DEC DE435 PCI NIC or other DC21040-AA based card";; - disc$d) desc="Software discard network interface";; - ed$d) desc="Novell NE1000/2000; 3C503; NE2000-compatible PCMCIA";; - el$d) desc="3Com 3C501 Ethernet card";; - em$d) desc="Intel(R) PRO/1000 Ethernet card";; - en$d) desc="Efficient Networks ATM PCI card";; - ep$d) desc="3Com 3C509 Ethernet card/3C589 PCMCIA";; - et$d) desc="Agere ET1310 based PCI Express Gigabit Ethernet card";; - ex$d) desc="Intel EtherExpress Pro/10 Ethernet card";; - fe$d) desc="Fujitsu MB86960A/MB86965A Ethernet card";; - fpa$d) desc="DEC DEFPA PCI FDDI card";; - fwe$d) desc="FireWire Ethernet emulation";; - fwip$d) desc="IP over FireWire";; - fxp$d) desc="Intel EtherExpress Pro/100B PCI Fast Ethernet card";; - gem$d) desc="Apple GMAC or Sun ERI/GEM Ethernet adapter";; - hme$d) desc="Sun HME (Happy Meal Ethernet) Ethernet adapter";; - ie$d) desc="AT&T StarLAN 10 and EN100; 3Com 3C507; NI5210";; - igb$d) desc="Intel(R) PRO/1000 PCI Express Gigabit Ethernet card";; - ipw$d) desc="Intel PRO/Wireless 2100 IEEE 802.11 adapter";; - iwi$d) desc="Intel PRO/Wireless 2200BG/2225BG/2915ABG adapter";; - iwn$d) desc="Intel Wireless WiFi Link 4965AGN IEEE 802.11n adapter";; - ix$d) desc="Intel Etherexpress Ethernet card";; - ixgb$d) desc="Intel(R) PRO/10Gb Ethernet card";; - ixgbe$d) desc="Intel(R) PRO/10Gb Ethernet card";; - jme$d) desc="JMicron JMC250 Gigabit/JMC260 Fast Ethernet";; - kue$d) desc="Kawasaki LSI USB Ethernet adapter";; - le$d) desc="AMD Am7900 LANCE or Am79C9xx PCnet Ethernet adapter";; - lge$d) desc="Level 1 LXT1001 Gigabit Ethernet card";; - lnc$d) desc="Lance/PCnet (Isolan/Novell NE2100/NE32-VL) Ethernet";; - lp$d) desc="Parallel Port IP (PLIP) peer connection";; - lo$d) desc="Loop-back (local) network interface";; - malo$d) desc="Marvell Libertas 88W8335 802.11 wireless adapter";; - msk$d) desc="Marvell/SysKonnect Yukon II Gigabit Ethernet";; - mxge$d) desc="Myricom Myri10GE 10Gb Ethernet card";; - nfe$d) desc="NVIDIA nForce MCP Ethernet";; - ng${d}_*|ng$d${d}_*|ng$d$d${d}_*|ng$d$d$d${d}_*|ng$d$d$d$d${d}_*) - desc="Vimage netgraph(4) bridged Ethernet device";; - nge$d) desc="NatSemi PCI Gigabit Ethernet card";; - nve$d) desc="NVIDIA nForce MCP Ethernet";; - nxge$d) desc="Neterion Xframe 10GbE Server/Storage adapter";; - pcn$d) desc="AMD Am79c79x PCI Ethernet card";; - plip$d) desc="Parallel Port IP (PLIP) peer connection";; - ral$d) desc="Ralink Technology IEEE 802.11 wireless adapter";; - ray$d) desc="Raytheon Raylink 802.11 wireless adapter";; - re$d) desc="RealTek 8139C+/8169/8169S/8110S PCI Ethernet adapter";; - rl$d) desc="RealTek 8129/8139 PCI Ethernet card";; - rue$d) desc="RealTek USB Ethernet card";; - rum$d) desc="Ralink Technology USB IEEE 802.11 wireless adapter";; - sf$d) desc="Adaptec AIC-6915 PCI Ethernet card";; - sge$d) desc="Silicon Integrated Systems SiS190/191 Ethernet";; - sis$d) desc="SiS 900/SiS 7016 PCI Ethernet card";; - sk$d) desc="SysKonnect PCI Gigabit Ethernet card";; - sn$d) desc="SMC/Megahertz Ethernet card";; - snc$d) desc="SONIC Ethernet card";; - sr$d) desc="SDL T1/E1 sync serial PCI card";; - ste$d) desc="Sundance ST201 PCI Ethernet card";; - stge$d) desc="Sundance/Tamarack TC9021 Gigabit Ethernet";; - ti$d) desc="Alteon Networks PCI Gigabit Ethernet card";; - tl$d) desc="Texas Instruments ThunderLAN PCI Ethernet card";; - tx$d) desc="SMC 9432TX Ethernet card";; - txp$d) desc="3Com 3cR990 Ethernet card";; - uath$d) desc="Atheros AR5005UG and AR5005UX USB wireless adapter";; - upgt$d) desc="Conexant/Intersil PrismGT USB wireless adapter";; - ural$d) desc="Ralink Technology RT2500USB 802.11 wireless adapter";; - urtw$d) desc="Realtek 8187L USB wireless adapter";; - vge$d) desc="VIA VT612x PCI Gigabit Ethernet card";; - vlan$d|vlan$d$d|vlan$d$d$d|vlan$d$d$d$d|vlan$d$d$d$d$d) - desc="IEEE 802.1Q VLAN network interface";; - vr$d) desc="VIA VT3043/VT86C100A Rhine PCI Ethernet card";; - vx$d) desc="3COM 3c590 / 3c595 Ethernet card";; - wb$d) desc="Winbond W89C840F PCI Ethernet card";; - wi$d) desc="Lucent WaveLAN/IEEE 802.11 wireless adapter";; - wpi$d) desc="Intel 3945ABG IEEE 802.11 wireless adapter";; - wx$d) desc="Intel Gigabit Ethernet (82452) card";; - xe$d) desc="Xircom/Intel EtherExpress Pro100/16 Ethernet card";; - xl$d) desc="3COM 3c90x / 3c90xB PCI Ethernet card";; - zyd$d) desc="ZyDAS ZD1211/ZD1211B USB 802.11 wireless adapter";; - # Unknown device - *) desc="";; - esac - printf "%s\n" "$desc" -} - # f_dialog_menu_netdev # # Display a list of network devices with descriptions. Modified: head/usr.sbin/bsdconfig/networking/share/hostname.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/hostname.subr Mon Feb 25 19:22:56 2013 (r247279) +++ head/usr.sbin/bsdconfig/networking/share/hostname.subr Mon Feb 25 19:55:32 2013 (r247280) @@ -1,6 +1,6 @@ if [ ! "$_NETWORKING_HOSTNAME_SUBR" ]; then _NETWORKING_HOSTNAME_SUBR=1 # -# Copyright (c) 2006-2012 Devin Teske +# Copyright (c) 2006-2013 Devin Teske # All Rights Reserved. # # Redistribution and use in source and binary forms, with or without @@ -41,63 +41,6 @@ f_include_lang $BSDCFG_LIBE/$APP_DIR/inc ############################################################ FUNCTIONS -# f_validate_hostname $hostname -# -# Returns zero if the given argument (a fully-qualified hostname) is compliant -# with standards set-forth in RFC's 952 and 1123 of the Network Working Group: -# -# RFC 952 - DoD Internet host table specification -# http://tools.ietf.org/html/rfc952 -# -# RFC 1123 - Requirements for Internet Hosts - Application and Support -# http://tools.ietf.org/html/rfc1123 -# -# See http://en.wikipedia.org/wiki/Hostname for a brief overview. -# -# The return status for invalid hostnames is one of: -# 255 Entire hostname exceeds the maximum length of 255 characters. -# 63 One or more individual labels within the hostname (separated by -# dots) exceeds the maximum of 63 characters. -# 1 One or more individual labels within the hostname contains one -# or more invalid characters. -# 2 One or more individual labels within the hostname starts or -# ends with a hyphen (hyphens are allowed, but a label cannot -# begin or end with a hyphen). -# 3 One or more individual labels within the hostname are null. -# -# If the hostname is determined to be invalid, the appropriate error will be -# displayed using the f_show_msg function. -# -f_validate_hostname() -{ - local fqhn="$1" - - ( # Operate within a sub-shell to protect the parent environment - - # Return error if the hostname exceeds 255 characters - [ ${#fqhn} -gt 255 ] && exit 255 - - IFS="." # Split on `dot' - for label in $fqhn; do - - # Return error if the label exceeds 63 characters - [ ${#label} -gt 63 ] && exit 63 - - # Return error if the label is null - [ "$label" ] || exit 3 - - # Return error if label begins/ends with dash - case "$label" in - -*|*-) exit 2 - esac - - # Return error if the label contains any invalid chars - echo "$label" | grep -q '^[[:alnum:]-]*$' || exit 1 - - done - ) -} - # f_dialog_hnerror $error $hostname # # Display a msgbox with the appropriate error message for an error returned by Modified: head/usr.sbin/bsdconfig/networking/share/ipaddr.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Mon Feb 25 19:22:56 2013 (r247279) +++ head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Mon Feb 25 19:55:32 2013 (r247280) @@ -1,6 +1,6 @@ if [ ! "$_NETWORKING_IPADDR_SUBR" ]; then _NETWORKING_IPADDR_SUBR=1 # -# Copyright (c) 2006-2012 Devin Teske +# Copyright (c) 2006-2013 Devin Teske # All Rights Reserved. # # Redistribution and use in source and binary forms, with or without @@ -40,75 +40,10 @@ f_include_lang $BSDCFG_LIBE/$APP_DIR/inc ############################################################ FUNCTIONS -# f_ifconfig_inet $interface -# -# Returns the IPv4 address associated with $interface. -# -f_ifconfig_inet() -{ - local interface="$1" - ifconfig "$interface" 2> /dev/null | awk \ - ' - BEGIN { found = 0 } - ( $1 == "inet" ) \ - { - print $2 - found = 1 - exit - } - END { exit ! found } - ' -} - -# f_validate_ipaddr $ipaddr -# -# Returns zero if the given argument (an IP address) is of the proper format. -# -# The return status for invalid IP address is one of: -# 1 One or more individual octets within the IP address (separated -# by dots) contains one or more invalid characters. -# 2 One or more individual octets within the IP address are null -# and/or missing. -# 3 One or more individual octets within the IP address exceeds the -# maximum of 255 (or 2^8, being an octet comprised of 8 bits). -# 4 The IP address has either too few or too many octets. -# -f_validate_ipaddr() -{ - local ip="$1" - - ( # Operate within a sub-shell to protect the parent environment - - # Track number of octets for error checking - noctets=0 - - IFS="." # Split on `dot' - for octet in $ip; do - - # Return error if the octet is null - [ "$octet" ] || exit 2 - - # Return error if not a whole integer - f_isinteger "$octet" || exit 1 - - # Return error if not a positive integer - [ $octet -ge 0 ] || exit 1 - - # Return error if the octet exceeds 255 - [ $octet -gt 255 ] && exit 3 - - noctets=$(( $noctets + 1 )) - - done - - [ $noctets -eq 4 ] || exit 4 - ) -} - # f_dialog_iperror $error $ipaddr # # Display a msgbox with the appropriate error message for an error returned by -# the f_validate_ipaddr function above. +# the f_validate_ipaddr function. # f_dialog_iperror() { @@ -144,141 +79,6 @@ f_dialog_validate_ipaddr() return $retval } -# f_validate_ipaddr6 $ipv6_addr -# -# Returns zero if the given argument (an IPv6 address) is of the proper format. -# -# The return status for invalid IP address is one of: -# 1 One or more individual segments within the IP address -# (separated by colons) contains one or more invalid characters. -# Segments must contain only combinations of the characters 0-9, -# A-F, or a-f. -# 2 Too many/incorrect null segments. A single null segment is -# allowed within the IP address (separated by colons) but not -# allowed at the beginning or end (unless a double-null segment; -# i.e., "::*" or "*::"). -# 3 One or more individual segments within the IP address -# (separated by colons) exceeds the length of 4 hex-digits. -# 4 The IP address entered has either too few (less than 3), too -# many (more than 8), or not enough segments, separated by -# colons. -# 5* The IPv4 address at the end of the IPv6 address is invalid. -# * When there is an error with the dotted-quad IPv4 address at the -# end of the IPv6 address, the return value of 5 is OR'd with a -# bit-shifted (<< 4) return of f_validate_ipaddr. -# -f_validate_ipaddr6() -{ - local ip="$1" - - ( # Operate within a sub-shell to protect the parent environment - - IFS=":" # Split on `colon' - set -- $ip: - - # Return error if too many or too few segments - # Using 9 as max in case of leading or trailing null spanner - [ $# -gt 9 -o $# -lt 3 ] && exit 4 - - h="[0-9A-Fa-f]" - nulls=0 - nsegments=$# - contains_ipv4_segment= - - while [ $# -gt 0 ]; do - - segment="${1%:}" - shift - - # - # Return error if this segment makes one null too-many. - # A single null segment is allowed anywhere in the - # middle as well as double null segments are allowed at - # the beginning or end (but not both). - # - if [ ! "$segment" ]; then - nulls=$(( $nulls + 1 )) - if [ $nulls -eq 3 ]; then - # Only valid syntax for 3 nulls is `::' - [ "$ip" = "::" ] || exit 2 - elif [ $nulls -eq 2 ]; then - # Only valid if begins/ends with `::' - case "$ip" in - ::*|*::) : fall thru ;; - *) exit 2 - esac - fi - continue - fi - - # - # Return error if not a valid hexadecimal short - # - case "$segment" in - $h|$h$h|$h$h$h|$h$h$h$h) - : valid segment of 1-4 hexadecimal digits - ;; - *[!0-9A-Fa-f]*) - # Segment contains at least one invalid char - - # Return error immediately if not last segment - [ $# -eq 0 ] || exit 1 - - # Otherwise, check for legacy IPv4 notation - case "$segment" in - *[!0-9.]*) - # Segment contains at least one invalid - # character even for an IPv4 address - exit 1 - esac - - # Return error if not enough segments - if [ $nulls -eq 0 ]; then - [ $nsegments -eq 7 ] || exit 4 - fi *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 20:09:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7FEE6959; Mon, 25 Feb 2013 20:09:09 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 67A622F9; Mon, 25 Feb 2013 20:09:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PK98Cr004601; Mon, 25 Feb 2013 20:09:08 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PK98wF004594; Mon, 25 Feb 2013 20:09:08 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201302252009.r1PK98wF004594@svn.freebsd.org> From: Mikolaj Golub Date: Mon, 25 Feb 2013 20:09:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247281 - in head/sbin: hastctl hastd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 20:09:09 -0000 Author: trociny Date: Mon Feb 25 20:09:07 2013 New Revision: 247281 URL: http://svnweb.freebsd.org/changeset/base/247281 Log: Add i/o error counters to hastd(8) and make hastctl(8) display them. This may be useful for detecting problems with HAST disks. Discussed with and reviewed by: pjd MFC after: 1 week Modified: head/sbin/hastctl/hastctl.c head/sbin/hastd/control.c head/sbin/hastd/hast.h head/sbin/hastd/primary.c head/sbin/hastd/secondary.c Modified: head/sbin/hastctl/hastctl.c ============================================================================== --- head/sbin/hastctl/hastctl.c Mon Feb 25 19:55:32 2013 (r247280) +++ head/sbin/hastctl/hastctl.c Mon Feb 25 20:09:07 2013 (r247281) @@ -351,6 +351,12 @@ control_status(struct nv *nv) (uint64_t)nv_get_uint64(nv, "stat_flush%u", ii)); printf(" activemap updates: %ju\n", (uint64_t)nv_get_uint64(nv, "stat_activemap_update%u", ii)); + printf(" local errors: " + "read: %ju, write: %ju, delete: %ju, flush: %ju\n", + (uintmax_t)nv_get_uint64(nv, "stat_read_error%u", ii), + (uintmax_t)nv_get_uint64(nv, "stat_write_error%u", ii), + (uintmax_t)nv_get_uint64(nv, "stat_delete_error%u", ii), + (uintmax_t)nv_get_uint64(nv, "stat_flush_error%u", ii)); } return (ret); } Modified: head/sbin/hastd/control.c ============================================================================== --- head/sbin/hastd/control.c Mon Feb 25 19:55:32 2013 (r247280) +++ head/sbin/hastd/control.c Mon Feb 25 20:09:07 2013 (r247281) @@ -207,6 +207,14 @@ control_status_worker(struct hast_resour "stat_flush%u", no); nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_activemap_update"), "stat_activemap_update%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_read_error"), + "stat_read_error%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_write_error"), + "stat_write_error%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_delete_error"), + "stat_delete_error%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_flush_error"), + "stat_flush_error%u", no); end: if (cnvin != NULL) nv_free(cnvin); @@ -459,6 +467,16 @@ ctrl_thread(void *arg) nv_add_uint64(nvout, res->hr_stat_flush, "stat_flush"); nv_add_uint64(nvout, res->hr_stat_activemap_update, "stat_activemap_update"); + nv_add_uint64(nvout, res->hr_stat_read_error, + "stat_read_error"); + nv_add_uint64(nvout, res->hr_stat_write_error + + res->hr_stat_activemap_write_error, + "stat_write_error"); + nv_add_uint64(nvout, res->hr_stat_delete_error, + "stat_delete_error"); + nv_add_uint64(nvout, res->hr_stat_flush_error + + res->hr_stat_activemap_flush_error, + "stat_flush_error"); nv_add_int16(nvout, 0, "error"); break; case CONTROL_RELOAD: Modified: head/sbin/hastd/hast.h ============================================================================== --- head/sbin/hastd/hast.h Mon Feb 25 19:55:32 2013 (r247280) +++ head/sbin/hastd/hast.h Mon Feb 25 20:09:07 2013 (r247281) @@ -239,6 +239,18 @@ struct hast_resource { uint64_t hr_stat_flush; /* Number of activemap updates. */ uint64_t hr_stat_activemap_update; + /* Number of local read errors. */ + uint64_t hr_stat_read_error; + /* Number of local write errors. */ + uint64_t hr_stat_write_error; + /* Number of local delete errors. */ + uint64_t hr_stat_delete_error; + /* Number of flush errors. */ + uint64_t hr_stat_flush_error; + /* Number of activemap write errors. */ + uint64_t hr_stat_activemap_write_error; + /* Number of activemap flush errors. */ + uint64_t hr_stat_activemap_flush_error; /* Next resource. */ TAILQ_ENTRY(hast_resource) hr_next; Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Mon Feb 25 19:55:32 2013 (r247280) +++ head/sbin/hastd/primary.c Mon Feb 25 20:09:07 2013 (r247281) @@ -303,6 +303,7 @@ hast_activemap_flush(struct hast_resourc if (pwrite(res->hr_localfd, buf, size, METADATA_SIZE) != (ssize_t)size) { pjdlog_errno(LOG_ERR, "Unable to flush activemap to disk"); + res->hr_stat_activemap_write_error++; return (-1); } if (res->hr_metaflush == 1 && g_flush(res->hr_localfd) == -1) { @@ -313,6 +314,7 @@ hast_activemap_flush(struct hast_resourc } else { pjdlog_errno(LOG_ERR, "Unable to flush disk cache on activemap update"); + res->hr_stat_activemap_flush_error++; return (-1); } } @@ -1936,6 +1938,22 @@ ggate_send_thread(void *arg) "G_GATE_CMD_DONE failed"); } } + if (hio->hio_errors[0]) { + switch (ggio->gctl_cmd) { + case BIO_READ: + res->hr_stat_read_error++; + break; + case BIO_WRITE: + res->hr_stat_write_error++; + break; + case BIO_DELETE: + res->hr_stat_delete_error++; + break; + case BIO_FLUSH: + res->hr_stat_flush_error++; + break; + } + } pjdlog_debug(2, "ggate_send: (%p) Moving request to the free queue.", hio); QUEUE_INSERT2(hio, free); Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Mon Feb 25 19:55:32 2013 (r247280) +++ head/sbin/hastd/secondary.c Mon Feb 25 20:09:07 2013 (r247281) @@ -765,6 +765,7 @@ disk_thread(void *arg) pjdlog_errno(LOG_WARNING, "Unable to store cleared activemap"); free(map); + res->hr_stat_activemap_write_error++; break; } free(map); @@ -883,8 +884,23 @@ send_thread(void *arg) PJDLOG_ABORT("Unexpected command (cmd=%hhu).", hio->hio_cmd); } - if (hio->hio_error != 0) + if (hio->hio_error != 0) { + switch (hio->hio_cmd) { + case HIO_READ: + res->hr_stat_read_error++; + break; + case HIO_WRITE: + res->hr_stat_write_error++; + break; + case HIO_DELETE: + res->hr_stat_delete_error++; + break; + case HIO_FLUSH: + res->hr_stat_flush_error++; + break; + } nv_add_int16(nvout, hio->hio_error, "error"); + } if (hast_proto_send(res, res->hr_remoteout, nvout, data, length) == -1) { secondary_exit(EX_TEMPFAIL, "Unable to send reply"); From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 20:31:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 59C21195; Mon, 25 Feb 2013 20:31:48 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 35C00662; Mon, 25 Feb 2013 20:31:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PKVmZP012700; Mon, 25 Feb 2013 20:31:48 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PKVmxK012699; Mon, 25 Feb 2013 20:31:48 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201302252031.r1PKVmxK012699@svn.freebsd.org> From: Neel Natu Date: Mon, 25 Feb 2013 20:31:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247282 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 20:31:48 -0000 Author: neel Date: Mon Feb 25 20:31:47 2013 New Revision: 247282 URL: http://svnweb.freebsd.org/changeset/base/247282 Log: Get rid of unused struct member. Pointed out by: Gopakumar T Obtained from: NetApp Modified: head/usr.sbin/bhyve/pci_emul.h Modified: head/usr.sbin/bhyve/pci_emul.h ============================================================================== --- head/usr.sbin/bhyve/pci_emul.h Mon Feb 25 20:09:07 2013 (r247281) +++ head/usr.sbin/bhyve/pci_emul.h Mon Feb 25 20:31:47 2013 (r247282) @@ -105,7 +105,6 @@ struct pci_devinst { uint8_t pi_bus, pi_slot, pi_func; uint8_t pi_lintr_pin; char pi_name[PI_NAMESZ]; - uint16_t pi_iobase; int pi_bar_getsize; struct { From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 20:50:08 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D075B58D; Mon, 25 Feb 2013 20:50:08 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C3735730; Mon, 25 Feb 2013 20:50:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PKo8Zc016718; Mon, 25 Feb 2013 20:50:08 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PKo8BO016717; Mon, 25 Feb 2013 20:50:08 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201302252050.r1PKo8BO016717@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 25 Feb 2013 20:50:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247283 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 20:50:08 -0000 Author: pjd Date: Mon Feb 25 20:50:08 2013 New Revision: 247283 URL: http://svnweb.freebsd.org/changeset/base/247283 Log: After r237012, the fdgrowtable() doesn't drop the filedesc lock anymore, so update a stale comment. Reviewed by: kib, keramida Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Feb 25 20:31:47 2013 (r247282) +++ head/sys/kern/kern_descrip.c Mon Feb 25 20:50:08 2013 (r247283) @@ -855,9 +855,7 @@ do_dup(struct thread *td, int flags, int /* * If the caller specified a file descriptor, make sure the file * table is large enough to hold it, and grab it. Otherwise, just - * allocate a new descriptor the usual way. Since the filedesc - * lock may be temporarily dropped in the process, we have to look - * out for a race. + * allocate a new descriptor the usual way. */ if (flags & DUP_FIXED) { if (new >= fdp->fd_nfiles) { From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 20:51:30 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0AA2C761; Mon, 25 Feb 2013 20:51:30 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E762774D; Mon, 25 Feb 2013 20:51:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PKpTKH018504; Mon, 25 Feb 2013 20:51:29 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PKpTe4018503; Mon, 25 Feb 2013 20:51:29 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201302252051.r1PKpTe4018503@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 25 Feb 2013 20:51:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247284 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 20:51:30 -0000 Author: pjd Date: Mon Feb 25 20:51:29 2013 New Revision: 247284 URL: http://svnweb.freebsd.org/changeset/base/247284 Log: Style. Suggested by: kib Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Feb 25 20:50:08 2013 (r247283) +++ head/sys/kern/kern_descrip.c Mon Feb 25 20:51:29 2013 (r247284) @@ -1425,8 +1425,7 @@ fdgrowtable(struct filedesc *fdp, int nf FILEDESC_XLOCK_ASSERT(fdp); - KASSERT(fdp->fd_nfiles > 0, - ("zero-length file table")); + KASSERT(fdp->fd_nfiles > 0, ("zero-length file table")); /* save old values */ onfiles = fdp->fd_nfiles; @@ -1447,13 +1446,11 @@ fdgrowtable(struct filedesc *fdp, int nf * it on the freelist. We place the struct freetable in the * middle so we don't have to worry about padding. */ - ntable = malloc(nnfiles * sizeof(*ntable) + - sizeof(struct freetable) + - nnfiles * sizeof(*nfileflags), - M_FILEDESC, M_ZERO | M_WAITOK); + ntable = malloc(nnfiles * sizeof(*ntable) + sizeof(struct freetable) + + nnfiles * sizeof(*nfileflags), M_FILEDESC, M_ZERO | M_WAITOK); nfileflags = (char *)&ntable[nnfiles] + sizeof(struct freetable); - nmap = malloc(NDSLOTS(nnfiles) * NDSLOTSIZE, - M_FILEDESC, M_ZERO | M_WAITOK); + nmap = malloc(NDSLOTS(nnfiles) * NDSLOTSIZE, M_FILEDESC, + M_ZERO | M_WAITOK); /* copy the old data over and point at the new tables */ memcpy(ntable, otable, onfiles * sizeof(*otable)); From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 21:00:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 92E75C88; Mon, 25 Feb 2013 21:00:17 +0000 (UTC) (envelope-from alc@rice.edu) Received: from proofpoint1.mail.rice.edu (proofpoint1.mail.rice.edu [128.42.201.100]) by mx1.freebsd.org (Postfix) with ESMTP id 590887BE; Mon, 25 Feb 2013 21:00:16 +0000 (UTC) Received: from pps.filterd (proofpoint1 [127.0.0.1]) by proofpoint1.mail.rice.edu (8.14.5/8.14.5) with SMTP id r1PCuGgY022295; Mon, 25 Feb 2013 15:00:15 -0600 Received: from mh1.mail.rice.edu (mh1.mail.rice.edu [128.42.201.20]) by proofpoint1.mail.rice.edu with ESMTP id 1ant268ehq-1; Mon, 25 Feb 2013 15:00:15 -0600 Received: from mh1.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh1.mail.rice.edu (Postfix) with ESMTP id 830E0460147; Mon, 25 Feb 2013 15:00:15 -0600 (CST) Received: from mh1.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh1.mail.rice.edu (Postfix) with ESMTP id 7FC0A4600F9; Mon, 25 Feb 2013 15:00:15 -0600 (CST) X-Virus-Scanned: by amavis-2.7.0 at mh1.mail.rice.edu, auth channel Received: from mh1.mail.rice.edu ([127.0.0.1]) by mh1.mail.rice.edu (mh1.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id gvV7cGiGMJDj; Mon, 25 Feb 2013 15:00:15 -0600 (CST) Received: from staff-84-wless194-019.rice.edu (staff-84-wless194-019.rice.edu [10.84.194.19]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh1.mail.rice.edu (Postfix) with ESMTPSA id 2000A46015E; Mon, 25 Feb 2013 15:00:13 -0600 (CST) Subject: Re: svn commit: r247116 - in head/sys: fs/nfs fs/nfsclient kern nfsclient sys tools Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=us-ascii From: Alan Cox In-Reply-To: <20130225233603.49a5d4a5@bender> Date: Mon, 25 Feb 2013 15:00:41 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <8006325C-B281-4F4D-BE1A-C3B444FE979F@rice.edu> References: <201302211902.r1LJ2o5T033708@svn.freebsd.org> <20130225201313.2050da18@bender> <20130225085019.GU2454@kib.kiev.ua> <20130225233603.49a5d4a5@bender> To: Andrew Turner X-Mailer: Apple Mail (2.1085) Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 21:00:17 -0000 On Feb 25, 2013, at 4:36 AM, Andrew Turner wrote: > On Mon, 25 Feb 2013 10:50:19 +0200 > Konstantin Belousov wrote: >=20 >> On Mon, Feb 25, 2013 at 08:13:13PM +1300, Andrew Turner wrote: >>> On Thu, 21 Feb 2013 19:02:50 +0000 (UTC) >>> John Baldwin wrote: >>>=20 >>>> Author: jhb >>>> Date: Thu Feb 21 19:02:50 2013 >>>> New Revision: 247116 >>>> URL: http://svnweb.freebsd.org/changeset/base/247116 >>>>=20 >>>> Log: >>>> Further refine the handling of stop signals in the NFS client. >>>> The changes in r246417 were incomplete as they did not add >>>> explicit calls to sigdeferstop() around all the places that >>>> previously passed SBDRY to _sleep(). In addition, >>>> nfs_getcacheblk() could trigger a write RPC from getblk() >>>> resulting in sigdeferstop() recursing. Rather than manually >>>> deferring stop signals in specific places, change the VFS_*() and >>>> VOP_*() methods to defer stop signals for filesystems which >>>> request this behavior via a new VFCF_SBDRY flag. Note that this >>>> has to be a VFC flag rather than a MNTK flag so that it works >>>> properly with VFS_MOUNT() when the mount is not yet fully >>>> constructed. For now, only the NFS clients are set this new flag >>>> in VFS_SET(). A few other related changes: >>>> - Add an assertion to ensure that TDF_SBDRY doesn't leak to >>>> userland. >>>> - When a lookup request uses VOP_READLINK() to follow a symlink, >>>> mark the request as being on behalf of the thread performing the >>>> lookup (cnp_thread) rather than using a NULL thread pointer. This >>>> causes NFS to properly handle signals during this VOP on an >>>> interruptible mount. >>>>=20 >>>> PR: kern/176179 >>>> Reported by: Russell Cattelan (sigdeferstop() recursion) >>>> Reviewed by: kib >>>> MFC after: 1 month >>>=20 >>> This change is causing init to crash for me on armv6. I'm >>> netbooting a PandaBoard and it appears init is receiving a SIGABRT >>> before it gets into main(). >>>=20 >>> Do you have any idea where I could look to track down why it is >>> doing this? >>=20 >> It is weird. SIGABRT sent by the kernel usually means that execve(2) >> already destroyed the previous address space of the process, but the >> new image cannot be activated, most likely due to image format error >> discovered too late, or resource shortage. >>=20 >> Could it be that some NFS RPC fails after the patch, but I cannot >> imagine why. You would need to track this. Also, verify that the init >> binary is correct. >>=20 >> I tried amd64 netboot, and it worked fine. >=20 > It looks like this change is not the issue, it just changed the > symptom enough for me to not realise I was seeing an issue where > it would crash the kernel before. I reinstated this change but only > allowed the kernel to access half the memory and it booted correctly. >=20 > The real issue appears to be related to something in the vm layer not > working on ARM boards with too much memory (somewhere between 512MiB > and 1GiB). The recently introduced auto-sizing and cap may be too optimistic. In = fact, they are greater than what we allow on 32-bit x86 and 32-bit MIPS. Try the following. Index: arm/include/vmparam.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- arm/include/vmparam.h (revision 247249) +++ arm/include/vmparam.h (working copy) @@ -142,15 +142,15 @@ #define VM_KMEM_SIZE (12*1024*1024) #endif #ifndef VM_KMEM_SIZE_SCALE -#define VM_KMEM_SIZE_SCALE (2) +#define VM_KMEM_SIZE_SCALE (3) #endif =20 /* - * Ceiling on the size of the kmem submap: 60% of the kernel map. + * Ceiling on the size of the kmem submap: 40% of the kernel map. */ #ifndef VM_KMEM_SIZE_MAX #define VM_KMEM_SIZE_MAX ((vm_max_kernel_address - \ - VM_MIN_KERNEL_ADDRESS + 1) * 3 / 5) + VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5) #endif =20 #define MAXTSIZ (16*1024*1024) From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 22:25:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 081102A8; Mon, 25 Feb 2013 22:25:57 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EF0C1B6F; Mon, 25 Feb 2013 22:25:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PMPuol046614; Mon, 25 Feb 2013 22:25:56 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PMPuYJ046613; Mon, 25 Feb 2013 22:25:56 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201302252225.r1PMPuYJ046613@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Mon, 25 Feb 2013 22:25:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247285 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 22:25:57 -0000 Author: des Date: Mon Feb 25 22:25:56 2013 New Revision: 247285 URL: http://svnweb.freebsd.org/changeset/base/247285 Log: In all situations where we need to bootstrap yacc, we also need to bootstrap liby. This was not readily apparent, because a normal 'make buildworld' or 'make toolchain' builds liby before building anything that uses yacc. However, 'make kernel-toolchain' does not build headers or libraries, so it was not possible to build a kernel from head on, say, stable/9 without first building the complete toolchain. MFC after: 1 week Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Feb 25 20:51:29 2013 (r247284) +++ head/Makefile.inc1 Mon Feb 25 22:25:56 2013 (r247285) @@ -1132,7 +1132,8 @@ _lex= usr.bin/lex .endif .if ${BOOTSTRAPPING} < 1000013 -_yacc= usr.bin/yacc +_yacc= lib/liby \ + usr.bin/yacc .endif .if ${BOOTSTRAPPING} < 1000026 From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 22:42:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2A6EE77E; Mon, 25 Feb 2013 22:42:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 863DED03; Mon, 25 Feb 2013 22:42:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PMgkbg051990; Mon, 25 Feb 2013 22:42:46 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PMghVO051966; Mon, 25 Feb 2013 22:42:43 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201302252242.r1PMghVO051966@svn.freebsd.org> From: Adrian Chadd Date: Mon, 25 Feb 2013 22:42:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247286 - in head/sys/dev/ath: . ath_hal ath_hal/ar5210 ath_hal/ar5211 ath_hal/ar5212 ath_hal/ar5416 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 22:42:47 -0000 Author: adrian Date: Mon Feb 25 22:42:43 2013 New Revision: 247286 URL: http://svnweb.freebsd.org/changeset/base/247286 Log: Begin adding support to explicitly set the current chainmask. Right now the only way to set the chainmask is to set the hardware configured chainmask through capabilities. This is fine for forcing the chainmask to be something other than what the hardware is capable of (eg to reduce TX/RX to one connected antenna) but it does change what the HAL hardware chainmask configuration is. For operational mode changes, it (may?) make sense to separately control the TX/RX chainmask. Right now it's done as part of ar5416_reset.c - ar5416UpdateChainMasks() calculates which TX/RX chainmasks to enable based on the operating mode. (1 for legacy and whatever is supported for 11n operation.) But doing this in the HAL is suboptimal - the driver needs to know the currently configured chainmask in order to correctly enable things for each TX descriptor. This is currently done by overriding the chainmask config in the ar5416 TX routines but this has to disappear - the AR9300 HAL support requires the driver to dynamically set the TX chainmask based on the TX power and TX rate in order to meet mini-PCIe slot power requirements. So: * Introduce a new HAL method to set the operational chainmask variables; * Introduce null methods for the previous generation chipsets; * Add new driver state to record the current chainmask separate from the hardware configured chainmask. Part #2 of this will involve disabling ar5416UpdateChainMasks() and moving it into the driver; as well as properly programming the TX chainmask based on the currently configured HAL chainmask. Tested: * AR5416, STA mode - both legacy (11a/11bg) and 11n rates - verified that AR_SELFGEN_MASK (the chainmask used for self-generated frames like ACKs and RTSes) is correct, as well as the TX descriptor contents is correct. Modified: head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5210/ar5210.h head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c head/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c head/sys/dev/ath/ath_hal/ar5211/ar5211.h head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c head/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Mon Feb 25 22:25:56 2013 (r247285) +++ head/sys/dev/ath/ath_hal/ah.h Mon Feb 25 22:42:43 2013 (r247286) @@ -1437,6 +1437,8 @@ struct ath_hal { HAL_STATUS __ahdecl(*ah_setQuiet)(struct ath_hal *ah, uint32_t period, uint32_t duration, uint32_t nextStart, HAL_QUIET_FLAG flag); + void __ahdecl(*ah_setChainMasks)(struct ath_hal *, + uint32_t, uint32_t); /* DFS functions */ void __ahdecl(*ah_enableDfs)(struct ath_hal *ah, Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210.h Mon Feb 25 22:25:56 2013 (r247285) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210.h Mon Feb 25 22:42:43 2013 (r247286) @@ -259,6 +259,7 @@ extern HAL_BOOL ar5210GetDiagState(struc extern uint32_t ar5210Get11nExtBusy(struct ath_hal *); extern HAL_BOOL ar5210GetMibCycleCounts(struct ath_hal *, HAL_SURVEY_SAMPLE *); +extern void ar5210SetChainMasks(struct ath_hal *, uint32_t, uint32_t); extern void ar5210EnableDfs(struct ath_hal *, HAL_PHYERR_PARAM *); extern void ar5210GetDfsThresh(struct ath_hal *, HAL_PHYERR_PARAM *); extern void ar5210UpdateDiagReg(struct ath_hal *ah, uint32_t val); Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Mon Feb 25 22:25:56 2013 (r247285) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Mon Feb 25 22:42:43 2013 (r247286) @@ -137,6 +137,7 @@ static const struct ath_hal_private ar52 .ah_setCoverageClass = ar5210SetCoverageClass, .ah_get11nExtBusy = ar5210Get11nExtBusy, .ah_getMibCycleCounts = ar5210GetMibCycleCounts, + .ah_setChainMasks = ar5210SetChainMasks, .ah_enableDfs = ar5210EnableDfs, .ah_getDfsThresh = ar5210GetDfsThresh, /* XXX procRadarEvent */ Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c Mon Feb 25 22:25:56 2013 (r247285) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c Mon Feb 25 22:42:43 2013 (r247286) @@ -671,6 +671,12 @@ ar5210GetMibCycleCounts(struct ath_hal * } void +ar5210SetChainMasks(struct ath_hal *ah, uint32_t txchainmask, + uint32_t rxchainmask) +{ +} + +void ar5210EnableDfs(struct ath_hal *ah, HAL_PHYERR_PARAM *pe) { } Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211.h Mon Feb 25 22:25:56 2013 (r247285) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211.h Mon Feb 25 22:42:43 2013 (r247286) @@ -286,6 +286,8 @@ extern HAL_BOOL ar5211GetDiagState(struc extern uint32_t ar5211Get11nExtBusy(struct ath_hal *); extern HAL_BOOL ar5211GetMibCycleCounts(struct ath_hal *, HAL_SURVEY_SAMPLE *); +extern void ar5211SetChainMasks(struct ath_hal *ah, uint32_t, uint32_t); + extern void ar5211EnableDfs(struct ath_hal *, HAL_PHYERR_PARAM *); extern void ar5211GetDfsThresh(struct ath_hal *, HAL_PHYERR_PARAM *); Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c Mon Feb 25 22:25:56 2013 (r247285) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c Mon Feb 25 22:42:43 2013 (r247286) @@ -137,6 +137,7 @@ static const struct ath_hal_private ar52 .ah_setCoverageClass = ar5211SetCoverageClass, .ah_get11nExtBusy = ar5211Get11nExtBusy, .ah_getMibCycleCounts = ar5211GetMibCycleCounts, + .ah_setChainMasks = ar5211SetChainMasks, .ah_enableDfs = ar5211EnableDfs, .ah_getDfsThresh = ar5211GetDfsThresh, /* XXX procRadarEvent */ Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c Mon Feb 25 22:25:56 2013 (r247285) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c Mon Feb 25 22:42:43 2013 (r247286) @@ -711,6 +711,12 @@ ar5211GetMibCycleCounts(struct ath_hal * } void +ar5211SetChainMasks(struct ath_hal *ah, uint32_t txchainmask, + uint32_t rxchainmask) +{ +} + +void ar5211EnableDfs(struct ath_hal *ah, HAL_PHYERR_PARAM *pe) { } Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212.h Mon Feb 25 22:25:56 2013 (r247285) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h Mon Feb 25 22:42:43 2013 (r247286) @@ -513,6 +513,7 @@ extern HAL_STATUS ar5212SetQuiet(struct uint32_t duration, uint32_t nextStart, HAL_QUIET_FLAG flag); extern HAL_BOOL ar5212GetMibCycleCounts(struct ath_hal *, HAL_SURVEY_SAMPLE *); +extern void ar5212SetChainMasks(struct ath_hal *, uint32_t, uint32_t); extern HAL_BOOL ar5212SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip); Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Mon Feb 25 22:25:56 2013 (r247285) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Mon Feb 25 22:42:43 2013 (r247286) @@ -134,6 +134,7 @@ static const struct ath_hal_private ar52 .ah_setCoverageClass = ar5212SetCoverageClass, .ah_setQuiet = ar5212SetQuiet, .ah_getMibCycleCounts = ar5212GetMibCycleCounts, + .ah_setChainMasks = ar5212SetChainMasks, /* DFS Functions */ .ah_enableDfs = ar5212EnableDfs, Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Mon Feb 25 22:25:56 2013 (r247285) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Mon Feb 25 22:42:43 2013 (r247286) @@ -1413,3 +1413,9 @@ ar5212GetMibCycleCounts(struct ath_hal * return (AH_FALSE); } + +void +ar5212SetChainMasks(struct ath_hal *ah, uint32_t tx_chainmask, + uint32_t rx_chainmask) +{ +} Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Mon Feb 25 22:25:56 2013 (r247285) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Mon Feb 25 22:42:43 2013 (r247286) @@ -239,6 +239,7 @@ extern HAL_BOOL ar5416SetDecompMask(stru extern void ar5416SetCoverageClass(struct ath_hal *, uint8_t, int); extern HAL_BOOL ar5416GetMibCycleCounts(struct ath_hal *ah, HAL_SURVEY_SAMPLE *hsample); +extern void ar5416SetChainMasks(struct ath_hal *ah, uint32_t, uint32_t); extern uint32_t ar5416Get11nExtBusy(struct ath_hal *ah); extern void ar5416Set11nMac2040(struct ath_hal *ah, HAL_HT_MACMODE mode); extern HAL_HT_RXCLEAR ar5416Get11nRxClear(struct ath_hal *ah); Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Mon Feb 25 22:25:56 2013 (r247285) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Mon Feb 25 22:42:43 2013 (r247286) @@ -150,6 +150,7 @@ ar5416InitState(struct ath_hal_5416 *ahp ah->ah_setCoverageClass = ar5416SetCoverageClass; ah->ah_setQuiet = ar5416SetQuiet; ah->ah_getMibCycleCounts = ar5416GetMibCycleCounts; + ah->ah_setChainMasks = ar5416SetChainMasks; ah->ah_resetKeyCacheEntry = ar5416ResetKeyCacheEntry; ah->ah_setKeyCacheEntry = ar5416SetKeyCacheEntry; Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Mon Feb 25 22:25:56 2013 (r247285) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Mon Feb 25 22:42:43 2013 (r247286) @@ -256,6 +256,20 @@ ar5416GetMibCycleCounts(struct ath_hal * } /* + * Setup the TX/RX chainmasks - this needs to be done before a call + * to the reset method as it doesn't update the hardware. + */ +void +ar5416SetChainMasks(struct ath_hal *ah, uint32_t tx_chainmask, + uint32_t rx_chainmask) +{ + HAL_CAPABILITIES *pCap = &AH_PRIVATE(ah)->ah_caps; + + AH5416(ah)->ah_tx_chainmask = tx_chainmask & pCap->halTxChainMask; + AH5416(ah)->ah_rx_chainmask = rx_chainmask & pCap->halRxChainMask; +} + +/* * Return approximation of extension channel busy over an time interval * 0% (clear) -> 100% (busy) * Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Feb 25 22:25:56 2013 (r247285) +++ head/sys/dev/ath/if_athvar.h Mon Feb 25 22:42:43 2013 (r247286) @@ -715,8 +715,10 @@ struct ath_softc { u_int32_t sc_avgtsfdeltap;/* TDMA slot adjust (+) */ u_int32_t sc_avgtsfdeltam;/* TDMA slot adjust (-) */ uint16_t *sc_eepromdata; /* Local eeprom data, if AR9100 */ - int sc_txchainmask; /* currently configured TX chainmask */ - int sc_rxchainmask; /* currently configured RX chainmask */ + int sc_txchainmask; /* hardware TX chainmask */ + int sc_rxchainmask; /* hardware RX chainmask */ + int sc_cur_txchainmask; /* currently configured TX chainmask */ + int sc_cur_rxchainmask; /* currently configured RX chainmask */ int sc_rts_aggr_limit; /* TX limit on RTS aggregates */ int sc_aggr_limit; /* TX limit on all aggregates */ int sc_delim_min_pad; /* Minimum delimiter count */ @@ -1334,6 +1336,8 @@ void ath_intr(void *); ((*(_ah)->ah_getMibCycleCounts)((_ah), (_sample))) #define ath_hal_get_chan_ext_busy(_ah) \ ((*(_ah)->ah_get11nExtBusy)((_ah))) +#define ath_hal_setchainmasks(_ah, _txchainmask, _rxchainmask) \ + ((*(_ah)->ah_setChainMasks)((_ah), (_txchainmask), (_rxchainmask))) #define ath_hal_spectral_supported(_ah) \ (ath_hal_getcapability(_ah, HAL_CAP_SPECTRAL_SCAN, 0, NULL) == HAL_OK) From owner-svn-src-head@FreeBSD.ORG Mon Feb 25 22:45:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4C9FA93C; Mon, 25 Feb 2013 22:45:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3035ED30; Mon, 25 Feb 2013 22:45:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PMj4QR052388; Mon, 25 Feb 2013 22:45:04 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PMj3Bn052384; Mon, 25 Feb 2013 22:45:03 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201302252245.r1PMj3Bn052384@svn.freebsd.org> From: Adrian Chadd Date: Mon, 25 Feb 2013 22:45:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247287 - in head/sys/dev/ath: . ath_hal/ar5416 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 22:45:04 -0000 Author: adrian Date: Mon Feb 25 22:45:02 2013 New Revision: 247287 URL: http://svnweb.freebsd.org/changeset/base/247287 Log: Part #2 of the TX chainmask changes: * Remove ar5416UpdateChainmasks(); * Remove the TX chainmask override code from the ar5416 TX descriptor setup routines; * Write a driver method to calculate the current chainmask based on the operating mode and update the driver state; * Call the HAL chainmask method before calling ath_hal_reset(); * Use the currently configured chainmask in the TX descriptors rather than the hardware TX chainmasks. Tested: * AR5416, STA/AP mode - legacy and 11n modes Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Mon Feb 25 22:42:43 2013 (r247286) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Mon Feb 25 22:45:02 2013 (r247287) @@ -44,7 +44,6 @@ static void ar5416InitBB(struct ath_hal static void ar5416InitIMR(struct ath_hal *ah, HAL_OPMODE opmode); static void ar5416InitQoS(struct ath_hal *ah); static void ar5416InitUserSettings(struct ath_hal *ah); -static void ar5416UpdateChainMasks(struct ath_hal *ah, HAL_BOOL is_ht); static void ar5416OverrideIni(struct ath_hal *ah, const struct ieee80211_channel *); #if 0 @@ -210,11 +209,6 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO __func__, OS_REG_READ(ah,AR_PHY_ADC_CTL)); /* - * Setup ah_tx_chainmask / ah_rx_chainmask before we fiddle - * with enabling the TX/RX radio chains. - */ - ar5416UpdateChainMasks(ah, IEEE80211_IS_CHAN_HT(chan)); - /* * This routine swaps the analog chains - it should be done * before any radio register twiddling is done. */ @@ -1464,31 +1458,6 @@ ar5416RestoreChainMask(struct ath_hal *a } } -/* - * Update the chainmask based on the current channel configuration. - * - * XXX ath9k checks bluetooth co-existence here - * XXX ath9k checks whether the current state is "off-channel". - * XXX ath9k sticks the hardware into 1x1 mode for legacy; - * we're going to leave multi-RX on for multi-path cancellation. - */ -static void -ar5416UpdateChainMasks(struct ath_hal *ah, HAL_BOOL is_ht) -{ - struct ath_hal_private *ahpriv = AH_PRIVATE(ah); - HAL_CAPABILITIES *pCap = &ahpriv->ah_caps; - - if (is_ht) { - AH5416(ah)->ah_tx_chainmask = pCap->halTxChainMask; - } else { - AH5416(ah)->ah_tx_chainmask = 1; - } - AH5416(ah)->ah_rx_chainmask = pCap->halRxChainMask; - HALDEBUG(ah, HAL_DEBUG_RESET, "TX chainmask: 0x%x; RX chainmask: 0x%x\n", - AH5416(ah)->ah_tx_chainmask, - AH5416(ah)->ah_rx_chainmask); -} - void ar5416InitPLL(struct ath_hal *ah, const struct ieee80211_channel *chan) { Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Mon Feb 25 22:42:43 2013 (r247286) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Mon Feb 25 22:45:02 2013 (r247287) @@ -701,20 +701,6 @@ ar5416Set11nRateScenario(struct ath_hal (void)nseries; /* - * XXX since the upper layers doesn't know the current chainmask - * XXX setup, just override its decisions here. - * XXX The upper layers need to be taught this! - */ - if (series[0].Tries != 0) - series[0].ChSel = AH5416(ah)->ah_tx_chainmask; - if (series[1].Tries != 0) - series[1].ChSel = AH5416(ah)->ah_tx_chainmask; - if (series[2].Tries != 0) - series[2].ChSel = AH5416(ah)->ah_tx_chainmask; - if (series[3].Tries != 0) - series[3].ChSel = AH5416(ah)->ah_tx_chainmask; - - /* * Only one of RTS and CTS enable must be set. * If a frame has both set, just do RTS protection - * that's enough to satisfy legacy protection. Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Feb 25 22:42:43 2013 (r247286) +++ head/sys/dev/ath/if_ath.c Mon Feb 25 22:45:02 2013 (r247287) @@ -1476,6 +1476,26 @@ ath_reset_keycache(struct ath_softc *sc) ieee80211_crypto_reload_keys(ic); } +/* + * Fetch the current chainmask configuration based on the current + * operating channel and options. + */ +static void +ath_update_chainmasks(struct ath_softc *sc, struct ieee80211_channel *chan) +{ + + /* + * Set TX chainmask to the currently configured chainmask; + * the TX chainmask depends upon the current operating mode. + */ + sc->sc_cur_rxchainmask = sc->sc_rxchainmask; + if (IEEE80211_IS_CHAN_HT(chan)) { + sc->sc_cur_txchainmask = sc->sc_txchainmask; + } else { + sc->sc_cur_txchainmask = 1; + } +} + void ath_resume(struct ath_softc *sc) { @@ -1494,6 +1514,10 @@ ath_resume(struct ath_softc *sc) * Must reset the chip before we reload the * keycache as we were powered down on suspend. */ + ath_update_chainmasks(sc, + sc->sc_curchan != NULL ? sc->sc_curchan : ic->ic_curchan); + ath_hal_setchainmasks(sc->sc_ah, sc->sc_cur_txchainmask, + sc->sc_cur_rxchainmask); ath_hal_reset(ah, sc->sc_opmode, sc->sc_curchan != NULL ? sc->sc_curchan : ic->ic_curchan, AH_FALSE, &status); @@ -1935,6 +1959,9 @@ ath_init(void *arg) * and then setup of the interrupt mask. */ ath_settkipmic(sc); + ath_update_chainmasks(sc, ic->ic_curchan); + ath_hal_setchainmasks(sc->sc_ah, sc->sc_cur_txchainmask, + sc->sc_cur_rxchainmask); if (!ath_hal_reset(ah, sc->sc_opmode, ic->ic_curchan, AH_FALSE, &status)) { if_printf(ifp, "unable to reset hardware; hal status %u\n", status); @@ -2250,6 +2277,9 @@ ath_reset(struct ifnet *ifp, ATH_RESET_T ath_settkipmic(sc); /* configure TKIP MIC handling */ /* NB: indicate channel change so we do a full reset */ + ath_update_chainmasks(sc, ic->ic_curchan); + ath_hal_setchainmasks(sc->sc_ah, sc->sc_cur_txchainmask, + sc->sc_cur_rxchainmask); if (!ath_hal_reset(ah, sc->sc_opmode, ic->ic_curchan, AH_TRUE, &status)) if_printf(ifp, "%s: unable to reset hardware; hal status %u\n", __func__, status); @@ -4440,6 +4470,9 @@ ath_chan_set(struct ath_softc *sc, struc */ ath_draintxq(sc, ATH_RESET_FULL); /* clear pending tx frames */ + ath_update_chainmasks(sc, chan); + ath_hal_setchainmasks(sc->sc_ah, sc->sc_cur_txchainmask, + sc->sc_cur_rxchainmask); if (!ath_hal_reset(ah, sc->sc_opmode, chan, AH_TRUE, &status)) { if_printf(ifp, "%s: unable to reset " "channel %u (%u MHz, flags 0x%x), hal status %u\n", Modified: head/sys/dev/ath/if_ath_tx_ht.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_ht.c Mon Feb 25 22:42:43 2013 (r247286) +++ head/sys/dev/ath/if_ath_tx_ht.c Mon Feb 25 22:45:02 2013 (r247287) @@ -499,20 +499,13 @@ ath_rateseries_setup(struct ath_softc *s series[i].Tries = rc[i].tries; /* - * XXX this isn't strictly correct - sc_txchainmask - * XXX isn't the currently active chainmask; - * XXX it's the interface chainmask at startup. - * XXX It's overridden in the HAL rate scenario function - * XXX for now. - */ - /* * XXX TODO: When the NIC is capable of three stream TX, * transmit 1/2 stream rates on two streams. * * This reduces the power consumption of the NIC and * keeps it within the PCIe slot power limits. */ - series[i].ChSel = sc->sc_txchainmask; + series[i].ChSel = sc->sc_cur_txchainmask; if (flags & (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA)) series[i].RateFlags |= HAL_RATESERIES_RTS_CTS; @@ -542,6 +535,14 @@ ath_rateseries_setup(struct ath_softc *s ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20) series[i].RateFlags |= HAL_RATESERIES_HALFGI; + /* + * XXX TODO: STBC if it's possible + */ + + /* + * XXX TODO: LDPC if it's possible + */ + series[i].Rate = rt->info[rc[i].rix].rateCode; series[i].RateIndex = rc[i].rix; series[i].tx_power_cap = 0x3f; /* XXX for now */ From owner-svn-src-head@FreeBSD.ORG Tue Feb 26 00:02:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 18D315C3; Tue, 26 Feb 2013 00:02:31 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id D2CD3F8E; Tue, 26 Feb 2013 00:02:30 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 17F5D358C5D; Tue, 26 Feb 2013 01:02:28 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 02AD52848C; Tue, 26 Feb 2013 01:02:27 +0100 (CET) Date: Tue, 26 Feb 2013 01:02:27 +0100 From: Jilles Tjoelker To: Peter Jeremy Subject: Re: svn commit: r247274 - in head: bin/test tools/regression/bin/test Message-ID: <20130226000227.GA80718@stack.nl> References: <201302251905.r1PJ5fKF085179@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201302251905.r1PJ5fKF085179@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 00:02:31 -0000 On Mon, Feb 25, 2013 at 07:05:41PM +0000, Peter Jeremy wrote: > Author: peterj > Date: Mon Feb 25 19:05:40 2013 > New Revision: 247274 > URL: http://svnweb.freebsd.org/changeset/base/247274 > Log: > Enhance test(1) by adding provision to compare any combination of the > access, birth, change and modify times of two files, instead of only > being able to compare modify times. The builtin test in sh(1) will > automagically acquire the same expansion. > Approved by: grog > MFC after: 2 weeks What do you need this for? If it is not needed very often, this test can be done more portably (older FreeBSD and GNU) as [ -n "$(find -L FILE1 -prune -newerXY FILE2 2>/dev/null)" ] (If FILE1 is certainly not a directory, -prune can be omitted; if FILE1 is certainly not a symlink or should not be followed, -L can be omitted; the 2>/dev/null silences error messages about nonexistent files that test(1) does not generate.) I have generally been rather reluctant in adding things to sh(1) and even more so if they are completely new. Someone proposed something rather similar (except that it added a time string parser -- even more code) in PR bin/57054 and I rejected it in 2009. The -ef, -nt and -ot primaries are not in POSIX but they should remain anyway. They have existed for years and are (almost) compatible to features in most other shells. (Sadly, it was noticed rather late that pdksh's -nt and -ot give results not matching real ksh for nonexistent files.) > Modified: > head/bin/test/test.1 > head/bin/test/test.c > head/tools/regression/bin/test/regress.sh > [snip] > Modified: head/tools/regression/bin/test/regress.sh > ============================================================================== > --- head/tools/regression/bin/test/regress.sh Mon Feb 25 18:07:20 2013 (r247273) > +++ head/tools/regression/bin/test/regress.sh Mon Feb 25 19:05:40 2013 (r247274) > @@ -52,7 +52,7 @@ t () > [snip] > +a=/tmp/test$$.1 > +b=/tmp/test$$.2 Please use mktemp(1). Using $$ for temporary files is insecure on multiuser systems. > +trap "rm -f $a $b" EXIT > + > +# Tests 131-164 > +s 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 $a $b > + > +touch $a > +# Tests 165-198 > +s 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 $a $b > + > +sleep 2 # Ensure $b is newer than $a > +touch $b Please use touch -t instead of sleeping. I'm impatient while running tests :) > +# Tests 199-232 > +s 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 $a $b > + > +sleep 2 > +echo >$b # Updates mtime & ctime You can probably do this with touch -m -t. > +sleep 2 > +touch -A 01 -a $b > + > +# $b now has ctime > mtime > atime > btime > +# Tests 233-266 > +s 1 1 0 1 1 1 1 1 1 0 0 1 0 0 0 1 1 1 1 1 0 0 0 1 0 0 1 1 1 1 1 1 0 1 $b $b The ctime cannot be manipulated explicitly but the other times can be set in the future so both relations with the ctime can be tested. The touch -a is indeed required because file reads do not set the atime if the filesystem is mounted noatime. -- Jilles Tjoelker From owner-svn-src-head@FreeBSD.ORG Tue Feb 26 00:10:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 574718D0; Tue, 26 Feb 2013 00:10:29 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 46CC1FF8; Tue, 26 Feb 2013 00:10:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1Q0ATxr077661; Tue, 26 Feb 2013 00:10:29 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1Q0AS1a077655; Tue, 26 Feb 2013 00:10:28 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201302260010.r1Q0AS1a077655@svn.freebsd.org> From: Navdeep Parhar Date: Tue, 26 Feb 2013 00:10:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247289 - in head/sys: conf dev/cxgbe/common dev/cxgbe/firmware modules/cxgbe/firmware X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 00:10:29 -0000 Author: np Date: Tue Feb 26 00:10:28 2013 New Revision: 247289 URL: http://svnweb.freebsd.org/changeset/base/247289 Log: cxgbe(4): Update firmware to 1.8.4.0. MFC after: 5 days Added: head/sys/dev/cxgbe/firmware/t4fw-1.8.4.0.bin.uu (contents, props changed) Deleted: head/sys/dev/cxgbe/firmware/t4fw-1.6.2.0.bin.uu Modified: head/sys/conf/files head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/firmware/t4fw_interface.h head/sys/modules/cxgbe/firmware/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Feb 25 22:51:49 2013 (r247288) +++ head/sys/conf/files Tue Feb 26 00:10:28 2013 (r247289) @@ -1123,7 +1123,7 @@ t4fw.fwo optional cxgbe \ no-implicit-rule \ clean "t4fw.fwo" t4fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t4fw-1.6.2.0.bin.uu" \ + dependency "$S/dev/cxgbe/firmware/t4fw-1.8.4.0.bin.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "t4fw.fw" Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Mon Feb 25 22:51:49 2013 (r247288) +++ head/sys/dev/cxgbe/common/common.h Tue Feb 26 00:10:28 2013 (r247289) @@ -64,8 +64,9 @@ enum { }; #define FW_VERSION_MAJOR 1 -#define FW_VERSION_MINOR 6 -#define FW_VERSION_MICRO 2 +#define FW_VERSION_MINOR 8 +#define FW_VERSION_MICRO 4 +#define FW_VERSION_BUILD 0 struct port_stats { u64 tx_octets; /* total # of octets in good frames */ @@ -546,7 +547,4 @@ int t4_sge_ctxt_rd_bd(struct adapter *ad int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox); int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl); int t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox, u32 addr, u32 val); -int t4_config_scheduler(struct adapter *adapter, int mode, int level, int pktsize, - int sched_class, int port, int rate, int unit, - int weight, int minrate, int maxrate); #endif /* __CHELSIO_COMMON_H */ Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Mon Feb 25 22:51:49 2013 (r247288) +++ head/sys/dev/cxgbe/common/t4_hw.c Tue Feb 26 00:10:28 2013 (r247289) @@ -3909,13 +3909,13 @@ int t4_i2c_rd(struct adapter *adap, unsi F_FW_CMD_READ | V_FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_FUNC_I2C)); c.cycles_to_len16 = htonl(FW_LEN16(c)); - c.u.i2c.pid_pkd = V_FW_LDST_CMD_PID(port_id); - c.u.i2c.base = dev_addr; - c.u.i2c.boffset = offset; + c.u.i2c_deprecated.pid_pkd = V_FW_LDST_CMD_PID(port_id); + c.u.i2c_deprecated.base = dev_addr; + c.u.i2c_deprecated.boffset = offset; ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); if (ret == 0) - *valp = c.u.i2c.data; + *valp = c.u.i2c_deprecated.data; return ret; } @@ -4593,7 +4593,7 @@ int t4_alloc_vi_func(struct adapter *ada } } if (rss_size) - *rss_size = G_FW_VI_CMD_RSSSIZE(ntohs(c.rsssize_pkd)); + *rss_size = G_FW_VI_CMD_RSSSIZE(ntohs(c.norss_rsssize)); return G_FW_VI_CMD_VIID(htons(c.type_to_viid)); } @@ -5304,43 +5304,3 @@ int __devinit t4_port_init(struct port_i return 0; } - -int t4_config_scheduler(struct adapter *adapter, int mode, int level, - int pktsize, int sched_class, int port, int unit, - int rate, int weight, int minrate, int maxrate) -{ - struct fw_sched_cmd cmd, rpl; - - if (rate < 0 || unit < 0) - return -EINVAL; - - memset(&cmd, 0, sizeof(cmd)); - cmd.op_to_write = cpu_to_be32(V_FW_CMD_OP(FW_SCHED_CMD) | - F_FW_CMD_REQUEST | F_FW_CMD_WRITE); - cmd.retval_len16 = cpu_to_be32(V_FW_CMD_LEN16(sizeof(cmd)/16)); - - cmd.u.params.sc = 1; - cmd.u.params.level = level; - cmd.u.params.mode = mode; - cmd.u.params.ch = port; - cmd.u.params.cl = sched_class; - cmd.u.params.rate = rate; - cmd.u.params.unit = unit; - - switch (level) { - case FW_SCHED_PARAMS_LEVEL_CH_WRR: - case FW_SCHED_PARAMS_LEVEL_CL_WRR: - cmd.u.params.weight = cpu_to_be16(weight); - break; - case FW_SCHED_PARAMS_LEVEL_CH_RL: - case FW_SCHED_PARAMS_LEVEL_CL_RL: - cmd.u.params.max = cpu_to_be32(maxrate); - cmd.u.params.min = cpu_to_be32(minrate); - cmd.u.params.pktsize = cpu_to_be16(pktsize); - break; - default: - return -EINVAL; - } - - return t4_wr_mbox_meat(adapter, adapter->mbox, &cmd, sizeof(cmd), &rpl, 1); -} Added: head/sys/dev/cxgbe/firmware/t4fw-1.8.4.0.bin.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cxgbe/firmware/t4fw-1.8.4.0.bin.uu Tue Feb 26 00:10:28 2013 (r247289) @@ -0,0 +1,8237 @@ +/*- + * Copyright (c) 2013 Chelsio Communications, Inc. + * 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. + */ +begin-base64 644 t4fw +AAADkgEIBAAAAQkBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAA3cDhgONAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAENoZWxzaW8gRlcgUlVOTUVNIERFQlVHPTAgKEJ1aWx0IFRodSBGZWIgIDcgMTU6 +Mzg6MjYgUFNUIDIwMTMgb24gY2xlb3BhdHJhLmFzaWNkZXNpZ25lcnMuY29tOi9ob21lL2Zpcm13 +YXJlL2N2cy9mdy1yZWxlYXNlKSwgVmVyc2lvbiBUNHh4IDAxLjA4LjA0LjAwAAAAAAAAAJ/jNKZg +AMQA4QAwuHj///8f/OFAgAAAAeEAe3AAABAAH//7gOEAYBDhAZRwIAAAAOEBnAThAHkAAAIAQOEA +eYAABgBAAAIACgAGAArhAHkEAAoAAIAAAQDhAHs84QB7ROEAe+TiAAAAAAEAAOEAe5AgAAAAAACA +AOEAewAAAEAB4QB7nAAAQABERERC4AAAAOMABHNERERA4wAIACAAAlwAAAAAH/+NIAAAAAAf/40k +AAAAAB//jSgAAAAAH/+NLB//wAAAAAAAAAAAAMAAEv/OE//OhCAEMwGTIBH/zRL/zZIQEf/NEv/N +khAR/80B9DER/8yQEBH/zCIK/5IQAOQxAAUxAQIAEv/JAucxAhYAEf/IgRABAV/AIQIRAckUEf/F +Ev/FkhAR/8US/8WSEGAAEgAAABH/vxL/w5IQEf+/Ev/CkhCBEBH/wcAgkhES/8CSEsAgkhMS/7+S +EIIQAvJQZS/3Ef+9xy+SEBH/vJIQEv+8E/+8kyDAMpMhE/+7kyKCIhL/uhP/upMgIyIhFP+5BDMB +yTgT/7iDMAODFAgzERT/tqQzkyET/6qTImAACMIwkyET/6eTIhL/sZAgkCGQIpAjkCSQJZAmkCeQ +KJApkCqQK5AskC2QLpAvICYQICYRgiIS/6TAMC03MC03NC03OC03PCM9AXIz7QACABL/oSMKAC83 +AC83EC83IC83MCM9AXIz7QACABL/lsAwKDcwKDc0KDc4KDc8Iz0BcjPtAwIAEv+UwDAnNwAnNxAn +NyAnNzAjPQFyM+0DAgAS/44V/48W/4/AMNcgBWYBYAAWAAAAAAQ2BQACANMP0w8FMwxuOxQHRxQH +BEN2MeYENgUFMwxvO+0AAgAS/4IV/4AjCgACJwIHBEMEPgUFMwwHRxRvO/ADAgAS/3zJLoMghCGF +IrwidDsOhlC0VZYwtDN0M/Rj/+YAZT/iZV/fEv9wwDIDLgUDAgAS/2fAMCg3QCg3RCg3SCg3TCM9 +AXIz7QMCAAACABL/ai0nAMARAUkxAEgxAQIAwAAU/2YE0jEV/2WUUBT/ZQTTMRX/ZZRQFP9kBNQx +Ff9klFAU/2QE1TEV/2OUUBD/YwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf/AAA +H/wAAOMACfgf/AAAH/wAAOMACfgf/AAAH/wAAOMACfgf/4AAH/+GAOMACfgf/4YAH/+GAOMAD/gf +/4YAH/+GAOMAD/gf/4YAH/+HdOMAD/gf/4d0H/+NIOMAEWwf/40gH/+nhOMAFxgf/6eEH/+nhOMA +MXwf/8AAH//8ZeMAMXwgAAAAIAABauMAbeQgAAF4IAABfOMAb1AgAAF8IAABheMAb1QgAAGYIAAB +nOMAb2AgAAGcIAABpeMAb2QgAAG4IAABvOMAb3AgAAG8IAABxeMAb3QgAAHYIAAB2OMAb4AgAAHc +IAAB4uMAb4AgAAH4IAAB+OMAb4ggAAH8IAAB/OMAb4ggAAIYIAACGOMAb4ggAAIcIAACHOMAb4gg +AAI4IAACOOMAb4ggAAI8IAACPOMAb4ggAAJYIAACWOMAb4ggAAJcIAACYuMAb4ggAAJ4IAACeOMA +b5AgAAJ8IAACguMAb5AgAAKYIAGaouMAb5ggAoAAIAKTYOMCB6QgApNgIAKTYOMCGwQgApNgIAYP +KOMCGwQgBg8wIAYT8OMFltQgBoAAIAaNUOMFm5QgBo1QIAdgsuMFqOQgB2DAIAdhjOMGfFQgCMAA +IAjAAOMGfSAgCMAAIAjAAOMGfSAgCMAAIAkvL+MGfSAAAAAAAAAAAAAAAAAgAAYvIAAGICAACjkg +AAYgIAAJpSAABiAgAAbZIAAJPSAACMIgAAYgIAAIcSAACCQgAAe5IAAGDSAAB2QgAAYgIAAGICAA +BiAgAAb6AAAAAP///////w/8///w////APwgAItrIACMqyAAjNsgAIyhIACMYSAAjFcgAIwcIACM +EiAAjAggAIu4IACM2SAAi64gAIuUAAAAAAAAAAAAAAAAAAAACgAAAAoAAAAUAAAACgAAAAoAAAAK +AAAACgAAAAoAAAAKAAAAAAAAAAAAAAAAAAAIAAAAEAAAAEAAAAEAAAAACAAAABAAAABAAAABAAAA +BAAAABAAAABAAAABAAAAIAbKiyAGycIgBsshIAbLCCAGyu8gBsrWIAbKvSAGyqQgQIAAAAAAAP8Y +MGBgAAAA/wABAgIAAAAQIEAAAAAAAAQAAgABAACAAEAAIAAQAAggBwDOIAcAziAHAIEgBwBIIAb/ +nSAG/2ggBv9oIAcAziAHAM4gBv9oIAb/gyAG/4MgBwDOIAcAziAHAM4gBwDOIAcAziAHAM4gBwDO +IAcAziAHAM4gBwDOIAcAziAHAM4gBwDOIAcAziAHAM4gBwDOIAcAziAHAM4gBwDOIAcAISACiqgA +AAABIAKKrAAAAAIgAo3wAAAA/yACidwAAAD/IAKJ3AAAAAAgAo3wAAAAACACieAAAAABIAKJ6AAA +AAQgAonwAAAACCACifwAAAAQIAKKBAAAACAgAooMAAAAQCACihQAAACAIAKKKAAAAQAgAoo8AAAC +ACACilQAAAQAIAKKaAAACAAgAop4AAAQACACioQAACAAIAKKmAAAQAAgAonIAAAAECACidAAAAAR +IAKJSAAAAQAgAolUAAAAgCACiWQAAABAIAKJdAAAACAgAomEAAAAECACiZQAAAAIIAKJoAAAAAQg +AomsAAAAAiACibgAAAABAAAAAAAAAAAgAojoAAAAASACjfwAAAACIAKI8AAAAAQgAoj4AAAACCAC +iQAAAAAQIAKOBAAAACAgAokEAAAAQCACiRAAAACAIAKJHAAAAQAgAokoAAACAAAAAAEAAAABAAAA +AQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAH +AAAABwAAAAYAAAAGAAw1AAAQRqoAFFhVABhqAAAAK2gAACODAAAYagAADQYAAAsqAAAAAAAAAAAA +AAAAAABoKwAAaCsAAGyCAABvnAAASmgAAEpoAABNKQAASmgAAE7qAABMmAAAUj0AAE+4AAGGoAAB +hqAAAgjWAAII1gACCNUAAgjVAAKLCwACiwsAAgjVAAK2cgACtnIAAw1AAAQGBwAAAAAAAAAAAAAA +AAACAgUFCAgLCw4OEREUFBcXGhodHSAgIyMmJikpLCwvLzIyNTU4ODs7AAAAAAAAACAEkYAgAWn4 +IAA1yCABQhggAWWAIAFe0CABJAggA6KkH//rIB//5uAgAI1sH//azCAAXFQgAE7gAAAAAAAAAAAg +AUOQIAB7CAAAAAAAAAAAH//U4B//xggf/8PoH//BmCAASnAgAEKsIAA/4CAAg/gf/99YAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgARGgIAFRqCAAlcggAJT8H//w +KB//z/wf/8tAIAB4VCAE6eggAQXwIADkxCAAzJggAMb8IAC5QCAArCwgAJiAIASVLCADu5QgAPcw +IAPbiCABliwgAFwUAAAAACAAliQgBVKUIACK4CABScQgADI4AAAAAAAAAAAAAAAAH//zUCAAlegg +A75EAAAAAAAAAAAgAw1UIAAq2CAAMUQgACdoAAAAACAAIRggACPYIAAdjAAAAAAgAC+cIAD66AAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAALKwgBJEgAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAgAC6IIAMYMCAALWAAAAAAAAAAAAAAAAAf/8AAAAQAICAGE/AgBhiw +BEEACAQBAAgf/6SggQAAADAAAAAf/5iApQAAAMAAAADABAAAH/zeACAGFEAf/5iQA4AAAAD/+AAB +AAAAABAAAIEEAQCBBAAAAQQAAAEEAQCAAAAAAAX//x//hBAGAAAAKgAAAB//zyggA/V0AgAAAIAQ +AABBQAAAQUABAIMAAAH//7//gYAAAAQAAAgf/5cAIAjhcB//jXD//wAA//8A/yAI4aAgCOIAIAjh +4B//jhAAAA0gH/+XcB//lkAf/5scH/ziAB//mpAf/5sUH/zg4B//klAP////H/+S1B//l6gf/5a0 +H/+XIAAAC5AAAP+AIAkE8B//lxQAAAo44QAuAOEAXgDhAZIAH/+X5B//lqTgAACg4QAwuAAAgADh +AGAQAABAAOECEADhAjAA4QJQAOECcADhABAIH/zhQB//p0Qf/6c8H/zgCB//p0Af/6dcH/+nVB// +p1gf/6d0H/+nbB//p3Af/5iA//7//wAgAAAgBhPwH/zeAAQAAAgFAAAAg/8AAIEAAAAAEAAAIAYU +QCoAAAAgAAOAIAKJkB//gAAgCMRgAAA/KCAIw7AgCMRQIAjEgCACkLzP////EAAAACAIw9A///// +AgAAACACisQgAorIIAKQuCACisxAAAAAIAjEEB/84HQf/5sgH/ziDAAAgAAgABEoH/+NcAAADDz/ +/3//H/+VmCAIx7AgCQyQH/+XcCAIx+AgAoiQAAAIAB//keSCAAAAgYAAAAwAAAAABgAAAABAAB/8 +4gAf/5scAAALOCAIyGAgCMjQIAjJQCAIyXAEAQAI4AAAAB//ljggCMmgIAjJAFMAAABRAAAAIAjJ +4FIAAAAwAAAA//v//w/+//8AA///AAAn/yAJDNAgABfUH4AAPx//liwgCMowAAQAAAABAAAgCMrw +H/+UzAAA//8gCMtQIAjLsCAIy4AgBg8wIAjMMB//lkgNAAAAIAAv2CAIzLAIAAAAIAjNAPf///8f +/6SgAQAAAB//lSgf/5SAIAjfIBQAAACAAAAAgAAAAngAAACAAAAGgACwAAAACgAA4zCS///wAIAA +sQDhAZoAAAIAACAI3uAAAH5AH/+OIAYAAAAFgAAAH/+YkB//lFQrAAAAIABFsDUAAAADgAAAAwAA +AB//lFgH////AD///4BAAAAID///H////wD///8gAAAAH/+WHD0AAAAf/5KMBwAAAIEEAQCBBAAA +AAA6mMMAAAAYAAAAH/+OYAAAD/8AQwAAH/+V5AQAAAAf/4QQH/+muB//pMDhAHoAH/+STB//lQQf +/5aAH/+UnCAJEzAAAweAIAkToABAAAAAAAkAAAAwAv/8+H/AAAAAo/+7AKP/ugDgAwAAg/+2AA// +//8P//gA/wAAACAJE+AgCOEAIAjhMCAJFHAACgAAAA8AAP//AA8f/5UQA//AAIP/wAAgCRTwIAkV +YB//lpgf/6Uw/2DwAB//pRAf/40wBIAACB//gFAARAAAAMAAAP8f//8AAIEADwAAAP//AAAf/5Y8 +H/+bGB/84ggf/5yoIAjmkB//kogf/4BgIAYSAAAAMAAAACcQH//Z4B//lPjerb7vNAAAAD8AAAAA +AIkGAJkAAB//pHgQAAcC7gAAAAHAgAAf/6NImQAAAB//pTQAiAAIgoAAAR//pMgf/6PUAxUAAAMR +AAAADwP/IAjqYCAAwCQgCOqQIAjq0CAJHUAAAI4CIAkeECAI6vAgCR2AIAkdwCAI6yAgCOtgIAjr +kCkAAAAgAMicIAYYMCAGEkAgANs48PDw8P8A/wCqqqqqzMzMzAAPQkAgA+F4H/+WoAAJAAAAgAAA +IAjtACAA++wAAEgAIAD/cB//lhQACQAIH/+kPB//pIQf/5SYAAAIBgAAiMwAAIkUfwAAAPAAAAAg +CR9AIAkgQCAJIHAgCR6gIAkgECAJH6AABAP/CgAAAB//o2Qf/6QkH/+UcIP/twCD/7YgIAjx8DMA +AADhAAAAH/+kRB//lVQf/6SMA//gAAA/9pAAABkUA//wAAAQAAEAABkcH/+kiAAP//8AAN6tH/+k +QB//lhAf/5UsIAYPQB//lIwf/5aIIABgWB//lSAgADWIH/+UhB//lFAf/5n0IAkhsCACjSAgAGD4 +H/+TiACBAADgAQAAAOABAAAA4AEgCSKAIAj0sAAADEQgAIgkIACFuCAJIgAgCSJQH/+WNCAJApAg +CQLASAAAAB//jgTv////IAkDAH////+/////3////yABddgf/5XwIAF3yB//klAf/5Ws4QAuAB// +lbThAF4A4QIOAP//v/8f/48s4QAOAOEBjgDhAHIA//++/x//lrQAAAo4H/+X+B//l/QAAAxwAAD/ +gB//l+wf/5hYIAF9dCABhcwD/wAA/7///x//l1Q8AAAAAAX//4MAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACB +gAAAAAAAAB//+Wgf//loH//5LB//+Swf//ksH//5LB//9Ggf//b0H//1mB//9Zgf//WYIAXlwAAA +AAAAAAAAAAAAAAAAAAAgBelAIAXpQAAAAAAAAAAAAAAAAAAAAAAgAX9AIAXlwB//9/Qf//f0H//3 +9B//9/Qf//f0H//39AAAAAAf//RwAAAAAAAAAAAAAAAAAAAAAAIBAAAAAAAAAAAAAAAAAAAEAAAA +AAAAAIGAAAAAAAAQBQAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAgQAAAAAAABgFAAAAgAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAACgQAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAgCgAR8X8T8X/TDwPmMQECABbxfRfxfndrBpBgtGZ3Y/hUDoBVk5kPFABj +//kAAABsEAQY8Xsd8XYrIAcc8XYqIQj6AgAHcbsBAO7cOQ3cAoAAC6oCnDDj8XAZsASAAAiqAhzx +biMwgPpACBXgDQUAnWXsZgIhuN0AAPrAhhWkdx0A6Xz/Ld4CgADrewIMzwKAAOtmASTL4QAAmWMC +BImTZyhmBgYgixjxXyUhCfTBZhWkMx0A5WYKK5AEgADoAAUDKMEAAG05AgUCYdEPAAAAbBAEHPFP +JiAHG/FOH/FU/kEEFaDWEQANyzmbMIcg++KWBaAJJQD6YEYVoBgFAOg2Ayu+AoAA+OYADHFmAQD4 +YCYVoAwFAOUgVys0AoAA98YADrArBQD/pgAO8Ao1AOjxPhKCAYAAnDWcN5szGfE9CnUClTGZNiUh +CZ00LyAHnDmUO/imAAkx/wEA4jYKL/wCgAAP7gII7gLuNggtEASAANEPJyEIKiEJnDWUNwZ3Agiq +Apo2CHcC5zYELJAEgADRDwAAAAAAAABsEAgoIAUnIAcpMQX4IIYV4BlFAPkADMVhdwEAiiIW8R8Y +8R/xVQwN4A2VAAx7Eaa7LLKe/YAMQ+AKpQArsp3rFgUljDmAAIyI94AMcJIAnQAtYq5k0TgrYq3k +sTRmc/0AAO6GCCWJuYAAKCAUpIgICEcoJBT1AAu90A8FABnxCS4iFiwhKYgVGvEIrsyagOoiHi5n +woAA/QBmFaANJQD9AEYV4AtlAO3w9x1WAoAAC6oCixSagekAFQRAQQAAiRUIAIooPBD9IMYV4EwF +AP0g5hWgDEUA7Ls2BMiBAABtuQUIAIYJAmHu8OkVoIeAAIgV7gAFDc8CgACpiOiMICWkNQAAC8kM +bZkCCAJhKCEp6iEoJEAFAAAICE8oJSn5QAhEIgCdAP/hwgXgDBUA+iCoFeAe5QDqIh4sbUKAAPwg +JhXgCQUA+CAGFeANBQDpFgIl2YEAAFhx1Ax+EffAAEcwDZUA/dOmFefFAQD5gAYpUgCdAMAg0Q8A +6iQACdgEgADsRAAK6ASAAFhzsdKg0Q8AwLAKzzTvhggt9o4AANog/EBoHaAbxQBYdABj/8oAAADq +JAAK2ASAAFh1PtKg0Q8A//nsDaALBQAAACt8GOokAAlgBIAAWHP0Y/+cwKBZjncY8LCMiPmf80CQ +CqUAY/+sKiEJ/EKwFa/9BQANjQENjgwuJBTttAMuYQKAAO+0AC1WAoAA/UYADTAJFQAJqgKasfjV +phXv+WIALyUp//vUDaAIBQCKJ+tEAApoBIAA+0QAFaAMBQBYbjDSoNEPAAAAbBAGKCAFKyIQ5CAH +KlAEgAD4AwId4B7FAPveAAzwGUUA+QAMXWFEAQCMIh/wiOoWAC4LHgAADEkRD5kILZKeDwIA96AL +41IAnQAnkp0MBj5kcW6LKSoiCguqDPdACQuiAJ0AKiBOLCBMsa37gAskIAsVAC0kTiowASkiGPNA +C0aSAJ0AKyAHLCEk/GAkFeAIVQD5QAQEMKsRAOCIEQ1SgoAACogCGvBuCN0CKCEHKyEJCswC+6YA +DrqIAQDq8GocQwKAAAi7AighIp1wjSCbc5x0+wYADDAKZQDodgIu7gKAAArdAp1xLCIQnHUrIDgY +8F78ACId4EwVAPzhJhXguxkAC805HPBZnnj7DQAOcAgFAJh3DcwCnHbt8E4U2AUAACsmGBvwRJh7 +mXrtABUDyMEAAAkAiut2DiHIQQAA7nYPI/EBAAAJIIYOAmMJAIYOAmEMTBGvzOrGnSMAqYAAjikt +IDim7p4p86AFV5IAnQAFD0f54ARRUgCdAMAg0Q8A6iQAC1gEgABYTV/B7O/wLxV2kYAA6iQACdgE +gADsEgAq6ASAAFhzFtKg0Q8AAAAA6iQACtgEgABYdKrSoNEPAAAAK0wY6iQACWAEgABYc2Jj/8GI +IsCUCYgC+EBGFa/+3gAAAAAAAAD8Q6gVpIkBAACBBAC9Gg3MAvxDphWv+h4AiieNEMDA6qwgLtgE +gABYbarSoNEP2iBYcsBj/1EAAGwQDC0gBSYiEC8gByshNeUWAynABIAA+wCIFac1AQDyf8AV4AwV +AAPDOftBAA1wFYUA64ICLGAEgAD3XgAKsf8BAPcAMBWgFUUA9aAf1WO7AQCJIigWAPM9XA3gDoUA +mBDywB4HEgCdAJ8SnxqbFhbv75MV6hYEL68CgADmVQgCMA0AAOYWCSJwBQAAiBouFggrEgn1AAZi +EgCdACpSnvtACaviAJ0AL1KdZPO7GO/giIj3AAlYkgCdABnv3CmSrgwDPurv2hSJ+YAAKqKtFu/Y +6hYLJGv9AADrEgslCWmAAO1mCCWbmYAAiCmHKgh3DPLgCWPiAJ0AKRoA8yIyDeD69QArIBacEftg +Ca0iAJ0AGO/QhhSNwyogOP3g5hXgCQUA+eEmFeBHBQD34QYVoKoZAAp5ORfvxysiF5v6KyIbm/uN +xAp4OfzADxLiAJ0AmBeeHYYVnBGZHOcSDCsIHgAAYAF+GO+ziIhqgSaKGSlSnnqTQytSnZsbjRvp +760UM/0AAO/UAAaB2YAAlphl/xxgAtWeHfwgJhWgCgUAWY1rGO+kiIiMEe4SDSQPBwAA//9oDaAP +BQAAwJD4IWYV7/7uABvvm8CqCoo0+2EGFa/+/gAAAAAAAAD/+zgNoA8FAACeHZ8e/CAmFaAKBQBZ +jVcY75CMEYiIjx6OHfkf9diSAJ0AYAJRwJCZG4obHe+JwLoLizTr1ggtdo4AAGACOACeHZ8enBHq +JAAJ2ASAAFhMrowRjx7uEg0ldfmAAGAB7wCeHZ8e+kDwFaAMBQBYTaWMEY8e7hINLXXGAABgAsYA +iBGOF/YgyBWvjAUALCQ7jBQGdgIG7gKsuQzaDJqE6SYbLFgEgADtIhApUASAAFhz744djBH6s6YV +oQcFAHN7CCsgFigK/3i5XoopKSA4o6rqJgkk+aaAAC8iEC0hNfuAiBXgCBUA+CCmFaAGNQCWEw27 +NvoghhXgHYUA/34ADv/2tgCKJ58eixDqrCAqYASAAFhwkI8emhErIhv9QIgV7/2GAAAAAAAA6iAH +KeAEgABYTV+MEf4hqBWv/kIA2iBYcfeMEf4hqBWv/kIAAC0iEIoWKyA7Fu9ICpkCCYkC5pgCDYn2 +AAAa70X4RIQV42kBAIfA6yAHKzICgAAGmQImIQf64AQDsLsRAOrvNR3agoAAC3cCKyEiCncCKiEJ +l/CHIJ31+eDGFapmAQDp9gQrMwKAAAaqAhbvK+r2Ayu+AoAA5+cCB8jBAADn9gEmQIEAAOa7AgJT ++QAA6/YCIhQ1AABtqQUIAIYJAmEoIBSkiAgIRygkFPUABq3SAJ0Aihj6s6YVoQkFAPMh8g3g/PUA +KyAW/WAJFSIAnQAtIhex3e0mFyGAqYAAjykuIDij/58p88AHv5IAnQCGFWVg0sAg0Q8AAAAAKCBO +ZIw9DpsCmyLrEgApUASAAO0SAypgBIAAWHHn0qDRDwDrEgMpUASAAFhzfNKg0Q8A2iD8QGgdoBvF +AFhyNWP/xwCLEtog67wYKWAEgABYcjBj/7QAAAAAAOokAA5YBIAA/CCIFa+OBQDuJDsscASAAFhz +bPohBhWgDwUALyYb/kdmHe/8ggCLGyohCfxCsBWv/QUADY0BDY4MLiQU5MwQDVYCgAAMqgL9YGYd +4A4FAP9gBh2gBhUABqoCmrEZ7tL3NaYVr/vKAACKJ+tEAApoBIAA+0QAFaAMBQBYbGXSoNEPAADa +IFhxe2P/BAAAAAAA6iAHKeAEgABYTNtj/tOLEtog67wSKWAEgABYcgFj/vdsEAgoIAXt7rwZ0ASA +APPdcgXgHkUA/wAKdSAMpQArIE4p0gjTD+oWAyXb/QAAKyRO9yAIWJAHFQAvMq5k8igqMq3mpAAF +EVGAALCY6NYIJQhBgAApIBSzmQkJRykkFPUgEO3SAJ0AKSBzKyId+yAEAN//9QDgehoEwAUAAP9X +AA/0iAEAKCRz+0AEBXAIFQAKijkPuwHrJh0tBv4AAIoifKcEKyBOyrR9pwgtIEwsIE59wxnMbC4g +FO8iAi9YHAAAZPH0wCDRDwAAAAAAAIgnx5MJqQHpJgIkUMEAAFhkOOPukhUBEYAAKKAAA4gKiIzs +oActWASAAPpAaB2gDUUAC4AAZa/hiSdkn6iKmsqnKpIJZK+eKKAAA4gKiIzsoActWASAAPpAaB2g +DTUAC4AAZa/hY/99AAD//1gNoAoFAMCgWYw0He5sidgsCgr5P/dAkB5FACYKACkgFLOZ+EKGHe/8 +GgAAAADqJAAK2ASAAFhy5tKg0Q8AACogBSsgBw8CAP9ADxUhuwEABQVH+KAPKVIAnQCOE+7iBi94 +BIAAnhQLvgL1YApyEgCdAAy6EQOqCCiinvcADnzSAJ0AKqKd7hYBJQrxgAD6QAgV4AwVAFgf9hvu +Si8hCR7uQCghIi0gBxzuUikhJP8GAAww3REA7hIELuqCgAANmQIMmQKZoIwgKKYC/0BmFeANJQDu +pgUuZgKAAA3MAv1AJhWgCQUA6wAVBVBhAACxmeqDHgyP6AAAjxEM/xHz4ABH8A6lAC72nfS/8sES +AJ0AKiIH60QACmgEgAD7RAAVoAwFAFhrwGP+OgAAAAAA//dYDaAKBQAMmzTr1ggtbu4AAGP+2QAA +LyEJ+EKwFaALBQD6wAYd7/oFAAqaASpkA+qaDAxBAoAA6iQUL/4CgAAI/wIH/wKfYfZ1phXv9soA +iifAsPtEABWgDBUAWG47He4anaCMIBvuGeumAi5mAoAAB8wC/UAmFaAbxQDsJAAJUASAAFhxRMAg +0Q8AAInY9yAEqJIAnQAM6hGjqiiinvcABXzSAJ0AKqKdZKCmsJiY2O4WAS11VgAAiSLrFgAkhRmA +AJ8S+L/rYVIAnQCKJ8Cw+0QAFaAMFQBYby4e7fqeoI0gG+377BICLu4CgAAH3QKdoYzGnKP7QEYV +7/TqAOtUAAlQBIAAWHJmY/0njxOP8/4ghhXv+I4AAAAAAAAA//jQDaAKBQAAnxKbEfogBhXgCgUA +WYudHe3WixCJ2I8SjhH5P/qIkAylAP/9jA2gCgUAwKAMmDT5oQYVr/1aAAAAAIsQ7xYCKVAEgADr +vBgpYASAAFhxCP4gSBXv/SIAbBAEKCAU74seahgEgACKJ/pgaB3gDAUA6qwgKegEgABYa1XSoNEP +AIsic75+FO24iUhqkXob7bXTDyyyrmTAWCqyrWSgVLCd7UYIJQLhgAApIBTpJBQs2twAAC8hCfhC +sBWgDQUA/UAGHe/8BQAMnAEspAPsnAwMQQKAAOwkFC/+AoAA+eYAD7AOFQAO/wKfof91phWv/eYA +wKDA6g6eNO5GCC19ZgAAjyLJ9cAg0Q/AoFmLXolI+T/70JIAnQBj/+UA2iD8QGgdoBvFAFhw0sAg +0Q9sEAgpIg/vITQpsASAAPZg6BXnhQEA7iAHKlgEgAD7H8AVoAQVAPqNAA0wHUUA/uEAC/HuAQDp +fR8MFHQAACggT+8gTSRABQAACAhHKCRP+eATC6IAnQAvIAWbEZoQ/eARLWIAnQCJIsej+UAN0OIA +nQAsIhmLMv1gE00iAJ0AjTgY7W3vEgEmkaGAAAzkEahEGO1r6BYCJ/gNAAD1wA0CEgCdAClCnv8g +GYviAJ0AKUKd7ZQABJHBgACLKSoiCgwFPg8CAAuqDPVACeviAJ0ALBoA9YIyDeD49QArIBbTD/lg +GAUiAJ0AGu1mKSEkKyEHCpkCKiEJCwtKDLsQC6oCKyAHHO1SCytA6O1eHdqCgAAMuwIsISKb0Isg +mdSa0wjMApzS/WAAFbAMVQAMuwKb0RvtVSoiDyrWBSkgOPvapgWgDAUA/aDmFaBIJQD3oQYV4JkZ +APlNAA3wCiUACYo5KWIEKdYJKGIFKNYK/MDIFaAJBQDs1gsjh+GAAOntRRzCgoAACYgCmNyMaJff +nN6MEolpKdYQiGoo1hHsABUGySEAAAkAioxn/OAKq6IAnQAZ7S0KuAIJiAKY1sD1/pOmFeEOBQD1 +wfIN4Pr1ACsgFvtgEgUiAJ0ALiIZjCktIE8rIDjlzAgHcAUAAO4mGSbr/QAALSRPnCnzYA4HkgCd +AI0QZdG+wCDRD58TnhSeFZ0W6iQACtgEgABYSjaNFo4U7xIDJXVhgACOEGXv14on2zDsEgElUMEA +AFhuHMAg0Q8a7P+KqPdADsiSAJ0AK0Ke/2APs+IAnQApQp0d7PjkkeplY/0AAJzY7ZQADPJ2AABg +AHoAKCA58R/4DhIAnQD/++QNoAkVAMGjevkSKSA6/iCmFaAL9QD7IBAlYgCdAOokAArYBIAAWHFq +0qDRDwAAAAAAAPAAGA2gGtUAwKGMNyshCY04jjLrrxEN3QKAAA+7AuS7AglQBIAAWHFMwCDRDwAA +AP//WA2gGoUAAAAr7BjqJAAJYASAAFhwEmP/KAAACrkCmdbAhfiTphWhDAUAdcsNKyAWKgr/+2AN +PSIAnQCLEGSxNYtqjGeKaat7B8wMnGf3YNIN4A0FALGqjGWbaotmmmms2qt7d7sBsaqbZppliCkt +IDiliJgp86AJN5IAnQCJJ4qayqWLmcqxnxMZ7L8osACeFJ4VCYgKiIwssAf6QGgdoA01AAuAAI4U +jxOLIsej+1/zaOIAnQAoITSHZ/xB6BXgCRUAmRD44QALsBxFAPz+AA5/85YAANogWG9SY/47iifq +rDArWASAAFhcw9Kg0Q8AAAAAAAAA//NIDaAJBQCfE54UnhWdFvpA8BWgDAUAWEq+jRaOFO8SAy1n +TgAAK+wS6iQACWAEgABYb81j/hPqIAcq4ASAAFhKn2P9tZ8TnhT+IKYVoAoFAFmKShrsgoqojhSP +E/lf8HiSAJ0A//iIDaAJBQDAkBzsfMC6C6s0+4EGFe/4QgCfE4onnhTuFgUp2ASAAOwSASVQwQAA +WG2O7hIELTAEgAD+IGgV7/qWAJ8TnhTuFgUpUASAAFhvHY4U/iBoFe/7JgAAwVP6QGgdoAsFAPwA +Ah2gDTUAWGjGKyAFjhX1f91NYgCdAGP9Y58TnhSeFeogByrgBIAAWEpyjhT+IGgV7/kaAAAAAAAA +bBAMlRMmIAUvIAeHL+oyBCnABIAA/EaEFec1AQDyf8AV4A4VAAPjOf1BAA1wG0UA56sfDGAEgAD6 +wB6lYf8BAIkiKBYA8zr8DeAOhQAmgAEoFgDywBy3EgCdAJ8SnxoZ7D6TFxbsPOoWBiJYDQAA6xYJ +L68CgADmVQgCcAUAAIganhiNGfUABVoSAJ0AK1Ke/WAII+IAnQAvUp1k85KImPcAB+iSAJ0AFuwr +JmKuDAM+6uwoEwiJgAAqoq3qFgska/0AAOsSCyUIEYAA7ZYIJZqBgACHKYYqB2YM8sAH6+IAnQAo +GgDzAjIN4Pr1ACsgFpwR+2AILSIAnQAW7CsqIDj72FAF4A0FAJ3394CIFeCqGQAKazmGFsSACo05 +9sAPguIAnQCdFI0X6xYFLoduAABgAZCImGqBIY0ZK1KefbM+L1KdnxuGG7CK72QAAwHhgACamGX/ +RmAC1gCeHPwgJhWgCgUAWYnDGev8iJiMEe4SDCQPGwAA//9kDaAPBQAAwLD6IWYV7/8CAMDaDY00 +/SEGFe//BgAA//v8DaAPBQAAnhyfHfwgJhWgCgUAWYmxGevqjBGImI8djhz5H/dIkgCdAGACWcBg +lhuKG8C6C4s065YILXf+AABgAkOeHJ8dnBHqJAAJ2ASAAFhJCYwRjx3uEgwld3GAAGAB+54cnx36 +QPAVoAwFAFhKAIwRjx3uEgwtd0YAAGAC05wR/iGGFa+IBQDoJDsmOEEAAOcDHgewgQAABgJhhhaW ++I3Hh8SIxq1tBncMl8R22wouFgzsFgEkQAUAAIwWixGGFI4VmLadtwbuAu0iDylQBIAAWHBBGeu6 +jhyMEfqzphWhBwUAc3sIKyAWKAr/eLlciykqIDiju+smCSV5qoAAhi8vITT9gIgV4AoVAPog5hWg +CDUAmBMP3Tb8IMYV4B9FAPe+AA+/9v4AAJ4ciiefHYsQ6qwgKmAEgABYbOHvEg0tYASAAP4hiBWv +/NoA6iAHKeAEgABYSbGMEY4c+dcwBe/+QgAA2iBYbkiMEY4c+dcmBe/+NgAmIDsX65vtuwIHyIEA +APmCABWjqwEA57cCCwjGAACTH43AE+uUA90BIyAHAyNACjMQA90CE+uIJiEkA90CIyEH6yEJLVIC +gAD6xgALOjMBAOohIimbAoAAA7sCgy+d8I0glvSX9pP1m/ODH+vrfB7uAoAADe0CnfELqgLq9gIi +DD0AALBKbakFCACGCQJhKCAUpIgICEcoJBT1AAZd0gCdACoSCPqzphWhCQUA8yHyDeD89QArIBb9 +YAilIgCdAMg/jiktIDij7p4p86AHr5IAnQCPF2Xw0sAg0Q8AJiBOZGxnDpsCmyLrEgApUASAAO0S +AypgBIAAWG4/0qDRDwDqJAAK2ASAAFhv1NKg0Q8A2iD8QGgdoBvFAFhujWP/xwCLEtog67wYKWAE +gABYbohj/7TbwPwgyBWvjgUALiQ7CCCGCQJj7PYIKVAEgADtIg8r8ASAAFhvw/ohBhWgDwUA/kdm +He/8qgCLGyohCfxCsBWv/QUADY0BDY4MLiQU5MwQDVYCgAAMqgL9YGYd4A4FAP9gBh2gBhUABqoC +mrEZ6yn3NaYVr/vyAACKJ+tEAApoBIAA+0QAFaAMBQBYaLzSoNEP2iBYbdNj/wYAAAAA6iAHKeAE +gABYSTNj/uGLEtog67wSKWAEgABYbllj/vdsEAYoIAUlIAckCgP3AAVkUVUBACggImSAoQIqAlhm +5vlABMDQBhUAKSAh4+sKGAQKgADzIAQv0gCdAOxZEQKlaQAAo5kqkp5uo3Qrkp1ksGopICH6QAgV +oPzlAAyZAfcmAAywDQUA+EQmHeAIBQD4IAYVoA6VAPggJhWgDwUA+CBGFaAMBQBYa/YMXRGj3fWz +phWgAgUA0Q8X6u+KeGqhJgxZEaOZLpKebuMtK5Kd5LApZWP9AACceGW/lMAg0Q///igNoAsFAMCg +WYiqinhroc7//4wNoAsFAMCwwNoNrTT84QYV7/9SAAAAAGwQCiwgBfhA8BXgCxUA+GBoHaelAQDo +FgElU/kAAOq6OQoYBIAA6hYFLCAEgAD9gcAEUZkBAMGz+4AZhWIAnQCMIhvqybQ+5cKxbMcCgACr +iJ4U7RIEKAQKgAD1IAQCEgCdACyCnv2ABxPiAJ0AL4Kd7xYGJ5SJgAAlIRuKQocpmBAFpTb1TwAL +cQ8FAHbzAdWghioHZgz0wAXT4gCdACoaAPVCMg3g/PUAKyAWmBD9YAX1IgCdAI0ppd2dKYpC+qAK +cqIAnQCZGIwVG+q+h0OZGZgQ63cBBgfpgABgAK0a6qOKqOgWACUMn4AAjBQrgp58sz8vgp0e6p3k +8Dhla/0AAJ3o7xYGL/uOAABgAfaZGPghJhXgCgUAWYhbGuqUiqiIEOkSCCUPFwAA//9UDaAPBQAA +wPAc6o3AugurNPuBBhXv/woAAAAAAAAA//yEDaAPBQAAmRiZGeokAArYBIAAWEewiBDpEggleamA +AGABipkYmRn6QPAVoAwFAFhIqIgQ6RIILXmOAABgAmDudAAKWASAAOWsDAroBIAA7xIGKVAEgADs +RgIp4ASAAFhr5okZiRiIEPsTphWhDQUAddsIKyAWLgr/frkxwPH+IKYV7/oOAACKJ4sR6qwgKeAE +gABYa6PAsuukAi0gBIAA+0BIFa/+bgAAAAAAAADqIAcq4ASAAFhIcYgQ+CEIFe/+9gCJQIwVh0P4 +IAYVp9kBAO0WAi4HpgAAKiAH+uBoHeGqAQBYJ3mJFteg6jz/IkBBAADpnCAhjDUAAG2pBQgAhgkC +YcCgmhMvIQcW6lyIEvvUtAWq/wEA6eo6H/8CgADm/wIEaD0AAPYgyBWk3R0A7iEaJugFAAANPQyf +YOsiACvgBIAA7ak5AbgFAADpZgIkQEEAAOhmAy3+AoAAD38C72YBKugEgADvQgMjUEEAAFhrmZcX +6iQACdgEgABYYfaPQOMSByep7oAAhxDy86YV4QYFAPTB8g3g+PUAKyAW+WAE3SIAnQCIE9KA0Q8A +iRVkkJvAINEPACucGOokAAlgBIAAWG1YY//kiif4IAYVp7lBAA8CAOqsICgECoAA9WAEUdIAnQCM +FisKAezMICnoBIAAWGek+iBmFa/8OgAAAACLFuw9EQlQBIAA/WAARfAMFQBYZazyYGAV7/3CAGWs +0Pmf5mjSAJ0ALyAg8f/mF5IAnQBj/3sAAAAAAAAA6iAHKuAEgABYSA2IE9KA0Q+KJ9ww6xIBJVCB +AABYazHAsvtARh3gAgUA0Q8AANsw/GBoHeAMBQBYZ4PbQOw0AAroBIAA6hYDK/AEgADvEgYpUASA +AFhrWfdAaB3v+2YAAAArnBLqJAAJYASAAFhtHmP+/ABsEAQU6fMkQIAIRBH6gGgdoAsVAFmEixjp +32SgQvhGAAwwCSUAmaHopgAhAcmAAGghHG8kGe4iFmVIIQAAA0CICQiKAyCICQSKAwCICQCK2kD6 +AEId4AwVAFmJWMAg0Q/HJNEPD+gwn6IO7jCeow3AMJ2kDLEw/UCmFaALBQCbpvtA5hXv/y4AAAAA +AGwQFOIWGynwBIAA/iNGFaAMFQD6I2gVp2UBAOjiACNb+QAAC8s5KaAHiqf6IaYV54gBAPgihhWh +mQEA6RYKJVCBAADqFh4qGASAAPTAL2ESAJ0ALRIbjdJl1B8f6aGP+BLpn/fgL8iQDqUAJiKuZGYc +KSKtZJYYGumasPiYqOiUAASvwYAALxIeKRIa++BoFa/FBQAF/wEvFhzvrwgEyIEAAO/8QCyoBIAA +/yAvkuIAnQAmEhotEhQlFhX2wGgVr/wFAOYWESboPQAADNkBpZbmFhArKASAAP7ALmLiAJ0AmBeZ +FZMWJBIb7xIKItgRAACbG/4iZhXkrR0A6hYWIbBBAADmFhIi0CEAAJocFul1lhgqEhomEhzkQQcv +/wKAAKL/7xYYIzEBAACWGRbphftBhBWqRAEA6hYZKicCgAAGRAKUH/XTAgWgB6IAJyAA6v8MBMgF +AADqEh4nQAUAAP8AaB2gaAEA6BIdJJWJgAArEhwsMACKowXMC6ur67xALmgEgAD7gBUC4gCdAAkM +QPoAIh3gCgUADLo4DasL7aoKBeghAAD6ACId4AwFAAa8OBbpZwh3C6bGJmCQ58sLDUAEgADnzAoF +2GEAAORkCAZgQQAAioANAIkPqjaawAsAi4yA4zwBIRAFAAD/n/rz4gCdAIMUD8sMCsIMkoD/oAgV +4AcVAPOgKBWgBgUAC3Y4qWmiopLReisBsf+f0PKAGefSAJ0AHOlNLRIbIhIaFulJGulI7hIPJ0AF +AAAGNgHqOgEMzgKAAAlmAikSHQqIAiMSGZiUllCPJygSFyYSFgP/DP5A5hXhNB0Ao2MvEhQS6TOT +Hp6AjdAuEh7ihgIhmAUAAO+GAy7OAoAA+GYADPALBQD5ACYV4ApVAOYWASmgBIAA6BIVJBBBAADo +FgApeASAAFmGcy8SHioSFiYSHI/zKBIVKxIQ5v8ICUgEgADmEhEn+QEAAPvgFVviAJ0AbakFCACG +CQJhAzQCKBIa6IIHKw0eAABkgaj10igFoPL1ABzpFy4SGi8SGC0SGy7hDfPzphXgClUA/aAIFeAL +BQBZhlgmEhsmYBbywAoFIgCdAC0SGy4SGigSGf2gCBXgClUA/8DoFeALBQDoFgAqYASAAFmGSy4S +Gy7gFiIK/3LhCioSG4sdWCgsZKKMLxITJhIYJxIS9eAFwhIAnQAmYp4pEhj2wBNT4gCdACmSnekW +FySHeYAAKhIaLxIZiVCKpy4SF/gghhXgBCUA++EAD7eZQQDvFhkkkRmAACoSHhPo1CsSHIqjo5Mj +MAAX6NGrqwUzC+00AAXZAQAA+mAQUuDJAQD6ACId4AoFAAy6OA2rC+2qCgXoIQAAjBXYoOeTCAuQ +BIAA/4AARjAOBQDsFh0mWGEAAP2CgBWv9u4AjRz6IWgVr/YOAAAA+48ADr/1ggAf6KyP+PfgDpiS +AJ0AJhIYJxISJmKeKRIY9sAOy+IAnQApkp0b6KPkkc1n0/0AAJq46RYXLPmGAABgABMrEhoqEhsr +sQ1YJ9Jj/rTAINEPAIsaLBIb67wYLlAEgABYa9bAINEPLGEAscz8wAQdr/liACUSGiYSGSVRDAZV +DGVSACYSGyZgBPTAENkSAJ0AIhIa4xIXKbcCgACIIaYzIiIC5oI2adgEgADzABKgUAcFACkSG4oW +KJAUhB6qiPaAAEJ3iAEA6JQUIiAFAAD1ABIeUgCdABzoly4SGi8SGC0SGy7hDST2nf2gCBXgClUA +9c8AD3ALBQBZhdYvEhsv8BYmCv928Q4rEhorsQ0qEhsFuwxYJ58qEhuNFoqnwMDqrCAu2ASAAFhl +/NKg0Q8nEh2LGPaAAgPwDwUA6wAVA7hBAACx/+eDHg+P6AAA9IAgFa/ylgAAAC0SFdMP7foMCUAE +gAD4IsgV5OodAPHBIA3gDwUADQCG6AwAB/gFAAB++fEoEheNGQ6eDPlAAEQwDwUA5O0mZEBBAAAN +IIboLAAH+AUAAH758WP9EBfoTY0c+iFoFa/4WgAAAPpvAA6/99oA//ZkDaAJBQCLGiwSG+u8Ei5Q +BIAAWGt4wCDRD8CgWYX7H+gzj/j5//EYkgCdAP/4/A2gCQUAwJAY6C7Aagb2NPcBBhWv+LYAAAAA +2+DtjA8qYASAAPojyBWk3R0AWQWy+iNGFaAOFQD+IaYVr+feAMCgWYXmH+gej/j5/8/okA6lAP/o +IA2gCQUALBIb+4BoHaAbxQBYa1jAINEPAADAkBjoFA72NPcBBhWv55IAAAD7LwAKv+g6APrPAAq/ +6NIAACwSGi7AFS3AFCvAEezBCSlQBIAA7t0IC3AEgABZBYdj/dwAACoSG4sWWF/PLxIaj/Dx//Dy +kgCdACsSF+oSGynvAoAA/WAARfAMBQBYY6L0YGAVr/gCAAAAKhIb6zQACWAEgABb9pgoEhqIgQyr +Ees7CA04BIAA8R/toFIAnQDqEhspYASAAFv2Z/dAAEP/9oYAjBf2I2gV7/8FAA+PAQ+GDCZ0FC1x +Cf7isBWgCwUAK8QAL8QD5O4QDu4CgAD/pgAOsAkVAAndAp3BGufY+VWmFe/2BgAAbBAIiCIvIAeV +FPQgZhWg+/UA8RgsDeH/AQAoIBZ7gSwrEgTTD9MP/iDGFee7AQD7f8AV4AkVAOubOQlQBIAAWCcU +LxIG808QDeD79QAsMA8V57od58EW57/lUIAuC4YAAIcTsHclXDf+IKYV5FUdAOV1CA/PAoAA5pkI +AqgNAAD14AbiEAylACiSnvUAFQviAJ0AJZKd5FQAAooBgACK2PdACjiSAJ0ALmKuZOEBKWKt5JD9 +ZXv9AADv1ggkiAGAACggFtMPe4EOmRDrMQYpUASAAFgm2YkQKiAEixP1QAk5EgCdACogFKuqCgpH +KiQU9UAM5lIAnQAsMA+JFPGRnA3nmQEA+SAOKVIAnQDpVAABwEEAAG15BQgAhgkCYcCgmhIMdBGk +VCggBPUACjkSAJ0AiTHkFgEqWASAAOUyAiyNYgAA8yAOQFAEBQCkeYoV4hICLVcCgACmqimmndEP +AIrY90APUJIAnQCJFQyZEaaZLpKe9cAQA+IAnQAukp2eEIgQ5YQABA/ZgACwqfmhBhXv/BYAAAAA +7BIDKVAEgADtEgQp2ASAAFhqV9Kg0Q8AwJAMrjTu1ggs+EYAANog/EBoHaAbxQBYaqZj/8onMA72 +4ACD//pGAAAAK/wY6iQACWAEgABYap5j/6zAoFmFIR3nWorYKwr/+V/1YJAMpQBj/7kAAAAAAOsS +AylQBIAAWF8fY/7hAAAAACwhBx3nZvvO0gXqzAEA7jAOLmcCgAANzAIstiiKIBjnaf1AABUwDDUA +DKoCKrYp6AQFAfhBAAD5IAnBUgCdAG3pDgQCYw9AhgQCZQ8AhgQCYcDQ/CBGFe/62gCOMPPACuqS +AJ0AjxXiEgIv/wKAAKb/J/ad0Q8rIQn8QrAVr/0FAA2tAQ2vDP5Chh3gDgUA7ZQDLmECgADulAAt +3gKAAP1mAA2wCBUACLsCm5H41aYVr/i6AIon/KBoHaALFQDtEgMlUIEAAFhkt/ogRhWv+O4AANog +60QACuAEgABb9b6LEYkxDKwR7LsIDSAEgADxP/IAUgCdAOokAArgBIAAW/WNpKSkeYoV4hICLVcC +gACmqimmndEP//WIDaAFBQAAACv8EuokAAlgBIAAWGpGY/5MAAAAAAD+IMYV4AoFAFmExh3m/4rY +/iDIFeD79QD5X+/wkAylAP/0iA2gBQUAwOD+IAYVr/gOAAyoNPmhBhWv9DYAiieFq/tEABWvyQUA +CakBqVkpnEBt6RMEAmMPgIYEAmkPYIYEAmd5+xnTD40TDwIA+6BoHeAMBQBYZH76IEYVr/VuAPXv +AA///4oA2iD6gGgd4AwFAFhih7N7jBXiEgIuZwKAAKbMK8ad0Q9sEAQjIAAkCu10MQYiIQO8ItEP +hiCFI4Qh9nAABDs2IQD4YABBs2YBAKYzDjMR8q8ACX1EAQDjPBohE8kAAAQkLAQzKKMi0Q9sEAiK +IicgB4kwlRT4QtAVoXcBAPFbDA3omQEA+CAmFeD79QB7gSArEgQLC0f7f8AV4AkVAOubOQlQBIAA +WCYE80/gDeD79QAa5rSIqBbmsfcADGCSAJ0ALWKuZNGsJWKtZFGosIiYqOlUAAKMeYAAFeaiJVCA +JVw3+CAGFeRVHQDlRQgLzwKAAOaZCAKoDQAA9OAIWhIAnQAokp71ABMD4gCdACWSnWRRbyogFvtD +Jg3g7NUAKzAQ/WASZCIAnQArMQu8u9ogWCXMLCAE9YAK+RIAnQAoIBSkiAgIRygkFPUADIZSAJ0A +ihQe5qKNESghBxzmghnmoP+h4BXqiAEA/wAAFDT/HQDpiAIH+AUAAA9PDJhQiyAP7Dn8oGYV56oB +AOxWAi3eAoAA60sCAshBAADrVgEhwEEAAPlACAFSAJ0A6EENYlP9AABtqQUIAIYJAmHAgJgT6SAE +Ilv9AAAMuxGrW/UgB5kSAJ0AiDHlMgIl2EEAAOsWAiwJ8gAA8wAK8FADBQCjTIgTDH0Rpt3s1p0s +EASAANEPAAAAAAAAAPcADXiSAJ0ADHkRppkukp71wA3T4gCdACWSnWRRsbCMnKhlXuRgAFHqJAAJ +2ASAAO0SBCpgBIAAWGk70qDRDwDAoFmEFBrmTIio+R/zUJD79QD/+cgNoAUFAADaIPxAaB2gG8UA +WGmGY/+8wFDA2g2INPlBBhWv+UoAK3wY6iQACWAEgABYaX5j/5wAAAAAAOokAApYBIAAWF4FY/6p +iif9IGgdoAsVAOqsICpoBIAAWGPL+iBmFa/8AgCLMPNgCOKSAJ0A4hIDK+cCgACmzCTGndEPjxAu +IQn4QrAV7/oFAAqKAQqMDCwkFOSZEA92AoAACe4C++BmHaALBQD74AYd4A0VAA3uAp7x/NWmFe/4 +6gAAAAAAAADqJAAK4ASAAFv0u4sSKDIB6hYFLWcCgADsuwgNGASAAPEf9VBSAJ0A6iQACuAEgABb +9ImIE6Ojo0wMfRGm3ezWnSwQBIAA0Q//9owNoAUFAI40izeNNf5wAAe7ziEA/4AARnPuAQCuzA7M +Ef1vAA293QEA7MwaJdvJAAANvSwNzCj9YABFv/YiAAArfBLqJAAJYASAAFhpNGP+dMCgWYO3GuXw +iKj5H/I4kPv1AP/5ZA2gBQUAAMBQwPoPjzT/QQYV7/kmALBLDLsR61sICVAEgAD7YgAV4AwFAFhh +i7NM4hIDK+8CgACm3SzWndEPAABsEATaIFgluIQ3JTAW+cvmBaKmBQAGpigX5fioaAVVCghVC6dV +iFC4RPUEBg3gBxUAiDLqUgEpAQqAAAB5GgmIApSgmkGVQJRRmDLRD9ogWCWmG+XqHeXqK7Iy6tKB +LWAEgACsu+8wFi3eQoAAq6oe5eYZ5eTo5doeZwKAAK7MqWkrkn3u5cUfgQqAAO/CASvoCoAADbsC +LZJ/CP8BK5Z9D90CDe04DbsCm8Ipkn9kn39YAraIMupSASkBCoAAAHkaCYgClKCaQZVAlFGYMtEP +bBAI2iBYJYTUoBvlzvnLmAXipgUABkQoFeW96UkICVcCgACrqoqgKZJ/GOXEpUX7IAQEsGMFAPgg +BhXgBxUA4QAFATO5AAD4gABCMADiAAAAAAM8CvWAAgZ8OEUA6MgICVAEgADogn8qWASAAP50ABWu +LQUA7cwIC2gEgAALgAABAYcDN2DhAQcJ9yAAANEPbBAEKCAFJSAH+mCoFa/01QD6QEgV4AMlAP0B +IBHRVQEAwCDRDwCIKRnlpJor+wAHfCIAnQAJWQkpnQIqkQgpkQT7IARbogCdAMGv+0AECOIAnQDa +IFhhN4siA7oBZK/AiicEuwHrJgIlUMEAAFhbGuPldBUBEYAAKKAAA4gKiIzsoActWASAAPpAaB2g +DUUAC4AAZa/hiSdkn4WKmsqnKpIJZK97KKAAA4gKiIzsoActWASAAPpAaB2gDTUAC4AAZa/hY/9a +AAD//1gNoAoFANogWGEnKyAi6rsMCVAEgABYYnfaUPoAIh3gDAUAWGMmiyIDugHzf/smYgCdACwg +B+S9AQlQBIAA/EBGFeG8AQDrvB8pYASAAFhof8Ag0Q8A6yAiKVAEgABYYmUqIAXB436hDGioKYsi +82AEBX/8hgAvIDrAj3j56vpAaB2gCwUA/AACHaANJQBYYZFj/9cAAPpAaB2gCwUA/AACHaANJQBY +YQ9j/78AAGwQCogrHeVPLiAhizf8YMgVoP/lAA/uAS4kIQ3MAQy7DOuJCHjIBIAAwCDRDwMAhgkC +YZsVKCAFJSAH+CEGFe/01QD8QEgV4AMlAP0bQEHRVQEAiimbK/tAB+xiAJ0AG+U4C1sJK70CLLEI +K7EE/WAEs6IAnQDBz/2ABGDiAJ0AAioCWGDOiyIDugFkr5qKJwS7AesmAiVQwQAAWFqx26Dj5QoV +ASGAACiwANMPA4gKiIwssAf6QGgdoA1FAAuAAOukAA1/JgAAiScPAgBkn1iKmiuSCcqnZL9OKLAA +A4gKiIwssAf6QGgdoA01AAuAAOukAA1/NgAAY/8tAAAAAAD//0wNoAsFANogWGC7KyAi6rsMCVAE +gABYYgvaUPoAIh3gDAUAWGK6iyIDugHzf/rWYgCdACwgB+S9AQlQBIAA/EBGFeG8AQDrvB8pYASA +AFhoE8Ag0Q8A6yAiKVAEgABYYfkqIAXB436hDGioKYsi82AEBX/8XgAvIDrAj3j56vpAaB2gCwUA +/AACHaANJQBYYSVj/9cAAPpAaB2gCwUA/AACHaANJQBYYKNj/78AAGwQBCkwFglZFPUgBliSAJ0A +8S2wDe/65QDj5L8UpfkAAGiVBMAg0Q8AKyAGsLsLC0frJAYt/34AAI0ijCcK3QHtJgImUMEAAFha +WcmsKKAAA4gKiIzsoActWASAAPpAaB2gDUUAC4AAZa/hiSdkn7OKmmSgmoqZZK+pKKAAA4gKiIzs +oActWASAAPpAaB2gDTUAC4AAZa/hY/+IKSAGsJkJCUfpJAYs++4AAIwiiScKzAGcIouaZLBOi5ko +sAADiAqIjNog/WDwFaANNQALgADAINEPAAAAAOokAAnYBIAA7EQACugEgABYaX3AINEPAOokAAnY +BIAA7EQACugEgABb/1PAINEPAP/+vA2gCwUA//2MDaAKBQBsEATRDwAAAGwQCBXknRTkfBfknZIS ++CBIFaAKBQD6IGYVoAlFAJkUGuSXCIIJ4IEECReCgAD2QABD8AgVAOoiCAxACoAA+CAmFa/59QD5 +FwAMcAYFAPggBhWgAIoAmxOMFLFm4iwMI7gxAADlXAImY/0AAOwWBCYE8YAALVHC+sAEANALFQDg +uxoOo0wAAC5xfmTvygIqAlhiyY8R+sAEANAIFQDgiBoNGASAAOgWAyeAaYAAiaKKEAqZAZkyijcq +rDBYWfXJrCigAASICoiM7KAHLVgEgAD6YGgdoA1FAAuAAGWv4Yk3ZJ90iprLpyqSCWSvaiigAASI +CoiM7KAHLVgEgAD6YGgdoA01AAuAAGWv4WP/SYsT+iBIFaAJFQALmzlYY5vRD///GA2gCgUAbBAG +HeRWCysRrbMqMn8Z5FQV5D6IoPigAETwBAUA6bkIBAGRgAAsMngvMnv5gAWEYgCdAGXw7Cw2fCsy +eSs2e91ADeQWlKAN5BbAyfxABhQiAJ0ALzJ7wcDt5EIXg5mAACIyfCohBI4g8+H+Daa6AQAkNnz0 +b2YVoAAeAC42fO2vAQXD/QAACP8C7yUEJYxZAAAiMnywzO8yeyEA8YAAycZj/7/aIFhiNmWgnSoh +BP9BAAwWmgEAyJjRD9ogWGNh0Q8A2iBYY5TRDwAAAAAAAPpAaB2gCwUAWGNh0Q8AAADq0mAhY+EA +APuABADQCxUA/WABBd/89QAMuwMLqgEq1mBZhiEkNnwkNnv6b+gVr/zKAFl781hh6C1So2TfNVl7 +xGP/LxzkEf5viBWgClUA+G9IFaALRQDoFgAha+UAAFmBQPpv6BWv+9IAKTJ74jZ8LPtGAAAiNnvR +DwAAbBAEFOQDGeP/6OPpGV7CgACktCNCf6mI6LgIAYJBgACKMHipAipCexzj+CsxBCpGfwy6Aeo1 +BCnQBIAAWGH5zq4pMQT/IQAMFtkBAMjX0Q/aMFhjJdEP2jBYY1jRDwAAAAAAAPpAaB2gCwUAWGMl +0Q8jRn/RDwAAbBAE8GDwDe/59QCIIgk5AwmIASgmAoonDwIADwIAKqwwWFlc4+O2FQERgAAooAAD +iAqIjOygBy1YBIAA+kBoHaANRQALgABlr+GJJ8uUiprKqIqZyawooAADiAqIjOygBy1YBIAA+kBo +HaANNQALgABlr+HRDwAAAAAAAP//UA2gCgUA0Q8AAGwQBPJdABXgGMUA+EAHXCczAQAU44v0YAXS +EgCdAAw5EaSZKJKe0w/3AAcG0gCdACmSnWSQzxzjnhvjtgIqCQyqCquqWGH7+kAEANAJFQD9IAEE +3/v1AOKkAASAcYAAiqILmwMLqgGaIoonDwIAKqwwWFkm4+OAFQERgAAooAADiAqIjOygBy1YBIAA ++kBoHaANRQALgABlr+GJJ2SQZCqSCsqmKpIJyawooAADiAqIjOygBy1YBIAA+kBoHaANNQALgABl +r+HRDwAAAP//XA2gCgUAFeNcilhqoTcMORGkmSuSnm69PimSneSQOmVb/QAAm1hlnz5gAAvaMFl7 +amWvM9EP0Q/RDwAAAAD//IwNoAkFAMCgWYESilhrob3//0gNoAkFAMCQwMoMrDT8oQYVr/8OAAAA +AGwQBBjjQQIDRwwzEagzKzKEGeNKKLAAKrIBCYgKCiGMAgo+KIIMAwI+/EBoHaANJQALgAAiNoQM +AgDRD2wQBBTjMgIDRwwzEaQzJDKEikEmQAAoQAj6mGgdoKklAAIFPgMCPnmBJRjjNQhoCoiM6lQA +ClgEgAD8QGgdoA0lAAuAACI2hAwCANEPAAAA6yQAClAEgABYYbvzQGgdr/8uAAAAAAAAbBAEGuM0 +KqJGK3rQC6ooFONL/0AAFTALFQALqgL6luYVoAkFAAnkMRXjRhjjKyhWhCVShCNCt2YwDW0IBStC +t2awBGP/8wAAHOM/IsaKY//8AAAAbBAEWX/sEuMCE+MdKSKC0w8JGo4DqAqIgAuAAGP/7ABsEAQq +IgcqrBBYYpjRDwAAbBAEiCcijBDaIFhid2ihAdEP2iBYYnES4ysLqBHoIggFAdmAAAzqMCsihSuy +ACKs/+y7CAlQBIAAWYTvHOMjKsJ/+kAEANALFQAAuxoLqgIqxn9ZhR7RDwAAAAD6AOIdoAsVAFhi +Tywifywmg9EPAGwQBCYiBw8CAOZsECnQBIAAWGKy7DQACmgEgADuVAANWASAAO8iACtQBIAAWGH1 +0Q8AAAAS4woD6DAE7jAFsTCTIJQhlSIS4wYT4tSEIAQzApMgEuMEwDAoN0AoN0QoN0goN0wjPQFy +M+0DAgAS4v4T4t2TIMcvE+L9AyMDEuL8hCAENAGUIBLi+4QgBDQBlCAS4vmEIAQ0AZQgEuL4hCAE +NAGUIMcvwDEDIwMS4vWEIAQ0AZQgY//8AAAAEuLygyADExQPMxGTIFf/2hDi75EAkgGTApQDEeLt +ghAB6jCiEQHwMcBABOQWAAIAEeLpghAjGgADIgKSEBHi5sAhkhAE5DGEA4MCggGBAADSMAEjAAAA +ABDi4ZEAkgGTApQDEeLfghAB6jCiEQHxMcBABOQWAAIAEeLXghAjKgADIgKSEBHi18AhkhAE5DGE +A4MCggGBAADTMAEzAAAAABDi0pEAkgGTApQDEeLQghAB6jCiEQHyMcBABOQWAAIAEeLFghAjSgAD +IgKSEBHiyMAhkhAE5DGEA4MCggGBAADUMAFDAAAAAABclAFdlAJelANflABDAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXJABXZACXpADX5AAUwAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJyUAB2QAZ2UAp6U +A5+UBAiUBQmUBgqUBwuUAEMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACckAGd +kAKekAcdkAOfkAR4kAV5kAZ6kAd7kABTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAA3JQAHZAB3ZQC3pQD35QEBJQFBZQGBpQHB5QICJQJCZQKCpQLC5QAQwAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAANyQAd2QAt6QCx2QA9+QBLSQBbWQBraQB7eQCLiQCbmQCrqQC7uQAFMAAAAf//uQ +ANIxEP/+CgAAAAAAH//72ADTMRD//goAAAAAAB///CAA1DEQ//4KAAAAAAAA9DAKAAAAAAD0MAoA +AAAAAPQwCgAAAABsEAQqIhAooAUpCpL5AATlYgCdACsiGPrgAAZwjbUA/YAETWIAnQDzYAQr0gCd +AP9uwAwfyQUAi62Ot4jqjOiN6y/sIOn/AQZQwQAA790IBEDBAADo5gom6QEAAOrTYH5IBIAAfaFp +muga4RwKAIcJAmEJAmEJAmHAgejGBSlQBIAA+YDmFaAOBQD/gIYVoA0lAP+AxhWv//UA78YDL2AE +gABYA3vAINEPWMcSwCDRDxnhDAm5AfhDBhXgAgUA0Q8M2gwK+gwqrHD7wQYVr/5yAC38QP3BBhXv +/kYAbBAEE+EBAyIC0Q8AbBAEFuD/JCAHiWDAc/EyQA3hRAEAKSIYCehR9QAJiJIAnQDzwfAF4anh +APVACYiSAJ0A9IAGchIAnQAMSRGjmSuSnvdgCsnSAJ0AKpKdZKEzG+Do6wAFDUgEgAAJAmEJAmEJ +AmEpIQcb4Oj/wdAF6pkBAOzg5xzPAoAAC5kCmaAZ4OX+QAgVoD0FAJ2n/UCmFaAbhQCbo5mi7+4C +D0YCgACepPcGAAxwDgUAnqaYoSgiGAiIQe6mCCxHAoAAmKnt4NYafwKAAKP/J/adLCIYnmAqIhAN +zALsJhgpWASAAFi35QUKR2iiGIon+gAiHeAMBQD7RAAVoA0VAFheCdKg0Q/AINEPHODFi8j3YATQ +kgCdAAxJEaOZLZKe96AFIdIAnQAqkp3koJtl6/0AAJ3IZa8eYABPjiKxn+9mACcBqYAABQhH9QAE +SRIAnQDAINEPKhoACpkC+EMGFe/7JgAAACsqAAubAvpDBhXv+yYAAAAAACtMGOokAAlgBIAAWGOQ +Y/+9AACMImXPtitMGOokAAlgBIAAWGOKY/+lAAAAAAD/+qgNoAoFAMCgWX4KHOCbi8j5f/rgkgCd +AP/9xA2gCgUAwKDA2g29NP2BBhXv/YoAjCePyorJ/4QAFa/IBQDo7gEH+EEAAO/GCiVTwQAA6sYJ +J3EBAAB+qymJyx3giaqamsmdoIwg+8EOBeANFQDrpgIuZgKAAA3MAv1AJhWgAgUA0Q8d4H+doIwg ++8D8BeANFQDrpgIuZgKAAA3MAv1AJhWgAgUA0Q9sEAjkIhAqYASAAOdCByvQBIAA6+BzGXAEgADy +gsgVoBg1AOdyDiL76QAAePspGOBtCPgKiICaFJwS7hYBLAAigAAAAACSECqykexUAAnYBIAAWXzN +ZKYv8oLGFaACBQDRDwAAAAAAK+IYC5tS7hYBJf85gAAa4FriFgAp2ASAAOqisyrgBIAAWXy/ZKRZ +IiqAonKSFSIg3hrgUtsw6qK1KuAEgABZfLj7QEEAEgCdABrgTNsw6qK3KuAEgABZfLL7QEFoEgCd +ABrgRtsw6qK5KuAEgABZfKxkppQa4EHbMOqiuyrgBIAAWXyn+0BC4BIAnQDBOPJAHrhiAJ0AaScj +ixUjtN2LEPqCxhXgAgUA0Q+SECqyiexUAAnYBIAAWXyaZKbbixD6gsYV4AIFANEPAACSECqyl+xU +AAnYBIAAWXySZa8S+iBoHaALtQBYtNT6ACId4AMFAOqzOAUBiYAA6hICK1gEgABZedLDsOzgHh0o +BIAA/KBoHeAKVQBZfSTIWRzgGo0RDFw2LNYXZTTgjRD8gsYV4AIFANEPLkByZO61khAqsq3sVAAJ +2ASAAFl8dmWuovogaB2gG2UAWLS4+gAiHeACBQDqsjgFAKmAAOoSAitYBIAAWXm2LH0DKsUoZSSM +jRD8gsYV4AIFANEPAJIQKrKf7FQACdgEgABZfGJkovsa3/fbMOqiiyrgBIAAWXxdZa5A+iBoHaAL +VQBYtKD6ACId4AIFAOqyOAUpmYAA6hICK1gEgABZeZ4sQHPxgCju0gCdAGSlFYoU+gCiHeAM1QBY +tHzSoNEPkhAqsqXsVAAJ2ASAAFl8R2WutPogaB2gGyUAWLSKZKPzK0By+2BEIBIAnQDqEgIrWASA +AFl5iCxCF4sQK0YWCsw2/ILmFaACBQDRDwCSECqyo+xUAAnYBIAAWXw0ZKJzGt/J2zDqop0q4ASA +AFl8L2WuVPogaB2gC+UAWLRyZKOT6hICK1gEgABZeXMrfQIqtRSLEPqCxhXgAgUA0Q+SECqylexU +AAnYBIAAWXwgZKJ6Gt+02zDqoqEq4ASAAFl8G2SjtxrfsNsw0w/qoo8q4ASAAFl8FmWt7vogaB2g +C3UAWLRYZKMtK0ByZLfyGt+lixLqotsrYASAAFl8DGWm5ytAc8DIDLsCK0RzixD6gsYV4AIFANEP +AACSECqyq+xUAAnYBIAAWXwBZKI/Gt+W2zDTD+qijSrgBIAAWXv8Za2G+iBoHaALZQBYtD5kosUr +QHJkt3ka34uLEuqi2ytgBIAAWXvyZKeIK0BzLAr9DLsBK0RzixD6gsYV4AIFANEPAJIQKrKT7FQA +CdgEgABZe+dkogca33zbMNMP6qKHKuAEgABZe+Jkowoa33bbMOqipyrgBIAAWXvdZKw/Gt9y2zDq +oq8q4ASAAFl72GWsLMCl/b7gBaA7BQBZfHYa32qLEuqiyStgBIAAWXvQZaQYixErshgLmVLImWiS +B/kgBPnSAJ0AjRGMECvWGPyCxhWgAgUA0Q+SECqyg+xUAAnYBIAAWXvCZKG7Gt9X2zDqooUq4ASA +AFl7vWWsjPogaB2gCyUAWLQAZKHLGt9OixLqotsrYASAAFl7tWWsa4oU+gBCHeAM1QBYs+HSoNEP +AAAAAAAAAOoSASpYBIAAWLP7zayCFSIg3mP8FwAAAOoSAitYBIAAWXjw9UAq8pIAnQDHL9EPAPog +aB2gC/UAWLPlZKFi6hICK1gEgABZeOfoEgAjyAsAACqVFfiCxhWgAgUA0Q8AAPogaB2gGxUAWLPZ +ZKEyKkByZKXUKUBz8T/ez5IAnQDxP96P0gCdAOoSAitYBIAAWXjVLUIYHN8j+6EADrA7BQD8gwYV +4ApVAFl8JYsQ+oLGFeACBQDRDwD6IGgdoAulAFizw2Sg2i5ActMPZOTl6hICK1gEgABZeMMvQTb7 +4A8CogCdAIoU+gFCHeAM1QBYs6LSoNEPAAAA+iBoHaAbVQBYs7NkoJrqEgEqWASAAOwSAitoBIAA +WLM6ixD6gsYV4AIFANEPAAAA+iBoHaALlQBYs6dkoGooQHJkhIga3vWLEuqi2ytgBIAAWXtbZaHN +K0BzjRD8gsYV4AwVAAy7AvqOZh3gAgUA0Q8AAAAAAAAA+iBoHaALFQBYs5XKohre5IsS6qLbK2AE +gABZe0tlqsOKFPoAIh3gDNUAWLN30qDRD8Cl/b3CBaA7BQBZe+XAINEPAAAAAAAA+iBoHaALhQBY +s4P6ACId4AIFAOqyOAUBSYAALEByDwIAZMP5Gt7U6xICK2AEgABZezRlof0tQHPA6A7dAi1Ec2Uv +pY8Q/oLGFeACBQDRDwD6IGgdoBsFAFizb2SviihActMPZIOE6hICK1gEgABZeG8pQhmLECtGFgqZ +NviDJhXgAgUA0Q8AAPogaB2gCzUAWLNhZK9SGt6wixLTD+qiwStgBIAAWXsW4960HQO2AACLESuy +GAvJUciZaJIH+T/tkdIAnQCOEYwQA70BLeYY/ILGFaACBQDRD2UvDI8Q/oLGFeACBQDRD4gVwJgJ +IgIihN74IEgVpyIBAPj6xhWv5VYAAAAAAAAA6hICK1gEgABZeEYqRTaKEPqCxhWgAgUA0Q8a3o2L +EuqiwytgBIAAWXr0Za09ixErshgLyVFokQpokgf5P+lh0gCdAB7ejAO9AQ7dAo4RjBAt5hj8gsYV +oAIFANEPihT6ASId4AzVAFizFNKg0Q8AAPogaB2gC0UAWLMlZK5ijRH9vPwFoApVAP2jCBXgOwUA +WXt7Gt5vixLqosErYASAAFl61ePedh0N1gAAixErshgL6VHImWiSB/k/5XnSAJ0AjhGMEAO9AS3m +GPyCxhWgAgUA0Q8a3l+LEuqiyytgBIAAWXrFZayDixErshgLmVJokQpokgf5P+OR0gCdABLeYPgg +KBWijgUArn4CsgIihhgt4N38IAgVoA8VAA/dAi3k3fyCxhWgAgUA0Q+KFPoBAh3gDNUAWLLg0qDR +D4gV+iBIFaAPJQAPLwLvhN4rWASAAFl39IgVIoDe+xuGHa/fDgCKEo0V+7yOBeAJRQAJKQL5u8Yd +4AwlAFl6n2ShqYoS+7yEBeAMJQBZeptkoZkb3j/6IEgVoAwlAFl6l2ShoIoS+7x2BeAMJQBZepNk +oZCCFfJb0BWv3g4AAADAsPggqBXgGAUA+EYADDNjRQDy4ABB8IwFAOiU3inQBIAAWXdt+HyCHaAL +BQD44ABDsIwFAOMWAyvQBIAAWXdmhRLacOVcAiMb+QAA7DQACtgEgABZd1Ub3hz6IEgVoAwlAFl6 +dmShNBveGfogSBWgDCUAWXpyZKEjG94W+iBIFaAMJQBZem5koSKKEvu8JAXgDCUAWXpqZKESghXy +W9AVr9wiAAAAGt37ixLqosMrYASAAFl6YmWq9osRK7IYC+lRaJEKaJIH+T/XKdIAnQAe3gKMEQO9 +AQ7dAv2DBhXgClUA/bv8BaA7BQBZevaLEPqCxhXgAgUA0Q+KFPoA4h3gDNUAWLJ+0qDRDy8qgK9/ +IvDewIEIIgL+IKYV5yIBAPP7xh2v2KoAAIoU+gICHeAMxQBYsnLSoNEPihT6AUId4AzFAFiybtKg +0Q+KFPoBIh3gDMUAWLJq0qDRD4oU+gECHeAMxQBYsmXSoNEPAIoS/N/AFaNrRQDrewgFUAkAAFi0 +E2P+TYoS/N/AFaNrRQDrewgFUAkAAFizU2P+VtpQ6xIDKeAEgABYtAlj/svaUOsSAyngBIAAWLNL +Y/7cihT6AkId4AzFAFiyTdKg0Q+KFPoCIh3gDMUAWLJJ0qDRDwCKFPoAwh3gDMUAWLJE0qDRD4oU ++gDiHeAMxQBYskDSoNEPihT6AMId4AzVAFiyPNKg0Q8AAGwQBCgiGPjgAAQwicUAeYEn9EIIFeeV +AQD1IAmpEAcFAIk3iprkkgklAKGAAItD7EIFJYRlAADJwcAg0Q+Nc9Rw7nIFJoQdAABl7+wmIAf6 +QGgdoWYBAPrAaB3gPAUAWDArZKHUi0MpQgUPAgD1YAd4EgCdAGSRX/tC5h3vjgUA/0AmHaj7HQD/ +QsYd6P8dAP9Cph3o/x0AL6QULSIW/UPmHejdHQD9Q8Yd6N0dAP1Dph3o3R0ALaQcHN2EDGoR/UAA +RTAJVQCZoCogFvpA8BXg+PUA+UbGDaAZ9QD5uvoFoqwFAAy8HajIKIJ/CpkM+QALemIAnQAf3Xf1 +QAAWsDgFAOjdAg33AoAAr+6d4Ik4jEfqMgkkgJGAAJc7maCLOJqxJzYIJzYJ7t1sFgBpgAAtIhgO +3QItJhiKN/oAYh3gDAUA+0QAFaANNQBYWovAINEPizhkvslj/94AAAAAAAD5P/ig0gCdACekAC1S +E7Hf/qJmFejtHQD9Q2Yd6M4dACykGf9DRh2ozB0ALKQYKVIQHd0wsZkNnQL4ogYV6IcdAPlAxh2o ++B0A/0CmHejvHQAupAQnpAf9QmYd6M0dAP1CRh2ozB0A/UImHajMHQD9QgYdr/qWAADE0C2kAIxG +/UDmHajMHQD9QMYdqMwdAP1Aph2ozB0ALKQEKVIT+UNmHeiZHQD5Q0Yd6JkdAPlDJh3omR0AKaQY +iET5QmYdqIgdAPlCRh2oiB0A+UImHaiIHQD5QgYdr/kKAI44Ze35iS4a3SbqNgsh+IEAAO+WASFA +4QAAmDmZOP5BxhXgAgUA0Q8f3R8KrQoe3R+vzw/dC67dK9F/K7zQB7s1+6/kHe/6PgAAbBAEJCIQ +ZEB1KDAYKTAZKyIW6jAaLEYCgAAJiALpMBssRgKAAAqIAgiIEQmIAuuJB3XIBQAAKSYWKSIY0w/q +3QkUwCiAAAqaASomGCswECwwEe0wEi3eAoAADLsC7DATLd4CgAANuwIIuxEMuwJosBIsQAUtCpX9 +gAhMYgCdAMAg0Q8ALjAULzAV6DAWL3YCgAAP7gLvMBcvdgKAAAjuAgjuEQ/uAv3Y4ABfyQUAi02N +t4jajtjs0gsm+IEAAAn/AersMC9IBIAA78wIBEDBAADo1gomYQEAAPuABYOiAJ0A/UAFzCIAnQCa +2Bzct/wACB2gCjUAbaoCCQJhKTAUKjAV7DAWLM4CgAAKmQLqMBcszgKAAAyZAgiZEQqZApnjKDAQ +KTAR6jASLEYCgAAJiALpMBMsRgKAAPsGAAwwDAUA7OYFLEYCgAAJiAKY5C8wBCgwBekwBi/+AoAA +CP8C6DAHL/4CgAAJ/wII/xH55gAPsA0lAO/mBilQBIAAW/7/Y/7tANpAWMJawCDRDw7KDAr6DCqs +cPuhBhWv/UYALPxA/aEGFa/9GgAAAABsEAgW3K7Apf25XAWgOwUA9NYoFaANBQBZeZkoYk75uP4F +4AUFAPEc4A3gBhUAmRUY3KWYFoxMLcEEjsD7v+AV7/U5AO/FBS3PAoAA6ekID78CgAAHlwwHAIf3 +gGQV5qUBAAqmYP1DQEdWdwEADPgRCJgMCCCHwKAKpmL1QAwPUgCdAH+5Cch2+uAMpCIAnQAY3I4X +3IrogigvzkKAAKmpJ3KrqYgJiBGod4l68yAJxSIAnQDy4AmEYgCdAJcU/bkGBaAKVQD84AgV4DsF +AP7gsBWgCQUA+CAGFeAPBQBZeWiNFPe47AXvmHUAKNQFitj29igV755lAP+gph2gDAUA7NYKJQC5 +gAD8IMgVoAolAPwgiBXgOwUAWXlZHdxojBQt0p4qwh6MwA3MDOwWByV8/IAAixQqshkrshj+7ggV +qAA9APtrAA0wDAUA++AABTANFQD7WgANMC8FAO6qCg+CCoAA+0AIFaC7nQBYWSGLFI23jNrkwAlm +0IEAAI7ZYAABwOCN4Q0NR/ugaB3gDAUAWFltjhWLFIoX7gAFBciBAAAJAmEJAmEJAmEJAmEJAmEJ +AmGIt/8EABXvyQUA+eAEB/AJBQDphgon+QEAAP8BBhXgDAUA/wEmFeANFQDqcgwtWASAAFhZAhrc +NSqiTrFV+r/yC6AGFQDRDwAAAAAAAO3BBCf4BQAADw9PL8UFffFcsNsMuRH5wABE//lOAAAACfsR ++0AARf/59QD/oAATNfsdAObuCA//goAA/88AD3AGFQD/34AVpLsBAOjiAC2BCoAA78EFK1gKgAAJ +uQMJiAEIuwKb4P+ACBWv/loAwPAvxQX//mgNoA8FAABsEAyIIs6PKSIYGtwSF9vk9iBmFeGZQQDn +2+Yc3oKAAOsWAizPgoAA+yAARLAb5QD4IIYV4ARaAMAg0Q8uUhsc3AaurnrrAbGILlYb+KNGFaAI +BQAd3AKKGA2qCgiNCejcABRIBQAALiEHCJkCGNvRDg5KDO4RCO4CnkAY2/qOIPiARhWgSAUAmEMY +2/cO3REt3G/5xgAMNN0dAOhGBC92AoAADt4CGNvxnkEqoqEuYiUpRhQZ2+8IqgH/zwAPcAgFAA6Y +OY4SCO4CDqoCDKoCmkeKFigiFYkpqojqmQgEQMEAAOgmFSTIwQAAmSmOFwzuEafuLead+ELQFa+a +hQAqNAUqIAf/t44F4Pn1APkFZg3irgUADq4dr+8v8n/BnwiZDPngIzJiAJ0AHdvSCI8Q778CDU8C +gACtmZ+TKWImKGIl+QAdtGAb5QAsIAcMDEEMyBGniCqCnpwYnBf7QCDD4gCdACSCnY0T+iCIFeAZ +5QDoRAACIBmAAA0Ah+uyqCJ5gQAAnxVtmgIIAmGINyoiF40pjoqGjokqJYIJ7GImJxqhgAAoYiUu +YiwNmQwMiAwO7gkF7gsKiDYoFgvouwgHccEAAOsWBiXYwQAA6xYALGAEgAD7IBRr4gCdACogFhnb +lf5A8BXg/fUAfaF5HduilR70IaYVoqUFAAX1HQqkCq1dqVUFRAsV252THKVE5dJ+JRhBAAD6YAQA +0AMVAAA5GglVASnSfwWZAinWfyVCfwChBOMSDCnQCoAA5BYBIqgFAAAlRn8t0oCEHYUe+6AX2KIA +nQAd24cM+RENmQgpkgAJqgFkov0qXDjqBgACSKEAAPiCaB3gD1UAL0QgLTIb/IZmHejdHQD8hkYd +6N0dAPyGJh3o3R0ALUQwKmIk+obmHaiqHQD6hsYdqKodAPqGph2oqh0AKkQ0KSIW+IfmHeiZHQD4 +h8Yd6JkdAPiHph3omR0AKUQ8LWIo/IjmHej9HQD+iMYd6P8dAP6Iph3o/x0A70REJugFAAAtZigq +YicpYib4hOYdoA8FAP6EJh3o2B0A/ITGHej9HQAvRCX5QABFeN8dAC1EJPqJZh2oqh0A+olGHaiq +HQD6iSYdqKodACpESC9iJQn/DO+JCnJJYQAALfqALUQhKlIZDwIADwIA8VIADeANBQAtZiAtZiwK +ijbqRhUi4aEAAAwgiAkEii9iJqr/L2YmKVIZCowMKFIaCpkM6VYZLOUmAADxl5AN4AgFAP7ECBXg +2AEADvoKjxWKoA/ZCgrKNpqQKWIgDpkL798LBMghAADpRgAH+CEAAA8IiiliIC9iJg6ZCqr/L2Ym +j5AK/wyfkC9iIA75ComQsYjqzAwEgSmAAA7+C4XjHNsWj+KlpZXjelsBsf+f4v7EyBXv8QIAAAAA +APHjcA3gCgUAKWIsLuwY6mYgJMgFAAD4xYYV4A8FAIkVKpwY/U0ADPDYAQDpFgUuew4AAP22BAWv +/vYAwPEvZiD//2gNoA8VAACeGYsQ6BYKKVAEgABYN6qIG4wajhnrEgAlavGAAGP7si9iIA76Coqg +7v8LAmlhAADkrwNn+CEAAAqKNipGFQ9giA0MiiliICxiJg6ZCqrMLGYmj5AK/wyfkC9iIA79Co3Q +6owMBoLRgAAO/guP4xza4Yjir696+wGxiJ/j+cBGFaAIBQD+xMgV7+2eAAAAAP/ysA2gBQUAiDhk +izaJOcAgkjuYkIo4maGSOPJhJhWgAgUA0Q8c2s//+8ANoAgFAMn5LWIs/8MAFaAPBQDvZiAm6AUA +APzFhhXv+X4AwIH4xAYVr/lWAACNES3dAirRAinRAS3RBQqZAf0/6BrgChUAixjaIOu8EilgBIAA +WF1+wCDRD4sY2iDrvBgpYASAAFhdecAg0Q8AGdqqCI8KqekJ/wsZ2qip/4kWLfF/Cd0M/boAFeAJ +BQAJ3TX97+Qd7+4mAABsEAaLJycgB4i68wlgDeF3AQAjsgkFCEdogggpIHQImRApNgD9tVIFoApV +AO2yAilwBIAA/kAIFeA7BQBZd4P9tUYFoApVAPoGAh3gDUUAWXd/Ftpp9OASmhIAnQAMeRGmmSqS +nvdAFppSAJ0AJJKdZEKh/bUuBaAKVQD8YBAV4DsFAFl3ciowAMO0DwIA+0ASVGIAnQAqPQYloAHD +sA8CAP21GAWmVQEA/KBoHeAKVQBZd2bp2k0Z0ASAAPSgESCSAJ0A9KANIRIAnQD0oAzikgCdAMDA +CQCH6RYAKlgEgAALAmELAmELAmELAmEjIQcoIAce2nr+QQQV6jMBAPgCAAWxiAEA6rsQDEQCgADo +/wIJnwKAAAszAhjabxvaOw7/AggzApNAjSD+gIYV4DgFAPiAZhWgAwUAk0WTR/qARhXgCUUA7kYG +IliBAAD9oAAWsA5FAP+mAA6wDiUA7UYBLm4CgAAKIIYLAmMKAIbrDAABUMEAAA7dAu1GCSJZAQAA +CoCGCwJpCmCGCwJnCkCGCwJlDH8Rpv8p9p30oAqqkgCdABTaT/hBCBWvmnUAKiQF8pEoFe+ZZQD4 +QKYd4AYFAOYmCiQAuYAA+gBCHaA7BQDs2i8ZaASAAFl3HCsiHihCdiQiAOhEDAgECoAA82AEH9IA +nQArIgcpsgrkkO1l0IEAACuyCS2yAfQgCBXn3QEA+6BoHeAMBQBYVz7lAAUBSIEAAAkCYQkCYQkC +YQkCYQkCYQkCYY8n/+QAFa/IBQAI7gHm9goncQEAAO72CSpYBIAA/+EGFaAMBQD6YYgVoA0VAFhW +1sAg0Q8AAPxGUBWv+ZoAKiIZKyIY/m4IFagAPQAKuhgKCk8Kqg//QAEFMAwFAPtACBWgDRUAWFbI +Y/9TAAAA//W0DaADBQAV2dmKWPdABHiSAJ0ADHkRppkrkp73YAT6UgCdACSSnWRAlrCr+qEGFe/2 +bgAAAAD6YIAlr/bmAPwQQh2v97oA//xYDaALBQD9s/gFoApVAPoGAh3gDQUAWXbR6iIKKVgEgABb +/S9j/o2JJ4yay8+DmY0iZNBR/GAIFeAKVQD9s94FoDsFAFl2xsAg0Q8AAAD/9MANoAQFAMCgWXcg +ilj5X/tQkgCdAP/0ZA2gBAUAAP/+9A2gAwUAwEDA6g6uNP6hBhWv9AYAANog79ndGWAEgADvNgAj +2GEAAFhci2P/lWwQBoknIyAHKJIKAwNB55IJJA7xgAAFCEfogg1p0ASAACkgdAiZECl2ABnZkAw7 +EfRgDiISAJ0Aqbsssp73gBI6UgCdACuyneS0AAWPoYAAFtmDmhAT2YnmAAUKWASAAAsCYQsCYQsC +YQsCYS0gByghBxvZtvlAAAQwzREA6swQDEcCgAAMiAILiAKYQI4gw1D0gGYV4A9FAONGAi9mAoAA +D8wCnEErIDP0Q8gV4AMFAPxgaB2giJUAC4w58qAM35APJQAY2aMuIQiTReNGBy4uAoAA/qYACvHd +AQDoRgYu7AKAAA3uAvnGAA8wC0UA7kYEImiBAAAHIIYNAmMHAIYNAmGVSRXZkwyuEanu+9OmFe+d +dQAtJAWOKPSxKBWvmGUAKCQF4yYKJwC5gAD6AEIdoDsFAOzZcxloBIAAWXZgKCIeKVJ2hSDpVQwE +fdKAAIkni5rksOBk0IEAACuSCS2yAQ0NR/ugaB3gDAUAWFaG5gAFAUiBAAAJAmEJAmEJAmEJAmEJ +AmEJAmGPJ//kABWvyAUACO4B4/YKJ3EBAADu9gkq2ASAAP/hBhWgDAUA+oGIFaANFQBYVh7AINEP +AAAqIhkrIhj+jggVqAA9AAq6GAoKTwqqD/9AAQUwDAUA+0AIFaANFQBYVhJj/2IAAAD/+IgNoAcF +ABTZI4xI4xYAKAQKgAD3gAQ4kgCdAAyrEam7LbKe96AEwlIAnQArsp1ksI+wzZ1I5LQADfEuAABg +AA0AAAAAAAD//IwNoAsFANog7tlIGWAEgADudgAh2GEAAFhb9cAg0Q8AAI0q/bKEBaA7BQD9oAgV +4ApVAFl2FBnY/4oQ/EDwFeAPJQD8EaIdr/kOAAAAAP/28A2gCwUAwKBZdmqMSIoQ6dj0GAQKgAD5 +n/tAkgCdAP/96A2gCwUAwLDA6g7ONP6BBhWv/a4AbBAIiCcjIAeJigMDQeeCCSSPOYAABQhHaIIH +KSB0CJkQmXAqIDMV2OHyIKYV4AwFAPNAPA3gCwUAnBL6IIYV4ARFAPRgDcoSAJ0ADDkRpZkukp71 +wBgLogCdACiSnegWAyxQBIAA5tjNFBARgAD2AAgdoAMFAG1JAggCYSsgM2WyDSwhBy0gBxjZAvhB +BBXqzAEA/CAABfDdEQDq3RAOZwKAAO3MAg3cAoAAC5kCHdj3CJkCG9jCDcwCnKCOIJimk6WTp/tA +RhXgPwUAn6P5QIYV4A9FAOkSBC92AoAAD+4C7qYBJWCBAAAHIIYMAmMHAIYMAmEX2Of9IAAUsAsl +AAuZApmpiBXtIggsRwKAAKWI9ROmFa+fdQAvJAX08SgVr55lAC4kBeMmCiaAuYAA+gBCHaA7BQDs +2MMZaASAAFl1sCoiHihydoUgDwIADwIA6FUMBX3SgACIJ4mK6IIJJFCBAABkkMgtggENDUf7oGgd +4AwFAFhV1OYABQFAgQAACAJhCAJhCAJhCAJhCAJhCAJhjyf/5AAVr8gFAAjuAeP2CidxAQAA7vYJ +KtgEgAD/4QYVoAwFAPqBiBWgDRUAWFVswCDRDwAAKiIZKyIY/o4IFagAPQAKuhgKCk8Kqg//QAEF +MAwFAPtACBWgDRUAWFVgY/9iAAAA//hkDaAHBQAW2HGKaPdACriSAJ0AiRUMmRGlmSuSnvVgCyui +AJ0AKJKdZIFcsKv6wQYV7/jOAAD//MwNoAgFACggNSkgNiQgN+iZEQxEAoAACYgC+IYACjCIlQDk +FgIiIZ0AAPgghhWkRB0A9ICAFa/3bgCIJ4qKZKEEh4naIOvYjRlgBIAA63YAIdhhAABYWzjAINEP +AAAa2EuIEhnYhi0hCI4nKyEHLCAHju7+IAYVqrsBAPwgAAcwzBEA7LsRDmKCgADsuwIPdAKAAA7d +AhzYcY4TCd0CDLsCm+CMIOPmBSR5IQAAn+Pq5gIkWZ0AAP3AhhXkux0A6xYBLmYCgAAMuwKb4QcE +iQ4gi/nAxhXgugUAmucvIAz5BgAVoDwFAOjmBy/8AoAA790CAVjBAADt5gQnUKEAAFlxbIoTixDs +EgIlUWEAAFlxaIsRihMMuxH7QABFf/TSAAAAAAAAAP/0CA2gCAUAwKBZdYaKaPlf9RCSAJ0A//Os +DaAIBQAA//vkDaAHBQDAgMDKDKw0/MEGFa/zTgAAbBAEGthIKSIYGNhHCpkBKSYYLjIJ/wAWIKIA +nQAuIhMtMQsqIhQb2EEO3QgK2gztJhMlYQMAAHyzBR/YPXr7EvpAaB2gCwUA/AACHaANJQBYAgcr +IhIkCgDTD/NvkA3gPhUALbAwDQ1FftEvL7BIKLBJLCIW6bBKL/4CgAAI/wLosEsv/gKAAAn/Agj/ +EQj/Auz5B3ZABQAAKCYWKQoh+aAP7GAqJQD7oBCsICxVAP2gC0wiAJ0AftEXKgoC/bA6BaA7BQBZ +dOr0QkYVoAIFANEPLbAxLrA0irrxoAmWEgCdAC+wNeiwNi92AoAADwIAD+4C77A3L3YCgAAI7gII +7hEP7gJl4QgssFwtsF3usF4uZgKAAA3MAu2wXy5mAoAADswCCMwRDcwCZMDjLaIQLdIZ/aAG06IA +nQD9YOgVr52VAC20BR3XsYzO/AAIHeCZBQAJyQgJAmEJAmEvsFwosF3psF4v/gKAAAj/AuiwXy/+ +AoAACf8CCP8RCP8CL8YlLrBYL7BZ6LBaL3YCgAAP7gLvsFsvdgKAAAjuAuiiDy92AoAAD+4CLsYn +LbBELrBFGdfi77BGLu4CgAAO3QIusEfkxigu7gKAAA/dAuTGJi7uAoAADt0CLcYk6bYLJfCBAADu +hgAleOEAAC+2CPlhJhWgDSUA/0HmFaAMBQBb+5v0QkYVoAIFANEPAAAAAAAA9EJGFaACBQDRDwAA +KLAxf4ftLLBML7BNKiIQ7rBOLmYCgAAPzALtsE8uZgKAAA7MAumiFC5mAoAADcwCLaIVfJECLKYU +LLBQLrBRDwIA77BSLmYCgAAOzALusFMuZgKAAA/MAgjMEQ7MAnzRAiymFftgaB2gDAUA/ABCHeAL +BQBb/cf0QkYVoAIFANEPAAAA+2BoHaAMBQD8AEId4AsFAFv+b/RCRhWgAgUA0Q8AAAD7YGgdoAwF +APwAQh3gCwUAW/zU9EJGFaACBQDRDy8iEY/3j/4s8BAp8BEd15To8BIuZgKAAAnMAu/wEy5mAoAA +CMwCCMwRD8wCfNATDHtY/XAAFbWsAQD7RgANcAAeAADGqh/XZR3Xhi/yKC3Shqr/Cf8Rr90t3f4s +0n7AogrMAizWfhzXgPxACBXgOwUAWXRIY/zIAAAAAOsxCylQBIAAWLg/9EJGFaACBQDRDwAAAGwQ +BC4gBSgKdP8ACtuiAJ0AKyIYHtdx82AMA1A09QCNLIk2KjAgH9dt/GFEFaCItQD9IAp9ZaoBAP9m +AA3/+cUA6yYYJmNtAAD5gAQGd/sBAPngBhwiAJ0ArNiYLPVAB74QKTUA+UAHfGArZQD7QAc8YCxF +AP1ABvwgPSUA/UAGvGIAnQD1QAZ8IgCdACswMCwwMR/XTu0wMi3eAoAADLsC7DAzLd4CgAANuwII +uxH9ZgANv+mlAPvioB3oq7kA/VAAFTWbAQD7JgAMsAAWAAAb1x4a1z8rsigqooapuQmZEampK5yA +6yYSJMrBAAAqPCAKQIYJAmUKIIYJAmMKAIYJAmEsIhgOzAL8QwYVoAIFANEPAAAAAAD+AGId44vh +APn/+a4iAJ0AKzAkLzAl6DAmLd4CgAAPuwLvMCct3gKAAAi7Agi7Ee+7AgZIEQAA+y0ADn/8GgAA +KSIRiZf5IcgV7/42AAAAAP2uPAWgClUA/EAIFeA7BQBZc+EqIAUrCnh7oRL6QigVoAsFAPwAAh2g +DSUAWLWhwCDRDykiEsmYiZf5IcgV4AtlACo8IG25BQpghgkCZ8Ag0Q8pIhGJlysxC4mev7sLS0vl +v91kyMEAAGP/wmwQBBvXAyoxDNMPK7J/HNcB+GIQFeAUZQD7Q/YN4AUFAHyhF+okAArYBIAA7DQA +CmgEgABYtcjAINEPAGiRQWiSIWiUCcBA//9kDaAFBQB8odF7q87aMFi19tWg//8QDaAEBQD9QOYN +oBRlAHujAmAAAcBA2jBYtgL//pwNoAUFANowWLYT5aQABQERgAD9rcQFoApVAPxgKBXgOwUAWXOj +//38DaAEBQAAAAD//dANoATFAGwQBCkwE/EmcA3g9YUAaJEDwCDRD4QnDwIAhE4c1tP8YjAV4ogF +AAhICC2E3/5iUBWgClUA/xwGHaA7BQBZc478YjAVpHpFAOpKCAHYYQAAWW/CpTv8YlAVpVpFAKpK +WW+/6iQAClgEgABYtlbAINEPhCcPAgAPAgAkQg4c1rwtMBEtRAL+YlAVoApVAP6AZh2gOwUAWXN4 +/GIwFaHKhQDqSggB2GEAAFlvrKU7/GJQFaKqhQCqSllvqcAg0Q8AAGwQBIg3FtaqiI70wBAV4okF +APkAAEHwB3UA9npGHeAENQD0emYdoAcFACc01PZ6ph3g8vUA4lEPcsgFAAAnNNYlNNcpZADRD/zA +MBWgCxUAKzTX/HrGHaAKJQDqZAAmYAUAACxkAdEPbBAEjzj9rSIFoApVAPxiEBXgOwUA/+BoHaH/ +8QBZc0wpMBD1IASokgCdAGiSA8Ag0Q8S1oeDNiIifwkzEaMiiiqLLYqoj7ctohj94QgVoI7FAA7d +Ai2mGIj6jvvz5AAV78kFAOkzAQZowQAA4+4IBEDBAADo9goncQEAAH3jeP+gBDQiAJ0AnfgY1hjo +AAUOSASAAAkCYQkCYQkCYfOABhWgCQUA+YJEHeANJQDpxREs4ASAAFi1scAg0Q/aMFi2v/9WkA3g +DXUAi6eLviyyjgyeVn7QGfwAYh3o7LkAftAO+2BAJeAMBQBYtonAINEPWLXqwCDRDwAM6AwIOAwo +jHD54QYVr/4SACk8QPnhBhXv/eYAbBAEiC4jLDhzgQOJIsiUwCDRDwAAiy6Is+xEAAroBIAA67zg +KVAEgAALgACMLnPB3Y0iZN/eY//VAAAAbBAEKiIUKSIT/avQBec1AQDqmQwBlB0AAGSQkCwgBwwM +QQzKEa2qK6Ke92AFEVIAnQAqop3rpAAFBQGAABXV1xTV7R/WMAUAhwoCYQoCYS4hBxjV1/UmAAo6 +7gEA6tXXH3cCgAAI7gKesP5ACBWgGAUAmLOaspS1/8YAD/AEJQDvtgQvdgKAAATuAp6x5QIVBdBh +AAAKAIoMyBGtiCSGnS8iFKn/7yYUIZR1AACKJ/oAIh3gDAUA+0QAFaANFQBYUwLSoNEPwCDRDwAA +AAAAAP/9hA2gCgUAAIsiyLVoMhTAINEPK8wY6iQACWAEgABYWJ5pMuqMJ47Kisn9hAAV788FAO/d +AQdwQQAA7sYKJVPBAADqxgkm6QEAAH2rKYjLqoqayRzVqZygiyD5q+4F4AwVAOmmAi3eAoAADLsC ++0AmFeACBQDRDxzVoJygiyD5q9wF4AwVAOmmAi3eAoAADLsC+0AmFeACBQDRD2wQBBzV5y0yBv5h +ZBWgClUA/mPwFeA7BQBZcp4sMQskIhGILBrV4IVHrIiYLIlMwLD0ocgV4A0FAOqeAgSQRoAAnkz8 +g2YV4AAqAAAAACtCG+taCAHYgQAAWW7HLkIbLTELrt0tRhsqUAQrUAXpUAYtVgKAAAuqAuhQBy0u +AoAACVUC7NXJGq4CgAAIVQL0oGAV7/jFAPigBAKwOwUA/qBoHaAKVQBZcnspIhMoMQsrQhupiOgm +EyL4wQAAf7EJwCDRDwAAAAAAABzVuIpMDKoB6kYMKVAEgABYtmr6QGgdoAsFAPwAAh2gDSUAW/9p +wCDRDwBsEAiIIicgBykiFJkT8RL8DeF3AQAa1alkkQEW1UwqoIAMeBHmiAgFUN0AAPkTyBXkqh0A +qkrr1UsVUAkAAPsgCfOgDKUAKIKd6BYEJAnZgACNuPegCjiSAJ0ALmKu8c9wDeAJBQAqYq3koO5m ++/0AAO+2CCUHiYAAKyAUpLsLC0crJBT1YAleUgCdAIs5iRT4YgAVp8UBAPmACpFWux0A/IHgANAF +BQCwSm2pBQgAhgkCYYkTGtWCiZDoEgQiY/0AAOqZAgzuAoAADc0C/QAmFeAKBQBtuQfphgYkQQEA +AIgU6zIBLk8CgACpiJgV6TICLYwyAACaEPNgDThSAJ0AixDrSwgL5wKAAObMCAXb/QAA68adKpAE +gADRDwAFDEdowhiKJ/qAaB3gDAUA6qwgKmgEgABYUkzSoNEPwCDRD+okAAnYBIAA7EQACugEgABY +V5fSoNEPAADAoAzeNO62CC14vgAAjyJl/9TaIPxAaB2gG8UAWFfkY//EAAAAAAD/+xQNoAgFAIgi +ZY+yK3wY6iQACWAEgABYV9tj/6HAoFlyXhvU8I24+b/1eJAMpQBj/7ItIQn+QrAVr/8FAA+/AQ+4 +DCgkFO+kAy9xAoAA6aQALu4CgAD/pgAOsAwVAAzdAp2h/NWmFa/6kgAAAI4nnhGF6fnBSBWvyQUA +7OILJ2iBAAAJ2QGZEunJCApXAoAA6ogMAqhBAACV6ejmCiTJAQAA+KAIYuIAnQBoq0GlrCzM8P0g +BNuiAJ0A7xIEIgyFAACwTm3pBQUAhg8CYYzRDwIADwIArKzo0gImY8EAAPmABuRiAJ0A7NYBLigE +gABljj9gAKAAAOsSBSzgBIAA7BYGKVAEgABb4wOJFogVizHqFgAtbwKAAK2I8X/zCFIAnQDaIOyU +AAxYBIAAW+LSjhDurggKkASAAO5OCAv/AoAA5v8IB3P9AAAu9p3RDwAAAAWZDPwgiBWk+R0AbfkF +BSCGDAJjjBIPRQyPFCzMQOn/CAKMPQAAsFhtiQUMQIYPAmWFEozSCagMqFUlXDDl1gEubQYAAIkS +wKDq1gIkyQEAAPmgJhXgBQUA+aAGFe/2EgCOEQxVDPXBJhXv+74AhRIlXED1oCYV7/yeAAAAAGwQ +BB3UpRrU2w8CAC3SHSyixyqhcKPd6joMDu5CgAD9gABGcAsFACvEBCvEBVjxPfpAaB2gCwUAW/Bq +0Q8AAABsEBYrIAcjFhrlFhcqSASAAPghJhXgChUAmh8V1McmEhr8IugV4bsBACsWFodl+MCIFaP+ +9QD6uAQVp90BAPbB5BWgd/kA+AoAAbDIWQD8I2YVrEgdAPqPAA0wtnkA+iJmFe+qAQDqFhQkVEqA +AAYLSfohxhXgACYAAAAAnh4uEhotFhUv4T0o4B0oFAAvFhIu4h8uFhD1oDshEgCdAIki+yBCYJIA +nQDw5WAN4AwFAOwWESOASYAA2kBY2sX0AAId4AYFAC4SG9pw/ABiHeAMJQDu3DkJ2ASAAFjas/dA +AEMwD/UAdvBV9CEGFaSGHQDjFgckQAUAAPgjBhWgAT4AAAApEhJkl3cqEhqKpX2mn/wiCBWgCxUA +6xYRKlAEgADrEhIo6ASAAFja2manqfwAYh2gBQUACsU6ZFeTw2CUGPIg5hXk1h0ALRYYLxIWHtQh +E9Qa6RIYL6AEgAD14AhyEA2lAAz2EaNmKGKe+QBDA+IAnQAmYp3bYOa0AAW+QYAAj+ibFffgPniS +AJ0AKDKu0w/qEgkkPJGAACsyreS3iWfL/QAA6eYIJbxhgAApIBTTDw8CAKqZCQlHKSQU9SA9ZlIA +nQArEhsuEhTxYMAN4A01AP+gQAiiAJ0AZFDFjxcPAgDI8WRQY+tkAAlQBIAA/ABiHaAdhQBY2tDu +Eg4teASAAOYSCCKvWYAAKBIT+6faBeAMBQCc8pzznPSc9etrAg9UAoAA6/YALECCgAAKiALs1EIa +zsKAAPkGAAxwClUA+eAmFaAbxQBZcPEtEhX5oDqpUgCdAMAg7hIYKn8CgACj/y72ndEPAAAAAAAA +j+j34DtgkgCdAOkSGCo3AoAAo2YoYp75ADu74gCdACtinea0AAW7oYAAsPiY6PrAaB3v+2YAKhIR +ZKB66xIFKVAEgAD8AGIdoB2FAFjaoCsQABbUHh/UH44YJmL6GdQe/8YAD3H7HQDmtgsP+wKAAOn/ +AgX8pIAALBIQ7RISI1v/AAAosj8rsX2eoJ+hnaKco5uk+UCmFaAAdgAAACwSEC0SEithBYhjnqCf +oZuimKOdpJylJqwYLRITjB4C3RDtFgouZAKAAOwWCyum/gAAGtOh+CEIFaAPBQD+IMYV4A8lAJ8d +CogCKBYM62QACVAEgAD8AGIdoB2FAFjadI0cLxIaiRYrEhqP9fE1YA3j/vUAHNPyi7T/QEYVoI+Z +AP1ABhXgb4kA/UAmFaDfoQDw0AATMM+RAO7T6h7pQoAA7qYDLEECgAD9BgAMebsBAOumBC5gwoAA +DGYCCGYClqWMHemcASUwYQAA6RYGJmP9AADsFg0ue7YAAOtkAAlQBIAA/ABiHaAdhQBY2lEW09WJ +Go8b+iGIFeANBQCdEZ0SnROdFJ2k/UCmFe/+9QCeop6jm6AuEhrp/wIKxsKAAOj/AgDgMQAA5v8C +ANghAADtHBAlMGEAAO+mASDQEQAAWNkqwMHqyjkNKASAANmg6hYeIqHZgAAkFh/+ACIdoA0FAAnt +OOUWICbrUYAAE9O3iBuMGhrTtisSG4QYFdOv8XgAFLAOFQDr6zkKJ4KAAPSGAAp2DwUAC685/SYA +DLANNQD5JgAMMAwlAAvcOSwWHQn5AikWGfnmAA+wBQUA/iOGFeADIgAPVlD+GAAF8M/JAPwhiBXg +j7EA/UAGFeDveQDs7hEMRAKAAOvMEA3agoAA7LsCCzPCgAD4xgALMM+BAP2IABYxj2kA7O4CDEUC +gAAI7gIc04mcoSgQAAbuAvvGAA9wb7kA9MgAEzu/AQD3xgAPMAYlAObuAg3dAoAA7qYELEICgAAL +iAKYpRvTgZuiGNOB+UBmFa/5pgAAAAAAAAAAmaGUoJ6inqOepJ6lnaadp52onakvEh3lXAElMKEA +AP6gEZxiAJ0A62QACVAEgAD8AIIdoC2FAFjZ5eRQUWrOwoAA9KAKYJIAnQArEhzH7/smAAzwDQUA +45kCC/0uAACNEywSGo4SjxGLzCzCEJmhm6n1QAYVoAgFAJiimKafo56knaecpYwU/UEGFa/+JgAt +EhssEhkb01gMmQLrmQIGhBmAAPDiQA3v/vUAmaGUoJ6inqOepP9AphWgDQUAnaadp52o/UEmFe/9 +NgAvEhoiFiEr8hYm8Tgi8Tos8hXo8TkrNAKAAAYiAibxOy3yG+7yGixEAoAACGYCKPIXL/IZn6Ke +o52knKabp5iolqWZoZSgkqnyJCgVr/v2AAAAAAAAAADw4kAN7/v1AJmhlKCbopujm6T7QKYV4AgF +AJimmKeYqPlBJhWv+zoALBIajRIvwTsmwTkowTguwTrrwhgrNAKAAOb/AgxEAoAACO4CJsIUiMws +whCbpJinlqiZoZ2ilKCco5+lnqmMFP1AxhWv+hoAKxIb7BIZJYNRgAAb0xbH7/0mAAywDQUA65kC +A4DxgACZoZSgnqKeo56knqWdpp2nnaj9QSYV7/kyAC4SGiIWIS3iEiziEyviGIjthu4v4hSC7y7i +EZ6inaOcpJulmKaWp5+pmaGUoJKo8iQoFa/4VgArEhzH3/smAAzwDAUA45kCA4DxgACZoZSgnaKd +o52knaWcppynnKj9QSYVr/eaAJmhlKCOE/4gKBXgCAUAmKKYo5ikmKaYp5ion6X/QSYVr/cKACoS +GhnS6IqlE9J8JRIg5BIfJUwwgADj0ngThVmAABzS4osYDLsC+z9GFe/nwgCFH8DS960ACv/oRgDA +pf2luAWgG8UA7k4RCmgEgABZb39j+IcAAPoiiBWgDgUAnhGeEp4TnhRY2C3IqfoiiBWgCwUAWNgi +wKBZRRskFh/lFiAlYaGAAB/SvC/wFCQWH+UWIC/hHgAA+6WMBaFLFQBZY48s6v8MrAH7pYQFoUsV +AFlmoyQWH/QkBhXv7/IALRIQZdiBY/gmH9KYjhgP7gL/P0YVr+UmAMCgWUUDyKkY0qbTDyiAFGSA +XCoSFFjYDOkSHi1dbgAA+iKIFaALFQBY1//4I8gV7+5qAAAAAAD/38QNoDYFAOsSEipQBIAA7BIQ +KOgEgABY2Mlj+D8AACsSGowZ7RIXKVAEgABYVMjSoNEPAAAAAPulNgWhSxUAWWNjLBoADKwC+6Us +BaFLFQBZZndj/4MAwLAN+DTo5ggtw+YAANog/EBoHaAbxQBYUM1j/6orEhbaIOu8GClgBIAAWFDI +Y/+XwKBZb4we0h2P6Pn/wTiQDaUAY//HjB8tIQn+QrAVr/8FAA+fAQ+YDOgkFC9xAoAA/2BmHeAI +BQDotAAu7gKAAA7dAgzdAp2x/HWmFa/ghgCKJ40ZwMDqrCAu2ASAAFhPSNKg6xIYKmcCgACjzCvG +ndEPAAAAAAAA/96MDaAGBQD/4AgNoAVFAMCgWW9qHtH7j+j5/8RQkA2lAP/imA2gBgUAAAAAAAAA +/+IwDaALBQAN+DT5wQYVr+I2AAAAAAAAbBAGKCAFLSAHwZQPAgD5AA61Yd0BACkiAmWRky4wARbR +4f/BQAbQDKUALyBOZfJX7tHjHsgEgAD1oAnSEgCdAAzaEaaqKKKenRD3ABGU0gCdACqineekAAUN +AYAAi+iZEfdgDTCSAJ0ALWKuZNFYKmKt5KFUZfv9AADv5gglCrmAACsgFKS7CwtHKyQU9WAMvdAN +BQAY0cUf0eSOIP3lxhXgC0UA6O4CD1YCgAALqgIb0iwu9jTq9i0r6ASAAOsPHg3QBIAADQJnC0CG +DQJlCyCGDQJjCwCG7QwAA9kBAAAK4IYd0iALAm8KwIYLAm0KoIYLAmsKgIYLAmkqIQkvIAcuMAEo +MQErIST+IAAHMP8RAOr/EA90AoAAD+4CDrsCH9ISLiEiDbsCK3YgD+4CjSAqdiP45IYVoJqFAKp6 +GNILLnYi/aAAFrAOJQAO3QItdiGLMyt2JQgAiQoAigyaEaaq/VOmFaeFAQD5AAeZUgCdAMAg0Q+L +6J0R92AI0JIAnQAMmhGmqi+invfgCYTSAJ0AKqKdZKEnsL+f6OekAA117gAA/CAGFeABRgAAAAAA +6iQACdgEgADsRAAK6ASAAFhUEdKg0Q8AwKAMuDTo5ggtdY4AANog/EBoHaAbxQBYVGBj/8oAAADq +JAAK2ASAAFhVntKg0Q8AAIsQ2iDrvBgpYASAAFhUVmP/pMCgWW7ZHtFri+iJEfl/8nCQDKUAY/+y +AAAAAAAA+EKwFa/+BQAOvgEOvwwvJBQvIQntpAAsQQKAAO6kAy/+AoAA+eYAD7AOFQAO/wKfof7V +phWv+OIAiifrRAAKaASAAPtEABWgDAUAWE6T0qDRDwAAAAAAAP/3RA2gCgUAwLgLmwL6QEYV7/x+ +AAAAAPwgBhXgCgUAWW60HtFGi+iNEIkR+X/2kJAMpQD/+5ANoAoFAAAAwKAMvzT/wQYV7/tWAABs +EAgpIAUmIAfnNAAJwASAAPoCgh2gAzUA+yAOvSFmAQAFCUfl0S0UlFEAAIwi5GQABgORgADAINEP +AAAtIh1l0cmJJwxNEZ0TiJr/IWgV784FAOuSCCTggQAADs4BnhKr2q7/rYjolgon+QEAAPvgDVOi +AJ0AyXLJQAu5Am1JBQcAhgkCYY0TisCtqv9AEeRiAJ0AmsD5YGgdr/5KAAAAAAAAAOxqEQMkoQAA +BaoILqKe98AKcdIAnQAqop3Prtog7CQAA1hhAABYU/LAINEPF9EIiXiYFPcgD/CSAJ0ADEoRpaor +op73YBA50gCdACqineSh/mTb/QAAm3hkr78Z0QuZoI4g/aLOBeAPFQDvpgIvdgKAAAPuAp6hjoMt +0n8b0PL9or4FqO4dAK7d7aYDJUhBAAD8AAoVoAgFALGI6YMeDA/oAACbpvmirgWgGQUAmaeYqI8g +CP8RA/8Cn6nv0OUadwKAAKXuI+adiyIsIAb4QOgV4A0VAA27AusmAiZgBQAA7CQGJMiBAACIkYyS +/aKOBe/LBQDrmwEEQ0EAAOiWASZgwQAA7JYCJdkBAAB7iyCMk6jImJGfgI4g7YYCL3YCgAAD7gL/ +ACYVoAIFANEPAAAf0MifgI4gHdE07YYCL3YCgAAD7gL/ACYVoAIFANEPAOokAArYBIAAWFTo0qDR +DwD/+tQNoAoFAPqwyBXgGpUA+iAmFaACBgDr+gwDgbmAAApOFO3sCCvABIAA7U02DcgEgADTD23Z +BQgAhgkCYYkSqnjuTwwEyQEAAG35BQgghgkCY44TjRIK7gyu3S3cQP2ABhXv+L4AAChShC+ACCmA +B/ggBhXgqiUAevEuGNC3iIDAoAuAAIoQiREKmQzpFgEk7WmAACtSgn+3CSxSgn/PxmP9mQBZaBxj +/+8vgQsv/PgPD0Pv/Pwk8/0AAA/pOPggBhXv/uYAAIgSKIxA+YAGFa/3BgDAoFlt84l4iBT5P+/I +kgCdAP/4OA2gCgUAwKDAugubNPrhBhXv9/4AAAAAbBAIiCeJIvxA8BWvxgUA6oILKl8CgADrOwgE +QIEAAAaIAflAAEQwDzUA6IxALegEgAD5YCCSocwBAC7QB+3QZR6oBIAADMsR6uwDJzv5AADtuwgE +gEGAAMAg0Q8osp6aEe7QYhdIGQAA+QAfG+IAnQApsp0sFgDmlAAEnvmAACniCPcgHzCSAJ0ALNKu +ZMOVKtKt5KORZMP9AADo5gglHLGAACwgFCtQB6y7CwtHKyQU9WAendAOFQAZ0H4e0LyLEIogiDTs +0Ecd3wKAAO27CA1WAoAA8QAE+l/NBQAtIAcjUQH/RgAMcN0RAO0hJC7SgoAACaoCmGGaYBrQMvzA +RhWgGIUA+MBmFaAIJQDqAAUDUEEAAG2KAgoCYSwhCfpA8BWgCAUA+MCmFaA/pQDjZgkuZQKAAP+G +AA5xqgEA7GYGLVQCgAAK2gIOqgKaZCghCfpAaB2gDAUA/qAkFaAJNQDptp0sXQKAAP9mAA3wDQUA +WFQ5wCDRD48nsX4OrgKJ++kWAif4gQAADf0BnRWtme1cICTJAQAAedMEiBII3QyJ0Pj4AATwiBUA +eJkanmHp0IATw/0AAPjABhXhiB0A+MBGFaAATgAAnmEZ0HqZYIjRCFgUmGIY0HiJNh3QePkQCBWi +mR0ADZkBjfGpiJhjiPPvEgUicAkAAAzuEa7dr4/oFgMn+QEAAH/TAgjdDKdIsogMiBHuiAwL9wKA +AO3pCAQCIYAAKGwQmBT54A8S4gCdAA3/DPkAaB3krx0AbakFDQCGCQJhiRUKfQym+OqMECTJAQAA +bdkFCSCGCgJjiiDTDwiqERjQUq5p/6CuBaAPFQD/IMYV4A1FAA2qApiUGNBOmpWKUyiCfhbQTf+g +iAXoqh0Aqojolgck6IEAAP4AChXgCgUAsartgx4ND+gAAP0hRhWgKgUAmpuPNIhTijUG/wH3oIAF +p4gBAO6qAQxCQoAACP8CBv8Cn5woUAktUAsvUAomUAju0Dke6QKAAOb/EAxDAoAA+wYADDCmMQDt +/wINUcKAAAr/Agj/Aoo2GNAwn53+YUgV5dYdAO6qAQ7oQoAADaoC+yHGFaRmAQDo/wELMgKAAAb/ +AohVmJ+GViaWEI5XLpYRL5YSjVQtlhMqUAH/n7AF4BiFAO5RASgECoAA8UAED9IAnQAqIAcKKkDt +ISQtUoKAAA+qAiqWFI8gKJYX/eAAF7AINQAI/wIYz40slhbvlhUk0YEAAPgACB2gDyUAbfoCCgJh +LyEJLCAH++AAF7AYpQAI/wIvlhr/n/YF4cwBAADMEQzcAg/MAv4gKBXgCgUAKpYZLpYd7JYYJ/gN +AACfEY4RLradLVAHiif1oABGsAwFAOvUAAVQgQAAWEy70qDRDwAAAAAAAADphAAD8omAANMPbXkF +DUCGCQJlY/43wKDAigiYNOjmCC1jlgAA2iD8QGgdoBvFAFhSVMAg0Q8AAPtvAA6/77oAwJD8IAYV +r/CGACvMGOokAAlgBIAAWFJKwCDRD8CgWWzNHs9eiegdz1f5P+BokA81AGP/sAAAAAD4QrAVr/kF +AAm5AQm8DCwkFCwhCQSIEPlAZh3gCQUA6aQALmYCgAAIzAIOzAKcof+1phWv7/oAAGwQBikgBSYg +B9gw9gBiHeAaRQD7IA4NIWYBAAUJR/0iwAFfxQUAiiITzzvkZAAFA4mAAMAg0Q8AiCeOio2L64II +JGCBAAAFyQHpFgEqfwKAAKv6qd2v7u6GCibpAQAAnRD7oA3bogCdAO0SACGA2YAA6bQAAgCZgABt +SQUDAIYJAmEqwgAPqgj9QA8MYgCdAJrA+WBoHa/+QgAAAAAAAADsahEDJKEAAAOqCC6invfACbHS +AJ0AKqKdz67aIOwkAANYYQAAWFICwCDRDxvPGIm4mBL3IAjIkgCdAAxKEaOqLKKe94AJKdIAnQAq +op3koRxk4/0AAJy4ZK+/Gc8bmaCPIP+e7gWgCxUA66YCL/4CgAAH/wKfoY+DLuJ/HM8C/Z7eBej/ +HQCv7u6mAyVIQQAA/AAKFeAIBQCxiOmDHgwP6AAAnKYYz2f5QQYVoBkFAJmnjyAI/xEH/wKfqQxO +EaPuJ+adjSIsIAaJJwvdAu0mAiZgBQAA7CQGJMiBAACIkY2SH87r5ZwBBENBAADolgEm6MEAAO2W +AiZhAQAAfIsajZOo2JiRn4COIMAg4oYCL3YCgAAH7gKegdEPH87dn4COIMAg4oYCL3YCgAAH7gKe +gdEPAAAAAADqJAAK2ASAAFhS/tKg0Q8A//s0DaAKBQDAoFlsPBvOzYm4iBL5P/bYkgCdAP/7wA2g +CgUAwKDAygycNP1hBhWv+4YAAAAAAADr2gwBgbmAAApOFO3sCCnABIAA7U02DcgEgADTD23ZBQgA +hgkCYYkRqjjuTQwEyQEAAG3ZBQgghgkCY40RCv4Mrt0t3ED9gAYV7/imAI8RL/xA/4AGFe/4cgAA +AGwQBBXOpxbOxfCIABOwCUUA5M8QGcYCgAAJiAIoZi0FNQLnZi4qGASAAOVmNCkwBIAAA2CGBgJn +A0CGBgJlAyCGBgJjAwCG5gwAARkBAAD1yGgdoIoFAKoiAwJvBMCGAwJtBKCGAwJrBICGAwJp0Q8A +AAAAbBAGIyAHFM6HAwNBDDkRpJkokp79CCBB0AU1ACuSncu2H88AGM8A+kAIFaAJBQD4IAYV4AwF +APggRhXgDVUA+CAmFaAe5QBYTyYMOhGkqvVTphXgAgUA0Q/aIOs8GClgBIAAWFFfxyTRDwAAbBAG +KCBwwGTlzmwUdbSAACQgBwQEQQxJEaWZKpKe4yIALSFsAAAqkp1koFDbMFjqVcDB/AACHeAOFQD5 +nR4FoAkFAPggJhXgDwUA6RYCLVgEgADoFgAp0ASAAFhPBgxMEaXMJsadKiBwKwr7C6oB+k4GHaAC +BQDRD8Ag0Q/aIOtMGClgBIAAWFE7xyTRDwAAbBAEJCAHE87JFc5HBARB4zJ/Kk8CgAAFmQgokp4P +AgDkMwgMETgAACqSnWSgQwM7AvwAAh2gDSUA/gBCHaAfBQBZbV/9nXYFoA4VAOymACnuAoAADt0C +naGLIJuiDEkR9SAARPAIJQD5M6YVoAIFANEP2iDrTBgpYASAAFhRGcck0Q8AbBAWLjAQ95xOBeAf +RQDzwfAN4AYFAPXAQPCSAJ0AaOIDwCDRDyogBwUJR9MP+COGFeGqAQDqFh4slGgAACsgBfdgWDxS +AJ0ALCBy84BX55IAnQDaIFhRMmWnxI0iZde/LhIeiDUqIhD4IUYVoBmFAO4WECR4XQAA+x4ADLT/ +HQDvFgsn+A0AAJ8dnxz1wFDiEgCdACwSEAzMEafMK8Ket039YFrb4gCdACvCnftgWKASAJ0AjCmN +KgwOPi4WGgzdDH7beSogIikgIwqZDPsgWoASAJ0AKCAHGs52/VgAFeGIAQANiAkojQIugQYJ7zYP +7gwuhQYtICKv3Q0NRy0kIvugWbgSAJ0AKKJ/7iILJsv9AAD7AAQA0AgVAOCZGgxACoAA6e4IBEP9 +AAAI7gKeKigSGgzpDPkgWFuiAJ0AiR0ezl0sIAcoIQcdzjP+QSQV4MwRAPWQABY6iAEA7cwCDEMC +gAAI/wItISScsIogiBoczdLu3QINVgKAAAqZApmxKiEinbSfswyqApqyHM5LKSIQmbUZzkr8RxAV +4A8lAJ+5lrf5YQYVoA4VAP9hRhWgCnUA/AMABvBOdQAN6jkNyTkKmQKKG+a2CyHAQQAA6bYGJcjB +AABtqQUIAIYJAmEezbWevI0w86BEQpIAnQAqEhDpEgwtVwKAAKeqKaadKCAULxIapIjoJBQngMGA +AC0SGowpKyA4rcycKfNgTq+SAJ0ALhIc+cBNeVIAnQDAINEPKyAHKCAFKjAR/EBIFaG7AQArFh75 +AC48UKo5APuARjiQHqUADLwRp8wtwp4rFhAqFhn/oEdLogCdACnCnSkWEekWHSgECoAA+yBG2BIA +nQD6QGgdoAtFAFlrCxvNjPtARsBSAJ0Ai7j3YEbwkgCdACxyrveARE1SAJ0AKnKtHs2D7wIABev9 +AAD7QEdYEgCdAO3mCCgECoAA+0BDaBIAnQAtMBQtJDgrMBUmJDsrJDmJO4s8iDqPOY42jDgsJQkv +JSMuJSIoJSQpJSUrJEyJPSkkTSgyES4yECYkTiYkTyYmGyYmHSYkcCYkcvZOJh2gDxUALyUpLyYX +LyYYLyYZLyRzLiUoKCYVLiEaLDARx7z7wAQF88wBAPxHRh2gCCUA+aAEBjAPRQDo0Bx127EAAP8A +AAQwCRUA+S0ADDmeHQCpiA6IEQi7DBjN0f+gBAbwDhUADOw5C4ksDe05C4guCOg5Hs2m6YgIC0gE +gAAN6TkdzVrfYAzfOQn/Ai0gFAi5HOklNCXz8QAACOgcKRIZpN3oJTUvdAKAAA7+Ai4mEO0kFC3E +AoAA+eYAD7AsBQDvJg8kr+GAABvNtxnNZi4gB4wpnCyIPvgiRhWg/hEA6BIRL/qCgAAJ/wIpIQj/ +AAYV4e4BAO8iAC90AoAADpkC+yYADPAONQDr+wIP/gKAAA7/Ap+B/5o+BaAvBQCfg+6GAiR4wQAA +LxYdjiuWhZ6JnIj7AMYV4A8VAPkAhhXgCwUA+iJmFeAZZQD4I2YV4BxFAOwWCS7yAoAAD+4Cnof2 +QoYdoCwFAC0gBw0NQevNjhboUQAA6hYILoEKgADtMg8vyAqAAAuZAhvNIC0WFCkWFSm2QCkSHRvN *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Feb 26 00:27:28 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 91BEEC90; Tue, 26 Feb 2013 00:27:28 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 75238124; Tue, 26 Feb 2013 00:27:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1Q0RS0M083181; Tue, 26 Feb 2013 00:27:28 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1Q0RRjj083176; Tue, 26 Feb 2013 00:27:27 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201302260027.r1Q0RRjj083176@svn.freebsd.org> From: Navdeep Parhar Date: Tue, 26 Feb 2013 00:27:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247291 - in head/sys/dev/cxgbe: . common firmware X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 00:27:28 -0000 Author: np Date: Tue Feb 26 00:27:27 2013 New Revision: 247291 URL: http://svnweb.freebsd.org/changeset/base/247291 Log: cxgbe(4): Ask the card's firmware to pad up tiny CPLs by encapsulating them in a firmware message if it is able to do so. This works out better for one of the FIFOs in the chip. MFC after: 5 days Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/t4_msg.h head/sys/dev/cxgbe/firmware/t4fw_interface.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Tue Feb 26 00:18:50 2013 (r247290) +++ head/sys/dev/cxgbe/adapter.h Tue Feb 26 00:27:27 2013 (r247291) @@ -600,7 +600,7 @@ struct adapter { struct callout sfl_callout; an_handler_t an_handler __aligned(CACHE_LINE_SIZE); - fw_msg_handler_t fw_msg_handler[4]; /* NUM_FW6_TYPES */ + fw_msg_handler_t fw_msg_handler[5]; /* NUM_FW6_TYPES */ cpl_handler_t cpl_handler[0xef]; /* NUM_CPL_CMDS */ #ifdef INVARIANTS Modified: head/sys/dev/cxgbe/common/t4_msg.h ============================================================================== --- head/sys/dev/cxgbe/common/t4_msg.h Tue Feb 26 00:18:50 2013 (r247290) +++ head/sys/dev/cxgbe/common/t4_msg.h Tue Feb 26 00:27:27 2013 (r247291) @@ -2224,6 +2224,15 @@ struct cpl_sge_egr_update { #define V_EGR_QID(x) ((x) << S_EGR_QID) #define G_EGR_QID(x) (((x) >> S_EGR_QID) & M_EGR_QID) +/* cpl_fw*.type values */ +enum { + FW_TYPE_CMD_RPL = 0, + FW_TYPE_WR_RPL = 1, + FW_TYPE_CQE = 2, + FW_TYPE_OFLD_CONNECTION_WR_RPL = 3, + FW_TYPE_RSSCPL = 4, +}; + struct cpl_fw2_pld { RSS_HDR u8 opcode; @@ -2292,10 +2301,11 @@ struct cpl_fw6_msg { /* cpl_fw6_msg.type values */ enum { - FW6_TYPE_CMD_RPL = 0, - FW6_TYPE_WR_RPL = 1, - FW6_TYPE_CQE = 2, - FW6_TYPE_OFLD_CONNECTION_WR_RPL = 3, + FW6_TYPE_CMD_RPL = FW_TYPE_CMD_RPL, + FW6_TYPE_WR_RPL = FW_TYPE_WR_RPL, + FW6_TYPE_CQE = FW_TYPE_CQE, + FW6_TYPE_OFLD_CONNECTION_WR_RPL = FW_TYPE_OFLD_CONNECTION_WR_RPL, + FW6_TYPE_RSSCPL = FW_TYPE_RSSCPL, NUM_FW6_TYPES }; Modified: head/sys/dev/cxgbe/firmware/t4fw_interface.h ============================================================================== --- head/sys/dev/cxgbe/firmware/t4fw_interface.h Tue Feb 26 00:18:50 2013 (r247290) +++ head/sys/dev/cxgbe/firmware/t4fw_interface.h Tue Feb 26 00:27:27 2013 (r247291) @@ -3534,7 +3534,7 @@ enum fw_params_param_pfvf { FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_END = 0x2E, FW_PARAMS_PARAM_PFVF_ETHOFLD_START = 0x2F, FW_PARAMS_PARAM_PFVF_ETHOFLD_END = 0x30, - FW_PARAMS_PARAM_PFVF_CPLFW4MSG_CPLSGEEGRUPDATE = 0x31 + FW_PARAMS_PARAM_PFVF_CPLFW4MSG_ENCAP = 0x31 }; /* Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Feb 26 00:18:50 2013 (r247290) +++ head/sys/dev/cxgbe/t4_main.c Tue Feb 26 00:27:27 2013 (r247291) @@ -281,6 +281,7 @@ static int upload_config_file(struct ada static int partition_resources(struct adapter *, const struct firmware *); static int get_params__pre_init(struct adapter *); static int get_params__post_init(struct adapter *); +static int set_params__post_init(struct adapter *); static void t4_set_desc(struct adapter *); static void build_medialist(struct port_info *); static int update_mac_settings(struct port_info *, int); @@ -519,6 +520,10 @@ t4_attach(device_t dev) if (rc != 0) goto done; /* error message displayed already */ + rc = set_params__post_init(sc); + if (rc != 0) + goto done; /* error message displayed already */ + if (sc->flags & MASTER_PF) { uint16_t indsz = min(RX_COPY_THRESHOLD - 1, M_INDICATESIZE); @@ -1991,6 +1996,33 @@ get_params__post_init(struct adapter *sc return (rc); } +static int +set_params__post_init(struct adapter *sc) +{ + uint32_t param, val; + int rc; + + param = FW_PARAM_PFVF(CPLFW4MSG_ENCAP); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, ¶m, &val); + if (rc == 0) { + /* ask for encapsulated CPLs */ + param = FW_PARAM_PFVF(CPLFW4MSG_ENCAP); + val = 1; + rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, ¶m, &val); + if (rc != 0) { + device_printf(sc->dev, + "failed to set parameter (post_init): %d.\n", rc); + return (rc); + } + } else if (rc != FW_EINVAL) { + device_printf(sc->dev, + "failed to check for encapsulated CPLs: %d.\n", rc); + } else + rc = 0; /* the firmware doesn't support the param, no worries */ + + return (rc); +} + #undef FW_PARAM_PFVF #undef FW_PARAM_DEV @@ -3077,6 +3109,14 @@ t4_register_fw_msg_handler(struct adapte if (type >= nitems(sc->fw_msg_handler)) return (EINVAL); + /* + * These are dispatched by the handler for FW{4|6}_CPL_MSG using the CPL + * handler dispatch table. Reject any attempt to install a handler for + * this subtype. + */ + if (type == FW_TYPE_RSSCPL || type == FW6_TYPE_RSSCPL) + return (EINVAL); + new = h ? (uintptr_t)h : (uintptr_t)fw_msg_not_handled; loc = (uintptr_t *) &sc->fw_msg_handler[type]; atomic_store_rel_ptr(loc, new); Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Tue Feb 26 00:18:50 2013 (r247290) +++ head/sys/dev/cxgbe/t4_sge.c Tue Feb 26 00:27:27 2013 (r247291) @@ -3509,6 +3509,10 @@ handle_sge_egr_update(struct sge_iq *iq, return (0); } +/* handle_fw_msg works for both fw4_msg and fw6_msg because this is valid */ +CTASSERT(offsetof(struct cpl_fw4_msg, data) == \ + offsetof(struct cpl_fw6_msg, data)); + static int handle_fw_msg(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) { @@ -3518,6 +3522,13 @@ handle_fw_msg(struct sge_iq *iq, const s KASSERT(m == NULL, ("%s: payload with opcode %02x", __func__, rss->opcode)); + if (cpl->type == FW_TYPE_RSSCPL || cpl->type == FW6_TYPE_RSSCPL) { + const struct rss_header *rss2; + + rss2 = (const struct rss_header *)&cpl->data[0]; + return (sc->cpl_handler[rss2->opcode](iq, rss2, m)); + } + return (sc->fw_msg_handler[cpl->type](sc, &cpl->data[0])); } From owner-svn-src-head@FreeBSD.ORG Tue Feb 26 00:58:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 839396AD; Tue, 26 Feb 2013 00:58:47 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 65BDC227; Tue, 26 Feb 2013 00:58:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1Q0wkRj092462; Tue, 26 Feb 2013 00:58:47 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1Q0wiJX092450; Tue, 26 Feb 2013 00:58:44 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201302260058.r1Q0wiJX092450@svn.freebsd.org> From: Xin LI Date: Tue, 26 Feb 2013 00:58:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247296 - in head: contrib/expat contrib/expat/doc contrib/expat/examples contrib/expat/lib contrib/expat/tests contrib/expat/tests/benchmark contrib/expat/xmlwf lib/libexpat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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 Feb 2013 00:58:47 -0000 Author: delphij Date: Tue Feb 26 00:58:44 2013 New Revision: 247296 URL: http://svnweb.freebsd.org/changeset/base/247296 Log: Update base system libexpat to 2.1.0. MFC after: 3 days Added: head/contrib/expat/FREEBSD-Xlist - copied unchanged from r247293, vendor/expat/dist/FREEBSD-Xlist Deleted: head/contrib/expat/FREEBSD-upgrade head/contrib/expat/configure head/contrib/expat/doc/valid-xhtml10.png head/contrib/expat/lib/winconfig.h head/contrib/expat/tests/benchmark/benchmark.dsp head/contrib/expat/tests/benchmark/benchmark.dsw Modified: head/contrib/expat/Changes (contents, props changed) head/contrib/expat/MANIFEST (contents, props changed) head/contrib/expat/Makefile.in (contents, props changed) head/contrib/expat/README (contents, props changed) head/contrib/expat/configure.in (contents, props changed) head/contrib/expat/doc/reference.html (contents, props changed) head/contrib/expat/doc/xmlwf.sgml (contents, props changed) head/contrib/expat/expat_config.h.in (contents, props changed) head/contrib/expat/lib/expat.h (contents, props changed) head/contrib/expat/lib/xmlparse.c (contents, props changed) head/contrib/expat/lib/xmlrole.c (contents, props changed) head/contrib/expat/lib/xmltok.c (contents, props changed) head/contrib/expat/lib/xmltok_impl.c (contents, props changed) head/contrib/expat/tests/README.txt (contents, props changed) head/contrib/expat/tests/minicheck.h head/contrib/expat/tests/runtests.c (contents, props changed) head/contrib/expat/tests/xmltest.sh (contents, props changed) head/contrib/expat/xmlwf/readfilemap.c (contents, props changed) head/contrib/expat/xmlwf/xmlwf.c (contents, props changed) head/lib/libexpat/expat_config.h head/lib/libexpat/libbsdxml.3 Directory Properties: head/contrib/expat/ (props changed) head/contrib/expat/COPYING (props changed) head/contrib/expat/doc/style.css (props changed) head/contrib/expat/doc/xmlwf.1 (props changed) head/contrib/expat/examples/elements.c (props changed) head/contrib/expat/examples/outline.c (props changed) head/contrib/expat/lib/ascii.h (props changed) head/contrib/expat/lib/asciitab.h (props changed) head/contrib/expat/lib/iasciitab.h (props changed) head/contrib/expat/lib/internal.h (props changed) head/contrib/expat/lib/latin1tab.h (props changed) head/contrib/expat/lib/nametab.h (props changed) head/contrib/expat/lib/utf8tab.h (props changed) head/contrib/expat/lib/xmlrole.h (props changed) head/contrib/expat/lib/xmltok.h (props changed) head/contrib/expat/lib/xmltok_impl.h (props changed) head/contrib/expat/lib/xmltok_ns.c (props changed) head/contrib/expat/tests/chardata.c (props changed) head/contrib/expat/tests/chardata.h (props changed) head/contrib/expat/xmlwf/codepage.c (props changed) head/contrib/expat/xmlwf/codepage.h (props changed) head/contrib/expat/xmlwf/ct.c (props changed) head/contrib/expat/xmlwf/filemap.h (props changed) head/contrib/expat/xmlwf/unixfilemap.c (props changed) head/contrib/expat/xmlwf/win32filemap.c (props changed) head/contrib/expat/xmlwf/xmlfile.c (props changed) head/contrib/expat/xmlwf/xmlfile.h (props changed) head/contrib/expat/xmlwf/xmlmime.c (props changed) head/contrib/expat/xmlwf/xmlmime.h (props changed) head/contrib/expat/xmlwf/xmltchar.h (props changed) head/contrib/expat/xmlwf/xmlurl.h (props changed) head/contrib/expat/xmlwf/xmlwin32url.cxx (props changed) Modified: head/contrib/expat/Changes ============================================================================== --- head/contrib/expat/Changes Tue Feb 26 00:58:03 2013 (r247295) +++ head/contrib/expat/Changes Tue Feb 26 00:58:44 2013 (r247296) @@ -1,5 +1,41 @@ +Release 2.1.0 Sat March 24 2012 + - Bug Fixes: + #1742315: Harmful XML_ParserCreateNS suggestion. + #2895533: CVE-2012-1147 - Resource leak in readfilemap.c. + #1785430: Expat build fails on linux-amd64 with gcc version>=4.1 -O3. + #1983953, 2517952, 2517962, 2649838: + Build modifications using autoreconf instead of buildconf.sh. + #2815947, #2884086: OBJEXT and EXEEXT support while building. + #1990430: CVE-2009-3720 - Parser crash with special UTF-8 sequences. + #2517938: xmlwf should return non-zero exit status if not well-formed. + #2517946: Wrong statement about XMLDecl in xmlwf.1 and xmlwf.sgml. + #2855609: Dangling positionPtr after error. + #2894085: CVE-2009-3560 - Buffer over-read and crash in big2_toUtf8(). + #2958794: CVE-2012-1148 - Memory leak in poolGrow. + #2990652: CMake support. + #3010819: UNEXPECTED_STATE with a trailing "%" in entity value. + #3206497: Unitialized memory returned from XML_Parse. + #3287849: make check fails on mingw-w64. + #3496608: CVE-2012-0876 - Hash DOS attack. + - Patches: + #1749198: pkg-config support. + #3010222: Fix for bug #3010819. + #3312568: CMake support. + #3446384: Report byte offsets for attr names and values. + - New Features / API changes: + Added new API member XML_SetHashSalt() that allows setting an intial + value (salt) for hash calculations. This is part of the fix for + bug #3496608 to randomize hash parameters. + When compiled with XML_ATTR_INFO defined, adds new API member + XML_GetAttributeInfo() that allows retrieving the byte + offsets for attribute names and values (patch #3446384). + Added CMake build system. + See bug #2990652 and patch #3312568. + Added run-benchmark target to Makefile.in - relies on testdata module + present in the same relative location as in the repository. + Release 2.0.1 Tue June 5 2007 - - Fixed bugs #1515266, 1515600: The character data handler's calling + - Fixed bugs #1515266, #1515600: The character data handler's calling of XML_StopParser() was not handled properly; if the parser was stopped and the handler set to NULL, the parser would segfault. - Fixed bug #1690883: Expat failed on EBCDIC systems as it assumed @@ -8,7 +44,7 @@ Release 2.0.1 Tue June 5 2007 - Fixed xmlwf bug #1513566: "out of memory" error on file size zero. - Fixed outline.c bug #1543233: missing a final XML_ParserFree() call. - Fixes and improvements for Windows platform: - bugs #1409451, #1476160, 1548182, 1602769, 1717322. + bugs #1409451, #1476160, #1548182, #1602769, #1717322. - Build fixes for various platforms: HP-UX, Tru64, Solaris 9: patch #1437840, bug #1196180. All Unix: #1554618 (refreshed config.sub/config.guess). @@ -30,8 +66,8 @@ Release 2.0.0 Wed Jan 11 2006 byte indexes and line/column numbers. - Updated to use libtool 1.5.22 (the most recent). - Added support for AmigaOS. - - Some mostly minor bug fixes. SF issues include: 1006708, - 1021776, 1023646, 1114960, 1156398, 1221160, 1271642. + - Some mostly minor bug fixes. SF issues include: #1006708, + #1021776, #1023646, #1114960, #1156398, #1221160, #1271642. Release 1.95.8 Fri Jul 23 2004 - Major new feature: suspend/resume. Handlers can now request @@ -40,8 +76,8 @@ Release 1.95.8 Fri Jul 23 2004 documentation for more details. - Some mostly minor bug fixes, but compilation should no longer generate warnings on most platforms. SF issues - include: 827319, 840173, 846309, 888329, 896188, 923913, - 928113, 961698, 985192. + include: #827319, #840173, #846309, #888329, #896188, #923913, + #928113, #961698, #985192. Release 1.95.7 Mon Oct 20 2003 - Fixed enum XML_Status issue (reported on SourceForge many @@ -54,19 +90,19 @@ Release 1.95.7 Mon Oct 20 2003 - Improved ability to build without the configure-generated expat_config.h header. This is useful for applications which embed Expat rather than linking in the library. - - Fixed a variety of bugs: see SF issues 458907, 609603, - 676844, 679754, 692878, 692964, 695401, 699323, 699487, - 820946. + - Fixed a variety of bugs: see SF issues #458907, #609603, + #676844, #679754, #692878, #692964, #695401, #699323, #699487, + #820946. - Improved hash table lookups. - Added more regression tests and improved documentation. Release 1.95.6 Tue Jan 28 2003 - Added XML_FreeContentModel(). - Added XML_MemMalloc(), XML_MemRealloc(), XML_MemFree(). - - Fixed a variety of bugs: see SF issues 615606, 616863, - 618199, 653180, 673791. + - Fixed a variety of bugs: see SF issues #615606, #616863, + #618199, #653180, #673791. - Enhanced the regression test suite. - - Man page improvements: includes SF issue 632146. + - Man page improvements: includes SF issue #632146. Release 1.95.5 Fri Sep 6 2002 - Added XML_UseForeignDTD() for improved SAX2 support. @@ -84,9 +120,9 @@ Release 1.95.5 Fri Sep 6 2002 - Reduced line-length for all source code and headers to be no longer than 80 characters, to help with AS/400 support. - Reduced memory copying during parsing (SF patch #600964). - - Fixed a variety of bugs: see SF issues 580793, 434664, - 483514, 580503, 581069, 584041, 584183, 584832, 585537, - 596555, 596678, 598352, 598944, 599715, 600479, 600971. + - Fixed a variety of bugs: see SF issues #580793, #434664, + #483514, #580503, #581069, #584041, #584183, #584832, #585537, + #596555, #596678, #598352, #598944, #599715, #600479, #600971. Release 1.95.4 Fri Jul 12 2002 - Added support for VMS, contributed by Craig Berry. See @@ -95,14 +131,14 @@ Release 1.95.4 Fri Jul 12 2002 contributed by Thomas Wegner and Daryle Walker. - Added Borland C++ Builder 5 / BCC 5.5 support, contributed by Patrick McConnell (SF patch #538032). - - Fixed a variety of bugs: see SF issues 441449, 563184, - 564342, 566334, 566901, 569461, 570263, 575168, 579196. + - Fixed a variety of bugs: see SF issues #441449, #563184, + #564342, #566334, #566901, #569461, #570263, #575168, #579196. - Made skippedEntityHandler conform to SAX2 (see source comment) - Re-implemented WFC: Entity Declared from XML 1.0 spec and added a new error "entity declared in parameter entity": - see SF bug report 569461 and SF patch 578161 + see SF bug report #569461 and SF patch #578161 - Re-implemented section 5.1 from XML 1.0 spec: - see SF bug report 570263 and SF patch 578161 + see SF bug report #570263 and SF patch #578161 Release 1.95.3 Mon Jun 3 2002 - Added a project to the MSVC workspace to create a wchar_t @@ -114,9 +150,9 @@ Release 1.95.3 Mon Jun 3 2002 - Made the XML_UNICODE builds usable (thanks, Karl!). - Allow xmlwf to read from standard input. - Install a man page for xmlwf on Unix systems. - - Fixed many bugs; see SF bug reports 231864, 461380, 464837, - 466885, 469226, 477667, 484419, 487840, 494749, 496505, - 547350. Other bugs which we can't test as easily may also + - Fixed many bugs; see SF bug reports #231864, #461380, #464837, + #466885, #469226, #477667, #484419, #487840, #494749, #496505, + #547350. Other bugs which we can't test as easily may also have been fixed, especially in the area of build support. Release 1.95.2 Fri Jul 27 2001 Copied: head/contrib/expat/FREEBSD-Xlist (from r247293, vendor/expat/dist/FREEBSD-Xlist) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/expat/FREEBSD-Xlist Tue Feb 26 00:58:44 2013 (r247296, copy of r247293, vendor/expat/dist/FREEBSD-Xlist) @@ -0,0 +1,19 @@ +# $FreeBSD$ +*.MPW +*.cmake +*.def +*.dsp +*.dsw +*.m4 +*.pc.in +*config.h +CMake* +Configure* +amiga +bcb5 +configure +conftools +doc/valid-xhtml10.png +m4 +vms +win32 Modified: head/contrib/expat/MANIFEST ============================================================================== --- head/contrib/expat/MANIFEST Tue Feb 26 00:58:03 2013 (r247295) +++ head/contrib/expat/MANIFEST Tue Feb 26 00:58:44 2013 (r247296) @@ -1,5 +1,8 @@ -amiga/stdlib.c amiga/launch.c +amiga/expat_68k.c +amiga/expat_68k.h +amiga/expat_68k_handler_stubs.c +amiga/expat_base.h amiga/expat_vectors.c amiga/expat_lib.c amiga/expat.xml @@ -42,25 +45,35 @@ doc/style.css doc/valid-xhtml10.png doc/xmlwf.1 doc/xmlwf.sgml +CMakeLists.txt +CMake.README COPYING Changes +ConfigureChecks.cmake MANIFEST Makefile.in README configure configure.in expat_config.h.in +expat_config.h.cmake +expat.pc.in expat.dsw +aclocal.m4 conftools/PrintPath conftools/ac_c_bigendian_cross.m4 -conftools/config.guess -conftools/config.sub conftools/expat.m4 conftools/get-version.sh +conftools/mkinstalldirs +conftools/config.guess +conftools/config.sub conftools/install-sh -conftools/libtool.m4 conftools/ltmain.sh -conftools/mkinstalldirs +m4/libtool.m4 +m4/ltversion.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/lt~obsolete.m4 examples/elements.c examples/elements.dsp examples/outline.c Modified: head/contrib/expat/Makefile.in ============================================================================== --- head/contrib/expat/Makefile.in Tue Feb 26 00:58:03 2013 (r247295) +++ head/contrib/expat/Makefile.in Tue Feb 26 00:58:44 2013 (r247296) @@ -31,6 +31,7 @@ bindir = @bindir@ libdir = @libdir@ includedir = @includedir@ man1dir = @mandir@/man1 +pkgconfigdir = $(libdir)/pkgconfig top_builddir = . @@ -46,18 +47,18 @@ LIBRARY = libexpat.la DESTDIR = $(INSTALL_ROOT) -default: buildlib xmlwf/xmlwf +default: buildlib xmlwf/xmlwf@EXEEXT@ -buildlib: $(LIBRARY) +buildlib: $(LIBRARY) expat.pc -all: $(LIBRARY) xmlwf/xmlwf examples/elements examples/outline +all: $(LIBRARY) expat.pc xmlwf/xmlwf@EXEEXT@ examples/elements examples/outline clean: - cd lib && rm -f $(LIBRARY) *.o *.lo && rm -rf .libs _libs - cd xmlwf && rm -f xmlwf *.o *.lo && rm -rf .libs _libs - cd examples && rm -f elements outline *.o *.lo && rm -rf .libs _libs - cd tests && rm -rf .libs runtests runtests.o runtestspp runtestspp.o - cd tests && rm -f chardata.o minicheck.o + cd lib && rm -f $(LIBRARY) *.@OBJEXT@ *.lo && rm -rf .libs _libs + cd xmlwf && rm -f xmlwf *.@OBJEXT@ *.lo && rm -rf .libs _libs + cd examples && rm -f elements outline *.@OBJEXT@ *.lo && rm -rf .libs _libs + cd tests && rm -rf .libs runtests runtests.@OBJEXT@ runtestspp runtestspp.@OBJEXT@ + cd tests && rm -f chardata.@OBJEXT@ minicheck.@OBJEXT@ rm -rf .libs libexpat.la rm -f examples/core tests/core xmlwf/core @@ -65,34 +66,37 @@ clobber: clean distclean: clean rm -f expat_config.h config.status config.log config.cache libtool - rm -f Makefile + rm -f Makefile expat.pc extraclean: distclean rm -f expat_config.h.in configure - rm -f conftools/ltconfig conftools/ltmain.sh conftools/libtool.m4 + rm -f aclocal.m4 m4/* + rm -f conftools/ltmain.sh conftools/install-sh conftools/config.guess conftools/config.sub check: tests/runtests tests/runtestspp tests/runtests tests/runtestspp -install: xmlwf/xmlwf installlib +install: xmlwf/xmlwf@EXEEXT@ installlib $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf $(DESTDIR)$(bindir)/xmlwf + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf@EXEEXT@ $(DESTDIR)$(bindir)/xmlwf $(INSTALL_DATA) $(MANFILE) $(DESTDIR)$(man1dir) -installlib: $(LIBRARY) $(APIHEADER) - $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) +installlib: $(LIBRARY) $(APIHEADER) expat.pc + $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) $(DESTDIR)$(pkgconfigdir) $(LIBTOOL) --mode=install $(INSTALL) $(LIBRARY) $(DESTDIR)$(libdir)/$(LIBRARY) for FN in $(APIHEADER) ; do $(INSTALL_DATA) $$FN $(DESTDIR)$(includedir) ; done + $(INSTALL_DATA) expat.pc $(DESTDIR)$(pkgconfigdir)/expat.pc uninstall: uninstalllib - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bindir)/xmlwf + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bindir)/xmlwf@EXEEXT@ rm -f $(DESTDIR)$(man1dir)/xmlwf.1 uninstalllib: $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(LIBRARY) rm -f $(DESTDIR)$(includedir)/expat.h rm -f $(DESTDIR)$(includedir)/expat_external.h + rm -f $(DESTDIR)$(pkgconfigdir)/expat.pc # for VPATH builds (invoked by configure) mkdir-init: @@ -125,6 +129,9 @@ LIB_OBJS = lib/xmlparse.lo lib/xmltok.lo $(LIBRARY): $(LIB_OBJS) $(LINK_LIB) $(LIB_OBJS) +expat.pc: $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $@ + lib/xmlparse.lo: lib/xmlparse.c lib/expat.h lib/xmlrole.h lib/xmltok.h \ $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h @@ -137,46 +144,53 @@ lib/xmltok.lo: lib/xmltok.c lib/xmltok_i $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h -XMLWF_OBJS = xmlwf/xmlwf.o xmlwf/xmlfile.o xmlwf/codepage.o xmlwf/@FILEMAP@.o -xmlwf/xmlwf.o: xmlwf/xmlwf.c -xmlwf/xmlfile.o: xmlwf/xmlfile.c -xmlwf/codepage.o: xmlwf/codepage.c -xmlwf/@FILEMAP@.o: xmlwf/@FILEMAP@.c -xmlwf/xmlwf: $(XMLWF_OBJS) $(LIBRARY) +XMLWF_OBJS = xmlwf/xmlwf.@OBJEXT@ xmlwf/xmlfile.@OBJEXT@ xmlwf/codepage.@OBJEXT@ xmlwf/@FILEMAP@.@OBJEXT@ +xmlwf/xmlwf.@OBJEXT@: xmlwf/xmlwf.c +xmlwf/xmlfile.@OBJEXT@: xmlwf/xmlfile.c +xmlwf/codepage.@OBJEXT@: xmlwf/codepage.c +xmlwf/@FILEMAP@.@OBJEXT@: xmlwf/@FILEMAP@.c +xmlwf/xmlwf@EXEEXT@: $(XMLWF_OBJS) $(LIBRARY) $(LINK_EXE) $(XMLWF_OBJS) $(LIBRARY) -examples/elements.o: examples/elements.c -examples/elements: examples/elements.o $(LIBRARY) +examples/elements.@OBJEXT@: examples/elements.c +examples/elements: examples/elements.@OBJEXT@ $(LIBRARY) $(LINK_EXE) $< $(LIBRARY) -examples/outline.o: examples/outline.c -examples/outline: examples/outline.o $(LIBRARY) +examples/outline.@OBJEXT@: examples/outline.c +examples/outline: examples/outline.@OBJEXT@ $(LIBRARY) $(LINK_EXE) $< $(LIBRARY) -tests/chardata.o: tests/chardata.c tests/chardata.h -tests/minicheck.o: tests/minicheck.c tests/minicheck.h -tests/runtests.o: tests/runtests.c tests/chardata.h -tests/runtests: tests/runtests.o tests/chardata.o tests/minicheck.o $(LIBRARY) - $(LINK_EXE) tests/runtests.o tests/chardata.o tests/minicheck.o $(LIBRARY) -tests/runtestspp.o: tests/runtestspp.cpp tests/runtests.c tests/chardata.h -tests/runtestspp: tests/runtestspp.o tests/chardata.o tests/minicheck.o $(LIBRARY) - $(LINK_CXX_EXE) tests/runtestspp.o tests/chardata.o tests/minicheck.o $(LIBRARY) +tests/chardata.@OBJEXT@: tests/chardata.c tests/chardata.h +tests/minicheck.@OBJEXT@: tests/minicheck.c tests/minicheck.h +tests/runtests.@OBJEXT@: tests/runtests.c tests/chardata.h +tests/runtests: tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) + $(LINK_EXE) tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) +tests/runtestspp.@OBJEXT@: tests/runtestspp.cpp tests/runtests.c tests/chardata.h +tests/runtestspp: tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) + $(LINK_CXX_EXE) tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) + +tests/benchmark/benchmark.@OBJEXT@: tests/benchmark/benchmark.c +tests/benchmark/benchmark: tests/benchmark/benchmark.@OBJEXT@ $(LIBRARY) + $(LINK_EXE) tests/benchmark/benchmark.@OBJEXT@ $(LIBRARY) + +run-benchmark: tests/benchmark/benchmark + tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3 tests/xmlts.zip: wget --output-document=tests/xmlts.zip \ - http://www.w3.org/XML/Test/xmlts20020606.zip + http://www.w3.org/XML/Test/xmlts20080827.zip tests/XML-Test-Suite: tests/xmlts.zip cd tests && unzip -q xmlts.zip -run-xmltest: xmlwf/xmlwf tests/XML-Test-Suite +run-xmltest: xmlwf/xmlwf@EXEEXT@ tests/XML-Test-Suite tests/xmltest.sh -.SUFFIXES: .c .cpp .lo .o +.SUFFIXES: .c .cpp .lo .@OBJEXT@ -.cpp.o: +.cpp.@OBJEXT@: $(CXXCOMPILE) -o $@ -c $< -.c.o: +.c.@OBJEXT@: $(COMPILE) -o $@ -c $< .c.lo: $(LTCOMPILE) -o $@ -c $< Modified: head/contrib/expat/README ============================================================================== --- head/contrib/expat/README Tue Feb 26 00:58:03 2013 (r247295) +++ head/contrib/expat/README Tue Feb 26 00:58:44 2013 (r247296) @@ -1,5 +1,5 @@ - Expat, Release 2.0.1 + Expat, Release 2.1.0 This is Expat, a C library for parsing XML, written by James Clark. Expat is a stream-oriented XML parser. This means that you register @@ -25,8 +25,7 @@ intended to be production grade software If you are building Expat from a check-out from the CVS repository, you need to run a script that generates the configure script using the GNU autoconf and libtool tools. To do this, you need to have -autoconf 2.52 or newer and libtool 1.4 or newer (1.5 or newer preferred). -Run the script like this: +autoconf 2.58 or newer. Run the script like this: ./buildconf.sh @@ -65,8 +64,8 @@ location. Have a look at the "Makefile" the directories into which things will be installed. If you are interested in building Expat to provide document -information in UTF-16 rather than the default UTF-8, follow these -instructions (after having run "make distclean"): +information in UTF-16 encoding rather than the default UTF-8, follow +these instructions (after having run "make distclean"): 1. For UTF-16 output as unsigned short (and version/error strings as char), run: @@ -106,7 +105,10 @@ use DESTDIR=$(INSTALL_ROOT), even if DES environment, because variable-setting priority is 1) commandline 2) in-makefile -3) environment +3) environment + +Note: This only applies to the Expat library itself, building UTF-16 versions +of xmlwf and the tests is currently not supported. Note for Solaris users: The "ar" command is usually located in "/usr/ccs/bin", which is not in the default PATH. You will need to Modified: head/contrib/expat/configure.in ============================================================================== --- head/contrib/expat/configure.in Tue Feb 26 00:58:03 2013 (r247295) +++ head/contrib/expat/configure.in Tue Feb 26 00:58:44 2013 (r247296) @@ -10,8 +10,8 @@ dnl under the terms of the License (ba dnl in the file COPYING that comes with this distribution. dnl -dnl Ensure that Expat is configured with autoconf 2.52 or newer -AC_PREREQ(2.52) +dnl Ensure that Expat is configured with autoconf 2.58 or newer +AC_PREREQ(2.58) dnl Get the version number of Expat, using m4's esyscmd() command to run dnl the command at m4-generation time. This allows us to create an m4 @@ -25,12 +25,13 @@ dnl test. I believe this test will work, dnl GNU M4 to test it right now. define([expat_version], ifdef([__gnu__], [esyscmd(conftools/get-version.sh lib/expat.h)], - [2.0.x])) + [2.1.x])) AC_INIT(expat, expat_version, expat-bugs@libexpat.org) undefine([expat_version]) AC_CONFIG_SRCDIR(Makefile.in) AC_CONFIG_AUX_DIR(conftools) +AC_CONFIG_MACRO_DIR([m4]) dnl @@ -44,13 +45,12 @@ dnl dnl If the API changes incompatibly set LIBAGE back to 0 dnl -LIBCURRENT=6 -LIBREVISION=2 -LIBAGE=5 +LIBCURRENT=7 +LIBREVISION=0 +LIBAGE=6 AC_CONFIG_HEADER(expat_config.h) -sinclude(conftools/libtool.m4) sinclude(conftools/ac_c_bigendian_cross.m4) AC_LIBTOOL_WIN32_DLL @@ -62,6 +62,7 @@ AC_SUBST(LIBAGE) dnl Checks for programs. AC_PROG_CC +AC_PROG_CXX AC_PROG_INSTALL if test "$GCC" = yes ; then @@ -144,7 +145,7 @@ AC_DEFINE([XML_DTD], 1, AC_DEFINE([XML_CONTEXT_BYTES], 1024, [Define to specify how much context to retain around the current parse point.]) -AC_CONFIG_FILES(Makefile) +AC_CONFIG_FILES([Makefile expat.pc]) AC_OUTPUT abs_srcdir="`cd $srcdir && pwd`" Modified: head/contrib/expat/doc/reference.html ============================================================================== --- head/contrib/expat/doc/reference.html Tue Feb 26 00:58:03 2013 (r247295) +++ head/contrib/expat/doc/reference.html Tue Feb 26 00:58:44 2013 (r247296) @@ -129,8 +129,10 @@ interface.

  • XML_GetBase
  • XML_GetSpecifiedAttributeCount
  • XML_GetIdAttributeIndex
  • +
  • XML_GetAttributeInfo
  • XML_SetEncoding
  • XML_SetParamEntityParsing
  • +
  • XML_SetHashSalt
  • XML_UseForeignDTD
  • XML_SetReturnNSTriplet
  • XML_DefaultCurrent
  • @@ -369,6 +371,11 @@ footprint and can be faster. statically with the code that calls it; this is required to get all the right MSVC magic annotations correct. This is ignored on other platforms. + +
    XML_ATTR_INFO
    +
    If defined, makes the the additional function XML_GetAttributeInfo available +for reporting attribute byte offsets.

    @@ -917,12 +924,15 @@ XML_ParserCreateNS(const XML_Char *encod Constructs a new parser that has namespace processing in effect. Namespace expanded element names and attribute names are returned as a concatenation of the namespace URI, sep, and the local part of the name. This -means that you should pick a character for sep that can't be -part of a legal URI. There is a special case when sep is the null -character '\0': the namespace URI and the local part will be -concatenated without any separator - this is intended to support RDF processors. -It is a programming error to use the null separator with -namespace triplets. +means that you should pick a character for sep that can't be part +of an URI. Since Expat does not check namespace URIs for conformance, the +only safe choice for a namespace separator is a character that is illegal +in XML. For instance, '\xFF' is not legal in UTF-8, and +'\xFFFF' is not legal in UTF-16. There is a special case when +sep is the null character '\0': the namespace URI and +the local part will be concatenated without any separator - this is intended +to support RDF processors. It is a programming error to use the null separator +with namespace triplets.
     XML_Parser XMLCALL
    @@ -2074,6 +2084,27 @@ attribute. If called inside a start hand
     current call.
     
     
    +
    +const XML_AttrInfo * XMLCALL
    +XML_GetAttributeInfo(XML_Parser parser);
    +
    +
    +typedef struct {
    +  XML_Index  nameStart;  /* Offset to beginning of the attribute name. */
    +  XML_Index  nameEnd;    /* Offset after the attribute name's last byte. */
    +  XML_Index  valueStart; /* Offset to beginning of the attribute value. */
    +  XML_Index  valueEnd;   /* Offset after the attribute value's last byte. */
    +} XML_AttrInfo;
    +
    +
    +Returns an array of XML_AttrInfo structures for the +attribute/value pairs passed in the last call to the +XML_StartElementHandler that were specified +in the start-tag rather than defaulted. Each attribute/value pair counts +as 1; thus the number of entries in the array is +XML_GetSpecifiedAttributeCount(parser) / 2. +
    +
     enum XML_Status XMLCALL
     XML_SetEncoding(XML_Parser p,
    @@ -2104,6 +2135,24 @@ The choices for code are:
     
  • XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE
  • XML_PARAM_ENTITY_PARSING_ALWAYS
  • +Note: If XML_SetParamEntityParsing is called after +XML_Parse or XML_ParseBuffer, then it has +no effect and will always return 0. + + +
    +int XMLCALL
    +XML_SetHashSalt(XML_Parser p,
    +                unsigned long hash_salt);
    +
    +
    +Sets the hash salt to use for internal hash calculations. +Helps in preventing DoS attacks based on predicting hash +function behavior. In order to have an effect this must be called +before parsing has started. Returns 1 if successful, 0 when called +after XML_Parse or XML_ParseBuffer. +

    Note: This call is optional, as the parser will auto-generate a new +random salt value if no value has been set at the start of parsing.

    
    Modified: head/contrib/expat/doc/xmlwf.sgml
    ==============================================================================
    --- head/contrib/expat/doc/xmlwf.sgml	Tue Feb 26 00:58:03 2013	(r247295)
    +++ head/contrib/expat/doc/xmlwf.sgml	Tue Feb 26 00:58:44 2013	(r247296)
    @@ -389,11 +389,6 @@ supports both.
       
         BUGS
     	
    -	According to the W3C standard, an XML file without a
    -	declaration at the beginning is not considered well-formed.
    -	However, &dhpackage; allows this to pass.
    -	
    -	
     	&dhpackage; returns a 0 - noerr result,
     	even if the file is not well-formed.  There is no good way for
     	a program to use &dhpackage; to quickly
    
    Modified: head/contrib/expat/expat_config.h.in
    ==============================================================================
    --- head/contrib/expat/expat_config.h.in	Tue Feb 26 00:58:03 2013	(r247295)
    +++ head/contrib/expat/expat_config.h.in	Tue Feb 26 00:58:44 2013	(r247296)
    @@ -39,6 +39,9 @@
     /* Define to 1 if you have the  header file. */
     #undef HAVE_STRING_H
     
    +/* Define to 1 if you have the  header file. */
    +#undef HAVE_SYS_PARAM_H
    +
     /* Define to 1 if you have the  header file. */
     #undef HAVE_SYS_STAT_H
     
    @@ -48,6 +51,10 @@
     /* Define to 1 if you have the  header file. */
     #undef HAVE_UNISTD_H
     
    +/* Define to the sub-directory in which libtool stores uninstalled libraries.
    +   */
    +#undef LT_OBJDIR
    +
     /* Define to the address where bug reports for this package should be sent. */
     #undef PACKAGE_BUGREPORT
     
    @@ -60,6 +67,9 @@
     /* Define to the one symbol short name of this package. */
     #undef PACKAGE_TARNAME
     
    +/* Define to the home page for this package. */
    +#undef PACKAGE_URL
    +
     /* Define to the version of this package. */
     #undef PACKAGE_VERSION
     
    @@ -85,8 +95,8 @@
     /* Define to empty if `const' does not conform to ANSI C. */
     #undef const
     
    -/* Define to `long' if  does not define. */
    +/* Define to `long int' if  does not define. */
     #undef off_t
     
    -/* Define to `unsigned' if  does not define. */
    +/* Define to `unsigned int' if  does not define. */
     #undef size_t
    
    Modified: head/contrib/expat/lib/expat.h
    ==============================================================================
    --- head/contrib/expat/lib/expat.h	Tue Feb 26 00:58:03 2013	(r247295)
    +++ head/contrib/expat/lib/expat.h	Tue Feb 26 00:58:44 2013	(r247296)
    @@ -742,6 +742,29 @@ XML_GetSpecifiedAttributeCount(XML_Parse
     XMLPARSEAPI(int)
     XML_GetIdAttributeIndex(XML_Parser parser);
     
    +#ifdef XML_ATTR_INFO
    +/* Source file byte offsets for the start and end of attribute names and values.
    +   The value indices are exclusive of surrounding quotes; thus in a UTF-8 source
    +   file an attribute value of "blah" will yield:
    +   info->valueEnd - info->valueStart = 4 bytes.
    +*/
    +typedef struct {
    +  XML_Index  nameStart;  /* Offset to beginning of the attribute name. */
    +  XML_Index  nameEnd;    /* Offset after the attribute name's last byte. */
    +  XML_Index  valueStart; /* Offset to beginning of the attribute value. */
    +  XML_Index  valueEnd;   /* Offset after the attribute value's last byte. */
    +} XML_AttrInfo;
    +
    +/* Returns an array of XML_AttrInfo structures for the attribute/value pairs
    +   passed in last call to the XML_StartElementHandler that were specified
    +   in the start-tag rather than defaulted. Each attribute/value pair counts
    +   as 1; thus the number of entries in the array is
    +   XML_GetSpecifiedAttributeCount(parser) / 2.
    +*/
    +XMLPARSEAPI(const XML_AttrInfo *)
    +XML_GetAttributeInfo(XML_Parser parser);
    +#endif
    +
     /* Parses some input. Returns XML_STATUS_ERROR if a fatal error is
        detected.  The last call to XML_Parse must have isFinal true; len
        may be zero for this call (or any other).
    @@ -883,6 +906,15 @@ XMLPARSEAPI(int)
     XML_SetParamEntityParsing(XML_Parser parser,
                               enum XML_ParamEntityParsing parsing);
     
    +/* Sets the hash salt to use for internal hash calculations.
    +   Helps in preventing DoS attacks based on predicting hash
    +   function behavior. This must be called before parsing is started.
    +   Returns 1 if successful, 0 when called after parsing has started.
    +*/
    +XMLPARSEAPI(int)
    +XML_SetHashSalt(XML_Parser parser,
    +                unsigned long hash_salt);
    +
     /* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
        XML_GetErrorCode returns information about the error.
     */
    @@ -984,7 +1016,8 @@ enum XML_FeatureEnum {
       XML_FEATURE_SIZEOF_XML_CHAR,
       XML_FEATURE_SIZEOF_XML_LCHAR,
       XML_FEATURE_NS,
    -  XML_FEATURE_LARGE_SIZE
    +  XML_FEATURE_LARGE_SIZE,
    +  XML_FEATURE_ATTR_INFO
       /* Additional features must be added to the end of this enum. */
     };
     
    @@ -1004,8 +1037,8 @@ XML_GetFeatureList(void);
        change to major or minor version.
     */
     #define XML_MAJOR_VERSION 2
    -#define XML_MINOR_VERSION 0
    -#define XML_MICRO_VERSION 1
    +#define XML_MINOR_VERSION 1
    +#define XML_MICRO_VERSION 0
     
     #ifdef __cplusplus
     }
    
    Modified: head/contrib/expat/lib/xmlparse.c
    ==============================================================================
    --- head/contrib/expat/lib/xmlparse.c	Tue Feb 26 00:58:03 2013	(r247295)
    +++ head/contrib/expat/lib/xmlparse.c	Tue Feb 26 00:58:44 2013	(r247296)
    @@ -5,6 +5,8 @@
     #include 
     #include                      /* memset(), memcpy() */
     #include 
    +#include                      /* UINT_MAX */
    +#include                        /* time() */
     
     #define XML_BUILDING_EXPAT 1
     
    @@ -12,7 +14,7 @@
     #include "winconfig.h"
     #elif defined(MACOS_CLASSIC)
     #include "macconfig.h"
    -#elif defined(__amigaos4__)
    +#elif defined(__amigaos__)
     #include "amigaconfig.h"
     #elif defined(__WATCOMC__)
     #include "watcomconfig.h"
    @@ -327,15 +329,15 @@ processXmlDecl(XML_Parser parser, int is
     static enum XML_Error
     initializeEncoding(XML_Parser parser);
     static enum XML_Error
    -doProlog(XML_Parser parser, const ENCODING *enc, const char *s, 
    -         const char *end, int tok, const char *next, const char **nextPtr, 
    +doProlog(XML_Parser parser, const ENCODING *enc, const char *s,
    +         const char *end, int tok, const char *next, const char **nextPtr,
              XML_Bool haveMore);
     static enum XML_Error
    -processInternalEntity(XML_Parser parser, ENTITY *entity, 
    +processInternalEntity(XML_Parser parser, ENTITY *entity,
                           XML_Bool betweenDecl);
     static enum XML_Error
     doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,
    -          const char *start, const char *end, const char **endPtr, 
    +          const char *start, const char *end, const char **endPtr,
               XML_Bool haveMore);
     static enum XML_Error
     doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr,
    @@ -353,7 +355,7 @@ static enum XML_Error
     addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,
                const XML_Char *uri, BINDING **bindingsPtr);
     static int
    -defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata, 
    +defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata,
                     XML_Bool isId, const XML_Char *dfltValue, XML_Parser parser);
     static enum XML_Error
     storeAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata,
    @@ -391,12 +393,13 @@ static void dtdReset(DTD *p, const XML_M
     static void
     dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms);
     static int
    -dtdCopy(DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms);
    +dtdCopy(XML_Parser oldParser,
    +        DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms);
     static int
    -copyEntityTable(HASH_TABLE *, STRING_POOL *, const HASH_TABLE *);
    -
    +copyEntityTable(XML_Parser oldParser,
    +                HASH_TABLE *, STRING_POOL *, const HASH_TABLE *);
     static NAMED *
    -lookup(HASH_TABLE *table, KEY name, size_t createSize);
    +lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize);
     static void FASTCALL
     hashTableInit(HASH_TABLE *, const XML_Memory_Handling_Suite *ms);
     static void FASTCALL hashTableClear(HASH_TABLE *);
    @@ -429,11 +432,15 @@ static ELEMENT_TYPE *
     getElementType(XML_Parser parser, const ENCODING *enc,
                    const char *ptr, const char *end);
     
    +static unsigned long generate_hash_secret_salt(void);
    +static XML_Bool startParsing(XML_Parser parser);
    +
     static XML_Parser
     parserCreate(const XML_Char *encodingName,
                  const XML_Memory_Handling_Suite *memsuite,
                  const XML_Char *nameSep,
                  DTD *dtd);
    +
     static void
     parserInit(XML_Parser parser, const XML_Char *encodingName);
     
    @@ -533,6 +540,9 @@ struct XML_ParserStruct {
       NS_ATT *m_nsAtts;
       unsigned long m_nsAttsVersion;
       unsigned char m_nsAttsPower;
    +#ifdef XML_ATTR_INFO
    +  XML_AttrInfo *m_attInfo;
    +#endif
       POSITION m_position;
       STRING_POOL m_tempPool;
       STRING_POOL m_temp2Pool;
    @@ -546,6 +556,7 @@ struct XML_ParserStruct {
       XML_Bool m_useForeignDTD;
       enum XML_ParamEntityParsing m_paramEntityParsing;
     #endif
    +  unsigned long m_hash_secret_salt;
     };
     
     #define MALLOC(s) (parser->m_mem.malloc_fcn((s)))
    @@ -640,6 +651,7 @@ struct XML_ParserStruct {
     #define nsAtts (parser->m_nsAtts)
     #define nsAttsVersion (parser->m_nsAttsVersion)
     #define nsAttsPower (parser->m_nsAttsPower)
    +#define attInfo (parser->m_attInfo)
     #define tempPool (parser->m_tempPool)
     #define temp2Pool (parser->m_temp2Pool)
     #define groupConnector (parser->m_groupConnector)
    @@ -653,6 +665,7 @@ struct XML_ParserStruct {
     #define useForeignDTD (parser->m_useForeignDTD)
     #define paramEntityParsing (parser->m_paramEntityParsing)
     #endif /* XML_DTD */
    +#define hash_secret_salt (parser->m_hash_secret_salt)
     
     XML_Parser XMLCALL
     XML_ParserCreate(const XML_Char *encodingName)
    @@ -670,29 +683,42 @@ XML_ParserCreateNS(const XML_Char *encod
     
     static const XML_Char implicitContext[] = {
       ASCII_x, ASCII_m, ASCII_l, ASCII_EQUALS, ASCII_h, ASCII_t, ASCII_t, ASCII_p,
    -  ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w, 
    +  ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w,
       ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g,
       ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, ASCII_SLASH, ASCII_1, ASCII_9,
       ASCII_9, ASCII_8, ASCII_SLASH, ASCII_n, ASCII_a, ASCII_m, ASCII_e,
       ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e, '\0'
     };
     
    +static unsigned long
    +generate_hash_secret_salt(void)
    +{
    +  unsigned int seed = time(NULL) % UINT_MAX;
    +  srand(seed);
    +  return rand();
    +}
    +
    +static XML_Bool  /* only valid for root parser */
    +startParsing(XML_Parser parser)
    +{
    +    /* hash functions must be initialized before setContext() is called */
    +    if (hash_secret_salt == 0)
    +      hash_secret_salt = generate_hash_secret_salt();
    +    if (ns) {
    +      /* implicit context only set for root parser, since child
    +         parsers (i.e. external entity parsers) will inherit it
    +      */
    +      return setContext(parser, implicitContext);
    +    }
    +    return XML_TRUE;
    +}
    +
     XML_Parser XMLCALL
     XML_ParserCreate_MM(const XML_Char *encodingName,
                         const XML_Memory_Handling_Suite *memsuite,
                         const XML_Char *nameSep)
     {
    -  XML_Parser parser = parserCreate(encodingName, memsuite, nameSep, NULL);
    -  if (parser != NULL && ns) {
    -    /* implicit context only set for root parser, since child
    -       parsers (i.e. external entity parsers) will inherit it
    -    */
    -    if (!setContext(parser, implicitContext)) {
    -      XML_ParserFree(parser);
    -      return NULL;
    -    }
    -  }
    -  return parser;
    +  return parserCreate(encodingName, memsuite, nameSep, NULL);
     }
     
     static XML_Parser
    @@ -737,9 +763,20 @@ parserCreate(const XML_Char *encodingNam
         FREE(parser);
         return NULL;
       }
    +#ifdef XML_ATTR_INFO
    +  attInfo = (XML_AttrInfo*)MALLOC(attsSize * sizeof(XML_AttrInfo));
    +  if (attInfo == NULL) {
    +    FREE(atts);
    +    FREE(parser);
    +    return NULL;
    +  }
    +#endif
       dataBuf = (XML_Char *)MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char));
       if (dataBuf == NULL) {
         FREE(atts);
    +#ifdef XML_ATTR_INFO
    +    FREE(attInfo);
    +#endif
         FREE(parser);
         return NULL;
       }
    @@ -752,6 +789,9 @@ parserCreate(const XML_Char *encodingNam
         if (_dtd == NULL) {
           FREE(dataBuf);
           FREE(atts);
    +#ifdef XML_ATTR_INFO
    +      FREE(attInfo);
    +#endif
           FREE(parser);
           return NULL;
         }
    @@ -866,6 +906,7 @@ parserInit(XML_Parser parser, const XML_
       useForeignDTD = XML_FALSE;
       paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
     #endif
    +  hash_secret_salt = 0;
     }
     
     /* moves list of bindings to freeBindingList */
    @@ -913,7 +954,7 @@ XML_ParserReset(XML_Parser parser, const
       poolClear(&temp2Pool);
       parserInit(parser, encodingName);
       dtdReset(_dtd, &parser->m_mem);
    -  return setContext(parser, implicitContext);
    +  return XML_TRUE;
     }
     
     enum XML_Status XMLCALL
    @@ -982,6 +1023,12 @@ XML_ExternalEntityParserCreate(XML_Parse
       int oldInEntityValue = prologState.inEntityValue;
     #endif
       XML_Bool oldns_triplets = ns_triplets;
    +  /* Note that the new parser shares the same hash secret as the old
    +     parser, so that dtdCopy and copyEntityTable can lookup values
    +     from hash tables associated with either parser without us having
    +     to worry which hash secrets each table has.
    +  */
    +  unsigned long oldhash_secret_salt = hash_secret_salt;
     
     #ifdef XML_DTD
       if (!context)
    @@ -1035,13 +1082,14 @@ XML_ExternalEntityParserCreate(XML_Parse
         externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg;
       defaultExpandInternalEntities = oldDefaultExpandInternalEntities;
       ns_triplets = oldns_triplets;
    +  hash_secret_salt = oldhash_secret_salt;
       parentParser = oldParser;
     #ifdef XML_DTD
       paramEntityParsing = oldParamEntityParsing;
       prologState.inEntityValue = oldInEntityValue;
       if (context) {
     #endif /* XML_DTD */
    -    if (!dtdCopy(_dtd, oldDtd, &parser->m_mem)
    +    if (!dtdCopy(oldParser, _dtd, oldDtd, &parser->m_mem)
           || !setContext(parser, context)) {
           XML_ParserFree(parser);
           return NULL;
    @@ -1130,6 +1178,9 @@ XML_ParserFree(XML_Parser parser)
     #endif /* XML_DTD */
         dtdDestroy(_dtd, (XML_Bool)!parentParser, &parser->m_mem);
       FREE((void *)atts);
    +#ifdef XML_ATTR_INFO
    +  FREE((void *)attInfo);
    +#endif
       FREE(groupConnector);
       FREE(buffer);
       FREE(dataBuf);
    @@ -1210,6 +1261,14 @@ XML_GetIdAttributeIndex(XML_Parser parse
       return idAttIndex;
     }
     
    +#ifdef XML_ATTR_INFO
    +const XML_AttrInfo * XMLCALL
    +XML_GetAttributeInfo(XML_Parser parser)
    +{
    +  return attInfo;
    +}
    +#endif
    +
     void XMLCALL
     XML_SetElementHandler(XML_Parser parser,
                           XML_StartElementHandler start,
    @@ -1426,6 +1485,17 @@ XML_SetParamEntityParsing(XML_Parser par
     #endif
     }
     
    +int XMLCALL
    
    *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 01:00:16 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 2E39F839;
     Tue, 26 Feb 2013 01:00:16 +0000 (UTC)
     (envelope-from attilio@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 1BE1F23E;
     Tue, 26 Feb 2013 01:00:16 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1Q10GwV094184;
     Tue, 26 Feb 2013 01:00:16 GMT (envelope-from attilio@svn.freebsd.org)
    Received: (from attilio@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1Q10Cns093263;
     Tue, 26 Feb 2013 01:00:12 GMT (envelope-from attilio@svn.freebsd.org)
    Message-Id: <201302260100.r1Q10Cns093263@svn.freebsd.org>
    From: Attilio Rao 
    Date: Tue, 26 Feb 2013 01:00:12 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247297 - in head/sys: arm/at91 arm/sa11x0 fs/fuse kern
     mips/adm5120 mips/alchemy mips/beri mips/cavium mips/gxemul mips/idt
     mips/malta mips/rt305x mips/sentry5 mips/sibyte powerpc/aim ...
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 01:00:16 -0000
    
    Author: attilio
    Date: Tue Feb 26 01:00:11 2013
    New Revision: 247297
    URL: http://svnweb.freebsd.org/changeset/base/247297
    
    Log:
      Merge from vmobj-rwlock branch:
      Remove unused inclusion of vm/vm_pager.h and vm/vnode_pager.h.
      
      Sponsored by:	EMC / Isilon storage division
      Tested by:	pho
      Reviewed by:	alc
    
    Modified:
      head/sys/arm/at91/at91_machdep.c
      head/sys/arm/sa11x0/assabet_machdep.c
      head/sys/fs/fuse/fuse_io.c
      head/sys/kern/sys_process.c
      head/sys/mips/adm5120/adm5120_machdep.c
      head/sys/mips/alchemy/alchemy_machdep.c
      head/sys/mips/beri/beri_machdep.c
      head/sys/mips/cavium/octeon_machdep.c
      head/sys/mips/gxemul/gxemul_machdep.c
      head/sys/mips/idt/idt_machdep.c
      head/sys/mips/malta/malta_machdep.c
      head/sys/mips/rt305x/rt305x_machdep.c
      head/sys/mips/sentry5/s5_machdep.c
      head/sys/mips/sibyte/sb_machdep.c
      head/sys/powerpc/aim/mmu_oea.c
      head/sys/powerpc/aim/mmu_oea64.c
      head/sys/powerpc/aim/moea64_native.c
      head/sys/powerpc/ps3/mmu_ps3.c
      head/sys/sparc64/sparc64/tsb.c
    
    Modified: head/sys/arm/at91/at91_machdep.c
    ==============================================================================
    --- head/sys/arm/at91/at91_machdep.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/arm/at91/at91_machdep.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -76,7 +76,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    Modified: head/sys/arm/sa11x0/assabet_machdep.c
    ==============================================================================
    --- head/sys/arm/sa11x0/assabet_machdep.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/arm/sa11x0/assabet_machdep.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -79,7 +79,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    Modified: head/sys/fs/fuse/fuse_io.c
    ==============================================================================
    --- head/sys/fs/fuse/fuse_io.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/fs/fuse/fuse_io.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -87,8 +87,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
    -#include 
     #include 
     
     #include "fuse.h"
    
    Modified: head/sys/kern/sys_process.c
    ==============================================================================
    --- head/sys/kern/sys_process.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/kern/sys_process.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
     
     #ifdef COMPAT_FREEBSD32
    
    Modified: head/sys/mips/adm5120/adm5120_machdep.c
    ==============================================================================
    --- head/sys/mips/adm5120/adm5120_machdep.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/mips/adm5120/adm5120_machdep.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     
     #include 
     #include 
    
    Modified: head/sys/mips/alchemy/alchemy_machdep.c
    ==============================================================================
    --- head/sys/mips/alchemy/alchemy_machdep.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/mips/alchemy/alchemy_machdep.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     
     #include 
     #include 
    
    Modified: head/sys/mips/beri/beri_machdep.c
    ==============================================================================
    --- head/sys/mips/beri/beri_machdep.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/mips/beri/beri_machdep.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     
     #include 
     #include 
    
    Modified: head/sys/mips/cavium/octeon_machdep.c
    ==============================================================================
    --- head/sys/mips/cavium/octeon_machdep.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/mips/cavium/octeon_machdep.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     
     #include 
     #include 
    
    Modified: head/sys/mips/gxemul/gxemul_machdep.c
    ==============================================================================
    --- head/sys/mips/gxemul/gxemul_machdep.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/mips/gxemul/gxemul_machdep.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     
     #include 
     #include 
    
    Modified: head/sys/mips/idt/idt_machdep.c
    ==============================================================================
    --- head/sys/mips/idt/idt_machdep.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/mips/idt/idt_machdep.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     
     #include 
     #include 
    
    Modified: head/sys/mips/malta/malta_machdep.c
    ==============================================================================
    --- head/sys/mips/malta/malta_machdep.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/mips/malta/malta_machdep.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     
     #include 
     #include 
    
    Modified: head/sys/mips/rt305x/rt305x_machdep.c
    ==============================================================================
    --- head/sys/mips/rt305x/rt305x_machdep.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/mips/rt305x/rt305x_machdep.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     
     #include 
     #include 
    
    Modified: head/sys/mips/sentry5/s5_machdep.c
    ==============================================================================
    --- head/sys/mips/sentry5/s5_machdep.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/mips/sentry5/s5_machdep.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     
     #include 
     #include 
    
    Modified: head/sys/mips/sibyte/sb_machdep.c
    ==============================================================================
    --- head/sys/mips/sibyte/sb_machdep.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/mips/sibyte/sb_machdep.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     
     #include 
     #include 
    
    Modified: head/sys/powerpc/aim/mmu_oea.c
    ==============================================================================
    --- head/sys/powerpc/aim/mmu_oea.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/powerpc/aim/mmu_oea.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -136,7 +136,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
     
     #include 
    
    Modified: head/sys/powerpc/aim/mmu_oea64.c
    ==============================================================================
    --- head/sys/powerpc/aim/mmu_oea64.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/powerpc/aim/mmu_oea64.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -140,7 +140,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
     
     #include 
    
    Modified: head/sys/powerpc/aim/moea64_native.c
    ==============================================================================
    --- head/sys/powerpc/aim/moea64_native.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/powerpc/aim/moea64_native.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -117,7 +117,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     
     #include 
     #include 
    
    Modified: head/sys/powerpc/ps3/mmu_ps3.c
    ==============================================================================
    --- head/sys/powerpc/ps3/mmu_ps3.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/powerpc/ps3/mmu_ps3.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
     
     #include 
    
    Modified: head/sys/sparc64/sparc64/tsb.c
    ==============================================================================
    --- head/sys/sparc64/sparc64/tsb.c	Tue Feb 26 00:58:44 2013	(r247296)
    +++ head/sys/sparc64/sparc64/tsb.c	Tue Feb 26 01:00:11 2013	(r247297)
    @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     
     #include 
     #include 
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 02:13:03 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id CC9AC5A6;
     Tue, 26 Feb 2013 02:13:03 +0000 (UTC)
     (envelope-from delphij@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id AAE34726;
     Tue, 26 Feb 2013 02:13:03 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1Q2D3Ra016806;
     Tue, 26 Feb 2013 02:13:03 GMT (envelope-from delphij@svn.freebsd.org)
    Received: (from delphij@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1Q2D2N1016801;
     Tue, 26 Feb 2013 02:13:02 GMT (envelope-from delphij@svn.freebsd.org)
    Message-Id: <201302260213.r1Q2D2N1016801@svn.freebsd.org>
    From: Xin LI 
    Date: Tue, 26 Feb 2013 02:13:02 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247300 - in head: sys/sys usr.bin/truss
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 02:13:03 -0000
    
    Author: delphij
    Date: Tue Feb 26 02:13:02 2013
    New Revision: 247300
    URL: http://svnweb.freebsd.org/changeset/base/247300
    
    Log:
      Expose timespec and timeval macros when __BSD_VISIBLE is defined.  This
      allows userland application to use the following macros:
      
      	timespecclear, timespecisset, timespeccmp, timespecadd,
      	timespecsub;
      
      	timevalclear, timevalisset, timevalcmp.
      
      MFC after:	1 month
    
    Modified:
      head/sys/sys/time.h
      head/usr.bin/truss/main.c
      head/usr.bin/truss/syscalls.c
      head/usr.bin/truss/truss.h
    
    Modified: head/sys/sys/time.h
    ==============================================================================
    --- head/sys/sys/time.h	Tue Feb 26 01:38:12 2013	(r247299)
    +++ head/sys/sys/time.h	Tue Feb 26 02:13:02 2013	(r247300)
    @@ -156,9 +156,6 @@ timeval2bintime(const struct timeval *tv
     	/* 18446744073709 = int(2^64 / 1000000) */
     	bt->frac = tv->tv_usec * (uint64_t)18446744073709LL;
     }
    -#endif /* __BSD_VISIBLE */
    -
    -#ifdef _KERNEL
     
     /* Operations on timespecs */
     #define	timespecclear(tvp)	((tvp)->tv_sec = (tvp)->tv_nsec = 0)
    @@ -197,7 +194,7 @@ timeval2bintime(const struct timeval *tv
     
     /* timevaladd and timevalsub are not inlined */
     
    -#endif /* _KERNEL */
    +#endif /* __BSD_VISIBLE */
     
     #ifndef _KERNEL			/* NetBSD/OpenBSD compatible interfaces */
     
    
    Modified: head/usr.bin/truss/main.c
    ==============================================================================
    --- head/usr.bin/truss/main.c	Tue Feb 26 01:38:12 2013	(r247299)
    +++ head/usr.bin/truss/main.c	Tue Feb 26 02:13:02 2013	(r247300)
    @@ -323,14 +323,14 @@ START_TRACE:
     				fprintf(trussinfo->outfile, "%5d: ",
     				    trussinfo->pid);
     			if (trussinfo->flags & ABSOLUTETIMESTAMPS) {
    -				timespecsubt(&trussinfo->curthread->after,
    +				timespecsubt_to(&trussinfo->curthread->after,
     				    &trussinfo->start_time, &timediff);
     				fprintf(trussinfo->outfile, "%ld.%09ld ",
     				    (long)timediff.tv_sec,
     				    timediff.tv_nsec);
     			}
     			if (trussinfo->flags & RELATIVETIMESTAMPS) {
    -				timespecsubt(&trussinfo->curthread->after,
    +				timespecsubt_to(&trussinfo->curthread->after,
     				    &trussinfo->curthread->before, &timediff);
     				fprintf(trussinfo->outfile, "%ld.%09ld ",
     				    (long)timediff.tv_sec,
    @@ -349,14 +349,14 @@ START_TRACE:
     				fprintf(trussinfo->outfile, "%5d: ",
     				    trussinfo->pid);
     			if (trussinfo->flags & ABSOLUTETIMESTAMPS) {
    -				timespecsubt(&trussinfo->curthread->after,
    +				timespecsubt_to(&trussinfo->curthread->after,
     				    &trussinfo->start_time, &timediff);
     				fprintf(trussinfo->outfile, "%ld.%09ld ",
     				    (long)timediff.tv_sec,
     				    timediff.tv_nsec);
     			}
     			if (trussinfo->flags & RELATIVETIMESTAMPS) {
    -				timespecsubt(&trussinfo->curthread->after,
    +				timespecsubt_to(&trussinfo->curthread->after,
     				    &trussinfo->curthread->before, &timediff);
     				fprintf(trussinfo->outfile, "%ld.%09ld ",
     				    (long)timediff.tv_sec, timediff.tv_nsec);
    
    Modified: head/usr.bin/truss/syscalls.c
    ==============================================================================
    --- head/usr.bin/truss/syscalls.c	Tue Feb 26 01:38:12 2013	(r247299)
    +++ head/usr.bin/truss/syscalls.c	Tue Feb 26 02:13:02 2013	(r247300)
    @@ -1126,14 +1126,14 @@ print_syscall(struct trussinfo *trussinf
     	}
     
     	if (trussinfo->flags & ABSOLUTETIMESTAMPS) {
    -		timespecsubt(&trussinfo->curthread->after,
    +		timespecsubt_to(&trussinfo->curthread->after,
     		    &trussinfo->start_time, &timediff);
     		len += fprintf(trussinfo->outfile, "%ld.%09ld ",
     		    (long)timediff.tv_sec, timediff.tv_nsec);
     	}
     
     	if (trussinfo->flags & RELATIVETIMESTAMPS) {
    -		timespecsubt(&trussinfo->curthread->after,
    +		timespecsubt_to(&trussinfo->curthread->after,
     		    &trussinfo->curthread->before, &timediff);
     		len += fprintf(trussinfo->outfile, "%ld.%09ld ",
     		    (long)timediff.tv_sec, timediff.tv_nsec);
    @@ -1165,9 +1165,9 @@ print_syscall_ret(struct trussinfo *trus
     		if (!sc)
     			return;
     		clock_gettime(CLOCK_REALTIME, &trussinfo->curthread->after);
    -		timespecsubt(&trussinfo->curthread->after,
    +		timespecsubt_to(&trussinfo->curthread->after,
     		    &trussinfo->curthread->before, &timediff);
    -		timespecadd(&sc->time, &timediff, &sc->time);
    +		timespecadd_to(&sc->time, &timediff, &sc->time);
     		sc->ncalls++;
     		if (errorp)
     			sc->nerror++;
    @@ -1205,7 +1205,7 @@ print_summary(struct trussinfo *trussinf
     			fprintf(trussinfo->outfile, "%-20s%5jd.%09ld%8d%8d\n",
     			    sc->name, (intmax_t)sc->time.tv_sec,
     			    sc->time.tv_nsec, sc->ncalls, sc->nerror);
    -			timespecadd(&total, &sc->time, &total);
    +			timespecadd_to(&total, &sc->time, &total);
     			ncall += sc->ncalls;
     			nerror += sc->nerror;
     		}
    
    Modified: head/usr.bin/truss/truss.h
    ==============================================================================
    --- head/usr.bin/truss/truss.h	Tue Feb 26 01:38:12 2013	(r247299)
    +++ head/usr.bin/truss/truss.h	Tue Feb 26 02:13:02 2013	(r247300)
    @@ -62,7 +62,7 @@ struct trussinfo
     	SLIST_HEAD(, threadinfo) threadlist;
     };
     
    -#define	timespecsubt(tvp, uvp, vvp)					\
    +#define	timespecsubt_to(tvp, uvp, vvp)					\
     	do {								\
     		(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;		\
     		(vvp)->tv_nsec = (tvp)->tv_nsec - (uvp)->tv_nsec;	\
    @@ -72,7 +72,7 @@ struct trussinfo
     		}							\
     	} while (0)
     
    -#define	timespecadd(tvp, uvp, vvp)					\
    +#define	timespecadd_to(tvp, uvp, vvp)					\
     	do {								\
     		(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;		\
     		(vvp)->tv_nsec = (tvp)->tv_nsec + (uvp)->tv_nsec;	\
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 03:24:46 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 754B4709;
     Tue, 26 Feb 2013 03:24:46 +0000 (UTC) (envelope-from ian@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 507709B4;
     Tue, 26 Feb 2013 03:24:46 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1Q3Ojb0039627;
     Tue, 26 Feb 2013 03:24:45 GMT (envelope-from ian@svn.freebsd.org)
    Received: (from ian@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1Q3Oj56039626;
     Tue, 26 Feb 2013 03:24:45 GMT (envelope-from ian@svn.freebsd.org)
    Message-Id: <201302260324.r1Q3Oj56039626@svn.freebsd.org>
    From: Ian Lepore 
    Date: Tue, 26 Feb 2013 03:24:45 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247301 - head/sys/boot/common
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 03:24:46 -0000
    
    Author: ian
    Date: Tue Feb 26 03:24:45 2013
    New Revision: 247301
    URL: http://svnweb.freebsd.org/changeset/base/247301
    
    Log:
      Adjust the arm kernel entry point address properly regardless of whether the
      e_entry field holds a physical or a virtual address.  Add a comment block
      that explains the assumptions being made by the adjustment code.
    
    Modified:
      head/sys/boot/common/load_elf.c
    
    Modified: head/sys/boot/common/load_elf.c
    ==============================================================================
    --- head/sys/boot/common/load_elf.c	Tue Feb 26 02:13:02 2013	(r247300)
    +++ head/sys/boot/common/load_elf.c	Tue Feb 26 03:24:45 2013	(r247301)
    @@ -290,14 +290,25 @@ __elfN(loadimage)(struct preloaded_file 
     	} else
     	    off = 0;
     #elif defined(__arm__)
    -	if (off & 0xf0000000u) {
    -	    off = -(off & 0xf0000000u);
    -	    ehdr->e_entry += off;
    +	/*
    +	 * The elf headers in some kernels specify virtual addresses in all
    +	 * header fields.  More recently, the e_entry and p_paddr fields are the
    +	 * proper physical addresses.  Even when the p_paddr fields are correct,
    +	 * the MI code below uses the p_vaddr fields with an offset added for
    +	 * loading (doing so is arguably wrong).  To make loading work, we need
    +	 * an offset that represents the difference between physical and virtual
    +	 * addressing.  ARM kernels are always linked at 0xC0000000.  Depending
    +	 * on the headers, the offset value passed in may be physical or virtual
    +	 * (because it typically comes from e_entry), but we always replace
    +	 * whatever is passed in with the va<->pa offset.  On the other hand, we
    +	 * only adjust the entry point if it's a virtual address to begin with.
    +	 */
    +	off = -0xc0000000u;
    +	if ((ehdr->e_entry & 0xc0000000u) == 0xc000000u)
    +		ehdr->e_entry += off;
     #ifdef ELF_VERBOSE
    -	    printf("Converted entry 0x%08x\n", ehdr->e_entry);
    +	printf("ehdr->e_entry 0x%08x, va<->pa off %llx\n", ehdr->e_entry, off);
     #endif
    -	} else
    -	    off = 0;
     #else
     	off = 0;		/* other archs use direct mapped kernels */
     #endif
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 04:59:03 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 69AAB73E;
     Tue, 26 Feb 2013 04:59:03 +0000 (UTC)
     (envelope-from kientzle@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 44AEBCFC;
     Tue, 26 Feb 2013 04:59:03 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1Q4x3jC067202;
     Tue, 26 Feb 2013 04:59:03 GMT
     (envelope-from kientzle@svn.freebsd.org)
    Received: (from kientzle@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1Q4x39V067201;
     Tue, 26 Feb 2013 04:59:03 GMT
     (envelope-from kientzle@svn.freebsd.org)
    Message-Id: <201302260459.r1Q4x39V067201@svn.freebsd.org>
    From: Tim Kientzle 
    Date: Tue, 26 Feb 2013 04:59:03 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247304 - head/sys/arm/conf
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 04:59:03 -0000
    
    Author: kientzle
    Date: Tue Feb 26 04:59:02 2013
    New Revision: 247304
    URL: http://svnweb.freebsd.org/changeset/base/247304
    
    Log:
      RPi users might want to touch the boot partition, which is always FAT
      formatted on this board, so compile-in MSDOSFS.
      
      Comment out the compiled-in FDT and explain why.
    
    Modified:
      head/sys/arm/conf/RPI-B
    
    Modified: head/sys/arm/conf/RPI-B
    ==============================================================================
    --- head/sys/arm/conf/RPI-B	Tue Feb 26 03:46:35 2013	(r247303)
    +++ head/sys/arm/conf/RPI-B	Tue Feb 26 04:59:02 2013	(r247304)
    @@ -42,6 +42,7 @@ options 	FFS			#Berkeley Fast Filesystem
     options 	SOFTUPDATES		#Enable FFS soft updates support
     options 	UFS_ACL			#Support for access control lists
     options 	UFS_DIRHASH		#Improve performance on big directories
    +options 	MSDOSFS			#MSDOS Filesystem
     device		snp
     
     options 	NFSCL			#Network Filesystem Client
    @@ -113,5 +114,7 @@ device		smsc
     
     # Flattened Device Tree
     options         FDT
    -options         FDT_DTB_STATIC
    -makeoptions     FDT_DTS_FILE=bcm2835-rpi-b.dts
    +# Note:  DTB is normally loaded and modified by RPi boot loader, then
    +# handed to kernel via U-Boot and ubldr.
    +#options         FDT_DTB_STATIC
    +#makeoptions     FDT_DTS_FILE=bcm2835-rpi-b.dts
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 07:00:26 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 03AA0F04;
     Tue, 26 Feb 2013 07:00:26 +0000 (UTC) (envelope-from alc@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id D7C1812B;
     Tue, 26 Feb 2013 07:00:25 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1Q70PFm005556;
     Tue, 26 Feb 2013 07:00:25 GMT (envelope-from alc@svn.freebsd.org)
    Received: (from alc@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1Q70Pej005555;
     Tue, 26 Feb 2013 07:00:25 GMT (envelope-from alc@svn.freebsd.org)
    Message-Id: <201302260700.r1Q70Pej005555@svn.freebsd.org>
    From: Alan Cox 
    Date: Tue, 26 Feb 2013 07:00:25 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247312 - head/sys/fs/fuse
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 07:00:26 -0000
    
    Author: alc
    Date: Tue Feb 26 07:00:24 2013
    New Revision: 247312
    URL: http://svnweb.freebsd.org/changeset/base/247312
    
    Log:
      Eliminate a duplicate #include.
      
      Sponsored by:	EMC / Isilon Storage Division
    
    Modified:
      head/sys/fs/fuse/fuse_io.c
    
    Modified: head/sys/fs/fuse/fuse_io.c
    ==============================================================================
    --- head/sys/fs/fuse/fuse_io.c	Tue Feb 26 06:38:00 2013	(r247311)
    +++ head/sys/fs/fuse/fuse_io.c	Tue Feb 26 07:00:24 2013	(r247312)
    @@ -87,7 +87,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     
     #include "fuse.h"
     #include "fuse_file.h"
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 07:27:31 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 8DBB776B;
     Tue, 26 Feb 2013 07:27:31 +0000 (UTC)
     (envelope-from andrew@fubar.geek.nz)
    Received: from smtp3.clear.net.nz (smtp3.clear.net.nz [203.97.33.64])
     by mx1.freebsd.org (Postfix) with ESMTP id 595D320D;
     Tue, 26 Feb 2013 07:27:31 +0000 (UTC)
    Received: from mxin1-orange.clear.net.nz
     (lb2-srcnat.clear.net.nz [203.97.32.237])
     by smtp3.clear.net.nz (CLEAR Net Mail)
     with ESMTP id <0MIT0069RGPTX700@smtp3.clear.net.nz>; Tue,
     26 Feb 2013 20:27:30 +1300 (NZDT)
    Received: from 202-0-48-19.paradise.net.nz (HELO bender) ([202.0.48.19])
     by smtpin1.paradise.net.nz with ESMTP; Tue, 26 Feb 2013 20:27:30 +1300
    Date: Tue, 26 Feb 2013 20:27:07 +1300
    From: Andrew Turner 
    Subject: Re: svn commit: r247116 - in head/sys: fs/nfs fs/nfsclient kern
     nfsclient sys tools
    In-reply-to: <8006325C-B281-4F4D-BE1A-C3B444FE979F@rice.edu>
    To: Alan Cox 
    Message-id: <20130226202707.026ad226@bender>
    MIME-version: 1.0
    Content-type: text/plain; charset=US-ASCII
    Content-transfer-encoding: 7bit
    References: <201302211902.r1LJ2o5T033708@svn.freebsd.org>
     <20130225201313.2050da18@bender> <20130225085019.GU2454@kib.kiev.ua>
     <20130225233603.49a5d4a5@bender>
     <8006325C-B281-4F4D-BE1A-C3B444FE979F@rice.edu>
    Cc: Konstantin Belousov , svn-src-head@freebsd.org,
     svn-src-all@freebsd.org, src-committers@freebsd.org,
     John Baldwin 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 07:27:31 -0000
    
    On Mon, 25 Feb 2013 15:00:41 -0600
    Alan Cox  wrote:
    
    > 
    > On Feb 25, 2013, at 4:36 AM, Andrew Turner wrote:
    > 
    > > On Mon, 25 Feb 2013 10:50:19 +0200
    > > Konstantin Belousov  wrote:
    > > 
    > >> On Mon, Feb 25, 2013 at 08:13:13PM +1300, Andrew Turner wrote:
    > >>> On Thu, 21 Feb 2013 19:02:50 +0000 (UTC)
    > >>> John Baldwin  wrote:
    > >>> 
    > >>>> Author: jhb
    > >>>> Date: Thu Feb 21 19:02:50 2013
    > >>>> New Revision: 247116
    > >>>> URL: http://svnweb.freebsd.org/changeset/base/247116
    > >>>> 
    > >>>> Log:
    > >>>>  Further refine the handling of stop signals in the NFS client.
    > >>>> The changes in r246417 were incomplete as they did not add
    > >>>> explicit calls to sigdeferstop() around all the places that
    > >>>> previously passed SBDRY to _sleep().  In addition,
    > >>>> nfs_getcacheblk() could trigger a write RPC from getblk()
    > >>>> resulting in sigdeferstop() recursing. Rather than manually
    > >>>> deferring stop signals in specific places, change the VFS_*() and
    > >>>> VOP_*() methods to defer stop signals for filesystems which
    > >>>> request this behavior via a new VFCF_SBDRY flag. Note that this
    > >>>> has to be a VFC flag rather than a MNTK flag so that it works
    > >>>> properly with VFS_MOUNT() when the mount is not yet fully
    > >>>> constructed.  For now, only the NFS clients are set this new flag
    > >>>> in VFS_SET(). A few other related changes:
    > >>>>  - Add an assertion to ensure that TDF_SBDRY doesn't leak to
    > >>>> userland.
    > >>>>  - When a lookup request uses VOP_READLINK() to follow a symlink,
    > >>>> mark the request as being on behalf of the thread performing the
    > >>>> lookup (cnp_thread) rather than using a NULL thread pointer.
    > >>>> This causes NFS to properly handle signals during this VOP on an
    > >>>> interruptible mount.
    > >>>> 
    > >>>>  PR:		kern/176179
    > >>>>  Reported by:	Russell Cattelan (sigdeferstop() recursion)
    > >>>>  Reviewed by:	kib
    > >>>>  MFC after:	1 month
    > >>> 
    > >>> This change is causing init to crash for me on armv6. I'm
    > >>> netbooting a PandaBoard and it appears init is receiving a SIGABRT
    > >>> before it gets into main().
    > >>> 
    > >>> Do you have any idea where I could look to track down why it is
    > >>> doing this?
    > >> 
    > >> It is weird. SIGABRT sent by the kernel usually means that
    > >> execve(2) already destroyed the previous address space of the
    > >> process, but the new image cannot be activated, most likely due to
    > >> image format error discovered too late, or resource shortage.
    > >> 
    > >> Could it be that some NFS RPC fails after the patch, but I cannot
    > >> imagine why. You would need to track this. Also, verify that the
    > >> init binary is correct.
    > >> 
    > >> I tried amd64 netboot, and it worked fine.
    > > 
    > > It looks like this change is not the issue, it just changed the
    > > symptom enough for me to not realise I was seeing an issue where
    > > it would crash the kernel before. I reinstated this change but only
    > > allowed the kernel to access half the memory and it booted
    > > correctly.
    > > 
    > > The real issue appears to be related to something in the vm layer
    > > not working on ARM boards with too much memory (somewhere between
    > > 512MiB and 1GiB).
    > 
    > 
    > The recently introduced auto-sizing and cap may be too optimistic.
    > In fact, they are greater than what we allow on 32-bit x86 and 32-bit
    > MIPS.  Try the following.
    > 
    > Index: arm/include/vmparam.h
    > ===================================================================
    > --- arm/include/vmparam.h	(revision 247249)
    > +++ arm/include/vmparam.h	(working copy)
    > @@ -142,15 +142,15 @@
    >  #define VM_KMEM_SIZE		(12*1024*1024)
    >  #endif
    >  #ifndef VM_KMEM_SIZE_SCALE
    > -#define VM_KMEM_SIZE_SCALE	(2)
    > +#define VM_KMEM_SIZE_SCALE	(3)
    >  #endif
    >  
    >  /*
    > - * Ceiling on the size of the kmem submap: 60% of the kernel map.
    > + * Ceiling on the size of the kmem submap: 40% of the kernel map.
    >   */
    >  #ifndef VM_KMEM_SIZE_MAX
    >  #define	VM_KMEM_SIZE_MAX	((vm_max_kernel_address - \
    > -    VM_MIN_KERNEL_ADDRESS + 1) * 3 / 5)
    > +    VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
    >  #endif
    >  
    >  #define MAXTSIZ 	(16*1024*1024)
    > 
    This patch fixes the boot for me. Is it likely we will see similar
    issues with boards with more memory with this? I know of ARM boards
    with 2GiB of ram, and I would expect to see some with more soon.
    
    Andrew
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 07:41:35 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 991C0A79;
     Tue, 26 Feb 2013 07:41:35 +0000 (UTC) (envelope-from alc@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 8B85C28D;
     Tue, 26 Feb 2013 07:41:35 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1Q7fZut018015;
     Tue, 26 Feb 2013 07:41:35 GMT (envelope-from alc@svn.freebsd.org)
    Received: (from alc@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1Q7fZSn018013;
     Tue, 26 Feb 2013 07:41:35 GMT (envelope-from alc@svn.freebsd.org)
    Message-Id: <201302260741.r1Q7fZSn018013@svn.freebsd.org>
    From: Alan Cox 
    Date: Tue, 26 Feb 2013 07:41:35 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247313 - in head/sys/arm: at91 sa11x0
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 07:41:35 -0000
    
    Author: alc
    Date: Tue Feb 26 07:41:34 2013
    New Revision: 247313
    URL: http://svnweb.freebsd.org/changeset/base/247313
    
    Log:
      Eliminate a redundant #include: machine/pmap.h is already included
      through vm/pmap.h.
    
    Modified:
      head/sys/arm/at91/at91_machdep.c
      head/sys/arm/sa11x0/assabet_machdep.c
    
    Modified: head/sys/arm/at91/at91_machdep.c
    ==============================================================================
    --- head/sys/arm/at91/at91_machdep.c	Tue Feb 26 07:00:24 2013	(r247312)
    +++ head/sys/arm/at91/at91_machdep.c	Tue Feb 26 07:41:34 2013	(r247313)
    @@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    Modified: head/sys/arm/sa11x0/assabet_machdep.c
    ==============================================================================
    --- head/sys/arm/sa11x0/assabet_machdep.c	Tue Feb 26 07:00:24 2013	(r247312)
    +++ head/sys/arm/sa11x0/assabet_machdep.c	Tue Feb 26 07:41:34 2013	(r247313)
    @@ -80,7 +80,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 07:49:46 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 5BB76C5F;
     Tue, 26 Feb 2013 07:49:46 +0000 (UTC) (envelope-from alc@rice.edu)
    Received: from proofpoint1.mail.rice.edu (proofpoint1.mail.rice.edu
     [128.42.201.100])
     by mx1.freebsd.org (Postfix) with ESMTP id EA18F2D3;
     Tue, 26 Feb 2013 07:49:45 +0000 (UTC)
    Received: from pps.filterd (proofpoint1 [127.0.0.1])
     by proofpoint1.mail.rice.edu (8.14.5/8.14.5) with SMTP id r1PMK2FK023466;
     Tue, 26 Feb 2013 01:49:44 -0600
    Received: from mh10.mail.rice.edu (mh10.mail.rice.edu [128.42.201.30])
     by proofpoint1.mail.rice.edu with ESMTP id 1ant268mk5-1;
     Tue, 26 Feb 2013 01:49:44 -0600
    Received: from mh10.mail.rice.edu (localhost.localdomain [127.0.0.1])
     by mh10.mail.rice.edu (Postfix) with ESMTP id 97CE9603DC;
     Tue, 26 Feb 2013 01:49:44 -0600 (CST)
    Received: from mh10.mail.rice.edu (localhost.localdomain [127.0.0.1])
     by mh10.mail.rice.edu (Postfix) with ESMTP id 95EBB603DB;
     Tue, 26 Feb 2013 01:49:44 -0600 (CST)
    X-Virus-Scanned: by amavis-2.7.0 at mh10.mail.rice.edu, auth channel
    Received: from mh10.mail.rice.edu ([127.0.0.1])
     by mh10.mail.rice.edu (mh10.mail.rice.edu [127.0.0.1]) (amavis, port 10026)
     with ESMTP id qI_DU-Ym-wcu; Tue, 26 Feb 2013 01:49:44 -0600 (CST)
    Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net
     (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18])
     (using TLSv1 with cipher RC4-MD5 (128/128 bits))
     (No client certificate requested) (Authenticated sender: alc)
     by mh10.mail.rice.edu (Postfix) with ESMTPSA id D3D36603DA;
     Tue, 26 Feb 2013 01:49:43 -0600 (CST)
    Message-ID: <512C6916.5010608@rice.edu>
    Date: Tue, 26 Feb 2013 01:49:42 -0600
    From: Alan Cox 
    User-Agent: Mozilla/5.0 (X11; FreeBSD i386;
     rv:17.0) Gecko/20130127 Thunderbird/17.0.2
    MIME-Version: 1.0
    To: Andrew Turner 
    Subject: Re: svn commit: r247116 - in head/sys: fs/nfs fs/nfsclient kern 
     nfsclient sys tools
    References: <201302211902.r1LJ2o5T033708@svn.freebsd.org>
     <20130225201313.2050da18@bender> <20130225085019.GU2454@kib.kiev.ua>
     <20130225233603.49a5d4a5@bender>
     <8006325C-B281-4F4D-BE1A-C3B444FE979F@rice.edu>
     <20130226202707.026ad226@bender>
    In-Reply-To: <20130226202707.026ad226@bender>
    Content-Type: text/plain; charset=ISO-8859-1
    Content-Transfer-Encoding: 7bit
    Cc: Konstantin Belousov , svn-src-head@freebsd.org,
     svn-src-all@freebsd.org, src-committers@freebsd.org,
     John Baldwin 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 07:49:46 -0000
    
    On 02/26/2013 01:27, Andrew Turner wrote:
    > On Mon, 25 Feb 2013 15:00:41 -0600
    > Alan Cox  wrote:
    >
    >> On Feb 25, 2013, at 4:36 AM, Andrew Turner wrote:
    >>
    >>> On Mon, 25 Feb 2013 10:50:19 +0200
    >>> Konstantin Belousov  wrote:
    >>>
    >>>> On Mon, Feb 25, 2013 at 08:13:13PM +1300, Andrew Turner wrote:
    >>>>> On Thu, 21 Feb 2013 19:02:50 +0000 (UTC)
    >>>>> John Baldwin  wrote:
    >>>>>
    >>>>>> Author: jhb
    >>>>>> Date: Thu Feb 21 19:02:50 2013
    >>>>>> New Revision: 247116
    >>>>>> URL: http://svnweb.freebsd.org/changeset/base/247116
    >>>>>>
    >>>>>> Log:
    >>>>>>  Further refine the handling of stop signals in the NFS client.
    >>>>>> The changes in r246417 were incomplete as they did not add
    >>>>>> explicit calls to sigdeferstop() around all the places that
    >>>>>> previously passed SBDRY to _sleep().  In addition,
    >>>>>> nfs_getcacheblk() could trigger a write RPC from getblk()
    >>>>>> resulting in sigdeferstop() recursing. Rather than manually
    >>>>>> deferring stop signals in specific places, change the VFS_*() and
    >>>>>> VOP_*() methods to defer stop signals for filesystems which
    >>>>>> request this behavior via a new VFCF_SBDRY flag. Note that this
    >>>>>> has to be a VFC flag rather than a MNTK flag so that it works
    >>>>>> properly with VFS_MOUNT() when the mount is not yet fully
    >>>>>> constructed.  For now, only the NFS clients are set this new flag
    >>>>>> in VFS_SET(). A few other related changes:
    >>>>>>  - Add an assertion to ensure that TDF_SBDRY doesn't leak to
    >>>>>> userland.
    >>>>>>  - When a lookup request uses VOP_READLINK() to follow a symlink,
    >>>>>> mark the request as being on behalf of the thread performing the
    >>>>>> lookup (cnp_thread) rather than using a NULL thread pointer.
    >>>>>> This causes NFS to properly handle signals during this VOP on an
    >>>>>> interruptible mount.
    >>>>>>
    >>>>>>  PR:		kern/176179
    >>>>>>  Reported by:	Russell Cattelan (sigdeferstop() recursion)
    >>>>>>  Reviewed by:	kib
    >>>>>>  MFC after:	1 month
    >>>>> This change is causing init to crash for me on armv6. I'm
    >>>>> netbooting a PandaBoard and it appears init is receiving a SIGABRT
    >>>>> before it gets into main().
    >>>>>
    >>>>> Do you have any idea where I could look to track down why it is
    >>>>> doing this?
    >>>> It is weird. SIGABRT sent by the kernel usually means that
    >>>> execve(2) already destroyed the previous address space of the
    >>>> process, but the new image cannot be activated, most likely due to
    >>>> image format error discovered too late, or resource shortage.
    >>>>
    >>>> Could it be that some NFS RPC fails after the patch, but I cannot
    >>>> imagine why. You would need to track this. Also, verify that the
    >>>> init binary is correct.
    >>>>
    >>>> I tried amd64 netboot, and it worked fine.
    >>> It looks like this change is not the issue, it just changed the
    >>> symptom enough for me to not realise I was seeing an issue where
    >>> it would crash the kernel before. I reinstated this change but only
    >>> allowed the kernel to access half the memory and it booted
    >>> correctly.
    >>>
    >>> The real issue appears to be related to something in the vm layer
    >>> not working on ARM boards with too much memory (somewhere between
    >>> 512MiB and 1GiB).
    >>
    >> The recently introduced auto-sizing and cap may be too optimistic.
    >> In fact, they are greater than what we allow on 32-bit x86 and 32-bit
    >> MIPS.  Try the following.
    >>
    >> Index: arm/include/vmparam.h
    >> ===================================================================
    >> --- arm/include/vmparam.h	(revision 247249)
    >> +++ arm/include/vmparam.h	(working copy)
    >> @@ -142,15 +142,15 @@
    >>  #define VM_KMEM_SIZE		(12*1024*1024)
    >>  #endif
    >>  #ifndef VM_KMEM_SIZE_SCALE
    >> -#define VM_KMEM_SIZE_SCALE	(2)
    >> +#define VM_KMEM_SIZE_SCALE	(3)
    >>  #endif
    >>  
    >>  /*
    >> - * Ceiling on the size of the kmem submap: 60% of the kernel map.
    >> + * Ceiling on the size of the kmem submap: 40% of the kernel map.
    >>   */
    >>  #ifndef VM_KMEM_SIZE_MAX
    >>  #define	VM_KMEM_SIZE_MAX	((vm_max_kernel_address - \
    >> -    VM_MIN_KERNEL_ADDRESS + 1) * 3 / 5)
    >> +    VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
    >>  #endif
    >>  
    >>  #define MAXTSIZ 	(16*1024*1024)
    >>
    > This patch fixes the boot for me. Is it likely we will see similar
    > issues with boards with more memory with this? I know of ARM boards
    > with 2GiB of ram, and I would expect to see some with more soon.
    >
    
    The kmem submap should be fine, but other things might become a problem.
    
    What do "sysctl -x vm.min_kernel_address" and "sysctl -x
    vm.max_kernel_address" report on your machine?
    
    Alan
    
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 08:09:52 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 59359348;
     Tue, 26 Feb 2013 08:09:52 +0000 (UTC)
     (envelope-from andrew@fubar.geek.nz)
    Received: from smtp3.clear.net.nz (smtp3.clear.net.nz [203.97.33.64])
     by mx1.freebsd.org (Postfix) with ESMTP id 0293F373;
     Tue, 26 Feb 2013 08:09:51 +0000 (UTC)
    Received: from mxin2-orange.clear.net.nz
     (lb2-srcnat.clear.net.nz [203.97.32.237])
     by smtp3.clear.net.nz (CLEAR Net Mail)
     with ESMTP id <0MIT0061FIMVX610@smtp3.clear.net.nz>; Tue,
     26 Feb 2013 21:08:58 +1300 (NZDT)
    Received: from 202-0-48-19.paradise.net.nz (HELO bender) ([202.0.48.19])
     by smtpin2.paradise.net.nz with ESMTP; Tue, 26 Feb 2013 21:08:57 +1300
    Date: Tue, 26 Feb 2013 21:08:35 +1300
    From: Andrew Turner 
    Subject: Re: svn commit: r247116 - in head/sys: fs/nfs fs/nfsclient kern
     nfsclient sys tools
    In-reply-to: <512C6916.5010608@rice.edu>
    To: Alan Cox 
    Message-id: <20130226210835.749cd816@bender>
    MIME-version: 1.0
    Content-type: text/plain; charset=US-ASCII
    Content-transfer-encoding: 7bit
    References: <201302211902.r1LJ2o5T033708@svn.freebsd.org>
     <20130225201313.2050da18@bender> <20130225085019.GU2454@kib.kiev.ua>
     <20130225233603.49a5d4a5@bender>
     <8006325C-B281-4F4D-BE1A-C3B444FE979F@rice.edu>
     <20130226202707.026ad226@bender> <512C6916.5010608@rice.edu>
    Cc: Konstantin Belousov , svn-src-head@freebsd.org,
     svn-src-all@freebsd.org, src-committers@freebsd.org,
     John Baldwin 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 08:09:52 -0000
    
    On Tue, 26 Feb 2013 01:49:42 -0600
    Alan Cox  wrote:
    
    > On 02/26/2013 01:27, Andrew Turner wrote:
    > > On Mon, 25 Feb 2013 15:00:41 -0600
    > > Alan Cox  wrote:
    > >
    > >> On Feb 25, 2013, at 4:36 AM, Andrew Turner wrote:
    > >>
    > >>> On Mon, 25 Feb 2013 10:50:19 +0200
    > >>> Konstantin Belousov  wrote:
    > >>>
    > >>>> On Mon, Feb 25, 2013 at 08:13:13PM +1300, Andrew Turner wrote:
    > >>>>> On Thu, 21 Feb 2013 19:02:50 +0000 (UTC)
    > >>>>> John Baldwin  wrote:
    > >>>>>
    > >>>>>> Author: jhb
    > >>>>>> Date: Thu Feb 21 19:02:50 2013
    > >>>>>> New Revision: 247116
    > >>>>>> URL: http://svnweb.freebsd.org/changeset/base/247116
    > >>>>>>
    > >>>>>> Log:
    > >>>>>>  Further refine the handling of stop signals in the NFS client.
    > >>>>>> The changes in r246417 were incomplete as they did not add
    > >>>>>> explicit calls to sigdeferstop() around all the places that
    > >>>>>> previously passed SBDRY to _sleep().  In addition,
    > >>>>>> nfs_getcacheblk() could trigger a write RPC from getblk()
    > >>>>>> resulting in sigdeferstop() recursing. Rather than manually
    > >>>>>> deferring stop signals in specific places, change the VFS_*()
    > >>>>>> and VOP_*() methods to defer stop signals for filesystems which
    > >>>>>> request this behavior via a new VFCF_SBDRY flag. Note that this
    > >>>>>> has to be a VFC flag rather than a MNTK flag so that it works
    > >>>>>> properly with VFS_MOUNT() when the mount is not yet fully
    > >>>>>> constructed.  For now, only the NFS clients are set this new
    > >>>>>> flag in VFS_SET(). A few other related changes:
    > >>>>>>  - Add an assertion to ensure that TDF_SBDRY doesn't leak to
    > >>>>>> userland.
    > >>>>>>  - When a lookup request uses VOP_READLINK() to follow a
    > >>>>>> symlink, mark the request as being on behalf of the thread
    > >>>>>> performing the lookup (cnp_thread) rather than using a NULL
    > >>>>>> thread pointer. This causes NFS to properly handle signals
    > >>>>>> during this VOP on an interruptible mount.
    > >>>>>>
    > >>>>>>  PR:		kern/176179
    > >>>>>>  Reported by:	Russell Cattelan (sigdeferstop()
    > >>>>>> recursion) Reviewed by:	kib
    > >>>>>>  MFC after:	1 month
    > >>>>> This change is causing init to crash for me on armv6. I'm
    > >>>>> netbooting a PandaBoard and it appears init is receiving a
    > >>>>> SIGABRT before it gets into main().
    > >>>>>
    > >>>>> Do you have any idea where I could look to track down why it is
    > >>>>> doing this?
    > >>>> It is weird. SIGABRT sent by the kernel usually means that
    > >>>> execve(2) already destroyed the previous address space of the
    > >>>> process, but the new image cannot be activated, most likely due
    > >>>> to image format error discovered too late, or resource shortage.
    > >>>>
    > >>>> Could it be that some NFS RPC fails after the patch, but I cannot
    > >>>> imagine why. You would need to track this. Also, verify that the
    > >>>> init binary is correct.
    > >>>>
    > >>>> I tried amd64 netboot, and it worked fine.
    > >>> It looks like this change is not the issue, it just changed the
    > >>> symptom enough for me to not realise I was seeing an issue where
    > >>> it would crash the kernel before. I reinstated this change but
    > >>> only allowed the kernel to access half the memory and it booted
    > >>> correctly.
    > >>>
    > >>> The real issue appears to be related to something in the vm layer
    > >>> not working on ARM boards with too much memory (somewhere between
    > >>> 512MiB and 1GiB).
    > >>
    > >> The recently introduced auto-sizing and cap may be too optimistic.
    > >> In fact, they are greater than what we allow on 32-bit x86 and
    > >> 32-bit MIPS.  Try the following.
    > >>
    > >> Index: arm/include/vmparam.h
    > >> ===================================================================
    > >> --- arm/include/vmparam.h	(revision 247249)
    > >> +++ arm/include/vmparam.h	(working copy)
    > >> @@ -142,15 +142,15 @@
    > >>  #define VM_KMEM_SIZE		(12*1024*1024)
    > >>  #endif
    > >>  #ifndef VM_KMEM_SIZE_SCALE
    > >> -#define VM_KMEM_SIZE_SCALE	(2)
    > >> +#define VM_KMEM_SIZE_SCALE	(3)
    > >>  #endif
    > >>  
    > >>  /*
    > >> - * Ceiling on the size of the kmem submap: 60% of the kernel map.
    > >> + * Ceiling on the size of the kmem submap: 40% of the kernel map.
    > >>   */
    > >>  #ifndef VM_KMEM_SIZE_MAX
    > >>  #define	VM_KMEM_SIZE_MAX	((vm_max_kernel_address - \
    > >> -    VM_MIN_KERNEL_ADDRESS + 1) * 3 / 5)
    > >> +    VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
    > >>  #endif
    > >>  
    > >>  #define MAXTSIZ 	(16*1024*1024)
    > >>
    > > This patch fixes the boot for me. Is it likely we will see similar
    > > issues with boards with more memory with this? I know of ARM boards
    > > with 2GiB of ram, and I would expect to see some with more soon.
    > >
    > 
    > The kmem submap should be fine, but other things might become a
    > problem.
    > 
    > What do "sysctl -x vm.min_kernel_address" and "sysctl -x
    > vm.max_kernel_address" report on your machine?
    
    I get the following.
    
    # sysctl -x vm.min_kernel_address
    vm.min_kernel_address: 0xc0000000
    # sysctl -x vm.max_kernel_address
    vm.max_kernel_address: 0xdf000000
    
    Andrew
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 08:17:34 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id D0C99518;
     Tue, 26 Feb 2013 08:17:34 +0000 (UTC) (envelope-from alc@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id B90AC3CE;
     Tue, 26 Feb 2013 08:17:34 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1Q8HYln028049;
     Tue, 26 Feb 2013 08:17:34 GMT (envelope-from alc@svn.freebsd.org)
    Received: (from alc@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1Q8HY19028048;
     Tue, 26 Feb 2013 08:17:34 GMT (envelope-from alc@svn.freebsd.org)
    Message-Id: <201302260817.r1Q8HY19028048@svn.freebsd.org>
    From: Alan Cox 
    Date: Tue, 26 Feb 2013 08:17:34 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247314 - head/sys/arm/include
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 08:17:34 -0000
    
    Author: alc
    Date: Tue Feb 26 08:17:34 2013
    New Revision: 247314
    URL: http://svnweb.freebsd.org/changeset/base/247314
    
    Log:
      Be more conservative in auto-sizing and capping the kmem submap.  In
      fact, use the same values here that we use on 32-bit x86 and MIPS.  Some
      machines were reported to have problems with the more aggressive values.
      
      Reported and tested by:	andrew
    
    Modified:
      head/sys/arm/include/vmparam.h
    
    Modified: head/sys/arm/include/vmparam.h
    ==============================================================================
    --- head/sys/arm/include/vmparam.h	Tue Feb 26 07:41:34 2013	(r247313)
    +++ head/sys/arm/include/vmparam.h	Tue Feb 26 08:17:34 2013	(r247314)
    @@ -142,15 +142,15 @@
     #define VM_KMEM_SIZE		(12*1024*1024)
     #endif
     #ifndef VM_KMEM_SIZE_SCALE
    -#define VM_KMEM_SIZE_SCALE	(2)
    +#define VM_KMEM_SIZE_SCALE	(3)
     #endif
     
     /*
    - * Ceiling on the size of the kmem submap: 60% of the kernel map.
    + * Ceiling on the size of the kmem submap: 40% of the kernel map.
      */
     #ifndef VM_KMEM_SIZE_MAX
     #define	VM_KMEM_SIZE_MAX	((vm_max_kernel_address - \
    -    VM_MIN_KERNEL_ADDRESS + 1) * 3 / 5)
    +    VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
     #endif
     
     #define MAXTSIZ 	(16*1024*1024)
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 10:24:49 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id D14E4FC;
     Tue, 26 Feb 2013 10:24:49 +0000 (UTC)
     (envelope-from adrian@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id AAE50A36;
     Tue, 26 Feb 2013 10:24:49 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QAOncw067218;
     Tue, 26 Feb 2013 10:24:49 GMT (envelope-from adrian@svn.freebsd.org)
    Received: (from adrian@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QAOnUO067217;
     Tue, 26 Feb 2013 10:24:49 GMT (envelope-from adrian@svn.freebsd.org)
    Message-Id: <201302261024.r1QAOnUO067217@svn.freebsd.org>
    From: Adrian Chadd 
    Date: Tue, 26 Feb 2013 10:24:49 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247317 - head/sys/dev/ath/ath_rate/sample
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 10:24:49 -0000
    
    Author: adrian
    Date: Tue Feb 26 10:24:49 2013
    New Revision: 247317
    URL: http://svnweb.freebsd.org/changeset/base/247317
    
    Log:
      Update the EWMA statistics for each intermediary rate as well as the final
      rate.
      
      This fixes two things:
      
      * The intermediary rates now also have their EWMA values changed;
      * The existing code was using the wrong value for longtries - so the
        EWMA stats were only adjusted for the first rate and not subsequent
        rates in a MRR setup.
      
      TODO:
      
      * Merge the EWMA updates into update_stats() now..
    
    Modified:
      head/sys/dev/ath/ath_rate/sample/sample.c
    
    Modified: head/sys/dev/ath/ath_rate/sample/sample.c
    ==============================================================================
    --- head/sys/dev/ath/ath_rate/sample/sample.c	Tue Feb 26 08:53:33 2013	(r247316)
    +++ head/sys/dev/ath/ath_rate/sample/sample.c	Tue Feb 26 10:24:49 2013	(r247317)
    @@ -1008,6 +1008,15 @@ ath_rate_tx_complete(struct ath_softc *s
     				     short_tries, long_tries,
     				     long_tries > rc[0].tries,
     				     nframes, nbad);
    +			update_ewma_stats(sc, an, frame_size,
    +				     rc[0].rix, rc[0].tries,
    +				     rc[1].rix, rc[1].tries,
    +				     rc[2].rix, rc[2].tries,
    +				     rc[3].rix, rc[3].tries,
    +				     short_tries, long_tries,
    +				     long_tries > rc[0].tries,
    +				     nframes, nbad);
    +
     			long_tries -= rc[0].tries;
     		}
     		
    @@ -1020,6 +1029,14 @@ ath_rate_tx_complete(struct ath_softc *s
     				     short_tries, long_tries,
     				     status,
     				     nframes, nbad);
    +			update_ewma_stats(sc, an, frame_size,
    +				     rc[1].rix, rc[1].tries,
    +				     rc[2].rix, rc[2].tries,
    +				     rc[3].rix, rc[3].tries,
    +				     0, 0,
    +				     short_tries, long_tries,
    +				     status,
    +				     nframes, nbad);
     			long_tries -= rc[1].tries;
     		}
     
    @@ -1032,6 +1049,14 @@ ath_rate_tx_complete(struct ath_softc *s
     				     short_tries, long_tries,
     				     status,
     				     nframes, nbad);
    +			update_ewma_stats(sc, an, frame_size,
    +				     rc[2].rix, rc[2].tries,
    +				     rc[3].rix, rc[3].tries,
    +				     0, 0,
    +				     0, 0,
    +				     short_tries, long_tries,
    +				     status,
    +				     nframes, nbad);
     			long_tries -= rc[2].tries;
     		}
     
    @@ -1044,17 +1069,15 @@ ath_rate_tx_complete(struct ath_softc *s
     				     short_tries, long_tries,
     				     status,
     				     nframes, nbad);
    +			update_ewma_stats(sc, an, frame_size,
    +				     rc[3].rix, rc[3].tries,
    +				     0, 0,
    +				     0, 0,
    +				     0, 0,
    +				     short_tries, long_tries,
    +				     status,
    +				     nframes, nbad);
     		}
    -
    -		update_ewma_stats(sc, an, frame_size,
    -			     rc[0].rix, rc[0].tries,
    -			     rc[1].rix, rc[1].tries,
    -			     rc[2].rix, rc[2].tries,
    -			     rc[3].rix, rc[3].tries,
    -			     short_tries, long_tries,
    -			     long_tries > rc[0].tries,
    -			     nframes, nbad);
    -
     	}
     }
     
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 13:59:40 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 56EC9FC8;
     Tue, 26 Feb 2013 13:59:40 +0000 (UTC) (envelope-from mav@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 4991A666;
     Tue, 26 Feb 2013 13:59:40 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QDxeX0031012;
     Tue, 26 Feb 2013 13:59:40 GMT (envelope-from mav@svn.freebsd.org)
    Received: (from mav@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QDxe64031009;
     Tue, 26 Feb 2013 13:59:40 GMT (envelope-from mav@svn.freebsd.org)
    Message-Id: <201302261359.r1QDxe64031009@svn.freebsd.org>
    From: Alexander Motin 
    Date: Tue, 26 Feb 2013 13:59:40 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247318 - head/sys/dev/hwpmc
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 13:59:40 -0000
    
    Author: mav
    Date: Tue Feb 26 13:59:39 2013
    New Revision: 247318
    URL: http://svnweb.freebsd.org/changeset/base/247318
    
    Log:
      Change the way how software PMC updates counters.
      This at least fixes -n option of pmcstat.
      
      Reviewed by:	fabient
    
    Modified:
      head/sys/dev/hwpmc/hwpmc_soft.c
    
    Modified: head/sys/dev/hwpmc/hwpmc_soft.c
    ==============================================================================
    --- head/sys/dev/hwpmc/hwpmc_soft.c	Tue Feb 26 10:24:49 2013	(r247317)
    +++ head/sys/dev/hwpmc/hwpmc_soft.c	Tue Feb 26 13:59:39 2013	(r247318)
    @@ -408,8 +408,11 @@ pmc_soft_intr(struct pmckern_soft *ks)
     		}
     
     		processed = 1;
    -		pc->soft_values[ri]++;
     		if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) {
    +			if ((pc->soft_values[ri]--) <= 0)
    +				pc->soft_values[ri] += pm->pm_sc.pm_reloadcount;
    +			else
    +				continue;
     			user_mode = TRAPF_USERMODE(ks->pm_tf);
     			error = pmc_process_interrupt(ks->pm_cpu, PMC_SR, pm,
     			    ks->pm_tf, user_mode);
    @@ -424,7 +427,8 @@ pmc_soft_intr(struct pmckern_soft *ks)
     				 */
     				curthread->td_flags |= TDF_ASTPENDING;
     			}
    -		}
    +		} else
    +			pc->soft_values[ri]++;
     	}
     
     	atomic_add_int(processed ? &pmc_stats.pm_intr_processed :
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 16:49:08 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 9AD74869;
     Tue, 26 Feb 2013 16:49:08 +0000 (UTC) (envelope-from jhb@freebsd.org)
    Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net
     [IPv6:2001:470:1f10:75::2])
     by mx1.freebsd.org (Postfix) with ESMTP id 5F199F3C;
     Tue, 26 Feb 2013 16:49:08 +0000 (UTC)
    Received: from jhbbsd.localnet (unknown [209.249.190.124])
     by bigwig.baldwin.cx (Postfix) with ESMTPSA id 44851B97D;
     Tue, 26 Feb 2013 11:49:07 -0500 (EST)
    From: John Baldwin 
    To: Xin LI 
    Subject: Re: svn commit: r247300 - in head: sys/sys usr.bin/truss
    Date: Tue, 26 Feb 2013 09:41:52 -0500
    User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; )
    References: <201302260213.r1Q2D2N1016801@svn.freebsd.org>
    In-Reply-To: <201302260213.r1Q2D2N1016801@svn.freebsd.org>
    MIME-Version: 1.0
    Content-Type: Text/Plain;
      charset="utf-8"
    Content-Transfer-Encoding: 7bit
    Message-Id: <201302260941.52534.jhb@freebsd.org>
    X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7
     (bigwig.baldwin.cx); Tue, 26 Feb 2013 11:49:07 -0500 (EST)
    Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
     src-committers@freebsd.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 16:49:08 -0000
    
    On Monday, February 25, 2013 9:13:02 pm Xin LI wrote:
    > Author: delphij
    > Date: Tue Feb 26 02:13:02 2013
    > New Revision: 247300
    > URL: http://svnweb.freebsd.org/changeset/base/247300
    > 
    > Log:
    >   Expose timespec and timeval macros when __BSD_VISIBLE is defined.  This
    >   allows userland application to use the following macros:
    >   
    >   	timespecclear, timespecisset, timespeccmp, timespecadd,
    >   	timespecsub;
    >   
    >   	timevalclear, timevalisset, timevalcmp.
    
    Why not fix truss to use the stock functions instead of keeping private 
    "unusual" versions?
    
    -- 
    John Baldwin
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 17:09:49 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id A25A6211;
     Tue, 26 Feb 2013 17:09:49 +0000 (UTC)
     (envelope-from davide.italiano@gmail.com)
    Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com
     [209.85.212.171])
     by mx1.freebsd.org (Postfix) with ESMTP id 9E4D810BA;
     Tue, 26 Feb 2013 17:09:48 +0000 (UTC)
    Received: by mail-wi0-f171.google.com with SMTP id hn17so5177420wib.4
     for ; Tue, 26 Feb 2013 09:09:42 -0800 (PST)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
     h=mime-version:x-received:sender:in-reply-to:references:date
     :x-google-sender-auth:message-id:subject:from:to:cc:content-type;
     bh=htnbC5Zcd07c4KcFbdcuhqwEtYPdst+KV+L2JNUjJyo=;
     b=BfLhdW45GYNBXLCVla1BX8b93ewTrlI9iwPR88zODvKT3jd56e224Pm9F8e4T5chUl
     nzaOs90sDQJoCqqBQe3JhLLRfGqUQE3E/9fnEKFXdLl8ZZ8DLrihC9vxut6MAGYbjToU
     aiBlDTGuC22zU2FtTjwBGrox7Bmfu9rZkk59bHSU33MeKRbp7PBO6b0PmKKAtsNjMbVl
     FWoZ5TmC83N3HgvOGrjGARdKnK7iiq3x9q8YZCGg7CVmBKoFQvL0XJuEGNW0KUaa/DmB
     LRcka3Mu+bm6RGAmO8MNePXAExoVrx4z7i918jkVvpji9PjpD6B1rOKkbd6C+0C5f//T
     yXhA==
    MIME-Version: 1.0
    X-Received: by 10.194.119.68 with SMTP id ks4mr28071775wjb.3.1361898582471;
     Tue, 26 Feb 2013 09:09:42 -0800 (PST)
    Sender: davide.italiano@gmail.com
    Received: by 10.180.105.197 with HTTP; Tue, 26 Feb 2013 09:09:42 -0800 (PST)
    In-Reply-To: <201302260941.52534.jhb@freebsd.org>
    References: <201302260213.r1Q2D2N1016801@svn.freebsd.org>
     <201302260941.52534.jhb@freebsd.org>
    Date: Tue, 26 Feb 2013 18:09:42 +0100
    X-Google-Sender-Auth: yDYu8RCWnvKCQR6QaVDWn7wRIvU
    Message-ID: 
    Subject: Re: svn commit: r247300 - in head: sys/sys usr.bin/truss
    From: Davide Italiano 
    To: John Baldwin 
    Content-Type: text/plain; charset=ISO-8859-1
    Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
     src-committers@freebsd.org, Xin LI 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 17:09:49 -0000
    
    On Tue, Feb 26, 2013 at 3:41 PM, John Baldwin  wrote:
    > On Monday, February 25, 2013 9:13:02 pm Xin LI wrote:
    >> Author: delphij
    >> Date: Tue Feb 26 02:13:02 2013
    >> New Revision: 247300
    >> URL: http://svnweb.freebsd.org/changeset/base/247300
    >>
    >> Log:
    >>   Expose timespec and timeval macros when __BSD_VISIBLE is defined.  This
    >>   allows userland application to use the following macros:
    >>
    >>       timespecclear, timespecisset, timespeccmp, timespecadd,
    >>       timespecsub;
    >>
    >>       timevalclear, timevalisset, timevalcmp.
    >
    > Why not fix truss to use the stock functions instead of keeping private
    > "unusual" versions?
    >
    > --
    > John Baldwin
    
    time.h is already a mess in terms of namespace pollution, and this
    exposure might not help thing.
    Other details here:
    http://permalink.gmane.org/gmane.os.freebsd.architechture/15518
    
    -- 
    Davide
    
    "There are no solved problems; there are only problems that are more
    or less solved" -- Henri Poincare
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 17:22:10 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 1F18E761;
     Tue, 26 Feb 2013 17:22:10 +0000 (UTC)
     (envelope-from attilio@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 02C511144;
     Tue, 26 Feb 2013 17:22:10 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QHM9vI095027;
     Tue, 26 Feb 2013 17:22:09 GMT (envelope-from attilio@svn.freebsd.org)
    Received: (from attilio@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QHM9Sn095015;
     Tue, 26 Feb 2013 17:22:09 GMT (envelope-from attilio@svn.freebsd.org)
    Message-Id: <201302261722.r1QHM9Sn095015@svn.freebsd.org>
    From: Attilio Rao 
    Date: Tue, 26 Feb 2013 17:22:09 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247323 - head/sys/vm
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 17:22:10 -0000
    
    Author: attilio
    Date: Tue Feb 26 17:22:08 2013
    New Revision: 247323
    URL: http://svnweb.freebsd.org/changeset/base/247323
    
    Log:
      Wrap the sleeps synchronized by the vm_object lock into the specific
      macro VM_OBJECT_SLEEP().
      This hides some implementation details like the usage of the msleep()
      primitive and the necessity to access to the lock address directly.
      For this reason VM_OBJECT_MTX() macro is now retired.
      
      Sponsored by:	EMC / Isilon storage division
      Reviewed by:	alc
      Tested by:	pho
    
    Modified:
      head/sys/vm/swap_pager.c
      head/sys/vm/vm_object.c
      head/sys/vm/vm_object.h
      head/sys/vm/vm_page.c
      head/sys/vm/vnode_pager.c
    
    Modified: head/sys/vm/swap_pager.c
    ==============================================================================
    --- head/sys/vm/swap_pager.c	Tue Feb 26 16:55:59 2013	(r247322)
    +++ head/sys/vm/swap_pager.c	Tue Feb 26 17:22:08 2013	(r247323)
    @@ -1213,7 +1213,7 @@ swap_pager_getpages(vm_object_t object, 
     	while ((mreq->oflags & VPO_SWAPINPROG) != 0) {
     		mreq->oflags |= VPO_WANTED;
     		PCPU_INC(cnt.v_intrans);
    -		if (msleep(mreq, VM_OBJECT_MTX(object), PSWP, "swread", hz*20)) {
    +		if (VM_OBJECT_SLEEP(object, mreq, PSWP, "swread", hz * 20)) {
     			printf(
     "swap_pager: indefinite wait buffer: bufobj: %p, blkno: %jd, size: %ld\n",
     			    bp->b_bufobj, (intmax_t)bp->b_blkno, bp->b_bcount);
    
    Modified: head/sys/vm/vm_object.c
    ==============================================================================
    --- head/sys/vm/vm_object.c	Tue Feb 26 16:55:59 2013	(r247322)
    +++ head/sys/vm/vm_object.c	Tue Feb 26 17:22:08 2013	(r247323)
    @@ -387,7 +387,7 @@ vm_object_pip_wait(vm_object_t object, c
     	VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
     	while (object->paging_in_progress) {
     		object->flags |= OBJ_PIPWNT;
    -		msleep(object, VM_OBJECT_MTX(object), PVM, waitid, 0);
    +		VM_OBJECT_SLEEP(object, object, PVM, waitid, 0);
     	}
     }
     
    @@ -579,8 +579,7 @@ retry:
     					} else if (object->paging_in_progress) {
     						VM_OBJECT_UNLOCK(robject);
     						object->flags |= OBJ_PIPWNT;
    -						msleep(object,
    -						    VM_OBJECT_MTX(object),
    +						VM_OBJECT_SLEEP(object, object,
     						    PDROP | PVM, "objde2", 0);
     						VM_OBJECT_LOCK(robject);
     						temp = robject->backing_object;
    @@ -1139,8 +1138,7 @@ shadowlookup:
     			if (object != tobject)
     				VM_OBJECT_UNLOCK(object);
     			m->oflags |= VPO_WANTED;
    -			msleep(m, VM_OBJECT_MTX(tobject), PDROP | PVM, "madvpo",
    -			    0);
    +			VM_OBJECT_SLEEP(tobject, m, PDROP | PVM, "madvpo" , 0);
     			VM_OBJECT_LOCK(object);
       			goto relookup;
     		}
    @@ -1338,7 +1336,7 @@ retry:
     		if ((m->oflags & VPO_BUSY) || m->busy) {
     			VM_OBJECT_UNLOCK(new_object);
     			m->oflags |= VPO_WANTED;
    -			msleep(m, VM_OBJECT_MTX(orig_object), PVM, "spltwt", 0);
    +			VM_OBJECT_SLEEP(orig_object, m, PVM, "spltwt" , 0);
     			VM_OBJECT_LOCK(new_object);
     			goto retry;
     		}
    @@ -1496,7 +1494,7 @@ vm_object_backing_scan(vm_object_t objec
     				if ((p->oflags & VPO_BUSY) || p->busy) {
     					VM_OBJECT_UNLOCK(object);
     					p->oflags |= VPO_WANTED;
    -					msleep(p, VM_OBJECT_MTX(backing_object),
    +					VM_OBJECT_SLEEP(backing_object, p,
     					    PDROP | PVM, "vmocol", 0);
     					VM_OBJECT_LOCK(object);
     					VM_OBJECT_LOCK(backing_object);
    
    Modified: head/sys/vm/vm_object.h
    ==============================================================================
    --- head/sys/vm/vm_object.h	Tue Feb 26 16:55:59 2013	(r247322)
    +++ head/sys/vm/vm_object.h	Tue Feb 26 17:22:08 2013	(r247323)
    @@ -210,7 +210,9 @@ extern struct vm_object kmem_object_stor
     					mtx_init(&(object)->mtx, "vm object", \
     					    (type), MTX_DEF | MTX_DUPOK)
     #define	VM_OBJECT_LOCKED(object)	mtx_owned(&(object)->mtx)
    -#define	VM_OBJECT_MTX(object)		(&(object)->mtx)
    +#define	VM_OBJECT_SLEEP(object, wchan, pri, wmesg, timo) \
    +					msleep((wchan), &(object)->mtx, (pri), \
    +					    (wmesg), (timo))
     #define	VM_OBJECT_TRYLOCK(object)	mtx_trylock(&(object)->mtx)
     #define	VM_OBJECT_UNLOCK(object)	mtx_unlock(&(object)->mtx)
     
    
    Modified: head/sys/vm/vm_page.c
    ==============================================================================
    --- head/sys/vm/vm_page.c	Tue Feb 26 16:55:59 2013	(r247322)
    +++ head/sys/vm/vm_page.c	Tue Feb 26 17:22:08 2013	(r247323)
    @@ -763,7 +763,7 @@ vm_page_sleep(vm_page_t m, const char *m
     	 * it.
     	 */
     	m->oflags |= VPO_WANTED;
    -	msleep(m, VM_OBJECT_MTX(m->object), PVM, msg, 0);
    +	VM_OBJECT_SLEEP(m->object, m, PVM, msg, 0);
     }
     
     /*
    
    Modified: head/sys/vm/vnode_pager.c
    ==============================================================================
    --- head/sys/vm/vnode_pager.c	Tue Feb 26 16:55:59 2013	(r247322)
    +++ head/sys/vm/vnode_pager.c	Tue Feb 26 17:22:08 2013	(r247323)
    @@ -116,7 +116,7 @@ vnode_create_vobject(struct vnode *vp, o
     		}
     		VOP_UNLOCK(vp, 0);
     		vm_object_set_flag(object, OBJ_DISCONNECTWNT);
    -		msleep(object, VM_OBJECT_MTX(object), PDROP | PVM, "vodead", 0);
    +		VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vodead" , 0);
     		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
     	}
     
    @@ -210,7 +210,7 @@ retry:
     		if ((object->flags & OBJ_DEAD) == 0)
     			break;
     		vm_object_set_flag(object, OBJ_DISCONNECTWNT);
    -		msleep(object, VM_OBJECT_MTX(object), PDROP | PVM, "vadead", 0);
    +		VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vadead" , 0);
     	}
     
     	if (vp->v_usecount == 0)
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 18:13:43 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id CB507ED5;
     Tue, 26 Feb 2013 18:13:43 +0000 (UTC) (envelope-from mav@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id BAD6B158A;
     Tue, 26 Feb 2013 18:13:43 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QIDh9V010788;
     Tue, 26 Feb 2013 18:13:43 GMT (envelope-from mav@svn.freebsd.org)
    Received: (from mav@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QIDhNU010783;
     Tue, 26 Feb 2013 18:13:43 GMT (envelope-from mav@svn.freebsd.org)
    Message-Id: <201302261813.r1QIDhNU010783@svn.freebsd.org>
    From: Alexander Motin 
    Date: Tue, 26 Feb 2013 18:13:43 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247329 - in head: lib/libpmc sys/dev/hwpmc sys/kern
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 18:13:43 -0000
    
    Author: mav
    Date: Tue Feb 26 18:13:42 2013
    New Revision: 247329
    URL: http://svnweb.freebsd.org/changeset/base/247329
    
    Log:
      Add support for good old 8192Hz profiling clock to software PMC.
      
      Reviewed by:	fabient
    
    Modified:
      head/lib/libpmc/pmc.soft.3
      head/sys/dev/hwpmc/hwpmc_soft.c
      head/sys/kern/kern_clock.c
      head/sys/kern/kern_clocksource.c
    
    Modified: head/lib/libpmc/pmc.soft.3
    ==============================================================================
    --- head/lib/libpmc/pmc.soft.3	Tue Feb 26 18:11:43 2013	(r247328)
    +++ head/lib/libpmc/pmc.soft.3	Tue Feb 26 18:13:42 2013	(r247329)
    @@ -23,7 +23,7 @@
     .\"
     .\" $FreeBSD$
     .\"
    -.Dd March 28, 2012
    +.Dd February 26, 2013
     .Dt PMC.SOFT 3
     .Os
     .Sh NAME
    @@ -61,6 +61,8 @@ The event specifiers supported by softwa
     Hard clock ticks.
     .It Li CLOCK.STAT
     Stat clock ticks.
    +.It Li CLOCK.PROF
    +Profiling clock ticks.
     .It Li LOCK.FAILED
     Lock acquisition failed.
     .It Li PAGE_FAULT.ALL
    
    Modified: head/sys/dev/hwpmc/hwpmc_soft.c
    ==============================================================================
    --- head/sys/dev/hwpmc/hwpmc_soft.c	Tue Feb 26 18:11:43 2013	(r247328)
    +++ head/sys/dev/hwpmc/hwpmc_soft.c	Tue Feb 26 18:13:42 2013	(r247329)
    @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$");
     #define	SOFT_CAPS (PMC_CAP_READ | PMC_CAP_WRITE | PMC_CAP_INTERRUPT | \
         PMC_CAP_USER | PMC_CAP_SYSTEM)
     
    +PMC_SOFT_DECLARE( , , clock, prof);
    +
     struct soft_descr {
     	struct pmc_descr pm_descr;  /* "base class" */
     };
    @@ -125,6 +127,8 @@ soft_allocate_pmc(int cpu, int ri, struc
     		return (EINVAL);
     	pmc_soft_ev_release(ps);
     
    +	if (ev == pmc___clock_prof.ps_ev.pm_ev_code)
    +		cpu_startprofclock();
     	return (0);
     }
     
    @@ -324,9 +328,8 @@ soft_release_pmc(int cpu, int ri, struct
     	KASSERT(phw->phw_pmc == NULL,
     	    ("[soft,%d] PHW pmc %p non-NULL", __LINE__, phw->phw_pmc));
     
    -	/*
    -	 * Nothing to do.
    -	 */
    +	if (pmc->pm_event == pmc___clock_prof.ps_ev.pm_ev_code)
    +		cpu_stopprofclock();
     	return (0);
     }
     
    
    Modified: head/sys/kern/kern_clock.c
    ==============================================================================
    --- head/sys/kern/kern_clock.c	Tue Feb 26 18:11:43 2013	(r247328)
    +++ head/sys/kern/kern_clock.c	Tue Feb 26 18:13:42 2013	(r247329)
    @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$");
     #include 
     PMC_SOFT_DEFINE( , , clock, hard);
     PMC_SOFT_DEFINE( , , clock, stat);
    +PMC_SOFT_DEFINE( , , clock, prof);
     #endif
     
     #ifdef DEVICE_POLLING
    @@ -817,6 +818,10 @@ profclock_cnt(int cnt, int usermode, uin
     		}
     	}
     #endif
    +#ifdef HWPMC_HOOKS
    +	if (td->td_intr_frame != NULL)
    +		PMC_SOFT_CALL_TF( , , clock, prof, td->td_intr_frame);
    +#endif
     }
     
     /*
    
    Modified: head/sys/kern/kern_clocksource.c
    ==============================================================================
    --- head/sys/kern/kern_clocksource.c	Tue Feb 26 18:11:43 2013	(r247328)
    +++ head/sys/kern/kern_clocksource.c	Tue Feb 26 18:13:42 2013	(r247329)
    @@ -732,12 +732,15 @@ cpu_startprofclock(void)
     {
     
     	ET_LOCK();
    -	if (periodic) {
    -		configtimer(0);
    -		profiling = 1;
    -		configtimer(1);
    +	if (profiling == 0) {
    +		if (periodic) {
    +			configtimer(0);
    +			profiling = 1;
    +			configtimer(1);
    +		} else
    +			profiling = 1;
     	} else
    -		profiling = 1;
    +		profiling++;
     	ET_UNLOCK();
     }
     
    @@ -749,12 +752,15 @@ cpu_stopprofclock(void)
     {
     
     	ET_LOCK();
    -	if (periodic) {
    -		configtimer(0);
    +	if (profiling == 1) {
    +		if (periodic) {
    +			configtimer(0);
    +			profiling = 0;
    +			configtimer(1);
    +		} else
     		profiling = 0;
    -		configtimer(1);
     	} else
    -		profiling = 0;
    +		profiling--;
     	ET_UNLOCK();
     }
     
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 18:30:48 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 84CE4661;
     Tue, 26 Feb 2013 18:30:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 5F2E0166B;
     Tue, 26 Feb 2013 18:30:48 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QIUlHV014978;
     Tue, 26 Feb 2013 18:30:47 GMT (envelope-from jhb@svn.freebsd.org)
    Received: (from jhb@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QIUlnS014977;
     Tue, 26 Feb 2013 18:30:47 GMT (envelope-from jhb@svn.freebsd.org)
    Message-Id: <201302261830.r1QIUlnS014977@svn.freebsd.org>
    From: John Baldwin 
    Date: Tue, 26 Feb 2013 18:30:47 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247332 - head/sys/dev/cpufreq
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 18:30:48 -0000
    
    Author: jhb
    Date: Tue Feb 26 18:30:47 2013
    New Revision: 247332
    URL: http://svnweb.freebsd.org/changeset/base/247332
    
    Log:
      Add a quirk to disable this driver for certain older laptops with an ICH2
      southbridge and an Intel 82815_MC host bridge where the host bridge's
      revision is less than 5.
      
      Tested by:	mi
      MFC after:	1 week
    
    Modified:
      head/sys/dev/cpufreq/ichss.c
    
    Modified: head/sys/dev/cpufreq/ichss.c
    ==============================================================================
    --- head/sys/dev/cpufreq/ichss.c	Tue Feb 26 18:19:51 2013	(r247331)
    +++ head/sys/dev/cpufreq/ichss.c	Tue Feb 26 18:30:47 2013	(r247332)
    @@ -67,7 +67,7 @@ struct ichss_softc {
     #define PCI_DEV_82801BA		0x244c /* ICH2M */
     #define PCI_DEV_82801CA		0x248c /* ICH3M */
     #define PCI_DEV_82801DB		0x24cc /* ICH4M */
    -#define PCI_DEV_82815BA		0x1130 /* Unsupported/buggy part */
    +#define PCI_DEV_82815_MC	0x1130 /* Unsupported/buggy part */
     
     /* PCI config registers for finding PMBASE and enabling SpeedStep. */
     #define ICHSS_PMBASE_OFFSET	0x40
    @@ -155,9 +155,6 @@ ichss_identify(driver_t *driver, device_
     	 * E.g. see Section 6.1 "PCI Devices and Functions" and table 6.1 of
     	 * Intel(r) 82801BA I/O Controller Hub 2 (ICH2) and Intel(r) 82801BAM
     	 * I/O Controller Hub 2 Mobile (ICH2-M).
    -	 *
    -	 * TODO: add a quirk to disable if we see the 82815_MC along
    -	 * with the 82801BA and revision < 5.
     	 */
     	ich_device = pci_find_bsf(0, 0x1f, 0);
     	if (ich_device == NULL ||
    @@ -167,6 +164,22 @@ ichss_identify(driver_t *driver, device_
     	    pci_get_device(ich_device) != PCI_DEV_82801DB))
     		return;
     
    +	/*
    +	 * Certain systems with ICH2 and an Intel 82815_MC host bridge
    +	 * where the host bridge's revision is < 5 lockup if SpeedStep
    +	 * is used.
    +	 */
    +	if (pci_get_device(ich_device) == PCI_DEV_82801BA) {
    +		device_t hostb;
    +
    +		hostb = pci_find_bsf(0, 0, 0);
    +		if (hostb != NULL &&
    +		    pci_get_vendor(hostb) == PCI_VENDOR_INTEL &&
    +		    pci_get_device(hostb) == PCI_DEV_82815_MC &&
    +		    pci_get_revid(hostb) < 5)
    +			return;
    +	}
    +
     	/* Find the PMBASE register from our PCI config header. */
     	pmbase = pci_read_config(ich_device, ICHSS_PMBASE_OFFSET,
     	    sizeof(pmbase));
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 18:33:24 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 46859B64;
     Tue, 26 Feb 2013 18:33:24 +0000 (UTC)
     (envelope-from delphij@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 3939816D9;
     Tue, 26 Feb 2013 18:33:24 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QIXNQ7016869;
     Tue, 26 Feb 2013 18:33:24 GMT (envelope-from delphij@svn.freebsd.org)
    Received: (from delphij@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QIXNeJ016867;
     Tue, 26 Feb 2013 18:33:23 GMT (envelope-from delphij@svn.freebsd.org)
    Message-Id: <201302261833.r1QIXNeJ016867@svn.freebsd.org>
    From: Xin LI 
    Date: Tue, 26 Feb 2013 18:33:23 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247334 - head/sys/dev/random
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 18:33:24 -0000
    
    Author: delphij
    Date: Tue Feb 26 18:33:23 2013
    New Revision: 247334
    URL: http://svnweb.freebsd.org/changeset/base/247334
    
    Log:
      Correct a typo introduced in r153575, which gives inverted logic when
      handling blocking semantics when seeding.
      
      PR:		kern/143298
      Submitted by:	James Juran 
      Reviewed by:	markm
      MFC after:	3 days
    
    Modified:
      head/sys/dev/random/randomdev_soft.c
    
    Modified: head/sys/dev/random/randomdev_soft.c
    ==============================================================================
    --- head/sys/dev/random/randomdev_soft.c	Tue Feb 26 18:31:03 2013	(r247333)
    +++ head/sys/dev/random/randomdev_soft.c	Tue Feb 26 18:33:23 2013	(r247334)
    @@ -391,7 +391,7 @@ random_yarrow_block(int flag)
     	mtx_lock(&random_reseed_mtx);
     
     	/* Blocking logic */
    -	while (random_systat.seeded && !error) {
    +	while (!random_systat.seeded && !error) {
     		if (flag & O_NONBLOCK)
     			error = EWOULDBLOCK;
     		else {
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 18:35:56 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 79243EC0;
     Tue, 26 Feb 2013 18:35:56 +0000 (UTC) (envelope-from jhb@freebsd.org)
    Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net
     [IPv6:2001:470:1f10:75::2])
     by mx1.freebsd.org (Postfix) with ESMTP id 55FFC1716;
     Tue, 26 Feb 2013 18:35:56 +0000 (UTC)
    Received: from jhbbsd.localnet (unknown [209.249.190.124])
     by bigwig.baldwin.cx (Postfix) with ESMTPSA id 84E42B958;
     Tue, 26 Feb 2013 13:35:55 -0500 (EST)
    From: John Baldwin 
    To: Davide Italiano 
    Subject: Re: svn commit: r247300 - in head: sys/sys usr.bin/truss
    Date: Tue, 26 Feb 2013 13:35:30 -0500
    User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; )
    References: <201302260213.r1Q2D2N1016801@svn.freebsd.org>
     <201302260941.52534.jhb@freebsd.org>
     
    In-Reply-To: 
    MIME-Version: 1.0
    Content-Type: Text/Plain;
      charset="iso-8859-1"
    Content-Transfer-Encoding: 7bit
    Message-Id: <201302261335.38001.jhb@freebsd.org>
    X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7
     (bigwig.baldwin.cx); Tue, 26 Feb 2013 13:35:55 -0500 (EST)
    Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
     src-committers@freebsd.org, Xin LI 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 18:35:56 -0000
    
    On Tuesday, February 26, 2013 12:09:42 pm Davide Italiano wrote:
    > On Tue, Feb 26, 2013 at 3:41 PM, John Baldwin  wrote:
    > > On Monday, February 25, 2013 9:13:02 pm Xin LI wrote:
    > >> Author: delphij
    > >> Date: Tue Feb 26 02:13:02 2013
    > >> New Revision: 247300
    > >> URL: http://svnweb.freebsd.org/changeset/base/247300
    > >>
    > >> Log:
    > >>   Expose timespec and timeval macros when __BSD_VISIBLE is defined.  This
    > >>   allows userland application to use the following macros:
    > >>
    > >>       timespecclear, timespecisset, timespeccmp, timespecadd,
    > >>       timespecsub;
    > >>
    > >>       timevalclear, timevalisset, timevalcmp.
    > >
    > > Why not fix truss to use the stock functions instead of keeping private
    > > "unusual" versions?
    > >
    > > --
    > > John Baldwin
    > 
    > time.h is already a mess in terms of namespace pollution, and this
    > exposure might not help thing.
    > Other details here:
    > http://permalink.gmane.org/gmane.os.freebsd.architechture/15518
    
    I think that is orthogonal.  Even if this is reverted I think truss should
    be changed to use the "normal" timespecsubt() macro rather than using a custom
    one with a different argument order.
    
    -- 
    John Baldwin
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 18:51:14 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id E475B79E;
     Tue, 26 Feb 2013 18:51:14 +0000 (UTC)
     (envelope-from davide.italiano@gmail.com)
    Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com
     [209.85.212.179])
     by mx1.freebsd.org (Postfix) with ESMTP id E50F718C0;
     Tue, 26 Feb 2013 18:51:13 +0000 (UTC)
    Received: by mail-wi0-f179.google.com with SMTP id ez12so5079285wid.6
     for ; Tue, 26 Feb 2013 10:51:11 -0800 (PST)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
     h=mime-version:x-received:sender:in-reply-to:references:date
     :x-google-sender-auth:message-id:subject:from:to:cc:content-type;
     bh=o0Dgv56Bs0MTBBC97rngr6PBxxuvxwY2J792oBLqUZQ=;
     b=JwJJgeV3b+RPznHMTKPf7Nk3hsiOnej75lB0lYHY3plvdBfaPJ99AeNkfgDJ026Uos
     U26P2aGrnId5git9pgwsSw4Bkh8jCyOC4wj1HVqCfflTDv9TmgUX71uaM6waZZz5JpJv
     6e5pGxkhF3ZD1VBfxrL8X+fhFfvCDkK4yXZw/+FrJkMXyWOMG4OSzXOAH7d2eKFHJ5c1
     aqmrQPmzUQGub3WkEnbNiWcvWufkyz/0GlaBTwHNcIX+DZAvDNvIvP3Br3VeOovKYaj6
     3knFWPhLMSHmBJXH7fGWshLeCLxKD5jPkkq8aCrFlbeokMOa76HfiVVkXFMER6zF36qq
     y2pA==
    MIME-Version: 1.0
    X-Received: by 10.194.62.170 with SMTP id z10mr28564266wjr.34.1361904671500;
     Tue, 26 Feb 2013 10:51:11 -0800 (PST)
    Sender: davide.italiano@gmail.com
    Received: by 10.180.105.197 with HTTP; Tue, 26 Feb 2013 10:51:11 -0800 (PST)
    In-Reply-To: <201302261335.38001.jhb@freebsd.org>
    References: <201302260213.r1Q2D2N1016801@svn.freebsd.org>
     <201302260941.52534.jhb@freebsd.org>
     
     <201302261335.38001.jhb@freebsd.org>
    Date: Tue, 26 Feb 2013 19:51:11 +0100
    X-Google-Sender-Auth: ozRWSi6Josxuw9Na7wrIZN2XLPg
    Message-ID: 
    Subject: Re: svn commit: r247300 - in head: sys/sys usr.bin/truss
    From: Davide Italiano 
    To: John Baldwin 
    Content-Type: text/plain; charset=ISO-8859-1
    Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
     src-committers@freebsd.org, Xin LI 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 18:51:15 -0000
    
    On Tue, Feb 26, 2013 at 7:35 PM, John Baldwin  wrote:
    > On Tuesday, February 26, 2013 12:09:42 pm Davide Italiano wrote:
    >> On Tue, Feb 26, 2013 at 3:41 PM, John Baldwin  wrote:
    >> > On Monday, February 25, 2013 9:13:02 pm Xin LI wrote:
    >> >> Author: delphij
    >> >> Date: Tue Feb 26 02:13:02 2013
    >> >> New Revision: 247300
    >> >> URL: http://svnweb.freebsd.org/changeset/base/247300
    >> >>
    >> >> Log:
    >> >>   Expose timespec and timeval macros when __BSD_VISIBLE is defined.  This
    >> >>   allows userland application to use the following macros:
    >> >>
    >> >>       timespecclear, timespecisset, timespeccmp, timespecadd,
    >> >>       timespecsub;
    >> >>
    >> >>       timevalclear, timevalisset, timevalcmp.
    >> >
    >> > Why not fix truss to use the stock functions instead of keeping private
    >> > "unusual" versions?
    >> >
    >> > --
    >> > John Baldwin
    >>
    >> time.h is already a mess in terms of namespace pollution, and this
    >> exposure might not help thing.
    >> Other details here:
    >> http://permalink.gmane.org/gmane.os.freebsd.architechture/15518
    >
    > I think that is orthogonal.  Even if this is reverted I think truss should
    > be changed to use the "normal" timespecsubt() macro rather than using a custom
    > one with a different argument order.
    >
    > --
    > John Baldwin
    
    When I talked about "exposure" I referred about timeval/timespec
    macros(). I wasn't arguing about your proposed change.
    Sorry if it wasn't clear.
    
    -- 
    Davide
    
    "There are no solved problems; there are only problems that are more
    or less solved" -- Henri Poincare
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 19:04:00 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 628EEBD2;
     Tue, 26 Feb 2013 19:04:00 +0000 (UTC)
     (envelope-from delphij@delphij.net)
    Received: from anubis.delphij.net (anubis.delphij.net
     [IPv6:2001:470:1:117::25])
     by mx1.freebsd.org (Postfix) with ESMTP id 314B91968;
     Tue, 26 Feb 2013 19:04:00 +0000 (UTC)
    Received: from epsilon.delphij.net (drawbridge.ixsystems.com [206.40.55.65])
     (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
     (No client certificate requested)
     by anubis.delphij.net (Postfix) with ESMTPSA id DF46C24B56;
     Tue, 26 Feb 2013 11:03:58 -0800 (PST)
    DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis;
     t=1361905439; bh=kY3OIAUOgUHZOQlhwBzzUzVNEbR6mdU9q33ZdFzlrQE=;
     h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To;
     b=BaGr7LYSWfXz4IX8Yd2sSFzTrp8J+ohKBURJvziLSEdvCgYSPnZiN1/j+n7yH2xI7
     70UOzp0NOKsjlmpj03+LUK2J8uMMm2yjg/FZ10kbr5imbLiUJVJxZDUOiIV2dHQGOL
     RsYL8r7tNFW2q3pp1YUU1TNhKsdKv0NkEU5bWjHM=
    Message-ID: <512D071E.8090306@delphij.net>
    Date: Tue, 26 Feb 2013 11:03:58 -0800
    From: Xin Li 
    Organization: The FreeBSD Project
    MIME-Version: 1.0
    To: Davide Italiano 
    Subject: Re: svn commit: r247300 - in head: sys/sys usr.bin/truss
    References: <201302260213.r1Q2D2N1016801@svn.freebsd.org>
     <201302260941.52534.jhb@freebsd.org>
     
    In-Reply-To: 
    X-Enigmail-Version: 1.5.1
    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, Xin LI ,
     John Baldwin 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    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: Tue, 26 Feb 2013 19:04:00 -0000
    
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA512
    
    On 02/26/13 09:09, Davide Italiano wrote:
    > On Tue, Feb 26, 2013 at 3:41 PM, John Baldwin 
    > wrote:
    >> On Monday, February 25, 2013 9:13:02 pm Xin LI wrote:
    >>> Author: delphij Date: Tue Feb 26 02:13:02 2013 New Revision:
    >>> 247300 URL: http://svnweb.freebsd.org/changeset/base/247300
    >>> 
    >>> Log: Expose timespec and timeval macros when __BSD_VISIBLE is
    >>> defined.  This allows userland application to use the following
    >>> macros:
    >>> 
    >>> timespecclear, timespecisset, timespeccmp, timespecadd, 
    >>> timespecsub;
    >>> 
    >>> timevalclear, timevalisset, timevalcmp.
    >> 
    >> Why not fix truss to use the stock functions instead of keeping
    >> private "unusual" versions?
    >> 
    >> -- John Baldwin
    > 
    > time.h is already a mess in terms of namespace pollution, and this 
    > exposure might not help thing. Other details here: 
    > http://permalink.gmane.org/gmane.os.freebsd.architechture/15518
    
    What would be the preferred way of doing these operations on a
    timespec structure then?  Should the caller duplicate these macros?
    
    Cheers,
    - -- 
    Xin LI     https://www.delphij.net/
    FreeBSD - The Power to Serve!           Live free or die
    -----BEGIN PGP SIGNATURE-----
    
    iQEcBAEBCgAGBQJRLQceAAoJEG80Jeu8UPuzYQIIAIf9vJ6TS2Lmk+vkC0O9oXFi
    1W+msaOn/Onhi9TSbpdPlhfQI2VB8bkdDCA63ll3LC64jjDaRObobSYxYn7mKhz9
    +o0sdRXl8AvDkHNofSmrtO0h3JormzJjGIxNLi0DsTgrUDuOiVT34WtzTY6uvvnG
    Y4zpxoY/KI9ftaAabxhfTG8RcMkWbAHrQXmah/UujuMID57665I0NwxBap5lyyng
    lMygEBfAZ8bZqbh2IcUZi9qKBsIkFJugxYZc95WkU73A4rCGBJSJXpYWAghJxthy
    nDHNA6I5DxoeXpf3hEscG4WjHgLubZen8HwEs/3uA4mRkmAkI7pwT56wo7kVnwU=
    =JZjk
    -----END PGP SIGNATURE-----
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 19:04:55 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id C51E8D4A;
     Tue, 26 Feb 2013 19:04:55 +0000 (UTC)
     (envelope-from delphij@delphij.net)
    Received: from anubis.delphij.net (anubis.delphij.net
     [IPv6:2001:470:1:117::25])
     by mx1.freebsd.org (Postfix) with ESMTP id 8ADBE1971;
     Tue, 26 Feb 2013 19:04:55 +0000 (UTC)
    Received: from epsilon.delphij.net (drawbridge.ixsystems.com [206.40.55.65])
     (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
     (No client certificate requested)
     by anubis.delphij.net (Postfix) with ESMTPSA id 30ABA24B71;
     Tue, 26 Feb 2013 11:04:55 -0800 (PST)
    DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis;
     t=1361905495; bh=Yc28KuYhkm0Yqc5QGF0PcqvRGjuwkqFdj6trrVQpRV8=;
     h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To;
     b=RohULJJfMIksDuYSDcq01w3KJu1aj3qmJUmz/tC3vq5W0Il7LoXA8hlrWYJURIzu+
     qu5X5xExFDRdSadBEBxCA/WcG33jvu24nB9Wr5PIcPjV0JrB0diFvvdzg21bpsSegR
     geSJS9a1rBOR/nbW1Jk9k2yD8NOy/VbR0RRBNR6c=
    Message-ID: <512D0756.80804@delphij.net>
    Date: Tue, 26 Feb 2013 11:04:54 -0800
    From: Xin Li 
    Organization: The FreeBSD Project
    MIME-Version: 1.0
    To: John Baldwin 
    Subject: Re: svn commit: r247300 - in head: sys/sys usr.bin/truss
    References: <201302260213.r1Q2D2N1016801@svn.freebsd.org>
     <201302260941.52534.jhb@freebsd.org>
     
     <201302261335.38001.jhb@freebsd.org>
    In-Reply-To: <201302261335.38001.jhb@freebsd.org>
    X-Enigmail-Version: 1.5.1
    Content-Type: text/plain; charset=ISO-8859-1
    Content-Transfer-Encoding: 7bit
    Cc: Davide Italiano , svn-src-head@freebsd.org,
     svn-src-all@freebsd.org, src-committers@freebsd.org,
     Xin LI 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    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: Tue, 26 Feb 2013 19:04:55 -0000
    
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA512
    
    On 02/26/13 10:35, John Baldwin wrote:
    > On Tuesday, February 26, 2013 12:09:42 pm Davide Italiano wrote:
    >> On Tue, Feb 26, 2013 at 3:41 PM, John Baldwin 
    >> wrote:
    >>> On Monday, February 25, 2013 9:13:02 pm Xin LI wrote:
    >>>> Author: delphij Date: Tue Feb 26 02:13:02 2013 New Revision:
    >>>> 247300 URL: http://svnweb.freebsd.org/changeset/base/247300
    >>>> 
    >>>> Log: Expose timespec and timeval macros when __BSD_VISIBLE is
    >>>> defined.  This allows userland application to use the
    >>>> following macros:
    >>>> 
    >>>> timespecclear, timespecisset, timespeccmp, timespecadd, 
    >>>> timespecsub;
    >>>> 
    >>>> timevalclear, timevalisset, timevalcmp.
    >>> 
    >>> Why not fix truss to use the stock functions instead of keeping
    >>> private "unusual" versions?
    >>> 
    >>> -- John Baldwin
    >> 
    >> time.h is already a mess in terms of namespace pollution, and
    >> this exposure might not help thing. Other details here: 
    >> http://permalink.gmane.org/gmane.os.freebsd.architechture/15518
    > 
    > I think that is orthogonal.  Even if this is reverted I think truss
    > should be changed to use the "normal" timespecsubt() macro rather
    > than using a custom one with a different argument order.
    
    I'll find a way to solve this and post a patch for review, thanks for
    your comments.
    
    Cheers,
    - -- 
    Xin LI     https://www.delphij.net/
    FreeBSD - The Power to Serve!           Live free or die
    -----BEGIN PGP SIGNATURE-----
    
    iQEcBAEBCgAGBQJRLQdWAAoJEG80Jeu8UPuzpQ0H/1wxy58rK+p/jx2sZtFIhxCA
    j6H/xQ0nNqthVBW2rw0gwiaUgU1AfcAtdfz7/lFopsvbGFoxzQFYUyC4U67JhSk6
    IOgElmtjfFMfvj0ksQnEtIGPMYFbc5G4AHfmmwu4f9cjEPBQz3rPssybGqFvJjO+
    tUs7I6tYsq5Lnu9ltjDXgBcNHblgjFqz0jMZ/Rysdu4+51Mga5akyV2D6OFbcbNG
    oYzC5OOJFvnw6lV+bCVh/ZQNjvEE/Z+YUhfT66MlmU9CBDM9TlYCl7F+5/snZiZ4
    0xVFDUIglQqHXkaA1DtP7+HGfVtYhDvO3BgOUe+fHieFxkQFsiEATO4YUImZTKE=
    =KUVT
    -----END PGP SIGNATURE-----
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 19:46:03 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id B556AA4F;
     Tue, 26 Feb 2013 19:46:03 +0000 (UTC) (envelope-from jmg@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 8FFBE1B84;
     Tue, 26 Feb 2013 19:46:03 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QJk340038119;
     Tue, 26 Feb 2013 19:46:03 GMT (envelope-from jmg@svn.freebsd.org)
    Received: (from jmg@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QJk3DW038118;
     Tue, 26 Feb 2013 19:46:03 GMT (envelope-from jmg@svn.freebsd.org)
    Message-Id: <201302261946.r1QJk3DW038118@svn.freebsd.org>
    From: John-Mark Gurney 
    Date: Tue, 26 Feb 2013 19:46:03 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247337 - head/lib/libkiconv
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 19:46:03 -0000
    
    Author: jmg
    Date: Tue Feb 26 19:46:02 2013
    New Revision: 247337
    URL: http://svnweb.freebsd.org/changeset/base/247337
    
    Log:
      no one bothered to write the iconv.9 man page...  If it appears we
      can readd the xref...
      
      MFC:	1 week
    
    Modified:
      head/lib/libkiconv/kiconv.3
    
    Modified: head/lib/libkiconv/kiconv.3
    ==============================================================================
    --- head/lib/libkiconv/kiconv.3	Tue Feb 26 19:14:29 2013	(r247336)
    +++ head/lib/libkiconv/kiconv.3	Tue Feb 26 19:46:02 2013	(r247337)
    @@ -126,5 +126,4 @@ not using
     .Sh SEE ALSO
     .Xr iconv 3 ,
     .Xr tolower 3 ,
    -.Xr toupper 3 ,
    -.Xr iconv 9
    +.Xr toupper 3
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 19:47:00 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 7DCACBDF;
     Tue, 26 Feb 2013 19:47:00 +0000 (UTC)
     (envelope-from delphij@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 5810E1BA1;
     Tue, 26 Feb 2013 19:47:00 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QJl0MZ038287;
     Tue, 26 Feb 2013 19:47:00 GMT (envelope-from delphij@svn.freebsd.org)
    Received: (from delphij@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QJkxcK038276;
     Tue, 26 Feb 2013 19:46:59 GMT (envelope-from delphij@svn.freebsd.org)
    Message-Id: <201302261946.r1QJkxcK038276@svn.freebsd.org>
    From: Xin LI 
    Date: Tue, 26 Feb 2013 19:46:59 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247338 - in head: sys/sys usr.bin/truss
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 19:47:00 -0000
    
    Author: delphij
    Date: Tue Feb 26 19:46:59 2013
    New Revision: 247338
    URL: http://svnweb.freebsd.org/changeset/base/247338
    
    Log:
      Revert r247300 for now.  I'll post a new changeset for review.
    
    Modified:
      head/sys/sys/time.h
      head/usr.bin/truss/main.c
      head/usr.bin/truss/syscalls.c
      head/usr.bin/truss/truss.h
    
    Modified: head/sys/sys/time.h
    ==============================================================================
    --- head/sys/sys/time.h	Tue Feb 26 19:46:02 2013	(r247337)
    +++ head/sys/sys/time.h	Tue Feb 26 19:46:59 2013	(r247338)
    @@ -156,6 +156,9 @@ timeval2bintime(const struct timeval *tv
     	/* 18446744073709 = int(2^64 / 1000000) */
     	bt->frac = tv->tv_usec * (uint64_t)18446744073709LL;
     }
    +#endif /* __BSD_VISIBLE */
    +
    +#ifdef _KERNEL
     
     /* Operations on timespecs */
     #define	timespecclear(tvp)	((tvp)->tv_sec = (tvp)->tv_nsec = 0)
    @@ -194,7 +197,7 @@ timeval2bintime(const struct timeval *tv
     
     /* timevaladd and timevalsub are not inlined */
     
    -#endif /* __BSD_VISIBLE */
    +#endif /* _KERNEL */
     
     #ifndef _KERNEL			/* NetBSD/OpenBSD compatible interfaces */
     
    
    Modified: head/usr.bin/truss/main.c
    ==============================================================================
    --- head/usr.bin/truss/main.c	Tue Feb 26 19:46:02 2013	(r247337)
    +++ head/usr.bin/truss/main.c	Tue Feb 26 19:46:59 2013	(r247338)
    @@ -323,14 +323,14 @@ START_TRACE:
     				fprintf(trussinfo->outfile, "%5d: ",
     				    trussinfo->pid);
     			if (trussinfo->flags & ABSOLUTETIMESTAMPS) {
    -				timespecsubt_to(&trussinfo->curthread->after,
    +				timespecsubt(&trussinfo->curthread->after,
     				    &trussinfo->start_time, &timediff);
     				fprintf(trussinfo->outfile, "%ld.%09ld ",
     				    (long)timediff.tv_sec,
     				    timediff.tv_nsec);
     			}
     			if (trussinfo->flags & RELATIVETIMESTAMPS) {
    -				timespecsubt_to(&trussinfo->curthread->after,
    +				timespecsubt(&trussinfo->curthread->after,
     				    &trussinfo->curthread->before, &timediff);
     				fprintf(trussinfo->outfile, "%ld.%09ld ",
     				    (long)timediff.tv_sec,
    @@ -349,14 +349,14 @@ START_TRACE:
     				fprintf(trussinfo->outfile, "%5d: ",
     				    trussinfo->pid);
     			if (trussinfo->flags & ABSOLUTETIMESTAMPS) {
    -				timespecsubt_to(&trussinfo->curthread->after,
    +				timespecsubt(&trussinfo->curthread->after,
     				    &trussinfo->start_time, &timediff);
     				fprintf(trussinfo->outfile, "%ld.%09ld ",
     				    (long)timediff.tv_sec,
     				    timediff.tv_nsec);
     			}
     			if (trussinfo->flags & RELATIVETIMESTAMPS) {
    -				timespecsubt_to(&trussinfo->curthread->after,
    +				timespecsubt(&trussinfo->curthread->after,
     				    &trussinfo->curthread->before, &timediff);
     				fprintf(trussinfo->outfile, "%ld.%09ld ",
     				    (long)timediff.tv_sec, timediff.tv_nsec);
    
    Modified: head/usr.bin/truss/syscalls.c
    ==============================================================================
    --- head/usr.bin/truss/syscalls.c	Tue Feb 26 19:46:02 2013	(r247337)
    +++ head/usr.bin/truss/syscalls.c	Tue Feb 26 19:46:59 2013	(r247338)
    @@ -1126,14 +1126,14 @@ print_syscall(struct trussinfo *trussinf
     	}
     
     	if (trussinfo->flags & ABSOLUTETIMESTAMPS) {
    -		timespecsubt_to(&trussinfo->curthread->after,
    +		timespecsubt(&trussinfo->curthread->after,
     		    &trussinfo->start_time, &timediff);
     		len += fprintf(trussinfo->outfile, "%ld.%09ld ",
     		    (long)timediff.tv_sec, timediff.tv_nsec);
     	}
     
     	if (trussinfo->flags & RELATIVETIMESTAMPS) {
    -		timespecsubt_to(&trussinfo->curthread->after,
    +		timespecsubt(&trussinfo->curthread->after,
     		    &trussinfo->curthread->before, &timediff);
     		len += fprintf(trussinfo->outfile, "%ld.%09ld ",
     		    (long)timediff.tv_sec, timediff.tv_nsec);
    @@ -1165,9 +1165,9 @@ print_syscall_ret(struct trussinfo *trus
     		if (!sc)
     			return;
     		clock_gettime(CLOCK_REALTIME, &trussinfo->curthread->after);
    -		timespecsubt_to(&trussinfo->curthread->after,
    +		timespecsubt(&trussinfo->curthread->after,
     		    &trussinfo->curthread->before, &timediff);
    -		timespecadd_to(&sc->time, &timediff, &sc->time);
    +		timespecadd(&sc->time, &timediff, &sc->time);
     		sc->ncalls++;
     		if (errorp)
     			sc->nerror++;
    @@ -1205,7 +1205,7 @@ print_summary(struct trussinfo *trussinf
     			fprintf(trussinfo->outfile, "%-20s%5jd.%09ld%8d%8d\n",
     			    sc->name, (intmax_t)sc->time.tv_sec,
     			    sc->time.tv_nsec, sc->ncalls, sc->nerror);
    -			timespecadd_to(&total, &sc->time, &total);
    +			timespecadd(&total, &sc->time, &total);
     			ncall += sc->ncalls;
     			nerror += sc->nerror;
     		}
    
    Modified: head/usr.bin/truss/truss.h
    ==============================================================================
    --- head/usr.bin/truss/truss.h	Tue Feb 26 19:46:02 2013	(r247337)
    +++ head/usr.bin/truss/truss.h	Tue Feb 26 19:46:59 2013	(r247338)
    @@ -62,7 +62,7 @@ struct trussinfo
     	SLIST_HEAD(, threadinfo) threadlist;
     };
     
    -#define	timespecsubt_to(tvp, uvp, vvp)					\
    +#define	timespecsubt(tvp, uvp, vvp)					\
     	do {								\
     		(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;		\
     		(vvp)->tv_nsec = (tvp)->tv_nsec - (uvp)->tv_nsec;	\
    @@ -72,7 +72,7 @@ struct trussinfo
     		}							\
     	} while (0)
     
    -#define	timespecadd_to(tvp, uvp, vvp)					\
    +#define	timespecadd(tvp, uvp, vvp)					\
     	do {								\
     		(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;		\
     		(vvp)->tv_nsec = (tvp)->tv_nsec + (uvp)->tv_nsec;	\
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 19:58:49 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id B8F6DE3A;
     Tue, 26 Feb 2013 19:58:49 +0000 (UTC)
     (envelope-from cognet@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 95F421C15;
     Tue, 26 Feb 2013 19:58:49 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QJwnNE041413;
     Tue, 26 Feb 2013 19:58:49 GMT (envelope-from cognet@svn.freebsd.org)
    Received: (from cognet@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QJwn0x041412;
     Tue, 26 Feb 2013 19:58:49 GMT (envelope-from cognet@svn.freebsd.org)
    Message-Id: <201302261958.r1QJwn0x041412@svn.freebsd.org>
    From: Olivier Houchard 
    Date: Tue, 26 Feb 2013 19:58:49 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247339 - head/sys/arm/arm
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 19:58:49 -0000
    
    Author: cognet
    Date: Tue Feb 26 19:58:49 2013
    New Revision: 247339
    URL: http://svnweb.freebsd.org/changeset/base/247339
    
    Log:
      Don't forget to init the VFP stuff for all cores.
    
    Modified:
      head/sys/arm/arm/mp_machdep.c
    
    Modified: head/sys/arm/arm/mp_machdep.c
    ==============================================================================
    --- head/sys/arm/arm/mp_machdep.c	Tue Feb 26 19:46:59 2013	(r247338)
    +++ head/sys/arm/arm/mp_machdep.c	Tue Feb 26 19:58:49 2013	(r247339)
    @@ -49,6 +49,9 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    +#ifdef ARM_VFP_SUPPORT
    +#include 
    +#endif
     
     #include "opt_smp.h"
     
    @@ -181,6 +184,11 @@ init_secondary(int cpu)
     	KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread"));
     	pc->pc_curthread = pc->pc_idlethread;
     	pc->pc_curpcb = pc->pc_idlethread->td_pcb;
    +#ifdef ARM_VFP_SUPPORT
    +	pc->pc_cpu = cpu;
    +
    +	vfp_init();
    +#endif
     
     	mtx_lock_spin(&ap_boot_mtx);
     
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 19:59:53 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 24AA6FC4;
     Tue, 26 Feb 2013 19:59:53 +0000 (UTC)
     (envelope-from cognet@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 0D2F61C26;
     Tue, 26 Feb 2013 19:59:53 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QJxqkg041600;
     Tue, 26 Feb 2013 19:59:52 GMT (envelope-from cognet@svn.freebsd.org)
    Received: (from cognet@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QJxq1c041599;
     Tue, 26 Feb 2013 19:59:52 GMT (envelope-from cognet@svn.freebsd.org)
    Message-Id: <201302261959.r1QJxq1c041599@svn.freebsd.org>
    From: Olivier Houchard 
    Date: Tue, 26 Feb 2013 19:59:52 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247340 - head/sys/arm/arm
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 19:59:53 -0000
    
    Author: cognet
    Date: Tue Feb 26 19:59:52 2013
    New Revision: 247340
    URL: http://svnweb.freebsd.org/changeset/base/247340
    
    Log:
      Fix SMP build.
    
    Modified:
      head/sys/arm/arm/vfp.c
    
    Modified: head/sys/arm/arm/vfp.c
    ==============================================================================
    --- head/sys/arm/arm/vfp.c	Tue Feb 26 19:58:49 2013	(r247339)
    +++ head/sys/arm/arm/vfp.c	Tue Feb 26 19:59:52 2013	(r247340)
    @@ -43,7 +43,6 @@ unsigned int get_coprocessorACR(void);
     int	vfp_bounce(u_int, u_int, struct trapframe *, int);
     void	vfp_discard(void);
     void	vfp_enable(void);
    -void	vfp_init(void);
     void	vfp_restore(struct vfp_state *);
     void	vfp_store(struct vfp_state *);
     void	set_coprocessorACR(u_int);
    @@ -74,8 +73,8 @@ void
     set_coprocessorACR(u_int val)
     {
     	__asm __volatile("mcr p15, 0, %0, c1, c0, 2\n\t"
    -			 "isb\n\t"
     	 : : "r" (val) : "cc");
    +	isb();
     }
     
     
    @@ -140,7 +139,7 @@ vfp_bounce(u_int addr, u_int insn, struc
     #ifdef SMP
     		/* don't save if newer registers are on another processor */
     		if (vfptd /* && (vfptd == curthread) */ &&
    -		   (vfptd->td_pcb->pcb_vfpcpu == PCPU_GET(vfpcpu))
    +		   (vfptd->td_pcb->pcb_vfpcpu == PCPU_GET(cpu)))
     #else
     		/* someone did not save their registers, */
     		if (vfptd /* && (vfptd == curthread) */)
    @@ -168,7 +167,7 @@ vfp_bounce(u_int addr, u_int insn, struc
     	 */
     	vfp_restore(&curpcb->pcb_vfpstate);
     #ifdef SMP
    -	curpcb->pcb_cpu = PCPU_GET(cpu);
    +	curpcb->pcb_vfpcpu = PCPU_GET(cpu);
     #endif
     	PCPU_SET(vfpcthread, PCPU_GET(curthread));
     	return 0;
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 20:01:05 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id E76711DC;
     Tue, 26 Feb 2013 20:01:05 +0000 (UTC)
     (envelope-from cognet@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id BB5931C3A;
     Tue, 26 Feb 2013 20:01:05 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QK15x6043547;
     Tue, 26 Feb 2013 20:01:05 GMT (envelope-from cognet@svn.freebsd.org)
    Received: (from cognet@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QK15p0043546;
     Tue, 26 Feb 2013 20:01:05 GMT (envelope-from cognet@svn.freebsd.org)
    Message-Id: <201302262001.r1QK15p0043546@svn.freebsd.org>
    From: Olivier Houchard 
    Date: Tue, 26 Feb 2013 20:01:05 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247341 - head/sys/arm/include
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 20:01:06 -0000
    
    Author: cognet
    Date: Tue Feb 26 20:01:05 2013
    New Revision: 247341
    URL: http://svnweb.freebsd.org/changeset/base/247341
    
    Log:
      Export vfp_init() prototype, for use in the MP code.
    
    Modified:
      head/sys/arm/include/vfp.h
    
    Modified: head/sys/arm/include/vfp.h
    ==============================================================================
    --- head/sys/arm/include/vfp.h	Tue Feb 26 19:59:52 2013	(r247340)
    +++ head/sys/arm/include/vfp.h	Tue Feb 26 20:01:05 2013	(r247341)
    @@ -124,5 +124,6 @@
     #define COPROC10		(0x3 << 20)
     #define COPROC11		(0x3 << 22)
     
    +void    vfp_init(void);
     
     #endif
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 20:02:17 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id BDC2D36E;
     Tue, 26 Feb 2013 20:02:17 +0000 (UTC)
     (envelope-from neel@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id B08B41C53;
     Tue, 26 Feb 2013 20:02:17 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QK2H29043798;
     Tue, 26 Feb 2013 20:02:17 GMT (envelope-from neel@svn.freebsd.org)
    Received: (from neel@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QK2HhZ043797;
     Tue, 26 Feb 2013 20:02:17 GMT (envelope-from neel@svn.freebsd.org)
    Message-Id: <201302262002.r1QK2HhZ043797@svn.freebsd.org>
    From: Neel Natu 
    Date: Tue, 26 Feb 2013 20:02:17 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247342 - head/usr.sbin/bhyve
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 20:02:17 -0000
    
    Author: neel
    Date: Tue Feb 26 20:02:17 2013
    New Revision: 247342
    URL: http://svnweb.freebsd.org/changeset/base/247342
    
    Log:
      Ignore the BARRIER flag in the virtio block header.
      
      This capability is not advertised by the host so ignore it even if the guest
      insists on setting the flag.
      
      Reviewed by:	grehan
      Obtained from:	NetApp
    
    Modified:
      head/usr.sbin/bhyve/pci_virtio_block.c
    
    Modified: head/usr.sbin/bhyve/pci_virtio_block.c
    ==============================================================================
    --- head/usr.sbin/bhyve/pci_virtio_block.c	Tue Feb 26 20:01:05 2013	(r247341)
    +++ head/usr.sbin/bhyve/pci_virtio_block.c	Tue Feb 26 20:02:17 2013	(r247342)
    @@ -110,8 +110,9 @@ CTASSERT(sizeof(struct vtblk_config) == 
      * Fixed-size block header
      */
     struct virtio_blk_hdr {
    -#define VBH_OP_READ	0
    -#define VBH_OP_WRITE	1
    +#define	VBH_OP_READ		0
    +#define	VBH_OP_WRITE		1
    +#define	VBH_FLAG_BARRIER	0x80000000	/* OR'ed into vbh_type */
     	uint32_t       	vbh_type;
     	uint32_t	vbh_ioprio;
     	uint64_t	vbh_sector;
    @@ -198,7 +199,7 @@ pci_vtblk_proc(struct pci_vtblk_softc *s
     	int iolen;
     	int nsegs;
     	int uidx, aidx, didx;
    -	int writeop;
    +	int writeop, type;
     	off_t offset;
     
     	uidx = *hq->hq_used_idx;
    @@ -232,7 +233,13 @@ pci_vtblk_proc(struct pci_vtblk_softc *s
     	assert(vid[0].vd_flags & VRING_DESC_F_NEXT);
     	assert((vid[0].vd_flags & VRING_DESC_F_WRITE) == 0);
     
    -	writeop = (vbh->vbh_type == VBH_OP_WRITE);
    +	/*
    +	 * XXX
    +	 * The guest should not be setting the BARRIER flag because
    +	 * we don't advertise the capability.
    +	 */
    +	type = vbh->vbh_type & ~VBH_FLAG_BARRIER;
    +	writeop = (type == VBH_OP_WRITE);
     
     	offset = vbh->vbh_sector * DEV_BSIZE;
     
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 20:13:11 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id A6E178D9;
     Tue, 26 Feb 2013 20:13:11 +0000 (UTC)
     (envelope-from davide.italiano@gmail.com)
    Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com
     [209.85.212.173])
     by mx1.freebsd.org (Postfix) with ESMTP id AA8F01CD3;
     Tue, 26 Feb 2013 20:13:10 +0000 (UTC)
    Received: by mail-wi0-f173.google.com with SMTP id hq4so5379436wib.6
     for ; Tue, 26 Feb 2013 12:13:04 -0800 (PST)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
     h=mime-version:x-received:sender:in-reply-to:references:date
     :x-google-sender-auth:message-id:subject:from:to:cc:content-type;
     bh=5XixmqRwAL3QcXC0xiGkwjLvpKPuO07FZ9n5CxfiBN4=;
     b=VKr1H0YW3/6IBwdQe/YIN+xrsn/lXwiWHH+GQ5VpUyBacnN8/3NqXgspGUs0bTiQGK
     /RdZyZVUHdKXRUikSEKs2QIeqLiSO09S5O7gWO/CTXI1Z6sM2v5CjDkA/KQ5pIi9hnOk
     kAM6jSBUOGABdyHT8np9ZEZ3KqxKogVRiTftKh0bNGXoIEYJ9J5dkpRjroxoo1e91YiD
     czPh/iXAOehRzY8uhsFIdxz3RIgfaCRAJu/mxJDWD67kF9wDPB6E7S0Xd/YjfPRnsd14
     RyZM98BqtDu3R3oWLlGGVUKtvN7s2QJ3IfgJmnvzfFVN74eM2wbrswdx4OfG6kWOqhPx
     cJ/Q==
    MIME-Version: 1.0
    X-Received: by 10.194.62.170 with SMTP id z10mr28981326wjr.34.1361909584067;
     Tue, 26 Feb 2013 12:13:04 -0800 (PST)
    Sender: davide.italiano@gmail.com
    Received: by 10.180.105.197 with HTTP; Tue, 26 Feb 2013 12:13:03 -0800 (PST)
    In-Reply-To: <512D071E.8090306@delphij.net>
    References: <201302260213.r1Q2D2N1016801@svn.freebsd.org>
     <201302260941.52534.jhb@freebsd.org>
     
     <512D071E.8090306@delphij.net>
    Date: Tue, 26 Feb 2013 21:13:03 +0100
    X-Google-Sender-Auth: DjA3xebRUg0WkjqKp_mLoq8YsOw
    Message-ID: 
    Subject: Re: svn commit: r247300 - in head: sys/sys usr.bin/truss
    From: Davide Italiano 
    To: d@delphij.net
    Content-Type: text/plain; charset=ISO-8859-1
    Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
     src-committers@freebsd.org, Xin LI ,
     John Baldwin 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 20:13:11 -0000
    
    On Tue, Feb 26, 2013 at 8:03 PM, Xin Li  wrote:
    > -----BEGIN PGP SIGNED MESSAGE-----
    > Hash: SHA512
    >
    > On 02/26/13 09:09, Davide Italiano wrote:
    >> On Tue, Feb 26, 2013 at 3:41 PM, John Baldwin 
    >> wrote:
    >>> On Monday, February 25, 2013 9:13:02 pm Xin LI wrote:
    >>>> Author: delphij Date: Tue Feb 26 02:13:02 2013 New Revision:
    >>>> 247300 URL: http://svnweb.freebsd.org/changeset/base/247300
    >>>>
    >>>> Log: Expose timespec and timeval macros when __BSD_VISIBLE is
    >>>> defined.  This allows userland application to use the following
    >>>> macros:
    >>>>
    >>>> timespecclear, timespecisset, timespeccmp, timespecadd,
    >>>> timespecsub;
    >>>>
    >>>> timevalclear, timevalisset, timevalcmp.
    >>>
    >>> Why not fix truss to use the stock functions instead of keeping
    >>> private "unusual" versions?
    >>>
    >>> -- John Baldwin
    >>
    >> time.h is already a mess in terms of namespace pollution, and this
    >> exposure might not help thing. Other details here:
    >> http://permalink.gmane.org/gmane.os.freebsd.architechture/15518
    >
    > What would be the preferred way of doing these operations on a
    > timespec structure then?  Should the caller duplicate these macros?
    >
    > Cheers,
    > - --
    > Xin LI     https://www.delphij.net/
    > FreeBSD - The Power to Serve!           Live free or die
    > -----BEGIN PGP SIGNATURE-----
    >
    > iQEcBAEBCgAGBQJRLQceAAoJEG80Jeu8UPuzYQIIAIf9vJ6TS2Lmk+vkC0O9oXFi
    > 1W+msaOn/Onhi9TSbpdPlhfQI2VB8bkdDCA63ll3LC64jjDaRObobSYxYn7mKhz9
    > +o0sdRXl8AvDkHNofSmrtO0h3JormzJjGIxNLi0DsTgrUDuOiVT34WtzTY6uvvnG
    > Y4zpxoY/KI9ftaAabxhfTG8RcMkWbAHrQXmah/UujuMID57665I0NwxBap5lyyng
    > lMygEBfAZ8bZqbh2IcUZi9qKBsIkFJugxYZc95WkU73A4rCGBJSJXpYWAghJxthy
    > nDHNA6I5DxoeXpf3hEscG4WjHgLubZen8HwEs/3uA4mRkmAkI7pwT56wo7kVnwU=
    > =JZjk
    > -----END PGP SIGNATURE-----
    
    Well, it may be. And maybe this might be a topic for a larger discussion.
    What's your use-case?
    
    -- 
    Davide
    
    "There are no solved problems; there are only problems that are more
    or less solved" -- Henri Poincare
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 20:19:46 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 21639D61;
     Tue, 26 Feb 2013 20:19:46 +0000 (UTC)
     (envelope-from trociny@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 131A01D12;
     Tue, 26 Feb 2013 20:19:46 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QKJjP5048359;
     Tue, 26 Feb 2013 20:19:45 GMT (envelope-from trociny@svn.freebsd.org)
    Received: (from trociny@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QKJjVW048358;
     Tue, 26 Feb 2013 20:19:45 GMT (envelope-from trociny@svn.freebsd.org)
    Message-Id: <201302262019.r1QKJjVW048358@svn.freebsd.org>
    From: Mikolaj Golub 
    Date: Tue, 26 Feb 2013 20:19:45 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247345 - head/sbin/hastctl
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 20:19:46 -0000
    
    Author: trociny
    Date: Tue Feb 26 20:19:45 2013
    New Revision: 247345
    URL: http://svnweb.freebsd.org/changeset/base/247345
    
    Log:
      Fix casting.
      
      MFC after:	3 days
    
    Modified:
      head/sbin/hastctl/hastctl.c
    
    Modified: head/sbin/hastctl/hastctl.c
    ==============================================================================
    --- head/sbin/hastctl/hastctl.c	Tue Feb 26 20:19:19 2013	(r247344)
    +++ head/sbin/hastctl/hastctl.c	Tue Feb 26 20:19:45 2013	(r247345)
    @@ -342,15 +342,15 @@ control_status(struct nv *nv)
     		    (intmax_t)nv_get_uint64(nv, "dirty%u", ii));
     		printf("  statistics:\n");
     		printf("    reads: %ju\n",
    -		    (uint64_t)nv_get_uint64(nv, "stat_read%u", ii));
    +		    (uintmax_t)nv_get_uint64(nv, "stat_read%u", ii));
     		printf("    writes: %ju\n",
    -		    (uint64_t)nv_get_uint64(nv, "stat_write%u", ii));
    +		    (uintmax_t)nv_get_uint64(nv, "stat_write%u", ii));
     		printf("    deletes: %ju\n",
    -		    (uint64_t)nv_get_uint64(nv, "stat_delete%u", ii));
    +		    (uintmax_t)nv_get_uint64(nv, "stat_delete%u", ii));
     		printf("    flushes: %ju\n",
    -		    (uint64_t)nv_get_uint64(nv, "stat_flush%u", ii));
    +		    (uintmax_t)nv_get_uint64(nv, "stat_flush%u", ii));
     		printf("    activemap updates: %ju\n",
    -		    (uint64_t)nv_get_uint64(nv, "stat_activemap_update%u", ii));
    +		    (uintmax_t)nv_get_uint64(nv, "stat_activemap_update%u", ii));
     		printf("    local errors: "
     		    "read: %ju, write: %ju, delete: %ju, flush: %ju\n",
     		    (uintmax_t)nv_get_uint64(nv, "stat_read_error%u", ii),
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 20:35:40 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id E1021F8;
     Tue, 26 Feb 2013 20:35:40 +0000 (UTC)
     (envelope-from attilio@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id C97CA1DBD;
     Tue, 26 Feb 2013 20:35:40 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QKZeU6053687;
     Tue, 26 Feb 2013 20:35:40 GMT (envelope-from attilio@svn.freebsd.org)
    Received: (from attilio@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QKZeSI053685;
     Tue, 26 Feb 2013 20:35:40 GMT (envelope-from attilio@svn.freebsd.org)
    Message-Id: <201302262035.r1QKZeSI053685@svn.freebsd.org>
    From: Attilio Rao 
    Date: Tue, 26 Feb 2013 20:35:40 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247346 - head/sys/vm
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 20:35:41 -0000
    
    Author: attilio
    Date: Tue Feb 26 20:35:40 2013
    New Revision: 247346
    URL: http://svnweb.freebsd.org/changeset/base/247346
    
    Log:
      Remove white spaces.
      
      Sponsored by:	EMC / Isilon storage division
    
    Modified:
      head/sys/vm/vm_object.c
      head/sys/vm/vnode_pager.c
    
    Modified: head/sys/vm/vm_object.c
    ==============================================================================
    --- head/sys/vm/vm_object.c	Tue Feb 26 20:19:45 2013	(r247345)
    +++ head/sys/vm/vm_object.c	Tue Feb 26 20:35:40 2013	(r247346)
    @@ -1138,7 +1138,7 @@ shadowlookup:
     			if (object != tobject)
     				VM_OBJECT_UNLOCK(object);
     			m->oflags |= VPO_WANTED;
    -			VM_OBJECT_SLEEP(tobject, m, PDROP | PVM, "madvpo" , 0);
    +			VM_OBJECT_SLEEP(tobject, m, PDROP | PVM, "madvpo", 0);
     			VM_OBJECT_LOCK(object);
       			goto relookup;
     		}
    @@ -1336,7 +1336,7 @@ retry:
     		if ((m->oflags & VPO_BUSY) || m->busy) {
     			VM_OBJECT_UNLOCK(new_object);
     			m->oflags |= VPO_WANTED;
    -			VM_OBJECT_SLEEP(orig_object, m, PVM, "spltwt" , 0);
    +			VM_OBJECT_SLEEP(orig_object, m, PVM, "spltwt", 0);
     			VM_OBJECT_LOCK(new_object);
     			goto retry;
     		}
    
    Modified: head/sys/vm/vnode_pager.c
    ==============================================================================
    --- head/sys/vm/vnode_pager.c	Tue Feb 26 20:19:45 2013	(r247345)
    +++ head/sys/vm/vnode_pager.c	Tue Feb 26 20:35:40 2013	(r247346)
    @@ -116,7 +116,7 @@ vnode_create_vobject(struct vnode *vp, o
     		}
     		VOP_UNLOCK(vp, 0);
     		vm_object_set_flag(object, OBJ_DISCONNECTWNT);
    -		VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vodead" , 0);
    +		VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vodead", 0);
     		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
     	}
     
    @@ -210,7 +210,7 @@ retry:
     		if ((object->flags & OBJ_DEAD) == 0)
     			break;
     		vm_object_set_flag(object, OBJ_DISCONNECTWNT);
    -		VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vadead" , 0);
    +		VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vadead", 0);
     	}
     
     	if (vp->v_usecount == 0)
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 20:35:55 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 25C92268;
     Tue, 26 Feb 2013 20:35:55 +0000 (UTC) (envelope-from np@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 17E9C1DC1;
     Tue, 26 Feb 2013 20:35:55 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QKZsGo053762;
     Tue, 26 Feb 2013 20:35:54 GMT (envelope-from np@svn.freebsd.org)
    Received: (from np@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QKZsAQ053757;
     Tue, 26 Feb 2013 20:35:54 GMT (envelope-from np@svn.freebsd.org)
    Message-Id: <201302262035.r1QKZsAQ053757@svn.freebsd.org>
    From: Navdeep Parhar 
    Date: Tue, 26 Feb 2013 20:35:54 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247347 - in head: share/man/man4 sys/dev/cxgbe
     sys/dev/cxgbe/common
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 20:35:55 -0000
    
    Author: np
    Date: Tue Feb 26 20:35:54 2013
    New Revision: 247347
    URL: http://svnweb.freebsd.org/changeset/base/247347
    
    Log:
      cxgbe(4): Consider all the API versions of the interfaces exported by
      the firmware (instead of just the main firmware version) when evaluating
      firmware compatibility.  Document the new "hw.cxgbe.fw_install" knob
      being introduced here.
      
      This should fix kern/173584 too.  Setting hw.cxgbe.fw_install=2 will
      mostly do what was requested in the PR but it's a bit more intelligent
      in that it won't reinstall the same firmware repeatedly if the knob is
      left set.
      
      PR:		kern/173584
      MFC after:	5 days
    
    Modified:
      head/share/man/man4/cxgbe.4
      head/sys/dev/cxgbe/common/common.h
      head/sys/dev/cxgbe/t4_main.c
    
    Modified: head/share/man/man4/cxgbe.4
    ==============================================================================
    --- head/share/man/man4/cxgbe.4	Tue Feb 26 20:35:40 2013	(r247346)
    +++ head/share/man/man4/cxgbe.4	Tue Feb 26 20:35:54 2013	(r247347)
    @@ -178,6 +178,15 @@ Bit 0 represents INTx (line interrupts),
     The default is 7 (all allowed).
     The driver will select the best possible type out of the allowed types by
     itself.
    +.It Va hw.cxgbe.fw_install
    +0 prohibits the driver from installing a firmware on the card.
    +1 allows the driver to install a new firmware if internal driver
    +heuristics indicate that the new firmware is preferable to the one
    +already on the card.
    +2 instructs the driver to always install the new firmware on the card as
    +long as it is compatible with the driver and is a different version than
    +the one already on the card.
    +The default is 1.
     .It Va hw.cxgbe.config_file
     Select a pre-packaged device configuration file.
     A configuration file contains a recipe for partitioning and configuring the
    
    Modified: head/sys/dev/cxgbe/common/common.h
    ==============================================================================
    --- head/sys/dev/cxgbe/common/common.h	Tue Feb 26 20:35:40 2013	(r247346)
    +++ head/sys/dev/cxgbe/common/common.h	Tue Feb 26 20:35:54 2013	(r247347)
    @@ -68,6 +68,11 @@ enum {
     #define FW_VERSION_MICRO 4
     #define FW_VERSION_BUILD 0
     
    +#define FW_VERSION (V_FW_HDR_FW_VER_MAJOR(FW_VERSION_MAJOR) | \
    +    V_FW_HDR_FW_VER_MINOR(FW_VERSION_MINOR) | \
    +    V_FW_HDR_FW_VER_MICRO(FW_VERSION_MICRO) | \
    +    V_FW_HDR_FW_VER_BUILD(FW_VERSION_BUILD))
    +
     struct port_stats {
     	u64 tx_octets;            /* total # of octets in good frames */
     	u64 tx_frames;            /* all good frames */
    
    Modified: head/sys/dev/cxgbe/t4_main.c
    ==============================================================================
    --- head/sys/dev/cxgbe/t4_main.c	Tue Feb 26 20:35:40 2013	(r247346)
    +++ head/sys/dev/cxgbe/t4_main.c	Tue Feb 26 20:35:54 2013	(r247347)
    @@ -213,6 +213,13 @@ static char t4_cfg_file[32] = "default";
     TUNABLE_STR("hw.cxgbe.config_file", t4_cfg_file, sizeof(t4_cfg_file));
     
     /*
    + * Firmware auto-install by driver during attach (0, 1, 2 = prohibited, allowed,
    + * encouraged respectively).
    + */
    +static unsigned int t4_fw_install = 1;
    +TUNABLE_INT("hw.cxgbe.fw_install", &t4_fw_install);
    +
    +/*
      * ASIC features that will be used.  Disable the ones you don't want so that the
      * chip resources aren't wasted on features that will not be used.
      */
    @@ -1503,6 +1510,33 @@ allocate:
     }
     
     /*
    + * Is the given firmware compatible with the one the driver was compiled with?
    + */
    +static int
    +fw_compatible(const struct fw_hdr *hdr)
    +{
    +
    +	if (hdr->fw_ver == htonl(FW_VERSION))
    +		return (1);
    +
    +	/*
    +	 * XXX: Is this too conservative?  Perhaps I should limit this to the
    +	 * features that are supported in the driver.
    +	 */
    +	if (hdr->intfver_nic == FW_HDR_INTFVER_NIC &&
    +	    hdr->intfver_vnic == FW_HDR_INTFVER_VNIC &&
    +	    hdr->intfver_ofld == FW_HDR_INTFVER_OFLD &&
    +	    hdr->intfver_ri == FW_HDR_INTFVER_RI &&
    +	    hdr->intfver_iscsipdu == FW_HDR_INTFVER_ISCSIPDU &&
    +	    hdr->intfver_iscsi == FW_HDR_INTFVER_ISCSI &&
    +	    hdr->intfver_fcoepdu == FW_HDR_INTFVER_FCOEPDU &&
    +	    hdr->intfver_fcoe == FW_HDR_INTFVER_FCOEPDU)
    +		return (1);
    +
    +	return (0);
    +}
    +
    +/*
      * Install a compatible firmware (if required), establish contact with it (by
      * saying hello), and reset the device.  If we end up as the master driver,
      * partition adapter resources by providing a configuration file to the
    @@ -1512,84 +1546,99 @@ static int
     prep_firmware(struct adapter *sc)
     {
     	const struct firmware *fw = NULL, *cfg = NULL, *default_cfg;
    -	int rc;
    +	int rc, card_fw_usable, kld_fw_usable;
     	enum dev_state state;
    +	struct fw_hdr *card_fw;
    +	const struct fw_hdr *kld_fw;
     
     	default_cfg = firmware_get(T4_CFGNAME);
     
    -	/* Check firmware version and install a different one if necessary */
    -	rc = t4_check_fw_version(sc);
    -	snprintf(sc->fw_version, sizeof(sc->fw_version), "%u.%u.%u.%u",
    -	    G_FW_HDR_FW_VER_MAJOR(sc->params.fw_vers),
    -	    G_FW_HDR_FW_VER_MINOR(sc->params.fw_vers),
    -	    G_FW_HDR_FW_VER_MICRO(sc->params.fw_vers),
    -	    G_FW_HDR_FW_VER_BUILD(sc->params.fw_vers));
    -	if (rc != 0) {
    -		uint32_t v = 0;
    -
    -		fw = firmware_get(T4_FWNAME);
    -		if (fw != NULL) {
    -			const struct fw_hdr *hdr = (const void *)fw->data;
    +	/* Read the header of the firmware on the card */
    +	card_fw = malloc(sizeof(*card_fw), M_CXGBE, M_ZERO | M_WAITOK);
    +	rc = -t4_read_flash(sc, FLASH_FW_START,
    +	    sizeof (*card_fw) / sizeof (uint32_t), (uint32_t *)card_fw, 1);
    +	if (rc == 0)
    +		card_fw_usable = fw_compatible((const void*)card_fw);
    +	else {
    +		device_printf(sc->dev,
    +		    "Unable to read card's firmware header: %d\n", rc);
    +		card_fw_usable = 0;
    +	}
     
    -			v = ntohl(hdr->fw_ver);
    +	/* This is the firmware in the KLD */
    +	fw = firmware_get(T4_FWNAME);
    +	if (fw != NULL) {
    +		kld_fw = (const void *)fw->data;
    +		kld_fw_usable = fw_compatible(kld_fw);
    +	} else {
    +		kld_fw = NULL;
    +		kld_fw_usable = 0;
    +	}
     
    -			/*
    -			 * The firmware module will not be used if it isn't the
    -			 * same major version as what the driver was compiled
    -			 * with.
    -			 */
    -			if (G_FW_HDR_FW_VER_MAJOR(v) != FW_VERSION_MAJOR) {
    -				device_printf(sc->dev,
    -				    "Found firmware image but version %d "
    -				    "can not be used with this driver (%d)\n",
    -				    G_FW_HDR_FW_VER_MAJOR(v), FW_VERSION_MAJOR);
    +	/*
    +	 * Short circuit for the common case: the firmware on the card is an
    +	 * exact match and the KLD is an exact match too, or it's
    +	 * absent/incompatible, or we're prohibited from using it.  Note that
    +	 * t4_fw_install = 2 is ignored here -- use cxgbetool loadfw if you want
    +	 * to reinstall the same firmware as the one on the card.
    +	 */
    +	if (card_fw_usable && card_fw->fw_ver == htonl(FW_VERSION) &&
    +	    (!kld_fw_usable || kld_fw->fw_ver == htonl(FW_VERSION) ||
    +	    t4_fw_install == 0))
    +		goto hello;
    +
    +	if (kld_fw_usable && (!card_fw_usable ||
    +	    ntohl(kld_fw->fw_ver) > ntohl(card_fw->fw_ver) ||
    +	    (t4_fw_install == 2 && kld_fw->fw_ver != card_fw->fw_ver))) {
    +		uint32_t v = ntohl(kld_fw->fw_ver);
     
    -				firmware_put(fw, FIRMWARE_UNLOAD);
    -				fw = NULL;
    -			}
    -		}
    +		device_printf(sc->dev,
    +		    "installing firmware %d.%d.%d.%d on card.\n",
    +		    G_FW_HDR_FW_VER_MAJOR(v), G_FW_HDR_FW_VER_MINOR(v),
    +		    G_FW_HDR_FW_VER_MICRO(v), G_FW_HDR_FW_VER_BUILD(v));
     
    -		if (fw == NULL && rc < 0) {
    -			device_printf(sc->dev, "No usable firmware. "
    -			    "card has %d.%d.%d, driver compiled with %d.%d.%d",
    -			    G_FW_HDR_FW_VER_MAJOR(sc->params.fw_vers),
    -			    G_FW_HDR_FW_VER_MINOR(sc->params.fw_vers),
    -			    G_FW_HDR_FW_VER_MICRO(sc->params.fw_vers),
    -			    FW_VERSION_MAJOR, FW_VERSION_MINOR,
    -			    FW_VERSION_MICRO);
    -			rc = EAGAIN;
    +		rc = -t4_load_fw(sc, fw->data, fw->datasize);
    +		if (rc != 0) {
    +			device_printf(sc->dev,
    +			    "failed to install firmware: %d\n", rc);
     			goto done;
     		}
     
    -		/*
    -		 * Always upgrade, even for minor/micro/build mismatches.
    -		 * Downgrade only for a major version mismatch or if
    -		 * force_firmware_install was specified.
    -		 */
    -		if (fw != NULL && (rc < 0 || v > sc->params.fw_vers)) {
    -			device_printf(sc->dev,
    -			    "installing firmware %d.%d.%d.%d on card.\n",
    -			    G_FW_HDR_FW_VER_MAJOR(v), G_FW_HDR_FW_VER_MINOR(v),
    -			    G_FW_HDR_FW_VER_MICRO(v), G_FW_HDR_FW_VER_BUILD(v));
    -
    -			rc = -t4_load_fw(sc, fw->data, fw->datasize);
    -			if (rc != 0) {
    -				device_printf(sc->dev,
    -				    "failed to install firmware: %d\n", rc);
    -				goto done;
    -			} else {
    -				/* refresh */
    -				(void) t4_check_fw_version(sc);
    -				snprintf(sc->fw_version,
    -				    sizeof(sc->fw_version), "%u.%u.%u.%u",
    -				    G_FW_HDR_FW_VER_MAJOR(sc->params.fw_vers),
    -				    G_FW_HDR_FW_VER_MINOR(sc->params.fw_vers),
    -				    G_FW_HDR_FW_VER_MICRO(sc->params.fw_vers),
    -				    G_FW_HDR_FW_VER_BUILD(sc->params.fw_vers));
    -			}
    -		}
    +		/* Installed successfully, update the cached header too. */
    +		memcpy(card_fw, kld_fw, sizeof(*card_fw));
    +		card_fw_usable = 1;
    +	}
    +
    +	if (!card_fw_usable) {
    +		uint32_t c, k;
    +
    +		c = ntohl(card_fw->fw_ver);
    +		k = kld_fw ? ntohl(kld_fw->fw_ver) : 0;
    +
    +		device_printf(sc->dev, "Cannot find a usable firmware: "
    +		    "fw_install %d, driver compiled with %d.%d.%d.%d, "
    +		    "card has %d.%d.%d.%d, KLD has %d.%d.%d.%d\n",
    +		    t4_fw_install,
    +		    G_FW_HDR_FW_VER_MAJOR(FW_VERSION),
    +		    G_FW_HDR_FW_VER_MINOR(FW_VERSION),
    +		    G_FW_HDR_FW_VER_MICRO(FW_VERSION),
    +		    G_FW_HDR_FW_VER_BUILD(FW_VERSION),
    +		    G_FW_HDR_FW_VER_MAJOR(c), G_FW_HDR_FW_VER_MINOR(c),
    +		    G_FW_HDR_FW_VER_MICRO(c), G_FW_HDR_FW_VER_BUILD(c),
    +		    G_FW_HDR_FW_VER_MAJOR(k), G_FW_HDR_FW_VER_MINOR(k),
    +		    G_FW_HDR_FW_VER_MICRO(k), G_FW_HDR_FW_VER_BUILD(k));
    +		goto done;
     	}
     
    +hello:
    +	/* We're using whatever's on the card and it's known to be good. */
    +	sc->params.fw_vers = ntohl(card_fw->fw_ver);
    +	snprintf(sc->fw_version, sizeof(sc->fw_version), "%u.%u.%u.%u",
    +	    G_FW_HDR_FW_VER_MAJOR(sc->params.fw_vers),
    +	    G_FW_HDR_FW_VER_MINOR(sc->params.fw_vers),
    +	    G_FW_HDR_FW_VER_MICRO(sc->params.fw_vers),
    +	    G_FW_HDR_FW_VER_BUILD(sc->params.fw_vers));
    +
     	/* Contact firmware.  */
     	rc = t4_fw_hello(sc, sc->mbox, sc->mbox, MASTER_MAY, &state);
     	if (rc < 0) {
    @@ -1639,6 +1688,7 @@ prep_firmware(struct adapter *sc)
     	sc->flags |= FW_OK;
     
     done:
    +	free(card_fw, M_CXGBE);
     	if (fw != NULL)
     		firmware_put(fw, FIRMWARE_UNLOAD);
     	if (cfg != NULL)
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 20:41:27 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id AD249626;
     Tue, 26 Feb 2013 20:41:27 +0000 (UTC) (envelope-from mm@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 942301E19;
     Tue, 26 Feb 2013 20:41:27 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QKfRfG056178;
     Tue, 26 Feb 2013 20:41:27 GMT (envelope-from mm@svn.freebsd.org)
    Received: (from mm@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QKfR1d056177;
     Tue, 26 Feb 2013 20:41:27 GMT (envelope-from mm@svn.freebsd.org)
    Message-Id: <201302262041.r1QKfR1d056177@svn.freebsd.org>
    From: Martin Matuska 
    Date: Tue, 26 Feb 2013 20:41:27 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247348 -
     head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 20:41:27 -0000
    
    Author: mm
    Date: Tue Feb 26 20:41:27 2013
    New Revision: 247348
    URL: http://svnweb.freebsd.org/changeset/base/247348
    
    Log:
      Be more verbose on ZFS deadman I/O panic
      Patch suggested upstream.
      
      Suggested by:	Olivier Cinquin
      MFC after:	12 days
    
    Modified:
      head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
    
    Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
    ==============================================================================
    --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c	Tue Feb 26 20:35:54 2013	(r247347)
    +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c	Tue Feb 26 20:41:27 2013	(r247348)
    @@ -23,6 +23,7 @@
      * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
      * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
      * Copyright (c) 2012 by Delphix. All rights reserved.
    + * Copyright 2013 Martin Matuska . All rights reserved.
      */
     
     #include 
    @@ -3205,7 +3206,10 @@ vdev_deadman(vdev_t *vd)
     				    fio->io_timestamp, delta,
     				    vq->vq_io_complete_ts);
     				fm_panic("I/O to pool '%s' appears to be "
    -				    "hung.", spa_name(spa));
    +				    "hung on vdev guid %llu at '%s'.",
    +				    spa_name(spa),
    +				    (long long unsigned int) vd->vdev_guid,
    +				    vd->vdev_path);
     			}
     		}
     		mutex_exit(&vq->vq_lock);
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 21:25:18 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 34FB5D6A;
     Tue, 26 Feb 2013 21:25:18 +0000 (UTC) (envelope-from np@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 1929016F;
     Tue, 26 Feb 2013 21:25:18 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QLPHSA069380;
     Tue, 26 Feb 2013 21:25:17 GMT (envelope-from np@svn.freebsd.org)
    Received: (from np@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QLPHua069379;
     Tue, 26 Feb 2013 21:25:17 GMT (envelope-from np@svn.freebsd.org)
    Message-Id: <201302262125.r1QLPHua069379@svn.freebsd.org>
    From: Navdeep Parhar 
    Date: Tue, 26 Feb 2013 21:25:17 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247355 - head/sys/dev/cxgbe/common
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 21:25:18 -0000
    
    Author: np
    Date: Tue Feb 26 21:25:17 2013
    New Revision: 247355
    URL: http://svnweb.freebsd.org/changeset/base/247355
    
    Log:
      cxgbe(4): Report unusual out of band errors from the firmware.
      
      Obtained from:	Chelsio
      MFC after:	5 days
    
    Modified:
      head/sys/dev/cxgbe/common/t4_hw.c
    
    Modified: head/sys/dev/cxgbe/common/t4_hw.c
    ==============================================================================
    --- head/sys/dev/cxgbe/common/t4_hw.c	Tue Feb 26 21:17:38 2013	(r247354)
    +++ head/sys/dev/cxgbe/common/t4_hw.c	Tue Feb 26 21:25:17 2013	(r247355)
    @@ -154,6 +154,36 @@ u32 t4_hw_pci_read_cfg4(adapter_t *adap,
     }
     
     /*
    + *	t4_report_fw_error - report firmware error
    + *	@adap: the adapter
    + *
    + *	The adapter firmware can indicate error conditions to the host.
    + *	This routine prints out the reason for the firmware error (as
    + *	reported by the firmware).
    + */
    +static void t4_report_fw_error(struct adapter *adap)
    +{
    +	static const char *reason[] = {
    +		"Crash",			/* PCIE_FW_EVAL_CRASH */
    +		"During Device Preparation",	/* PCIE_FW_EVAL_PREP */
    +		"During Device Configuration",	/* PCIE_FW_EVAL_CONF */
    +		"During Device Initialization",	/* PCIE_FW_EVAL_INIT */
    +		"Unexpected Event",		/* PCIE_FW_EVAL_UNEXPECTEDEVENT */
    +		"Insufficient Airflow",		/* PCIE_FW_EVAL_OVERHEAT */
    +		"Device Shutdown",		/* PCIE_FW_EVAL_DEVICESHUTDOWN */
    +		"Reserved",			/* reserved */
    +	};
    +	u32 pcie_fw;
    +
    +	pcie_fw = t4_read_reg(adap, A_PCIE_FW);
    +	if (!(pcie_fw & F_PCIE_FW_ERR))
    +		CH_ERR(adap, "Firmware error report called with no error\n");
    +	else
    +		CH_ERR(adap, "Firmware reports adapter error: %s\n",
    +		       reason[G_PCIE_FW_EVAL(pcie_fw)]);
    +}
    +
    +/*
      * Get the reply to a mailbox command and store it in @rpl in big-endian order.
      */
     static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit,
    @@ -267,8 +297,15 @@ int t4_wr_mbox_meat(struct adapter *adap
     		}
     	}
     
    +	/*
    +	 * We timed out waiting for a reply to our mailbox command.  Report
    +	 * the error and also check to see if the firmware reported any
    +	 * errors ...
    +	 */
     	CH_ERR(adap, "command %#x in mailbox %d timed out\n",
     	       *(const u8 *)cmd, mbox);
    +	if (t4_read_reg(adap, A_PCIE_FW) & F_PCIE_FW_ERR)
    +		t4_report_fw_error(adap);
     	return -ETIMEDOUT;
     }
     
    @@ -2033,9 +2070,11 @@ static void cim_intr_handler(struct adap
     		{ F_TIMEOUTMAINT , "CIM PIF MA timeout", -1, 1 },
     		{ 0 }
     	};
    -
     	int fat;
     
    +	if (t4_read_reg(adapter, A_PCIE_FW) & F_PCIE_FW_ERR)
    +		t4_report_fw_error(adapter);
    +
     	fat = t4_handle_intr_status(adapter, A_CIM_HOST_INT_CAUSE,
     				    cim_intr_info) +
     	      t4_handle_intr_status(adapter, A_CIM_HOST_UPACC_INT_CAUSE,
    @@ -4103,12 +4142,16 @@ retry:
     	/*
     	 * Issue the HELLO command to the firmware.  If it's not successful
     	 * but indicates that we got a "busy" or "timeout" condition, retry
    -	 * the HELLO until we exhaust our retry limit.
    +	 * the HELLO until we exhaust our retry limit.  If we do exceed our
    +	 * retry limit, check to see if the firmware left us any error
    +	 * information and report that if so ...
     	 */
     	ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c);
     	if (ret != FW_SUCCESS) {
     		if ((ret == -EBUSY || ret == -ETIMEDOUT) && retries-- > 0)
     			goto retry;
    +		if (t4_read_reg(adap, A_PCIE_FW) & F_PCIE_FW_ERR)
    +			t4_report_fw_error(adap);
     		return ret;
     	}
     
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 21:37:13 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 2F9793D7;
     Tue, 26 Feb 2013 21:37:13 +0000 (UTC)
     (envelope-from mjacob@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 176EB206;
     Tue, 26 Feb 2013 21:37:13 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QLbC9q072766;
     Tue, 26 Feb 2013 21:37:12 GMT (envelope-from mjacob@svn.freebsd.org)
    Received: (from mjacob@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QLbCw2072765;
     Tue, 26 Feb 2013 21:37:12 GMT (envelope-from mjacob@svn.freebsd.org)
    Message-Id: <201302262137.r1QLbCw2072765@svn.freebsd.org>
    From: Matt Jacob 
    Date: Tue, 26 Feb 2013 21:37:12 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247356 - head/sys/dev/isp
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 21:37:13 -0000
    
    Author: mjacob
    Date: Tue Feb 26 21:37:12 2013
    New Revision: 247356
    URL: http://svnweb.freebsd.org/changeset/base/247356
    
    Log:
      Remove redundant xpt_alloc_ccb in isp_target_thread that was causing leakage.
      
      Pointed out by:	Sascha Wildner of DragonFly BSD
      MFC after:	1 week
    
    Modified:
      head/sys/dev/isp/isp_freebsd.c
    
    Modified: head/sys/dev/isp/isp_freebsd.c
    ==============================================================================
    --- head/sys/dev/isp/isp_freebsd.c	Tue Feb 26 21:25:17 2013	(r247355)
    +++ head/sys/dev/isp/isp_freebsd.c	Tue Feb 26 21:37:12 2013	(r247356)
    @@ -4140,8 +4140,6 @@ isp_target_thread(ispsoftc_t *isp, int c
     		return;
     	}
     
    -	ccb = xpt_alloc_ccb();
    -
     	ISP_LOCK(isp);
     	status = cam_periph_alloc(isptargctor, NULL, isptargdtor, isptargstart, "isptarg", CAM_PERIPH_BIO, wpath, NULL, 0, softc);
     	if (status != CAM_REQ_CMP) {
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 23:18:36 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 9713F386;
     Tue, 26 Feb 2013 23:18:36 +0000 (UTC)
     (envelope-from n_hibma@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 89A7B8AF;
     Tue, 26 Feb 2013 23:18:36 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QNIaUt003864;
     Tue, 26 Feb 2013 23:18:36 GMT (envelope-from n_hibma@svn.freebsd.org)
    Received: (from n_hibma@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QNIauL003863;
     Tue, 26 Feb 2013 23:18:36 GMT (envelope-from n_hibma@svn.freebsd.org)
    Message-Id: <201302262318.r1QNIauL003863@svn.freebsd.org>
    From: Nick Hibma 
    Date: Tue, 26 Feb 2013 23:18:36 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247359 - head/sbin/reboot
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 23:18:36 -0000
    
    Author: n_hibma
    Date: Tue Feb 26 23:18:35 2013
    New Revision: 247359
    URL: http://svnweb.freebsd.org/changeset/base/247359
    
    Log:
      Clarify that overriding the -h/-D flags through flags in device.hints
      only works for sio(4) but not for uart(4) which no longer has this flag.
    
    Modified:
      head/sbin/reboot/boot_i386.8
    
    Modified: head/sbin/reboot/boot_i386.8
    ==============================================================================
    --- head/sbin/reboot/boot_i386.8	Tue Feb 26 22:08:10 2013	(r247358)
    +++ head/sbin/reboot/boot_i386.8	Tue Feb 26 23:18:35 2013	(r247359)
    @@ -220,15 +220,14 @@ you can use the
     option to force the kernel to use the serial port as its
     console device.
     The serial port driver
    -.Xr uart 4
    +.Xr sio 4
    +(but not
    +.Xr uart 4 )
     has a flag (0x20) to override this option.
     If that flag is set, the serial port will always be used as the console,
     regardless of the
     .Fl h
     option described here.
    -See the man page for
    -.Xr uart 4
    -for more details.
     .It Fl m
     mute the console to suppress all console input and output during the
     boot.
    
    From owner-svn-src-head@FreeBSD.ORG  Tue Feb 26 23:35:29 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id A5343942;
     Tue, 26 Feb 2013 23:35:29 +0000 (UTC)
     (envelope-from attilio@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 881A8941;
     Tue, 26 Feb 2013 23:35:29 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QNZT8O009329;
     Tue, 26 Feb 2013 23:35:29 GMT (envelope-from attilio@svn.freebsd.org)
    Received: (from attilio@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QNZR4x009316;
     Tue, 26 Feb 2013 23:35:27 GMT (envelope-from attilio@svn.freebsd.org)
    Message-Id: <201302262335.r1QNZR4x009316@svn.freebsd.org>
    From: Attilio Rao 
    Date: Tue, 26 Feb 2013 23:35:27 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247360 - in head/sys: arm/arm powerpc/booke vm
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 23:35:29 -0000
    
    Author: attilio
    Date: Tue Feb 26 23:35:27 2013
    New Revision: 247360
    URL: http://svnweb.freebsd.org/changeset/base/247360
    
    Log:
      Merge from vmc-playground branch:
      Replace the sub-optimal uma_zone_set_obj() primitive with more modern
      uma_zone_reserve_kva().  The new primitive reserves before hand
      the necessary KVA space to cater the zone allocations and allocates pages
      with ALLOC_NOOBJ.  More specifically:
      - uma_zone_reserve_kva() does not need an object to cater the backend
        allocator.
      - uma_zone_reserve_kva() can cater M_WAITOK requests, in order to
        serve zones which need to do uma_prealloc() too.
      - When possible, uma_zone_reserve_kva() uses directly the direct-mapping
        by uma_small_alloc() rather than relying on the KVA / offset
        combination.
      
      The removal of the object attribute allows 2 further changes:
      1) _vm_object_allocate() becomes static within vm_object.c
      2) VM_OBJECT_LOCK_INIT() is removed.  This function is replaced by
         direct calls to mtx_init() as there is no need to export it anymore
         and the calls aren't either homogeneous anymore: there are now small
         differences between arguments passed to mtx_init().
      
      Sponsored by:	EMC / Isilon storage division
      Reviewed by:	alc (which also offered almost all the comments)
      Tested by:	pho, jhb, davide
    
    Modified:
      head/sys/arm/arm/pmap-v6.c
      head/sys/arm/arm/pmap.c
      head/sys/powerpc/booke/pmap.c
      head/sys/vm/swap_pager.c
      head/sys/vm/uma.h
      head/sys/vm/uma_core.c
      head/sys/vm/uma_int.h
      head/sys/vm/vm_map.c
      head/sys/vm/vm_object.c
      head/sys/vm/vm_object.h
    
    Modified: head/sys/arm/arm/pmap-v6.c
    ==============================================================================
    --- head/sys/arm/arm/pmap-v6.c	Tue Feb 26 23:18:35 2013	(r247359)
    +++ head/sys/arm/arm/pmap-v6.c	Tue Feb 26 23:35:27 2013	(r247360)
    @@ -392,7 +392,6 @@ static uma_zone_t l2table_zone;
     static vm_offset_t pmap_kernel_l2dtable_kva;
     static vm_offset_t pmap_kernel_l2ptp_kva;
     static vm_paddr_t pmap_kernel_l2ptp_phys;
    -static struct vm_object pvzone_obj;
     static int pv_entry_count=0, pv_entry_max=0, pv_entry_high_water=0;
     static struct rwlock pvh_global_lock;
     
    @@ -1164,7 +1163,7 @@ pmap_init(void)
     	    NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM | UMA_ZONE_NOFREE);
     	TUNABLE_INT_FETCH("vm.pmap.shpgperproc", &shpgperproc);
     	pv_entry_max = shpgperproc * maxproc + cnt.v_page_count;
    -	uma_zone_set_obj(pvzone, &pvzone_obj, pv_entry_max);
    +	uma_zone_reserve_kva(pvzone, pv_entry_max);
     	pv_entry_high_water = 9 * (pv_entry_max / 10);
     
     	/*
    
    Modified: head/sys/arm/arm/pmap.c
    ==============================================================================
    --- head/sys/arm/arm/pmap.c	Tue Feb 26 23:18:35 2013	(r247359)
    +++ head/sys/arm/arm/pmap.c	Tue Feb 26 23:35:27 2013	(r247360)
    @@ -397,7 +397,6 @@ static uma_zone_t l2table_zone;
     static vm_offset_t pmap_kernel_l2dtable_kva;
     static vm_offset_t pmap_kernel_l2ptp_kva;
     static vm_paddr_t pmap_kernel_l2ptp_phys;
    -static struct vm_object pvzone_obj;
     static int pv_entry_count=0, pv_entry_max=0, pv_entry_high_water=0;
     static struct rwlock pvh_global_lock;
     
    @@ -1828,7 +1827,7 @@ pmap_init(void)
     	    NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM | UMA_ZONE_NOFREE);
     	TUNABLE_INT_FETCH("vm.pmap.shpgperproc", &shpgperproc);
     	pv_entry_max = shpgperproc * maxproc + cnt.v_page_count;
    -	uma_zone_set_obj(pvzone, &pvzone_obj, pv_entry_max);
    +	uma_zone_reserve_kva(pvzone, pv_entry_max);
     	pv_entry_high_water = 9 * (pv_entry_max / 10);
     
     	/*
    
    Modified: head/sys/powerpc/booke/pmap.c
    ==============================================================================
    --- head/sys/powerpc/booke/pmap.c	Tue Feb 26 23:18:35 2013	(r247359)
    +++ head/sys/powerpc/booke/pmap.c	Tue Feb 26 23:35:27 2013	(r247360)
    @@ -217,7 +217,6 @@ static struct rwlock_padalign pvh_global
     
     /* Data for the pv entry allocation mechanism */
     static uma_zone_t pvzone;
    -static struct vm_object pvzone_obj;
     static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0;
     
     #define PV_ENTRY_ZONE_MIN	2048	/* min pv entries in uma zone */
    @@ -1343,7 +1342,7 @@ mmu_booke_init(mmu_t mmu)
     	TUNABLE_INT_FETCH("vm.pmap.pv_entries", &pv_entry_max);
     	pv_entry_high_water = 9 * (pv_entry_max / 10);
     
    -	uma_zone_set_obj(pvzone, &pvzone_obj, pv_entry_max);
    +	uma_zone_reserve_kva(pvzone, pv_entry_max);
     
     	/* Pre-fill pvzone with initial number of pv entries. */
     	uma_prealloc(pvzone, PV_ENTRY_ZONE_MIN);
    
    Modified: head/sys/vm/swap_pager.c
    ==============================================================================
    --- head/sys/vm/swap_pager.c	Tue Feb 26 23:18:35 2013	(r247359)
    +++ head/sys/vm/swap_pager.c	Tue Feb 26 23:35:27 2013	(r247360)
    @@ -343,7 +343,6 @@ SYSCTL_INT(_vm, OID_AUTO, swap_async_max
     static struct mtx sw_alloc_mtx;	/* protect list manipulation */
     static struct pagerlst	swap_pager_object_list[NOBJLISTS];
     static uma_zone_t	swap_zone;
    -static struct vm_object	swap_zone_obj;
     
     /*
      * pagerops for OBJT_SWAP - "swap pager".  Some ops are also global procedure
    @@ -554,7 +553,7 @@ swap_pager_swap_init(void)
     	if (swap_zone == NULL)
     		panic("failed to create swap_zone.");
     	do {
    -		if (uma_zone_set_obj(swap_zone, &swap_zone_obj, n))
    +		if (uma_zone_reserve_kva(swap_zone, n))
     			break;
     		/*
     		 * if the allocation failed, try a zone two thirds the
    
    Modified: head/sys/vm/uma.h
    ==============================================================================
    --- head/sys/vm/uma.h	Tue Feb 26 23:18:35 2013	(r247359)
    +++ head/sys/vm/uma.h	Tue Feb 26 23:35:27 2013	(r247360)
    @@ -432,24 +432,23 @@ void uma_reclaim(void);
     void uma_set_align(int align);
     
     /*
    - * Switches the backing object of a zone
    + * Reserves the maximum KVA space required by the zone and configures the zone
    + * to use a VM_ALLOC_NOOBJ-based backend allocator.
      *
      * Arguments:
      *	zone  The zone to update.
    - *	obj   The VM object to use for future allocations.
    - *	size  The size of the object to allocate.
    + *	nitems  The upper limit on the number of items that can be allocated.
      *
      * Returns:
    - *	0  if kva space can not be allocated
    + *	0  if KVA space can not be allocated
      *	1  if successful
      *
      * Discussion:
    - *	A NULL object can be used and uma will allocate one for you.  Setting
    - *	the size will limit the amount of memory allocated to this zone.
    - *
    + *	When the machine supports a direct map and the zone's items are smaller
    + *	than a page, the zone will use the direct map instead of allocating KVA
    + *	space.
      */
    -struct vm_object;
    -int uma_zone_set_obj(uma_zone_t zone, struct vm_object *obj, int size);
    +int uma_zone_reserve_kva(uma_zone_t zone, int nitems);
     
     /*
      * Sets a high limit on the number of items allowed in a zone
    @@ -521,7 +520,7 @@ void uma_zone_set_zinit(uma_zone_t zone,
     void uma_zone_set_zfini(uma_zone_t zone, uma_fini zfini);
     
     /*
    - * Replaces the standard page_alloc or obj_alloc functions for this zone
    + * Replaces the standard backend allocator for this zone.
      *
      * Arguments:
      *	zone   The zone whose backend allocator is being changed.
    
    Modified: head/sys/vm/uma_core.c
    ==============================================================================
    --- head/sys/vm/uma_core.c	Tue Feb 26 23:18:35 2013	(r247359)
    +++ head/sys/vm/uma_core.c	Tue Feb 26 23:35:27 2013	(r247360)
    @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    +#include 
     #include 
     #include 
     #include 
    @@ -213,7 +214,7 @@ enum zfreeskip { SKIP_NONE, SKIP_DTOR, S
     
     /* Prototypes.. */
     
    -static void *obj_alloc(uma_zone_t, int, u_int8_t *, int);
    +static void *noobj_alloc(uma_zone_t, int, u_int8_t *, int);
     static void *page_alloc(uma_zone_t, int, u_int8_t *, int);
     static void *startup_alloc(uma_zone_t, int, u_int8_t *, int);
     static void page_free(void *, int, u_int8_t);
    @@ -1030,50 +1031,53 @@ page_alloc(uma_zone_t zone, int bytes, u
      *	NULL if M_NOWAIT is set.
      */
     static void *
    -obj_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
    +noobj_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
     {
    -	vm_object_t object;
    +	TAILQ_HEAD(, vm_page) alloctail;
    +	u_long npages;
     	vm_offset_t retkva, zkva;
    -	vm_page_t p;
    -	int pages, startpages;
    +	vm_page_t p, p_next;
     	uma_keg_t keg;
     
    +	TAILQ_INIT(&alloctail);
     	keg = zone_first_keg(zone);
    -	object = keg->uk_obj;
    -	retkva = 0;
     
    -	/*
    -	 * This looks a little weird since we're getting one page at a time.
    -	 */
    -	VM_OBJECT_LOCK(object);
    -	p = TAILQ_LAST(&object->memq, pglist);
    -	pages = p != NULL ? p->pindex + 1 : 0;
    -	startpages = pages;
    -	zkva = keg->uk_kva + pages * PAGE_SIZE;
    -	for (; bytes > 0; bytes -= PAGE_SIZE) {
    -		p = vm_page_alloc(object, pages,
    -		    VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED);
    -		if (p == NULL) {
    -			if (pages != startpages)
    -				pmap_qremove(retkva, pages - startpages);
    -			while (pages != startpages) {
    -				pages--;
    -				p = TAILQ_LAST(&object->memq, pglist);
    -				vm_page_unwire(p, 0);
    -				vm_page_free(p);
    -			}
    -			retkva = 0;
    -			goto done;
    +	npages = howmany(bytes, PAGE_SIZE);
    +	while (npages > 0) {
    +		p = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT |
    +		    VM_ALLOC_WIRED | VM_ALLOC_NOOBJ);
    +		if (p != NULL) {
    +			/*
    +			 * Since the page does not belong to an object, its
    +			 * listq is unused.
    +			 */
    +			TAILQ_INSERT_TAIL(&alloctail, p, listq);
    +			npages--;
    +			continue;
    +		}
    +		if (wait & M_WAITOK) {
    +			VM_WAIT;
    +			continue;
     		}
    +
    +		/*
    +		 * Page allocation failed, free intermediate pages and
    +		 * exit.
    +		 */
    +		TAILQ_FOREACH_SAFE(p, &alloctail, listq, p_next) {
    +			vm_page_unwire(p, 0);
    +			vm_page_free(p); 
    +		}
    +		return (NULL);
    +	}
    +	*flags = UMA_SLAB_PRIV;
    +	zkva = keg->uk_kva +
    +	    atomic_fetchadd_long(&keg->uk_offset, round_page(bytes));
    +	retkva = zkva;
    +	TAILQ_FOREACH(p, &alloctail, listq) {
     		pmap_qenter(zkva, &p, 1);
    -		if (retkva == 0)
    -			retkva = zkva;
     		zkva += PAGE_SIZE;
    -		pages += 1;
     	}
    -done:
    -	VM_OBJECT_UNLOCK(object);
    -	*flags = UMA_SLAB_PRIV;
     
     	return ((void *)retkva);
     }
    @@ -3012,7 +3016,7 @@ uma_zone_set_allocf(uma_zone_t zone, uma
     
     /* See uma.h */
     int
    -uma_zone_set_obj(uma_zone_t zone, struct vm_object *obj, int count)
    +uma_zone_reserve_kva(uma_zone_t zone, int count)
     {
     	uma_keg_t keg;
     	vm_offset_t kva;
    @@ -3024,21 +3028,25 @@ uma_zone_set_obj(uma_zone_t zone, struct
     	if (pages * keg->uk_ipers < count)
     		pages++;
     
    -	kva = kmem_alloc_nofault(kernel_map, pages * UMA_SLAB_SIZE);
    -
    -	if (kva == 0)
    -		return (0);
    -	if (obj == NULL)
    -		obj = vm_object_allocate(OBJT_PHYS, pages);
    -	else {
    -		VM_OBJECT_LOCK_INIT(obj, "uma object");
    -		_vm_object_allocate(OBJT_PHYS, pages, obj);
    -	}
    +#ifdef UMA_MD_SMALL_ALLOC
    +	if (keg->uk_ppera > 1) {
    +#else
    +	if (1) {
    +#endif
    +		kva = kmem_alloc_nofault(kernel_map, pages * UMA_SLAB_SIZE);
    +		if (kva == 0)
    +			return (0);
    +	} else
    +		kva = 0;
     	ZONE_LOCK(zone);
     	keg->uk_kva = kva;
    -	keg->uk_obj = obj;
    +	keg->uk_offset = 0;
     	keg->uk_maxpages = pages;
    -	keg->uk_allocf = obj_alloc;
    +#ifdef UMA_MD_SMALL_ALLOC
    +	keg->uk_allocf = (keg->uk_ppera > 1) ? noobj_alloc : uma_small_alloc;
    +#else
    +	keg->uk_allocf = noobj_alloc;
    +#endif
     	keg->uk_flags |= UMA_ZONE_NOFREE | UMA_ZFLAG_PRIVALLOC;
     	ZONE_UNLOCK(zone);
     	return (1);
    
    Modified: head/sys/vm/uma_int.h
    ==============================================================================
    --- head/sys/vm/uma_int.h	Tue Feb 26 23:18:35 2013	(r247359)
    +++ head/sys/vm/uma_int.h	Tue Feb 26 23:35:27 2013	(r247360)
    @@ -221,8 +221,8 @@ struct uma_keg {
     	uma_alloc	uk_allocf;	/* Allocation function */
     	uma_free	uk_freef;	/* Free routine */
     
    -	struct vm_object	*uk_obj;	/* Zone specific object */
    -	vm_offset_t	uk_kva;		/* Base kva for zones with objs */
    +	u_long		uk_offset;	/* Next free offset from base KVA */
    +	vm_offset_t	uk_kva;		/* Zone base KVA */
     	uma_zone_t	uk_slabzone;	/* Slab zone backing us, if OFFPAGE */
     
     	u_int16_t	uk_pgoff;	/* Offset to uma_slab struct */
    
    Modified: head/sys/vm/vm_map.c
    ==============================================================================
    --- head/sys/vm/vm_map.c	Tue Feb 26 23:18:35 2013	(r247359)
    +++ head/sys/vm/vm_map.c	Tue Feb 26 23:35:27 2013	(r247360)
    @@ -125,7 +125,6 @@ static uma_zone_t mapentzone;
     static uma_zone_t kmapentzone;
     static uma_zone_t mapzone;
     static uma_zone_t vmspace_zone;
    -static struct vm_object kmapentobj;
     static int vmspace_zinit(void *mem, int size, int flags);
     static void vmspace_zfini(void *mem, int size);
     static int vm_map_zinit(void *mem, int ize, int flags);
    @@ -303,7 +302,7 @@ vmspace_alloc(min, max)
     void
     vm_init2(void)
     {
    -	uma_zone_set_obj(kmapentzone, &kmapentobj, lmin(cnt.v_page_count,
    +	uma_zone_reserve_kva(kmapentzone, lmin(cnt.v_page_count,
     	    (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE) / 8 +
     	     maxproc * 2 + maxfiles);
     	vmspace_zone = uma_zcreate("VMSPACE", sizeof(struct vmspace), NULL,
    
    Modified: head/sys/vm/vm_object.c
    ==============================================================================
    --- head/sys/vm/vm_object.c	Tue Feb 26 23:18:35 2013	(r247359)
    +++ head/sys/vm/vm_object.c	Tue Feb 26 23:35:27 2013	(r247360)
    @@ -194,7 +194,7 @@ vm_object_zinit(void *mem, int size, int
     
     	object = (vm_object_t)mem;
     	bzero(&object->mtx, sizeof(object->mtx));
    -	VM_OBJECT_LOCK_INIT(object, "standard object");
    +	mtx_init(&object->mtx, "vm object", NULL, MTX_DEF | MTX_DUPOK);
     
     	/* These are true for any object that has been freed */
     	object->paging_in_progress = 0;
    @@ -203,7 +203,7 @@ vm_object_zinit(void *mem, int size, int
     	return (0);
     }
     
    -void
    +static void
     _vm_object_allocate(objtype_t type, vm_pindex_t size, vm_object_t object)
     {
     
    @@ -266,7 +266,7 @@ vm_object_init(void)
     	TAILQ_INIT(&vm_object_list);
     	mtx_init(&vm_object_list_mtx, "vm object_list", NULL, MTX_DEF);
     	
    -	VM_OBJECT_LOCK_INIT(kernel_object, "kernel object");
    +	mtx_init(&kernel_object->mtx, "vm object", "kernel object", MTX_DEF);
     	_vm_object_allocate(OBJT_PHYS, OFF_TO_IDX(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS),
     	    kernel_object);
     #if VM_NRESERVLEVEL > 0
    @@ -274,7 +274,7 @@ vm_object_init(void)
     	kernel_object->pg_color = (u_short)atop(VM_MIN_KERNEL_ADDRESS);
     #endif
     
    -	VM_OBJECT_LOCK_INIT(kmem_object, "kmem object");
    +	mtx_init(&kmem_object->mtx, "vm object", "kmem object", MTX_DEF);
     	_vm_object_allocate(OBJT_PHYS, OFF_TO_IDX(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS),
     	    kmem_object);
     #if VM_NRESERVLEVEL > 0
    
    Modified: head/sys/vm/vm_object.h
    ==============================================================================
    --- head/sys/vm/vm_object.h	Tue Feb 26 23:18:35 2013	(r247359)
    +++ head/sys/vm/vm_object.h	Tue Feb 26 23:35:27 2013	(r247360)
    @@ -206,9 +206,6 @@ extern struct vm_object kmem_object_stor
     #define	VM_OBJECT_LOCK(object)		mtx_lock(&(object)->mtx)
     #define	VM_OBJECT_LOCK_ASSERT(object, type) \
     					mtx_assert(&(object)->mtx, (type))
    -#define	VM_OBJECT_LOCK_INIT(object, type) \
    -					mtx_init(&(object)->mtx, "vm object", \
    -					    (type), MTX_DEF | MTX_DUPOK)
     #define	VM_OBJECT_LOCKED(object)	mtx_owned(&(object)->mtx)
     #define	VM_OBJECT_SLEEP(object, wchan, pri, wmesg, timo) \
     					msleep((wchan), &(object)->mtx, (pri), \
    @@ -234,7 +231,6 @@ void vm_object_pip_wakeupn(vm_object_t o
     void vm_object_pip_wait(vm_object_t object, char *waitid);
     
     vm_object_t vm_object_allocate (objtype_t, vm_pindex_t);
    -void _vm_object_allocate (objtype_t, vm_pindex_t, vm_object_t);
     boolean_t vm_object_coalesce(vm_object_t, vm_ooffset_t, vm_size_t, vm_size_t,
        boolean_t);
     void vm_object_collapse (vm_object_t);
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 00:01:28 2013
    Return-Path: 
    Delivered-To: svn-src-head@FreeBSD.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id BA6F952A;
     Wed, 27 Feb 2013 00:01:28 +0000 (UTC) (envelope-from grog@lemis.com)
    Received: from w3.lemis.com (w3.lemis.com [208.86.224.149])
     by mx1.freebsd.org (Postfix) with ESMTP id 75B6AA4F;
     Wed, 27 Feb 2013 00:01:28 +0000 (UTC)
    Received: from eureka.lemis.com (1032.x.rootbsd.net [208.86.224.149])
     by w3.lemis.com (Postfix) with ESMTP id BB0833B736;
     Wed, 27 Feb 2013 00:01:26 +0000 (UTC)
    Received: by eureka.lemis.com (Postfix, from userid 1004)
     id 7D460F74FA; Wed, 27 Feb 2013 11:01:25 +1100 (EST)
    Date: Wed, 27 Feb 2013 11:01:25 +1100
    From: Greg 'groggy' Lehey 
    To: Jilles Tjoelker 
    Subject: Re: svn commit: r247274 - in head: bin/test tools/regression/bin/test
    Message-ID: <20130227000125.GA7223@eureka.lemis.com>
    References: <201302251905.r1PJ5fKF085179@svn.freebsd.org>
     <20130226000227.GA80718@stack.nl>
    Mime-Version: 1.0
    Content-Type: multipart/signed; micalg=pgp-sha1;
     protocol="application/pgp-signature"; boundary="RnlQjJ0d97Da+TV1"
    Content-Disposition: inline
    In-Reply-To: <20130226000227.GA80718@stack.nl>
    User-Agent: Mutt/1.4.2.3i
    Organization: The FreeBSD Project
    Phone: +61-3-5346-1370
    Mobile: +61-418-838-708
    WWW-Home-Page: http://www.FreeBSD.org/
    X-PGP-Fingerprint: 9A1B 8202 BCCE B846 F92F  09AC 22E6 F290 507A 4223
    Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
     Peter Jeremy , src-committers@FreeBSD.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 00:01:28 -0000
    
    
    --RnlQjJ0d97Da+TV1
    Content-Type: text/plain; charset=us-ascii
    Content-Disposition: inline
    
    On Tuesday, 26 February 2013 at  1:02:27 +0100, Jilles Tjoelker wrote:
    > On Mon, Feb 25, 2013 at 07:05:41PM +0000, Peter Jeremy wrote:
    >> Author: peterj
    >> Date: Mon Feb 25 19:05:40 2013
    >> New Revision: 247274
    >> URL: http://svnweb.freebsd.org/changeset/base/247274
    >
    >> Log:
    >>   Enhance test(1) by adding provision to compare any combination of the
    >>   access, birth, change and modify times of two files, instead of only
    >>   being able to compare modify times.  The builtin test in sh(1) will
    >>   automagically acquire the same expansion.
    >
    >>   Approved by:	grog
    >>   MFC after:	2 weeks
    >
    > What do you need this for?
    
    Lots of things.  For example, I need it to compare photos I have
    created and then set the timestamp to the time of exposure.  The only
    way I can establish that the image is newer is via the creation
    timestamp.  In the past I've wished I had the functionality for other
    reasons I now forget.  Peter has other reasons again.  I expect other
    users to also find this useful.
    
    Arguably comparing different kinds of timestamps is not very useful,
    but then, that's "arguably".  Others might find a use for it.
    
    > If it is not needed very often, this test can
    > be done more portably (older FreeBSD and GNU) as
    >   [ -n "$(find -L FILE1 -prune -newerXY FILE2 2>/dev/null)" ]
    
    That's really ugly.  It's also difficult for the casual reader to
    understand.
    
    > I have generally been rather reluctant in adding things to sh(1) and
    > even more so if they are completely new. Someone proposed something
    > rather similar (except that it added a time string parser -- even more
    > code) in PR bin/57054 and I rejected it in 2009.
    
    That was a much larger chunk of code.  And times change.  In December
    1998 I added an -S option to ls(1), and jkh (my mentor) refused it on
    the basis of bloat.  In June 2005, keramida submitted similar
    functionality, and it was committed as revision 146924.  It's also
    functionality that I use frequently.
    
    Re bloat.  Here's before and after:
    
       text    data     bss     dec     hex filename
      25645    1152    4720   31517    7b1d /bin/ls
      26718    1168    4840   32726    7fd6 /bin/ls
    
    A little over a kilobyte.  Peter even went to the trouble of keeping
    the size of the operator table entries the same.  I think the
    additional size is justifiable.
    
    Greg
    --
    Sent from my desktop computer.
    Finger grog@FreeBSD.org for PGP public key.
    See complete headers for address and phone numbers.
    This message is digitally signed.  If your Microsoft MUA reports
    problems, please read http://tinyurl.com/broken-mua
    
    --RnlQjJ0d97Da+TV1
    Content-Type: application/pgp-signature
    Content-Disposition: inline
    
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.19 (FreeBSD)
    
    iEYEARECAAYFAlEtTNQACgkQIubykFB6QiO7sQCfc/WV5Xbi4kxv+tn+1EMR6LCO
    DroAn3dbK/kQpgRG2xuJflfqmK389BN6
    =NPID
    -----END PGP SIGNATURE-----
    
    --RnlQjJ0d97Da+TV1--
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 00:25:45 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 6881B6C3;
     Wed, 27 Feb 2013 00:25:45 +0000 (UTC)
     (envelope-from adrian@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 4FF13CC9;
     Wed, 27 Feb 2013 00:25:45 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1R0Pj7h024942;
     Wed, 27 Feb 2013 00:25:45 GMT (envelope-from adrian@svn.freebsd.org)
    Received: (from adrian@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1R0Pi0E024938;
     Wed, 27 Feb 2013 00:25:44 GMT (envelope-from adrian@svn.freebsd.org)
    Message-Id: <201302270025.r1R0Pi0E024938@svn.freebsd.org>
    From: Adrian Chadd 
    Date: Wed, 27 Feb 2013 00:25:44 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247366 - in head/sys/dev/ath: . ath_hal
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 00:25:45 -0000
    
    Author: adrian
    Date: Wed Feb 27 00:25:44 2013
    New Revision: 247366
    URL: http://svnweb.freebsd.org/changeset/base/247366
    
    Log:
      Add in the STBC TX/RX capability support into the HAL and driver.
      
      The HAL already included the STBC fields; it just needed to be exposed
      to the driver and net80211 stack.
      
      This should allow single-stream STBC TX and RX to be negotiated; however
      the driver and rate control code currently don't do anything with it.
    
    Modified:
      head/sys/dev/ath/ath_hal/ah.c
      head/sys/dev/ath/ath_hal/ah.h
      head/sys/dev/ath/if_ath.c
      head/sys/dev/ath/if_athvar.h
    
    Modified: head/sys/dev/ath/ath_hal/ah.c
    ==============================================================================
    --- head/sys/dev/ath/ath_hal/ah.c	Wed Feb 27 00:14:12 2013	(r247365)
    +++ head/sys/dev/ath/ath_hal/ah.c	Wed Feb 27 00:25:44 2013	(r247366)
    @@ -692,6 +692,10 @@ ath_hal_getcapability(struct ath_hal *ah
     		return pCap->hal4AddrAggrSupport ? HAL_OK : HAL_ENOTSUPP;
     	case HAL_CAP_EXT_CHAN_DFS:
     		return pCap->halExtChanDfsSupport ? HAL_OK : HAL_ENOTSUPP;
    +	case HAL_CAP_RX_STBC:
    +		return pCap->halRxStbcSupport ? HAL_OK : HAL_ENOTSUPP;
    +	case HAL_CAP_TX_STBC:
    +		return pCap->halTxStbcSupport ? HAL_OK : HAL_ENOTSUPP;
     	case HAL_CAP_COMBINED_RADAR_RSSI:
     		return pCap->halUseCombinedRadarRssi ? HAL_OK : HAL_ENOTSUPP;
     	case HAL_CAP_AUTO_SLEEP:
    
    Modified: head/sys/dev/ath/ath_hal/ah.h
    ==============================================================================
    --- head/sys/dev/ath/ath_hal/ah.h	Wed Feb 27 00:14:12 2013	(r247365)
    +++ head/sys/dev/ath/ath_hal/ah.h	Wed Feb 27 00:25:44 2013	(r247366)
    @@ -137,6 +137,9 @@ typedef enum {
     	HAL_CAP_RIFS_RX_ENABLED	= 53,
     	HAL_CAP_BB_DFS_HANG	= 54,
     
    +	HAL_CAP_RX_STBC		= 58,
    +	HAL_CAP_TX_STBC		= 59,
    +
     	HAL_CAP_BT_COEX		= 60,	/* hardware is capable of bluetooth coexistence */
     	HAL_CAP_DYNAMIC_SMPS	= 61,	/* Dynamic MIMO Power Save hardware support */
     
    
    Modified: head/sys/dev/ath/if_ath.c
    ==============================================================================
    --- head/sys/dev/ath/if_ath.c	Wed Feb 27 00:14:12 2013	(r247365)
    +++ head/sys/dev/ath/if_ath.c	Wed Feb 27 00:25:44 2013	(r247366)
    @@ -781,6 +781,28 @@ ath_attach(u_int16_t devid, struct ath_s
     		ic->ic_txstream = txs;
     		ic->ic_rxstream = rxs;
     
    +		/*
    +		 * Setup TX and RX STBC based on what the HAL allows and
    +		 * the currently configured chainmask set.
    +		 * Ie - don't enable STBC TX if only one chain is enabled.
    +		 * STBC RX is fine on a single RX chain; it just won't
    +		 * provide any real benefit.
    +		 */
    +		if (ath_hal_getcapability(ah, HAL_CAP_RX_STBC, 0,
    +		    NULL) == HAL_OK) {
    +			sc->sc_rx_stbc = 1;
    +			device_printf(sc->sc_dev,
    +			    "[HT] 1 stream STBC receive enabled\n");
    +			ic->ic_htcaps |= IEEE80211_HTCAP_RXSTBC_1STREAM;
    +		}
    +		if (txs > 1 && ath_hal_getcapability(ah, HAL_CAP_TX_STBC, 0,
    +		    NULL) == HAL_OK) {
    +			sc->sc_tx_stbc = 1;
    +			device_printf(sc->sc_dev,
    +			    "[HT] 1 stream STBC transmit enabled\n");
    +			ic->ic_htcaps |= IEEE80211_HTCAP_TXSTBC;
    +		}
    +
     		(void) ath_hal_getcapability(ah, HAL_CAP_RTS_AGGR_LIMIT, 1,
     		    &sc->sc_rts_aggr_limit);
     		if (sc->sc_rts_aggr_limit != (64 * 1024))
    
    Modified: head/sys/dev/ath/if_athvar.h
    ==============================================================================
    --- head/sys/dev/ath/if_athvar.h	Wed Feb 27 00:14:12 2013	(r247365)
    +++ head/sys/dev/ath/if_athvar.h	Wed Feb 27 00:25:44 2013	(r247366)
    @@ -567,7 +567,9 @@ struct ath_softc {
     	/*
     	 * Second set of flags.
     	 */
    -	u_int32_t		sc_use_ent  : 1;
    +	u_int32_t		sc_use_ent  : 1,
    +				sc_rx_stbc  : 1,
    +				sc_tx_stbc  : 1;
     
     	/*
     	 * Enterprise mode configuration for AR9380 and later chipsets.
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 00:35:41 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id C71A1DE6;
     Wed, 27 Feb 2013 00:35:41 +0000 (UTC) (envelope-from smh@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id B866ED53;
     Wed, 27 Feb 2013 00:35:41 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1R0ZfNS028014;
     Wed, 27 Feb 2013 00:35:41 GMT (envelope-from smh@svn.freebsd.org)
    Received: (from smh@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1R0Zft7028012;
     Wed, 27 Feb 2013 00:35:41 GMT (envelope-from smh@svn.freebsd.org)
    Message-Id: <201302270035.r1R0Zft7028012@svn.freebsd.org>
    From: Steven Hartland 
    Date: Wed, 27 Feb 2013 00:35:41 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247367 - head/sys/dev/mfi
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 00:35:41 -0000
    
    Author: smh
    Date: Wed Feb 27 00:35:40 2013
    New Revision: 247367
    URL: http://svnweb.freebsd.org/changeset/base/247367
    
    Log:
      Fixes mfi panic on recused on non-recusive mutex MFI I/O lock
      
      Removes a mtx_unlock call for mfi_io_lock which is never aquired
      
      While I'm here fix a braceing style issue.
      
      Reviewed by:	Doug Ambrisko
      Approved by:	pjd (mentor)
      MFC after:	1 month
    
    Modified:
      head/sys/dev/mfi/mfi.c
      head/sys/dev/mfi/mfi_tbolt.c
    
    Modified: head/sys/dev/mfi/mfi.c
    ==============================================================================
    --- head/sys/dev/mfi/mfi.c	Wed Feb 27 00:25:44 2013	(r247366)
    +++ head/sys/dev/mfi/mfi.c	Wed Feb 27 00:35:40 2013	(r247367)
    @@ -723,10 +723,8 @@ mfi_attach(struct mfi_softc *sc)
     		    "hook\n");
     		return (EINVAL);
     	}
    -	if ((error = mfi_aen_setup(sc, 0), 0) != 0) {
    -		mtx_unlock(&sc->mfi_io_lock);
    +	if ((error = mfi_aen_setup(sc, 0), 0) != 0)
     		return (error);
    -	}
     
     	/*
     	 * Register a shutdown handler.
    
    Modified: head/sys/dev/mfi/mfi_tbolt.c
    ==============================================================================
    --- head/sys/dev/mfi/mfi_tbolt.c	Wed Feb 27 00:25:44 2013	(r247366)
    +++ head/sys/dev/mfi/mfi_tbolt.c	Wed Feb 27 00:35:40 2013	(r247367)
    @@ -1194,6 +1194,7 @@ mfi_process_fw_state_chg_isr(void *arg)
     			sc->hw_crit_error= 1;
     			return ;
     		}
    +		mtx_unlock(&sc->mfi_io_lock);
     		if ((error = mfi_tbolt_init_MFI_queue(sc)) != 0)
     				return;
     
    @@ -1225,7 +1226,9 @@ mfi_process_fw_state_chg_isr(void *arg)
     			/*
     			 * Initiate AEN (Asynchronous Event Notification)
     			 */
    +			mtx_unlock(&sc->mfi_io_lock);
     			mfi_aen_setup(sc, sc->last_seq_num);
    +			mtx_lock(&sc->mfi_io_lock);
     			sc->issuepend_done = 1;
     			device_printf(sc->mfi_dev, "second stage of reset "
     			    "complete, FW is ready now.\n");
    @@ -1237,7 +1240,6 @@ mfi_process_fw_state_chg_isr(void *arg)
     		device_printf(sc->mfi_dev, "mfi_process_fw_state_chg_isr "
     		    "called with unhandled value:%d\n", sc->adpreset);
     	}
    -	mtx_unlock(&sc->mfi_io_lock);
     }
     
     /*
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 00:49:33 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 11AD12C8;
     Wed, 27 Feb 2013 00:49:33 +0000 (UTC)
     (envelope-from adrian@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 035F4E01;
     Wed, 27 Feb 2013 00:49:33 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1R0nWn5031492;
     Wed, 27 Feb 2013 00:49:32 GMT (envelope-from adrian@svn.freebsd.org)
    Received: (from adrian@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1R0nWjC031491;
     Wed, 27 Feb 2013 00:49:32 GMT (envelope-from adrian@svn.freebsd.org)
    Message-Id: <201302270049.r1R0nWjC031491@svn.freebsd.org>
    From: Adrian Chadd 
    Date: Wed, 27 Feb 2013 00:49:32 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247368 - head/sys/dev/ath
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 00:49:33 -0000
    
    Author: adrian
    Date: Wed Feb 27 00:49:32 2013
    New Revision: 247368
    URL: http://svnweb.freebsd.org/changeset/base/247368
    
    Log:
      Enable STBC for the given rate series if it's negotiated:
      
      * If both ends have negotiated (at least) one stream;
      * Only if it's a single stream rate (MCS0-7);
      * Only if there's more than one TX chain enabled.
      
      Tested:
      
      * AR9280 STA mode -> Atheros AP; tested both MCS2 (STBC) and MCS12 (no STBC.)
        Verified using athalq to inspect the TX descriptors.
      
      TODO:
      
      * Test AR5416 - no STBC should be enabled;
      * Test AR9280 with one TX chain enabled - no STBC should be enabled.
    
    Modified:
      head/sys/dev/ath/if_ath_tx_ht.c
    
    Modified: head/sys/dev/ath/if_ath_tx_ht.c
    ==============================================================================
    --- head/sys/dev/ath/if_ath_tx_ht.c	Wed Feb 27 00:35:40 2013	(r247367)
    +++ head/sys/dev/ath/if_ath_tx_ht.c	Wed Feb 27 00:49:32 2013	(r247368)
    @@ -536,17 +536,30 @@ ath_rateseries_setup(struct ath_softc *s
     			series[i].RateFlags |= HAL_RATESERIES_HALFGI;
     
     		/*
    -		 * XXX TODO: STBC if it's possible
    +		 * Setup rate and TX power cap for this series.
     		 */
    +		series[i].Rate = rt->info[rc[i].rix].rateCode;
    +		series[i].RateIndex = rc[i].rix;
    +		series[i].tx_power_cap = 0x3f;	/* XXX for now */
    +
    +
    +		/*
    +		 * If we have STBC TX enabled and the receiver
    +		 * can receive (at least) 1 stream STBC, AND it's
    +		 * MCS 0-7, AND we have at least two chains enabled,
    +		 * enable STBC.
    +		 */
    +		if (ic->ic_htcaps & IEEE80211_HTCAP_TXSTBC &&
    +		    ni->ni_htcap & IEEE80211_HTCAP_RXSTBC_1STREAM &&
    +		    (sc->sc_cur_txchainmask > 1) &&
    +		    HT_RC_2_STREAMS(series[i].Rate) == 1) {
    +			series[i].RateFlags |= HAL_RATESERIES_STBC;
    +		}
     
     		/*
     		 * XXX TODO: LDPC if it's possible
     		 */
     
    -		series[i].Rate = rt->info[rc[i].rix].rateCode;
    -		series[i].RateIndex = rc[i].rix;
    -		series[i].tx_power_cap = 0x3f;	/* XXX for now */
    -
     		/*
     		 * PktDuration doesn't include slot, ACK, RTS, etc timing -
     		 * it's just the packet duration
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 02:21:11 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 85BB8F10;
     Wed, 27 Feb 2013 02:21:11 +0000 (UTC) (envelope-from smh@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 5E18C219;
     Wed, 27 Feb 2013 02:21:11 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1R2LBD6061416;
     Wed, 27 Feb 2013 02:21:11 GMT (envelope-from smh@svn.freebsd.org)
    Received: (from smh@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1R2LA8q061406;
     Wed, 27 Feb 2013 02:21:10 GMT (envelope-from smh@svn.freebsd.org)
    Message-Id: <201302270221.r1R2LA8q061406@svn.freebsd.org>
    From: Steven Hartland 
    Date: Wed, 27 Feb 2013 02:21:10 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247369 - head/sys/dev/mfi
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 02:21:11 -0000
    
    Author: smh
    Date: Wed Feb 27 02:21:10 2013
    New Revision: 247369
    URL: http://svnweb.freebsd.org/changeset/base/247369
    
    Log:
      Fixes queuing issues where mfi_release_command blindly sets the cm_flags = 0
      without first removing the command from the relavent queue.
      
      This was causing panics in the queue functions which check to ensure a command
      is not on another queue.
      
      Fixed some cases where the error from mfi_mapcmd was lost and where the command
      was never released / dequeued in error cases.
      
      Ensure that all failures to mfi_mapcmd are logged.
      
      Fixed possible null pointer exception in mfi_aen_setup if mfi_get_log_state
      failed.
      
      Fixed mfi_parse_entries & mfi_aen_setup not returning possible errors.
      
      Corrected MFI_DUMP_CMDS calls with invalid vars SC vs sc.
      
      Commands which have timed out now set cm_error to ETIMEDOUT and call
      mfi_complete which prevents them getting stuck in the busy queue forever.
      
      Fixed possible use of NULL pointer in mfi_tbolt_get_cmd.
      
      Changed output formats to be more easily recognisable when debugging.
      
      Optimised mfi_cmd_pool_tbolt cleanup.
      
      Made information about driver limiting commands always display as for modern
      cards this can be severe.
      
      Fixed mfi_tbolt_alloc_cmd out of memory case which previously didnt return an
      error.
      
      Added malloc checks for request_desc_pool including free when subsiquent errors
      are detected.
      
      Fixed overflow error in SIMD reply descriptor check.
      
      Fixed tbolt_cmd leak in mfi_build_and_issue_cmd if there's an error during IO
      build.
      
      Elimintated double checks on sc->mfi_aen_cm & sc->mfi_map_sync_cm in
      mfi_shutdown.
      
      Move local hdr calculation after error check in mfi_aen_complete.
      
      Fixed wakeup on NULL in mfi_aen_complete.
      
      Fixed mfi_aen_cm cleanup in mfi_process_fw_state_chg_isr not checking if it was
      NULL.
      
      Changed mfi_alloc_commands to error if bus_dmamap_create fails. Previously we
      would try to continue with the number of allocated commands but lots of places
      in the driver assume sc->mfi_max_fw_cmds is whats available so its unsafe to do
      this without lots of changes.
      
      Removed mfi_total_cmds as its no longer used due the above change.
      
      Corrected mfi_tbolt_alloc_cmd to return ENOMEM where appropriate.
      
      Fixed timeouts actually firing at double what they should.
      
      Setting hw.mfi.max_cmds=-1 now configures to use the controller max.
      
      A few style (9) fixes e.g. braced single line conditions and double blank lines
      
      Cleaned up queuing macros
      
      Removed invalid queuing tests for multiple queues
      
      Trap and deal with errors when doing sends in mfi_data_cb
      
      Refactored frame sending into one method with error checking of the return
      code so we can ensure commands aren't left on the queue after error. This
      ensures that mfi_mapcmd & mfi_data_cb leave the queue in a valid state.
      
      Refactored how commands are cleaned up, mfi_release_command now ensures
      that all queues and command state is maintained in a consistent state.
      
      Prevent NULL pointer use in mfi_tbolt_complete_cmd
      
      Fixed use of NULL sc->mfi_map_sync_cm in wakeup
      
      Added defines to help with output of mfi_cmd and header flags.
      
      Fixed mfi_tbolt_init_MFI_queue invalidating cm_index of the acquired mfi_cmd.
      
      Reset now reinitialises sync map as well as AEN.
      
      Fixed possible use of NULL pointer in mfi_build_and_issue_cmd
      
      Fixed mfi_tbolt_init_MFI_queue call to mfi_process_fw_state_chg_isr causing
      panic on failure.
      
      Ensure that tbolt cards always initialise next_host_reply_index and
      free_host_reply_index (based off mfi_max_fw_cmds) on both startup and
      reset as per the linux driver.
      
      Fixed mfi_tbolt_complete_cmd not acknowledging unknown commands so
      it didn't clear the controller.
      
      Prevent locks from being dropped and re-acquired in the following functions
      which was allowing multiple threads to enter critical methods such as
      mfi_tbolt_complete_cmd & mfi_process_fw_state_chg_isr:-
      * mfi_tbolt_init_MFI_queue
      * mfi_aen_complete / mfi_aen_register
      * mfi_tbolt_sync_map_info
      * mfi_get_log_state
      * mfi_parse_entries
      
      The locking for these functions was promoting to higher level methods. This
      also fixed MFI_LINUX_SET_AEN_2 which was already acquiring the lock, so would
      have paniced for recursive lock.
      
      This also required changing malloc of ld_sync in mfi_tbolt_sync_map_info to
      M_NOWAIT which can hence now fail but this was already expected as its return
      was being tested.
      
      Removed the assignment of cm_index in mfi_tbolt_init_MFI_queue which breaks
      the world if the cmd returned by mfi_dequeue_free isn't the first cmd.
      
      Fixed locking in mfi_data_cb, this is an async callback from bus_dmamap_load
      which could hence be called after the caller has dropped the lock. If we
      don't have the lock we aquire it and ensure we unlock before returning.
      
      Fixed locking mfi_comms_init when mfi_dequeue_free fails.
      
      Fixed mfi_build_and_issue_cmd not returning tbolt cmds aquired to the pool
      on error.
      
      Fixed mfi_abort not dropping the io lock when mfi_dequeue_free fails.
      
      Added hw.mfi.polled_cmd_timeout sysctl that enables tuning of polled
      timeouts. This shouldn't be reduced below 50 seconds as its used for
      firmware patching which can take quite some time.
      
      Added hw.mfi.fw_reset_test sysctl which is avaliable when compiled with
      MFI_DEBUG and allows the testing of controller reset that was provoking a
      large number of the issues encountered here.
      
      Reviewed by:	Doug Ambrisko
      Approved by:	pjd (mentor)
      MFC after:	1 month
    
    Modified:
      head/sys/dev/mfi/mfi.c
      head/sys/dev/mfi/mfi_cam.c
      head/sys/dev/mfi/mfi_debug.c
      head/sys/dev/mfi/mfi_tbolt.c
      head/sys/dev/mfi/mfireg.h
      head/sys/dev/mfi/mfivar.h
    
    Modified: head/sys/dev/mfi/mfi.c
    ==============================================================================
    --- head/sys/dev/mfi/mfi.c	Wed Feb 27 00:49:32 2013	(r247368)
    +++ head/sys/dev/mfi/mfi.c	Wed Feb 27 02:21:10 2013	(r247369)
    @@ -108,6 +108,7 @@ static void	mfi_bio_complete(struct mfi_
     static struct mfi_command *mfi_build_ldio(struct mfi_softc *,struct bio*);
     static struct mfi_command *mfi_build_syspdio(struct mfi_softc *,struct bio*);
     static int	mfi_send_frame(struct mfi_softc *, struct mfi_command *);
    +static int	mfi_std_send_frame(struct mfi_softc *, struct mfi_command *);
     static int	mfi_abort(struct mfi_softc *, struct mfi_command **);
     static int	mfi_linux_ioctl_int(struct cdev *, u_long, caddr_t, int, struct thread *);
     static void	mfi_timeout(void *);
    @@ -132,24 +133,30 @@ static int mfi_check_for_sscd(struct mfi
     SYSCTL_NODE(_hw, OID_AUTO, mfi, CTLFLAG_RD, 0, "MFI driver parameters");
     static int	mfi_event_locale = MFI_EVT_LOCALE_ALL;
     TUNABLE_INT("hw.mfi.event_locale", &mfi_event_locale);
    -SYSCTL_INT(_hw_mfi, OID_AUTO, event_locale, CTLFLAG_RW, &mfi_event_locale,
    -            0, "event message locale");
    +SYSCTL_INT(_hw_mfi, OID_AUTO, event_locale, CTLFLAG_RWTUN, &mfi_event_locale,
    +           0, "event message locale");
     
     static int	mfi_event_class = MFI_EVT_CLASS_INFO;
     TUNABLE_INT("hw.mfi.event_class", &mfi_event_class);
    -SYSCTL_INT(_hw_mfi, OID_AUTO, event_class, CTLFLAG_RW, &mfi_event_class,
    -          0, "event message class");
    +SYSCTL_INT(_hw_mfi, OID_AUTO, event_class, CTLFLAG_RWTUN, &mfi_event_class,
    +           0, "event message class");
     
     static int	mfi_max_cmds = 128;
     TUNABLE_INT("hw.mfi.max_cmds", &mfi_max_cmds);
    -SYSCTL_INT(_hw_mfi, OID_AUTO, max_cmds, CTLFLAG_RD, &mfi_max_cmds,
    -	   0, "Max commands");
    +SYSCTL_INT(_hw_mfi, OID_AUTO, max_cmds, CTLFLAG_RDTUN, &mfi_max_cmds,
    +	   0, "Max commands limit (-1 = controller limit)");
     
     static int	mfi_detect_jbod_change = 1;
     TUNABLE_INT("hw.mfi.detect_jbod_change", &mfi_detect_jbod_change);
    -SYSCTL_INT(_hw_mfi, OID_AUTO, detect_jbod_change, CTLFLAG_RW,
    +SYSCTL_INT(_hw_mfi, OID_AUTO, detect_jbod_change, CTLFLAG_RWTUN,
     	   &mfi_detect_jbod_change, 0, "Detect a change to a JBOD");
     
    +int		mfi_polled_cmd_timeout = MFI_POLL_TIMEOUT_SECS;
    +TUNABLE_INT("hw.mfi.polled_cmd_timeout", &mfi_polled_cmd_timeout);
    +SYSCTL_INT(_hw_mfi, OID_AUTO, polled_cmd_timeout, CTLFLAG_RWTUN,
    +	   &mfi_polled_cmd_timeout, 0,
    +	   "Polled command timeout - used for firmware flash etc (in seconds)");
    +
     /* Management interface */
     static d_open_t		mfi_open;
     static d_close_t	mfi_close;
    @@ -361,7 +368,7 @@ mfi_attach(struct mfi_softc *sc)
     {
     	uint32_t status;
     	int error, commsz, framessz, sensesz;
    -	int frames, unit, max_fw_sge;
    +	int frames, unit, max_fw_sge, max_fw_cmds;
     	uint32_t tb_mem_size = 0;
     
     	if (sc == NULL)
    @@ -456,7 +463,14 @@ mfi_attach(struct mfi_softc *sc)
     	 * instead of compile time.
     	 */
     	status = sc->mfi_read_fw_status(sc);
    -	sc->mfi_max_fw_cmds = status & MFI_FWSTATE_MAXCMD_MASK;
    +	max_fw_cmds = status & MFI_FWSTATE_MAXCMD_MASK;
    +	if (mfi_max_cmds > 0 && mfi_max_cmds < max_fw_cmds) {
    +		device_printf(sc->mfi_dev, "FW MaxCmds = %d, limiting to %d\n",
    +		    max_fw_cmds, mfi_max_cmds);
    +		sc->mfi_max_fw_cmds = mfi_max_cmds;
    +	} else {
    +		sc->mfi_max_fw_cmds = max_fw_cmds;
    +	}
     	max_fw_sge = (status & MFI_FWSTATE_MAXSGL_MASK) >> 16;
     	sc->mfi_max_sge = min(max_fw_sge, ((MFI_MAXPHYS / PAGE_SIZE) + 1));
     
    @@ -464,7 +478,8 @@ mfi_attach(struct mfi_softc *sc)
     
     	if (sc->mfi_flags & MFI_FLAGS_TBOLT) {
     		mfi_tbolt_init_globals(sc);
    -		device_printf(sc->mfi_dev, "MaxCmd = %x MaxSgl = %x state = %x \n",
    +		device_printf(sc->mfi_dev, "MaxCmd = %d, Drv MaxCmd = %d, "
    +		    "MaxSgl = %d, state = %#x\n", max_fw_cmds,
     		    sc->mfi_max_fw_cmds, sc->mfi_max_sge, status);
     		tb_mem_size = mfi_tbolt_get_memory_requirement(sc);
     
    @@ -503,8 +518,8 @@ mfi_attach(struct mfi_softc *sc)
     				0,			/* flags */
     				NULL, NULL,		/* lockfunc, lockarg */
     				&sc->mfi_tb_init_dmat)) {
    -		device_printf(sc->mfi_dev, "Cannot allocate init DMA tag\n");
    -		return (ENOMEM);
    +			device_printf(sc->mfi_dev, "Cannot allocate init DMA tag\n");
    +			return (ENOMEM);
     		}
     		if (bus_dmamem_alloc(sc->mfi_tb_init_dmat, (void **)&sc->mfi_tb_init,
     		    BUS_DMA_NOWAIT, &sc->mfi_tb_init_dmamap)) {
    @@ -683,11 +698,14 @@ mfi_attach(struct mfi_softc *sc)
     	/* ThunderBolt MFI_IOC2 INIT */
     	if (sc->mfi_flags & MFI_FLAGS_TBOLT) {
     		sc->mfi_disable_intr(sc);
    +		mtx_lock(&sc->mfi_io_lock);
     		if ((error = mfi_tbolt_init_MFI_queue(sc)) != 0) {
     			device_printf(sc->mfi_dev,
     			    "TB Init has failed with error %d\n",error);
    +			mtx_unlock(&sc->mfi_io_lock);
     			return error;
     		}
    +		mtx_unlock(&sc->mfi_io_lock);
     
     		if ((error = mfi_tbolt_alloc_cmd(sc)) != 0)
     			return error;
    @@ -723,8 +741,12 @@ mfi_attach(struct mfi_softc *sc)
     		    "hook\n");
     		return (EINVAL);
     	}
    -	if ((error = mfi_aen_setup(sc, 0), 0) != 0)
    +	mtx_lock(&sc->mfi_io_lock);
    +	if ((error = mfi_aen_setup(sc, 0), 0) != 0) {
    +		mtx_unlock(&sc->mfi_io_lock);
     		return (error);
    +	}
    +	mtx_unlock(&sc->mfi_io_lock);
     
     	/*
     	 * Register a shutdown handler.
    @@ -764,7 +786,9 @@ mfi_attach(struct mfi_softc *sc)
     	    mfi_timeout, sc);
     
     	if (sc->mfi_flags & MFI_FLAGS_TBOLT) {
    +		mtx_lock(&sc->mfi_io_lock);
     		mfi_tbolt_sync_map_info(sc);
    +		mtx_unlock(&sc->mfi_io_lock);
     	}
     
     	return (0);
    @@ -774,21 +798,16 @@ static int
     mfi_alloc_commands(struct mfi_softc *sc)
     {
     	struct mfi_command *cm;
    -	int i, ncmds;
    +	int i, j;
     
     	/*
     	 * XXX Should we allocate all the commands up front, or allocate on
     	 * demand later like 'aac' does?
     	 */
    -	ncmds = MIN(mfi_max_cmds, sc->mfi_max_fw_cmds);
    -	if (bootverbose)
    -		device_printf(sc->mfi_dev, "Max fw cmds= %d, sizing driver "
    -		   "pool to %d\n", sc->mfi_max_fw_cmds, ncmds);
    -
    -	sc->mfi_commands = malloc(sizeof(struct mfi_command) * ncmds, M_MFIBUF,
    -	    M_WAITOK | M_ZERO);
    +	sc->mfi_commands = malloc(sizeof(sc->mfi_commands[0]) *
    +	    sc->mfi_max_fw_cmds, M_MFIBUF, M_WAITOK | M_ZERO);
     
    -	for (i = 0; i < ncmds; i++) {
    +	for (i = 0; i < sc->mfi_max_fw_cmds; i++) {
     		cm = &sc->mfi_commands[i];
     		cm->cm_frame = (union mfi_frame *)((uintptr_t)sc->mfi_frames +
     		    sc->mfi_cmd_size * i);
    @@ -804,10 +823,20 @@ mfi_alloc_commands(struct mfi_softc *sc)
     			mtx_lock(&sc->mfi_io_lock);
     			mfi_release_command(cm);
     			mtx_unlock(&sc->mfi_io_lock);
    +		} else {
    +			device_printf(sc->mfi_dev, "Failed to allocate %d "
    +			   "command blocks, only allocated %d\n",
    +			    sc->mfi_max_fw_cmds, i - 1);
    +			for (j = 0; j < i; j++) {
    +				cm = &sc->mfi_commands[i];
    +				bus_dmamap_destroy(sc->mfi_buffer_dmat,
    +				    cm->cm_dmamap);
    +			}
    +			free(sc->mfi_commands, M_MFIBUF);
    +			sc->mfi_commands = NULL;
    +
    +			return (ENOMEM);
     		}
    -		else
    -			break;
    -		sc->mfi_total_cmds++;
     	}
     
     	return (0);
    @@ -832,6 +861,29 @@ mfi_release_command(struct mfi_command *
     		cm->cm_sg->sg32[0].addr = 0;
     	}
     
    +	/*
    +	 * Command may be on other queues e.g. busy queue depending on the
    +	 * flow of a previous call to mfi_mapcmd, so ensure its dequeued
    +	 * properly
    +	 */
    +	if ((cm->cm_flags & MFI_ON_MFIQ_BUSY) != 0)
    +		mfi_remove_busy(cm);
    +	if ((cm->cm_flags & MFI_ON_MFIQ_READY) != 0)
    +		mfi_remove_ready(cm);
    +
    +	/* We're not expecting it to be on any other queue but check */
    +	if ((cm->cm_flags & MFI_ON_MFIQ_MASK) != 0) {
    +		panic("Command %p is still on another queue, flags = %#x",
    +		    cm, cm->cm_flags);
    +	}
    +
    +	/* tbolt cleanup */
    +	if ((cm->cm_flags & MFI_CMD_TBOLT) != 0) {
    +		mfi_tbolt_return_cmd(cm->cm_sc,
    +		    cm->cm_sc->mfi_cmd_pool_tbolt[cm->cm_extra_frames - 1],
    +		    cm);
    +	}
    +
     	hdr_data = (uint32_t *)cm->cm_frame;
     	hdr_data[0] = 0;	/* cmd, sense_len, cmd_status, scsi_status */
     	hdr_data[1] = 0;	/* target_id, lun_id, cdb_len, sg_count */
    @@ -914,8 +966,10 @@ mfi_comms_init(struct mfi_softc *sc)
     	uint32_t context = 0;
     
     	mtx_lock(&sc->mfi_io_lock);
    -	if ((cm = mfi_dequeue_free(sc)) == NULL)
    +	if ((cm = mfi_dequeue_free(sc)) == NULL) {
    +		mtx_unlock(&sc->mfi_io_lock);
     		return (EBUSY);
    +	}
     
     	/* Zero out the MFI frame */
     	context = cm->cm_frame->header.context;
    @@ -944,15 +998,12 @@ mfi_comms_init(struct mfi_softc *sc)
     	cm->cm_data = NULL;
     	cm->cm_flags = MFI_CMD_POLLED;
     
    -	if ((error = mfi_mapcmd(sc, cm)) != 0) {
    +	if ((error = mfi_mapcmd(sc, cm)) != 0)
     		device_printf(sc->mfi_dev, "failed to send init command\n");
    -		mtx_unlock(&sc->mfi_io_lock);
    -		return (error);
    -	}
     	mfi_release_command(cm);
     	mtx_unlock(&sc->mfi_io_lock);
     
    -	return (0);
    +	return (error);
     }
     
     static int
    @@ -1003,7 +1054,7 @@ mfi_get_log_state(struct mfi_softc *sc, 
     	struct mfi_command *cm = NULL;
     	int error;
     
    -	mtx_lock(&sc->mfi_io_lock);
    +	mtx_assert(&sc->mfi_io_lock, MA_OWNED);
     	error = mfi_dcmd_command(sc, &cm, MFI_DCMD_CTRL_EVENT_GETINFO,
     	    (void **)log_state, sizeof(**log_state));
     	if (error)
    @@ -1022,7 +1073,6 @@ mfi_get_log_state(struct mfi_softc *sc, 
     out:
     	if (cm)
     		mfi_release_command(cm);
    -	mtx_unlock(&sc->mfi_io_lock);
     
     	return (error);
     }
    @@ -1035,32 +1085,32 @@ mfi_aen_setup(struct mfi_softc *sc, uint
     	int error = 0;
     	uint32_t seq;
     
    +	mtx_assert(&sc->mfi_io_lock, MA_OWNED);
    +
     	class_locale.members.reserved = 0;
     	class_locale.members.locale = mfi_event_locale;
     	class_locale.members.evt_class  = mfi_event_class;
     
     	if (seq_start == 0) {
    -		error = mfi_get_log_state(sc, &log_state);
    +		if ((error = mfi_get_log_state(sc, &log_state)) != 0)
    +			goto out;
     		sc->mfi_boot_seq_num = log_state->boot_seq_num;
    -		if (error) {
    -			if (log_state)
    -				free(log_state, M_MFIBUF);
    -			return (error);
    -		}
     
     		/*
     		 * Walk through any events that fired since the last
     		 * shutdown.
     		 */
    -		mfi_parse_entries(sc, log_state->shutdown_seq_num,
    -		    log_state->newest_seq_num);
    +		if ((error = mfi_parse_entries(sc, log_state->shutdown_seq_num,
    +		    log_state->newest_seq_num)) != 0)
    +			goto out;
     		seq = log_state->newest_seq_num;
     	} else
     		seq = seq_start;
    -	mfi_aen_register(sc, seq, class_locale.word);
    +	error = mfi_aen_register(sc, seq, class_locale.word);
    +out:
     	free(log_state, M_MFIBUF);
     
    -	return 0;
    +	return (error);
     }
     
     int
    @@ -1070,7 +1120,6 @@ mfi_wait_command(struct mfi_softc *sc, s
     	mtx_assert(&sc->mfi_io_lock, MA_OWNED);
     	cm->cm_complete = NULL;
     
    -
     	/*
     	 * MegaCli can issue a DCMD of 0.  In this case do nothing
     	 * and return 0 to it as status
    @@ -1098,12 +1147,13 @@ mfi_free(struct mfi_softc *sc)
     	if (sc->mfi_cdev != NULL)
     		destroy_dev(sc->mfi_cdev);
     
    -	if (sc->mfi_total_cmds != 0) {
    -		for (i = 0; i < sc->mfi_total_cmds; i++) {
    +	if (sc->mfi_commands != NULL) {
    +		for (i = 0; i < sc->mfi_max_fw_cmds; i++) {
     			cm = &sc->mfi_commands[i];
     			bus_dmamap_destroy(sc->mfi_buffer_dmat, cm->cm_dmamap);
     		}
     		free(sc->mfi_commands, M_MFIBUF);
    +		sc->mfi_commands = NULL;
     	}
     
     	if (sc->mfi_intr)
    @@ -1159,7 +1209,8 @@ mfi_free(struct mfi_softc *sc)
     		/* End LSIP200113393 */
     		/* ThunderBolt INIT packet memory Free */
     		if (sc->mfi_tb_init_busaddr != 0)
    -			bus_dmamap_unload(sc->mfi_tb_init_dmat, sc->mfi_tb_init_dmamap);
    +			bus_dmamap_unload(sc->mfi_tb_init_dmat,
    +			    sc->mfi_tb_init_dmamap);
     		if (sc->mfi_tb_init != NULL)
     			bus_dmamem_free(sc->mfi_tb_init_dmat, sc->mfi_tb_init,
     			    sc->mfi_tb_init_dmamap);
    @@ -1176,16 +1227,14 @@ mfi_free(struct mfi_softc *sc)
     			    sc->mfi_tb_ioc_init_dmamap);
     		if (sc->mfi_tb_ioc_init_dmat != NULL)
     			bus_dma_tag_destroy(sc->mfi_tb_ioc_init_dmat);
    -		for (int i = 0; i < sc->mfi_max_fw_cmds; i++) {
    -			if (sc->mfi_cmd_pool_tbolt != NULL) {
    +		if (sc->mfi_cmd_pool_tbolt != NULL) {
    +			for (int i = 0; i < sc->mfi_max_fw_cmds; i++) {
     				if (sc->mfi_cmd_pool_tbolt[i] != NULL) {
     					free(sc->mfi_cmd_pool_tbolt[i],
     					    M_MFIBUF);
     					sc->mfi_cmd_pool_tbolt[i] = NULL;
     				}
     			}
    -		}
    -		if (sc->mfi_cmd_pool_tbolt != NULL) {
     			free(sc->mfi_cmd_pool_tbolt, M_MFIBUF);
     			sc->mfi_cmd_pool_tbolt = NULL;
     		}
    @@ -1250,16 +1299,14 @@ restart:
     			cm->cm_error = 0;
     			mfi_complete(sc, cm);
     		}
    -		if (++ci == (sc->mfi_max_fw_cmds + 1)) {
    +		if (++ci == (sc->mfi_max_fw_cmds + 1))
     			ci = 0;
    -		}
     	}
     
     	sc->mfi_comms->hw_ci = ci;
     
     	/* Give defered I/O a chance to run */
    -	if (sc->mfi_flags & MFI_FLAGS_QFRZN)
    -		sc->mfi_flags &= ~MFI_FLAGS_QFRZN;
    +	sc->mfi_flags &= ~MFI_FLAGS_QFRZN;
     	mfi_startio(sc);
     	mtx_unlock(&sc->mfi_io_lock);
     
    @@ -1282,15 +1329,15 @@ mfi_shutdown(struct mfi_softc *sc)
     	int error;
     
     
    -	if (sc->mfi_aen_cm)
    +	if (sc->mfi_aen_cm != NULL) {
     		sc->cm_aen_abort = 1;
    -	if (sc->mfi_aen_cm != NULL)
     		mfi_abort(sc, &sc->mfi_aen_cm);
    +	}
     
    -	if (sc->mfi_map_sync_cm)
    +	if (sc->mfi_map_sync_cm != NULL) {
     		sc->cm_map_abort = 1;
    -	if (sc->mfi_map_sync_cm != NULL)
     		mfi_abort(sc, &sc->mfi_map_sync_cm);
    +	}
     
     	mtx_lock(&sc->mfi_io_lock);
     	error = mfi_dcmd_command(sc, &cm, MFI_DCMD_CTRL_SHUTDOWN, NULL, 0);
    @@ -1304,9 +1351,8 @@ mfi_shutdown(struct mfi_softc *sc)
     	cm->cm_flags = MFI_CMD_POLLED;
     	cm->cm_data = NULL;
     
    -	if ((error = mfi_mapcmd(sc, cm)) != 0) {
    +	if ((error = mfi_mapcmd(sc, cm)) != 0)
     		device_printf(sc->mfi_dev, "Failed to shutdown controller\n");
    -	}
     
     	mfi_release_command(cm);
     	mtx_unlock(&sc->mfi_io_lock);
    @@ -1372,8 +1418,10 @@ mfi_syspdprobe(struct mfi_softc *sc)
     	TAILQ_FOREACH_SAFE(syspd, &sc->mfi_syspd_tqh, pd_link, tmp) {
     		found = 0;
     		for (i = 0; i < pdlist->count; i++) {
    -			if (syspd->pd_id == pdlist->addr[i].device_id)
    +			if (syspd->pd_id == pdlist->addr[i].device_id) {
     				found = 1;
    +				break;
    +			}
     		}
     		if (found == 0) {
     			printf("DELETE\n");
    @@ -1626,6 +1674,8 @@ mfi_aen_register(struct mfi_softc *sc, i
     	struct mfi_evt_detail *ed = NULL;
     	int error = 0;
     
    +	mtx_assert(&sc->mfi_io_lock, MA_OWNED);
    +
     	current_aen.word = locale;
     	if (sc->mfi_aen_cm != NULL) {
     		prior_aen.word =
    @@ -1644,13 +1694,10 @@ mfi_aen_register(struct mfi_softc *sc, i
     		}
     	}
     
    -	mtx_lock(&sc->mfi_io_lock);
     	error = mfi_dcmd_command(sc, &cm, MFI_DCMD_CTRL_EVENT_WAIT,
     	    (void **)&ed, sizeof(*ed));
    -	mtx_unlock(&sc->mfi_io_lock);
    -	if (error) {
    +	if (error)
     		goto out;
    -	}
     
     	dcmd = &cm->cm_frame->dcmd;
     	((uint32_t *)&dcmd->mbox)[0] = seq;
    @@ -1661,10 +1708,8 @@ mfi_aen_register(struct mfi_softc *sc, i
     	sc->last_seq_num = seq;
     	sc->mfi_aen_cm = cm;
     
    -	mtx_lock(&sc->mfi_io_lock);
     	mfi_enqueue_ready(cm);
     	mfi_startio(sc);
    -	mtx_unlock(&sc->mfi_io_lock);
     
     out:
     	return (error);
    @@ -1682,11 +1727,11 @@ mfi_aen_complete(struct mfi_command *cm)
     	sc = cm->cm_sc;
     	mtx_assert(&sc->mfi_io_lock, MA_OWNED);
     
    -	hdr = &cm->cm_frame->header;
    -
     	if (sc->mfi_aen_cm == NULL)
     		return;
     
    +	hdr = &cm->cm_frame->header;
    +
     	if (sc->cm_aen_abort ||
     	    hdr->cmd_status == MFI_STAT_INVALID_STATUS) {
     		sc->cm_aen_abort = 0;
    @@ -1712,16 +1757,13 @@ mfi_aen_complete(struct mfi_command *cm)
     	}
     
     	free(cm->cm_data, M_MFIBUF);
    -	sc->mfi_aen_cm = NULL;
     	wakeup(&sc->mfi_aen_cm);
    +	sc->mfi_aen_cm = NULL;
     	mfi_release_command(cm);
     
     	/* set it up again so the driver can catch more events */
    -	if (!aborted) {
    -		mtx_unlock(&sc->mfi_io_lock);
    +	if (!aborted)
     		mfi_aen_setup(sc, seq);
    -		mtx_lock(&sc->mfi_io_lock);
    -	}
     }
     
     #define MAX_EVENTS 15
    @@ -1735,6 +1777,8 @@ mfi_parse_entries(struct mfi_softc *sc, 
     	union mfi_evt class_locale;
     	int error, i, seq, size;
     
    +	mtx_assert(&sc->mfi_io_lock, MA_OWNED);
    +
     	class_locale.members.reserved = 0;
     	class_locale.members.locale = mfi_event_locale;
     	class_locale.members.evt_class  = mfi_event_class;
    @@ -1746,13 +1790,10 @@ mfi_parse_entries(struct mfi_softc *sc, 
     		return (ENOMEM);
     
     	for (seq = start_seq;;) {
    -		mtx_lock(&sc->mfi_io_lock);
     		if ((cm = mfi_dequeue_free(sc)) == NULL) {
     			free(el, M_MFIBUF);
    -			mtx_unlock(&sc->mfi_io_lock);
     			return (EBUSY);
     		}
    -		mtx_unlock(&sc->mfi_io_lock);
     
     		dcmd = &cm->cm_frame->dcmd;
     		bzero(dcmd->mbox, MFI_MBOX_SIZE);
    @@ -1768,38 +1809,30 @@ mfi_parse_entries(struct mfi_softc *sc, 
     		cm->cm_data = el;
     		cm->cm_len = size;
     
    -		mtx_lock(&sc->mfi_io_lock);
     		if ((error = mfi_mapcmd(sc, cm)) != 0) {
     			device_printf(sc->mfi_dev,
     			    "Failed to get controller entries\n");
     			mfi_release_command(cm);
    -			mtx_unlock(&sc->mfi_io_lock);
     			break;
     		}
     
    -		mtx_unlock(&sc->mfi_io_lock);
     		bus_dmamap_sync(sc->mfi_buffer_dmat, cm->cm_dmamap,
     		    BUS_DMASYNC_POSTREAD);
     		bus_dmamap_unload(sc->mfi_buffer_dmat, cm->cm_dmamap);
     
     		if (dcmd->header.cmd_status == MFI_STAT_NOT_FOUND) {
    -			mtx_lock(&sc->mfi_io_lock);
     			mfi_release_command(cm);
    -			mtx_unlock(&sc->mfi_io_lock);
     			break;
     		}
     		if (dcmd->header.cmd_status != MFI_STAT_OK) {
     			device_printf(sc->mfi_dev,
     			    "Error %d fetching controller entries\n",
     			    dcmd->header.cmd_status);
    -			mtx_lock(&sc->mfi_io_lock);
     			mfi_release_command(cm);
    -			mtx_unlock(&sc->mfi_io_lock);
    +			error = EIO;
     			break;
     		}
    -		mtx_lock(&sc->mfi_io_lock);
     		mfi_release_command(cm);
    -		mtx_unlock(&sc->mfi_io_lock);
     
     		for (i = 0; i < el->count; i++) {
     			/*
    @@ -1815,15 +1848,13 @@ mfi_parse_entries(struct mfi_softc *sc, 
     				else if (el->event[i].seq < start_seq)
     					break;
     			}
    -			mtx_lock(&sc->mfi_io_lock);
     			mfi_queue_evt(sc, &el->event[i]);
    -			mtx_unlock(&sc->mfi_io_lock);
     		}
     		seq = el->event[el->count - 1].seq + 1;
     	}
     
     	free(el, M_MFIBUF);
    -	return (0);
    +	return (error);
     }
     
     static int
    @@ -1940,11 +1971,12 @@ static int mfi_add_sys_pd(struct mfi_sof
     	dcmd->mbox[0]=id;
     	dcmd->header.scsi_status = 0;
     	dcmd->header.pad0 = 0;
    -	if (mfi_mapcmd(sc, cm) != 0) {
    +	if ((error = mfi_mapcmd(sc, cm)) != 0) {
     		device_printf(sc->mfi_dev,
     		    "Failed to get physical drive info %d\n", id);
     		free(pd_info, M_MFIBUF);
    -		return (0);
    +		mfi_release_command(cm);
    +		return (error);
     	}
     	bus_dmamap_sync(sc->mfi_buffer_dmat, cm->cm_dmamap,
     	    BUS_DMASYNC_POSTREAD);
    @@ -2094,6 +2126,8 @@ mfi_build_syspdio(struct mfi_softc *sc, 
     	int flags = 0, blkcount = 0, readop;
     	uint8_t cdb_len;
     
    +	mtx_assert(&sc->mfi_io_lock, MA_OWNED);
    +
     	if ((cm = mfi_dequeue_free(sc)) == NULL)
     	    return (NULL);
     
    @@ -2140,6 +2174,7 @@ mfi_build_syspdio(struct mfi_softc *sc, 
     	cm->cm_sg = &pass->sgl;
     	cm->cm_total_frame_size = MFI_PASS_FRAME_SIZE;
     	cm->cm_flags = flags;
    +
     	return (cm);
     }
     
    @@ -2152,6 +2187,8 @@ mfi_build_ldio(struct mfi_softc *sc, str
     	uint32_t blkcount;
     	uint32_t context = 0;
     
    +	mtx_assert(&sc->mfi_io_lock, MA_OWNED);
    +
     	if ((cm = mfi_dequeue_free(sc)) == NULL)
     	    return (NULL);
     
    @@ -2193,6 +2230,7 @@ mfi_build_ldio(struct mfi_softc *sc, str
     	cm->cm_sg = &io->sgl;
     	cm->cm_total_frame_size = MFI_IO_FRAME_SIZE;
     	cm->cm_flags = flags;
    +
     	return (cm);
     }
     
    @@ -2210,11 +2248,14 @@ mfi_bio_complete(struct mfi_command *cm)
     	if ((hdr->cmd_status != MFI_STAT_OK) || (hdr->scsi_status != 0)) {
     		bio->bio_flags |= BIO_ERROR;
     		bio->bio_error = EIO;
    -		device_printf(sc->mfi_dev, "I/O error, status= %d "
    -		    "scsi_status= %d\n", hdr->cmd_status, hdr->scsi_status);
    +		device_printf(sc->mfi_dev, "I/O error, cmd=%p, status=%#x, "
    +		    "scsi_status=%#x\n", cm, hdr->cmd_status, hdr->scsi_status);
     		mfi_print_sense(cm->cm_sc, cm->cm_sense);
     	} else if (cm->cm_error != 0) {
     		bio->bio_flags |= BIO_ERROR;
    +		bio->bio_error = cm->cm_error;
    +		device_printf(sc->mfi_dev, "I/O error, cmd=%p, error=%#x\n",
    +		    cm, cm->cm_error);
     	}
     
     	mfi_release_command(cm);
    @@ -2250,6 +2291,7 @@ mfi_startio(struct mfi_softc *sc)
     
     		/* Send the command to the controller */
     		if (mfi_mapcmd(sc, cm) != 0) {
    +			device_printf(sc->mfi_dev, "Failed to startio\n");
     			mfi_requeue_ready(cm);
     			break;
     		}
    @@ -2278,10 +2320,7 @@ mfi_mapcmd(struct mfi_softc *sc, struct 
     			return (0);
     		}
     	} else {
    -		if (sc->MFA_enabled)
    -			error = mfi_tbolt_send_frame(sc, cm);
    -		else
    -			error = mfi_send_frame(sc, cm);
    +		error = mfi_send_frame(sc, cm);
     	}
     
     	return (error);
    @@ -2295,18 +2334,28 @@ mfi_data_cb(void *arg, bus_dma_segment_t
     	union mfi_sgl *sgl;
     	struct mfi_softc *sc;
     	int i, j, first, dir;
    -	int sge_size;
    +	int sge_size, locked;
     
     	cm = (struct mfi_command *)arg;
     	sc = cm->cm_sc;
     	hdr = &cm->cm_frame->header;
     	sgl = cm->cm_sg;
     
    +	/*
    +	 * We need to check if we have the lock as this is async
    +	 * callback so even though our caller mfi_mapcmd asserts
    +	 * it has the lock, there is no garantee that hasn't been
    +	 * dropped if bus_dmamap_load returned prior to our
    +	 * completion.
    +	 */
    +	if ((locked = mtx_owned(&sc->mfi_io_lock)) == 0)
    +		mtx_lock(&sc->mfi_io_lock);
    +
     	if (error) {
     		printf("error %d in callback\n", error);
     		cm->cm_error = error;
     		mfi_complete(sc, cm);
    -		return;
    +		goto out;
     	}
     	/* Use IEEE sgl only for IO's on a SKINNY controller
     	 * For other commands on a SKINNY controller use either
    @@ -2378,10 +2427,17 @@ mfi_data_cb(void *arg, bus_dma_segment_t
     	cm->cm_total_frame_size += (sc->mfi_sge_size * nsegs);
     	cm->cm_extra_frames = (cm->cm_total_frame_size - 1) / MFI_FRAME_SIZE;
     
    -	if (sc->MFA_enabled)
    -			mfi_tbolt_send_frame(sc, cm);
    -	else
    -		mfi_send_frame(sc, cm);
    +	if ((error = mfi_send_frame(sc, cm)) != 0) {
    +		printf("error %d in callback from mfi_send_frame\n", error);
    +		cm->cm_error = error;
    +		mfi_complete(sc, cm);
    +		goto out;
    +	}
    +
    +out:
    +	/* leave the lock in the state we found it */
    +	if (locked == 0)
    +		mtx_unlock(&sc->mfi_io_lock);
     
     	return;
     }
    @@ -2389,8 +2445,26 @@ mfi_data_cb(void *arg, bus_dma_segment_t
     static int
     mfi_send_frame(struct mfi_softc *sc, struct mfi_command *cm)
     {
    +	int error;
    +
    +	mtx_assert(&sc->mfi_io_lock, MA_OWNED);
    +
    +	if (sc->MFA_enabled)
    +		error = mfi_tbolt_send_frame(sc, cm);
    +	else
    +		error = mfi_std_send_frame(sc, cm);
    +
    +	if (error != 0 && (cm->cm_flags & MFI_ON_MFIQ_BUSY) != 0)
    +		mfi_remove_busy(cm);
    +
    +	return (error);
    +}
    +
    +static int
    +mfi_std_send_frame(struct mfi_softc *sc, struct mfi_command *cm)
    +{
     	struct mfi_frame_header *hdr;
    -	int tm = MFI_POLL_TIMEOUT_SECS * 1000;
    +	int tm = mfi_polled_cmd_timeout * 1000;
     
     	hdr = &cm->cm_frame->header;
     
    @@ -2444,6 +2518,7 @@ void
     mfi_complete(struct mfi_softc *sc, struct mfi_command *cm)
     {
     	int dir;
    +	mtx_assert(&sc->mfi_io_lock, MA_OWNED);
     
     	if ((cm->cm_flags & MFI_CMD_MAPPED) != 0) {
     		dir = 0;
    @@ -2471,11 +2546,12 @@ mfi_abort(struct mfi_softc *sc, struct m
     {
     	struct mfi_command *cm;
     	struct mfi_abort_frame *abort;
    -	int i = 0;
    +	int i = 0, error;
     	uint32_t context = 0;
     
     	mtx_lock(&sc->mfi_io_lock);
     	if ((cm = mfi_dequeue_free(sc)) == NULL) {
    +		mtx_unlock(&sc->mfi_io_lock);
     		return (EBUSY);
     	}
     
    @@ -2495,7 +2571,8 @@ mfi_abort(struct mfi_softc *sc, struct m
     	cm->cm_data = NULL;
     	cm->cm_flags = MFI_CMD_POLLED;
     
    -	mfi_mapcmd(sc, cm);
    +	if ((error = mfi_mapcmd(sc, cm)) != 0)
    +		device_printf(sc->mfi_dev, "failed to abort command\n");
     	mfi_release_command(cm);
     
     	mtx_unlock(&sc->mfi_io_lock);
    @@ -2511,7 +2588,7 @@ mfi_abort(struct mfi_softc *sc, struct m
     		mtx_unlock(&sc->mfi_io_lock);
     	}
     
    -	return (0);
    +	return (error);
     }
     
     int
    @@ -2549,7 +2626,8 @@ mfi_dump_blocks(struct mfi_softc *sc, in
     	cm->cm_total_frame_size = MFI_IO_FRAME_SIZE;
     	cm->cm_flags = MFI_CMD_POLLED | MFI_CMD_DATAOUT;
     
    -	error = mfi_mapcmd(sc, cm);
    +	if ((error = mfi_mapcmd(sc, cm)) != 0)
    +		device_printf(sc->mfi_dev, "failed dump blocks\n");
     	bus_dmamap_sync(sc->mfi_buffer_dmat, cm->cm_dmamap,
     	    BUS_DMASYNC_POSTWRITE);
     	bus_dmamap_unload(sc->mfi_buffer_dmat, cm->cm_dmamap);
    @@ -2592,7 +2670,8 @@ mfi_dump_syspd_blocks(struct mfi_softc *
     	cm->cm_total_frame_size = MFI_PASS_FRAME_SIZE;
     	cm->cm_flags = MFI_CMD_POLLED | MFI_CMD_DATAOUT | MFI_CMD_SCSI;
     
    -	error = mfi_mapcmd(sc, cm);
    +	if ((error = mfi_mapcmd(sc, cm)) != 0)
    +		device_printf(sc->mfi_dev, "failed dump blocks\n");
     	bus_dmamap_sync(sc->mfi_buffer_dmat, cm->cm_dmamap,
     	    BUS_DMASYNC_POSTWRITE);
     	bus_dmamap_unload(sc->mfi_buffer_dmat, cm->cm_dmamap);
    @@ -3306,8 +3385,10 @@ out:
     		}
     	case MFI_SET_AEN:
     		aen = (struct mfi_ioc_aen *)arg;
    +		mtx_lock(&sc->mfi_io_lock);
     		error = mfi_aen_register(sc, aen->aen_seq_num,
     		    aen->aen_class_locale);
    +		mtx_unlock(&sc->mfi_io_lock);
     
     		break;
     	case MFI_LINUX_CMD_2: /* Firmware Linux ioctl shim */
    @@ -3636,7 +3717,7 @@ mfi_dump_all(void)
     		deadline = time_uptime - MFI_CMD_TIMEOUT;
     		mtx_lock(&sc->mfi_io_lock);
     		TAILQ_FOREACH(cm, &sc->mfi_busy, cm_link) {
    -			if (cm->cm_timestamp < deadline) {
    +			if (cm->cm_timestamp <= deadline) {
     				device_printf(sc->mfi_dev,
     				    "COMMAND %p TIMEOUT AFTER %d SECONDS\n",
     				    cm, (int)(time_uptime - cm->cm_timestamp));
    @@ -3647,7 +3728,7 @@ mfi_dump_all(void)
     
     #if 0
     		if (timedout)
    -			MFI_DUMP_CMDS(SC);
    +			MFI_DUMP_CMDS(sc);
     #endif
     
     		mtx_unlock(&sc->mfi_io_lock);
    @@ -3660,7 +3741,7 @@ static void
     mfi_timeout(void *data)
     {
     	struct mfi_softc *sc = (struct mfi_softc *)data;
    -	struct mfi_command *cm;
    +	struct mfi_command *cm, *tmp;
     	time_t deadline;
     	int timedout = 0;
     
    @@ -3672,10 +3753,10 @@ mfi_timeout(void *data)
     		}
     	}
     	mtx_lock(&sc->mfi_io_lock);
    -	TAILQ_FOREACH(cm, &sc->mfi_busy, cm_link) {
    +	TAILQ_FOREACH_SAFE(cm, &sc->mfi_busy, cm_link, tmp) {
     		if (sc->mfi_aen_cm == cm || sc->mfi_map_sync_cm == cm)
     			continue;
    -		if (cm->cm_timestamp < deadline) {
    +		if (cm->cm_timestamp <= deadline) {
     			if (sc->adpreset != 0 && sc->issuepend_done == 0) {
     				cm->cm_timestamp = time_uptime;
     			} else {
    @@ -3685,6 +3766,13 @@ mfi_timeout(void *data)
     				     );
     				MFI_PRINT_CMD(cm);
     				MFI_VALIDATE_CMD(sc, cm);
    +				/*
    +				 * Fail the command instead of leaving it on
    +				 * the queue where it could remain stuck forever
    +				 */
    +				mfi_remove_busy(cm);
    +				cm->cm_error = ETIMEDOUT;
    +				mfi_complete(sc, cm);
     				timedout++;
     			}
     		}
    @@ -3692,7 +3780,7 @@ mfi_timeout(void *data)
     
     #if 0
     	if (timedout)
    -		MFI_DUMP_CMDS(SC);
    +		MFI_DUMP_CMDS(sc);
     #endif
     
     	mtx_unlock(&sc->mfi_io_lock);
    
    Modified: head/sys/dev/mfi/mfi_cam.c
    ==============================================================================
    --- head/sys/dev/mfi/mfi_cam.c	Wed Feb 27 00:49:32 2013	(r247368)
    +++ head/sys/dev/mfi/mfi_cam.c	Wed Feb 27 02:21:10 2013	(r247369)
    @@ -145,6 +145,7 @@ mfip_attach(device_t dev)
     				MFI_SCSI_MAX_CMDS, sc->devq);
     	if (sc->sim == NULL) {
     		cam_simq_free(sc->devq);
    +		sc->devq = NULL;
     		device_printf(dev, "CAM SIM attach failed\n");
     		return (EINVAL);
     	}
    @@ -155,7 +156,9 @@ mfip_attach(device_t dev)
     	if (xpt_bus_register(sc->sim, dev, 0) != 0) {
     		device_printf(dev, "XPT bus registration failed\n");
     		cam_sim_free(sc->sim, FALSE);
    +		sc->sim = NULL;
     		cam_simq_free(sc->devq);
    +		sc->devq = NULL;
     		mtx_unlock(&mfisc->mfi_io_lock);
     		return (EINVAL);
     	}
    @@ -187,11 +190,14 @@ mfip_detach(device_t dev)
     		mtx_lock(&sc->mfi_sc->mfi_io_lock);
     		xpt_bus_deregister(cam_sim_path(sc->sim));
     		cam_sim_free(sc->sim, FALSE);
    +		sc->sim = NULL;
     		mtx_unlock(&sc->mfi_sc->mfi_io_lock);
     	}
     
    -	if (sc->devq != NULL)
    +	if (sc->devq != NULL) {
     		cam_simq_free(sc->devq);
    +		sc->devq = NULL;
    +	}
     
     	return (0);
     }
    
    Modified: head/sys/dev/mfi/mfi_debug.c
    ==============================================================================
    --- head/sys/dev/mfi/mfi_debug.c	Wed Feb 27 00:49:32 2013	(r247368)
    +++ head/sys/dev/mfi/mfi_debug.c	Wed Feb 27 02:21:10 2013	(r247369)
    @@ -57,14 +57,7 @@ __FBSDID("$FreeBSD$");
     static void
     mfi_print_frame_flags(device_t dev, uint32_t flags)
     {
    -	device_printf(dev, "flags=%b\n", flags,
    -	    "\20"
    -	    "\1NOPOST"
    -	    "\2SGL64"
    -	    "\3SENSE64"
    -	    "\4WRITE"
    -	    "\5READ"
    -	    "\6IEEESGL");
    +	device_printf(dev, "flags=%b\n", flags, MFI_FRAME_FMT);
     }
     
     static void
    @@ -205,16 +198,7 @@ mfi_print_cmd(struct mfi_command *cm)
     	device_printf(dev, "cm=%p index=%d total_frame_size=%d "
     	    "extra_frames=%d\n", cm, cm->cm_index, cm->cm_total_frame_size,
     	    cm->cm_extra_frames);
    -	device_printf(dev, "flags=%b\n", cm->cm_flags,
    -	    "\20"
    -	    "\1MAPPED"
    -	    "\2DATAIN"
    -	    "\3DATAOUT"
    -	    "\4COMPLETED"
    -	    "\5POLLED"
    -	    "\6Q_FREE"
    -	    "\7Q_READY"
    -	    "\10Q_BUSY");
    +	device_printf(dev, "flags=%b\n", cm->cm_flags, MFI_CMD_FLAGS_FMT);
     
     	switch (cm->cm_frame->header.cmd) {
     	case MFI_CMD_DCMD:
    @@ -237,7 +221,7 @@ mfi_dump_cmds(struct mfi_softc *sc)
     {
     	int i;
     
    -	for (i = 0; i < sc->mfi_total_cmds; i++)
    +	for (i = 0; i < sc->mfi_max_fw_cmds; i++)
     		mfi_print_generic_frame(sc, &sc->mfi_commands[i]);
     }
     
    
    Modified: head/sys/dev/mfi/mfi_tbolt.c
    ==============================================================================
    --- head/sys/dev/mfi/mfi_tbolt.c	Wed Feb 27 00:49:32 2013	(r247368)
    +++ head/sys/dev/mfi/mfi_tbolt.c	Wed Feb 27 02:21:10 2013	(r247369)
    @@ -55,14 +55,12 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     
    -struct mfi_cmd_tbolt *mfi_tbolt_get_cmd(struct mfi_softc *sc);
    +struct mfi_cmd_tbolt *mfi_tbolt_get_cmd(struct mfi_softc *sc, struct mfi_command *);
     union mfi_mpi2_request_descriptor *
     mfi_tbolt_get_request_descriptor(struct mfi_softc *sc, uint16_t index);
     void mfi_tbolt_complete_cmd(struct mfi_softc *sc);
     int mfi_tbolt_build_io(struct mfi_softc *sc, struct mfi_command *mfi_cmd,
         struct mfi_cmd_tbolt *cmd);
    -static inline void mfi_tbolt_return_cmd(struct mfi_softc *sc,
    -    struct mfi_cmd_tbolt *cmd);
     union mfi_mpi2_request_descriptor *mfi_tbolt_build_mpt_cmd(struct mfi_softc
         *sc, struct mfi_command *cmd);
     uint8_t
    @@ -84,6 +82,15 @@ static void mfi_queue_map_sync(struct mf
     
     #define MFI_FUSION_ENABLE_INTERRUPT_MASK	(0x00000008)
     
    +
    +extern int	mfi_polled_cmd_timeout;
    +static int	mfi_fw_reset_test = 0;
    +#ifdef MFI_DEBUG
    +TUNABLE_INT("hw.mfi.fw_reset_test", &mfi_fw_reset_test);
    +SYSCTL_INT(_hw_mfi, OID_AUTO, fw_reset_test, CTLFLAG_RWTUN, &mfi_fw_reset_test,
    +           0, "Force a firmware reset condition");
    +#endif
    +
     void
     mfi_tbolt_enable_intr_ppc(struct mfi_softc *sc)
     {
    @@ -162,14 +169,14 @@ mfi_tbolt_adp_reset(struct mfi_softc *sc
     	while (!( HostDiag & DIAG_WRITE_ENABLE)) {
     		for (i = 0; i < 1000; i++);
     		HostDiag = (uint32_t)MFI_READ4(sc, MFI_HDR);
    -		device_printf(sc->mfi_dev, "ADP_RESET_TBOLT: retry time=%x, "
    -		    "hostdiag=%x\n", retry, HostDiag);
    +		device_printf(sc->mfi_dev, "ADP_RESET_TBOLT: retry time=%d, "
    +		    "hostdiag=%#x\n", retry, HostDiag);
     
     		if (retry++ >= 100)
     			return 1;
     	}
     
    -	device_printf(sc->mfi_dev, "ADP_RESET_TBOLT: HostDiag=%x\n", HostDiag);
    +	device_printf(sc->mfi_dev, "ADP_RESET_TBOLT: HostDiag=%#x\n", HostDiag);
     
     	MFI_WRITE4(sc, MFI_HDR, (HostDiag | DIAG_RESET_ADAPTER));
    
    *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 03:43:17 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 7D397D95;
     Wed, 27 Feb 2013 03:43:17 +0000 (UTC)
     (envelope-from benno@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 6E71073B;
     Wed, 27 Feb 2013 03:43:17 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1R3hHnS087120;
     Wed, 27 Feb 2013 03:43:17 GMT (envelope-from benno@svn.freebsd.org)
    Received: (from benno@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1R3hHVB087119;
     Wed, 27 Feb 2013 03:43:17 GMT (envelope-from benno@svn.freebsd.org)
    Message-Id: <201302270343.r1R3hHVB087119@svn.freebsd.org>
    From: Benno Rice 
    Date: Wed, 27 Feb 2013 03:43:17 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247370 - head/sbin/geom/class/part
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 03:43:17 -0000
    
    Author: benno
    Date: Wed Feb 27 03:43:16 2013
    New Revision: 247370
    URL: http://svnweb.freebsd.org/changeset/base/247370
    
    Log:
      Fix typo in EFI GPT GUID.
    
    Modified:
      head/sbin/geom/class/part/gpart.8
    
    Modified: head/sbin/geom/class/part/gpart.8
    ==============================================================================
    --- head/sbin/geom/class/part/gpart.8	Wed Feb 27 02:21:10 2013	(r247369)
    +++ head/sbin/geom/class/part/gpart.8	Wed Feb 27 03:43:16 2013	(r247370)
    @@ -583,7 +583,7 @@ The system partition for computers that 
     Interface (EFI).
     In such cases, the GPT partitioning scheme is used and the
     actual partition type for the system partition can also be specified as
    -.Qq Li "!c12a7328-f81f-11d2-ba4b-00a0c93ec93ab" .
    +.Qq Li "!c12a7328-f81f-11d2-ba4b-00a0c93ec93b" .
     .It Cm freebsd
     A
     .Fx
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 04:33:07 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 6154D874;
     Wed, 27 Feb 2013 04:33:07 +0000 (UTC)
     (envelope-from adrian@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 522B88AB;
     Wed, 27 Feb 2013 04:33:07 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1R4X7br002654;
     Wed, 27 Feb 2013 04:33:07 GMT (envelope-from adrian@svn.freebsd.org)
    Received: (from adrian@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1R4X7iB002652;
     Wed, 27 Feb 2013 04:33:07 GMT (envelope-from adrian@svn.freebsd.org)
    Message-Id: <201302270433.r1R4X7iB002652@svn.freebsd.org>
    From: Adrian Chadd 
    Date: Wed, 27 Feb 2013 04:33:07 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247372 - head/sys/dev/ath/ath_rate/sample
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 04:33:07 -0000
    
    Author: adrian
    Date: Wed Feb 27 04:33:06 2013
    New Revision: 247372
    URL: http://svnweb.freebsd.org/changeset/base/247372
    
    Log:
      I give up - just throw the EWMA update into the normal update_stats()
      routine.
      
      There were still corner cases where the EWMA update stats are being
      called on a rix which didn't have an intermediary stats update; thus
      no packets were counted against it.  Sigh.
      
      This should fix the crashes I've been seeing on recent -HEAD.
    
    Modified:
      head/sys/dev/ath/ath_rate/sample/sample.c
    
    Modified: head/sys/dev/ath/ath_rate/sample/sample.c
    ==============================================================================
    --- head/sys/dev/ath/ath_rate/sample/sample.c	Wed Feb 27 04:19:12 2013	(r247371)
    +++ head/sys/dev/ath/ath_rate/sample/sample.c	Wed Feb 27 04:33:06 2013	(r247372)
    @@ -708,71 +708,6 @@ ath_rate_setupxtxdesc(struct ath_softc *
     	    s3code, sched->t3);		/* series 3 */
     }
     
    -/*
    - * Update the EWMA percentage.
    - *
    - * This is a simple hack to track an EWMA based on the current
    - * rate scenario. For the rate codes which failed, this will
    - * record a 0% against it. For the rate code which succeeded,
    - * EWMA will record the nbad*100/nframes percentage against it.
    - */
    -static void
    -update_ewma_stats(struct ath_softc *sc, struct ath_node *an,
    -    int frame_size,
    -    int rix0, int tries0,
    -    int rix1, int tries1,
    -    int rix2, int tries2,
    -    int rix3, int tries3,
    -    int short_tries, int tries, int status,
    -    int nframes, int nbad)
    -{
    -	struct sample_node *sn = ATH_NODE_SAMPLE(an);
    -	struct sample_softc *ssc = ATH_SOFTC_SAMPLE(sc);
    -	const int size_bin = size_to_bin(frame_size);
    -	int tries_so_far;
    -	int pct;
    -	int rix = rix0;
    -
    -	/* Calculate percentage based on current rate */
    -	if (nframes == 0)
    -		nframes = nbad = 1;
    -	pct = ((nframes - nbad) * 1000) / nframes;
    -
    -	/* Figure out which rate index succeeded */
    -	tries_so_far = tries0;
    -
    -	if (tries1 && tries_so_far < tries) {
    -		tries_so_far += tries1;
    -		rix = rix1;
    -		/* XXX bump ewma pct */
    -	}
    -
    -	if (tries2 && tries_so_far < tries) {
    -		tries_so_far += tries2;
    -		rix = rix2;
    -		/* XXX bump ewma pct */
    -	}
    -
    -	if (tries3 && tries_so_far < tries) {
    -		rix = rix3;
    -		/* XXX bump ewma pct */
    -	}
    -
    -	/* rix is the successful rate, update EWMA for final rix */
    -	if (sn->stats[size_bin][rix].total_packets <
    -	    ssc->smoothing_minpackets) {
    -		/* just average the first few packets */
    -		int a_pct = (sn->stats[size_bin][rix].packets_acked * 1000) /
    -		    (sn->stats[size_bin][rix].total_packets);
    -		sn->stats[size_bin][rix].ewma_pct = a_pct;
    -	} else {
    -		/* use a ewma */
    -		sn->stats[size_bin][rix].ewma_pct =
    -			((sn->stats[size_bin][rix].ewma_pct * ssc->smoothing_rate) +
    -			 (pct * (100 - ssc->smoothing_rate))) / 100;
    -	}
    -}
    -
     static void
     update_stats(struct ath_softc *sc, struct ath_node *an, 
     		  int frame_size,
    @@ -792,6 +727,7 @@ update_stats(struct ath_softc *sc, struc
     	const int size = bin_to_size(size_bin);
     	int tt, tries_so_far;
     	int is_ht40 = (an->an_node.ni_chw == 40);
    +	int pct;
     
     	if (!IS_RATE_DEFINED(sn, rix0))
     		return;
    @@ -865,6 +801,27 @@ update_stats(struct ath_softc *sc, struc
     	sn->stats[size_bin][rix0].last_tx = ticks;
     	sn->stats[size_bin][rix0].total_packets += nframes;
     
    +	/* update EWMA for this rix */
    +
    +	/* Calculate percentage based on current rate */
    +	if (nframes == 0)
    +		nframes = nbad = 1;
    +	pct = ((nframes - nbad) * 1000) / nframes;
    +
    +	if (sn->stats[size_bin][rix0].total_packets <
    +	    ssc->smoothing_minpackets) {
    +		/* just average the first few packets */
    +		int a_pct = (sn->stats[size_bin][rix0].packets_acked * 1000) /
    +		    (sn->stats[size_bin][rix0].total_packets);
    +		sn->stats[size_bin][rix0].ewma_pct = a_pct;
    +	} else {
    +		/* use a ewma */
    +		sn->stats[size_bin][rix0].ewma_pct =
    +			((sn->stats[size_bin][rix0].ewma_pct * ssc->smoothing_rate) +
    +			 (pct * (100 - ssc->smoothing_rate))) / 100;
    +	}
    +
    +
     	if (rix0 == sn->current_sample_rix[size_bin]) {
     		IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL,
     		   &an->an_node,
    @@ -907,6 +864,11 @@ ath_rate_tx_complete(struct ath_softc *s
     	short_tries = ts->ts_shortretry;
     	long_tries = ts->ts_longretry + 1;
     
    +	if (nframes == 0) {
    +		device_printf(sc->sc_dev, "%s: nframes=0?\n", __func__);
    +		return;
    +	}
    +
     	if (frame_size == 0)		    /* NB: should not happen */
     		frame_size = 1500;
     
    @@ -950,13 +912,6 @@ ath_rate_tx_complete(struct ath_softc *s
     			     0, 0,
     			     short_tries, long_tries, status,
     			     nframes, nbad);
    -		update_ewma_stats(sc, an, frame_size, 
    -			     final_rix, long_tries,
    -			     0, 0,
    -			     0, 0,
    -			     0, 0,
    -			     short_tries, long_tries, status,
    -			     nframes, nbad);
     
     	} else {
     		int finalTSIdx = ts->ts_finaltsi;
    @@ -1008,15 +963,6 @@ ath_rate_tx_complete(struct ath_softc *s
     				     short_tries, long_tries,
     				     long_tries > rc[0].tries,
     				     nframes, nbad);
    -			update_ewma_stats(sc, an, frame_size,
    -				     rc[0].rix, rc[0].tries,
    -				     rc[1].rix, rc[1].tries,
    -				     rc[2].rix, rc[2].tries,
    -				     rc[3].rix, rc[3].tries,
    -				     short_tries, long_tries,
    -				     long_tries > rc[0].tries,
    -				     nframes, nbad);
    -
     			long_tries -= rc[0].tries;
     		}
     		
    @@ -1029,14 +975,6 @@ ath_rate_tx_complete(struct ath_softc *s
     				     short_tries, long_tries,
     				     status,
     				     nframes, nbad);
    -			update_ewma_stats(sc, an, frame_size,
    -				     rc[1].rix, rc[1].tries,
    -				     rc[2].rix, rc[2].tries,
    -				     rc[3].rix, rc[3].tries,
    -				     0, 0,
    -				     short_tries, long_tries,
    -				     status,
    -				     nframes, nbad);
     			long_tries -= rc[1].tries;
     		}
     
    @@ -1049,14 +987,6 @@ ath_rate_tx_complete(struct ath_softc *s
     				     short_tries, long_tries,
     				     status,
     				     nframes, nbad);
    -			update_ewma_stats(sc, an, frame_size,
    -				     rc[2].rix, rc[2].tries,
    -				     rc[3].rix, rc[3].tries,
    -				     0, 0,
    -				     0, 0,
    -				     short_tries, long_tries,
    -				     status,
    -				     nframes, nbad);
     			long_tries -= rc[2].tries;
     		}
     
    @@ -1069,14 +999,6 @@ ath_rate_tx_complete(struct ath_softc *s
     				     short_tries, long_tries,
     				     status,
     				     nframes, nbad);
    -			update_ewma_stats(sc, an, frame_size,
    -				     rc[3].rix, rc[3].tries,
    -				     0, 0,
    -				     0, 0,
    -				     0, 0,
    -				     short_tries, long_tries,
    -				     status,
    -				     nframes, nbad);
     		}
     	}
     }
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 04:46:09 2013
    Return-Path: 
    Delivered-To: svn-src-head@FreeBSD.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 6669995;
     Wed, 27 Feb 2013 04:46:09 +0000 (UTC)
     (envelope-from brde@optusnet.com.au)
    Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au
     [211.29.132.184])
     by mx1.freebsd.org (Postfix) with ESMTP id E282D912;
     Wed, 27 Feb 2013 04:46:08 +0000 (UTC)
    Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au
     (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106])
     by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r1R4jv4Y018237
     (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
     Wed, 27 Feb 2013 15:45:59 +1100
    Date: Wed, 27 Feb 2013 15:45:57 +1100 (EST)
    From: Bruce Evans 
    X-X-Sender: bde@besplex.bde.org
    To: Davide Italiano 
    Subject: Re: svn commit: r247300 - in head: sys/sys usr.bin/truss
    In-Reply-To: 
    Message-ID: <20130227144854.F1004@besplex.bde.org>
    References: <201302260213.r1Q2D2N1016801@svn.freebsd.org>
     <201302260941.52534.jhb@freebsd.org>
     
     <201302261335.38001.jhb@freebsd.org>
     
    MIME-Version: 1.0
    Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
    X-Optus-CM-Score: 0
    X-Optus-CM-Analysis: v=2.0 cv=D4sfsYtj c=1 sm=1 a=BX3CFZHxMzQA:10
     a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=Zxvf0eAqCQgA:10
     a=6I5d2MoRAAAA:8 a=TSbVqHtbAAAA:8 a=0f5610cAo4tEP4S7ggQA:9
     a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 a=TEtd8y5WR3g2ypngnwZWYw==:117
    Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
     src-committers@FreeBSD.org, Xin LI ,
     John Baldwin 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 04:46:09 -0000
    
    On Tue, 26 Feb 2013, Davide Italiano wrote:
    
    > On Tue, Feb 26, 2013 at 7:35 PM, John Baldwin  wrote:
    >> On Tuesday, February 26, 2013 12:09:42 pm Davide Italiano wrote:
    >>> On Tue, Feb 26, 2013 at 3:41 PM, John Baldwin  wrote:
    >>>> On Monday, February 25, 2013 9:13:02 pm Xin LI wrote:
    >>>>> Author: delphij
    >>>>> Date: Tue Feb 26 02:13:02 2013
    >>>>> New Revision: 247300
    >>>>> URL: http://svnweb.freebsd.org/changeset/base/247300
    >>>>>
    >>>>> Log:
    >>>>>   Expose timespec and timeval macros when __BSD_VISIBLE is defined.  This
    >>>>>   allows userland application to use the following macros:
    >>>>>
    >>>>>       timespecclear, timespecisset, timespeccmp, timespecadd,
    >>>>>       timespecsub;
    >>>>>
    >>>>>       timevalclear, timevalisset, timevalcmp.
    
    These were intentionally left out.  Unfortunately the API/namespace police
    were not vigilant when the even worse APIs timerclear(), etc., were imported
    from NetBSD/OpenBSD.
    
    Apart from namespace pollution, bugs in these APIs start with them being
    unsafe macros spelled as safe ones.  This bug is unimportant for
    relatively limited use in the kernel, but is unsuitable for a public
    API.
    
    Not leaving the above out gives a reasonable but nonstandard set of APIs
    for timespecs (the 5 listed above), but a weird sesqui-duplicated set for
    timevals (the 3 listed above, plus the 5 misnamed timer*() from NetBSD/
    OpenBSD).  Not leaving out the 3 duplicates the 3 least useful ones.
    
    >>>> Why not fix truss to use the stock functions instead of keeping private
    >>>> "unusual" versions?
    
    They are 3-operand variants of the 2-operand kernel ones that escaped.
    3 operands would be better (more general, and at no cost except in
    calling complexity if the target operand is one of the source operands),
    but the order of the 3 operands is as badly designed as possible:
    
         kernel API: operands (v, u); result v op= u;
         truss API:  operands (t, u, v); result should be t = u op v
                                         result is        v = t op u
             			    (just reversed; t is not the target...)
    
    The timeval APIs are not actually sesqui-duplicated like I said above.
    The NetBSD/OpenBSD ones follow the truss order, with t not being the
    target (it just means generic timespec/timeval, while u and v mean
    the second and third ones, and now it is the kernel API that is
    confusing since there is no t and the order of the others is reversed
    in the operands), while the 3 recently exposed kernel ones aren't of
    the form target = source1 op source2.
    
    truss's timespecadd() also has or had an off by 1 error in its tv_nsec
    wrap check.
    
    >>> time.h is already a mess in terms of namespace pollution, and this
    >>> exposure might not help thing.
    >>> Other details here:
    >>> http://permalink.gmane.org/gmane.os.freebsd.architechture/15518
    
    The bintime macros add further designed and implementation errors.  And
    now there are sbintimes...
    
    >> I think that is orthogonal.  Even if this is reverted I think truss should
    >> be changed to use the "normal" timespecsubt() macro rather than using a custom
    >> one with a different argument order.
    >
    > When I talked about "exposure" I referred about timeval/timespec
    > macros(). I wasn't arguing about your proposed change.
    > Sorry if it wasn't clear.
    
    In fact, conversion would further unimprove truss, since it wants a
    different target in all cases, so the 3-operand variants are ideal for
    it.  Converting to the 2-operand variants would require a temporary
    variable in all callers or in the macros.  The macros could be based
    on the standard ones, but would hardly be improved by that since the
    operations are so simple that no one would get them wrong with off by
    1 errors etc.
    
    Bruce
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 05:03:35 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id B64E1751;
     Wed, 27 Feb 2013 05:03:35 +0000 (UTC)
     (envelope-from yongari@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 934FC980;
     Wed, 27 Feb 2013 05:03:35 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1R53ZsA012020;
     Wed, 27 Feb 2013 05:03:35 GMT (envelope-from yongari@svn.freebsd.org)
    Received: (from yongari@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1R53ZYB012019;
     Wed, 27 Feb 2013 05:03:35 GMT (envelope-from yongari@svn.freebsd.org)
    Message-Id: <201302270503.r1R53ZYB012019@svn.freebsd.org>
    From: Pyun YongHyeon 
    Date: Wed, 27 Feb 2013 05:03:35 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247382 - head/sys/dev/msk
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 05:03:35 -0000
    
    Author: yongari
    Date: Wed Feb 27 05:03:35 2013
    New Revision: 247382
    URL: http://svnweb.freebsd.org/changeset/base/247382
    
    Log:
      RX checksum offloading on old Yukon controllers seem to cause more
      problems.  Disable RX checksum offloading on controllers that don't
      use new descriptor format but give chance to enable it with
      ifconfig(8).
    
    Modified:
      head/sys/dev/msk/if_msk.c
    
    Modified: head/sys/dev/msk/if_msk.c
    ==============================================================================
    --- head/sys/dev/msk/if_msk.c	Wed Feb 27 05:02:40 2013	(r247381)
    +++ head/sys/dev/msk/if_msk.c	Wed Feb 27 05:03:35 2013	(r247382)
    @@ -1695,6 +1695,12 @@ msk_attach(device_t dev)
     			ifp->if_capabilities |= IFCAP_VLAN_HWCSUM;
     	}
     	ifp->if_capenable = ifp->if_capabilities;
    +	/*
    +	 * Disable RX checksum offloading on controllers that don't use
    +	 * new descriptor format but give chance to enable it.
    +	 */
    +	if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0)
    +		ifp->if_capenable &= ~IFCAP_RXCSUM;
     
     	/*
     	 * Tell the upper layer(s) we support long frames.
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 06:53:16 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id E11189F0;
     Wed, 27 Feb 2013 06:53:16 +0000 (UTC)
     (envelope-from andrew@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id D2D98D61;
     Wed, 27 Feb 2013 06:53:16 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1R6rGl7044767;
     Wed, 27 Feb 2013 06:53:16 GMT (envelope-from andrew@svn.freebsd.org)
    Received: (from andrew@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1R6rGZW044766;
     Wed, 27 Feb 2013 06:53:16 GMT (envelope-from andrew@svn.freebsd.org)
    Message-Id: <201302270653.r1R6rGZW044766@svn.freebsd.org>
    From: Andrew Turner 
    Date: Wed, 27 Feb 2013 06:53:16 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247386 - head/contrib/binutils/gas/config
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 06:53:17 -0000
    
    Author: andrew
    Date: Wed Feb 27 06:53:15 2013
    New Revision: 247386
    URL: http://svnweb.freebsd.org/changeset/base/247386
    
    Log:
      Clear the memory allocated to build the unwind tables. This fixes C++
      exceptions on ARM EABI with static binaries.
    
    Modified:
      head/contrib/binutils/gas/config/tc-arm.c
    
    Modified: head/contrib/binutils/gas/config/tc-arm.c
    ==============================================================================
    --- head/contrib/binutils/gas/config/tc-arm.c	Wed Feb 27 06:12:50 2013	(r247385)
    +++ head/contrib/binutils/gas/config/tc-arm.c	Wed Feb 27 06:53:15 2013	(r247386)
    @@ -3079,6 +3079,7 @@ s_arm_unwind_fnend (int ignored ATTRIBUT
       record_alignment (now_seg, 2);
     
       ptr = frag_more (8);
    +  memset(ptr, 0, 8);
       where = frag_now_fix () - 8;
     
       /* Self relative offset of the function start.  */
    @@ -17350,6 +17351,7 @@ create_unwind_entry (int have_data)
     
       /* Allocate the table entry.	*/
       ptr = frag_more ((size << 2) + 4);
    +  memset(ptr, 0, (size << 2) + 4);
       where = frag_now_fix () - ((size << 2) + 4);
     
       switch (unwind.personality_index)
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 07:31:24 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 921DF170;
     Wed, 27 Feb 2013 07:31:24 +0000 (UTC) (envelope-from kib@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 7635DE62;
     Wed, 27 Feb 2013 07:31:24 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1R7VOtw056843;
     Wed, 27 Feb 2013 07:31:24 GMT (envelope-from kib@svn.freebsd.org)
    Received: (from kib@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1R7VOrT056842;
     Wed, 27 Feb 2013 07:31:24 GMT (envelope-from kib@svn.freebsd.org)
    Message-Id: <201302270731.r1R7VOrT056842@svn.freebsd.org>
    From: Konstantin Belousov 
    Date: Wed, 27 Feb 2013 07:31:24 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247387 - head/sys/ufs/ffs
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 07:31:24 -0000
    
    Author: kib
    Date: Wed Feb 27 07:31:23 2013
    New Revision: 247387
    URL: http://svnweb.freebsd.org/changeset/base/247387
    
    Log:
      An inode block must not be blockingly read while cg block is owned.
      The order is inode buffer lock -> snaplk -> cg buffer lock, reversing
      the order causes deadlocks.
      
      Inode block must not be written while cg block buffer is owned. The
      FFS copy on write needs to allocate a block to copy the content of the
      inode block, and the cylinder group selected for the allocation might
      be the same as the owned cg block.  The reserved block detection code
      in the ffs_copyonwrite() and ffs_bp_snapblk() is unable to detect the
      situation, because the locked cg buffer is not exposed to it.
      
      In order to maintain the dependency between initialized inode block
      and the cg_initediblk pointer, look up the inode buffer in
      non-blocking mode. If succeeded, brelse cg block, initialize the inode
      block and write it.  After the write is finished, reread cg block and
      update the cg_initediblk.
      
      If inode block is already locked by another thread, let the another
      thread initialize it.  If another thread raced with us after we
      started writing inode block, the situation is detected by an update of
      cg_initediblk.  Note that double-initialization of the inode block is
      harmless, the block cannot be used until cg_initediblk is incremented.
      
      Sponsored by:	The FreeBSD Foundation
      In collaboration with:	pho
      Reviewed by:	mckusick
      MFC after:	1 month
      X-MFC-note:	after r246877
    
    Modified:
      head/sys/ufs/ffs/ffs_alloc.c
    
    Modified: head/sys/ufs/ffs/ffs_alloc.c
    ==============================================================================
    --- head/sys/ufs/ffs/ffs_alloc.c	Wed Feb 27 06:53:15 2013	(r247386)
    +++ head/sys/ufs/ffs/ffs_alloc.c	Wed Feb 27 07:31:23 2013	(r247387)
    @@ -1790,6 +1790,17 @@ fail:
     	return (0);
     }
     
    +static inline struct buf *
    +getinobuf(struct inode *ip, u_int cg, u_int32_t cginoblk, int gbflags)
    +{
    +	struct fs *fs;
    +
    +	fs = ip->i_fs;
    +	return (getblk(ip->i_devvp, fsbtodb(fs, ino_to_fsba(fs,
    +	    cg * fs->fs_ipg + cginoblk)), (int)fs->fs_bsize, 0, 0,
    +	    gbflags));
    +}
    +
     /*
      * Determine whether an inode can be allocated.
      *
    @@ -1814,9 +1825,11 @@ ffs_nodealloccg(ip, cg, ipref, mode, unu
     	u_int8_t *inosused, *loc;
     	struct ufs2_dinode *dp2;
     	int error, start, len, i;
    +	u_int32_t old_initediblk;
     
     	fs = ip->i_fs;
     	ump = ip->i_ump;
    +check_nifree:
     	if (fs->fs_cs(fs, cg).cs_nifree == 0)
     		return (0);
     	UFS_UNLOCK(ump);
    @@ -1828,13 +1841,13 @@ ffs_nodealloccg(ip, cg, ipref, mode, unu
     		return (0);
     	}
     	cgp = (struct cg *)bp->b_data;
    +restart:
     	if (!cg_chkmagic(cgp) || cgp->cg_cs.cs_nifree == 0) {
     		brelse(bp);
     		UFS_LOCK(ump);
     		return (0);
     	}
     	bp->b_xflags |= BX_BKGRDWRITE;
    -	cgp->cg_old_time = cgp->cg_time = time_second;
     	inosused = cg_inosused(cgp);
     	if (ipref) {
     		ipref %= fs->fs_ipg;
    @@ -1856,7 +1869,6 @@ ffs_nodealloccg(ip, cg, ipref, mode, unu
     		}
     	}
     	ipref = (loc - inosused) * NBBY + ffs(~*loc) - 1;
    -	cgp->cg_irotor = ipref;
     gotit:
     	/*
     	 * Check to see if we need to initialize more inodes.
    @@ -1864,9 +1876,37 @@ gotit:
     	if (fs->fs_magic == FS_UFS2_MAGIC &&
     	    ipref + INOPB(fs) > cgp->cg_initediblk &&
     	    cgp->cg_initediblk < cgp->cg_niblk) {
    -		ibp = getblk(ip->i_devvp, fsbtodb(fs,
    -		    ino_to_fsba(fs, cg * fs->fs_ipg + cgp->cg_initediblk)),
    -		    (int)fs->fs_bsize, 0, 0, 0);
    +		old_initediblk = cgp->cg_initediblk;
    +
    +		/*
    +		 * Free the cylinder group lock before writing the
    +		 * initialized inode block.  Entering the
    +		 * babarrierwrite() with the cylinder group lock
    +		 * causes lock order violation between the lock and
    +		 * snaplk.
    +		 *
    +		 * Another thread can decide to initialize the same
    +		 * inode block, but whichever thread first gets the
    +		 * cylinder group lock after writing the newly
    +		 * allocated inode block will update it and the other
    +		 * will realize that it has lost and leave the
    +		 * cylinder group unchanged.
    +		 */
    +		ibp = getinobuf(ip, cg, old_initediblk, GB_LOCK_NOWAIT);
    +		brelse(bp);
    +		if (ibp == NULL) {
    +			/*
    +			 * The inode block buffer is already owned by
    +			 * another thread, which must initialize it.
    +			 * Wait on the buffer to allow another thread
    +			 * to finish the updates, with dropped cg
    +			 * buffer lock, then retry.
    +			 */
    +			ibp = getinobuf(ip, cg, old_initediblk, 0);
    +			brelse(ibp);
    +			UFS_LOCK(ump);
    +			goto check_nifree;
    +		}
     		bzero(ibp->b_data, (int)fs->fs_bsize);
     		dp2 = (struct ufs2_dinode *)(ibp->b_data);
     		for (i = 0; i < INOPB(fs); i++) {
    @@ -1883,8 +1923,29 @@ gotit:
     		 * loading of newly created filesystems.
     		 */
     		babarrierwrite(ibp);
    -		cgp->cg_initediblk += INOPB(fs);
    +
    +		/*
    +		 * After the inode block is written, try to update the
    +		 * cg initediblk pointer.  If another thread beat us
    +		 * to it, then leave it unchanged as the other thread
    +		 * has already set it correctly.
    +		 */
    +		error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
    +		    (int)fs->fs_cgsize, NOCRED, &bp);
    +		UFS_LOCK(ump);
    +		ACTIVECLEAR(fs, cg);
    +		UFS_UNLOCK(ump);
    +		if (error != 0) {
    +			brelse(bp);
    +			return (error);
    +		}
    +		cgp = (struct cg *)bp->b_data;
    +		if (cgp->cg_initediblk == old_initediblk)
    +			cgp->cg_initediblk += INOPB(fs);
    +		goto restart;
     	}
    +	cgp->cg_old_time = cgp->cg_time = time_second;
    +	cgp->cg_irotor = ipref;
     	UFS_LOCK(ump);
     	ACTIVECLEAR(fs, cg);
     	setbit(inosused, ipref);
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 07:32:40 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 9C2F92E8;
     Wed, 27 Feb 2013 07:32:40 +0000 (UTC) (envelope-from kib@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 75F91E6E;
     Wed, 27 Feb 2013 07:32:40 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1R7We4P057054;
     Wed, 27 Feb 2013 07:32:40 GMT (envelope-from kib@svn.freebsd.org)
    Received: (from kib@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1R7Wd3k057047;
     Wed, 27 Feb 2013 07:32:39 GMT (envelope-from kib@svn.freebsd.org)
    Message-Id: <201302270732.r1R7Wd3k057047@svn.freebsd.org>
    From: Konstantin Belousov 
    Date: Wed, 27 Feb 2013 07:32:39 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247388 - in head/sys: sys ufs/ffs ufs/ufs
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 07:32:40 -0000
    
    Author: kib
    Date: Wed Feb 27 07:32:39 2013
    New Revision: 247388
    URL: http://svnweb.freebsd.org/changeset/base/247388
    
    Log:
      The softdep freeblks workitem might hold a reference on the dquot.
      Current dqflush() panics when a dquot with with non-zero refcount is
      encountered.  The situation is possible, because quotas are turned off
      before softdep workitem queue if flushed, due to the quota file writes
      might create softdep workitems.
      
      Make the encountering an active dquot in dqflush() not fatal, return
      the error from quotaoff() instead.  Ignore the quotaoff() failures
      when ffs_flushfiles() is called in the course of softdep_flushfiles()
      loop, until the last iteration.  At the last loop, the quotas must be
      closed, and because SU workitems should be already flushed, the
      references to dquot are gone.
      
      Sponsored by:	The FreeBSD Foundation
      Reported and tested by:	pho
      Reviewed by:	mckusick
      MFC after:	2 weeks
    
    Modified:
      head/sys/sys/vnode.h
      head/sys/ufs/ffs/ffs_softdep.c
      head/sys/ufs/ffs/ffs_vfsops.c
      head/sys/ufs/ufs/ufs_quota.c
    
    Modified: head/sys/sys/vnode.h
    ==============================================================================
    --- head/sys/sys/vnode.h	Wed Feb 27 07:31:23 2013	(r247387)
    +++ head/sys/sys/vnode.h	Wed Feb 27 07:32:39 2013	(r247388)
    @@ -385,6 +385,7 @@ extern int		vttoif_tab[];
     #define	SKIPSYSTEM	0x0001	/* vflush: skip vnodes marked VSYSTEM */
     #define	FORCECLOSE	0x0002	/* vflush: force file closure */
     #define	WRITECLOSE	0x0004	/* vflush: only close writable files */
    +#define	EARLYFLUSH	0x0008	/* vflush: early call for ffs_flushfiles */
     #define	V_SAVE		0x0001	/* vinvalbuf: sync file first */
     #define	V_ALT		0x0002	/* vinvalbuf: invalidate only alternate bufs */
     #define	V_NORMAL	0x0004	/* vinvalbuf: invalidate only regular bufs */
    
    Modified: head/sys/ufs/ffs/ffs_softdep.c
    ==============================================================================
    --- head/sys/ufs/ffs/ffs_softdep.c	Wed Feb 27 07:31:23 2013	(r247387)
    +++ head/sys/ufs/ffs/ffs_softdep.c	Wed Feb 27 07:32:39 2013	(r247388)
    @@ -1908,7 +1908,12 @@ softdep_flushfiles(oldmnt, flags, td)
     	int flags;
     	struct thread *td;
     {
    -	int error, depcount, loopcnt, retry_flush_count, retry;
    +#ifdef QUOTA
    +	struct ufsmount *ump;
    +	int i;
    +#endif
    +	int error, early, depcount, loopcnt, retry_flush_count, retry;
    +	int morework;
     
     	loopcnt = 10;
     	retry_flush_count = 3;
    @@ -1926,7 +1931,9 @@ retry_flush:
     		 * Do another flush in case any vnodes were brought in
     		 * as part of the cleanup operations.
     		 */
    -		if ((error = ffs_flushfiles(oldmnt, flags, td)) != 0)
    +		early = retry_flush_count == 1 || (oldmnt->mnt_kern_flag &
    +		    MNTK_UNMOUNT) == 0 ? 0 : EARLYFLUSH;
    +		if ((error = ffs_flushfiles(oldmnt, flags | early, td)) != 0)
     			break;
     		if ((error = softdep_flushworklist(oldmnt, &depcount, td)) != 0 ||
     		    depcount == 0)
    @@ -1950,7 +1957,17 @@ retry_flush:
     			MNT_ILOCK(oldmnt);
     			KASSERT((oldmnt->mnt_kern_flag & MNTK_NOINSMNTQ) != 0,
     			    ("softdep_flushfiles: !MNTK_NOINSMNTQ"));
    -			if (oldmnt->mnt_nvnodelistsize > 0) {
    +			morework = oldmnt->mnt_nvnodelistsize > 0;
    +#ifdef QUOTA
    +			ump = VFSTOUFS(oldmnt);
    +			UFS_LOCK(ump);
    +			for (i = 0; i < MAXQUOTAS; i++) {
    +				if (ump->um_quotas[i] != NULLVP)
    +					morework = 1;
    +			}
    +			UFS_UNLOCK(ump);
    +#endif
    +			if (morework) {
     				if (--retry_flush_count > 0) {
     					retry = 1;
     					loopcnt = 3;
    
    Modified: head/sys/ufs/ffs/ffs_vfsops.c
    ==============================================================================
    --- head/sys/ufs/ffs/ffs_vfsops.c	Wed Feb 27 07:31:23 2013	(r247387)
    +++ head/sys/ufs/ffs/ffs_vfsops.c	Wed Feb 27 07:32:39 2013	(r247388)
    @@ -1351,9 +1351,10 @@ ffs_flushfiles(mp, flags, td)
     	struct thread *td;
     {
     	struct ufsmount *ump;
    -	int error;
    +	int qerror, error;
     
     	ump = VFSTOUFS(mp);
    +	qerror = 0;
     #ifdef QUOTA
     	if (mp->mnt_flag & MNT_QUOTA) {
     		int i;
    @@ -1361,11 +1362,19 @@ ffs_flushfiles(mp, flags, td)
     		if (error)
     			return (error);
     		for (i = 0; i < MAXQUOTAS; i++) {
    -			quotaoff(td, mp, i);
    +			error = quotaoff(td, mp, i);
    +			if (error != 0) {
    +				if ((flags & EARLYFLUSH) == 0)
    +					return (error);
    +				else
    +					qerror = error;
    +			}
     		}
    +
     		/*
    -		 * Here we fall through to vflush again to ensure
    -		 * that we have gotten rid of all the system vnodes.
    +		 * Here we fall through to vflush again to ensure that
    +		 * we have gotten rid of all the system vnodes, unless
    +		 * quotas must not be closed.
     		 */
     	}
     #endif
    @@ -1380,11 +1389,21 @@ ffs_flushfiles(mp, flags, td)
     		 * that we have gotten rid of all the system vnodes.
     		 */
     	}
    -        /*
    -	 * Flush all the files.
    +
    +	/*
    +	 * Do not close system files if quotas were not closed, to be
    +	 * able to sync the remaining dquots.  The freeblks softupdate
    +	 * workitems might hold a reference on a dquot, preventing
    +	 * quotaoff() from completing.  Next round of
    +	 * softdep_flushworklist() iteration should process the
    +	 * blockers, allowing the next run of quotaoff() to finally
    +	 * flush held dquots.
    +	 *
    +	 * Otherwise, flush all the files.
     	 */
    -	if ((error = vflush(mp, 0, flags, td)) != 0)
    +	if (qerror == 0 && (error = vflush(mp, 0, flags, td)) != 0)
     		return (error);
    +
     	/*
     	 * Flush filesystem metadata.
     	 */
    
    Modified: head/sys/ufs/ufs/ufs_quota.c
    ==============================================================================
    --- head/sys/ufs/ufs/ufs_quota.c	Wed Feb 27 07:31:23 2013	(r247387)
    +++ head/sys/ufs/ufs/ufs_quota.c	Wed Feb 27 07:32:39 2013	(r247388)
    @@ -80,7 +80,7 @@ static int dqopen(struct vnode *, struct
     static int dqget(struct vnode *,
     	u_long, struct ufsmount *, int, struct dquot **);
     static int dqsync(struct vnode *, struct dquot *);
    -static void dqflush(struct vnode *);
    +static int dqflush(struct vnode *);
     static int quotaoff1(struct thread *td, struct mount *mp, int type);
     static int quotaoff_inchange(struct thread *td, struct mount *mp, int type);
     
    @@ -674,8 +674,12 @@ again:
     		vrele(vp);
     	}
     
    -	dqflush(qvp);
    -	/* Clear um_quotas before closing the quota vnode to prevent
    +	error = dqflush(qvp);
    +	if (error != 0)
    +		return (error);
    +
    +	/*
    +	 * Clear um_quotas before closing the quota vnode to prevent
     	 * access to the closed vnode from dqget/dqsync
     	 */
     	UFS_LOCK(ump);
    @@ -1594,17 +1598,19 @@ out:
     /*
      * Flush all entries from the cache for a particular vnode.
      */
    -static void
    +static int
     dqflush(struct vnode *vp)
     {
     	struct dquot *dq, *nextdq;
     	struct dqhash *dqh;
    +	int error;
     
     	/*
     	 * Move all dquot's that used to refer to this quota
     	 * file off their hash chains (they will eventually
     	 * fall off the head of the free list and be re-used).
     	 */
    +	error = 0;
     	DQH_LOCK();
     	for (dqh = &dqhashtbl[dqhash]; dqh >= dqhashtbl; dqh--) {
     		for (dq = LIST_FIRST(dqh); dq; dq = nextdq) {
    @@ -1612,12 +1618,15 @@ dqflush(struct vnode *vp)
     			if (dq->dq_ump->um_quotas[dq->dq_type] != vp)
     				continue;
     			if (dq->dq_cnt)
    -				panic("dqflush: stray dquot");
    -			LIST_REMOVE(dq, dq_hash);
    -			dq->dq_ump = (struct ufsmount *)0;
    +				error = EBUSY;
    +			else {
    +				LIST_REMOVE(dq, dq_hash);
    +				dq->dq_ump = NULL;
    +			}
     		}
     	}
     	DQH_UNLOCK();
    +	return (error);
     }
     
     /*
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 07:34:09 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id C72F1476;
     Wed, 27 Feb 2013 07:34:09 +0000 (UTC) (envelope-from kib@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id A3AB3E81;
     Wed, 27 Feb 2013 07:34:09 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1R7Y9Fo057324;
     Wed, 27 Feb 2013 07:34:09 GMT (envelope-from kib@svn.freebsd.org)
    Received: (from kib@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1R7Y9Tu057323;
     Wed, 27 Feb 2013 07:34:09 GMT (envelope-from kib@svn.freebsd.org)
    Message-Id: <201302270734.r1R7Y9Tu057323@svn.freebsd.org>
    From: Konstantin Belousov 
    Date: Wed, 27 Feb 2013 07:34:09 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247389 - head/sys/kern
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 07:34:09 -0000
    
    Author: kib
    Date: Wed Feb 27 07:34:09 2013
    New Revision: 247389
    URL: http://svnweb.freebsd.org/changeset/base/247389
    
    Log:
      Make recursive getblk() slightly more useful.  Keep the buffer state
      intact if getblk() is done on the already owned buffer.  Exit from
      brelse() early when the lock recursion is detected, otherwise brelse()
      might prematurely destroy the buffer under some circumstances.
      
      Sponsored by:	The FreeBSD Foundation
      Noted by:	mckusick
      Tested by:	pho
      MFC after:	2 weeks
    
    Modified:
      head/sys/kern/vfs_bio.c
    
    Modified: head/sys/kern/vfs_bio.c
    ==============================================================================
    --- head/sys/kern/vfs_bio.c	Wed Feb 27 07:32:39 2013	(r247388)
    +++ head/sys/kern/vfs_bio.c	Wed Feb 27 07:34:09 2013	(r247389)
    @@ -1268,6 +1268,15 @@ brelse(struct buf *bp)
     	KASSERT(!(bp->b_flags & (B_CLUSTER|B_PAGING)),
     	    ("brelse: inappropriate B_PAGING or B_CLUSTER bp %p", bp));
     
    +	if (BUF_LOCKRECURSED(bp)) {
    +		/*
    +		 * Do not process, in particular, do not handle the
    +		 * B_INVAL/B_RELBUF and do not release to free list.
    +		 */
    +		BUF_UNLOCK(bp);
    +		return;
    +	}
    +
     	if (bp->b_flags & B_MANAGED) {
     		bqrelse(bp);
     		return;
    @@ -1444,12 +1453,6 @@ brelse(struct buf *bp)
     			brelvp(bp);
     	}
     			
    -	if (BUF_LOCKRECURSED(bp)) {
    -		/* do not release to free list */
    -		BUF_UNLOCK(bp);
    -		return;
    -	}
    -
     	/* enqueue */
     	mtx_lock(&bqlock);
     	/* Handle delayed bremfree() processing. */
    @@ -2681,6 +2684,9 @@ loop:
     		/* We timed out or were interrupted. */
     		else if (error)
     			return (NULL);
    +		/* If recursed, assume caller knows the rules. */
    +		else if (BUF_LOCKRECURSED(bp))
    +			goto end;
     
     		/*
     		 * The buffer is locked.  B_CACHE is cleared if the buffer is 
    @@ -2864,6 +2870,7 @@ loop:
     	}
     	CTR4(KTR_BUF, "getblk(%p, %ld, %d) = %p", vp, (long)blkno, size, bp);
     	BUF_ASSERT_HELD(bp);
    +end:
     	KASSERT(bp->b_bufobj == bo,
     	    ("bp %p wrong b_bufobj %p should be %p", bp, bp->b_bufobj, bo));
     	return (bp);
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 08:25:59 2013
    Return-Path: 
    Delivered-To: svn-src-head@FreeBSD.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id C66F4EF7;
     Wed, 27 Feb 2013 08:25:59 +0000 (UTC)
     (envelope-from peter@rulingia.com)
    Received: from vps.rulingia.com (host-122-100-2-194.octopus.com.au
     [122.100.2.194]) by mx1.freebsd.org (Postfix) with ESMTP id 71CB9D3;
     Wed, 27 Feb 2013 08:25:58 +0000 (UTC)
    Received: from server.rulingia.com
     (c220-239-237-213.belrs5.nsw.optusnet.com.au [220.239.237.213])
     by vps.rulingia.com (8.14.5/8.14.5) with ESMTP id r1R8Ptnk098994
     (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
     Wed, 27 Feb 2013 19:25:56 +1100 (EST)
     (envelope-from peter@rulingia.com)
    X-Bogosity: Ham, spamicity=0.000000
    Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1])
     by server.rulingia.com (8.14.5/8.14.5) with ESMTP id r1R8Pn0I091366
     (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
     Wed, 27 Feb 2013 19:25:49 +1100 (EST)
     (envelope-from peter@server.rulingia.com)
    Received: (from peter@localhost)
     by server.rulingia.com (8.14.5/8.14.5/Submit) id r1R8Pm8T091365;
     Wed, 27 Feb 2013 19:25:48 +1100 (EST) (envelope-from peter)
    Date: Wed, 27 Feb 2013 19:25:48 +1100
    From: Peter Jeremy 
    To: Jilles Tjoelker 
    Subject: Re: svn commit: r247274 - in head: bin/test tools/regression/bin/test
    Message-ID: <20130227082548.GF99210@server.rulingia.com>
    References: <201302251905.r1PJ5fKF085179@svn.freebsd.org>
     <20130226000227.GA80718@stack.nl>
    MIME-Version: 1.0
    Content-Type: multipart/signed; micalg=pgp-sha1;
     protocol="application/pgp-signature"; boundary="EP0wieDxd4TSJjHq"
    Content-Disposition: inline
    In-Reply-To: <20130226000227.GA80718@stack.nl>
    X-PGP-Key: http://www.rulingia.com/keys/peter.pgp
    User-Agent: Mutt/1.5.21 (2010-09-15)
    Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
     src-committers@FreeBSD.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 08:25:59 -0000
    
    
    --EP0wieDxd4TSJjHq
    Content-Type: text/plain; charset=iso-8859-1
    Content-Disposition: inline
    Content-Transfer-Encoding: quoted-printable
    
    On 2013-Feb-26 01:02:27 +0100, Jilles Tjoelker  wrote:
    >>   Enhance test(1) by adding provision to compare any combination of the
    >>   access, birth, change and modify times of two files, instead of only
    >>   being able to compare modify times.  The builtin test in sh(1) will
    >>   automagically acquire the same expansion.
    >
    >What do you need this for? If it is not needed very often, this test can
    >be done more portably (older FreeBSD and GNU) as
    >  [ -n "$(find -L FILE1 -prune -newerXY FILE2 2>/dev/null)" ]
    
    In my case I needed to compare the ctime on one set of files with the
    mtime in another set.  I had a think about using find(1) and gave it
    away as too ugly.  That expression needs serious thought to understand
    and about =BD the tokens in the find(1) are to handle special cases -
    which is a further indication that it isn't ideal.
    
    >I have generally been rather reluctant in adding things to sh(1) and
    >even more so if they are completely new. Someone proposed something
    >rather similar (except that it added a time string parser -- even more
    >code) in PR bin/57054 and I rejected it in 2009.
    
    Time parsing is a large can of worms - getting it right is messy (that
    patch includes 1KLOC of new code and still isn't locale aware).  And
    the work-around of touching a dummy file to the wanted age isn't too
    horrrible.  This is a much smaller patch and there's no equally clean
    work-around.
    
    >> +a=3D/tmp/test$$.1
    >> +b=3D/tmp/test$$.2
    >
    >Please use mktemp(1). Using $$ for temporary files is insecure on
    >multiuser systems.
    
    In this case, I want filenames that don't exist.  I will look at using
    mktemp(1) to create a temporary directory.
    
    >> +sleep 2    # Ensure $b is newer than $a
    >> +touch $b
    >
    >Please use touch -t instead of sleeping. I'm impatient while running
    >tests :)
    
    In this case, I want all the timestamps on $b to be later than $a.  I
    initially tried without the sleep but that failed with the builtin
    test(1) because the FS timestamps weren't sufficiently granular to
    report the difference.  I could create one of the files much earlier
    during the test and then use a conditional test to only sleep if the
    timestamps were indistinguishable (this probably needs to use the
    above find(1) horror to avoid using test(1) to test itself).
    
    I agree the other sleep(1)s should be able to be replaced with
    touch(1) but I ran into problems with my initial efforts to do
    everything using touch(1).  I will revisit it.
    
    --=20
    Peter Jeremy
    
    --EP0wieDxd4TSJjHq
    Content-Type: application/pgp-signature
    
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.19 (FreeBSD)
    
    iEYEARECAAYFAlEtwwwACgkQ/opHv/APuIeFvACeOgfECr+1cchOoV4s8MgvPapO
    HyYAoJz+idnfLYUcklexj343j62LFYI7
    =qmM8
    -----END PGP SIGNATURE-----
    
    --EP0wieDxd4TSJjHq--
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 08:32:35 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 69C312F3;
     Wed, 27 Feb 2013 08:32:35 +0000 (UTC)
     (envelope-from gonzo@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 44633117;
     Wed, 27 Feb 2013 08:32:35 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1R8WZoX074996;
     Wed, 27 Feb 2013 08:32:35 GMT (envelope-from gonzo@svn.freebsd.org)
    Received: (from gonzo@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1R8WZmP074995;
     Wed, 27 Feb 2013 08:32:35 GMT (envelope-from gonzo@svn.freebsd.org)
    Message-Id: <201302270832.r1R8WZmP074995@svn.freebsd.org>
    From: Oleksandr Tymoshenko 
    Date: Wed, 27 Feb 2013 08:32:35 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247390 - head/sys/arm/ti
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 08:32:35 -0000
    
    Author: gonzo
    Date: Wed Feb 27 08:32:34 2013
    New Revision: 247390
    URL: http://svnweb.freebsd.org/changeset/base/247390
    
    Log:
      - Initialize GPIO_OE register based on pinmux configuration
      
      Although AM335x TRM states that GPIO_OE register is not used and just
      reflects pads configuration in practice it does control pin behavior
      and shoiuld be set in addition to pinmux setup
    
    Modified:
      head/sys/arm/ti/ti_gpio.c
    
    Modified: head/sys/arm/ti/ti_gpio.c
    ==============================================================================
    --- head/sys/arm/ti/ti_gpio.c	Wed Feb 27 07:34:09 2013	(r247389)
    +++ head/sys/arm/ti/ti_gpio.c	Wed Feb 27 08:32:34 2013	(r247390)
    @@ -653,6 +653,9 @@ ti_gpio_attach(device_t dev)
     	struct ti_gpio_softc *sc = device_get_softc(dev);
     	unsigned int i;
     	int err = 0;
    +	int pin;
    +	uint32_t flags;
    +	uint32_t reg_oe;
     
     	sc->sc_dev = dev;
     
    @@ -720,6 +723,17 @@ ti_gpio_attach(device_t dev)
     			/* Disable interrupts for all pins */
     			ti_gpio_write_4(sc, i, TI_GPIO_CLEARIRQENABLE1, 0xffffffff);
     			ti_gpio_write_4(sc, i, TI_GPIO_CLEARIRQENABLE2, 0xffffffff);
    +
    +			/* Init OE registger based on pads configuration */
    +			reg_oe = 0xffffffff;
    +			for (pin = 0; pin < 32; pin++) {
    +				ti_scm_padconf_get_gpioflags(
    +				    PINS_PER_BANK*i + pin, &flags);
    +				if (flags & GPIO_PIN_OUTPUT)
    +					reg_oe &= ~(1U << pin);
    +			}
    +
    +			ti_gpio_write_4(sc, i, TI_GPIO_OE, reg_oe);
     		}
     	}
     
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 08:34:32 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id B34D5476;
     Wed, 27 Feb 2013 08:34:32 +0000 (UTC)
     (envelope-from gonzo@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id A606E129;
     Wed, 27 Feb 2013 08:34:32 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1R8YW2X075331;
     Wed, 27 Feb 2013 08:34:32 GMT (envelope-from gonzo@svn.freebsd.org)
    Received: (from gonzo@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1R8YWpp075330;
     Wed, 27 Feb 2013 08:34:32 GMT (envelope-from gonzo@svn.freebsd.org)
    Message-Id: <201302270834.r1R8YWpp075330@svn.freebsd.org>
    From: Oleksandr Tymoshenko 
    Date: Wed, 27 Feb 2013 08:34:32 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247391 - head/sys/arm/ti
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 08:34:32 -0000
    
    Author: gonzo
    Date: Wed Feb 27 08:34:32 2013
    New Revision: 247391
    URL: http://svnweb.freebsd.org/changeset/base/247391
    
    Log:
      Fix typo
    
    Modified:
      head/sys/arm/ti/ti_gpio.c
    
    Modified: head/sys/arm/ti/ti_gpio.c
    ==============================================================================
    --- head/sys/arm/ti/ti_gpio.c	Wed Feb 27 08:32:34 2013	(r247390)
    +++ head/sys/arm/ti/ti_gpio.c	Wed Feb 27 08:34:32 2013	(r247391)
    @@ -724,7 +724,7 @@ ti_gpio_attach(device_t dev)
     			ti_gpio_write_4(sc, i, TI_GPIO_CLEARIRQENABLE1, 0xffffffff);
     			ti_gpio_write_4(sc, i, TI_GPIO_CLEARIRQENABLE2, 0xffffffff);
     
    -			/* Init OE registger based on pads configuration */
    +			/* Init OE register based on pads configuration */
     			reg_oe = 0xffffffff;
     			for (pin = 0; pin < 32; pin++) {
     				ti_scm_padconf_get_gpioflags(
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 09:34:10 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 21FF8463;
     Wed, 27 Feb 2013 09:34:10 +0000 (UTC)
     (envelope-from tijl@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 135D0339;
     Wed, 27 Feb 2013 09:34:10 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1R9Y9cC093716;
     Wed, 27 Feb 2013 09:34:09 GMT (envelope-from tijl@svn.freebsd.org)
    Received: (from tijl@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1R9Y9j9093715;
     Wed, 27 Feb 2013 09:34:09 GMT (envelope-from tijl@svn.freebsd.org)
    Message-Id: <201302270934.r1R9Y9j9093715@svn.freebsd.org>
    From: Tijl Coosemans 
    Date: Wed, 27 Feb 2013 09:34:09 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247396 - head/libexec/rtld-elf
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 09:34:10 -0000
    
    Author: tijl
    Date: Wed Feb 27 09:34:09 2013
    New Revision: 247396
    URL: http://svnweb.freebsd.org/changeset/base/247396
    
    Log:
      Map libraries linked with -Ttext-segment=base_addr at base_addr.
      Normal libraries have base address 0 and are unaffected by this change.
      
      PR:		176216
      Submitted by:	Damjan Jovanovic 
      Reviewed by:	kib
      MFC after:	1 week
    
    Modified:
      head/libexec/rtld-elf/map_object.c
    
    Modified: head/libexec/rtld-elf/map_object.c
    ==============================================================================
    --- head/libexec/rtld-elf/map_object.c	Wed Feb 27 08:56:57 2013	(r247395)
    +++ head/libexec/rtld-elf/map_object.c	Wed Feb 27 09:34:09 2013	(r247396)
    @@ -175,7 +175,7 @@ map_object(int fd, const char *path, con
         base_vaddr = trunc_page(segs[0]->p_vaddr);
         base_vlimit = round_page(segs[nsegs]->p_vaddr + segs[nsegs]->p_memsz);
         mapsize = base_vlimit - base_vaddr;
    -    base_addr = hdr->e_type == ET_EXEC ? (caddr_t) base_vaddr : NULL;
    +    base_addr = (caddr_t) base_vaddr;
     
         mapbase = mmap(base_addr, mapsize, PROT_NONE, MAP_ANON | MAP_PRIVATE |
           MAP_NOCORE, -1, 0);
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 14:45:25 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 2E2B5A15;
     Wed, 27 Feb 2013 14:45:25 +0000 (UTC) (envelope-from mm@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 1EC4C72E;
     Wed, 27 Feb 2013 14:45:25 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1REjPvO087790;
     Wed, 27 Feb 2013 14:45:25 GMT (envelope-from mm@svn.freebsd.org)
    Received: (from mm@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1REjOEE087781;
     Wed, 27 Feb 2013 14:45:24 GMT (envelope-from mm@svn.freebsd.org)
    Message-Id: <201302271445.r1REjOEE087781@svn.freebsd.org>
    From: Martin Matuska 
    Date: Wed, 27 Feb 2013 14:45:24 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247398 - in head: cddl/contrib/opensolaris/cmd/zdb
     sys/cddl/contrib/opensolaris/uts/common/fs/zfs
     sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 14:45:25 -0000
    
    Author: mm
    Date: Wed Feb 27 14:45:23 2013
    New Revision: 247398
    URL: http://svnweb.freebsd.org/changeset/base/247398
    
    Log:
      MFV 247176, 247178, 247315:
      Import metaslab_sync() speedup from vendor (illumos).
      
      Illumos ZFS issues:
        3552 condensing one space map burns 3 seconds of CPU in spa_sync() thread
        3564 spa_sync() spends 5-10% of its time in metaslab_sync() (when not
             condensing)
        3578 transferring the freed map to the defer map should be constant time
        3579 ztest trips assertion in metaslab_weight()
      
      References:
        https://www.illumos.org/issues/3552
        https://www.illumos.org/issues/3564
        https://www.illumos.org/issues/3578
        https://www.illumos.org/issues/3579
      
      MFC after:	2 weeks
    
    Modified:
      head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
      head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
      head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c
      head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h
      head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h
      head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
    Directory Properties:
      head/cddl/contrib/opensolaris/   (props changed)
      head/sys/cddl/contrib/opensolaris/   (props changed)
    
    Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
    ==============================================================================
    --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c	Wed Feb 27 11:42:28 2013	(r247397)
    +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c	Wed Feb 27 14:45:23 2013	(r247398)
    @@ -545,7 +545,7 @@ static void
     dump_metaslab_stats(metaslab_t *msp)
     {
     	char maxbuf[32];
    -	space_map_t *sm = &msp->ms_map;
    +	space_map_t *sm = msp->ms_map;
     	avl_tree_t *t = sm->sm_pp_root;
     	int free_pct = sm->sm_space * 100 / sm->sm_size;
     
    @@ -561,7 +561,7 @@ dump_metaslab(metaslab_t *msp)
     {
     	vdev_t *vd = msp->ms_group->mg_vd;
     	spa_t *spa = vd->vdev_spa;
    -	space_map_t *sm = &msp->ms_map;
    +	space_map_t *sm = msp->ms_map;
     	space_map_obj_t *smo = &msp->ms_smo;
     	char freebuf[32];
     
    @@ -2160,11 +2160,11 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
     			for (int m = 0; m < vd->vdev_ms_count; m++) {
     				metaslab_t *msp = vd->vdev_ms[m];
     				mutex_enter(&msp->ms_lock);
    -				space_map_unload(&msp->ms_map);
    -				VERIFY(space_map_load(&msp->ms_map,
    +				space_map_unload(msp->ms_map);
    +				VERIFY(space_map_load(msp->ms_map,
     				    &zdb_space_map_ops, SM_ALLOC, &msp->ms_smo,
     				    spa->spa_meta_objset) == 0);
    -				msp->ms_map.sm_ppd = vd;
    +				msp->ms_map->sm_ppd = vd;
     				mutex_exit(&msp->ms_lock);
     			}
     		}
    @@ -2187,7 +2187,7 @@ zdb_leak_fini(spa_t *spa)
     			for (int m = 0; m < vd->vdev_ms_count; m++) {
     				metaslab_t *msp = vd->vdev_ms[m];
     				mutex_enter(&msp->ms_lock);
    -				space_map_unload(&msp->ms_map);
    +				space_map_unload(msp->ms_map);
     				mutex_exit(&msp->ms_lock);
     			}
     		}
    
    Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
    ==============================================================================
    --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c	Wed Feb 27 11:42:28 2013	(r247397)
    +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c	Wed Feb 27 14:45:23 2013	(r247398)
    @@ -48,6 +48,14 @@ uint64_t metaslab_aliquot = 512ULL << 10
     uint64_t metaslab_gang_bang = SPA_MAXBLOCKSIZE + 1;	/* force gang blocks */
     
     /*
    + * The in-core space map representation is more compact than its on-disk form.
    + * The zfs_condense_pct determines how much more compact the in-core
    + * space_map representation must be before we compact it on-disk.
    + * Values should be greater than or equal to 100.
    + */
    +int zfs_condense_pct = 200;
    +
    +/*
      * This value defines the number of allowed allocation failures per vdev.
      * If a device reaches this threshold in a given txg then we consider skipping
      * allocations on that device.
    @@ -215,9 +223,9 @@ metaslab_compare(const void *x1, const v
     	/*
     	 * If the weights are identical, use the offset to force uniqueness.
     	 */
    -	if (m1->ms_map.sm_start < m2->ms_map.sm_start)
    +	if (m1->ms_map->sm_start < m2->ms_map->sm_start)
     		return (-1);
    -	if (m1->ms_map.sm_start > m2->ms_map.sm_start)
    +	if (m1->ms_map->sm_start > m2->ms_map->sm_start)
     		return (1);
     
     	ASSERT3P(m1, ==, m2);
    @@ -732,14 +740,15 @@ metaslab_init(metaslab_group_t *mg, spac
     	 * addition of new space; and for debugging, it ensures that we'd
     	 * data fault on any attempt to use this metaslab before it's ready.
     	 */
    -	space_map_create(&msp->ms_map, start, size,
    +	msp->ms_map = kmem_zalloc(sizeof (space_map_t), KM_SLEEP);
    +	space_map_create(msp->ms_map, start, size,
     	    vd->vdev_ashift, &msp->ms_lock);
     
     	metaslab_group_add(mg, msp);
     
     	if (metaslab_debug && smo->smo_object != 0) {
     		mutex_enter(&msp->ms_lock);
    -		VERIFY(space_map_load(&msp->ms_map, mg->mg_class->mc_ops,
    +		VERIFY(space_map_load(msp->ms_map, mg->mg_class->mc_ops,
     		    SM_FREE, smo, spa_meta_objset(vd->vdev_spa)) == 0);
     		mutex_exit(&msp->ms_lock);
     	}
    @@ -767,22 +776,27 @@ metaslab_fini(metaslab_t *msp)
     	metaslab_group_t *mg = msp->ms_group;
     
     	vdev_space_update(mg->mg_vd,
    -	    -msp->ms_smo.smo_alloc, 0, -msp->ms_map.sm_size);
    +	    -msp->ms_smo.smo_alloc, 0, -msp->ms_map->sm_size);
     
     	metaslab_group_remove(mg, msp);
     
     	mutex_enter(&msp->ms_lock);
     
    -	space_map_unload(&msp->ms_map);
    -	space_map_destroy(&msp->ms_map);
    +	space_map_unload(msp->ms_map);
    +	space_map_destroy(msp->ms_map);
    +	kmem_free(msp->ms_map, sizeof (*msp->ms_map));
     
     	for (int t = 0; t < TXG_SIZE; t++) {
    -		space_map_destroy(&msp->ms_allocmap[t]);
    -		space_map_destroy(&msp->ms_freemap[t]);
    +		space_map_destroy(msp->ms_allocmap[t]);
    +		space_map_destroy(msp->ms_freemap[t]);
    +		kmem_free(msp->ms_allocmap[t], sizeof (*msp->ms_allocmap[t]));
    +		kmem_free(msp->ms_freemap[t], sizeof (*msp->ms_freemap[t]));
     	}
     
    -	for (int t = 0; t < TXG_DEFER_SIZE; t++)
    -		space_map_destroy(&msp->ms_defermap[t]);
    +	for (int t = 0; t < TXG_DEFER_SIZE; t++) {
    +		space_map_destroy(msp->ms_defermap[t]);
    +		kmem_free(msp->ms_defermap[t], sizeof (*msp->ms_defermap[t]));
    +	}
     
     	ASSERT0(msp->ms_deferspace);
     
    @@ -801,7 +815,7 @@ static uint64_t
     metaslab_weight(metaslab_t *msp)
     {
     	metaslab_group_t *mg = msp->ms_group;
    -	space_map_t *sm = &msp->ms_map;
    +	space_map_t *sm = msp->ms_map;
     	space_map_obj_t *smo = &msp->ms_smo;
     	vdev_t *vd = mg->mg_vd;
     	uint64_t weight, space;
    @@ -809,6 +823,16 @@ metaslab_weight(metaslab_t *msp)
     	ASSERT(MUTEX_HELD(&msp->ms_lock));
     
     	/*
    +	 * This vdev is in the process of being removed so there is nothing
    +	 * for us to do here.
    +	 */
    +	if (vd->vdev_removing) {
    +		ASSERT0(smo->smo_alloc);
    +		ASSERT0(vd->vdev_ms_shift);
    +		return (0);
    +	}
    +
    +	/*
     	 * The baseline weight is the metaslab's free space.
     	 */
     	space = sm->sm_size - smo->smo_alloc;
    @@ -861,7 +885,7 @@ metaslab_prefetch(metaslab_group_t *mg)
     	 * Prefetch the next potential metaslabs
     	 */
     	for (msp = avl_first(t), m = 0; msp; msp = AVL_NEXT(t, msp), m++) {
    -		space_map_t *sm = &msp->ms_map;
    +		space_map_t *sm = msp->ms_map;
     		space_map_obj_t *smo = &msp->ms_smo;
     
     		/* If we have reached our prefetch limit then we're done */
    @@ -882,7 +906,7 @@ static int
     metaslab_activate(metaslab_t *msp, uint64_t activation_weight)
     {
     	metaslab_group_t *mg = msp->ms_group;
    -	space_map_t *sm = &msp->ms_map;
    +	space_map_t *sm = msp->ms_map;
     	space_map_ops_t *sm_ops = msp->ms_group->mg_class->mc_ops;
     
     	ASSERT(MUTEX_HELD(&msp->ms_lock));
    @@ -899,7 +923,7 @@ metaslab_activate(metaslab_t *msp, uint6
     				return (error);
     			}
     			for (int t = 0; t < TXG_DEFER_SIZE; t++)
    -				space_map_walk(&msp->ms_defermap[t],
    +				space_map_walk(msp->ms_defermap[t],
     				    space_map_claim, sm);
     
     		}
    @@ -930,12 +954,158 @@ metaslab_passivate(metaslab_t *msp, uint
     	 * this metaslab again.  In that case, it had better be empty,
     	 * or we would be leaving space on the table.
     	 */
    -	ASSERT(size >= SPA_MINBLOCKSIZE || msp->ms_map.sm_space == 0);
    +	ASSERT(size >= SPA_MINBLOCKSIZE || msp->ms_map->sm_space == 0);
     	metaslab_group_sort(msp->ms_group, msp, MIN(msp->ms_weight, size));
     	ASSERT((msp->ms_weight & METASLAB_ACTIVE_MASK) == 0);
     }
     
     /*
    + * Determine if the in-core space map representation can be condensed on-disk.
    + * We would like to use the following criteria to make our decision:
    + *
    + * 1. The size of the space map object should not dramatically increase as a
    + * result of writing out our in-core free map.
    + *
    + * 2. The minimal on-disk space map representation is zfs_condense_pct/100
    + * times the size than the in-core representation (i.e. zfs_condense_pct = 110
    + * and in-core = 1MB, minimal = 1.1.MB).
    + *
    + * Checking the first condition is tricky since we don't want to walk
    + * the entire AVL tree calculating the estimated on-disk size. Instead we
    + * use the size-ordered AVL tree in the space map and calculate the
    + * size required for the largest segment in our in-core free map. If the
    + * size required to represent that segment on disk is larger than the space
    + * map object then we avoid condensing this map.
    + *
    + * To determine the second criterion we use a best-case estimate and assume
    + * each segment can be represented on-disk as a single 64-bit entry. We refer
    + * to this best-case estimate as the space map's minimal form.
    + */
    +static boolean_t
    +metaslab_should_condense(metaslab_t *msp)
    +{
    +	space_map_t *sm = msp->ms_map;
    +	space_map_obj_t *smo = &msp->ms_smo_syncing;
    +	space_seg_t *ss;
    +	uint64_t size, entries, segsz;
    +
    +	ASSERT(MUTEX_HELD(&msp->ms_lock));
    +	ASSERT(sm->sm_loaded);
    +
    +	/*
    +	 * Use the sm_pp_root AVL tree, which is ordered by size, to obtain
    +	 * the largest segment in the in-core free map. If the tree is
    +	 * empty then we should condense the map.
    +	 */
    +	ss = avl_last(sm->sm_pp_root);
    +	if (ss == NULL)
    +		return (B_TRUE);
    +
    +	/*
    +	 * Calculate the number of 64-bit entries this segment would
    +	 * require when written to disk. If this single segment would be
    +	 * larger on-disk than the entire current on-disk structure, then
    +	 * clearly condensing will increase the on-disk structure size.
    +	 */
    +	size = (ss->ss_end - ss->ss_start) >> sm->sm_shift;
    +	entries = size / (MIN(size, SM_RUN_MAX));
    +	segsz = entries * sizeof (uint64_t);
    +
    +	return (segsz <= smo->smo_objsize &&
    +	    smo->smo_objsize >= (zfs_condense_pct *
    +	    sizeof (uint64_t) * avl_numnodes(&sm->sm_root)) / 100);
    +}
    +
    +/*
    + * Condense the on-disk space map representation to its minimized form.
    + * The minimized form consists of a small number of allocations followed by
    + * the in-core free map.
    + */
    +static void
    +metaslab_condense(metaslab_t *msp, uint64_t txg, dmu_tx_t *tx)
    +{
    +	spa_t *spa = msp->ms_group->mg_vd->vdev_spa;
    +	space_map_t *freemap = msp->ms_freemap[txg & TXG_MASK];
    +	space_map_t condense_map;
    +	space_map_t *sm = msp->ms_map;
    +	objset_t *mos = spa_meta_objset(spa);
    +	space_map_obj_t *smo = &msp->ms_smo_syncing;
    +
    +	ASSERT(MUTEX_HELD(&msp->ms_lock));
    +	ASSERT3U(spa_sync_pass(spa), ==, 1);
    +	ASSERT(sm->sm_loaded);
    +
    +	spa_dbgmsg(spa, "condensing: txg %llu, msp[%llu] %p, "
    +	    "smo size %llu, segments %lu", txg,
    +	    (msp->ms_map->sm_start / msp->ms_map->sm_size), msp,
    +	    smo->smo_objsize, avl_numnodes(&sm->sm_root));
    +
    +	/*
    +	 * Create an map that is a 100% allocated map. We remove segments
    +	 * that have been freed in this txg, any deferred frees that exist,
    +	 * and any allocation in the future. Removing segments should be
    +	 * a relatively inexpensive operation since we expect these maps to
    +	 * a small number of nodes.
    +	 */
    +	space_map_create(&condense_map, sm->sm_start, sm->sm_size,
    +	    sm->sm_shift, sm->sm_lock);
    +	space_map_add(&condense_map, condense_map.sm_start,
    +	    condense_map.sm_size);
    +
    +	/*
    +	 * Remove what's been freed in this txg from the condense_map.
    +	 * Since we're in sync_pass 1, we know that all the frees from
    +	 * this txg are in the freemap.
    +	 */
    +	space_map_walk(freemap, space_map_remove, &condense_map);
    +
    +	for (int t = 0; t < TXG_DEFER_SIZE; t++)
    +		space_map_walk(msp->ms_defermap[t],
    +		    space_map_remove, &condense_map);
    +
    +	for (int t = 1; t < TXG_CONCURRENT_STATES; t++)
    +		space_map_walk(msp->ms_allocmap[(txg + t) & TXG_MASK],
    +		    space_map_remove, &condense_map);
    +
    +	/*
    +	 * We're about to drop the metaslab's lock thus allowing
    +	 * other consumers to change it's content. Set the
    +	 * space_map's sm_condensing flag to ensure that
    +	 * allocations on this metaslab do not occur while we're
    +	 * in the middle of committing it to disk. This is only critical
    +	 * for the ms_map as all other space_maps use per txg
    +	 * views of their content.
    +	 */
    +	sm->sm_condensing = B_TRUE;
    +
    +	mutex_exit(&msp->ms_lock);
    +	space_map_truncate(smo, mos, tx);
    +	mutex_enter(&msp->ms_lock);
    +
    +	/*
    +	 * While we would ideally like to create a space_map representation
    +	 * that consists only of allocation records, doing so can be
    +	 * prohibitively expensive because the in-core free map can be
    +	 * large, and therefore computationally expensive to subtract
    +	 * from the condense_map. Instead we sync out two maps, a cheap
    +	 * allocation only map followed by the in-core free map. While not
    +	 * optimal, this is typically close to optimal, and much cheaper to
    +	 * compute.
    +	 */
    +	space_map_sync(&condense_map, SM_ALLOC, smo, mos, tx);
    +	space_map_vacate(&condense_map, NULL, NULL);
    +	space_map_destroy(&condense_map);
    +
    +	space_map_sync(sm, SM_FREE, smo, mos, tx);
    +	sm->sm_condensing = B_FALSE;
    +
    +	spa_dbgmsg(spa, "condensed: txg %llu, msp[%llu] %p, "
    +	    "smo size %llu", txg,
    +	    (msp->ms_map->sm_start / msp->ms_map->sm_size), msp,
    +	    smo->smo_objsize);
    +}
    +
    +/*
      * Write a metaslab to disk in the context of the specified transaction group.
      */
     void
    @@ -944,17 +1114,29 @@ metaslab_sync(metaslab_t *msp, uint64_t 
     	vdev_t *vd = msp->ms_group->mg_vd;
     	spa_t *spa = vd->vdev_spa;
     	objset_t *mos = spa_meta_objset(spa);
    -	space_map_t *allocmap = &msp->ms_allocmap[txg & TXG_MASK];
    -	space_map_t *freemap = &msp->ms_freemap[txg & TXG_MASK];
    -	space_map_t *freed_map = &msp->ms_freemap[TXG_CLEAN(txg) & TXG_MASK];
    -	space_map_t *sm = &msp->ms_map;
    +	space_map_t *allocmap = msp->ms_allocmap[txg & TXG_MASK];
    +	space_map_t **freemap = &msp->ms_freemap[txg & TXG_MASK];
    +	space_map_t **freed_map = &msp->ms_freemap[TXG_CLEAN(txg) & TXG_MASK];
    +	space_map_t *sm = msp->ms_map;
     	space_map_obj_t *smo = &msp->ms_smo_syncing;
     	dmu_buf_t *db;
     	dmu_tx_t *tx;
     
     	ASSERT(!vd->vdev_ishole);
     
    -	if (allocmap->sm_space == 0 && freemap->sm_space == 0)
    +	/*
    +	 * This metaslab has just been added so there's no work to do now.
    +	 */
    +	if (*freemap == NULL) {
    +		ASSERT3P(allocmap, ==, NULL);
    +		return;
    +	}
    +
    +	ASSERT3P(allocmap, !=, NULL);
    +	ASSERT3P(*freemap, !=, NULL);
    +	ASSERT3P(*freed_map, !=, NULL);
    +
    +	if (allocmap->sm_space == 0 && (*freemap)->sm_space == 0)
     		return;
     
     	/*
    @@ -982,49 +1164,36 @@ metaslab_sync(metaslab_t *msp, uint64_t 
     
     	mutex_enter(&msp->ms_lock);
     
    -	space_map_walk(freemap, space_map_add, freed_map);
    -
    -	if (sm->sm_loaded && spa_sync_pass(spa) == 1 && smo->smo_objsize >=
    -	    2 * sizeof (uint64_t) * avl_numnodes(&sm->sm_root)) {
    -		/*
    -		 * The in-core space map representation is twice as compact
    -		 * as the on-disk one, so it's time to condense the latter
    -		 * by generating a pure allocmap from first principles.
    -		 *
    -		 * This metaslab is 100% allocated,
    -		 * minus the content of the in-core map (sm),
    -		 * minus what's been freed this txg (freed_map),
    -		 * minus deferred frees (ms_defermap[]),
    -		 * minus allocations from txgs in the future
    -		 * (because they haven't been committed yet).
    -		 */
    -		space_map_vacate(allocmap, NULL, NULL);
    -		space_map_vacate(freemap, NULL, NULL);
    -
    -		space_map_add(allocmap, allocmap->sm_start, allocmap->sm_size);
    -
    -		space_map_walk(sm, space_map_remove, allocmap);
    -		space_map_walk(freed_map, space_map_remove, allocmap);
    -
    -		for (int t = 0; t < TXG_DEFER_SIZE; t++)
    -			space_map_walk(&msp->ms_defermap[t],
    -			    space_map_remove, allocmap);
    +	if (sm->sm_loaded && spa_sync_pass(spa) == 1 &&
    +	    metaslab_should_condense(msp)) {
    +		metaslab_condense(msp, txg, tx);
    +	} else {
    +		space_map_sync(allocmap, SM_ALLOC, smo, mos, tx);
    +		space_map_sync(*freemap, SM_FREE, smo, mos, tx);
    +	}
     
    -		for (int t = 1; t < TXG_CONCURRENT_STATES; t++)
    -			space_map_walk(&msp->ms_allocmap[(txg + t) & TXG_MASK],
    -			    space_map_remove, allocmap);
    +	space_map_vacate(allocmap, NULL, NULL);
     
    -		mutex_exit(&msp->ms_lock);
    -		space_map_truncate(smo, mos, tx);
    -		mutex_enter(&msp->ms_lock);
    +	/*
    +	 * For sync pass 1, we avoid walking the entire space map and
    +	 * instead will just swap the pointers for freemap and
    +	 * freed_map. We can safely do this since the freed_map is
    +	 * guaranteed to be empty on the initial pass.
    +	 */
    +	if (spa_sync_pass(spa) == 1) {
    +		ASSERT0((*freed_map)->sm_space);
    +		ASSERT0(avl_numnodes(&(*freed_map)->sm_root));
    +		space_map_swap(freemap, freed_map);
    +	} else {
    +		space_map_vacate(*freemap, space_map_add, *freed_map);
     	}
     
    -	space_map_sync(allocmap, SM_ALLOC, smo, mos, tx);
    -	space_map_sync(freemap, SM_FREE, smo, mos, tx);
    +	ASSERT0(msp->ms_allocmap[txg & TXG_MASK]->sm_space);
    +	ASSERT0(msp->ms_freemap[txg & TXG_MASK]->sm_space);
     
     	mutex_exit(&msp->ms_lock);
     
    -	VERIFY(0 == dmu_bonus_hold(mos, smo->smo_object, FTAG, &db));
    +	VERIFY0(dmu_bonus_hold(mos, smo->smo_object, FTAG, &db));
     	dmu_buf_will_dirty(db, tx);
     	ASSERT3U(db->db_size, >=, sizeof (*smo));
     	bcopy(smo, db->db_data, sizeof (*smo));
    @@ -1042,9 +1211,9 @@ metaslab_sync_done(metaslab_t *msp, uint
     {
     	space_map_obj_t *smo = &msp->ms_smo;
     	space_map_obj_t *smosync = &msp->ms_smo_syncing;
    -	space_map_t *sm = &msp->ms_map;
    -	space_map_t *freed_map = &msp->ms_freemap[TXG_CLEAN(txg) & TXG_MASK];
    -	space_map_t *defer_map = &msp->ms_defermap[txg % TXG_DEFER_SIZE];
    +	space_map_t *sm = msp->ms_map;
    +	space_map_t **freed_map = &msp->ms_freemap[TXG_CLEAN(txg) & TXG_MASK];
    +	space_map_t **defer_map = &msp->ms_defermap[txg % TXG_DEFER_SIZE];
     	metaslab_group_t *mg = msp->ms_group;
     	vdev_t *vd = mg->mg_vd;
     	int64_t alloc_delta, defer_delta;
    @@ -1055,40 +1224,57 @@ metaslab_sync_done(metaslab_t *msp, uint
     
     	/*
     	 * If this metaslab is just becoming available, initialize its
    -	 * allocmaps and freemaps and add its capacity to the vdev.
    +	 * allocmaps, freemaps, and defermap and add its capacity to the vdev.
     	 */
    -	if (freed_map->sm_size == 0) {
    +	if (*freed_map == NULL) {
    +		ASSERT(*defer_map == NULL);
     		for (int t = 0; t < TXG_SIZE; t++) {
    -			space_map_create(&msp->ms_allocmap[t], sm->sm_start,
    +			msp->ms_allocmap[t] = kmem_zalloc(sizeof (space_map_t),
    +			    KM_SLEEP);
    +			space_map_create(msp->ms_allocmap[t], sm->sm_start,
     			    sm->sm_size, sm->sm_shift, sm->sm_lock);
    -			space_map_create(&msp->ms_freemap[t], sm->sm_start,
    +			msp->ms_freemap[t] = kmem_zalloc(sizeof (space_map_t),
    +			    KM_SLEEP);
    +			space_map_create(msp->ms_freemap[t], sm->sm_start,
     			    sm->sm_size, sm->sm_shift, sm->sm_lock);
     		}
     
    -		for (int t = 0; t < TXG_DEFER_SIZE; t++)
    -			space_map_create(&msp->ms_defermap[t], sm->sm_start,
    +		for (int t = 0; t < TXG_DEFER_SIZE; t++) {
    +			msp->ms_defermap[t] = kmem_zalloc(sizeof (space_map_t),
    +			    KM_SLEEP);
    +			space_map_create(msp->ms_defermap[t], sm->sm_start,
     			    sm->sm_size, sm->sm_shift, sm->sm_lock);
    +		}
    +
    +		freed_map = &msp->ms_freemap[TXG_CLEAN(txg) & TXG_MASK];
    +		defer_map = &msp->ms_defermap[txg % TXG_DEFER_SIZE];
     
     		vdev_space_update(vd, 0, 0, sm->sm_size);
     	}
     
     	alloc_delta = smosync->smo_alloc - smo->smo_alloc;
    -	defer_delta = freed_map->sm_space - defer_map->sm_space;
    +	defer_delta = (*freed_map)->sm_space - (*defer_map)->sm_space;
     
     	vdev_space_update(vd, alloc_delta + defer_delta, defer_delta, 0);
     
    -	ASSERT(msp->ms_allocmap[txg & TXG_MASK].sm_space == 0);
    -	ASSERT(msp->ms_freemap[txg & TXG_MASK].sm_space == 0);
    +	ASSERT(msp->ms_allocmap[txg & TXG_MASK]->sm_space == 0);
    +	ASSERT(msp->ms_freemap[txg & TXG_MASK]->sm_space == 0);
     
     	/*
     	 * If there's a space_map_load() in progress, wait for it to complete
     	 * so that we have a consistent view of the in-core space map.
    -	 * Then, add defer_map (oldest deferred frees) to this map and
    -	 * transfer freed_map (this txg's frees) to defer_map.
     	 */
     	space_map_load_wait(sm);
    -	space_map_vacate(defer_map, sm->sm_loaded ? space_map_free : NULL, sm);
    -	space_map_vacate(freed_map, space_map_add, defer_map);
    +
    +	/*
    +	 * Move the frees from the defer_map to this map (if it's loaded).
    +	 * Swap the freed_map and the defer_map -- this is safe to do
    +	 * because we've just emptied out the defer_map.
    +	 */
    +	space_map_vacate(*defer_map, sm->sm_loaded ? space_map_free : NULL, sm);
    +	ASSERT0((*defer_map)->sm_space);
    +	ASSERT0(avl_numnodes(&(*defer_map)->sm_root));
    +	space_map_swap(freed_map, defer_map);
     
     	*smo = *smosync;
     
    @@ -1112,7 +1298,7 @@ metaslab_sync_done(metaslab_t *msp, uint
     		int evictable = 1;
     
     		for (int t = 1; t < TXG_CONCURRENT_STATES; t++)
    -			if (msp->ms_allocmap[(txg + t) & TXG_MASK].sm_space)
    +			if (msp->ms_allocmap[(txg + t) & TXG_MASK]->sm_space)
     				evictable = 0;
     
     		if (evictable && !metaslab_debug)
    @@ -1137,7 +1323,7 @@ metaslab_sync_reassess(metaslab_group_t 
     	for (int m = 0; m < vd->vdev_ms_count; m++) {
     		metaslab_t *msp = vd->vdev_ms[m];
     
    -		if (msp->ms_map.sm_start > mg->mg_bonus_area)
    +		if (msp->ms_map->sm_start > mg->mg_bonus_area)
     			break;
     
     		mutex_enter(&msp->ms_lock);
    @@ -1158,7 +1344,7 @@ metaslab_distance(metaslab_t *msp, dva_t
     {
     	uint64_t ms_shift = msp->ms_group->mg_vd->vdev_ms_shift;
     	uint64_t offset = DVA_GET_OFFSET(dva) >> ms_shift;
    -	uint64_t start = msp->ms_map.sm_start >> ms_shift;
    +	uint64_t start = msp->ms_map->sm_start >> ms_shift;
     
     	if (msp->ms_group->mg_vd->vdev_id != DVA_GET_VDEV(dva))
     		return (1ULL << 63);
    @@ -1206,6 +1392,13 @@ metaslab_group_alloc(metaslab_group_t *m
     				mutex_exit(&mg->mg_lock);
     				return (-1ULL);
     			}
    +
    +			/*
    +			 * If the selected metaslab is condensing, skip it.
    +			 */
    +			if (msp->ms_map->sm_condensing)
    +				continue;
    +
     			was_active = msp->ms_weight & METASLAB_ACTIVE_MASK;
     			if (activation_weight == METASLAB_WEIGHT_PRIMARY)
     				break;
    @@ -1271,20 +1464,30 @@ metaslab_group_alloc(metaslab_group_t *m
     			continue;
     		}
     
    -		if ((offset = space_map_alloc(&msp->ms_map, asize)) != -1ULL)
    +		/*
    +		 * If this metaslab is currently condensing then pick again as
    +		 * we can't manipulate this metaslab until it's committed
    +		 * to disk.
    +		 */
    +		if (msp->ms_map->sm_condensing) {
    +			mutex_exit(&msp->ms_lock);
    +			continue;
    +		}
    +
    +		if ((offset = space_map_alloc(msp->ms_map, asize)) != -1ULL)
     			break;
     
     		atomic_inc_64(&mg->mg_alloc_failures);
     
    -		metaslab_passivate(msp, space_map_maxsize(&msp->ms_map));
    +		metaslab_passivate(msp, space_map_maxsize(msp->ms_map));
     
     		mutex_exit(&msp->ms_lock);
     	}
     
    -	if (msp->ms_allocmap[txg & TXG_MASK].sm_space == 0)
    +	if (msp->ms_allocmap[txg & TXG_MASK]->sm_space == 0)
     		vdev_dirty(mg->mg_vd, VDD_METASLAB, msp, txg);
     
    -	space_map_add(&msp->ms_allocmap[txg & TXG_MASK], offset, asize);
    +	space_map_add(msp->ms_allocmap[txg & TXG_MASK], offset, asize);
     
     	mutex_exit(&msp->ms_lock);
     
    @@ -1516,13 +1719,13 @@ metaslab_free_dva(spa_t *spa, const dva_
     	mutex_enter(&msp->ms_lock);
     
     	if (now) {
    -		space_map_remove(&msp->ms_allocmap[txg & TXG_MASK],
    +		space_map_remove(msp->ms_allocmap[txg & TXG_MASK],
     		    offset, size);
    -		space_map_free(&msp->ms_map, offset, size);
    +		space_map_free(msp->ms_map, offset, size);
     	} else {
    -		if (msp->ms_freemap[txg & TXG_MASK].sm_space == 0)
    +		if (msp->ms_freemap[txg & TXG_MASK]->sm_space == 0)
     			vdev_dirty(vd, VDD_METASLAB, msp, txg);
    -		space_map_add(&msp->ms_freemap[txg & TXG_MASK], offset, size);
    +		space_map_add(msp->ms_freemap[txg & TXG_MASK], offset, size);
     	}
     
     	mutex_exit(&msp->ms_lock);
    @@ -1557,10 +1760,10 @@ metaslab_claim_dva(spa_t *spa, const dva
     
     	mutex_enter(&msp->ms_lock);
     
    -	if ((txg != 0 && spa_writeable(spa)) || !msp->ms_map.sm_loaded)
    +	if ((txg != 0 && spa_writeable(spa)) || !msp->ms_map->sm_loaded)
     		error = metaslab_activate(msp, METASLAB_WEIGHT_SECONDARY);
     
    -	if (error == 0 && !space_map_contains(&msp->ms_map, offset, size))
    +	if (error == 0 && !space_map_contains(msp->ms_map, offset, size))
     		error = ENOENT;
     
     	if (error || txg == 0) {	/* txg == 0 indicates dry run */
    @@ -1568,12 +1771,12 @@ metaslab_claim_dva(spa_t *spa, const dva
     		return (error);
     	}
     
    -	space_map_claim(&msp->ms_map, offset, size);
    +	space_map_claim(msp->ms_map, offset, size);
     
     	if (spa_writeable(spa)) {	/* don't dirty if we're zdb(1M) */
    -		if (msp->ms_allocmap[txg & TXG_MASK].sm_space == 0)
    +		if (msp->ms_allocmap[txg & TXG_MASK]->sm_space == 0)
     			vdev_dirty(vd, VDD_METASLAB, msp, txg);
    -		space_map_add(&msp->ms_allocmap[txg & TXG_MASK], offset, size);
    +		space_map_add(msp->ms_allocmap[txg & TXG_MASK], offset, size);
     	}
     
     	mutex_exit(&msp->ms_lock);
    
    Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c
    ==============================================================================
    --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c	Wed Feb 27 11:42:28 2013	(r247397)
    +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c	Wed Feb 27 14:45:23 2013	(r247398)
    @@ -114,6 +114,7 @@ space_map_add(space_map_t *sm, uint64_t 
     	int merge_before, merge_after;
     
     	ASSERT(MUTEX_HELD(sm->sm_lock));
    +	VERIFY(!sm->sm_condensing);
     	VERIFY(size != 0);
     	VERIFY3U(start, >=, sm->sm_start);
     	VERIFY3U(end, <=, sm->sm_start + sm->sm_size);
    @@ -198,6 +199,7 @@ space_map_remove(space_map_t *sm, uint64
     	int left_over, right_over;
     
     	ASSERT(MUTEX_HELD(sm->sm_lock));
    +	VERIFY(!sm->sm_condensing);
     	VERIFY(size != 0);
     	VERIFY(P2PHASE(start, 1ULL << sm->sm_shift) == 0);
     	VERIFY(P2PHASE(size, 1ULL << sm->sm_shift) == 0);
    @@ -267,6 +269,20 @@ space_map_contains(space_map_t *sm, uint
     }
     
     void
    +space_map_swap(space_map_t **msrc, space_map_t **mdst)
    +{
    +	space_map_t *sm;
    +
    +	ASSERT(MUTEX_HELD((*msrc)->sm_lock));
    +	ASSERT0((*mdst)->sm_space);
    +	ASSERT0(avl_numnodes(&(*mdst)->sm_root));
    +
    +	sm = *msrc;
    +	*msrc = *mdst;
    +	*mdst = sm;
    +}
    +
    +void
     space_map_vacate(space_map_t *sm, space_map_func_t *func, space_map_t *mdest)
     {
     	space_seg_t *ss;
    @@ -447,9 +463,9 @@ space_map_sync(space_map_t *sm, uint8_t 
     	space_map_obj_t *smo, objset_t *os, dmu_tx_t *tx)
     {
     	spa_t *spa = dmu_objset_spa(os);
    -	void *cookie = NULL;
    +	avl_tree_t *t = &sm->sm_root;
     	space_seg_t *ss;
    -	uint64_t bufsize, start, size, run_len, delta, sm_space;
    +	uint64_t bufsize, start, size, run_len, total, sm_space, nodes;
     	uint64_t *entry, *entry_map, *entry_map_end;
     
     	ASSERT(MUTEX_HELD(sm->sm_lock));
    @@ -478,13 +494,14 @@ space_map_sync(space_map_t *sm, uint8_t 
     	    SM_DEBUG_SYNCPASS_ENCODE(spa_sync_pass(spa)) |
     	    SM_DEBUG_TXG_ENCODE(dmu_tx_get_txg(tx));
     
    -	delta = 0;
    +	total = 0;
    +	nodes = avl_numnodes(&sm->sm_root);
     	sm_space = sm->sm_space;
    -	while ((ss = avl_destroy_nodes(&sm->sm_root, &cookie)) != NULL) {
    +	for (ss = avl_first(t); ss != NULL; ss = AVL_NEXT(t, ss)) {
     		size = ss->ss_end - ss->ss_start;
     		start = (ss->ss_start - sm->sm_start) >> sm->sm_shift;
     
    -		delta += size;
    +		total += size;
     		size >>= sm->sm_shift;
     
     		while (size) {
    @@ -506,7 +523,6 @@ space_map_sync(space_map_t *sm, uint8_t 
     			start += run_len;
     			size -= run_len;
     		}
    -		kmem_cache_free(space_seg_cache, ss);
     	}
     
     	if (entry != entry_map) {
    @@ -522,12 +538,11 @@ space_map_sync(space_map_t *sm, uint8_t 
     	 * Ensure that the space_map's accounting wasn't changed
     	 * while we were in the middle of writing it out.
     	 */
    +	VERIFY3U(nodes, ==, avl_numnodes(&sm->sm_root));
     	VERIFY3U(sm->sm_space, ==, sm_space);
    +	VERIFY3U(sm->sm_space, ==, total);
     
     	zio_buf_free(entry_map, bufsize);
    -
    -	sm->sm_space -= delta;
    -	VERIFY0(sm->sm_space);
     }
     
     void
    
    Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h
    ==============================================================================
    --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h	Wed Feb 27 11:42:28 2013	(r247397)
    +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h	Wed Feb 27 14:45:23 2013	(r247398)
    @@ -66,20 +66,38 @@ struct metaslab_group {
     };
     
     /*
    - * Each metaslab's free space is tracked in space map object in the MOS,
    - * which is only updated in syncing context.  Each time we sync a txg,
    + * Each metaslab maintains an in-core free map (ms_map) that contains the
    + * current list of free segments. As blocks are allocated, the allocated
    + * segment is removed from the ms_map and added to a per txg allocation map.
    + * As blocks are freed, they are added to the per txg free map. These per
    + * txg maps allow us to process all allocations and frees in syncing context
    + * where it is safe to update the on-disk space maps.
    + *
    + * Each metaslab's free space is tracked in a space map object in the MOS,
    + * which is only updated in syncing context. Each time we sync a txg,
      * we append the allocs and frees from that txg to the space map object.
      * When the txg is done syncing, metaslab_sync_done() updates ms_smo
    - * to ms_smo_syncing.  Everything in ms_smo is always safe to allocate.
    + * to ms_smo_syncing. Everything in ms_smo is always safe to allocate.
    + *
    + * To load the in-core free map we read the space map object from disk.
    + * This object contains a series of alloc and free records that are
    + * combined to make up the list of all free segments in this metaslab. These
    + * segments are represented in-core by the ms_map and are stored in an
    + * AVL tree.
    + *
    + * As the space map objects grows (as a result of the appends) it will
    + * eventually become space-inefficient. When the space map object is
    + * zfs_condense_pct/100 times the size of the minimal on-disk representation,
    + * we rewrite it in its minimized form.
      */
     struct metaslab {
     	kmutex_t	ms_lock;	/* metaslab lock		*/
     	space_map_obj_t	ms_smo;		/* synced space map object	*/
     	space_map_obj_t	ms_smo_syncing;	/* syncing space map object	*/
    -	space_map_t	ms_allocmap[TXG_SIZE];  /* allocated this txg	*/
    -	space_map_t	ms_freemap[TXG_SIZE];	/* freed this txg	*/
    -	space_map_t	ms_defermap[TXG_DEFER_SIZE]; /* deferred frees	*/
    -	space_map_t	ms_map;		/* in-core free space map	*/
    +	space_map_t	*ms_allocmap[TXG_SIZE];	/* allocated this txg	*/
    +	space_map_t	*ms_freemap[TXG_SIZE];	/* freed this txg	*/
    +	space_map_t	*ms_defermap[TXG_DEFER_SIZE];	/* deferred frees */
    +	space_map_t	*ms_map;	/* in-core free space map	*/
     	int64_t		ms_deferspace;	/* sum of ms_defermap[] space	*/
     	uint64_t	ms_weight;	/* weight vs. others in group	*/
     	metaslab_group_t *ms_group;	/* metaslab group		*/
    
    Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h
    ==============================================================================
    --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h	Wed Feb 27 11:42:28 2013	(r247397)
    +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h	Wed Feb 27 14:45:23 2013	(r247398)
    @@ -40,17 +40,17 @@ extern "C" {
     typedef struct space_map_ops space_map_ops_t;
     
     typedef struct space_map {
    -	avl_tree_t	sm_root;	/* AVL tree of map segments */
    +	avl_tree_t	sm_root;	/* offset-ordered segment AVL tree */
     	uint64_t	sm_space;	/* sum of all segments in the map */
     	uint64_t	sm_start;	/* start of map */
     	uint64_t	sm_size;	/* size of map */
     	uint8_t		sm_shift;	/* unit shift */
    -	uint8_t		sm_pad[3];	/* unused */
     	uint8_t		sm_loaded;	/* map loaded? */
     	uint8_t		sm_loading;	/* map loading? */
    +	uint8_t		sm_condensing;	/* map condensing? */
     	kcondvar_t	sm_load_cv;	/* map load completion */
     	space_map_ops_t	*sm_ops;	/* space map block picker ops vector */
    -	avl_tree_t	*sm_pp_root;	/* picker-private AVL tree */
    +	avl_tree_t	*sm_pp_root;	/* size-ordered, picker-private tree */
     	void		*sm_ppd;	/* picker-private data */
     	kmutex_t	*sm_lock;	/* pointer to lock that protects map */
     } space_map_t;
    @@ -149,6 +149,7 @@ extern void space_map_add(space_map_t *s
     extern void space_map_remove(space_map_t *sm, uint64_t start, uint64_t size);
     extern boolean_t space_map_contains(space_map_t *sm,
         uint64_t start, uint64_t size);
    +extern void space_map_swap(space_map_t **msrc, space_map_t **mdest);
     extern void space_map_vacate(space_map_t *sm,
         space_map_func_t *func, space_map_t *mdest);
     extern void space_map_walk(space_map_t *sm,
    
    Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
    ==============================================================================
    --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c	Wed Feb 27 11:42:28 2013	(r247397)
    +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c	Wed Feb 27 14:45:23 2013	(r247398)
    @@ -1847,6 +1847,7 @@ vdev_dtl_sync(vdev_t *vd, uint64_t txg)
     
     	space_map_truncate(smo, mos, tx);
     	space_map_sync(&smsync, SM_ALLOC, smo, mos, tx);
    +	space_map_vacate(&smsync, NULL, NULL);
     
     	space_map_destroy(&smsync);
     
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 17:12:46 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id C12B39AF;
     Wed, 27 Feb 2013 17:12:46 +0000 (UTC) (envelope-from jhb@freebsd.org)
    Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net
     [IPv6:2001:470:1f10:75::2])
     by mx1.freebsd.org (Postfix) with ESMTP id 9DD12F75;
     Wed, 27 Feb 2013 17:12:46 +0000 (UTC)
    Received: from jhbbsd.localnet (unknown [209.249.190.124])
     by bigwig.baldwin.cx (Postfix) with ESMTPSA id 1E7F8B91E;
     Wed, 27 Feb 2013 12:12:46 -0500 (EST)
    From: John Baldwin 
    To: Nick Hibma 
    Subject: Re: svn commit: r247359 - head/sbin/reboot
    Date: Wed, 27 Feb 2013 11:38:24 -0500
    User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; )
    References: <201302262318.r1QNIauL003863@svn.freebsd.org>
    In-Reply-To: <201302262318.r1QNIauL003863@svn.freebsd.org>
    MIME-Version: 1.0
    Content-Type: Text/Plain;
      charset="utf-8"
    Content-Transfer-Encoding: 7bit
    Message-Id: <201302271138.24452.jhb@freebsd.org>
    X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7
     (bigwig.baldwin.cx); Wed, 27 Feb 2013 12:12:46 -0500 (EST)
    Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
     src-committers@freebsd.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 17:12:46 -0000
    
    On Tuesday, February 26, 2013 6:18:36 pm Nick Hibma wrote:
    > Author: n_hibma
    > Date: Tue Feb 26 23:18:35 2013
    > New Revision: 247359
    > URL: http://svnweb.freebsd.org/changeset/base/247359
    > 
    > Log:
    >   Clarify that overriding the -h/-D flags through flags in device.hints
    >   only works for sio(4) but not for uart(4) which no longer has this flag.
    
    You should probably just remove the flag entirely.  sio(4) doesn't build on 
    8.x and later.
    
    -- 
    John Baldwin
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 18:12:05 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 86A1CCB3;
     Wed, 27 Feb 2013 18:12:05 +0000 (UTC) (envelope-from pho@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 75365351;
     Wed, 27 Feb 2013 18:12:05 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1RIC46Q051130;
     Wed, 27 Feb 2013 18:12:04 GMT (envelope-from pho@svn.freebsd.org)
    Received: (from pho@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1RIC4HZ051129;
     Wed, 27 Feb 2013 18:12:04 GMT (envelope-from pho@svn.freebsd.org)
    Message-Id: <201302271812.r1RIC4HZ051129@svn.freebsd.org>
    From: Peter Holm 
    Date: Wed, 27 Feb 2013 18:12:04 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247399 - head/sbin/tunefs
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 18:12:05 -0000
    
    Author: pho
    Date: Wed Feb 27 18:12:04 2013
    New Revision: 247399
    URL: http://svnweb.freebsd.org/changeset/base/247399
    
    Log:
      The .journal file needs to reside on the ROOTINO which must not extend
      beyond direct blocks. A typo caused this check to fail.
    
    Modified:
      head/sbin/tunefs/tunefs.c
    
    Modified: head/sbin/tunefs/tunefs.c
    ==============================================================================
    --- head/sbin/tunefs/tunefs.c	Wed Feb 27 14:45:23 2013	(r247398)
    +++ head/sbin/tunefs/tunefs.c	Wed Feb 27 18:12:04 2013	(r247399)
    @@ -671,7 +671,7 @@ journal_findfile(void)
     				return (ino);
     		}
     	} else {
    -		if ((off_t)dp1->di_size >= lblktosize(&sblock, NDADDR)) {
    +		if ((off_t)dp2->di_size >= lblktosize(&sblock, NDADDR)) {
     			warnx("ROOTINO extends beyond direct blocks.");
     			return (-1);
     		}
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 18:12:15 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 4960BDFC;
     Wed, 27 Feb 2013 18:12:15 +0000 (UTC)
     (envelope-from attilio@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 3B5A3353;
     Wed, 27 Feb 2013 18:12:15 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1RICF1j051199;
     Wed, 27 Feb 2013 18:12:15 GMT (envelope-from attilio@svn.freebsd.org)
    Received: (from attilio@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1RICD1s051187;
     Wed, 27 Feb 2013 18:12:13 GMT (envelope-from attilio@svn.freebsd.org)
    Message-Id: <201302271812.r1RICD1s051187@svn.freebsd.org>
    From: Attilio Rao 
    Date: Wed, 27 Feb 2013 18:12:13 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247400 - in head/sys: amd64/amd64 i386/i386 i386/xen
     powerpc/aim powerpc/booke sparc64/sparc64 vm
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 18:12:15 -0000
    
    Author: attilio
    Date: Wed Feb 27 18:12:13 2013
    New Revision: 247400
    URL: http://svnweb.freebsd.org/changeset/base/247400
    
    Log:
      Merge from vmobj-rwlock:
      VM_OBJECT_LOCKED() macro is only used to implement a custom version
      of lock assertions right now (which likely spread out thanks to
      copy and paste).
      Remove it and implement actual assertions.
      
      Sponsored by:	EMC / Isilon storage division
      Reviewed by:	alc
      Tested by:	pho
    
    Modified:
      head/sys/amd64/amd64/pmap.c
      head/sys/i386/i386/pmap.c
      head/sys/i386/xen/pmap.c
      head/sys/powerpc/aim/mmu_oea.c
      head/sys/powerpc/aim/mmu_oea64.c
      head/sys/powerpc/booke/pmap.c
      head/sys/sparc64/sparc64/pmap.c
      head/sys/vm/vm_object.h
    
    Modified: head/sys/amd64/amd64/pmap.c
    ==============================================================================
    --- head/sys/amd64/amd64/pmap.c	Wed Feb 27 18:12:04 2013	(r247399)
    +++ head/sys/amd64/amd64/pmap.c	Wed Feb 27 18:12:13 2013	(r247400)
    @@ -3492,9 +3492,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
     	KASSERT((m->oflags & VPO_UNMANAGED) != 0 || va < kmi.clean_sva ||
     	    va >= kmi.clean_eva,
     	    ("pmap_enter: managed mapping within the clean submap"));
    -	KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0 ||
    -	    VM_OBJECT_LOCKED(m->object),
    -	    ("pmap_enter: page %p is not busy", m));
    +	if ((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == 0)
    +		VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
     	pa = VM_PAGE_TO_PHYS(m);
     	newpte = (pt_entry_t)(pa | PG_A | PG_V);
     	if ((access & VM_PROT_WRITE) != 0)
    
    Modified: head/sys/i386/i386/pmap.c
    ==============================================================================
    --- head/sys/i386/i386/pmap.c	Wed Feb 27 18:12:04 2013	(r247399)
    +++ head/sys/i386/i386/pmap.c	Wed Feb 27 18:12:13 2013	(r247400)
    @@ -3456,9 +3456,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
     	KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS,
     	    ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%x)",
     	    va));
    -	KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0 ||
    -	    VM_OBJECT_LOCKED(m->object),
    -	    ("pmap_enter: page %p is not busy", m));
    +	if ((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == 0)
    +		VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
     
     	mpte = NULL;
     
    
    Modified: head/sys/i386/xen/pmap.c
    ==============================================================================
    --- head/sys/i386/xen/pmap.c	Wed Feb 27 18:12:04 2013	(r247399)
    +++ head/sys/i386/xen/pmap.c	Wed Feb 27 18:12:13 2013	(r247400)
    @@ -2666,9 +2666,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
     	KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS,
     	    ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%x)",
     	    va));
    -	KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0 ||
    -	    VM_OBJECT_LOCKED(m->object),
    -	    ("pmap_enter: page %p is not busy", m));
    +	if ((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == 0)
    +		VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
     
     	mpte = NULL;
     
    
    Modified: head/sys/powerpc/aim/mmu_oea.c
    ==============================================================================
    --- head/sys/powerpc/aim/mmu_oea.c	Wed Feb 27 18:12:04 2013	(r247399)
    +++ head/sys/powerpc/aim/mmu_oea.c	Wed Feb 27 18:12:13 2013	(r247400)
    @@ -1121,9 +1121,8 @@ moea_enter_locked(pmap_t pmap, vm_offset
     	if (pmap_bootstrapped)
     		rw_assert(&pvh_global_lock, RA_WLOCKED);
     	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
    -	KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0 ||
    -	    VM_OBJECT_LOCKED(m->object),
    -	    ("moea_enter_locked: page %p is not busy", m));
    +	if ((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == 0)
    +		VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
     
     	/* XXX change the pvo head for fake pages */
     	if ((m->oflags & VPO_UNMANAGED) != 0) {
    
    Modified: head/sys/powerpc/aim/mmu_oea64.c
    ==============================================================================
    --- head/sys/powerpc/aim/mmu_oea64.c	Wed Feb 27 18:12:04 2013	(r247399)
    +++ head/sys/powerpc/aim/mmu_oea64.c	Wed Feb 27 18:12:13 2013	(r247400)
    @@ -1183,9 +1183,8 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_
     		pvo_flags = PVO_MANAGED;
     	}
     
    -	KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0 ||
    -	    VM_OBJECT_LOCKED(m->object),
    -	    ("moea64_enter: page %p is not busy", m));
    +	if ((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == 0)
    +		VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
     
     	/* XXX change the pvo head for fake pages */
     	if ((m->oflags & VPO_UNMANAGED) != 0) {
    
    Modified: head/sys/powerpc/booke/pmap.c
    ==============================================================================
    --- head/sys/powerpc/booke/pmap.c	Wed Feb 27 18:12:04 2013	(r247399)
    +++ head/sys/powerpc/booke/pmap.c	Wed Feb 27 18:12:13 2013	(r247400)
    @@ -1560,9 +1560,8 @@ mmu_booke_enter_locked(mmu_t mmu, pmap_t
     		KASSERT((va <= VM_MAXUSER_ADDRESS),
     		    ("mmu_booke_enter_locked: user pmap, non user va"));
     	}
    -	KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0 ||
    -	    VM_OBJECT_LOCKED(m->object),
    -	    ("mmu_booke_enter_locked: page %p is not busy", m));
    +	if ((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == 0)
    +		VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
     
     	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
     
    
    Modified: head/sys/sparc64/sparc64/pmap.c
    ==============================================================================
    --- head/sys/sparc64/sparc64/pmap.c	Wed Feb 27 18:12:04 2013	(r247399)
    +++ head/sys/sparc64/sparc64/pmap.c	Wed Feb 27 18:12:13 2013	(r247400)
    @@ -1494,9 +1494,8 @@ pmap_enter_locked(pmap_t pm, vm_offset_t
     
     	rw_assert(&tte_list_global_lock, RA_WLOCKED);
     	PMAP_LOCK_ASSERT(pm, MA_OWNED);
    -	KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0 ||
    -	    VM_OBJECT_LOCKED(m->object),
    -	    ("pmap_enter_locked: page %p is not busy", m));
    +	if ((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == 0)
    +		VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
     	PMAP_STATS_INC(pmap_nenter);
     	pa = VM_PAGE_TO_PHYS(m);
     
    
    Modified: head/sys/vm/vm_object.h
    ==============================================================================
    --- head/sys/vm/vm_object.h	Wed Feb 27 18:12:04 2013	(r247399)
    +++ head/sys/vm/vm_object.h	Wed Feb 27 18:12:13 2013	(r247400)
    @@ -206,7 +206,6 @@ extern struct vm_object kmem_object_stor
     #define	VM_OBJECT_LOCK(object)		mtx_lock(&(object)->mtx)
     #define	VM_OBJECT_LOCK_ASSERT(object, type) \
     					mtx_assert(&(object)->mtx, (type))
    -#define	VM_OBJECT_LOCKED(object)	mtx_owned(&(object)->mtx)
     #define	VM_OBJECT_SLEEP(object, wchan, pri, wmesg, timo) \
     					msleep((wchan), &(object)->mtx, (pri), \
     					    (wmesg), (timo))
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 19:03:33 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 2A23F4C9;
     Wed, 27 Feb 2013 19:03:33 +0000 (UTC)
     (envelope-from alfred@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 0CF3B84B;
     Wed, 27 Feb 2013 19:03:33 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1RJ3XxL066654;
     Wed, 27 Feb 2013 19:03:33 GMT (envelope-from alfred@svn.freebsd.org)
    Received: (from alfred@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1RJ3WDR066647;
     Wed, 27 Feb 2013 19:03:32 GMT (envelope-from alfred@svn.freebsd.org)
    Message-Id: <201302271903.r1RJ3WDR066647@svn.freebsd.org>
    From: Alfred Perlstein 
    Date: Wed, 27 Feb 2013 19:03:32 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247405 - in head: sys/dev/watchdog sys/sys
     usr.sbin/watchdogd
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 19:03:33 -0000
    
    Author: alfred
    Date: Wed Feb 27 19:03:31 2013
    New Revision: 247405
    URL: http://svnweb.freebsd.org/changeset/base/247405
    
    Log:
      watchdogd(8) and watchdog(4) enhancements.
      
      The following support was added to watchdog(4):
      - Support to query the outstanding timeout.
      - Support to set a software pre-timeout function watchdog with an 'action'
      - Support to set a software only watchdog with a configurable 'action'
      
      'action' can be a mask specifying a single operation or a combination of:
       log(9), printf(9), panic(9) and/or kdb_enter(9).
      
      Support the following in watchdogged:
      - Support to utilize the new additions to watchdog(4).
      - Support to warn if a watchdog script runs for too long.
      - Support for "dry run" where we do not actually arm the watchdog,
        but only report on our timing.
      
      Sponsored by:   iXsystems, Inc.
      MFC after:      1 month
    
    Modified:
      head/sys/dev/watchdog/watchdog.c
      head/sys/sys/watchdog.h
      head/usr.sbin/watchdogd/watchdogd.8
      head/usr.sbin/watchdogd/watchdogd.c
    
    Modified: head/sys/dev/watchdog/watchdog.c
    ==============================================================================
    --- head/sys/dev/watchdog/watchdog.c	Wed Feb 27 18:47:01 2013	(r247404)
    +++ head/sys/dev/watchdog/watchdog.c	Wed Feb 27 19:03:31 2013	(r247405)
    @@ -1,5 +1,8 @@
     /*-
      * Copyright (c) 2004 Poul-Henning Kamp
    + * Copyright (c) 2013 iXsystems.com,
    + *               author: Alfred Perlstein 
    + *
      * All rights reserved.
      *
      * Redistribution and use in source and binary forms, with or without
    @@ -29,21 +32,40 @@
     __FBSDID("$FreeBSD$");
     
     #include 
    +#include 
     #include 
     #include 
     #include 
     #include 
     #include 
     #include 
    +#include 
     #include 
     #include 
     #include 
     
    +#include  /* kern_clock_gettime() */
    +
    +static int wd_set_pretimeout(int newtimeout, int disableiftoolong);
    +static void wd_timeout_cb(void *arg);
    +
    +static struct callout wd_pretimeo_handle;
    +static int wd_pretimeout;
    +static int wd_pretimeout_act = WD_SOFT_LOG;
    +
    +static struct callout wd_softtimeo_handle;
    +static int wd_softtimer;	/* true = use softtimer instead of hardware
    +				   watchdog */
    +static int wd_softtimeout_act = WD_SOFT_LOG;	/* action for the software timeout */
    +
     static struct cdev *wd_dev;
    -static volatile u_int wd_last_u;
    +static volatile u_int wd_last_u;    /* last timeout value set by kern_do_pat */
     
    -static int
    -kern_do_pat(u_int utim)
    +static int wd_lastpat_valid = 0;
    +static time_t wd_lastpat = 0;	/* when the watchdog was last patted */
    +
    +int
    +wdog_kern_pat(u_int utim)
     {
     	int error;
     
    @@ -51,11 +73,20 @@ kern_do_pat(u_int utim)
     		return (EINVAL);
     
     	if ((utim & WD_LASTVAL) != 0) {
    +		/*
    +		 * if WD_LASTVAL is set, fill in the bits for timeout
    +		 * from the saved value in wd_last_u.
    +		 */
     		MPASS((wd_last_u & ~WD_INTERVAL) == 0);
     		utim &= ~WD_LASTVAL;
     		utim |= wd_last_u;
    -	} else
    +	} else {
    +		/*
    +		 * Otherwise save the new interval.
    +		 * This can be zero (to disable the watchdog)
    +		 */
     		wd_last_u = (utim & WD_INTERVAL);
    +	}
     	if ((utim & WD_INTERVAL) == WD_TO_NEVER) {
     		utim = 0;
     
    @@ -65,18 +96,49 @@ kern_do_pat(u_int utim)
     		/* Assume no watchdog available; watchdog flags success */
     		error = EOPNOTSUPP;
     	}
    -	EVENTHANDLER_INVOKE(watchdog_list, utim, &error);
    +	if (wd_softtimer) {
    +		if (utim == 0) {
    +			callout_stop(&wd_softtimeo_handle);
    +		} else {
    +			(void) callout_reset(&wd_softtimeo_handle,
    +			    hz*utim, wd_timeout_cb, "soft");
    +		}
    +		error = 0;
    +	} else {
    +		EVENTHANDLER_INVOKE(watchdog_list, utim, &error);
    +	}
    +	wd_set_pretimeout(wd_pretimeout, true);
    +	/*
    +	 * If we were able to arm/strobe the watchdog, then
    +	 * update the last time it was strobed for WDIOC_GETTIMELEFT
    +	 */
    +	if (!error) {
    +		struct timespec ts;
    +
    +		error = kern_clock_gettime(curthread /* XXX */,
    +		    CLOCK_MONOTONIC_FAST, &ts);
    +		if (!error) {
    +			wd_lastpat = ts.tv_sec;
    +			wd_lastpat_valid = 1;
    +		}
    +	}
     	return (error);
     }
     
     static int
    -wd_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data,
    -    int flags __unused, struct thread *td)
    +wd_valid_act(int act)
    +{
    +
    +	if ((act & ~(WD_SOFT_MASK)) != 0)
    +		return false;
    +	return true;
    +}
    +
    +static int
    +wd_ioctl_patpat(caddr_t data)
     {
     	u_int u;
     
    -	if (cmd != WDIOCPATPAT)
    -		return (ENOIOCTL);
     	u = *(u_int *)data;
     	if (u & ~(WD_ACTIVE | WD_PASSIVE | WD_LASTVAL | WD_INTERVAL))
     		return (EINVAL);
    @@ -89,24 +151,162 @@ wd_ioctl(struct cdev *dev __unused, u_lo
     		return (ENOSYS);	/* XXX Not implemented yet */
     	u &= ~(WD_ACTIVE | WD_PASSIVE);
     
    -	return (kern_do_pat(u));
    +	return (wdog_kern_pat(u));
     }
     
    -u_int
    -wdog_kern_last_timeout(void)
    +static int
    +wd_get_time_left(struct thread *td, time_t *remainp)
     {
    +	struct timespec ts;
    +	int error;
     
    -	return (wd_last_u);
    +	error = kern_clock_gettime(td, CLOCK_MONOTONIC_FAST, &ts);
    +	if (error)
    +		return (error);
    +	if (!wd_lastpat_valid)
    +		return (ENOENT);
    +	*remainp = ts.tv_sec - wd_lastpat;
    +	return (0);
     }
     
    -int
    -wdog_kern_pat(u_int utim)
    +static void
    +wd_timeout_cb(void *arg)
     {
    +	const char *type = arg;
     
    -	if (utim & ~(WD_LASTVAL | WD_INTERVAL))
    -		return (EINVAL);
    +#ifdef DDB
    +	if ((wd_pretimeout_act & WD_SOFT_DDB)) {
    +		char kdb_why[80];
    +		snprintf(kdb_why, sizeof(buf), "watchdog %s timeout", type);
    +		kdb_backtrace();
    +		kdb_enter(KDB_WHY_WATCHDOG, kdb_why);
    +	}
    +#endif
    +	if ((wd_pretimeout_act & WD_SOFT_LOG))
    +		log(LOG_EMERG, "watchdog %s-timeout, WD_SOFT_LOG", type);
    +	if ((wd_pretimeout_act & WD_SOFT_PRINTF))
    +		printf("watchdog %s-timeout, WD_SOFT_PRINTF\n", type);
    +	if ((wd_pretimeout_act & WD_SOFT_PANIC))
    +		panic("watchdog %s-timeout, WD_SOFT_PANIC set", type);
    +}
     
    -	return (kern_do_pat(utim));
    +/*
    + * Called to manage timeouts.
    + * newtimeout needs to be in the range of 0 to actual watchdog timeout.
    + * if 0, we disable the pre-timeout.
    + * otherwise we set the pre-timeout provided it's not greater than the
    + * current actual watchdog timeout.
    + */
    +static int
    +wd_set_pretimeout(int newtimeout, int disableiftoolong)
    +{
    +	u_int utime;
    +
    +	utime = wdog_kern_last_timeout();
    +	/* do not permit a pre-timeout >= than the timeout. */
    +	if (newtimeout >= utime) {
    +		/*
    +		 * If 'disableiftoolong' then just fall through
    +		 * so as to disable the pre-watchdog
    +		 */
    +		if (disableiftoolong)
    +			newtimeout = 0;
    +		else
    +			return EINVAL;
    +	}
    +
    +	/* disable the pre-timeout */
    +	if (newtimeout == 0) {
    +		wd_pretimeout = 0;
    +		callout_stop(&wd_pretimeo_handle);
    +		return 0;
    +	}
    +
    +	/* We determined the value is sane, so reset the callout */
    +	(void) callout_reset(&wd_pretimeo_handle, hz*(utime - newtimeout),
    +	    wd_timeout_cb, "pre-timeout");
    +	wd_pretimeout = newtimeout;
    +	return 0;
    +}
    +
    +static int
    +wd_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data,
    +    int flags __unused, struct thread *td)
    +{
    +	u_int u;
    +	time_t timeleft;
    +	int error;
    +
    +	error = 0;
    +
    +	switch (cmd) {
    +	case WDIOC_SETSOFT:
    +		u = *(int *)data;
    +		/* do nothing? */
    +		if (u == wd_softtimer)
    +			break;
    +		/* If there is a pending timeout disallow this ioctl */
    +		if (wd_last_u != 0) {
    +			error = EINVAL;
    +			break;
    +		}
    +		wd_softtimer = u;
    +		break;
    +	case WDIOC_SETSOFTTIMEOUTACT:
    +		u = *(int *)data;
    +		if (wd_valid_act(u)) {
    +			wd_softtimeout_act = u;
    +		} else {
    +			error = EINVAL;
    +		}
    +		break;
    +	case WDIOC_SETPRETIMEOUTACT:
    +		u = *(int *)data;
    +		if (wd_valid_act(u)) {
    +			wd_pretimeout_act = u;
    +		} else {
    +			error = EINVAL;
    +		}
    +		break;
    +	case WDIOC_GETPRETIMEOUT:
    +		*(int *)data = (int)wd_pretimeout;
    +		break;
    +	case WDIOC_SETPRETIMEOUT:
    +		error = wd_set_pretimeout(*(int *)data, false);
    +		break;
    +	case WDIOC_GETTIMELEFT:
    +		error = wd_get_time_left(td, &timeleft);
    +		if (error)
    +			break;
    +		*(int *)data = (int)timeleft;
    +		break;
    +	case WDIOC_SETTIMEOUT:
    +		u = *(u_int *)data;
    +		error = wdog_kern_pat(u);
    +		break;
    +	case WDIOC_GETTIMEOUT:
    +		u = wdog_kern_last_timeout();
    +		*(u_int *)data = u;
    +		break;
    +	case WDIOCPATPAT:
    +		error = wd_ioctl_patpat(data);
    +		break;
    +	default:
    +		error = ENOIOCTL;
    +		break;
    +	}
    +	return (error);
    +}
    +
    +/*
    + * Return the last timeout set, this is NOT the seconds from NOW until timeout,
    + * rather it is the amount of seconds passed to WDIOCPATPAT/WDIOC_SETTIMEOUT.
    + */
    +u_int
    +wdog_kern_last_timeout(void)
    +{
    +
    +	return (wd_last_u);
     }
     
     static struct cdevsw wd_cdevsw = {
    @@ -120,10 +320,16 @@ watchdog_modevent(module_t mod __unused,
     {
     	switch(type) {
     	case MOD_LOAD:
    +		callout_init(&wd_pretimeo_handle, true);
    +		callout_init(&wd_softtimeo_handle, true);
     		wd_dev = make_dev(&wd_cdevsw, 0,
     		    UID_ROOT, GID_WHEEL, 0600, _PATH_WATCHDOG);
     		return 0;
     	case MOD_UNLOAD:
    +		callout_stop(&wd_pretimeo_handle);
    +		callout_stop(&wd_softtimeo_handle);
    +		callout_drain(&wd_pretimeo_handle);
    +		callout_drain(&wd_softtimeo_handle);
     		destroy_dev(wd_dev);
     		return 0;
     	case MOD_SHUTDOWN:
    
    Modified: head/sys/sys/watchdog.h
    ==============================================================================
    --- head/sys/sys/watchdog.h	Wed Feb 27 18:47:01 2013	(r247404)
    +++ head/sys/sys/watchdog.h	Wed Feb 27 19:03:31 2013	(r247405)
    @@ -1,5 +1,8 @@
     /*-
      * Copyright (c) 2003 Poul-Henning Kamp
    + * Copyright (c) 2013 iXsystems.com,
    + *                    author: Alfred Perlstein 
    + *
      * All rights reserved.
      *
      * Redistribution and use in source and binary forms, with or without
    @@ -32,7 +35,18 @@
     
     #define	_PATH_WATCHDOG	"fido"
     
    -#define WDIOCPATPAT	_IOW('W', 42, u_int)
    +#define WDIOCPATPAT	_IOW('W', 42, u_int)	/* pat the watchdog */
    +#define WDIOC_SETTIMEOUT    _IOW('W', 43, int)	/* set/reset the timer */
    +#define WDIOC_GETTIMEOUT    _IOR('W', 44, int)	/* get total timeout */
    +#define WDIOC_GETTIMELEFT   _IOR('W', 45, int)	/* get time left */
    +#define WDIOC_GETPRETIMEOUT _IOR('W', 46, int)	/* get the pre-timeout */
    +#define WDIOC_SETPRETIMEOUT _IOW('W', 47, int)	/* set the pre-timeout */
    +/* set the action when a pre-timeout occurs see: WD_SOFT_* */
    +#define WDIOC_SETPRETIMEOUTACT _IOW('W', 48, int)
    +
    +/* use software watchdog instead of hardware */
    +#define WDIOC_SETSOFT	_IOW('W', 49, int)
    +#define WDIOC_SETSOFTTIMEOUTACT	_IOW('W', 50, int)
     
     #define WD_ACTIVE	0x8000000
     	/* 
    @@ -76,6 +90,15 @@
     #define WD_TO_8SEC	33
     #define WD_TO_16SEC	34
     #define WD_TO_32SEC	35
    +#define WD_TO_64SEC	36
    +#define WD_TO_128SEC	37
    +
    +/* action on pre-timeout trigger */
    +#define	WD_SOFT_PANIC	0x01	/* panic */
    +#define	WD_SOFT_DDB	0x02	/* enter debugger */
    +#define	WD_SOFT_LOG	0x04	/* log(9) */
    +#define	WD_SOFT_PRINTF	0x08	/* printf(9) */
    +#define WD_SOFT_MASK	0x0f	/* all of the above */
     
     #ifdef _KERNEL
     
    
    Modified: head/usr.sbin/watchdogd/watchdogd.8
    ==============================================================================
    --- head/usr.sbin/watchdogd/watchdogd.8	Wed Feb 27 18:47:01 2013	(r247404)
    +++ head/usr.sbin/watchdogd/watchdogd.8	Wed Feb 27 19:03:31 2013	(r247405)
    @@ -1,3 +1,5 @@
    +.\" Copyright (c) 2013  iXsystems.com,
    +.\"                     author: Alfred Perlstein 
     .\" Copyright (c) 2004  Poul-Henning Kamp 
     .\" Copyright (c) 2003  Sean M. Kelly 
     .\" All rights reserved.
    @@ -25,7 +27,7 @@
     .\"
     .\" $FreeBSD$
     .\"
    -.Dd September 2, 2006
    +.Dd September 2, 2013
     .Dt WATCHDOGD 8
     .Os
     .Sh NAME
    @@ -33,11 +35,17 @@
     .Nd watchdog daemon
     .Sh SYNOPSIS
     .Nm
    -.Op Fl d
    +.Op Fl dnw
    +.Op Fl -debug
    +.Op Fl -softtimeout
    +.Op Fl -softtimeout-action Ar action
    +.Op Fl -pretimeout Ar timeout
    +.Op Fl -pretimeout-action Ar action
     .Op Fl e Ar cmd
     .Op Fl I Ar file
     .Op Fl s Ar sleep
     .Op Fl t Ar timeout
    +.Op Fl T Ar script_timeout
     .Sh DESCRIPTION
     The
     .Nm
    @@ -62,6 +70,13 @@ is not specified, the daemon will perfor
     check instead.
     .Pp
     The
    +.Fl n
    +argument 'dry-run' will cause watchdog not to arm the system watchdog and
    +instead only run the watchdog function and report on failures.
    +This is useful for developing new watchdogd scripts as the system will not
    +reboot if there are problems with the script.
    +.Pp
    +The
     .Fl s Ar sleep
     argument can be used to control the sleep period between each execution
     of the check and defaults to one second.
    @@ -78,6 +93,16 @@ If this occurs,
     will no longer execute and thus the kernel's watchdog routines will take
     action after a configurable timeout.
     .Pp
    +The
    +.Fl T Ar script_timeout
    +specifies the threshold (in seconds) at which the watchdogd will complain
    +that its script has run for too long.
    +If unset
    +.Ar script_timeout
    +defaults to the value specified by the
    +.Fl s Ar sleep 
    +option.
    +.Pp
     Upon receiving the
     .Dv SIGTERM
     or
    @@ -90,17 +115,85 @@ will terminate.
     The
     .Nm
     utility recognizes the following runtime options:
    -.Bl -tag -width ".Fl I Ar file"
    +.Bl -tag -width ".Fl -softtimeout-action Ar action  "
     .It Fl I Ar file
     Write the process ID of the
     .Nm
     utility in the specified file.
    -.It Fl d
    +.It Fl d Fl -debug
     Do not fork.
     When this option is specified,
     .Nm
     will not fork into the background at startup.
    +.Pp
    +.It Fl w
    +Complain when the watchdog script takes too long.
    +This flag will cause watchdogd to complain when the amount of time to
    +execute the watchdog script exceeds the threshold of 'sleep' option.
    +.Pp
    +.It Fl -pretimeout Ar timeout
    +Set a "pretimeout" watchdog.  At "timeout" seconds before the watchdog
    +will fire attempt an action.  The action is set by the --pretimeout-action
    +flag.  The default is just to log a message (WD_SOFT_LOG) via
    +.Xr log 9 .
    +.Pp
    +.It Fl -pretimeout-action Ar action
    +Set the timeout action for the pretimeout.  See the section 
    +.Sx Timeout Actions .
    +.Pp
    +.It Fl -softtimeout
    +Instead of arming the various hardware watchdogs, only use a basic software
    +watchdog.  The default action is just to
    +.Xr log 9
    +a message (WD_SOFT_LOG).
    +.Pp
    +.It Fl -softtimeout-action Ar action
    +Set the timeout action for the softtimeout.  See the section 
    +.Sx Timeout Actions .
    +.Pp
     .El
    +.Sh Timeout Actions
    +The following timeout actions are available via the
    +.Fl -pretimeout-action
    +and
    +.Fl -softtimeout-action
    +flags:
    +.Bl -tag -width ".Ar printf  "
    +.It Ar panic
    +Call
    +.Xr panic 9
    +when the timeout is reached.
    +.Pp
    +.It Ar ddb
    +Enter the kernel debugger via
    +.Xr kdb_enter 9
    +when the timeout is reached.
    +.Pp
    +.It Ar log
    +Log a message using
    +.Xr log 9
    +when the timeout is reached.
    +.Pp
    +.It Ar printf
    +call the kernel 
    +.Xr printf 9
    +to display a message to the console and
    +.Xr dmesg 8
    +buffer.
    +.Pp
    +.El
    +Actions can be combined in a comma separated list as so:
    +.Ar log,printf
    +which would both
    +.Xr printf 9
    +and
    +.Xr log 9
    +which will send messages both to
    +.Xr dmesg 8
    +and the kernel
    +.Xr log 4
    +device for
    +.Xr syslog 8 .
     .Sh FILES
     .Bl -tag -width ".Pa /var/run/watchdogd.pid" -compact
     .It Pa /var/run/watchdogd.pid
    @@ -125,3 +218,6 @@ and
     .Pp
     Some contributions made by
     .An Jeff Roberson Aq jeff@FreeBSD.org .
    +.Pp
    +The pretimeout and softtimeout action system was added by
    +.An Alfred Perlstein Aq alfred@freebsd.org .
    
    Modified: head/usr.sbin/watchdogd/watchdogd.c
    ==============================================================================
    --- head/usr.sbin/watchdogd/watchdogd.c	Wed Feb 27 18:47:01 2013	(r247404)
    +++ head/usr.sbin/watchdogd/watchdogd.c	Wed Feb 27 19:03:31 2013	(r247405)
    @@ -1,5 +1,8 @@
     /*-
      * Copyright (c) 2003-2004  Sean M. Kelly 
    + * Copyright (c) 2013 iXsystems.com,
    + *                    author: Alfred Perlstein 
    + *
      * All rights reserved.
      *
      * Redistribution and use in source and binary forms, with or without
    @@ -50,8 +53,11 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    +#include 
     #include 
     
    +#include 
    +
     static void	parseargs(int, char *[]);
     static void	sighandler(int);
     static void	watchdog_loop(void);
    @@ -63,13 +69,39 @@ static void	usage(void);
     static int debugging = 0;
     static int end_program = 0;
     static const char *pidfile = _PATH_VARRUN "watchdogd.pid";
    -static u_int timeout = WD_TO_16SEC;
    +static u_int timeout = WD_TO_128SEC;
    +static u_int pretimeout = 0;
     static u_int passive = 0;
     static int is_daemon = 0;
    +static int is_dry_run = 0;  /* do not arm the watchdog, only
    +			       report on timing of the watch
    +			       program */
    +static int do_timedog = 0;
    +static int do_syslog = 0;
     static int fd = -1;
     static int nap = 1;
    +static int carp_thresh_seconds = -1;
     static char *test_cmd = NULL;
     
    +static const char *getopt_shortopts;
    +
    +static int pretimeout_set;
    +static int pretimeout_act;
    +static int pretimeout_act_set;
    +
    +static int softtimeout_set;
    +static int softtimeout_act;
    +static int softtimeout_act_set;
    +
    +static struct option longopts[] = {
    +	{ "debug", no_argument, &debugging, 1 },
    +	{ "pretimeout", required_argument, &pretimeout_set, 1 },
    +	{ "pretimeout-action", required_argument, &pretimeout_act_set, 1 },
    +	{ "softtimeout", no_argument, &softtimeout_set, 1 },
    +	{ "softtimeout-action", required_argument, &softtimeout_act_set, 1 },
    +	{ NULL, 0, NULL, 0}
    +};
    +
     /*
      * Ask malloc() to map minimum-sized chunks of virtual address space at a time,
      * so that mlockall() won't needlessly wire megabytes of unused memory into the
    @@ -93,12 +125,18 @@ main(int argc, char *argv[])
     		
     	parseargs(argc, argv);
     
    +	if (do_syslog) {
    +		openlog("watchdogd", LOG_CONS|LOG_NDELAY|LOG_PERROR,
    +		    LOG_DAEMON);
    +
    +	}
    +
     	rtp.type = RTP_PRIO_REALTIME;
     	rtp.prio = 0;
     	if (rtprio(RTP_SET, 0, &rtp) == -1)
     		err(EX_OSERR, "rtprio");
     
    -	if (watchdog_init() == -1)
    +	if (!is_dry_run && watchdog_init() == -1)
     		errx(EX_SOFTWARE, "unable to initialize watchdog");
     
     	if (is_daemon) {
    @@ -108,6 +146,7 @@ main(int argc, char *argv[])
     		pfh = pidfile_open(pidfile, 0600, &otherpid);
     		if (pfh == NULL) {
     			if (errno == EEXIST) {
    +				watchdog_onoff(0);
     				errx(EX_SOFTWARE, "%s already running, pid: %d",
     				    getprogname(), otherpid);
     			}
    @@ -164,6 +203,9 @@ static int
     watchdog_init(void)
     {
     
    +	if (is_dry_run)
    +		return 0;
    +
     	fd = open("/dev/" _PATH_WATCHDOG, O_RDWR);
     	if (fd >= 0)
     		return (0);
    @@ -172,26 +214,98 @@ watchdog_init(void)
     }
     
     /*
    + * If we are doing timing, then get the time.
    + */
    +static int
    +watchdog_getuptime(struct timespec *tp)
    +{
    +	int error;
    +
    +	if (!do_timedog)
    +		return 0;
    +
    +	error = clock_gettime(CLOCK_UPTIME_FAST, tp);
    +	if (error)
    +		warn("clock_gettime");
    +	return (error);
    +}
    +
    +static long
    +watchdog_check_dogfunction_time(struct timespec *tp_start,
    +    struct timespec *tp_end)
    +{
    +	struct timeval tv_start, tv_end, tv;
    +	const char *cmd_prefix, *cmd;
    +	int sec;
    +
    +	if (!do_timedog)
    +		return (0);
    +
    +	TIMESPEC_TO_TIMEVAL(&tv_start, tp_start);
    +	TIMESPEC_TO_TIMEVAL(&tv_end, tp_end);
    +	timersub(&tv_end, &tv_start, &tv);
    +	sec = tv.tv_sec;
    +	if (sec < carp_thresh_seconds)
    +		return (sec);
    +
    +	if (test_cmd) {
    +		cmd_prefix = "Watchdog program";
    +		cmd = test_cmd;
    +	} else {
    +		cmd_prefix = "Watchdog operation";
    +		cmd = "stat(\"/etc\", &sb)";
    +	}
    +	if (do_syslog)
    +		syslog(LOG_CRIT, "%s: '%s' took too long: "
    +		    "%d.%06ld seconds >= %d seconds threshhold",
    +		    cmd_prefix, cmd, sec, (long)tv.tv_usec,
    +		    carp_thresh_seconds);
    +	warnx("%s: '%s' took too long: "
    +	    "%d.%06ld seconds >= %d seconds threshhold",
    +	    cmd_prefix, cmd, sec, (long)tv.tv_usec, carp_thresh_seconds);
    +	return (sec);
    +}
    +
    +
    +/*
      * Main program loop which is iterated every second.
      */
     static void
     watchdog_loop(void)
     {
    +	struct timespec ts_start, ts_end;
     	struct stat sb;
    -	int failed;
    +	long waited;
    +	int error, failed;
     
     	while (end_program != 2) {
     		failed = 0;
     
    +		error = watchdog_getuptime(&ts_start);
    +		if (error) {
    +			end_program = 1;
    +			goto try_end;
    +		}
    +
     		if (test_cmd != NULL)
     			failed = system(test_cmd);
     		else
     			failed = stat("/etc", &sb);
     
    +		error = watchdog_getuptime(&ts_end);
    +		if (error) {
    +			end_program = 1;
    +			goto try_end;
    +		}
    +
    +		waited = watchdog_check_dogfunction_time(&ts_start, &ts_end);
    +
     		if (failed == 0)
     			watchdog_patpat(timeout|WD_ACTIVE);
    -		sleep(nap);
    +		if (nap - waited > 0)
    +			sleep(nap - waited);
     
    +try_end:
     		if (end_program != 0) {
     			if (watchdog_onoff(0) == 0) {
     				end_program = 2;
    @@ -211,6 +325,9 @@ static int
     watchdog_patpat(u_int t)
     {
     
    +	if (is_dry_run)
    +		return 0;
    +
     	return ioctl(fd, WDIOCPATPAT, &t);
     }
     
    @@ -221,11 +338,62 @@ watchdog_patpat(u_int t)
     static int
     watchdog_onoff(int onoff)
     {
    +	int error;
     
    -	if (onoff)
    +	/* fake successful watchdog op if a dry run */
    +	if (is_dry_run)
    +		return 0;
    +
    +	if (onoff) {
    +		/*
    +		 * Call the WDIOC_SETSOFT regardless of softtimeout_set
    +		 * because we'll need to turn it off if someone had turned
    +		 * it on.
    +		 */
    +		error = ioctl(fd, WDIOC_SETSOFT, &softtimeout_set);
    +		if (error) {
    +			warn("setting WDIOC_SETSOFT %d", softtimeout_set);
    +			return (error);
    +		}
    +		error = watchdog_patpat((timeout|WD_ACTIVE));
    +		if (error) {
    +			warn("watchdog_patpat failed");
    +			goto failsafe;
    +		}
    +		if (softtimeout_act_set) {
    +			error = ioctl(fd, WDIOC_SETSOFTTIMEOUTACT,
    +			    &softtimeout_act);
    +			if (error) {
    +				warn("setting WDIOC_SETSOFTTIMEOUTACT %d",
    +				    softtimeout_act);
    +				goto failsafe;
    +			}
    +		}
    +		if (pretimeout_set) {
    +			error = ioctl(fd, WDIOC_SETPRETIMEOUT, &pretimeout);
    +			if (error) {
    +				warn("setting WDIOC_SETPRETIMEOUT %d",
    +				    pretimeout);
    +				goto failsafe;
    +			}
    +		}
    +		if (pretimeout_act_set) {
    +			error = ioctl(fd, WDIOC_SETPRETIMEOUTACT,
    +			    &pretimeout_act);
    +			if (error) {
    +				warn("setting WDIOC_SETPRETIMEOUTACT %d",
    +				    pretimeout_act);
    +				goto failsafe;
    +			}
    +		}
    +		/* pat one more time for good measure */
     		return watchdog_patpat((timeout|WD_ACTIVE));
    -	else
    +	 } else {
     		return watchdog_patpat(0);
    +	 }
    +failsafe:
    +	watchdog_patpat(0);
    +	return (error);
     }
     
     /*
    @@ -235,27 +403,132 @@ static void
     usage(void)
     {
     	if (is_daemon)
    -		fprintf(stderr, "usage: watchdogd [-d] [-e cmd] [-I file] [-s sleep] [-t timeout]\n");
    +		fprintf(stderr, "usage:\n"
    +"  watchdogd [-dnw] [-e cmd] [-I file] [-s sleep] [-t timeout]\n"
    +"            [-T script_timeout]\n"
    +"            [--debug]\n"
    +"            [--pretimeout seconds] [-pretimeout-action action]\n"
    +"            [--softtimeout] [-softtimeout-action action]\n"
    +);
     	else
     		fprintf(stderr, "usage: watchdog [-d] [-t timeout]\n");
     	exit(EX_USAGE);
     }
     
    +static long
    +fetchtimeout(int opt, const char *longopt, const char *myoptarg)
    +{
    +	const char *errstr;
    +	char *p;
    +	long rv;
    +
    +	errstr = NULL;
    +	p = NULL;
    +	errno = 0;
    +	rv = strtol(myoptarg, &p, 0);
    +	if ((p != NULL && *p != '\0') || errno != 0)
    +		errstr = "is not a number";
    +	if (rv <= 0)
    +		errstr = "must be greater than zero";
    +	if (errstr) {
    +		if (longopt) 
    +			errx(EX_USAGE, "--%s argument %s", longopt, errstr);
    +		else 
    +			errx(EX_USAGE, "-%c argument %s", opt, errstr);
    +	}
    +	return (rv);
    +}
    +
    +struct act_tbl {
    +	const char *at_act;
    +	int at_value;
    +};
    +
    +struct act_tbl act_tbl[] = {
    +	{ "panic", WD_SOFT_PANIC },
    +	{ "ddb", WD_SOFT_DDB },
    +	{ "log", WD_SOFT_LOG },
    +	{ "printf", WD_SOFT_PRINTF },
    +	{ NULL, 0 }
    +};
    +
    +static void
    +timeout_act_error(const char *lopt, const char *badact)
    +{
    +	char *opts, *oldopts;
    +	int i;
    +
    +	opts = NULL;
    +	for (i = 0; act_tbl[i].at_act != NULL; i++) {
    +		oldopts = opts;
    +		if (asprintf(&opts, "%s%s%s",
    +		    oldopts == NULL ? "" : oldopts,
    +		    oldopts == NULL ? "" : ", ",
    +		    act_tbl[i].at_act) == -1)
    +			err(EX_OSERR, "malloc");
    +		free(oldopts);
    +	}
    +	warnx("bad --%s argument '%s' must be one of (%s).",
    +	    lopt, badact, opts);
    +	usage();
    +}
    +
    +/*
    + * Take a comma separated list of actions and or the flags
    + * together for the ioctl.
    + */
    +static int
    +timeout_act_str2int(const char *lopt, const char *acts)
    +{
    +	int i;
    +	char *dupacts, *tofree;
    +	char *o;
    +	int rv = 0;
    +
    +	tofree = dupacts = strdup(acts);
    +	if (!tofree)
    +		err(EX_OSERR, "malloc");
    +	while ((o = strsep(&dupacts, ",")) != NULL) {
    +		for (i = 0; act_tbl[i].at_act != NULL; i++) {
    +			if (!strcmp(o, act_tbl[i].at_act)) {
    +				rv |= act_tbl[i].at_value;
    +				break;
    +			}
    +		}
    +		if (act_tbl[i].at_act == NULL)
    +			timeout_act_error(lopt, o);
    +	}
    +	free(tofree);
    +	return rv;
    +}
    +
     /*
      * Handle the few command line arguments supported.
      */
     static void
     parseargs(int argc, char *argv[])
     {
    +	int longindex;
     	int c;
     	char *p;
    +	const char *lopt;
     	double a;
     
    +	/*
    +	 * if we end with a 'd' aka 'watchdogd' then we are the daemon program,
    +	 * otherwise run as a command line utility.
    +	 */
     	c = strlen(argv[0]);
     	if (argv[0][c - 1] == 'd')
     		is_daemon = 1;
    -	while ((c = getopt(argc, argv,
    -	    is_daemon ? "I:de:s:t:?" : "dt:?")) != -1) {
    +
    +	if (is_daemon)
    +		getopt_shortopts = "I:de:ns:t:ST:w?";
    +	else
    +		getopt_shortopts = "dt:?";
    +
    +	while ((c = getopt_long(argc, argv, getopt_shortopts, longopts,
    +		    &longindex)) != -1) {
     		switch (c) {
     		case 'I':
     			pidfile = optarg;
    @@ -266,17 +539,19 @@ parseargs(int argc, char *argv[])
     		case 'e':
     			test_cmd = strdup(optarg);
     			break;
    +		case 'n':
    +			is_dry_run = 1;
    +			break;
     #ifdef notyet
     		case 'p':
     			passive = 1;
     			break;
     #endif
     		case 's':
    -			p = NULL;
    -			errno = 0;
    -			nap = strtol(optarg, &p, 0);
    -			if ((p != NULL && *p != '\0') || errno != 0)
    -				errx(EX_USAGE, "-s argument is not a number");
    +			nap = fetchtimeout(c, NULL, optarg);
    +			break;
    +		case 'S':
    +			do_syslog = 1;
     			break;
     		case 't':
     			p = NULL;
    @@ -286,6 +561,7 @@ parseargs(int argc, char *argv[])
     				errx(EX_USAGE, "-t argument is not a number");
     			if (a < 0)
     				errx(EX_USAGE, "-t argument must be positive");
    +
     			if (a == 0)
     				timeout = WD_TO_NEVER;
     			else
    @@ -294,12 +570,39 @@ parseargs(int argc, char *argv[])
     				printf("Timeout is 2^%d nanoseconds\n",
     				    timeout);
     			break;
    +		case 'T':
    +			carp_thresh_seconds = fetchtimeout(c, "NULL", optarg);
    +			break;
    +		case 'w':
    +			do_timedog = 1;
    +			break;
    +		case 0:
    +			lopt = longopts[longindex].name;
    +			if (!strcmp(lopt, "pretimeout")) {
    +				pretimeout = fetchtimeout(0, lopt, optarg);
    +			} else if (!strcmp(lopt, "pretimeout-action")) {
    +				pretimeout_act = timeout_act_str2int(lopt,
    +				    optarg);
    +			} else if (!strcmp(lopt, "softtimeout-action")) {
    +				softtimeout_act = timeout_act_str2int(lopt,
    +				    optarg);
    +			} else {
    +		/*		warnx("bad option at index %d: %s", optind,
    +				    argv[optind]);
    
    *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 19:50:49 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 1F5BA5E7;
     Wed, 27 Feb 2013 19:50:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 020D1A73;
     Wed, 27 Feb 2013 19:50:49 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1RJomFg081640;
     Wed, 27 Feb 2013 19:50:48 GMT (envelope-from jhb@svn.freebsd.org)
    Received: (from jhb@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1RJokPe081626;
     Wed, 27 Feb 2013 19:50:46 GMT (envelope-from jhb@svn.freebsd.org)
    Message-Id: <201302271950.r1RJokPe081626@svn.freebsd.org>
    From: John Baldwin 
    Date: Wed, 27 Feb 2013 19:50:46 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247411 - in head: include lib/libc/stdio
     tools/regression/lib/libc/stdio
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 19:50:49 -0000
    
    Author: jhb
    Date: Wed Feb 27 19:50:46 2013
    New Revision: 247411
    URL: http://svnweb.freebsd.org/changeset/base/247411
    
    Log:
      Add an implementation of open_memstream() and open_wmemstream().  These
      routines provide write-only stdio FILE objects that store their data in a
      dynamically allocated buffer.  They are a string builder interface somewhat
      akin to a completely dynamic sbuf.
      
      Reviewed by:	bde, jilles (earlier versions)
      MFC after:	1 month
    
    Added:
      head/lib/libc/stdio/open_memstream.3   (contents, props changed)
      head/lib/libc/stdio/open_memstream.c   (contents, props changed)
      head/lib/libc/stdio/open_wmemstream.c   (contents, props changed)
      head/tools/regression/lib/libc/stdio/test-open_memstream.c   (contents, props changed)
      head/tools/regression/lib/libc/stdio/test-open_memstream.t   (contents, props changed)
      head/tools/regression/lib/libc/stdio/test-open_wmemstream.c   (contents, props changed)
      head/tools/regression/lib/libc/stdio/test-open_wmemstream.t   (contents, props changed)
    Modified:
      head/include/stdio.h
      head/include/wchar.h
      head/lib/libc/stdio/Makefile.inc
      head/lib/libc/stdio/Symbol.map
      head/tools/regression/lib/libc/stdio/Makefile
    
    Modified: head/include/stdio.h
    ==============================================================================
    --- head/include/stdio.h	Wed Feb 27 19:49:14 2013	(r247410)
    +++ head/include/stdio.h	Wed Feb 27 19:50:46 2013	(r247411)
    @@ -346,6 +346,7 @@ char	*tempnam(const char *, const char *
     FILE	*fmemopen(void * __restrict, size_t, const char * __restrict);
     ssize_t	 getdelim(char ** __restrict, size_t * __restrict, int,
     	    FILE * __restrict);
    +FILE	*open_memstream(char **, size_t *);
     int	 renameat(int, const char *, int, const char *);
     int	 vdprintf(int, const char * __restrict, __va_list);
     
    
    Modified: head/include/wchar.h
    ==============================================================================
    --- head/include/wchar.h	Wed Feb 27 19:49:14 2013	(r247410)
    +++ head/include/wchar.h	Wed Feb 27 19:50:46 2013	(r247411)
    @@ -207,6 +207,7 @@ int	wcwidth(wchar_t);
     #if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE
     size_t	mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
     	    size_t, mbstate_t * __restrict);
    +FILE	*open_wmemstream(wchar_t **, size_t *);
     wchar_t	*wcpcpy(wchar_t * __restrict, const wchar_t * __restrict);
     wchar_t	*wcpncpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
     wchar_t	*wcsdup(const wchar_t *) __malloc_like;
    
    Modified: head/lib/libc/stdio/Makefile.inc
    ==============================================================================
    --- head/lib/libc/stdio/Makefile.inc	Wed Feb 27 19:49:14 2013	(r247410)
    +++ head/lib/libc/stdio/Makefile.inc	Wed Feb 27 19:50:46 2013	(r247411)
    @@ -14,6 +14,7 @@ SRCS+=	_flock_stub.c asprintf.c clrerr.c
     	ftell.c funopen.c fvwrite.c fwalk.c fwide.c fwprintf.c fwscanf.c \
     	fwrite.c getc.c getchar.c getdelim.c getline.c \
     	gets.c getw.c getwc.c getwchar.c makebuf.c mktemp.c \
    +	open_memstream.c open_wmemstream.c \
     	perror.c printf.c printf-pos.c putc.c putchar.c \
     	puts.c putw.c putwc.c putwchar.c \
     	refill.c remove.c rewind.c rget.c scanf.c setbuf.c setbuffer.c \
    @@ -36,7 +37,7 @@ MAN+=	fclose.3 ferror.3 fflush.3 fgetln.
     	flockfile.3 \
     	fopen.3 fputs.3 \
     	fputws.3 fread.3 fseek.3 funopen.3 fwide.3 getc.3 \
    -	getline.3 getwc.3 mktemp.3 \
    +	getline.3 getwc.3 mktemp.3 open_memstream.3 \
     	printf.3 printf_l.3 putc.3 putwc.3 remove.3 scanf.3 scanf_l.3 setbuf.3 \
     	stdio.3 tmpnam.3 \
     	ungetc.3 ungetwc.3 wprintf.3 wscanf.3
    @@ -60,6 +61,7 @@ MLINKS+=getc.3 fgetc.3 getc.3 getc_unloc
     MLINKS+=getline.3 getdelim.3
     MLINKS+=getwc.3 fgetwc.3 getwc.3 getwchar.3
     MLINKS+=mktemp.3 mkdtemp.3 mktemp.3 mkstemp.3 mktemp.3 mkstemps.3
    +MLINKS+=open_memstream.3 open_wmemstream.3
     MLINKS+=printf.3 asprintf.3 printf.3 dprintf.3 printf.3 fprintf.3 \
     	printf.3 snprintf.3 printf.3 sprintf.3 \
     	printf.3 vasprintf.3 printf.3 vdprintf.3 \
    
    Modified: head/lib/libc/stdio/Symbol.map
    ==============================================================================
    --- head/lib/libc/stdio/Symbol.map	Wed Feb 27 19:49:14 2013	(r247410)
    +++ head/lib/libc/stdio/Symbol.map	Wed Feb 27 19:50:46 2013	(r247411)
    @@ -156,6 +156,8 @@ FBSD_1.3 {
     	putwc_l;
     	putwchar_l;
     	fmemopen;
    +	open_memstream;
    +	open_wmemstream;
     };
     
     FBSDprivate_1.0 {
    
    Added: head/lib/libc/stdio/open_memstream.3
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/lib/libc/stdio/open_memstream.3	Wed Feb 27 19:50:46 2013	(r247411)
    @@ -0,0 +1,154 @@
    +.\" Copyright (c) 2013 Advanced Computing Technologies LLC
    +.\" Written by: John H. Baldwin 
    +.\" 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 February 27, 2013
    +.Dt OPEN_MEMSTREAM 3
    +.Os
    +.Sh NAME
    +.Nm open_memstream ,
    +.Nm open_wmemstream
    +.Nd dynamic memory buffer stream open functions
    +.Sh LIBRARY
    +.Lb libc
    +.Sh SYNOPSIS
    +.In stdio.h
    +.Ft FILE *
    +.Fn open_memstream "char **bufp" "size_t **sizep"
    +.In wchar.h
    +.Ft FILE *
    +.Fn open_wmemstream "wchar_t **bufp" "size_t **sizep"
    +.Sh DESCRIPTION
    +The
    +.Fn open_memstream
    +and
    +.Fn open_wmemstream
    +functions create a write-only, seekable stream backed by a dynamically
    +allocated memory buffer.
    +The
    +.Fn open_memstream
    +function creates a byte-oriented stream,
    +while the
    +.Fn open_wmemstream
    +function creates a wide-oriented stream.
    +.Pp
    +Each stream maintains a current position and size.
    +Initially,
    +the position and size are set to zero.
    +Each write begins at the current position and advances it the number of
    +successfully written bytes for
    +.Fn open_memstream
    +or wide characters for
    +.Fn open_wmemstream .
    +If a write moves the current position beyond the length of the buffer,
    +the length of the buffer is extended and a null character is appended to the
    +buffer.
    +.Pp
    +A stream's buffer always contains a null character at the end of the buffer
    +that is not included in the current length.
    +.Pp
    +If a stream's current position is moved beyond the current length via a
    +seek operation and a write is performed,
    +the characters between the current length and the current position are filled
    +with null characters before the write is performed.
    +.Pp
    +After a successful call to
    +.Xr fclose 3
    +or
    +.Xr fflush 3 ,
    +the pointer referenced by
    +.Fa bufp
    +will contain the start of the memory buffer and the variable referenced by
    +.Fa sizep
    +will contain the smaller of the current position and the current buffer length.
    +.Pp
    +After a successful call to
    +.Xr fflush 3,
    +the pointer referenced by
    +.Fa bufp
    +and the variable referenced by
    +.Fa sizep
    +are only valid until the next write operation or a call to
    +.Xr fclose 3.
    +.Pp
    +Once a stream is closed,
    +the allocated buffer referenced by
    +.Fa bufp
    +should be released via a call to
    +.Xr free 3
    +when it is no longer needed.
    +.Sh IMPLEMENTATION NOTES
    +Internally all I/O streams are effectively byte-oriented,
    +so using wide-oriented operations to write to a stream opened via
    +.Fn open_wmemstream
    +results in wide characters being expanded to a stream of multibyte characters
    +in stdio's internal buffers.
    +These multibyte characters are then converted back to wide characters when
    +written into the stream.
    +As a result,
    +the wide-oriented streams maintain an internal multibyte character conversion
    +state that is cleared on any seek opertion that changes the current position.
    +This should have no effect as long as wide-oriented output operations are used
    +on a wide-oriented stream.
    +.Sh RETURN VALUES
    +Upon successful completion,
    +.Fn open_memstream
    +and
    +.Fn open_wmemstream
    +return a
    +.Tn FILE
    +pointer.
    +Otherwise,
    +.Dv NULL
    +is returned and the global variable
    +.Va errno
    +is set to indicate the error.
    +.Sh ERRORS
    +.Bl -tag -width Er
    +.It Bq Er EINVAL
    +The
    +.Fa bufp
    +or
    +.Fa sizep
    +argument was
    +.Dv NULL .
    +.It Bq Er ENOMEM
    +Memory for the stream or buffer could not be allocated.
    +.Sh SEE ALSO
    +.Xr fclose 3 ,
    +.Xr fflush 3 ,
    +.Xr fopen 3 ,
    +.Xr free 3 ,
    +.Xr fseek 3 ,
    +.Xr sbuf 3 ,
    +.Xr stdio 3
    +.Sh STANDARDS
    +The
    +.Fn open_memstream
    +and
    +.Fn open_wmemstream
    +functions conform to
    +.St -p1003.1-2008 .
    
    Added: head/lib/libc/stdio/open_memstream.c
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/lib/libc/stdio/open_memstream.c	Wed Feb 27 19:50:46 2013	(r247411)
    @@ -0,0 +1,209 @@
    +/*-
    + * Copyright (c) 2013 Advanced Computing Technologies LLC
    + * Written by: John H. Baldwin 
    + * 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 "namespace.h"
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include "un-namespace.h"
    +
    +/* XXX: There is no FPOS_MAX.  This assumes fpos_t is an off_t. */
    +#define	FPOS_MAX	OFF_MAX
    +
    +struct memstream {
    +	char **bufp;
    +	size_t *sizep;
    +	ssize_t len;
    +	fpos_t offset;
    +};
    +
    +static int
    +memstream_grow(struct memstream *ms, fpos_t newoff)
    +{
    +	char *buf;
    +	ssize_t newsize;
    +
    +	if (newoff < 0 || newoff >= SSIZE_MAX)
    +		newsize = SSIZE_MAX - 1;
    +	else
    +		newsize = newoff;
    +	if (newsize > ms->len) {
    +		buf = realloc(*ms->bufp, newsize + 1);
    +		if (buf != NULL) {
    +#ifdef DEBUG
    +			fprintf(stderr, "MS: %p growing from %zd to %zd\n",
    +			    ms, ms->len, newsize);
    +#endif
    +			memset(buf + ms->len + 1, 0, newsize - ms->len);
    +			*ms->bufp = buf;
    +			ms->len = newsize;
    +			return (1);
    +		}
    +		return (0);
    +	}
    +	return (1);
    +}
    +
    +static void
    +memstream_update(struct memstream *ms)
    +{
    +
    +	assert(ms->len >= 0 && ms->offset >= 0);
    +	*ms->sizep = ms->len < ms->offset ? ms->len : ms->offset;
    +}
    +
    +static int
    +memstream_write(void *cookie, const char *buf, int len)
    +{
    +	struct memstream *ms;
    +	ssize_t tocopy;
    +
    +	ms = cookie;
    +	if (!memstream_grow(ms, ms->offset + len))
    +		return (-1);
    +	tocopy = ms->len - ms->offset;
    +	if (len < tocopy)
    +		tocopy = len;
    +	memcpy(*ms->bufp + ms->offset, buf, tocopy);
    +	ms->offset += tocopy;
    +	memstream_update(ms);
    +#ifdef DEBUG
    +	fprintf(stderr, "MS: write(%p, %d) = %zd\n", ms, len, tocopy);
    +#endif
    +	return (tocopy);
    +}
    +
    +static fpos_t
    +memstream_seek(void *cookie, fpos_t pos, int whence)
    +{
    +	struct memstream *ms;
    +#ifdef DEBUG
    +	fpos_t old;
    +#endif
    +
    +	ms = cookie;
    +#ifdef DEBUG
    +	old = ms->offset;
    +#endif
    +	switch (whence) {
    +	case SEEK_SET:
    +		/* _fseeko() checks for negative offsets. */
    +		assert(pos >= 0);
    +		ms->offset = pos;
    +		break;
    +	case SEEK_CUR:
    +		/* This is only called by _ftello(). */
    +		assert(pos == 0);
    +		break;
    +	case SEEK_END:
    +		if (pos < 0) {
    +			if (pos + ms->len < 0) {
    +#ifdef DEBUG
    +				fprintf(stderr,
    +				    "MS: bad SEEK_END: pos %jd, len %zd\n",
    +				    (intmax_t)pos, ms->len);
    +#endif
    +				errno = EINVAL;
    +				return (-1);
    +			}
    +		} else {
    +			if (FPOS_MAX - ms->len < pos) {
    +#ifdef DEBUG
    +				fprintf(stderr,
    +				    "MS: bad SEEK_END: pos %jd, len %zd\n",
    +				    (intmax_t)pos, ms->len);
    +#endif
    +				errno = EOVERFLOW;
    +				return (-1);
    +			}
    +		}
    +		ms->offset = ms->len + pos;
    +		break;
    +	}
    +	memstream_update(ms);
    +#ifdef DEBUG
    +	fprintf(stderr, "MS: seek(%p, %jd, %d) %jd -> %jd\n", ms, (intmax_t)pos,
    +	    whence, (intmax_t)old, (intmax_t)ms->offset);
    +#endif
    +	return (ms->offset);
    +}
    +
    +static int
    +memstream_close(void *cookie)
    +{
    +
    +	free(cookie);
    +	return (0);
    +}
    +
    +FILE *
    +open_memstream(char **bufp, size_t *sizep)
    +{
    +	struct memstream *ms;
    +	int save_errno;
    +	FILE *fp;
    +
    +	if (bufp == NULL || sizep == NULL) {
    +		errno = EINVAL;
    +		return (NULL);
    +	}
    +	*bufp = calloc(1, 1);
    +	if (*bufp == NULL)
    +		return (NULL);
    +	ms = malloc(sizeof(*ms));
    +	if (ms == NULL) {
    +		save_errno = errno;
    +		free(*bufp);
    +		*bufp = NULL;
    +		errno = save_errno;
    +		return (NULL);
    +	}
    +	ms->bufp = bufp;
    +	ms->sizep = sizep;
    +	ms->len = 0;
    +	ms->offset = 0;
    +	memstream_update(ms);
    +	fp = funopen(ms, NULL, memstream_write, memstream_seek,
    +	    memstream_close);
    +	if (fp == NULL) {
    +		save_errno = errno;
    +		free(ms);
    +		free(*bufp);
    +		*bufp = NULL;
    +		errno = save_errno;
    +		return (NULL);
    +	}
    +	fwide(fp, -1);
    +	return (fp);
    +}
    
    Added: head/lib/libc/stdio/open_wmemstream.c
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/lib/libc/stdio/open_wmemstream.c	Wed Feb 27 19:50:46 2013	(r247411)
    @@ -0,0 +1,271 @@
    +/*-
    + * Copyright (c) 2013 Advanced Computing Technologies LLC
    + * Written by: John H. Baldwin 
    + * 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 "namespace.h"
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include "un-namespace.h"
    +
    +/* XXX: There is no FPOS_MAX.  This assumes fpos_t is an off_t. */
    +#define	FPOS_MAX	OFF_MAX
    +
    +struct wmemstream {
    +	wchar_t **bufp;
    +	size_t *sizep;
    +	ssize_t len;
    +	fpos_t offset;
    +	mbstate_t mbstate;
    +};
    +
    +static int
    +wmemstream_grow(struct wmemstream *ms, fpos_t newoff)
    +{
    +	wchar_t *buf;
    +	ssize_t newsize;
    +
    +	if (newoff < 0 || newoff >= SSIZE_MAX / sizeof(wchar_t))
    +		newsize = SSIZE_MAX / sizeof(wchar_t) - 1;
    +	else
    +		newsize = newoff;
    +	if (newsize > ms->len) {
    +		buf = realloc(*ms->bufp, (newsize + 1) * sizeof(wchar_t));
    +		if (buf != NULL) {
    +#ifdef DEBUG
    +			fprintf(stderr, "WMS: %p growing from %zd to %zd\n",
    +			    ms, ms->len, newsize);
    +#endif
    +			wmemset(buf + ms->len + 1, 0, newsize - ms->len);
    +			*ms->bufp = buf;
    +			ms->len = newsize;
    +			return (1);
    +		}
    +		return (0);
    +	}
    +	return (1);
    +}
    +
    +static void
    +wmemstream_update(struct wmemstream *ms)
    +{
    +
    +	assert(ms->len >= 0 && ms->offset >= 0);
    +	*ms->sizep = ms->len < ms->offset ? ms->len : ms->offset;
    +}
    +
    +/*
    + * Based on a starting multibyte state and an input buffer, determine
    + * how many wchar_t's would be output.  This doesn't use mbsnrtowcs()
    + * so that it can handle embedded null characters.
    + */
    +static size_t
    +wbuflen(const mbstate_t *state, const char *buf, int len)
    +{
    +	mbstate_t lenstate;
    +	size_t charlen, count;
    +
    +	count = 0;
    +	lenstate = *state;
    +	while (len > 0) {
    +		charlen = mbrlen(buf, len, &lenstate);
    +		if (charlen == (size_t)-1)
    +			return (-1);
    +		if (charlen == (size_t)-2)
    +			break;
    +		if (charlen == 0)
    +			/* XXX: Not sure how else to handle this. */
    +			charlen = 1;
    +		len -= charlen;
    +		buf += charlen;
    +		count++;
    +	}
    +	return (count);
    +}
    +
    +static int
    +wmemstream_write(void *cookie, const char *buf, int len)
    +{
    +	struct wmemstream *ms;
    +	ssize_t consumed, wlen;
    +	size_t charlen;
    +
    +	ms = cookie;
    +	wlen = wbuflen(&ms->mbstate, buf, len);
    +	if (wlen < 0) {
    +		errno = EILSEQ;
    +		return (-1);
    +	}
    +	if (!wmemstream_grow(ms, ms->offset + wlen))
    +		return (-1);
    +
    +	/*
    +	 * This copies characters one at a time rather than using
    +	 * mbsnrtowcs() so it can properly handle embedded null
    +	 * characters.
    +	 */
    +	consumed = 0;
    +	while (len > 0 && ms->offset < ms->len) {
    +		charlen = mbrtowc(*ms->bufp + ms->offset, buf, len,
    +		    &ms->mbstate);
    +		if (charlen == (size_t)-1) {
    +			if (consumed == 0) {
    +				errno = EILSEQ;
    +				return (-1);
    +			}
    +			/* Treat it as a successful short write. */
    +			break;
    +		}
    +		if (charlen == 0)
    +			/* XXX: Not sure how else to handle this. */
    +			charlen = 1;
    +		if (charlen == (size_t)-2) {
    +			consumed += len;
    +			len = 0;
    +		} else {
    +			consumed += charlen;
    +			buf += charlen;
    +			len -= charlen;
    +			ms->offset++;
    +		}
    +	}
    +	wmemstream_update(ms);
    +#ifdef DEBUG
    +	fprintf(stderr, "WMS: write(%p, %d) = %zd\n", ms, len, consumed);
    +#endif
    +	return (consumed);
    +}
    +
    +static fpos_t
    +wmemstream_seek(void *cookie, fpos_t pos, int whence)
    +{
    +	struct wmemstream *ms;
    +	fpos_t old;
    +
    +	ms = cookie;
    +	old = ms->offset;
    +	switch (whence) {
    +	case SEEK_SET:
    +		/* _fseeko() checks for negative offsets. */
    +		assert(pos >= 0);
    +		ms->offset = pos;
    +		break;
    +	case SEEK_CUR:
    +		/* This is only called by _ftello(). */
    +		assert(pos == 0);
    +		break;
    +	case SEEK_END:
    +		if (pos < 0) {
    +			if (pos + ms->len < 0) {
    +#ifdef DEBUG
    +				fprintf(stderr,
    +				    "WMS: bad SEEK_END: pos %jd, len %zd\n",
    +				    (intmax_t)pos, ms->len);
    +#endif
    +				errno = EINVAL;
    +				return (-1);
    +			}
    +		} else {
    +			if (FPOS_MAX - ms->len < pos) {
    +#ifdef DEBUG
    +				fprintf(stderr,
    +				    "WMS: bad SEEK_END: pos %jd, len %zd\n",
    +				    (intmax_t)pos, ms->len);
    +#endif
    +				errno = EOVERFLOW;
    +				return (-1);
    +			}
    +		}
    +		ms->offset = ms->len + pos;
    +		break;
    +	}
    +	/* Reset the multibyte state if a seek changes the position. */
    +	if (ms->offset != old)
    +		memset(&ms->mbstate, 0, sizeof(ms->mbstate));
    +	wmemstream_update(ms);
    +#ifdef DEBUG
    +	fprintf(stderr, "WMS: seek(%p, %jd, %d) %jd -> %jd\n", ms,
    +	    (intmax_t)pos, whence, (intmax_t)old, (intmax_t)ms->offset);
    +#endif
    +	return (ms->offset);
    +}
    +
    +static int
    +wmemstream_close(void *cookie)
    +{
    +
    +	free(cookie);
    +	return (0);
    +}
    +
    +FILE *
    +open_wmemstream(wchar_t **bufp, size_t *sizep)
    +{
    +	struct wmemstream *ms;
    +	int save_errno;
    +	FILE *fp;
    +
    +	if (bufp == NULL || sizep == NULL) {
    +		errno = EINVAL;
    +		return (NULL);
    +	}
    +	*bufp = calloc(1, sizeof(wchar_t));
    +	if (*bufp == NULL)
    +		return (NULL);
    +	ms = malloc(sizeof(*ms));
    +	if (ms == NULL) {
    +		save_errno = errno;
    +		free(*bufp);
    +		*bufp = NULL;
    +		errno = save_errno;
    +		return (NULL);
    +	}
    +	ms->bufp = bufp;
    +	ms->sizep = sizep;
    +	ms->len = 0;
    +	ms->offset = 0;
    +	memset(&ms->mbstate, 0, sizeof(mbstate_t));
    +	wmemstream_update(ms);
    +	fp = funopen(ms, NULL, wmemstream_write, wmemstream_seek,
    +	    wmemstream_close);
    +	if (fp == NULL) {
    +		save_errno = errno;
    +		free(ms);
    +		free(*bufp);
    +		*bufp = NULL;
    +		errno = save_errno;
    +		return (NULL);
    +	}
    +	fwide(fp, 1);
    +	return (fp);
    +}
    
    Modified: head/tools/regression/lib/libc/stdio/Makefile
    ==============================================================================
    --- head/tools/regression/lib/libc/stdio/Makefile	Wed Feb 27 19:49:14 2013	(r247410)
    +++ head/tools/regression/lib/libc/stdio/Makefile	Wed Feb 27 19:50:46 2013	(r247411)
    @@ -1,6 +1,8 @@
     # $FreeBSD$
     
    -TESTS=	test-getdelim test-perror test-print-positional test-printbasic test-printfloat test-scanfloat
    +TESTS=	test-fmemopen test-getdelim test-open_memstream test-open_wmemstream \
    +	test-perror test-print-positional test-printbasic test-printfloat \
    +	test-scanfloat 
     CFLAGS+= -lm
     
     .PHONY: tests
    
    Added: head/tools/regression/lib/libc/stdio/test-open_memstream.c
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/tools/regression/lib/libc/stdio/test-open_memstream.c	Wed Feb 27 19:50:46 2013	(r247411)
    @@ -0,0 +1,203 @@
    +/*-
    + * Copyright (c) 2013 Advanced Computing Technologies LLC
    + * Written by: John H. Baldwin 
    + * 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 
    +
    +static char *buf;
    +static size_t len;
    +
    +static void
    +assert_stream(const char *contents)
    +{
    +	if (strlen(contents) != len)
    +		printf("bad length %zd for \"%s\"\n", len, contents);
    +	else if (strncmp(buf, contents, strlen(contents)) != 0)
    +		printf("bad buffer \"%s\" for \"%s\"\n", buf, contents);
    +}
    +
    +static void
    +open_group_test(void)
    +{
    +	FILE *fp;
    +	off_t eob;
    +
    +	fp = open_memstream(&buf, &len);
    +	if (fp == NULL)
    +		err(1, "failed to open stream");
    +
    +	fprintf(fp, "hello my world");
    +	fflush(fp);
    +	assert_stream("hello my world");
    +	eob = ftello(fp);
    +	rewind(fp);
    +	fprintf(fp, "good-bye");
    +	fseeko(fp, eob, SEEK_SET);
    +	fclose(fp);
    +	assert_stream("good-bye world");
    +	free(buf);
    +}
    +
    +static void
    +simple_tests(void)
    +{
    +	static const char zerobuf[] =
    +	    { 'f', 'o', 'o', 0, 0, 0, 0, 'b', 'a', 'r', 0 };
    +	char c;
    +	FILE *fp;
    +
    +	fp = open_memstream(&buf, NULL);
    +	if (fp != NULL)
    +		errx(1, "did not fail to open stream");
    +	else if (errno != EINVAL)
    +		err(1, "incorrect error for bad length pointer");
    +	fp = open_memstream(NULL, &len);
    +	if (fp != NULL)
    +		errx(1, "did not fail to open stream");
    +	else if (errno != EINVAL)
    +		err(1, "incorrect error for bad buffer pointer");
    +	fp = open_memstream(&buf, &len);
    +	if (fp == NULL)
    +		err(1, "failed to open stream");
    +	fflush(fp);
    +	assert_stream("");
    +	if (fwide(fp, 0) >= 0)
    +		printf("stream is not byte-oriented\n");
    +
    +	fprintf(fp, "fo");
    +	fflush(fp);
    +	assert_stream("fo");
    +	fputc('o', fp);
    +	fflush(fp);
    +	assert_stream("foo");
    +	rewind(fp);
    +	fflush(fp);
    +	assert_stream("");
    +	fseek(fp, 0, SEEK_END);
    +	fflush(fp);
    +	assert_stream("foo");
    +
    +	/*
    +	 * Test seeking out past the current end.  Should zero-fill the
    +	 * intermediate area.
    +	 */
    +	fseek(fp, 4, SEEK_END);
    +	fprintf(fp, "bar");
    +	fflush(fp);
    +
    +	/*
    +	 * Can't use assert_stream() here since this should contain
    +	 * embedded null characters.
    +	 */
    +	if (len != 10)
    +		printf("bad length %zd for zero-fill test\n", len);
    +	else if (memcmp(buf, zerobuf, sizeof(zerobuf)) != 0)
    +		printf("bad buffer for zero-fill test\n");
    +
    +	fseek(fp, 3, SEEK_SET);
    +	fprintf(fp, " in ");
    +	fflush(fp);
    +	assert_stream("foo in ");
    +	fseek(fp, 0, SEEK_END);
    +	fflush(fp);
    +	assert_stream("foo in bar");
    +
    +	rewind(fp);
    +	if (fread(&c, sizeof(c), 1, fp) != 0)
    +		printf("fread did not fail\n");
    +	else if (!ferror(fp))
    +		printf("error indicator not set after fread\n");
    +	else
    +		clearerr(fp);
    +
    +	fseek(fp, 4, SEEK_SET);
    +	fprintf(fp, "bar baz");
    +	fclose(fp);
    +	assert_stream("foo bar baz");
    +	free(buf);
    +}
    +
    +static void
    +seek_tests(void)
    +{
    +	FILE *fp;
    +
    +	fp = open_memstream(&buf, &len);
    +	if (fp == NULL)
    +		err(1, "failed to open stream");
    +#define SEEK_FAIL(offset, whence, error) do {				\
    +	errno = 0;							\
    +	if (fseeko(fp, (offset), (whence)) == 0)			\
    +		printf("fseeko(%s, %s) did not fail, set pos to %jd\n",	\
    +		    __STRING(offset), __STRING(whence),			\
    +		    (intmax_t)ftello(fp));				\
    +	else if (errno != (error))					\
    +		printf("fseeko(%s, %s) failed with %d rather than %s\n",\
    +		    __STRING(offset), __STRING(whence),	errno,		\
    +		    __STRING(error));					\
    +} while (0)
    +
    +#define SEEK_OK(offset, whence, result) do {				\
    +	if (fseeko(fp, (offset), (whence)) != 0)			\
    +		printf("fseeko(%s, %s) failed: %s\n",			\
    +		    __STRING(offset), __STRING(whence),	strerror(errno)); \
    +	else if (ftello(fp) != (result))				\
    +		printf("fseeko(%s, %s) seeked to %jd rather than %s\n",	\
    +		    __STRING(offset), __STRING(whence),			\
    +		    (intmax_t)ftello(fp), __STRING(result));		\
    +} while (0)
    +
    +	SEEK_FAIL(-1, SEEK_SET, EINVAL);
    +	SEEK_FAIL(-1, SEEK_CUR, EINVAL);
    +	SEEK_FAIL(-1, SEEK_END, EINVAL);
    +	fprintf(fp, "foo");
    +	SEEK_OK(-1, SEEK_CUR, 2);
    +	SEEK_OK(0, SEEK_SET, 0);
    +	SEEK_OK(-1, SEEK_END, 2);
    +	SEEK_OK(OFF_MAX - 1, SEEK_SET, OFF_MAX - 1);
    +	SEEK_FAIL(2, SEEK_CUR, EOVERFLOW);
    +	fclose(fp);
    +}
    +
    +int
    +main(int ac, char **av)
    +{
    +
    +	open_group_test();
    +	simple_tests();
    +	seek_tests();
    +	return (0);
    +}
    
    Added: head/tools/regression/lib/libc/stdio/test-open_memstream.t
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/tools/regression/lib/libc/stdio/test-open_memstream.t	Wed Feb 27 19:50:46 2013	(r247411)
    @@ -0,0 +1,10 @@
    +#!/bin/sh
    +# $FreeBSD$
    +
    +cd `dirname $0`
    +
    +executable=`basename $0 .t`
    +
    +make $executable 2>&1 > /dev/null
    +
    +exec ./$executable
    
    Added: head/tools/regression/lib/libc/stdio/test-open_wmemstream.c
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/tools/regression/lib/libc/stdio/test-open_wmemstream.c	Wed Feb 27 19:50:46 2013	(r247411)
    @@ -0,0 +1,203 @@
    +/*-
    + * Copyright (c) 2013 Advanced Computing Technologies LLC
    + * Written by: John H. Baldwin 
    + * 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 
    +
    +static wchar_t *buf;
    +static size_t len;
    +
    +static void
    +assert_stream(const wchar_t *contents)
    +{
    +	if (wcslen(contents) != len)
    +		printf("bad length %zd for \"%ls\"\n", len, contents);
    +	else if (wcsncmp(buf, contents, wcslen(contents)) != 0)
    +		printf("bad buffer \"%ls\" for \"%ls\"\n", buf, contents);
    +}
    +
    +static void
    +open_group_test(void)
    +{
    +	FILE *fp;
    +	off_t eob;
    +
    +	fp = open_wmemstream(&buf, &len);
    +	if (fp == NULL)
    +		err(1, "failed to open stream");
    +
    +	fwprintf(fp, L"hello my world");
    +	fflush(fp);
    +	assert_stream(L"hello my world");
    +	eob = ftello(fp);
    
    *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 19:51:47 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id CA7ED7AE;
     Wed, 27 Feb 2013 19:51:47 +0000 (UTC)
     (envelope-from tuexen@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id BBC9FA87;
     Wed, 27 Feb 2013 19:51:47 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1RJpl0N081830;
     Wed, 27 Feb 2013 19:51:47 GMT (envelope-from tuexen@svn.freebsd.org)
    Received: (from tuexen@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1RJplnB081829;
     Wed, 27 Feb 2013 19:51:47 GMT (envelope-from tuexen@svn.freebsd.org)
    Message-Id: <201302271951.r1RJplnB081829@svn.freebsd.org>
    From: Michael Tuexen 
    Date: Wed, 27 Feb 2013 19:51:47 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247412 - head/sys/netinet
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 19:51:47 -0000
    
    Author: tuexen
    Date: Wed Feb 27 19:51:47 2013
    New Revision: 247412
    URL: http://svnweb.freebsd.org/changeset/base/247412
    
    Log:
      Fix a potential race in returning setting errno when an
      association goes down.
      Reported by Mozilla in
      https://bugzilla.mozilla.org/show_bug.cgi?id=845513
      
      MFC after: 3 days
    
    Modified:
      head/sys/netinet/sctputil.c
    
    Modified: head/sys/netinet/sctputil.c
    ==============================================================================
    --- head/sys/netinet/sctputil.c	Wed Feb 27 19:50:46 2013	(r247411)
    +++ head/sys/netinet/sctputil.c	Wed Feb 27 19:51:47 2013	(r247412)
    @@ -2678,6 +2678,7 @@ set_error:
     	if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
     	    (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) &&
     	    ((state == SCTP_COMM_LOST) || (state == SCTP_CANT_STR_ASSOC))) {
    +		SOCK_LOCK(stcb->sctp_socket);
     		if (from_peer) {
     			if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_WAIT) {
     				SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ECONNREFUSED);
    @@ -2709,7 +2710,7 @@ set_error:
     	if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
     	    (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) &&
     	    ((state == SCTP_COMM_LOST) || (state == SCTP_CANT_STR_ASSOC))) {
    -		socantrcvmore(stcb->sctp_socket);
    +		socantrcvmore_locked(stcb->sctp_socket);
     	}
     	sorwakeup(stcb->sctp_socket);
     	sowwakeup(stcb->sctp_socket);
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 19:59:42 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 2F0C3ADE;
     Wed, 27 Feb 2013 19:59:42 +0000 (UTC) (envelope-from ian@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 21143AF4;
     Wed, 27 Feb 2013 19:59:42 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1RJxgdS082986;
     Wed, 27 Feb 2013 19:59:42 GMT (envelope-from ian@svn.freebsd.org)
    Received: (from ian@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1RJxg7i082985;
     Wed, 27 Feb 2013 19:59:42 GMT (envelope-from ian@svn.freebsd.org)
    Message-Id: <201302271959.r1RJxg7i082985@svn.freebsd.org>
    From: Ian Lepore 
    Date: Wed, 27 Feb 2013 19:59:41 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247413 - head/sys/boot/common
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 19:59:42 -0000
    
    Author: ian
    Date: Wed Feb 27 19:59:41 2013
    New Revision: 247413
    URL: http://svnweb.freebsd.org/changeset/base/247413
    
    Log:
      Fix a typo that prevented booting a kernel that had virtual addresses in
      the elf headers.
    
    Modified:
      head/sys/boot/common/load_elf.c
    
    Modified: head/sys/boot/common/load_elf.c
    ==============================================================================
    --- head/sys/boot/common/load_elf.c	Wed Feb 27 19:51:47 2013	(r247412)
    +++ head/sys/boot/common/load_elf.c	Wed Feb 27 19:59:41 2013	(r247413)
    @@ -304,7 +304,7 @@ __elfN(loadimage)(struct preloaded_file 
     	 * only adjust the entry point if it's a virtual address to begin with.
     	 */
     	off = -0xc0000000u;
    -	if ((ehdr->e_entry & 0xc0000000u) == 0xc000000u)
    +	if ((ehdr->e_entry & 0xc0000000u) == 0xc0000000u)
     		ehdr->e_entry += off;
     #ifdef ELF_VERBOSE
     	printf("ehdr->e_entry 0x%08x, va<->pa off %llx\n", ehdr->e_entry, off);
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 19:59:59 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 373D3C54;
     Wed, 27 Feb 2013 19:59:59 +0000 (UTC) (envelope-from jmg@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 2919FAFD;
     Wed, 27 Feb 2013 19:59:59 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1RJxx7q083068;
     Wed, 27 Feb 2013 19:59:59 GMT (envelope-from jmg@svn.freebsd.org)
    Received: (from jmg@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1RJxxJ5083067;
     Wed, 27 Feb 2013 19:59:59 GMT (envelope-from jmg@svn.freebsd.org)
    Message-Id: <201302271959.r1RJxxJ5083067@svn.freebsd.org>
    From: John-Mark Gurney 
    Date: Wed, 27 Feb 2013 19:59:59 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247414 - head/tools/test/iconv/tablegen
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 19:59:59 -0000
    
    Author: jmg
    Date: Wed Feb 27 19:59:58 2013
    New Revision: 247414
    URL: http://svnweb.freebsd.org/changeset/base/247414
    
    Log:
      fix this script so we don't expand the second $FreeBSD since svn thinks
      the $ in $1 ends the keyword, and expands it...
    
    Modified:
      head/tools/test/iconv/tablegen/cmp.sh
    
    Modified: head/tools/test/iconv/tablegen/cmp.sh
    ==============================================================================
    --- head/tools/test/iconv/tablegen/cmp.sh	Wed Feb 27 19:59:41 2013	(r247413)
    +++ head/tools/test/iconv/tablegen/cmp.sh	Wed Feb 27 19:59:58 2013	(r247414)
    @@ -1,4 +1,4 @@
     #!/bin/sh
     # $FreeBSD$
     
    -diff -I\$FreeBSD$1 $2 | grep '^-' >/dev/null && printf "\tDIFFER: $1 $2\n" && exit 0 || exit 0
    +diff -I\$\FreeBSD $1 $2 | grep '^-' >/dev/null && printf "\tDIFFER: $1 $2\n" && exit 0 || exit 0
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 20:09:25 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id BF764295;
     Wed, 27 Feb 2013 20:09:25 +0000 (UTC)
     (envelope-from joel@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id B150BC1C;
     Wed, 27 Feb 2013 20:09:25 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1RK9Pfu086460;
     Wed, 27 Feb 2013 20:09:25 GMT (envelope-from joel@svn.freebsd.org)
    Received: (from joel@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1RK9PVV086458;
     Wed, 27 Feb 2013 20:09:25 GMT (envelope-from joel@svn.freebsd.org)
    Message-Id: <201302272009.r1RK9PVV086458@svn.freebsd.org>
    From: Joel Dahl 
    Date: Wed, 27 Feb 2013 20:09:25 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247415 - head/lib/libc/stdio
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 20:09:25 -0000
    
    Author: joel (doc committer)
    Date: Wed Feb 27 20:09:25 2013
    New Revision: 247415
    URL: http://svnweb.freebsd.org/changeset/base/247415
    
    Log:
      mdoc: add missing El.
    
    Modified:
      head/lib/libc/stdio/open_memstream.3
    
    Modified: head/lib/libc/stdio/open_memstream.3
    ==============================================================================
    --- head/lib/libc/stdio/open_memstream.3	Wed Feb 27 19:59:58 2013	(r247414)
    +++ head/lib/libc/stdio/open_memstream.3	Wed Feb 27 20:09:25 2013	(r247415)
    @@ -137,6 +137,7 @@ argument was
     .Dv NULL .
     .It Bq Er ENOMEM
     Memory for the stream or buffer could not be allocated.
    +.El
     .Sh SEE ALSO
     .Xr fclose 3 ,
     .Xr fflush 3 ,
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 20:15:07 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 346FC598;
     Wed, 27 Feb 2013 20:15:07 +0000 (UTC)
     (envelope-from joel@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 26185CDB;
     Wed, 27 Feb 2013 20:15:07 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1RKF7Qp089073;
     Wed, 27 Feb 2013 20:15:07 GMT (envelope-from joel@svn.freebsd.org)
    Received: (from joel@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1RKF7ac089072;
     Wed, 27 Feb 2013 20:15:07 GMT (envelope-from joel@svn.freebsd.org)
    Message-Id: <201302272015.r1RKF7ac089072@svn.freebsd.org>
    From: Joel Dahl 
    Date: Wed, 27 Feb 2013 20:15:06 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247416 - head/usr.sbin/watchdogd
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 20:15:07 -0000
    
    Author: joel (doc committer)
    Date: Wed Feb 27 20:15:06 2013
    New Revision: 247416
    URL: http://svnweb.freebsd.org/changeset/base/247416
    
    Log:
      mdoc: begin sentence on new line.
    
    Modified:
      head/usr.sbin/watchdogd/watchdogd.8
    
    Modified: head/usr.sbin/watchdogd/watchdogd.8
    ==============================================================================
    --- head/usr.sbin/watchdogd/watchdogd.8	Wed Feb 27 20:09:25 2013	(r247415)
    +++ head/usr.sbin/watchdogd/watchdogd.8	Wed Feb 27 20:15:06 2013	(r247416)
    @@ -132,23 +132,27 @@ This flag will cause watchdogd to compla
     execute the watchdog script exceeds the threshold of 'sleep' option.
     .Pp
     .It Fl -pretimeout Ar timeout
    -Set a "pretimeout" watchdog.  At "timeout" seconds before the watchdog
    -will fire attempt an action.  The action is set by the --pretimeout-action
    -flag.  The default is just to log a message (WD_SOFT_LOG) via
    +Set a "pretimeout" watchdog.
    +At "timeout" seconds before the watchdog will fire attempt an action.
    +The action is set by the --pretimeout-action flag.
    +The default is just to log a message (WD_SOFT_LOG) via
     .Xr log 9 .
     .Pp
     .It Fl -pretimeout-action Ar action
    -Set the timeout action for the pretimeout.  See the section 
    +Set the timeout action for the pretimeout.
    +See the section 
     .Sx Timeout Actions .
     .Pp
     .It Fl -softtimeout
     Instead of arming the various hardware watchdogs, only use a basic software
    -watchdog.  The default action is just to
    +watchdog.
    +The default action is just to
     .Xr log 9
     a message (WD_SOFT_LOG).
     .Pp
     .It Fl -softtimeout-action Ar action
    -Set the timeout action for the softtimeout.  See the section 
    +Set the timeout action for the softtimeout.
    +See the section 
     .Sx Timeout Actions .
     .Pp
     .El
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 20:16:31 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 4A3ED723;
     Wed, 27 Feb 2013 20:16:31 +0000 (UTC)
     (envelope-from joel@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 32284CEE;
     Wed, 27 Feb 2013 20:16:31 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1RKGV4R089290;
     Wed, 27 Feb 2013 20:16:31 GMT (envelope-from joel@svn.freebsd.org)
    Received: (from joel@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1RKGV48089289;
     Wed, 27 Feb 2013 20:16:31 GMT (envelope-from joel@svn.freebsd.org)
    Message-Id: <201302272016.r1RKGV48089289@svn.freebsd.org>
    From: Joel Dahl 
    Date: Wed, 27 Feb 2013 20:16:31 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247417 - head/usr.sbin/watchdogd
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 20:16:31 -0000
    
    Author: joel (doc committer)
    Date: Wed Feb 27 20:16:30 2013
    New Revision: 247417
    URL: http://svnweb.freebsd.org/changeset/base/247417
    
    Log:
      Remove EOL whitespace.
    
    Modified:
      head/usr.sbin/watchdogd/watchdogd.8
    
    Modified: head/usr.sbin/watchdogd/watchdogd.8
    ==============================================================================
    --- head/usr.sbin/watchdogd/watchdogd.8	Wed Feb 27 20:15:06 2013	(r247416)
    +++ head/usr.sbin/watchdogd/watchdogd.8	Wed Feb 27 20:16:30 2013	(r247417)
    @@ -100,7 +100,7 @@ that its script has run for too long.
     If unset
     .Ar script_timeout
     defaults to the value specified by the
    -.Fl s Ar sleep 
    +.Fl s Ar sleep
     option.
     .Pp
     Upon receiving the
    @@ -140,7 +140,7 @@ The default is just to log a message (WD
     .Pp
     .It Fl -pretimeout-action Ar action
     Set the timeout action for the pretimeout.
    -See the section 
    +See the section
     .Sx Timeout Actions .
     .Pp
     .It Fl -softtimeout
    @@ -152,7 +152,7 @@ a message (WD_SOFT_LOG).
     .Pp
     .It Fl -softtimeout-action Ar action
     Set the timeout action for the softtimeout.
    -See the section 
    +See the section
     .Sx Timeout Actions .
     .Pp
     .El
    @@ -179,7 +179,7 @@ Log a message using
     when the timeout is reached.
     .Pp
     .It Ar printf
    -call the kernel 
    +call the kernel
     .Xr printf 9
     to display a message to the console and
     .Xr dmesg 8
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 21:58:07 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 1B625725;
     Wed, 27 Feb 2013 21:58:07 +0000 (UTC)
     (envelope-from delphij@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 0C50A2FC;
     Wed, 27 Feb 2013 21:58:07 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1RLw6sY019515;
     Wed, 27 Feb 2013 21:58:06 GMT (envelope-from delphij@svn.freebsd.org)
    Received: (from delphij@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1RLw6Jp019514;
     Wed, 27 Feb 2013 21:58:06 GMT (envelope-from delphij@svn.freebsd.org)
    Message-Id: <201302272158.r1RLw6Jp019514@svn.freebsd.org>
    From: Xin LI 
    Date: Wed, 27 Feb 2013 21:58:06 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247422 - head
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 21:58:07 -0000
    
    Author: delphij
    Date: Wed Feb 27 21:58:06 2013
    New Revision: 247422
    URL: http://svnweb.freebsd.org/changeset/base/247422
    
    Log:
      Add a reminder that the user should update boot block if they are upgrading
      their existing system and use LZ4 compression for ZFS.
      
      Suggested by:	mm
      MFC after:	3 days
    
    Modified:
      head/UPDATING
    
    Modified: head/UPDATING
    ==============================================================================
    --- head/UPDATING	Wed Feb 27 21:03:19 2013	(r247421)
    +++ head/UPDATING	Wed Feb 27 21:58:06 2013	(r247422)
    @@ -26,6 +26,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
     	disable the most expensive debugging functionality run
     	"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
     
    +20130208:
    +	A new compression method (lz4) has been merged to -HEAD.  Please
    +	refer to zpool-features(7) for more information.
    +
    +	Please refer to the "ZFS notes" section of this file for information
    +	on upgrading boot ZFS pools.
    +
     20130129:
     	A BSD-licensed patch(1) variant has been added and is installed
     	as bsdpatch, being the GNU version the default patch.
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 23:17:46 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 6D5E45B1;
     Wed, 27 Feb 2013 23:17:46 +0000 (UTC) (envelope-from smh@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 3DD869AE;
     Wed, 27 Feb 2013 23:17:46 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1RNHkgx044103;
     Wed, 27 Feb 2013 23:17:46 GMT (envelope-from smh@svn.freebsd.org)
    Received: (from smh@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1RNHk1m044102;
     Wed, 27 Feb 2013 23:17:46 GMT (envelope-from smh@svn.freebsd.org)
    Message-Id: <201302272317.r1RNHk1m044102@svn.freebsd.org>
    From: Steven Hartland 
    Date: Wed, 27 Feb 2013 23:17:46 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247426 - head/sys/dev/mfi
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 23:17:46 -0000
    
    Author: smh
    Date: Wed Feb 27 23:17:45 2013
    New Revision: 247426
    URL: http://svnweb.freebsd.org/changeset/base/247426
    
    Log:
      Adds hw.mfi.cmd_timeout loader / sysctl tuneable which controls the default
      timeout used in the mfi driver. This is useful for long running commands
      such as secure erase.
      
      Reviewed by:	John Baldwin
      Approved by:	pjd (mentor)
    
    Modified:
      head/sys/dev/mfi/mfi.c
    
    Modified: head/sys/dev/mfi/mfi.c
    ==============================================================================
    --- head/sys/dev/mfi/mfi.c	Wed Feb 27 23:02:47 2013	(r247425)
    +++ head/sys/dev/mfi/mfi.c	Wed Feb 27 23:17:45 2013	(r247426)
    @@ -157,6 +157,11 @@ SYSCTL_INT(_hw_mfi, OID_AUTO, polled_cmd
     	   &mfi_polled_cmd_timeout, 0,
     	   "Polled command timeout - used for firmware flash etc (in seconds)");
     
    +static int	mfi_cmd_timeout = MFI_CMD_TIMEOUT;
    +TUNABLE_INT("hw.mfi.cmd_timeout", &mfi_cmd_timeout);
    +SYSCTL_INT(_hw_mfi, OID_AUTO, cmd_timeout, CTLFLAG_RWTUN, &mfi_cmd_timeout,
    +	   0, "Command timeout (in seconds)");
    +
     /* Management interface */
     static d_open_t		mfi_open;
     static d_close_t	mfi_close;
    @@ -782,7 +787,7 @@ mfi_attach(struct mfi_softc *sc)
     
     	/* Start the timeout watchdog */
     	callout_init(&sc->mfi_watchdog_callout, CALLOUT_MPSAFE);
    -	callout_reset(&sc->mfi_watchdog_callout, MFI_CMD_TIMEOUT * hz,
    +	callout_reset(&sc->mfi_watchdog_callout, mfi_cmd_timeout * hz,
     	    mfi_timeout, sc);
     
     	if (sc->mfi_flags & MFI_FLAGS_TBOLT) {
    @@ -3714,7 +3719,7 @@ mfi_dump_all(void)
     			break;
     		device_printf(sc->mfi_dev, "Dumping\n\n");
     		timedout = 0;
    -		deadline = time_uptime - MFI_CMD_TIMEOUT;
    +		deadline = time_uptime - mfi_cmd_timeout;
     		mtx_lock(&sc->mfi_io_lock);
     		TAILQ_FOREACH(cm, &sc->mfi_busy, cm_link) {
     			if (cm->cm_timestamp <= deadline) {
    @@ -3745,10 +3750,11 @@ mfi_timeout(void *data)
     	time_t deadline;
     	int timedout = 0;
     
    -	deadline = time_uptime - MFI_CMD_TIMEOUT;
    +	deadline = time_uptime - mfi_cmd_timeout;
     	if (sc->adpreset == 0) {
     		if (!mfi_tbolt_reset(sc)) {
    -			callout_reset(&sc->mfi_watchdog_callout, MFI_CMD_TIMEOUT * hz, mfi_timeout, sc);
    +			callout_reset(&sc->mfi_watchdog_callout,
    +			    mfi_cmd_timeout * hz, mfi_timeout, sc);
     			return;
     		}
     	}
    @@ -3785,7 +3791,7 @@ mfi_timeout(void *data)
     
     	mtx_unlock(&sc->mfi_io_lock);
     
    -	callout_reset(&sc->mfi_watchdog_callout, MFI_CMD_TIMEOUT * hz,
    +	callout_reset(&sc->mfi_watchdog_callout, mfi_cmd_timeout * hz,
     	    mfi_timeout, sc);
     
     	if (0)
    
    From owner-svn-src-head@FreeBSD.ORG  Wed Feb 27 23:23:27 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 02760875;
     Wed, 27 Feb 2013 23:23:27 +0000 (UTC)
     (envelope-from doconnor@gsoft.com.au)
    Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10])
     by mx1.freebsd.org (Postfix) with ESMTP id 7B59B9FA;
     Wed, 27 Feb 2013 23:23:26 +0000 (UTC)
    Received: from ur.gsoft.com.au (Ur.gsoft.com.au [203.31.81.55])
     (authenticated bits=0)
     by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id r1RNN2p0084711
     (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO);
     Thu, 28 Feb 2013 09:53:07 +1030 (CST)
     (envelope-from doconnor@gsoft.com.au)
    Subject: Re: svn commit: r247359 - head/sbin/reboot
    Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\))
    Content-Type: text/plain; charset=us-ascii
    From: "Daniel O'Connor" 
    In-Reply-To: <201302271138.24452.jhb@freebsd.org>
    Date: Thu, 28 Feb 2013 09:53:02 +1030
    Content-Transfer-Encoding: quoted-printable
    Message-Id: <4602D40D-C4B2-4FB5-8E3B-8D74E19118FD@gsoft.com.au>
    References: <201302262318.r1QNIauL003863@svn.freebsd.org>
     <201302271138.24452.jhb@freebsd.org>
    To: John Baldwin 
    X-Mailer: Apple Mail (2.1499)
    X-Spam-Score: -3.051 () ALL_TRUSTED,BAYES_00,RP_MATCHES_RCVD
    X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10
    Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
     src-committers@freebsd.org, Nick Hibma 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 23:23:27 -0000
    
    
    On 28/02/2013, at 3:08, John Baldwin  wrote:
    >> URL: http://svnweb.freebsd.org/changeset/base/247359
    >>=20
    >> Log:
    >>  Clarify that overriding the -h/-D flags through flags in =
    device.hints
    >>  only works for sio(4) but not for uart(4) which no longer has this =
    flag.
    >=20
    > You should probably just remove the flag entirely.  sio(4) doesn't =
    build on=20
    > 8.x and later.
    
    
    The handbook will need fixing too since it mentions sio(4) and -D/-h.
    
    --
    Daniel O'Connor software and network engineer
    for Genesis Software - http://www.gsoft.com.au
    "The nice thing about standards is that there
    are so many of them to choose from."
      -- Andrew Tanenbaum
    GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
    
    
    
    
    
    
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 00:18:58 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 5453E3D0;
     Thu, 28 Feb 2013 00:18:58 +0000 (UTC)
     (envelope-from attilio@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 3AAABBF6;
     Thu, 28 Feb 2013 00:18:58 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1S0Iwhq062425;
     Thu, 28 Feb 2013 00:18:58 GMT (envelope-from attilio@svn.freebsd.org)
    Received: (from attilio@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1S0IuL0062417;
     Thu, 28 Feb 2013 00:18:56 GMT (envelope-from attilio@svn.freebsd.org)
    Message-Id: <201302280018.r1S0IuL0062417@svn.freebsd.org>
    From: Attilio Rao 
    Date: Thu, 28 Feb 2013 00:18:56 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247429 - in head/sys/arm: econa s3c2xx0 xscale/i80321
     xscale/i8134x xscale/ixp425 xscale/pxa
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 00:18:58 -0000
    
    Author: attilio
    Date: Thu Feb 28 00:18:56 2013
    New Revision: 247429
    URL: http://svnweb.freebsd.org/changeset/base/247429
    
    Log:
      Complete r247297:
      Remove unused inclusions of vm/vm_pager.h and vm/vnode_pager.h.
      
      Sponsored by:	EMC / Isilon storage division
    
    Modified:
      head/sys/arm/econa/econa_machdep.c
      head/sys/arm/s3c2xx0/s3c24x0_machdep.c
      head/sys/arm/xscale/i80321/ep80219_machdep.c
      head/sys/arm/xscale/i80321/iq31244_machdep.c
      head/sys/arm/xscale/i8134x/crb_machdep.c
      head/sys/arm/xscale/ixp425/avila_machdep.c
      head/sys/arm/xscale/pxa/pxa_machdep.c
    
    Modified: head/sys/arm/econa/econa_machdep.c
    ==============================================================================
    --- head/sys/arm/econa/econa_machdep.c	Thu Feb 28 00:14:59 2013	(r247428)
    +++ head/sys/arm/econa/econa_machdep.c	Thu Feb 28 00:18:56 2013	(r247429)
    @@ -67,9 +67,7 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    Modified: head/sys/arm/s3c2xx0/s3c24x0_machdep.c
    ==============================================================================
    --- head/sys/arm/s3c2xx0/s3c24x0_machdep.c	Thu Feb 28 00:14:59 2013	(r247428)
    +++ head/sys/arm/s3c2xx0/s3c24x0_machdep.c	Thu Feb 28 00:18:56 2013	(r247429)
    @@ -77,9 +77,7 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c
    ==============================================================================
    --- head/sys/arm/xscale/i80321/ep80219_machdep.c	Thu Feb 28 00:14:59 2013	(r247428)
    +++ head/sys/arm/xscale/i80321/ep80219_machdep.c	Thu Feb 28 00:18:56 2013	(r247429)
    @@ -77,9 +77,7 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    Modified: head/sys/arm/xscale/i80321/iq31244_machdep.c
    ==============================================================================
    --- head/sys/arm/xscale/i80321/iq31244_machdep.c	Thu Feb 28 00:14:59 2013	(r247428)
    +++ head/sys/arm/xscale/i80321/iq31244_machdep.c	Thu Feb 28 00:18:56 2013	(r247429)
    @@ -77,9 +77,7 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    Modified: head/sys/arm/xscale/i8134x/crb_machdep.c
    ==============================================================================
    --- head/sys/arm/xscale/i8134x/crb_machdep.c	Thu Feb 28 00:14:59 2013	(r247428)
    +++ head/sys/arm/xscale/i8134x/crb_machdep.c	Thu Feb 28 00:18:56 2013	(r247429)
    @@ -77,9 +77,7 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    Modified: head/sys/arm/xscale/ixp425/avila_machdep.c
    ==============================================================================
    --- head/sys/arm/xscale/ixp425/avila_machdep.c	Thu Feb 28 00:14:59 2013	(r247428)
    +++ head/sys/arm/xscale/ixp425/avila_machdep.c	Thu Feb 28 00:18:56 2013	(r247429)
    @@ -77,9 +77,7 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    Modified: head/sys/arm/xscale/pxa/pxa_machdep.c
    ==============================================================================
    --- head/sys/arm/xscale/pxa/pxa_machdep.c	Thu Feb 28 00:14:59 2013	(r247428)
    +++ head/sys/arm/xscale/pxa/pxa_machdep.c	Thu Feb 28 00:18:56 2013	(r247429)
    @@ -79,9 +79,7 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 01:00:33 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 6FF5CA3D;
     Thu, 28 Feb 2013 01:00:33 +0000 (UTC)
     (envelope-from neel@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 6256EE75;
     Thu, 28 Feb 2013 01:00:33 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1S10XmG075163;
     Thu, 28 Feb 2013 01:00:33 GMT (envelope-from neel@svn.freebsd.org)
    Received: (from neel@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1S10X23075162;
     Thu, 28 Feb 2013 01:00:33 GMT (envelope-from neel@svn.freebsd.org)
    Message-Id: <201302280100.r1S10X23075162@svn.freebsd.org>
    From: Neel Natu 
    Date: Thu, 28 Feb 2013 01:00:33 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247438 - head/sys/dev/pci
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 01:00:33 -0000
    
    Author: neel
    Date: Thu Feb 28 01:00:32 2013
    New Revision: 247438
    URL: http://svnweb.freebsd.org/changeset/base/247438
    
    Log:
      Remove the quirk to allow use of MSI when the guest is running inside bhyve.
      
      This became redundant after the hostbridge presented to the guest started
      advertising the PCI-E capability (r246846).
      
      Obtained from:	NetApp
    
    Modified:
      head/sys/dev/pci/pci.c
    
    Modified: head/sys/dev/pci/pci.c
    ==============================================================================
    --- head/sys/dev/pci/pci.c	Thu Feb 28 00:52:44 2013	(r247437)
    +++ head/sys/dev/pci/pci.c	Thu Feb 28 01:00:32 2013	(r247438)
    @@ -244,7 +244,6 @@ static const struct pci_quirk pci_quirks
     	 * but support MSI just fine.  QEMU uses the Intel 82440.
     	 */
     	{ 0x12378086, PCI_QUIRK_ENABLE_MSI_VM,	0,	0 },
    -	{ 0x12751275, PCI_QUIRK_ENABLE_MSI_VM,	0, 	0 },	/* bhyve */
     
     	/*
     	 * HPET MMIO base address may appear in Bar1 for AMD SB600 SMBus
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 01:22:15 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id B9363476;
     Thu, 28 Feb 2013 01:22:15 +0000 (UTC) (envelope-from gjb@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id AC364F57;
     Thu, 28 Feb 2013 01:22:15 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1S1MFJ0083623;
     Thu, 28 Feb 2013 01:22:15 GMT (envelope-from gjb@svn.freebsd.org)
    Received: (from gjb@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1S1MFUB083622;
     Thu, 28 Feb 2013 01:22:15 GMT (envelope-from gjb@svn.freebsd.org)
    Message-Id: <201302280122.r1S1MFUB083622@svn.freebsd.org>
    From: Glen Barber 
    Date: Thu, 28 Feb 2013 01:22:15 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247441 - head/usr.bin/dc
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 01:22:15 -0000
    
    Author: gjb (doc,ports committer)
    Date: Thu Feb 28 01:22:14 2013
    New Revision: 247441
    URL: http://svnweb.freebsd.org/changeset/base/247441
    
    Log:
      Properly handle '-h' argument.
      
      PR:		176332
      Reviewed by:	scottl
      MFC after:	3 days
    
    Modified:
      head/usr.bin/dc/dc.c
    
    Modified: head/usr.bin/dc/dc.c
    ==============================================================================
    --- head/usr.bin/dc/dc.c	Thu Feb 28 01:05:48 2013	(r247440)
    +++ head/usr.bin/dc/dc.c	Thu Feb 28 01:22:14 2013	(r247441)
    @@ -84,7 +84,7 @@ main(int argc, char *argv[])
     	bool extended_regs = false, preproc_done = false;
     
     	/* accept and ignore a single dash to be 4.4BSD dc(1) compatible */
    -	while ((ch = getopt_long(argc, argv, "e:f:Vx", long_options, NULL)) != -1) {
    +	while ((ch = getopt_long(argc, argv, "e:f:hVx", long_options, NULL)) != -1) {
     		switch (ch) {
     		case 'e':
     			if (!preproc_done)
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 01:24:25 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 3A408612;
     Thu, 28 Feb 2013 01:24:25 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 2CA03F72;
     Thu, 28 Feb 2013 01:24:25 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1S1OPGN083937;
     Thu, 28 Feb 2013 01:24:25 GMT (envelope-from pjd@svn.freebsd.org)
    Received: (from pjd@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1S1OPmv083936;
     Thu, 28 Feb 2013 01:24:25 GMT (envelope-from pjd@svn.freebsd.org)
    Message-Id: <201302280124.r1S1OPmv083936@svn.freebsd.org>
    From: Pawel Jakub Dawidek 
    Date: Thu, 28 Feb 2013 01:24:25 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247442 - head/contrib/openbsm/bin/auditdistd
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 01:24:25 -0000
    
    Author: pjd
    Date: Thu Feb 28 01:24:24 2013
    New Revision: 247442
    URL: http://svnweb.freebsd.org/changeset/base/247442
    
    Log:
      When we are waiting for new trail files we may have been disconnected and
      reconnected in the meantime. Check if reset is set before opening next trail
      file, as not doing so will result in sending OPEN message with the same
      file name twice and this is illegal - the second OPEN is send without first
      closing previous trail file.
    
    Modified:
      head/contrib/openbsm/bin/auditdistd/sender.c
    
    Modified: head/contrib/openbsm/bin/auditdistd/sender.c
    ==============================================================================
    --- head/contrib/openbsm/bin/auditdistd/sender.c	Thu Feb 28 01:22:14 2013	(r247441)
    +++ head/contrib/openbsm/bin/auditdistd/sender.c	Thu Feb 28 01:24:24 2013	(r247442)
    @@ -394,6 +394,7 @@ read_thread_wait(void)
     
     	mtx_lock(&adist_remote_mtx);
     	if (adhost->adh_reset) {
    +reset:
     		adhost->adh_reset = false;
     		if (trail_filefd(adist_trail) != -1)
     			trail_close(adist_trail);
    @@ -408,6 +409,14 @@ read_thread_wait(void)
     	while (trail_filefd(adist_trail) == -1) {
     		newfile = true;
     		wait_for_dir();
    +		/*
    +		 * We may have been disconnected and reconnected in the
    +		 * meantime, check if reset is set.
    +		 */
    +		mtx_lock(&adist_remote_mtx);
    +		if (adhost->adh_reset)
    +			goto reset;
    +		mtx_unlock(&adist_remote_mtx);
     		if (trail_filefd(adist_trail) == -1)
     			trail_next(adist_trail);
     	}
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 04:16:49 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 52C9594;
     Thu, 28 Feb 2013 04:16:49 +0000 (UTC)
     (envelope-from delphij@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 453DE8BE;
     Thu, 28 Feb 2013 04:16:49 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1S4GmXs037519;
     Thu, 28 Feb 2013 04:16:48 GMT (envelope-from delphij@svn.freebsd.org)
    Received: (from delphij@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1S4Gm42037515;
     Thu, 28 Feb 2013 04:16:48 GMT (envelope-from delphij@svn.freebsd.org)
    Message-Id: <201302280416.r1S4Gm42037515@svn.freebsd.org>
    From: Xin LI 
    Date: Thu, 28 Feb 2013 04:16:48 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247443 - in head: share/man/man4 sys/dev/arcmsr
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 04:16:49 -0000
    
    Author: delphij
    Date: Thu Feb 28 04:16:47 2013
    New Revision: 247443
    URL: http://svnweb.freebsd.org/changeset/base/247443
    
    Log:
      Refresh vendor driver version which adds ARC-1224 support.
      
      Many thanks to Areca for continuing to support FreeBSD.
      
      Submitted by:	黃清隆 
      MFC after:	3 days
    
    Modified:
      head/share/man/man4/arcmsr.4
      head/sys/dev/arcmsr/arcmsr.c
      head/sys/dev/arcmsr/arcmsr.h
    
    Modified: head/share/man/man4/arcmsr.4
    ==============================================================================
    --- head/share/man/man4/arcmsr.4	Thu Feb 28 01:24:24 2013	(r247442)
    +++ head/share/man/man4/arcmsr.4	Thu Feb 28 04:16:47 2013	(r247443)
    @@ -24,7 +24,7 @@
     .\"
     .\" $FreeBSD$
     .\"
    -.Dd December 18, 2012
    +.Dd February 27, 2013
     .Dt ARCMSR 4
     .Os
     .Sh NAME
    @@ -108,6 +108,8 @@ ARC-1222
     .It
     ARC-1223
     .It
    +ARC-1224
    +.It
     ARC-1230
     .It
     ARC-1231
    
    Modified: head/sys/dev/arcmsr/arcmsr.c
    ==============================================================================
    --- head/sys/dev/arcmsr/arcmsr.c	Thu Feb 28 01:24:24 2013	(r247442)
    +++ head/sys/dev/arcmsr/arcmsr.c	Thu Feb 28 04:16:47 2013	(r247443)
    @@ -1,16 +1,15 @@
     /*
    -*****************************************************************************************
    -**        O.S   : FreeBSD
    +********************************************************************************
    +**        OS    : FreeBSD
     **   FILE NAME  : arcmsr.c
     **        BY    : Erich Chen, Ching Huang
     **   Description: SCSI RAID Device Driver for 
    -**                ARECA (ARC11XX/ARC12XX/ARC13XX/ARC16XX/ARC188x) SATA/SAS RAID HOST Adapter
    -**                ARCMSR RAID Host adapter
    -**                [RAID controller:INTEL 331(PCI-X) 341(PCI-EXPRESS) chip set]
    -******************************************************************************************
    -************************************************************************
    +**                ARECA (ARC11XX/ARC12XX/ARC13XX/ARC16XX/ARC188x)
    +**                SATA/SAS RAID HOST Adapter
    +********************************************************************************
    +********************************************************************************
     **
    -** Copyright (C) 2002 - 2010, Areca Technology Corporation All rights reserved.
    +** Copyright (C) 2002 - 2012, Areca Technology Corporation All rights reserved.
     **
     ** Redistribution and use in source and binary forms, with or without
     ** modification, are permitted provided that the following conditions
    @@ -33,7 +32,7 @@
     ** 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.
    -**************************************************************************
    +********************************************************************************
     ** History
     **
     **        REV#         DATE             NAME             DESCRIPTION
    @@ -73,7 +72,7 @@
     **     1.20.00.23   01/30/2012      Ching Huang          Fixed Request requeued and Retrying command
     **     1.20.00.24   06/11/2012      Ching Huang          Fixed return sense data condition
     **     1.20.00.25   08/17/2012      Ching Huang          Fixed hotplug device no function on type A adapter
    -**     1.20.00.26   12/14/2012      Ching Huang          Added support ARC1214
    +**     1.20.00.26   12/14/2012      Ching Huang          Added support ARC1214,1224
     ******************************************************************************************
     */
     
    @@ -145,7 +144,7 @@ __FBSDID("$FreeBSD$");
     #define arcmsr_callout_init(a)	callout_init(a);
     #endif
     
    -#define ARCMSR_DRIVER_VERSION	"Driver Version 1.20.00.26 2012-12-14"
    +#define ARCMSR_DRIVER_VERSION	"Driver Version 1.20.00.26 2013-01-08"
     #include 
     /*
     **************************************************************************
    @@ -168,7 +167,7 @@ static void arcmsr_stop_adapter_bgrb(str
     static void arcmsr_start_adapter_bgrb(struct AdapterControlBlock *acb);
     static void arcmsr_iop_init(struct AdapterControlBlock *acb);
     static void arcmsr_flush_adapter_cache(struct AdapterControlBlock *acb);
    -static void	arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb, struct QBUFFER *prbuffer);
    +static u_int32_t arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb, struct QBUFFER *prbuffer);
     static void arcmsr_Write_data_2iop_wqbuffer(struct AdapterControlBlock *acb);
     static void arcmsr_abort_allcmd(struct AdapterControlBlock *acb);
     static void arcmsr_srb_complete(struct CommandControlBlock *srb, int stand_flag);
    @@ -212,7 +211,11 @@ static device_method_t arcmsr_methods[]=
     	DEVMETHOD(device_suspend,	arcmsr_suspend),
     	DEVMETHOD(device_resume,	arcmsr_resume),
     
    +#if __FreeBSD_version >= 803000
     	DEVMETHOD_END
    +#else
    +	{ 0, 0 }
    +#endif
     };
     	
     static driver_t arcmsr_driver={
    @@ -1381,13 +1384,61 @@ static void arcmsr_poll(struct cam_sim *
     **************************************************************************
     **************************************************************************
     */
    -static void	arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb,
    +static u_int32_t arcmsr_Read_iop_rqbuffer_data_D(struct AdapterControlBlock *acb,
    +    struct QBUFFER *prbuffer) {
    +
    +	u_int8_t *pQbuffer;
    +	u_int8_t *buf1 = 0;
    +	u_int32_t *iop_data, *buf2 = 0;
    +	u_int32_t iop_len, data_len;
    +
    +	iop_data = (u_int32_t *)prbuffer->data;
    +	iop_len = (u_int32_t)prbuffer->data_len;
    +	if ( iop_len > 0 )
    +	{
    +		buf1 = malloc(128, M_DEVBUF, M_NOWAIT | M_ZERO);
    +		buf2 = (u_int32_t *)buf1;
    +		if( buf1 == NULL)
    +			return (0);
    +		data_len = iop_len;
    +		while(data_len >= 4)
    +		{
    +			*buf2++ = *iop_data++;
    +			data_len -= 4;
    +		}
    +		if(data_len)
    +			*buf2 = *iop_data;
    +		buf2 = (u_int32_t *)buf1;
    +	}
    +	while (iop_len > 0) {
    +		pQbuffer = &acb->rqbuffer[acb->rqbuf_lastindex];
    +		*pQbuffer = *buf1;
    +		acb->rqbuf_lastindex++;
    +		/* if last, index number set it to 0 */
    +		acb->rqbuf_lastindex %= ARCMSR_MAX_QBUFFER;
    +		buf1++;
    +		iop_len--;
    +	}
    +	if(buf2)
    +		free( (u_int8_t *)buf2, M_DEVBUF);
    +	/* let IOP know data has been read */
    +	arcmsr_iop_message_read(acb);
    +	return (1);
    +}
    +/*
    +**************************************************************************
    +**************************************************************************
    +*/
    +static u_int32_t arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb,
         struct QBUFFER *prbuffer) {
     
     	u_int8_t *pQbuffer;
     	u_int8_t *iop_data;
     	u_int32_t iop_len;
     
    +	if(acb->adapter_type == ACB_ADAPTER_TYPE_D) {
    +		return(arcmsr_Read_iop_rqbuffer_data_D(acb, prbuffer));
    +	}
     	iop_data = (u_int8_t *)prbuffer->data;
     	iop_len = (u_int32_t)prbuffer->data_len;
     	while (iop_len > 0) {
    @@ -1401,6 +1452,7 @@ static void	arcmsr_Read_iop_rqbuffer_dat
     	}
     	/* let IOP know data has been read */
     	arcmsr_iop_message_read(acb);
    +	return (1);
     }
     /*
     **************************************************************************
    @@ -1417,7 +1469,8 @@ static void arcmsr_iop2drv_data_wrote_ha
     	my_empty_len = (acb->rqbuf_lastindex - acb->rqbuf_firstindex - 1) &
     	    (ARCMSR_MAX_QBUFFER-1);
     	if(my_empty_len >= prbuffer->data_len) {
    -		arcmsr_Read_iop_rqbuffer_data(acb, prbuffer);
    +		if(arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0)
    +			acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW;
     	} else {
     		acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW;
     	}
    @@ -1427,6 +1480,50 @@ static void arcmsr_iop2drv_data_wrote_ha
     **********************************************************************
     **********************************************************************
     */
    +static void arcmsr_Write_data_2iop_wqbuffer_D(struct AdapterControlBlock *acb)
    +{
    +	u_int8_t *pQbuffer;
    +	struct QBUFFER *pwbuffer;
    +	u_int8_t *buf1 = 0;
    +	u_int32_t *iop_data, *buf2 = 0;
    +	u_int32_t allxfer_len = 0, data_len;
    +	
    +	if(acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READ) {
    +		buf1 = malloc(128, M_DEVBUF, M_NOWAIT | M_ZERO);
    +		buf2 = (u_int32_t *)buf1;
    +		if( buf1 == NULL)
    +			return;
    +
    +		acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READ);
    +		pwbuffer = arcmsr_get_iop_wqbuffer(acb);
    +		iop_data = (u_int32_t *)pwbuffer->data;
    +		while((acb->wqbuf_firstindex != acb->wqbuf_lastindex) 
    +			&& (allxfer_len < 124)) {
    +			pQbuffer = &acb->wqbuffer[acb->wqbuf_firstindex];
    +			*buf1 = *pQbuffer;
    +			acb->wqbuf_firstindex++;
    +			acb->wqbuf_firstindex %= ARCMSR_MAX_QBUFFER;
    +			buf1++;
    +			allxfer_len++;
    +		}
    +		pwbuffer->data_len = allxfer_len;
    +		data_len = allxfer_len;
    +		buf1 = (u_int8_t *)buf2;
    +		while(data_len >= 4)
    +		{
    +			*iop_data++ = *buf2++;
    +			data_len -= 4;
    +		}
    +		if(data_len)
    +			*iop_data = *buf2;
    +		free( buf1, M_DEVBUF);
    +		arcmsr_iop_message_wrote(acb);
    +	}
    +}
    +/*
    +**********************************************************************
    +**********************************************************************
    +*/
     static void arcmsr_Write_data_2iop_wqbuffer(struct AdapterControlBlock *acb)
     {
     	u_int8_t *pQbuffer;
    @@ -1434,6 +1531,10 @@ static void arcmsr_Write_data_2iop_wqbuf
     	u_int8_t *iop_data;
     	int32_t allxfer_len=0;
     	
    +	if(acb->adapter_type == ACB_ADAPTER_TYPE_D) {
    +		arcmsr_Write_data_2iop_wqbuffer_D(acb);
    +		return;
    +	}
     	if(acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READ) {
     		acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READ);
     		pwbuffer = arcmsr_get_iop_wqbuffer(acb);
    @@ -2153,7 +2254,8 @@ u_int32_t arcmsr_iop_ioctlcmd(struct Ada
     	
     				acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
     				prbuffer = arcmsr_get_iop_rqbuffer(acb);
    -				arcmsr_Read_iop_rqbuffer_data(acb, prbuffer);
    +				if(arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0)
    +					acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW;
     			}
     			pcmdmessagefld->cmdmessage.Length = allxfer_len;
     			pcmdmessagefld->cmdmessage.ReturnCode = ARCMSR_MESSAGE_RETURNCODE_OK;
    @@ -2374,7 +2476,8 @@ static int arcmsr_iop_message_xfer(struc
     	
     				acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
     				prbuffer = arcmsr_get_iop_rqbuffer(acb);
    -				arcmsr_Read_iop_rqbuffer_data(acb, prbuffer);
    +				if(arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0)
    +					acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW;
     			}
     			pcmdmessagefld->cmdmessage.Length = allxfer_len;
     			pcmdmessagefld->cmdmessage.ReturnCode = ARCMSR_MESSAGE_RETURNCODE_OK;
    
    Modified: head/sys/dev/arcmsr/arcmsr.h
    ==============================================================================
    --- head/sys/dev/arcmsr/arcmsr.h	Thu Feb 28 01:24:24 2013	(r247442)
    +++ head/sys/dev/arcmsr/arcmsr.h	Thu Feb 28 04:16:47 2013	(r247443)
    @@ -1,17 +1,14 @@
     /*
    -***********************************************************************************************
    -**        O.S   : FreeBSD
    +********************************************************************************
    +**        OS    : FreeBSD
     **   FILE NAME  : arcmsr.h
     **        BY    : Erich Chen, Ching Huang
     **   Description: SCSI RAID Device Driver for 
    -**                ARECA SATA/SAS RAID HOST Adapter
    -**                [RAID controller:INTEL 331(PCI-X) 341(PCI-EXPRESS) chip set]
    -***********************************************************************************************
    -************************************************************************
    -** Copyright (C) 2002 - 2010, Areca Technology Corporation All rights reserved.
    -**
    -**     Web site: www.areca.com.tw
    -**       E-mail: erich@areca.com.tw; ching2048@areca.com.tw
    +**                ARECA (ARC11XX/ARC12XX/ARC13XX/ARC16XX/ARC188x)
    +**                SATA/SAS RAID HOST Adapter
    +********************************************************************************
    +********************************************************************************
    +** Copyright (C) 2002 - 2012, Areca Technology Corporation All rights reserved.
     **
     ** Redistribution and use in source and binary forms,with or without
     ** modification,are permitted provided that the following conditions
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 10:21:06 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 16D594B3;
     Thu, 28 Feb 2013 10:21:06 +0000 (UTC) (envelope-from mav@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id ED824197C;
     Thu, 28 Feb 2013 10:21:05 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1SAL5Bn047857;
     Thu, 28 Feb 2013 10:21:05 GMT (envelope-from mav@svn.freebsd.org)
    Received: (from mav@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1SAL5NT047856;
     Thu, 28 Feb 2013 10:21:05 GMT (envelope-from mav@svn.freebsd.org)
    Message-Id: <201302281021.r1SAL5NT047856@svn.freebsd.org>
    From: Alexander Motin 
    Date: Thu, 28 Feb 2013 10:21:05 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247452 - head/sys/sys
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 10:21:06 -0000
    
    Author: mav
    Date: Thu Feb 28 10:21:04 2013
    New Revision: 247452
    URL: http://svnweb.freebsd.org/changeset/base/247452
    
    Log:
      Introduce sbintime_t type -- the simplified version of struct bintime,
      using 32.32 fixed point in form of single int64_t.  It is much easier to
      use in cases where additional precision and range of struct bintime is
      not required.
      
      Reviewed by:	bde (previous version), davide
    
    Modified:
      head/sys/sys/time.h
    
    Modified: head/sys/sys/time.h
    ==============================================================================
    --- head/sys/sys/time.h	Thu Feb 28 08:19:55 2013	(r247451)
    +++ head/sys/sys/time.h	Thu Feb 28 10:21:04 2013	(r247452)
    @@ -109,6 +109,37 @@ bintime_mul(struct bintime *bt, u_int x)
     	    ((a)->frac cmp (b)->frac) :					\
     	    ((a)->sec cmp (b)->sec))
     
    +typedef int64_t sbintime_t;
    +#define	SBT_1S	((sbintime_t)1 << 32)
    +#define	SBT_1M	(SBT_1S * 60)
    +#define	SBT_1MS	(SBT_1S / 1000)
    +#define	SBT_1US	(SBT_1S / 1000000)
    +#define	SBT_1NS (SBT_1S / 1000000000)  
    +
    +static __inline int
    +sbintime_getsec(sbintime_t sbt)
    +{
    +
    +	return (sbt >> 32);
    +}
    +
    +static __inline sbintime_t
    +bttosbt(const struct bintime bt)
    +{
    +
    +	return (((sbintime_t)bt.sec << 32) + (bt.frac >> 32));
    +}
    +
    +static __inline struct bintime
    +sbttobt(sbintime_t sbt)
    +{
    +	struct bintime bt;
    +	
    +	bt.sec = sbt >> 32;
    +	bt.frac = sbt << 32;
    +	return (bt);
    +}
    +
     /*-
      * Background information:
      *
    @@ -156,6 +187,42 @@ timeval2bintime(const struct timeval *tv
     	/* 18446744073709 = int(2^64 / 1000000) */
     	bt->frac = tv->tv_usec * (uint64_t)18446744073709LL;
     }
    +
    +static __inline struct timespec
    +sbttots(sbintime_t sbt)
    +{
    +	struct timespec ts;
    +
    +	ts.tv_sec = sbt >> 32;
    +	ts.tv_nsec = ((uint64_t)1000000000 * (uint32_t)sbt) >> 32;
    +	return (ts);
    +}
    +
    +static __inline sbintime_t
    +tstosbt(struct timespec ts)
    +{
    +
    +	return (((sbintime_t)ts.tv_sec << 32) +
    +	    (ts.tv_nsec * (((uint64_t)1 << 63) / 500000000) >> 32));
    +}
    +
    +static __inline struct timeval
    +sbttotv(sbintime_t sbt)
    +{
    +	struct timeval tv;
    +
    +	tv.tv_sec = sbt >> 32;
    +	tv.tv_usec = ((uint64_t)1000000 * (uint32_t)sbt) >> 32;
    +	return (tv);
    +}
    +
    +static __inline sbintime_t
    +tvtosbt(struct timeval tv)
    +{
    +
    +	return (((sbintime_t)tv.tv_sec << 32) +
    +	    (tv.tv_usec * (((uint64_t)1 << 63) / 500000) >> 32));
    +}
     #endif /* __BSD_VISIBLE */
     
     #ifdef _KERNEL
    @@ -317,6 +384,15 @@ void	binuptime(struct bintime *bt);
     void	nanouptime(struct timespec *tsp);
     void	microuptime(struct timeval *tvp);
     
    +static __inline sbintime_t
    +sbinuptime(void)
    +{
    +	struct bintime bt;
    +
    +	binuptime(&bt);
    +	return (bttosbt(bt));
    +}
    +
     void	bintime(struct bintime *bt);
     void	nanotime(struct timespec *tsp);
     void	microtime(struct timeval *tvp);
    @@ -325,6 +401,15 @@ void	getbinuptime(struct bintime *bt);
     void	getnanouptime(struct timespec *tsp);
     void	getmicrouptime(struct timeval *tvp);
     
    +static __inline sbintime_t
    +getsbinuptime(void)
    +{
    +	struct bintime bt;
    +
    +	getbinuptime(&bt);
    +	return (bttosbt(bt));
    +}
    +
     void	getbintime(struct bintime *bt);
     void	getnanotime(struct timespec *tsp);
     void	getmicrotime(struct timeval *tvp);
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 10:46:56 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id D4B87E87;
     Thu, 28 Feb 2013 10:46:56 +0000 (UTC)
     (envelope-from davide@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id AF9EA1A99;
     Thu, 28 Feb 2013 10:46:56 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1SAkuJD054835;
     Thu, 28 Feb 2013 10:46:56 GMT (envelope-from davide@svn.freebsd.org)
    Received: (from davide@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1SAksKF054820;
     Thu, 28 Feb 2013 10:46:54 GMT (envelope-from davide@svn.freebsd.org)
    Message-Id: <201302281046.r1SAksKF054820@svn.freebsd.org>
    From: Davide Italiano 
    Date: Thu, 28 Feb 2013 10:46:54 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247454 - in head/sys: amd64/amd64 dev/acpica i386/i386
     ia64/ia64 kern pc98/pc98 powerpc/powerpc powerpc/ps3 powerpc/wii sys
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 10:46:57 -0000
    
    Author: davide
    Date: Thu Feb 28 10:46:54 2013
    New Revision: 247454
    URL: http://svnweb.freebsd.org/changeset/base/247454
    
    Log:
      MFcalloutng:
      When CPU becomes idle, cpu_idleclock() calculates time to the next timer
      event in order to reprogram hw timer. Return that time in sbintime_t to
      the caller and pass it to acpi_cpu_idle(), where it can be used as one
      more factor (quite precise) to extimate furter sleep time and choose
      optimal sleep state. This is a preparatory change for further callout
      improvements will be committed in the next days.
      
      The commmit is not targeted for MFC.
    
    Modified:
      head/sys/amd64/amd64/machdep.c
      head/sys/dev/acpica/acpi_cpu.c
      head/sys/i386/i386/machdep.c
      head/sys/ia64/ia64/machdep.c
      head/sys/kern/kern_clocksource.c
      head/sys/pc98/pc98/machdep.c
      head/sys/powerpc/powerpc/cpu.c
      head/sys/powerpc/ps3/platform_ps3.c
      head/sys/powerpc/wii/platform_wii.c
      head/sys/sys/proc.h
      head/sys/sys/systm.h
    
    Modified: head/sys/amd64/amd64/machdep.c
    ==============================================================================
    --- head/sys/amd64/amd64/machdep.c	Thu Feb 28 10:45:16 2013	(r247453)
    +++ head/sys/amd64/amd64/machdep.c	Thu Feb 28 10:46:54 2013	(r247454)
    @@ -658,7 +658,7 @@ cpu_halt(void)
     		halt();
     }
     
    -void (*cpu_idle_hook)(void) = NULL;	/* ACPI idle hook. */
    +void (*cpu_idle_hook)(sbintime_t) = NULL;	/* ACPI idle hook. */
     static int	cpu_ident_amdc1e = 0;	/* AMD C1E supported. */
     static int	idle_mwait = 1;		/* Use MONITOR/MWAIT for short idle. */
     TUNABLE_INT("machdep.idle_mwait", &idle_mwait);
    @@ -670,7 +670,7 @@ SYSCTL_INT(_machdep, OID_AUTO, idle_mwai
     #define	STATE_SLEEPING	0x2
     
     static void
    -cpu_idle_acpi(int busy)
    +cpu_idle_acpi(sbintime_t sbt)
     {
     	int *state;
     
    @@ -682,14 +682,14 @@ cpu_idle_acpi(int busy)
     	if (sched_runnable())
     		enable_intr();
     	else if (cpu_idle_hook)
    -		cpu_idle_hook();
    +		cpu_idle_hook(sbt);
     	else
     		__asm __volatile("sti; hlt");
     	*state = STATE_RUNNING;
     }
     
     static void
    -cpu_idle_hlt(int busy)
    +cpu_idle_hlt(sbintime_t sbt)
     {
     	int *state;
     
    @@ -730,7 +730,7 @@ cpu_idle_hlt(int busy)
     #define	MWAIT_C4	0x30
     
     static void
    -cpu_idle_mwait(int busy)
    +cpu_idle_mwait(sbintime_t sbt)
     {
     	int *state;
     
    @@ -753,7 +753,7 @@ cpu_idle_mwait(int busy)
     }
     
     static void
    -cpu_idle_spin(int busy)
    +cpu_idle_spin(sbintime_t sbt)
     {
     	int *state;
     	int i;
    @@ -802,12 +802,13 @@ cpu_probe_amdc1e(void)
     	}
     }
     
    -void (*cpu_idle_fn)(int) = cpu_idle_acpi;
    +void (*cpu_idle_fn)(sbintime_t) = cpu_idle_acpi;
     
     void
     cpu_idle(int busy)
     {
     	uint64_t msr;
    +	sbintime_t sbt = -1;
     
     	CTR2(KTR_SPARE2, "cpu_idle(%d) at %d",
     	    busy, curcpu);
    @@ -825,7 +826,7 @@ cpu_idle(int busy)
     	/* If we have time - switch timers into idle mode. */
     	if (!busy) {
     		critical_enter();
    -		cpu_idleclock();
    +		sbt = cpu_idleclock();
     	}
     
     	/* Apply AMD APIC timer C1E workaround. */
    @@ -836,7 +837,7 @@ cpu_idle(int busy)
     	}
     
     	/* Call main idle method. */
    -	cpu_idle_fn(busy);
    +	cpu_idle_fn(sbt);
     
     	/* Switch timers mack into active mode. */
     	if (!busy) {
    
    Modified: head/sys/dev/acpica/acpi_cpu.c
    ==============================================================================
    --- head/sys/dev/acpica/acpi_cpu.c	Thu Feb 28 10:45:16 2013	(r247453)
    +++ head/sys/dev/acpica/acpi_cpu.c	Thu Feb 28 10:46:54 2013	(r247454)
    @@ -168,7 +168,7 @@ static int	acpi_cpu_cx_cst(struct acpi_c
     static void	acpi_cpu_startup(void *arg);
     static void	acpi_cpu_startup_cx(struct acpi_cpu_softc *sc);
     static void	acpi_cpu_cx_list(struct acpi_cpu_softc *sc);
    -static void	acpi_cpu_idle(void);
    +static void	acpi_cpu_idle(sbintime_t sbt);
     static void	acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context);
     static int	acpi_cpu_quirks(void);
     static int	acpi_cpu_usage_sysctl(SYSCTL_HANDLER_ARGS);
    @@ -954,13 +954,13 @@ acpi_cpu_startup_cx(struct acpi_cpu_soft
      * interrupts are re-enabled.
      */
     static void
    -acpi_cpu_idle()
    +acpi_cpu_idle(sbintime_t sbt)
     {
         struct	acpi_cpu_softc *sc;
         struct	acpi_cx *cx_next;
         uint64_t	cputicks;
         uint32_t	start_time, end_time;
    -    int		bm_active, cx_next_idx, i;
    +    int		bm_active, cx_next_idx, i, us;
     
         /*
          * Look up our CPU id to get our softc.  If it's NULL, we'll use C1
    @@ -980,13 +980,16 @@ acpi_cpu_idle()
         }
     
         /* Find the lowest state that has small enough latency. */
    +    us = sc->cpu_prev_sleep;
    +    if (sbt >= 0 && us > sbt / SBT_1US)
    +	us = sbt / SBT_1US;
         cx_next_idx = 0;
         if (cpu_disable_deep_sleep)
     	i = min(sc->cpu_cx_lowest, sc->cpu_non_c3);
         else
     	i = sc->cpu_cx_lowest;
         for (; i >= 0; i--) {
    -	if (sc->cpu_cx_states[i].trans_lat * 3 <= sc->cpu_prev_sleep) {
    +	if (sc->cpu_cx_states[i].trans_lat * 3 <= us) {
     	    cx_next_idx = i;
     	    break;
     	}
    
    Modified: head/sys/i386/i386/machdep.c
    ==============================================================================
    --- head/sys/i386/i386/machdep.c	Thu Feb 28 10:45:16 2013	(r247453)
    +++ head/sys/i386/i386/machdep.c	Thu Feb 28 10:46:54 2013	(r247454)
    @@ -1220,7 +1220,7 @@ cpu_halt(void)
     int scheduler_running;
     
     static void
    -cpu_idle_hlt(int busy)
    +cpu_idle_hlt(sbintime_t sbt)
     {
     
     	scheduler_running = 1;
    @@ -1241,7 +1241,7 @@ cpu_halt(void)
     
     #endif
     
    -void (*cpu_idle_hook)(void) = NULL;	/* ACPI idle hook. */
    +void (*cpu_idle_hook)(sbintime_t) = NULL;	/* ACPI idle hook. */
     static int	cpu_ident_amdc1e = 0;	/* AMD C1E supported. */
     static int	idle_mwait = 1;		/* Use MONITOR/MWAIT for short idle. */
     TUNABLE_INT("machdep.idle_mwait", &idle_mwait);
    @@ -1253,7 +1253,7 @@ SYSCTL_INT(_machdep, OID_AUTO, idle_mwai
     #define	STATE_SLEEPING	0x2
     
     static void
    -cpu_idle_acpi(int busy)
    +cpu_idle_acpi(sbintime_t sbt)
     {
     	int *state;
     
    @@ -1265,7 +1265,7 @@ cpu_idle_acpi(int busy)
     	if (sched_runnable())
     		enable_intr();
     	else if (cpu_idle_hook)
    -		cpu_idle_hook();
    +		cpu_idle_hook(sbt);
     	else
     		__asm __volatile("sti; hlt");
     	*state = STATE_RUNNING;
    @@ -1273,7 +1273,7 @@ cpu_idle_acpi(int busy)
     
     #ifndef XEN
     static void
    -cpu_idle_hlt(int busy)
    +cpu_idle_hlt(sbintime_t sbt)
     {
     	int *state;
     
    @@ -1315,7 +1315,7 @@ cpu_idle_hlt(int busy)
     #define	MWAIT_C4	0x30
     
     static void
    -cpu_idle_mwait(int busy)
    +cpu_idle_mwait(sbintime_t sbt)
     {
     	int *state;
     
    @@ -1338,7 +1338,7 @@ cpu_idle_mwait(int busy)
     }
     
     static void
    -cpu_idle_spin(int busy)
    +cpu_idle_spin(sbintime_t sbt)
     {
     	int *state;
     	int i;
    @@ -1388,9 +1388,9 @@ cpu_probe_amdc1e(void)
     }
     
     #ifdef XEN
    -void (*cpu_idle_fn)(int) = cpu_idle_hlt;
    +void (*cpu_idle_fn)(sbintime_t) = cpu_idle_hlt;
     #else
    -void (*cpu_idle_fn)(int) = cpu_idle_acpi;
    +void (*cpu_idle_fn)(sbintime_t) = cpu_idle_acpi;
     #endif
     
     void
    @@ -1399,6 +1399,7 @@ cpu_idle(int busy)
     #ifndef XEN
     	uint64_t msr;
     #endif
    +	sbintime_t sbt = -1;
     
     	CTR2(KTR_SPARE2, "cpu_idle(%d) at %d",
     	    busy, curcpu);
    @@ -1418,7 +1419,7 @@ cpu_idle(int busy)
     	/* If we have time - switch timers into idle mode. */
     	if (!busy) {
     		critical_enter();
    -		cpu_idleclock();
    +		sbt = cpu_idleclock();
     	}
     
     #ifndef XEN
    @@ -1431,7 +1432,7 @@ cpu_idle(int busy)
     #endif
     
     	/* Call main idle method. */
    -	cpu_idle_fn(busy);
    +	cpu_idle_fn(sbt);
     
     	/* Switch timers mack into active mode. */
     	if (!busy) {
    
    Modified: head/sys/ia64/ia64/machdep.c
    ==============================================================================
    --- head/sys/ia64/ia64/machdep.c	Thu Feb 28 10:45:16 2013	(r247453)
    +++ head/sys/ia64/ia64/machdep.c	Thu Feb 28 10:46:54 2013	(r247454)
    @@ -171,7 +171,7 @@ extern vm_offset_t ksym_start, ksym_end;
     struct msgbuf *msgbufp = NULL;
     
     /* Other subsystems (e.g., ACPI) can hook this later. */
    -void (*cpu_idle_hook)(void) = NULL;
    +void (*cpu_idle_hook)(sbintime_t) = NULL;
     
     struct kva_md_info kmi;
     
    @@ -408,10 +408,11 @@ void
     cpu_idle(int busy)
     {
     	register_t ie;
    +	sbintime_t sbt = -1;
     
     	if (!busy) {
     		critical_enter();
    -		cpu_idleclock();
    +		sbt = cpu_idleclock();
     	}
     
     	ie = intr_disable();
    @@ -420,7 +421,7 @@ cpu_idle(int busy)
     	if (sched_runnable())
     		ia64_enable_intr();
     	else if (cpu_idle_hook != NULL) {
    -		(*cpu_idle_hook)();
    +		(*cpu_idle_hook)(sbt);
     		/* The hook must enable interrupts! */
     	} else {
     		ia64_call_pal_static(PAL_HALT_LIGHT, 0, 0, 0);
    
    Modified: head/sys/kern/kern_clocksource.c
    ==============================================================================
    --- head/sys/kern/kern_clocksource.c	Thu Feb 28 10:45:16 2013	(r247453)
    +++ head/sys/kern/kern_clocksource.c	Thu Feb 28 10:46:54 2013	(r247454)
    @@ -767,7 +767,7 @@ cpu_stopprofclock(void)
     /*
      * Switch to idle mode (all ticks handled).
      */
    -void
    +sbintime_t
     cpu_idleclock(void)
     {
     	struct bintime now, t;
    @@ -779,7 +779,7 @@ cpu_idleclock(void)
     	    || curcpu == CPU_FIRST()
     #endif
     	    )
    -		return;
    +		return (-1);
     	state = DPCPU_PTR(timerstate);
     	if (periodic)
     		now = state->now;
    @@ -795,6 +795,8 @@ cpu_idleclock(void)
     	if (!periodic)
     		loadtimer(&now, 0);
     	ET_HW_UNLOCK(state);
    +	bintime_sub(&t, &now);
    +	return (MAX(bttosbt(t), 0));
     }
     
     /*
    
    Modified: head/sys/pc98/pc98/machdep.c
    ==============================================================================
    --- head/sys/pc98/pc98/machdep.c	Thu Feb 28 10:45:16 2013	(r247453)
    +++ head/sys/pc98/pc98/machdep.c	Thu Feb 28 10:46:54 2013	(r247454)
    @@ -1145,7 +1145,7 @@ SYSCTL_INT(_machdep, OID_AUTO, idle_mwai
     #define	STATE_SLEEPING	0x2
     
     static void
    -cpu_idle_hlt(int busy)
    +cpu_idle_hlt(sbintime_t sbt)
     {
     	int *state;
     
    @@ -1186,7 +1186,7 @@ cpu_idle_hlt(int busy)
     #define	MWAIT_C4	0x30
     
     static void
    -cpu_idle_mwait(int busy)
    +cpu_idle_mwait(sbintime_t sbt)
     {
     	int *state;
     
    @@ -1209,7 +1209,7 @@ cpu_idle_mwait(int busy)
     }
     
     static void
    -cpu_idle_spin(int busy)
    +cpu_idle_spin(sbintime_t sbt)
     {
     	int *state;
     	int i;
    @@ -1229,11 +1229,12 @@ cpu_idle_spin(int busy)
     	}
     }
     
    -void (*cpu_idle_fn)(int) = cpu_idle_hlt;
    +void (*cpu_idle_fn)(sbintime_t) = cpu_idle_hlt;
     
     void
     cpu_idle(int busy)
     {
    +	sbintime_t sbt = -1;
     
     	CTR2(KTR_SPARE2, "cpu_idle(%d) at %d",
     	    busy, curcpu);
    @@ -1251,11 +1252,11 @@ cpu_idle(int busy)
     	/* If we have time - switch timers into idle mode. */
     	if (!busy) {
     		critical_enter();
    -		cpu_idleclock();
    +		sbt = cpu_idleclock();
     	}
     
     	/* Call main idle method. */
    -	cpu_idle_fn(busy);
    +	cpu_idle_fn(sbt);
     
     	/* Switch timers mack into active mode. */
     	if (!busy) {
    
    Modified: head/sys/powerpc/powerpc/cpu.c
    ==============================================================================
    --- head/sys/powerpc/powerpc/cpu.c	Thu Feb 28 10:45:16 2013	(r247453)
    +++ head/sys/powerpc/powerpc/cpu.c	Thu Feb 28 10:46:54 2013	(r247454)
    @@ -79,9 +79,9 @@ static void	cpu_970_setup(int cpuid, uin
     static void	cpu_booke_setup(int cpuid, uint16_t vers);
     
     int powerpc_pow_enabled;
    -void (*cpu_idle_hook)(void) = NULL;
    -static void	cpu_idle_60x(void);
    -static void	cpu_idle_booke(void);
    +void (*cpu_idle_hook)(sbintime_t) = NULL;
    +static void	cpu_idle_60x(sbintime_t);
    +static void	cpu_idle_booke(sbintime_t);
     
     struct cputab {
     	const char	*name;
    @@ -516,6 +516,7 @@ cpu_feature_bit(SYSCTL_HANDLER_ARGS)
     void
     cpu_idle(int busy)
     {
    +	sbintime_t sbt = -1;
     
     #ifdef INVARIANTS
     	if ((mfmsr() & PSL_EE) != PSL_EE) {
    @@ -531,9 +532,9 @@ cpu_idle(int busy)
     	if (cpu_idle_hook != NULL) {
     		if (!busy) {
     			critical_enter();
    -			cpu_idleclock();
    +			sbt = cpu_idleclock();
     		}
    -		cpu_idle_hook();
    +		cpu_idle_hook(sbt);
     		if (!busy) {
     			cpu_activeclock();
     			critical_exit();
    @@ -551,7 +552,7 @@ cpu_idle_wakeup(int cpu)
     }
     
     static void
    -cpu_idle_60x(void)
    +cpu_idle_60x(sbintime_t sbt)
     {
     	register_t msr;
     	uint16_t vers;
    @@ -586,7 +587,7 @@ cpu_idle_60x(void)
     }
     
     static void
    -cpu_idle_booke(void)
    +cpu_idle_booke(sbintime_t sbt)
     {
     	register_t msr;
     
    
    Modified: head/sys/powerpc/ps3/platform_ps3.c
    ==============================================================================
    --- head/sys/powerpc/ps3/platform_ps3.c	Thu Feb 28 10:45:16 2013	(r247453)
    +++ head/sys/powerpc/ps3/platform_ps3.c	Thu Feb 28 10:46:54 2013	(r247454)
    @@ -70,7 +70,7 @@ static int ps3_smp_start_cpu(platform_t,
     static struct cpu_group *ps3_smp_topo(platform_t);
     #endif
     static void ps3_reset(platform_t);
    -static void ps3_cpu_idle(void);
    +static void ps3_cpu_idle(sbintime_t);
     
     static platform_method_t ps3_methods[] = {
     	PLATFORMMETHOD(platform_probe, 		ps3_probe),
    @@ -245,7 +245,7 @@ ps3_real_maxaddr(platform_t plat)
     }
     
     static void
    -ps3_cpu_idle(void)
    +ps3_cpu_idle(sbintime_t sbt)
     {
     	lv1_pause(0);
     }
    
    Modified: head/sys/powerpc/wii/platform_wii.c
    ==============================================================================
    --- head/sys/powerpc/wii/platform_wii.c	Thu Feb 28 10:45:16 2013	(r247453)
    +++ head/sys/powerpc/wii/platform_wii.c	Thu Feb 28 10:46:54 2013	(r247454)
    @@ -60,7 +60,7 @@ static void		wii_mem_regions(platform_t,
     			    int *, struct mem_region **, int *);
     static unsigned long	wii_timebase_freq(platform_t, struct cpuref *cpuref);
     static void		wii_reset(platform_t);
    -static void		wii_cpu_idle(void);
    +static void		wii_cpu_idle(sbintime_t sbt);
     
     static platform_method_t wii_methods[] = {
     	PLATFORMMETHOD(platform_probe,		wii_probe),
    @@ -155,6 +155,6 @@ wii_reset(platform_t plat)
     }
     
     static void
    -wii_cpu_idle(void)
    +wii_cpu_idle(sbintime_t sbt)
     {
     }
    
    Modified: head/sys/sys/proc.h
    ==============================================================================
    --- head/sys/sys/proc.h	Thu Feb 28 10:45:16 2013	(r247453)
    +++ head/sys/sys/proc.h	Thu Feb 28 10:46:54 2013	(r247454)
    @@ -908,7 +908,7 @@ void	tidhash_add(struct thread *);
     void	tidhash_remove(struct thread *);
     void	cpu_idle(int);
     int	cpu_idle_wakeup(int);
    -extern	void (*cpu_idle_hook)(void);	/* Hook to machdep CPU idler. */
    +extern	void (*cpu_idle_hook)(sbintime_t);	/* Hook to machdep CPU idler. */
     void	cpu_switch(struct thread *, struct thread *, struct mtx *);
     void	cpu_throw(struct thread *, struct thread *) __dead2;
     void	unsleep(struct thread *);
    
    Modified: head/sys/sys/systm.h
    ==============================================================================
    --- head/sys/sys/systm.h	Thu Feb 28 10:45:16 2013	(r247453)
    +++ head/sys/sys/systm.h	Thu Feb 28 10:46:54 2013	(r247454)
    @@ -44,6 +44,7 @@
     #include 
     #include 
     #include 		/* for people using printf mainly */
    +#include 
     
     extern int cold;		/* nonzero if we are doing a cold boot */
     extern int rebooting;		/* kern_reboot() has been called. */
    @@ -267,7 +268,7 @@ void	startprofclock(struct proc *);
     void	stopprofclock(struct proc *);
     void	cpu_startprofclock(void);
     void	cpu_stopprofclock(void);
    -void	cpu_idleclock(void);
    +sbintime_t 	cpu_idleclock(void);
     void	cpu_activeclock(void);
     extern int	cpu_can_deep_sleep;
     extern int	cpu_disable_deep_sleep;
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 11:27:03 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 2A5DCD62;
     Thu, 28 Feb 2013 11:27:03 +0000 (UTC)
     (envelope-from davide@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 05E6A1C0E;
     Thu, 28 Feb 2013 11:27:03 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1SBR2oD068277;
     Thu, 28 Feb 2013 11:27:02 GMT (envelope-from davide@svn.freebsd.org)
    Received: (from davide@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1SBR2VE068276;
     Thu, 28 Feb 2013 11:27:02 GMT (envelope-from davide@svn.freebsd.org)
    Message-Id: <201302281127.r1SBR2VE068276@svn.freebsd.org>
    From: Davide Italiano 
    Date: Thu, 28 Feb 2013 11:27:02 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247460 - head/sys/dev/acpica
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 11:27:03 -0000
    
    Author: davide
    Date: Thu Feb 28 11:27:01 2013
    New Revision: 247460
    URL: http://svnweb.freebsd.org/changeset/base/247460
    
    Log:
      MFcalloutng (r247427 by mav):
      We don't need any precision here. Let it be fast and dirty shift then
      slow and excessively precise 64-bit division.
    
    Modified:
      head/sys/dev/acpica/acpi_cpu.c
    
    Modified: head/sys/dev/acpica/acpi_cpu.c
    ==============================================================================
    --- head/sys/dev/acpica/acpi_cpu.c	Thu Feb 28 10:59:40 2013	(r247459)
    +++ head/sys/dev/acpica/acpi_cpu.c	Thu Feb 28 11:27:01 2013	(r247460)
    @@ -981,8 +981,8 @@ acpi_cpu_idle(sbintime_t sbt)
     
         /* Find the lowest state that has small enough latency. */
         us = sc->cpu_prev_sleep;
    -    if (sbt >= 0 && us > sbt / SBT_1US)
    -	us = sbt / SBT_1US;
    +    if (sbt >= 0 && us > (sbt >> 12))
    +	us = (sbt >> 12);
         cx_next_idx = 0;
         if (cpu_disable_deep_sleep)
     	i = min(sc->cpu_cx_lowest, sc->cpu_non_c3);
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 13:46:08 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 2EEDFA42;
     Thu, 28 Feb 2013 13:46:08 +0000 (UTC) (envelope-from mav@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 18F2B66D;
     Thu, 28 Feb 2013 13:46:08 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1SDk7Cg010268;
     Thu, 28 Feb 2013 13:46:07 GMT (envelope-from mav@svn.freebsd.org)
    Received: (from mav@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1SDk4tv010244;
     Thu, 28 Feb 2013 13:46:04 GMT (envelope-from mav@svn.freebsd.org)
    Message-Id: <201302281346.r1SDk4tv010244@svn.freebsd.org>
    From: Alexander Motin 
    Date: Thu, 28 Feb 2013 13:46:03 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247463 - in head: share/man/man9 sys/arm/allwinner
     sys/arm/arm sys/arm/broadcom/bcm2835 sys/arm/lpc sys/arm/mv sys/arm/ti/am335x
     sys/arm/versatile sys/dev/acpica sys/i386/xen sys/ia64/...
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 13:46:08 -0000
    
    Author: mav
    Date: Thu Feb 28 13:46:03 2013
    New Revision: 247463
    URL: http://svnweb.freebsd.org/changeset/base/247463
    
    Log:
      MFcalloutng:
      Switch eventtimers(9) from using struct bintime to sbintime_t.
      Even before this not a single driver really supported full dynamic range of
      struct bintime even in theory, not speaking about practical inexpediency.
      This change legitimates the status quo and cleans up the code.
    
    Modified:
      head/share/man/man9/eventtimers.9
      head/sys/arm/allwinner/timer.c
      head/sys/arm/arm/mpcore_timer.c
      head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c
      head/sys/arm/lpc/lpc_timer.c
      head/sys/arm/mv/timer.c
      head/sys/arm/ti/am335x/am335x_dmtimer.c
      head/sys/arm/versatile/sp804.c
      head/sys/dev/acpica/acpi_hpet.c
      head/sys/i386/xen/clock.c
      head/sys/ia64/ia64/clock.c
      head/sys/kern/kern_clocksource.c
      head/sys/kern/kern_et.c
      head/sys/mips/mips/tick.c
      head/sys/mips/nlm/tick.c
      head/sys/mips/rmi/tick.c
      head/sys/powerpc/aim/clock.c
      head/sys/powerpc/booke/clock.c
      head/sys/sparc64/sparc64/tick.c
      head/sys/sys/timeet.h
      head/sys/x86/isa/atrtc.c
      head/sys/x86/isa/clock.c
      head/sys/x86/x86/local_apic.c
    
    Modified: head/share/man/man9/eventtimers.9
    ==============================================================================
    --- head/share/man/man9/eventtimers.9	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/share/man/man9/eventtimers.9	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -1,5 +1,5 @@
     .\"
    -.\" Copyright (c) 2011 Alexander Motin 
    +.\" Copyright (c) 2011-2013 Alexander Motin 
     .\" All rights reserved.
     .\"
     .\" Redistribution and use in source and binary forms, with or without
    @@ -24,7 +24,7 @@
     .\"
     .\" $FreeBSD$
     .\"
    -.Dd December 14, 2011
    +.Dd February 25, 2013
     .Dt EVENTTIMERS 9
     .Os
     .Sh NAME
    @@ -36,7 +36,7 @@
     struct eventtimer;
     
     typedef int et_start_t(struct eventtimer *et,
    -    struct bintime *first, struct bintime *period);
    +    sbintime_t first, sbintime_t period);
     typedef int et_stop_t(struct eventtimer *et);
     typedef void et_event_cb_t(struct eventtimer *et, void *arg);
     typedef int et_deregister_cb_t(struct eventtimer *et, void *arg);
    @@ -53,8 +53,8 @@ struct eventtimer {
     	int			et_quality;
     	int			et_active;
     	uint64_t		et_frequency;
    -	struct bintime		et_min_period;
    -	struct bintime		et_max_period;
    +	sbintime_t		et_min_period;
    +	sbintime_t		et_max_period;
     	et_start_t		*et_start;
     	et_stop_t		*et_stop;
     	et_event_cb_t		*et_event_cb;
    @@ -75,7 +75,7 @@ struct eventtimer {
     .Ft int
     .Fn et_init "struct eventtimer *et" "et_event_cb_t *event" "et_deregister_cb_t *deregister" "void *arg"
     .Ft int
    -.Fn et_start "struct eventtimer *et" "struct bintime *first" "struct bintime *period"
    +.Fn et_start "struct eventtimer *et" "sbintime_t first" "sbintime_t period"
     .Ft int
     .Fn et_stop "struct eventtimer *et"
     .Ft int
    
    Modified: head/sys/arm/allwinner/timer.c
    ==============================================================================
    --- head/sys/arm/allwinner/timer.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/arm/allwinner/timer.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -95,7 +95,7 @@ int a10_timer_get_timerfreq(struct a10_t
     
     static u_int	a10_timer_get_timecount(struct timecounter *);
     static int	a10_timer_timer_start(struct eventtimer *,
    -    struct bintime *, struct bintime *);
    +    sbintime_t first, sbintime_t period);
     static int	a10_timer_timer_stop(struct eventtimer *);
     
     static uint64_t timer_read_counter64(void);
    @@ -193,12 +193,8 @@ a10_timer_attach(device_t dev)
     	sc->et.et_name = "a10_timer Eventtimer";
     	sc->et.et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERIODIC;
     	sc->et.et_quality = 1000;
    -	sc->et.et_min_period.sec = 0;
    -	sc->et.et_min_period.frac =
    -	    ((0x00000005LLU << 32) / sc->et.et_frequency) << 32;
    -	sc->et.et_max_period.sec = 0xfffffff0U / sc->et.et_frequency;
    -	sc->et.et_max_period.frac =
    -	    ((0xfffffffeLLU << 32) / sc->et.et_frequency) << 32;
    +	sc->et.et_min_period = (0x00000005LLU << 32) / sc->et.et_frequency;
    +	sc->et.et_max_period = (0xfffffffeLLU << 32) / sc->et.et_frequency;
     	sc->et.et_start = a10_timer_timer_start;
     	sc->et.et_stop = a10_timer_timer_stop;
     	sc->et.et_priv = sc;
    @@ -225,8 +221,8 @@ a10_timer_attach(device_t dev)
     }
     
     static int
    -a10_timer_timer_start(struct eventtimer *et, struct bintime *first,
    -    struct bintime *period)
    +a10_timer_timer_start(struct eventtimer *et, sbintime_t first,
    +    sbintime_t period)
     {
     	struct a10_timer_softc *sc;
     	uint32_t count;
    @@ -234,26 +230,21 @@ a10_timer_timer_start(struct eventtimer 
     
     	sc = (struct a10_timer_softc *)et->et_priv;
     
    -	sc->sc_period = 0;
    -
    -	if (period != NULL) {
    -		sc->sc_period = (sc->et.et_frequency * (period->frac >> 32)) >> 32;
    -		sc->sc_period += sc->et.et_frequency * period->sec;
    -	}
    -	if (first == NULL)
    +	if (period != 0)
    +		sc->sc_period = ((uint32_t)et->et_frequency * period) >> 32;
    +	else
    +		sc->sc_period = 0;
    +	if (first != 0)
    +		count = ((uint32_t)et->et_frequency * first) >> 32;
    +	else
     		count = sc->sc_period;
    -	else {
    -		count = (sc->et.et_frequency * (first->frac >> 32)) >> 32;
    -		if (first->sec != 0)
    -			count += sc->et.et_frequency * first->sec;
    -	}
     
     	/* Update timer values */
     	timer_write_4(sc, SW_TIMER0_INT_VALUE_REG, sc->sc_period);
     	timer_write_4(sc, SW_TIMER0_CUR_VALUE_REG, count);
     
     	val = timer_read_4(sc, SW_TIMER0_CTRL_REG);
    -	if (first == NULL) {
    +	if (period != 0) {
     		/* periodic */
     		val |= TIMER_AUTORELOAD;
     	} else {
    
    Modified: head/sys/arm/arm/mpcore_timer.c
    ==============================================================================
    --- head/sys/arm/arm/mpcore_timer.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/arm/arm/mpcore_timer.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -167,31 +167,23 @@ arm_tmr_get_timecount(struct timecounter
      *	Always returns 0
      */
     static int
    -arm_tmr_start(struct eventtimer *et, struct bintime *first,
    -              struct bintime *period)
    +arm_tmr_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
     {
    -	struct arm_tmr_softc *sc = (struct arm_tmr_softc *)et->et_priv;
     	uint32_t load, count;
     	uint32_t ctrl;
     
     	ctrl = PRV_TIMER_CTRL_IRQ_ENABLE | PRV_TIMER_CTRL_TIMER_ENABLE;
     
    -	if (period != NULL) {
    -		load = (et->et_frequency * (period->frac >> 32)) >> 32;
    -		if (period->sec > 0)
    -			load += et->et_frequency * period->sec;
    +	if (period != 0) {
    +		load = ((uint32_t)et->et_frequency * period) >> 32;
     		ctrl |= PRV_TIMER_CTRL_AUTO_RELOAD;
    -	} else {
    +	} else
     		load = 0;
    -	}
     
    -	if (first != NULL) {
    -		count = (sc->et.et_frequency * (first->frac >> 32)) >> 32;
    -		if (first->sec != 0)
    -			count += sc->et.et_frequency * first->sec;
    -	} else {
    +	if (first != 0)
    +		count = ((uint32_t)et->et_frequency * first) >> 32;
    +	else
     		count = load;
    -	}
     
     	tmr_prv_write_4(PRV_TIMER_LOAD, load);
     	tmr_prv_write_4(PRV_TIMER_COUNT, count);
    @@ -330,12 +322,8 @@ arm_tmr_attach(device_t dev)
     	sc->et.et_quality = 1000;
     
     	sc->et.et_frequency = sc->clkfreq;
    -	sc->et.et_min_period.sec = 0;
    -	sc->et.et_min_period.frac =
    -            ((0x00000002LLU << 32) / sc->et.et_frequency) << 32;
    -	sc->et.et_max_period.sec = 0xfffffff0U / sc->et.et_frequency;
    -	sc->et.et_max_period.frac =
    -            ((0xfffffffeLLU << 32) / sc->et.et_frequency) << 32;
    +	sc->et.et_min_period = (0x00000002LLU << 32) / sc->et.et_frequency;
    +	sc->et.et_max_period = (0xfffffffeLLU << 32) / sc->et.et_frequency;
     	sc->et.et_start = arm_tmr_start;
     	sc->et.et_stop = arm_tmr_stop;
     	sc->et.et_priv = sc;
    
    Modified: head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c
    ==============================================================================
    --- head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -118,19 +118,16 @@ bcm_systimer_tc_get_timecount(struct tim
     }
     
     static int
    -bcm_systimer_start(struct eventtimer *et, struct bintime *first,
    -              struct bintime *period)
    +bcm_systimer_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
     {
     	struct systimer *st = et->et_priv;
     	uint32_t clo;
     	uint32_t count;
     	register_t s;
     
    -	if (first != NULL) {
    +	if (first != 0) {
     
    -		count = (st->et.et_frequency * (first->frac >> 32)) >> 32;
    -		if (first->sec != 0)
    -			count += st->et.et_frequency * first->sec;
    +		count = ((uint32_t)et->et_frequency * first) >> 32;
     
     		s = intr_disable();
     		clo = bcm_systimer_tc_read_4(SYSTIMER_CLO);
    @@ -238,12 +235,10 @@ bcm_systimer_attach(device_t dev)
     	sc->st[DEFAULT_TIMER].et.et_flags = ET_FLAGS_ONESHOT;
     	sc->st[DEFAULT_TIMER].et.et_quality = 1000;
     	sc->st[DEFAULT_TIMER].et.et_frequency = sc->sysclk_freq;
    -	sc->st[DEFAULT_TIMER].et.et_min_period.sec = 0;
    -	sc->st[DEFAULT_TIMER].et.et_min_period.frac =
    -	    ((MIN_PERIOD << 32) / sc->st[DEFAULT_TIMER].et.et_frequency) << 32;
    -	sc->st[DEFAULT_TIMER].et.et_max_period.sec = 0xfffffff0U / sc->st[DEFAULT_TIMER].et.et_frequency;
    -	sc->st[DEFAULT_TIMER].et.et_max_period.frac =
    -	    ((0xfffffffeLLU << 32) / sc->st[DEFAULT_TIMER].et.et_frequency) << 32;
    +	sc->st[DEFAULT_TIMER].et.et_min_period =
    +	    (MIN_PERIOD << 32) / sc->st[DEFAULT_TIMER].et.et_frequency;
    +	sc->st[DEFAULT_TIMER].et.et_max_period =
    +	    (0xfffffffeLLU << 32) / sc->st[DEFAULT_TIMER].et.et_frequency;
     	sc->st[DEFAULT_TIMER].et.et_start = bcm_systimer_start;
     	sc->st[DEFAULT_TIMER].et.et_stop = bcm_systimer_stop;
     	sc->st[DEFAULT_TIMER].et.et_priv = &sc->st[DEFAULT_TIMER];
    
    Modified: head/sys/arm/lpc/lpc_timer.c
    ==============================================================================
    --- head/sys/arm/lpc/lpc_timer.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/arm/lpc/lpc_timer.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -72,8 +72,8 @@ static struct lpc_timer_softc *timer_sof
     static int lpc_timer_initialized = 0;
     static int lpc_timer_probe(device_t);
     static int lpc_timer_attach(device_t);
    -static int lpc_timer_start(struct eventtimer *, struct bintime *first,
    -    struct bintime *);
    +static int lpc_timer_start(struct eventtimer *,
    +    sbintime_t first, sbintime_t period);
     static int lpc_timer_stop(struct eventtimer *et);
     static unsigned lpc_get_timecount(struct timecounter *);
     static int lpc_hardclock(void *);
    @@ -173,12 +173,8 @@ lpc_timer_attach(device_t dev)
     	sc->lt_et.et_name = "LPC32x0 Timer0";
     	sc->lt_et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT;
     	sc->lt_et.et_quality = 1000;
    -	sc->lt_et.et_min_period.sec = 0;
    -	sc->lt_et.et_min_period.frac =
    -	    ((0x00000002LLU << 32) / sc->lt_et.et_frequency) << 32;
    -	sc->lt_et.et_max_period.sec = 0xfffffff0U / sc->lt_et.et_frequency;
    -	sc->lt_et.et_max_period.frac =
    -	    ((0xfffffffeLLU << 32) / sc->lt_et.et_frequency) << 32;
    +	sc->lt_et.et_min_period = (0x00000002LLU << 32) / sc->lt_et.et_frequency;
    +	sc->lt_et.et_max_period = (0xfffffffeLLU << 32) / sc->lt_et.et_frequency;
     	sc->lt_et.et_start = lpc_timer_start;
     	sc->lt_et.et_stop = lpc_timer_stop;
     	sc->lt_et.et_priv = sc;
    @@ -199,27 +195,23 @@ lpc_timer_attach(device_t dev)
     }
     
     static int
    -lpc_timer_start(struct eventtimer *et, struct bintime *first,
    -    struct bintime *period)
    +lpc_timer_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
     {
     	struct lpc_timer_softc *sc = (struct lpc_timer_softc *)et->et_priv;
     	uint32_t ticks;
     
    -	if (period == NULL)
    +	if (period == 0) {
     		sc->lt_oneshot = 1;
    -	else {
    +		sc->lt_period = 0;
    +	} else {
     		sc->lt_oneshot = 0;
    -		sc->lt_period = (sc->lt_et.et_frequency * (first->frac >> 32)) >> 32;
    -			sc->lt_period += sc->lt_et.et_frequency * first->sec;
    +		sc->lt_period = ((uint32_t)et->et_frequency * period) >> 32;
     	}
     
    -	if (first == NULL)
    +	if (first == 0)
     		ticks = sc->lt_period;
    -	else {
    -		ticks = (sc->lt_et.et_frequency * (first->frac >> 32)) >> 32;
    -		if (first->sec != 0)
    -			ticks += sc->lt_et.et_frequency * first->sec;
    -	}
    +	else
    +		ticks = ((uint32_t)et->et_frequency * first) >> 32;
     
     	/* Reset timer */
     	timer0_write_4(sc, LPC_TIMER_TCR, LPC_TIMER_TCR_RESET);
    
    Modified: head/sys/arm/mv/timer.c
    ==============================================================================
    --- head/sys/arm/mv/timer.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/arm/mv/timer.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -93,7 +93,7 @@ static void	mv_watchdog_enable(void);
     static void	mv_watchdog_disable(void);
     static void	mv_watchdog_event(void *, unsigned int, int *);
     static int	mv_timer_start(struct eventtimer *et,
    -    struct bintime *first, struct bintime *period);
    +    sbintime_t first, sbintime_t period);
     static int	mv_timer_stop(struct eventtimer *et);
     static void	mv_setup_timers(void);
     
    @@ -168,12 +168,8 @@ mv_timer_attach(device_t dev)
     	sc->et.et_quality = 1000;
     
     	sc->et.et_frequency = MV_CLOCK_SRC;
    -	sc->et.et_min_period.sec = 0;
    -	sc->et.et_min_period.frac =
    -	    ((0x00000002LLU << 32) / sc->et.et_frequency) << 32;
    -	sc->et.et_max_period.sec = 0xfffffff0U / sc->et.et_frequency;
    -	sc->et.et_max_period.frac =
    -	    ((0xfffffffeLLU << 32) / sc->et.et_frequency) << 32;
    +	sc->et.et_min_period = (0x00000002LLU << 32) / sc->et.et_frequency;
    +	sc->et.et_max_period = (0xfffffffeLLU << 32) / sc->et.et_frequency;
     	sc->et.et_start = mv_timer_start;
     	sc->et.et_stop = mv_timer_stop;
     	sc->et.et_priv = sc;
    @@ -394,25 +390,20 @@ mv_watchdog_event(void *arg, unsigned in
     }
     
     static int
    -mv_timer_start(struct eventtimer *et,
    -    struct bintime *first, struct bintime *period)
    +mv_timer_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
     {
     	struct	mv_timer_softc *sc;
     	uint32_t val, val1;
     
     	/* Calculate dividers. */
     	sc = (struct mv_timer_softc *)et->et_priv;
    -	if (period != NULL) {
    -		val = (sc->et.et_frequency * (period->frac >> 32)) >> 32;
    -		if (period->sec != 0)
    -			val += sc->et.et_frequency * period->sec;
    -	} else
    +	if (period != 0)
    +		val = ((uint32_t)sc->et.et_frequency * period) >> 32;
    +	else
     		val = 0;
    -	if (first != NULL) {
    -		val1 = (sc->et.et_frequency * (first->frac >> 32)) >> 32;
    -		if (first->sec != 0)
    -			val1 += sc->et.et_frequency * first->sec;
    -	} else
    +	if (first != 0)
    +		val1 = ((uint32_t)sc->et.et_frequency * first) >> 32;
    +	else
     		val1 = val;
     
     	/* Apply configuration. */
    @@ -420,7 +411,7 @@ mv_timer_start(struct eventtimer *et,
     	mv_set_timer(0, val1);
     	val = mv_get_timer_control();
     	val |= CPU_TIMER0_EN;
    -	if (period != NULL)
    +	if (period != 0)
     		val |= CPU_TIMER0_AUTO;
     	else
     		val &= ~CPU_TIMER0_AUTO;
    
    Modified: head/sys/arm/ti/am335x/am335x_dmtimer.c
    ==============================================================================
    --- head/sys/arm/ti/am335x/am335x_dmtimer.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/arm/ti/am335x/am335x_dmtimer.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -143,30 +143,24 @@ am335x_dmtimer_tc_get_timecount(struct t
     }
     
     static int
    -am335x_dmtimer_start(struct eventtimer *et, struct bintime *first,
    -              struct bintime *period)
    +am335x_dmtimer_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
     {
     	struct am335x_dmtimer *tmr = (struct am335x_dmtimer *)et->et_priv;
     	uint32_t load, count;
     	uint32_t tclr = 0;
     
    -	if (period != NULL) {
    -		load = (et->et_frequency * (period->frac >> 32)) >> 32;
    -		if (period->sec > 0)
    -			load += et->et_frequency * period->sec;
    +	if (period != 0) {
    +		load = ((uint32_t)et->et_frequency * period) >> 32;
     		tclr |= 2; /* autoreload bit */
     		panic("periodic timer not implemented\n");
     	} else {
     		load = 0;
     	}
     
    -	if (first != NULL) {
    -		count = (tmr->et.et_frequency * (first->frac >> 32)) >> 32;
    -		if (first->sec != 0)
    -			count += tmr->et.et_frequency * first->sec;
    -	} else {
    +	if (first != 0)
    +		count = ((uint32_t)et->et_frequency * first) >> 32;
    +	else
     		count = load;
    -	}
     
     	/* Reset Timer */
     	am335x_dmtimer_et_write_4(DMTIMER_TSICR, 2);
    @@ -316,12 +310,10 @@ am335x_dmtimer_attach(device_t dev)
     	sc->t[3].et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT;
     	sc->t[3].et.et_quality = 1000;
     	sc->t[3].et.et_frequency = sc->sysclk_freq;
    -	sc->t[3].et.et_min_period.sec = 0;
    -	sc->t[3].et.et_min_period.frac =
    -	    ((0x00000002LLU << 32) / sc->t[3].et.et_frequency) << 32;
    -	sc->t[3].et.et_max_period.sec = 0xfffffff0U / sc->t[3].et.et_frequency;
    -	sc->t[3].et.et_max_period.frac =
    -	    ((0xfffffffeLLU << 32) / sc->t[3].et.et_frequency) << 32;
    +	sc->t[3].et.et_min_period =
    +	    (0x00000002LLU << 32) / sc->t[3].et.et_frequency;
    +	sc->t[3].et.et_max_period =
    +	    (0xfffffffeLLU << 32) / sc->t[3].et.et_frequency;
     	sc->t[3].et.et_start = am335x_dmtimer_start;
     	sc->t[3].et.et_stop = am335x_dmtimer_stop;
     	sc->t[3].et.et_priv = &sc->t[3];
    
    Modified: head/sys/arm/versatile/sp804.c
    ==============================================================================
    --- head/sys/arm/versatile/sp804.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/arm/versatile/sp804.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -120,18 +120,15 @@ sp804_timer_tc_get_timecount(struct time
     }
     
     static int
    -sp804_timer_start(struct eventtimer *et, struct bintime *first,
    -              struct bintime *period)
    +sp804_timer_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
     {
     	struct sp804_timer_softc *sc = et->et_priv;
     	uint32_t count, reg;
     
    -	if (first != NULL) {
    +	if (first != 0) {
     		sc->et_enabled = 1;
     
    -		count = (sc->et.et_frequency * (first->frac >> 32)) >> 32;
    -		if (first->sec != 0)
    -			count += sc->et.et_frequency * first->sec;
    +		count = ((uint32_t)et->et_frequency * first) >> 32;
     
     		sp804_timer_tc_write_4(SP804_TIMER2_LOAD, count);
     		reg = TIMER_CONTROL_32BIT | TIMER_CONTROL_INTREN |
    @@ -142,7 +139,7 @@ sp804_timer_start(struct eventtimer *et,
     		return (0);
     	} 
     
    -	if (period != NULL) {
    +	if (period != 0) {
     		panic("period");
     	}
     
    @@ -264,12 +261,8 @@ sp804_timer_attach(device_t dev)
     	sc->et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT;
     	sc->et.et_quality = 1000;
     	sc->et.et_frequency = sc->sysclk_freq / DEFAULT_DIVISOR;
    -	sc->et.et_min_period.sec = 0;
    -	sc->et.et_min_period.frac =
    -	    ((0x00000002LLU << 32) / sc->et.et_frequency) << 32;
    -	sc->et.et_max_period.sec = 0xfffffff0U / sc->et.et_frequency;
    -	sc->et.et_max_period.frac =
    -	    ((0xfffffffeLLU << 32) / sc->et.et_frequency) << 32;
    +	sc->et.et_min_period = (0x00000002LLU << 32) / sc->et.et_frequency;
    +	sc->et.et_max_period = (0xfffffffeLLU << 32) / sc->et.et_frequency;
     	sc->et.et_start = sp804_timer_start;
     	sc->et.et_stop = sp804_timer_stop;
     	sc->et.et_priv = sc;
    
    Modified: head/sys/dev/acpica/acpi_hpet.c
    ==============================================================================
    --- head/sys/dev/acpica/acpi_hpet.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/dev/acpica/acpi_hpet.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -147,8 +147,7 @@ hpet_disable(struct hpet_softc *sc)
     }
     
     static int
    -hpet_start(struct eventtimer *et,
    -    struct bintime *first, struct bintime *period)
    +hpet_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
     {
     	struct hpet_timer *mt = (struct hpet_timer *)et->et_priv;
     	struct hpet_timer *t;
    @@ -156,20 +155,16 @@ hpet_start(struct eventtimer *et,
     	uint32_t fdiv, now;
     
     	t = (mt->pcpu_master < 0) ? mt : &sc->t[mt->pcpu_slaves[curcpu]];
    -	if (period != NULL) {
    +	if (period != 0) {
     		t->mode = 1;
    -		t->div = (sc->freq * (period->frac >> 32)) >> 32;
    -		if (period->sec != 0)
    -			t->div += sc->freq * period->sec;
    +		t->div = (sc->freq * period) >> 32;
     	} else {
     		t->mode = 2;
     		t->div = 0;
     	}
    -	if (first != NULL) {
    -		fdiv = (sc->freq * (first->frac >> 32)) >> 32;
    -		if (first->sec != 0)
    -			fdiv += sc->freq * first->sec;
    -	} else
    +	if (first != 0)
    +		fdiv = (sc->freq * first) >> 32;
    +	else
     		fdiv = t->div;
     	if (t->irq < 0)
     		bus_write_4(sc->mem_res, HPET_ISR, 1 << t->num);
    @@ -684,12 +679,9 @@ hpet_attach(device_t dev)
     		if ((t->caps & HPET_TCAP_PER_INT) == 0)
     			t->et.et_quality -= 10;
     		t->et.et_frequency = sc->freq;
    -		t->et.et_min_period.sec = 0;
    -		t->et.et_min_period.frac =
    -		    (((uint64_t)(HPET_MIN_CYCLES * 2) << 32) / sc->freq) << 32;
    -		t->et.et_max_period.sec = 0xfffffffeLLU / sc->freq;
    -		t->et.et_max_period.frac =
    -		    ((0xfffffffeLLU << 32) / sc->freq) << 32;
    +		t->et.et_min_period =
    +		    ((uint64_t)(HPET_MIN_CYCLES * 2) << 32) / sc->freq;
    +		t->et.et_max_period = (0xfffffffeLLU << 32) / sc->freq;
     		t->et.et_start = hpet_start;
     		t->et.et_stop = hpet_stop;
     		t->et.et_priv = &sc->t[i];
    
    Modified: head/sys/i386/xen/clock.c
    ==============================================================================
    --- head/sys/i386/xen/clock.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/i386/xen/clock.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -768,8 +768,7 @@ resettodr()
     #endif
     
     static int
    -xen_et_start(struct eventtimer *et,
    -    struct bintime *first, struct bintime *period)
    +xen_et_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
     {
     	struct xen_et_state *state = DPCPU_PTR(et_state);
     	struct shadow_time_info *shadow;
    @@ -777,21 +776,16 @@ xen_et_start(struct eventtimer *et,
     
     	__get_time_values_from_xen();
     
    -	if (period != NULL) {
    +	if (period != 0) {
     		state->mode = MODE_PERIODIC;
    -		state->period = (1000000000LL *
    -		    (uint32_t)(period->frac >> 32)) >> 32;
    -		if (period->sec != 0)
    -			state->period += 1000000000LL * period->sec;
    +		state->period = (1000000000LLU * period) >> 32;
     	} else {
     		state->mode = MODE_ONESHOT;
     		state->period = 0;
     	}
    -	if (first != NULL) {
    -		fperiod = (1000000000LL * (uint32_t)(first->frac >> 32)) >> 32;
    -		if (first->sec != 0)
    -			fperiod += 1000000000LL * first->sec;
    -	} else
    +	if (first != 0)
    +		fperiod = (1000000000LLU * first) >> 32;
    +	else
     		fperiod = state->period;
     
     	shadow = &per_cpu(shadow_time, smp_processor_id());
    @@ -832,11 +826,9 @@ cpu_initclocks(void)
     	xen_et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT |
     	    ET_FLAGS_PERCPU;
     	xen_et.et_quality = 600;
    -	xen_et.et_frequency = 0;
    -	xen_et.et_min_period.sec = 0;
    -	xen_et.et_min_period.frac = 0x00400000LL << 32;
    -	xen_et.et_max_period.sec = 2;
    -	xen_et.et_max_period.frac = 0;
    +	xen_et.et_frequency = 1000000000;
    +	xen_et.et_min_period = 0x00400000LL;
    +	xen_et.et_max_period = (0xfffffffeLLU << 32) / xen_et.et_frequency;
     	xen_et.et_start = xen_et_start;
     	xen_et.et_stop = xen_et_stop;
     	xen_et.et_priv = NULL;
    
    Modified: head/sys/ia64/ia64/clock.c
    ==============================================================================
    --- head/sys/ia64/ia64/clock.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/ia64/ia64/clock.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -105,17 +105,14 @@ ia64_ih_clock(struct thread *td, u_int x
      * Event timer start method.
      */
     static int
    -ia64_clock_start(struct eventtimer *et, struct bintime *first,
    -    struct bintime *period)
    +ia64_clock_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
     {
     	u_long itc, load;
     	register_t is;
     
    -	if (period != NULL) {
    +	if (period != 0) {
     		PCPU_SET(md.clock_mode, CLOCK_ET_PERIODIC);
    -		load = (et->et_frequency * (period->frac >> 32)) >> 32;
    -		if (period->sec > 0)
    -			load += et->et_frequency * period->sec;
    +		load = (et->et_frequency * period) >> 32;
     	} else {
     		PCPU_SET(md.clock_mode, CLOCK_ET_ONESHOT);
     		load = 0;
    @@ -123,11 +120,8 @@ ia64_clock_start(struct eventtimer *et, 
     
     	PCPU_SET(md.clock_load, load);
     
    -	if (first != NULL) {
    -		load = (et->et_frequency * (first->frac >> 32)) >> 32;
    -		if (first->sec > 0)
    -			load += et->et_frequency * first->sec;
    -	}
    +	if (first != 0)
    +		load = (et->et_frequency * first) >> 32;
     
     	is = intr_disable();
     	itc = ia64_get_itc();
    @@ -185,10 +179,8 @@ clock_configure(void *dummy)
     	et->et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU;
     	et->et_quality = 1000;
     	et->et_frequency = itc_freq;
    -	et->et_min_period.sec = 0;
    -	et->et_min_period.frac = (0x8000000000000000ul / (u_long)(10*hz)) << 1;
    -	et->et_max_period.sec = 0xffffffff;
    -	et->et_max_period.frac = ((0xfffffffeul << 32) / itc_freq) << 32;
    +	et->et_min_period = SBT_1S / (10 * hz);
    +	et->et_max_period = (0xfffffffeul << 32) / itc_freq;
     	et->et_start = ia64_clock_start;
     	et->et_stop = ia64_clock_stop;
     	et->et_priv = NULL;
    
    Modified: head/sys/kern/kern_clocksource.c
    ==============================================================================
    --- head/sys/kern/kern_clocksource.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/kern/kern_clocksource.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -153,6 +153,8 @@ static DPCPU_DEFINE(struct pcpu_state, t
     	(((uint64_t)0x8000000000000000 + ((bt)->frac >> 2)) /		\
     	    ((bt)->frac >> 1))
     
    +#define	SBT2FREQ(sbt)	((SBT_1S + ((sbt) >> 1)) / (sbt))
    +
     /*
      * Timer broadcast IPI handler.
      */
    @@ -442,7 +444,7 @@ loadtimer(struct bintime *now, int start
     			    new.sec, (u_int)(new.frac >> 32));
     			*next = new;
     			bintime_add(next, now);
    -			et_start(timer, &new, &timerperiod);
    +			et_start(timer, bttosbt(new), bttosbt(timerperiod));
     		}
     	} else {
     		getnextevent(&new);
    @@ -454,7 +456,7 @@ loadtimer(struct bintime *now, int start
     		if (!eq) {
     			*next = new;
     			bintime_sub(&new, now);
    -			et_start(timer, &new, NULL);
    +			et_start(timer, bttosbt(new), 0);
     		}
     	}
     }
    @@ -603,13 +605,13 @@ round_freq(struct eventtimer *et, int fr
     			div = 1 << (flsl(div + div / 2) - 1);
     		freq = (et->et_frequency + div / 2) / div;
     	}
    -	if (et->et_min_period.sec > 0)
    +	if (et->et_min_period > SBT_1S)
     		panic("Event timer \"%s\" doesn't support sub-second periods!",
     		    et->et_name);
    -	else if (et->et_min_period.frac != 0)
    -		freq = min(freq, BT2FREQ(&et->et_min_period));
    -	if (et->et_max_period.sec == 0 && et->et_max_period.frac != 0)
    -		freq = max(freq, BT2FREQ(&et->et_max_period));
    +	else if (et->et_min_period != 0)
    +		freq = min(freq, SBT2FREQ(et->et_min_period));
    +	if (et->et_max_period < SBT_1S && et->et_max_period != 0)
    +		freq = max(freq, SBT2FREQ(et->et_max_period));
     	return (freq);
     }
     
    
    Modified: head/sys/kern/kern_et.c
    ==============================================================================
    --- head/sys/kern/kern_et.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/kern/kern_et.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -1,5 +1,5 @@
     /*-
    - * Copyright (c) 2010 Alexander Motin 
    + * Copyright (c) 2010-2013 Alexander Motin 
      * All rights reserved.
      *
      * Redistribution and use in source and binary forms, with or without
    @@ -62,6 +62,7 @@ et_register(struct eventtimer *et)
     			    et->et_quality);
     		}
     	}
    +	KASSERT(et->et_start, ("et_register: timer has no start function"));
     	et->et_sysctl = SYSCTL_ADD_NODE(NULL,
     	    SYSCTL_STATIC_CHILDREN(_kern_eventtimer_et), OID_AUTO, et->et_name,
     	    CTLFLAG_RW, 0, "event timer description");
    @@ -159,43 +160,29 @@ et_init(struct eventtimer *et, et_event_
      * period - period of subsequent periodic ticks.
      */
     int
    -et_start(struct eventtimer *et,
    -    struct bintime *first, struct bintime *period)
    +et_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
     {
     
     	if (!et->et_active)
     		return (ENXIO);
    -	if (first == NULL && period == NULL)
    -		return (EINVAL);
    -	if ((et->et_flags & ET_FLAGS_PERIODIC) == 0 &&
    -	    period != NULL)
    -		return (ENODEV);
    -	if ((et->et_flags & ET_FLAGS_ONESHOT) == 0 &&
    -	    period == NULL)
    -		return (ENODEV);
    -	if (first != NULL) {
    -		if (first->sec < et->et_min_period.sec ||
    -		    (first->sec == et->et_min_period.sec &&
    -		     first->frac < et->et_min_period.frac))
    -		        first = &et->et_min_period;
    -		if (first->sec > et->et_max_period.sec ||
    -		    (first->sec == et->et_max_period.sec &&
    -		     first->frac > et->et_max_period.frac))
    -		        first = &et->et_max_period;
    -	}
    -	if (period != NULL) {
    -		if (period->sec < et->et_min_period.sec ||
    -		    (period->sec == et->et_min_period.sec &&
    -		     period->frac < et->et_min_period.frac))
    -		        period = &et->et_min_period;
    -		if (period->sec > et->et_max_period.sec ||
    -		    (period->sec == et->et_max_period.sec &&
    -		     period->frac > et->et_max_period.frac))
    -		        period = &et->et_max_period;
    +	KASSERT(period >= 0, ("et_start: negative period"));
    +	KASSERT((et->et_flags & ET_FLAGS_PERIODIC) || period == 0,
    +		("et_start: period specified for oneshot-only timer"));
    +	KASSERT((et->et_flags & ET_FLAGS_ONESHOT) && period == 0,
    +		("et_start: period not specified for periodic-only timer"));
    +	if (period != 0) {
    +		if (period < et->et_min_period)
    +		        period = et->et_min_period;
    +		else if (period > et->et_max_period)
    +		        period = et->et_max_period;
    +	}
    +	if (period == 0 || first != 0) {
    +		if (first < et->et_min_period)
    +		        first = et->et_min_period;
    +		else if (first > et->et_max_period)
    +		        first = et->et_max_period;
     	}
    -	if (et->et_start)
    -		return (et->et_start(et, first, period));
    -	return (0);
    +	return (et->et_start(et, first, period));
     }
     
     /* Stop event timer hardware. */
    
    Modified: head/sys/mips/mips/tick.c
    ==============================================================================
    --- head/sys/mips/mips/tick.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/mips/mips/tick.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -217,22 +217,17 @@ DELAY(int n)
     }
     
     static int
    -clock_start(struct eventtimer *et,
    -    struct bintime *first, struct bintime *period)
    +clock_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
     {
     	uint32_t fdiv, div, next;
     
    -	if (period != NULL) {
    -		div = (et->et_frequency * (period->frac >> 32)) >> 32;
    -		if (period->sec != 0)
    -			div += et->et_frequency * period->sec;
    +	if (period != 0) {
    +		div = (et->et_frequency * period) >> 32;
     	} else
     		div = 0;
    -	if (first != NULL) {
    -		fdiv = (et->et_frequency * (first->frac >> 32)) >> 32;
    -		if (first->sec != 0)
    -			fdiv += et->et_frequency * first->sec;
    -	} else 
    +	if (first != 0)
    +		fdiv = (et->et_frequency * first) >> 32;
    +	else 
     		fdiv = div;
     	DPCPU_SET(cycles_per_tick, div);
     	next = mips_rd_count() + fdiv;
    @@ -361,11 +356,8 @@ clock_attach(device_t dev)
     	    ET_FLAGS_PERCPU;
     	sc->et.et_quality = 800;
     	sc->et.et_frequency = counter_freq;
    -	sc->et.et_min_period.sec = 0;
    -	sc->et.et_min_period.frac = 0x00004000LLU << 32; /* To be safe. */
    -	sc->et.et_max_period.sec = 0xfffffffeU / sc->et.et_frequency;
    -	sc->et.et_max_period.frac =
    -	    ((0xfffffffeLLU << 32) / sc->et.et_frequency) << 32;
    +	sc->et.et_min_period = 0x00004000LLU; /* To be safe. */
    +	sc->et.et_max_period = (0xfffffffeLLU << 32) / sc->et.et_frequency;
     	sc->et.et_start = clock_start;
     	sc->et.et_stop = clock_stop;
     	sc->et.et_priv = sc;
    
    Modified: head/sys/mips/nlm/tick.c
    ==============================================================================
    --- head/sys/mips/nlm/tick.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/mips/nlm/tick.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -222,22 +222,17 @@ DELAY(int n)
     }
     
     static int
    -clock_start(struct eventtimer *et,
    -    struct bintime *first, struct bintime *period)
    +clock_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
     {
     	uint32_t fdiv, div, next;
     
    -	if (period != NULL) {
    -		div = (et->et_frequency * (period->frac >> 32)) >> 32;
    -		if (period->sec != 0)
    -			div += et->et_frequency * period->sec;
    -	} else
    +	if (period != 0)
    +		div = (et->et_frequency * period) >> 32;
    +	else
     		div = 0;
    -	if (first != NULL) {
    -		fdiv = (et->et_frequency * (first->frac >> 32)) >> 32;
    -		if (first->sec != 0)
    -			fdiv += et->et_frequency * first->sec;
    -	} else 
    +	if (first != 0)
    +		fdiv = (et->et_frequency * first) >> 32;
    +	else
     		fdiv = div;
     	DPCPU_SET(cycles_per_tick, div);
     	next = mips_rd_count() + fdiv;
    @@ -357,11 +352,8 @@ clock_attach(device_t dev)
     	sc->et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_PERCPU;
     	sc->et.et_quality = 800;
     	sc->et.et_frequency = counter_freq;
    -	sc->et.et_min_period.sec = 0;
    -	sc->et.et_min_period.frac = 0x00004000LLU << 32; /* To be safe. */
    -	sc->et.et_max_period.sec = 0xfffffffeU / sc->et.et_frequency;
    -	sc->et.et_max_period.frac =
    -	    ((0xfffffffeLLU << 32) / sc->et.et_frequency) << 32;
    +	sc->et.et_min_period = 0x00004000LLU; /* To be safe. */
    +	sc->et.et_max_period = (0xfffffffeLLU << 32) / sc->et.et_frequency;
     	sc->et.et_start = clock_start;
     	sc->et.et_stop = clock_stop;
     	sc->et.et_priv = sc;
    
    Modified: head/sys/mips/rmi/tick.c
    ==============================================================================
    --- head/sys/mips/rmi/tick.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/mips/rmi/tick.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -219,22 +219,17 @@ DELAY(int n)
     }
     
     static int
    -clock_start(struct eventtimer *et,
    -    struct bintime *first, struct bintime *period)
    +clock_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
     {
     	uint32_t fdiv, div, next;
     
    -	if (period != NULL) {
    -		div = (et->et_frequency * (period->frac >> 32)) >> 32;
    -		if (period->sec != 0)
    -			div += et->et_frequency * period->sec;
    -	} else
    +	if (period != 0)
    +		div = (et->et_frequency * period) >> 32;
    +	else
     		div = 0;
    -	if (first != NULL) {
    -		fdiv = (et->et_frequency * (first->frac >> 32)) >> 32;
    -		if (first->sec != 0)
    -			fdiv += et->et_frequency * first->sec;
    -	} else 
    +	if (first != 0)
    +		fdiv = (et->et_frequency * first) >> 32;
    +	else 
     		fdiv = div;
     	DPCPU_SET(cycles_per_tick, div);
     	next = mips_rd_count() + fdiv;
    @@ -351,11 +346,8 @@ clock_attach(device_t dev)
     	    ET_FLAGS_PERCPU;
     	sc->et.et_quality = 800;
     	sc->et.et_frequency = counter_freq;
    -	sc->et.et_min_period.sec = 0;
    -	sc->et.et_min_period.frac = 0x00004000LLU << 32; /* To be safe. */
    -	sc->et.et_max_period.sec = 0xfffffffeU / sc->et.et_frequency;
    -	sc->et.et_max_period.frac =
    -	    ((0xfffffffeLLU << 32) / sc->et.et_frequency) << 32;
    +	sc->et.et_min_period = 0x00004000LLU; /* To be safe. */
    +	sc->et.et_max_period = (0xfffffffeLLU << 32) / sc->et.et_frequency;
     	sc->et.et_start = clock_start;
     	sc->et.et_stop = clock_stop;
     	sc->et.et_priv = sc;
    
    Modified: head/sys/powerpc/aim/clock.c
    ==============================================================================
    --- head/sys/powerpc/aim/clock.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/powerpc/aim/clock.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -85,7 +85,7 @@ static u_long		ticks_per_sec = 12500000;
     static u_long		*decr_counts[MAXCPU];
     
     static int		decr_et_start(struct eventtimer *et,
    -    struct bintime *first, struct bintime *period);
    +    sbintime_t first, sbintime_t period);
     static int		decr_et_stop(struct eventtimer *et);
     static timecounter_get_t	decr_get_timecount;
     
    @@ -195,12 +195,8 @@ decr_tc_init(void)
     	    ET_FLAGS_PERCPU;
     	decr_et.et_quality = 1000;
     	decr_et.et_frequency = ticks_per_sec;
    -	decr_et.et_min_period.sec = 0;
    -	decr_et.et_min_period.frac =
    -	    ((0x00000002LLU << 32) / ticks_per_sec) << 32;
    -	decr_et.et_max_period.sec = 0x7fffffffLLU / ticks_per_sec;
    -	decr_et.et_max_period.frac =
    -	    ((0x7fffffffLLU << 32) / ticks_per_sec) << 32;
    +	decr_et.et_min_period = (0x00000002LLU << 32) / ticks_per_sec;
    +	decr_et.et_max_period = (0x7fffffffLLU << 32) / ticks_per_sec;
     	decr_et.et_start = decr_et_start;
     	decr_et.et_stop = decr_et_stop;
     	decr_et.et_priv = NULL;
    @@ -212,24 +208,20 @@ decr_tc_init(void)
      */
     static int
     decr_et_start(struct eventtimer *et,
    -    struct bintime *first, struct bintime *period)
    +    sbintime_t first, sbintime_t period)
     {
     	struct decr_state *s = DPCPU_PTR(decr_state);
     	uint32_t fdiv;
     
    -	if (period != NULL) {
    +	if (period != 0) {
     		s->mode = 1;
    -		s->div = (decr_et.et_frequency * (period->frac >> 32)) >> 32;
    -		if (period->sec != 0)
    -			s->div += decr_et.et_frequency * period->sec;
    +		s->div = (decr_et.et_frequency * period) >> 32;
     	} else {
     		s->mode = 2;
    -		s->div = 0x7fffffff;
    +		s->div = 0;
     	}
    -	if (first != NULL) {
    -		fdiv = (decr_et.et_frequency * (first->frac >> 32)) >> 32;
    -		if (first->sec != 0)
    -			fdiv += decr_et.et_frequency * first->sec;
    +	if (first != 0) {
    +		fdiv = (decr_et.et_frequency * first) >> 32;
     	} else
     		fdiv = s->div;
     
    
    Modified: head/sys/powerpc/booke/clock.c
    ==============================================================================
    --- head/sys/powerpc/booke/clock.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/powerpc/booke/clock.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -88,7 +88,7 @@ static u_long		*decr_counts[MAXCPU];
     #define	DIFF19041970	2082844800
     
     static int		decr_et_start(struct eventtimer *et,
    -    struct bintime *first, struct bintime *period);
    +    sbintime_t first, sbintime_t period);
     static int		decr_et_stop(struct eventtimer *et);
     static timecounter_get_t decr_get_timecount;
     
    @@ -193,12 +193,8 @@ decr_tc_init(void)
     	    ET_FLAGS_PERCPU;
     	decr_et.et_quality = 1000;
     	decr_et.et_frequency = ticks_per_sec;
    -	decr_et.et_min_period.sec = 0;
    -	decr_et.et_min_period.frac =
    -	    ((0x00000002LLU << 32) / ticks_per_sec) << 32;
    -	decr_et.et_max_period.sec = 0xfffffffeLLU / ticks_per_sec;
    -	decr_et.et_max_period.frac =
    -	    ((0xfffffffeLLU << 32) / ticks_per_sec) << 32;
    +	decr_et.et_min_period = (0x00000002LLU << 32) / ticks_per_sec;
    +	decr_et.et_max_period = (0xfffffffeLLU << 32) / ticks_per_sec;
     	decr_et.et_start = decr_et_start;
     	decr_et.et_stop = decr_et_stop;
     	decr_et.et_priv = NULL;
    @@ -209,26 +205,21 @@ decr_tc_init(void)
      * Event timer start method.
      */
     static int
    -decr_et_start(struct eventtimer *et,
    -    struct bintime *first, struct bintime *period)
    +decr_et_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
     {
     	struct decr_state *s = DPCPU_PTR(decr_state);
     	uint32_t fdiv, tcr;
     
    -	if (period != NULL) {
    +	if (period != 0) {
     		s->mode = 1;
    -		s->div = (decr_et.et_frequency * (period->frac >> 32)) >> 32;
    -		if (period->sec != 0)
    -			s->div += decr_et.et_frequency * period->sec;
    +		s->div = (decr_et.et_frequency * period) >> 32;
     	} else {
     		s->mode = 2;
    -		s->div = 0xffffffff;
    +		s->div = 0;
     	}
    -	if (first != NULL) {
    -		fdiv = (decr_et.et_frequency * (first->frac >> 32)) >> 32;
    -		if (first->sec != 0)
    -			fdiv += decr_et.et_frequency * first->sec;
    -	} else
    +	if (first != 0)
    +		fdiv = (decr_et.et_frequency * first) >> 32;
    +	else
     		fdiv = s->div;
     
     	tcr = mfspr(SPR_TCR);
    
    Modified: head/sys/sparc64/sparc64/tick.c
    ==============================================================================
    --- head/sys/sparc64/sparc64/tick.c	Thu Feb 28 12:09:36 2013	(r247462)
    +++ head/sys/sparc64/sparc64/tick.c	Thu Feb 28 13:46:03 2013	(r247463)
    @@ -93,8 +93,8 @@ static timecounter_get_t stick_get_timec
     static timecounter_get_t stick_get_timecount_up;
     static rd_tick_t stick_rd;
     static wr_tick_cmpr_t stick_wr_cmpr;
    -static int tick_et_start(struct eventtimer *et, struct bintime *first,
    -    struct bintime *period);
    
    *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 16:22:50 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 1C9703A1;
     Thu, 28 Feb 2013 16:22:50 +0000 (UTC)
     (envelope-from davide@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 0F2B5F2B;
     Thu, 28 Feb 2013 16:22:50 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1SGMn9e059076;
     Thu, 28 Feb 2013 16:22:49 GMT (envelope-from davide@svn.freebsd.org)
    Received: (from davide@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1SGMnCL059075;
     Thu, 28 Feb 2013 16:22:49 GMT (envelope-from davide@svn.freebsd.org)
    Message-Id: <201302281622.r1SGMnCL059075@svn.freebsd.org>
    From: Davide Italiano 
    Date: Thu, 28 Feb 2013 16:22:49 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247467 - head/sys/kern
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 16:22:50 -0000
    
    Author: davide
    Date: Thu Feb 28 16:22:49 2013
    New Revision: 247467
    URL: http://svnweb.freebsd.org/changeset/base/247467
    
    Log:
      MFcalloutng:
      Style fixes.
    
    Modified:
      head/sys/kern/kern_timeout.c
    
    Modified: head/sys/kern/kern_timeout.c
    ==============================================================================
    --- head/sys/kern/kern_timeout.c	Thu Feb 28 15:21:12 2013	(r247466)
    +++ head/sys/kern/kern_timeout.c	Thu Feb 28 16:22:49 2013	(r247467)
    @@ -100,7 +100,7 @@ struct cc_mig_ent {
     	int	ce_migration_ticks;
     #endif
     };
    -	
    +
     /*
      * There is one struct callout_cpu per cpu, holding all relevant
      * state for the callout processing thread on the individual CPU.
    @@ -613,7 +613,7 @@ skip:
     }
     
     /*
    - * The callout mechanism is based on the work of Adam M. Costello and 
    + * The callout mechanism is based on the work of Adam M. Costello and
      * George Varghese, published in a technical report entitled "Redesigning
      * the BSD Callout and Timer Facilities" and modified slightly for inclusion
      * in FreeBSD by Justin T. Gibbs.  The original work on the data structures
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 16:25:23 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: by hub.freebsd.org (Postfix, from userid 1033)
     id 1642D5E6; Thu, 28 Feb 2013 16:25:23 +0000 (UTC)
    Date: Thu, 28 Feb 2013 16:25:23 +0000
    From: Alexey Dokuchaev 
    To: Davide Italiano 
    Subject: Re: svn commit: r247460 - head/sys/dev/acpica
    Message-ID: <20130228162522.GA41693@FreeBSD.org>
    References: <201302281127.r1SBR2VE068276@svn.freebsd.org>
    MIME-Version: 1.0
    Content-Type: text/plain; charset=koi8-r
    Content-Disposition: inline
    In-Reply-To: <201302281127.r1SBR2VE068276@svn.freebsd.org>
    User-Agent: Mutt/1.5.21 (2010-09-15)
    Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
     src-committers@freebsd.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 16:25:23 -0000
    
    On Thu, Feb 28, 2013 at 11:27:02AM +0000, Davide Italiano wrote:
    > New Revision: 247460
    > URL: http://svnweb.freebsd.org/changeset/base/247460
    > 
    > Log:
    >   MFcalloutng (r247427 by mav):
    >   We don't need any precision here. Let it be fast and dirty shift then
    >   slow and excessively precise 64-bit division.
    > 
    > -    if (sbt >= 0 && us > sbt / SBT_1US)
    > -	us = sbt / SBT_1US;
    > +    if (sbt >= 0 && us > (sbt >> 12))
    > +	us = (sbt >> 12);
    
    Does this really buy us anything?  Modern compilers should be smart enough to
    generate correct code.  Do you have evidence that this is not the case here?
    Not to mention that it obfuscates the code by using some magic constant.
    
    ./danfe
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 16:46:15 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 941C7E0A;
     Thu, 28 Feb 2013 16:46:15 +0000 (UTC)
     (envelope-from rysto32@gmail.com)
    Received: from mail-oa0-f46.google.com (mail-oa0-f46.google.com
     [209.85.219.46]) by mx1.freebsd.org (Postfix) with ESMTP id 17E6310D;
     Thu, 28 Feb 2013 16:46:14 +0000 (UTC)
    Received: by mail-oa0-f46.google.com with SMTP id k1so3960679oag.19
     for ; Thu, 28 Feb 2013 08:46:14 -0800 (PST)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
     h=mime-version:x-received:in-reply-to:references:date:message-id
     :subject:from:to:cc:content-type;
     bh=fywfp9U4kaC1JGHS+KnXUaSAc0T+nPxqHdk8LVeUpUA=;
     b=Ee273WLIjNqmxEPgkAJsBbzKFlPCzEmNmOFmuBH+j72HCHnYRPffDSjJorzQ/M1H+R
     9O+DP++aVTJ62ih+YqcA3lUm3peW7DiXOpo8Yf4kg7qUADEiSo0Tr4tSqUOmn6uXKrEB
     zLTyLyermTltpPzllVPiVRhyqcFoGfFPSQ+hv8pGcpz0rRmCMDx+7bHv4XfH7sUM5ltu
     E7eh2goc7DQdwlVDNUaOWOpiQPWasRbN6nOdR3vBSagFHT1Zh0CMx4FjrzV7AlFMhriK
     D9jI9TkJohK1TiI0q6CCf+SvWXaTFVYF+yue2WtYMv+W1tE5Zuxn4ke6jT8m+zlDowkD
     On8g==
    MIME-Version: 1.0
    X-Received: by 10.60.172.84 with SMTP id ba20mr6060780oec.10.1362069974546;
     Thu, 28 Feb 2013 08:46:14 -0800 (PST)
    Received: by 10.76.109.236 with HTTP; Thu, 28 Feb 2013 08:46:14 -0800 (PST)
    In-Reply-To: <20130228162522.GA41693@FreeBSD.org>
    References: <201302281127.r1SBR2VE068276@svn.freebsd.org>
     <20130228162522.GA41693@FreeBSD.org>
    Date: Thu, 28 Feb 2013 11:46:14 -0500
    Message-ID: 
    Subject: Re: svn commit: r247460 - head/sys/dev/acpica
    From: Ryan Stone 
    To: Alexey Dokuchaev 
    Content-Type: text/plain; charset=ISO-8859-1
    X-Content-Filtered-By: Mailman/MimeDel 2.1.14
    Cc: Davide Italiano , svn-src-head@freebsd.org,
     svn-src-all@freebsd.org, src-committers@freebsd.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 16:46:15 -0000
    
    On Thu, Feb 28, 2013 at 11:25 AM, Alexey Dokuchaev wrote:
    
    > On Thu, Feb 28, 2013 at 11:27:02AM +0000, Davide Italiano wrote:
    > > New Revision: 247460
    > > URL: http://svnweb.freebsd.org/changeset/base/247460
    > >
    > > Log:
    > >   MFcalloutng (r247427 by mav):
    > >   We don't need any precision here. Let it be fast and dirty shift then
    > >   slow and excessively precise 64-bit division.
    > >
    > > -    if (sbt >= 0 && us > sbt / SBT_1US)
    > > -     us = sbt / SBT_1US;
    > > +    if (sbt >= 0 && us > (sbt >> 12))
    > > +     us = (sbt >> 12);
    >
    > Does this really buy us anything?  Modern compilers should be smart enough
    > to
    > generate correct code.  Do you have evidence that this is not the case
    > here?
    > Not to mention that it obfuscates the code by using some magic constant.
    >
    > ./danfe
    >
    
    SBT_1US is 4294, not 4096 (1 << 12).  This is an approximation, which the
    compiler obviously can't automatically apply.
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 17:09:53 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 4651BC0D;
     Thu, 28 Feb 2013 17:09:53 +0000 (UTC) (envelope-from jhb@freebsd.org)
    Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net
     [IPv6:2001:470:1f10:75::2])
     by mx1.freebsd.org (Postfix) with ESMTP id 22AEB27D;
     Thu, 28 Feb 2013 17:09:53 +0000 (UTC)
    Received: from jhbbsd.localnet (unknown [209.249.190.124])
     by bigwig.baldwin.cx (Postfix) with ESMTPSA id 83AB8B9BA;
     Thu, 28 Feb 2013 12:09:52 -0500 (EST)
    From: John Baldwin 
    To: "Daniel O'Connor" 
    Subject: Re: svn commit: r247359 - head/sbin/reboot
    Date: Thu, 28 Feb 2013 11:01:15 -0500
    User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; )
    References: <201302262318.r1QNIauL003863@svn.freebsd.org>
     <201302271138.24452.jhb@freebsd.org>
     <4602D40D-C4B2-4FB5-8E3B-8D74E19118FD@gsoft.com.au>
    In-Reply-To: <4602D40D-C4B2-4FB5-8E3B-8D74E19118FD@gsoft.com.au>
    MIME-Version: 1.0
    Content-Type: Text/Plain;
      charset="iso-8859-1"
    Content-Transfer-Encoding: 7bit
    Message-Id: <201302281101.15493.jhb@freebsd.org>
    X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7
     (bigwig.baldwin.cx); Thu, 28 Feb 2013 12:09:52 -0500 (EST)
    Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
     src-committers@freebsd.org, Nick Hibma 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 17:09:53 -0000
    
    On Wednesday, February 27, 2013 6:23:02 pm Daniel O'Connor wrote:
    > 
    > On 28/02/2013, at 3:08, John Baldwin  wrote:
    > >> URL: http://svnweb.freebsd.org/changeset/base/247359
    > >> 
    > >> Log:
    > >>  Clarify that overriding the -h/-D flags through flags in device.hints
    > >>  only works for sio(4) but not for uart(4) which no longer has this flag.
    > > 
    > > You should probably just remove the flag entirely.  sio(4) doesn't build on 
    > > 8.x and later.
    > 
    > 
    > The handbook will need fixing too since it mentions sio(4) and -D/-h.
    
    -D/-h are still valid and work fine with uart.
    
    -- 
    John Baldwin
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 17:10:31 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 117ACFC2;
     Thu, 28 Feb 2013 17:10:31 +0000 (UTC)
     (envelope-from davide@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 047E12B3;
     Thu, 28 Feb 2013 17:10:31 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1SHAUvG074124;
     Thu, 28 Feb 2013 17:10:30 GMT (envelope-from davide@svn.freebsd.org)
    Received: (from davide@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1SHAUW7074119;
     Thu, 28 Feb 2013 17:10:30 GMT (envelope-from davide@svn.freebsd.org)
    Message-Id: <201302281710.r1SHAUW7074119@svn.freebsd.org>
    From: Davide Italiano 
    Date: Thu, 28 Feb 2013 17:10:30 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247476 - head/sys/sys
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 17:10:31 -0000
    
    Author: davide
    Date: Thu Feb 28 17:10:30 2013
    New Revision: 247476
    URL: http://svnweb.freebsd.org/changeset/base/247476
    
    Log:
      Move the definition of sbintime_t type from  to .
      With this change we prevent gross namespace pollution.
      
      Reported by:	bde
      Suggested by:	attilio
    
    Modified:
      head/sys/sys/time.h
      head/sys/sys/types.h
    
    Modified: head/sys/sys/time.h
    ==============================================================================
    --- head/sys/sys/time.h	Thu Feb 28 16:56:08 2013	(r247475)
    +++ head/sys/sys/time.h	Thu Feb 28 17:10:30 2013	(r247476)
    @@ -109,7 +109,6 @@ bintime_mul(struct bintime *bt, u_int x)
     	    ((a)->frac cmp (b)->frac) :					\
     	    ((a)->sec cmp (b)->sec))
     
    -typedef int64_t sbintime_t;
     #define	SBT_1S	((sbintime_t)1 << 32)
     #define	SBT_1M	(SBT_1S * 60)
     #define	SBT_1MS	(SBT_1S / 1000)
    
    Modified: head/sys/sys/types.h
    ==============================================================================
    --- head/sys/sys/types.h	Thu Feb 28 16:56:08 2013	(r247475)
    +++ head/sys/sys/types.h	Thu Feb 28 17:10:30 2013	(r247476)
    @@ -188,6 +188,8 @@ typedef	__rlim_t	rlim_t;		/* resource li
     #define	_RLIM_T_DECLARED
     #endif
     
    +typedef	__int64_t	sbintime_t;
    +
     typedef	__segsz_t	segsz_t;	/* segment size (in pages) */
     
     #ifndef _SIZE_T_DECLARED
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 17:37:40 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 24107D70;
     Thu, 28 Feb 2013 17:37:40 +0000 (UTC)
     (envelope-from mavbsd@gmail.com)
    Received: from mail-la0-x236.google.com (mail-la0-x236.google.com
     [IPv6:2a00:1450:4010:c03::236])
     by mx1.freebsd.org (Postfix) with ESMTP id BB8B6648;
     Thu, 28 Feb 2013 17:37:38 +0000 (UTC)
    Received: by mail-la0-f54.google.com with SMTP id gw10so2069204lab.13
     for ; Thu, 28 Feb 2013 09:37:37 -0800 (PST)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
     h=x-received:sender:message-id:date:from:user-agent:mime-version:to
     :cc:subject:references:in-reply-to:content-type
     :content-transfer-encoding;
     bh=jCdrLhoE/cGnjXIpGbqErhcv/tx4PuHRtejlMG06LFE=;
     b=uC1hE68earCTHYv7JN5H1mVh8//msP77UA9qbAY3NqGGYTMrXQH06TJb4zAOXxGQmX
     G4DkJLObHtZCzuSmv22wr0s/Rq1gPyf8wIcwBlipCL1G021YdW70FTV0/CphyIyiOaV2
     G4BerHEkMP3BGVwpMdJohouF2i+gLNgAITcsN9oiOoNqSHPH6NCnxU6/yiSvbvRY1LVB
     0wBbQjny7mFjJ9XVDbJMmI3tvWfkbDcdwfOzCmyJh0FEnhE9Tuc63NwG2ZDTrJDD6Qu6
     QOsX8VhU3RhY0P5XzlMvBFKALjJQbK7Ox/hwZeXRfOvncDyZxhK1HYDbAAUpmJfe6bGL
     lf8A==
    X-Received: by 10.112.87.132 with SMTP id ay4mr3906045lbb.87.1362073057587;
     Thu, 28 Feb 2013 09:37:37 -0800 (PST)
    Received: from mavbook.mavhome.dp.ua (mavhome.mavhome.dp.ua. [213.227.240.37])
     by mx.google.com with ESMTPS id g6sm3176128lbd.14.2013.02.28.09.37.34
     (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
     Thu, 28 Feb 2013 09:37:36 -0800 (PST)
    Sender: Alexander Motin 
    Message-ID: <512F95DC.1040005@FreeBSD.org>
    Date: Thu, 28 Feb 2013 19:37:32 +0200
    From: Alexander Motin 
    User-Agent: Mozilla/5.0 (X11; FreeBSD amd64;
     rv:17.0) Gecko/20130125 Thunderbird/17.0.2
    MIME-Version: 1.0
    To: Alexey Dokuchaev 
    Subject: Re: svn commit: r247460 - head/sys/dev/acpica
    References: <201302281127.r1SBR2VE068276@svn.freebsd.org>
     <20130228162522.GA41693@FreeBSD.org>
    In-Reply-To: <20130228162522.GA41693@FreeBSD.org>
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 7bit
    Cc: Davide Italiano , svn-src-head@freebsd.org,
     svn-src-all@freebsd.org, src-committers@freebsd.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 17:37:40 -0000
    
    On 28.02.2013 18:25, Alexey Dokuchaev wrote:
    > On Thu, Feb 28, 2013 at 11:27:02AM +0000, Davide Italiano wrote:
    >> New Revision: 247460
    >> URL: http://svnweb.freebsd.org/changeset/base/247460
    >>
    >> Log:
    >>   MFcalloutng (r247427 by mav):
    >>   We don't need any precision here. Let it be fast and dirty shift then
    >>   slow and excessively precise 64-bit division.
    >>
    >> -    if (sbt >= 0 && us > sbt / SBT_1US)
    >> -	us = sbt / SBT_1US;
    >> +    if (sbt >= 0 && us > (sbt >> 12))
    >> +	us = (sbt >> 12);
    > 
    > Does this really buy us anything?  Modern compilers should be smart enough to
    > generate correct code.  Do you have evidence that this is not the case here?
    > Not to mention that it obfuscates the code by using some magic constant.
    
    SBT_1US is 4294 (0x10c6). The best that compiler may do is replace
    division with multiplication. In fact, Clang even does this on amd64.
    But on i386 it calls __divdi3(), doing 64bit division in software. Shift
    is definitely cheaper and 5% precision is fine here.
    
    -- 
    Alexander Motin
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 17:42:57 2013
    Return-Path: 
    Delivered-To: svn-src-head@FreeBSD.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 34099F62;
     Thu, 28 Feb 2013 17:42:57 +0000 (UTC)
     (envelope-from brde@optusnet.com.au)
    Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au
     [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id E7E21688;
     Thu, 28 Feb 2013 17:42:56 +0000 (UTC)
    Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au
     (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106])
     by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 54747122EA2;
     Fri,  1 Mar 2013 04:14:41 +1100 (EST)
    Date: Fri, 1 Mar 2013 04:14:41 +1100 (EST)
    From: Bruce Evans 
    X-X-Sender: bde@besplex.bde.org
    To: Alexey Dokuchaev 
    Subject: Re: svn commit: r247460 - head/sys/dev/acpica
    In-Reply-To: <20130228162522.GA41693@FreeBSD.org>
    Message-ID: <20130301034553.J3187@besplex.bde.org>
    References: <201302281127.r1SBR2VE068276@svn.freebsd.org>
     <20130228162522.GA41693@FreeBSD.org>
    MIME-Version: 1.0
    Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
    X-Optus-CM-Score: 0
    X-Optus-CM-Analysis: v=2.0 cv=D4sfsYtj c=1 sm=1 a=f5xiIF61AdoA:10
     a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=7E17uGdFteIA:10
     a=6I5d2MoRAAAA:8 a=oT54Gf4zYM1ZF3CoQrEA:9 a=CjuIK1q_8ugA:10
     a=TEtd8y5WR3g2ypngnwZWYw==:117
    Cc: Davide Italiano , svn-src-head@FreeBSD.org,
     svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 17:42:57 -0000
    
    On Thu, 28 Feb 2013, Alexey Dokuchaev wrote:
    
    > On Thu, Feb 28, 2013 at 11:27:02AM +0000, Davide Italiano wrote:
    >> New Revision: 247460
    >> URL: http://svnweb.freebsd.org/changeset/base/247460
    >>
    >> Log:
    >>   MFcalloutng (r247427 by mav):
    >>   We don't need any precision here. Let it be fast and dirty shift then
    >>   slow and excessively precise 64-bit division.
    >>
    >> -    if (sbt >= 0 && us > sbt / SBT_1US)
    >> -	us = sbt / SBT_1US;
    >> +    if (sbt >= 0 && us > (sbt >> 12))
    >> +	us = (sbt >> 12);
    >
    > Does this really buy us anything?
    
    Only a little.
    
    > Modern compilers should be smart enough to
    > generate correct code.  Do you have evidence that this is not the case here?
    > Not to mention that it obfuscates the code by using some magic constant.
    
    Modern compilers aren't smart enough to generate optimal code for this.
    But they can be helped by casting sbt to uint64_t before dividing it by
    the power of 2.
    
    Testing showed the following non-optimal code:
    - clang on amd64: generates 2 extra shifts and 1 more addition for signed
       division.  It apparently doesn't notice that the tst ensures that sbt
       is >= 0.  It reduces the division to a shift but this needs fixups if
       the result might be negative.
    - gcc on amd64: turns the division into a single shift without help.
    - clang on i386: as on amd64.  Nice code except for the poor algorithm.
    - gcc on i386: uses the poor algorithm and generates fairly horrible code
       for it, with about 6 more register move instuctions than clang.
    
    Correct code for signed division by a power of 2 is different from
    correct code for unsigned division by a power of 2.  The former can't
    use a a shift, because C99 specifies division to be broken (that it
    rounds towards zero).  C90 permitted signed division to work correctly
    (to round towards minus infinity, or towards zero, in an
    implementation-defined way), but most hardware does the broken rounding
    so not many C implementations do correct rounding.
    
    Bruce
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 17:50:10 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 75E163BD;
     Thu, 28 Feb 2013 17:50:10 +0000 (UTC)
     (envelope-from yaneurabeya@gmail.com)
    Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com
     [209.85.220.43]) by mx1.freebsd.org (Postfix) with ESMTP id 3B36D6D4;
     Thu, 28 Feb 2013 17:50:10 +0000 (UTC)
    Received: by mail-pa0-f43.google.com with SMTP id bh2so1280787pad.30
     for ; Thu, 28 Feb 2013 09:50:09 -0800 (PST)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
     h=x-received:references:mime-version:in-reply-to:content-type
     :content-transfer-encoding:message-id:cc:x-mailer:from:subject:date
     :to; bh=GGVBwb8n+5dZsc5boh8tFzj7V6oYh8fEjhtCuPV/eFo=;
     b=cpFYLCpIYzhwp/R+0TF/xXj5yGJU02Nu4yCkt/0uJO9L0uGwp7ZMUpl0uYQ4iszBLD
     0jWBK7sg1xFje2cE4Et9g+5nwreUr8mVEWfs8MNi6Yu7bTeKc03iHHZSxRAi6YWtsp92
     vtRVqlczJ9xdy+0TgQ5lnuWZ4OA3g/sODGKPMXTmeTQg0E+9pay5njZO6Q0iJCHN69aA
     fSbzBYGGUPU0XXErii3ZZD3LpsJ74My70C+KHgvopbBje0xx58p1pgKhgWf2NU30L3CT
     mpQ9i96fuxZV+M13qItbGtZGmBK24v4mAz7MgOMEEgKqhtfWGVz3dyxjiY0NvVJEd+12
     VYCQ==
    X-Received: by 10.68.213.132 with SMTP id ns4mr10628907pbc.84.1362073809010;
     Thu, 28 Feb 2013 09:50:09 -0800 (PST)
    Received: from [10.155.32.40] (mobile-166-147-082-043.mycingular.net.
     [166.147.82.43])
     by mx.google.com with ESMTPS id vd4sm9028328pbc.35.2013.02.28.09.50.06
     (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
     Thu, 28 Feb 2013 09:50:08 -0800 (PST)
    References: <201302262318.r1QNIauL003863@svn.freebsd.org>
     <201302271138.24452.jhb@freebsd.org>
     <4602D40D-C4B2-4FB5-8E3B-8D74E19118FD@gsoft.com.au>
     <201302281101.15493.jhb@freebsd.org>
    Mime-Version: 1.0 (1.0)
    In-Reply-To: <201302281101.15493.jhb@freebsd.org>
    Content-Type: text/plain;
    	charset=us-ascii
    Content-Transfer-Encoding: quoted-printable
    Message-Id: <683610EF-6A53-4E4A-9EF9-3021029CB84C@gmail.com>
    X-Mailer: iPhone Mail (10B146)
    From: Garrett Cooper 
    Subject: Re: svn commit: r247359 - head/sbin/reboot
    Date: Thu, 28 Feb 2013 09:50:00 -0800
    To: John Baldwin 
    Cc: "svn-src-head@freebsd.org" ,
     Daniel O'Connor ,
     "svn-src-all@freebsd.org" ,
     "src-committers@freebsd.org" ,
     Nick Hibma 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 17:50:10 -0000
    
    On Feb 28, 2013, at 8:01 AM, John Baldwin  wrote:
    
    > On Wednesday, February 27, 2013 6:23:02 pm Daniel O'Connor wrote:
    >>=20
    >> On 28/02/2013, at 3:08, John Baldwin  wrote:
    >>>> URL: http://svnweb.freebsd.org/changeset/base/247359
    >>>>=20
    >>>> Log:
    >>>> Clarify that overriding the -h/-D flags through flags in device.hints
    >>>> only works for sio(4) but not for uart(4) which no longer has this flag=
    .
    >>>=20
    >>> You should probably just remove the flag entirely.  sio(4) doesn't build=
     on=20
    >>> 8.x and later.
    >>=20
    >>=20
    >> The handbook will need fixing too since it mentions sio(4) and -D/-h.
    >=20
    > -D/-h are still valid and work fine with uart.
    
    +1
    
    The only thing that isn't really there is symmetry in the .flags hint.. I'll=
     file a pr for that today so it doesn't get forgotten..
    Thanks,
    -Garrett=
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 17:52:27 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id CE30D613;
     Thu, 28 Feb 2013 17:52:27 +0000 (UTC)
     (envelope-from carpeddiem@gmail.com)
    Received: from mail-oa0-f41.google.com (mail-oa0-f41.google.com
     [209.85.219.41]) by mx1.freebsd.org (Postfix) with ESMTP id 74C3F6ED;
     Thu, 28 Feb 2013 17:52:27 +0000 (UTC)
    Received: by mail-oa0-f41.google.com with SMTP id i10so4176219oag.14
     for ; Thu, 28 Feb 2013 09:52:27 -0800 (PST)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
     h=mime-version:x-received:sender:in-reply-to:references:date
     :x-google-sender-auth:message-id:subject:from:to:cc:content-type;
     bh=p/SVAaCU2S0Q3gzbxnTKtzc4jIqyy8FhnEcOeOtP2Wc=;
     b=VKqbYuluzawffirRVmlEATJuKSO+0KkluoU6st4+N0R6sIlpFVFg2nA2/SUFRKTyuk
     ASTt69Mwy5clI+tV2FO7eJgFcA7h9OmAwEJgVBqsxSb+qdjp1G3kknF7tZFYPkYgpNtQ
     Ak1XevdqmtdAmOngi10wK4IS5cY2ctMiRTYqswRmCbytGfS4CanbafXHWUTM+VZd+XQn
     IoLxHzaCNUJuXXQL1NaABEs/Nba/tFNs9N/jBMiO4/zFsfV8DDRK89Y9POnRQkNCJCX+
     aLT7F5UQSHQ5XRco2XoG/UYhJe/v6EiBp7FcpUE4qr77HGTsdYbb0VqNqpsY8Qqcm47h
     2Oug==
    MIME-Version: 1.0
    X-Received: by 10.60.169.231 with SMTP id ah7mr6109646oec.142.1362073947011;
     Thu, 28 Feb 2013 09:52:27 -0800 (PST)
    Sender: carpeddiem@gmail.com
    Received: by 10.60.150.239 with HTTP; Thu, 28 Feb 2013 09:52:26 -0800 (PST)
    In-Reply-To: <201212121741.qBCHfM6Q008489@svn.freebsd.org>
    References: <201212121741.qBCHfM6Q008489@svn.freebsd.org>
    Date: Thu, 28 Feb 2013 12:52:26 -0500
    X-Google-Sender-Auth: tAK49L4Z8deqlIXWlPY5jzD5NCA
    Message-ID: 
    Subject: Re: svn commit: r244157 - head/sys/netinet
    From: Ed Maste 
    To: Gleb Smirnoff 
    Content-Type: text/plain; charset=ISO-8859-1
    Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
     src-committers@freebsd.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 17:52:27 -0000
    
    On 12 December 2012 12:41, Gleb Smirnoff  wrote:
    > Author: glebius
    > Date: Wed Dec 12 17:41:21 2012
    > New Revision: 244157
    > URL: http://svnweb.freebsd.org/changeset/base/244157
    >
    > Log:
    >     Fix a crash in tcp_input(), that happens when mbuf has a fwd_tag on it,
    >   but later after processing and freeing the tag, we need to jump back again
    >   to the findpcb label. Since the fwd_tag pointer wasn't NULL we tried to
    >   process and free the tag for second time.
    
    This will fix the crash, but I worry that packets matching the
    TIMEWAIT cases that previously caused the crash will now fail to be
    forwarded instead.
    
    I'm looking at separating the detach and free of the fwd_tag to address this.
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 19:43:15 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 5243E85F;
     Thu, 28 Feb 2013 19:43:15 +0000 (UTC)
     (envelope-from gonzo@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 35A6AE7D;
     Thu, 28 Feb 2013 19:43:15 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1SJhFvS023268;
     Thu, 28 Feb 2013 19:43:15 GMT (envelope-from gonzo@svn.freebsd.org)
    Received: (from gonzo@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1SJhEmC023261;
     Thu, 28 Feb 2013 19:43:14 GMT (envelope-from gonzo@svn.freebsd.org)
    Message-Id: <201302281943.r1SJhEmC023261@svn.freebsd.org>
    From: Oleksandr Tymoshenko 
    Date: Thu, 28 Feb 2013 19:43:14 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247495 - head/sys/dev/sdhci
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 19:43:15 -0000
    
    Author: gonzo
    Date: Thu Feb 28 19:43:14 2013
    New Revision: 247495
    URL: http://svnweb.freebsd.org/changeset/base/247495
    
    Log:
      Add hooks for plugging platform-provided transfer backend.
      
      In order to use platorm backend hardware driver should
      impement three methods:
      - platform_start_transfer and platform_finish_transfer
          to start and finish transfer
      - platform_will_handle - check whether transaction is
          suitable for backend. If not - driver will fall back
          to PIO mode.
      
      Submitted by:	Daisuke Aoyama 
      Approved by:	ian@
    
    Modified:
      head/sys/dev/sdhci/sdhci.c
      head/sys/dev/sdhci/sdhci.h
      head/sys/dev/sdhci/sdhci_if.m
    
    Modified: head/sys/dev/sdhci/sdhci.c
    ==============================================================================
    --- head/sys/dev/sdhci/sdhci.c	Thu Feb 28 19:36:22 2013	(r247494)
    +++ head/sys/dev/sdhci/sdhci.c	Thu Feb 28 19:43:14 2013	(r247495)
    @@ -573,6 +573,13 @@ sdhci_init_slot(device_t dev, struct sdh
     	if (slot->quirks & SDHCI_QUIRK_FORCE_DMA)
     		slot->opt |= SDHCI_HAVE_DMA;
     
    +	/* 
    +	 * Use platform-provided transfer backend
    +	 * with PIO as a fallback mechanism
    +	 */
    +	if (slot->opt & SDHCI_PLATFORM_TRANSFER)
    +		slot->opt &= ~SDHCI_HAVE_DMA;
    +
     	if (bootverbose || sdhci_debug) {
     		slot_printf(slot, "%uMHz%s 4bits%s%s%s %s\n",
     		    slot->max_clk / 1000000,
    @@ -909,7 +916,7 @@ sdhci_start_data(struct sdhci_slot *slot
     	WR2(slot, SDHCI_BLOCK_COUNT, (data->len + 511) / 512);
     }
     
    -static void
    +void
     sdhci_finish_data(struct sdhci_slot *slot)
     {
     	struct mmc_data *data = slot->curcmd->data;
    @@ -1102,13 +1109,23 @@ sdhci_data_irq(struct sdhci_slot *slot, 
     	}
     	if (slot->curcmd->error) {
     		/* No need to continue after any error. */
    -		sdhci_finish_data(slot);
    +		if (slot->flags & PLATFORM_DATA_STARTED) {
    +			slot->flags &= ~PLATFORM_DATA_STARTED;
    +			SDHCI_PLATFORM_FINISH_TRANSFER(slot->bus, slot);
    +		} else
    +			sdhci_finish_data(slot);
     		return;
     	}
     
     	/* Handle PIO interrupt. */
    -	if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL))
    -		sdhci_transfer_pio(slot);
    +	if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL)) {
    +		if ((slot->opt & SDHCI_PLATFORM_TRANSFER) && 
    +		    SDHCI_PLATFORM_WILL_HANDLE(slot->bus, slot)) {
    +			SDHCI_PLATFORM_START_TRANSFER(slot->bus, slot, &intmask);
    +			slot->flags |= PLATFORM_DATA_STARTED;
    +		} else
    +			sdhci_transfer_pio(slot);
    +	}
     	/* Handle DMA border. */
     	if (intmask & SDHCI_INT_DMA_END) {
     		struct mmc_data *data = slot->curcmd->data;
    @@ -1147,8 +1164,13 @@ sdhci_data_irq(struct sdhci_slot *slot, 
     		WR4(slot, SDHCI_DMA_ADDRESS, slot->paddr);
     	}
     	/* We have got all data. */
    -	if (intmask & SDHCI_INT_DATA_END)
    -		sdhci_finish_data(slot);
    +	if (intmask & SDHCI_INT_DATA_END) {
    +		if (slot->flags & PLATFORM_DATA_STARTED) {
    +			slot->flags &= ~PLATFORM_DATA_STARTED;
    +			SDHCI_PLATFORM_FINISH_TRANSFER(slot->bus, slot);
    +		} else
    +			sdhci_finish_data(slot);
    +	}
     }
     
     static void
    
    Modified: head/sys/dev/sdhci/sdhci.h
    ==============================================================================
    --- head/sys/dev/sdhci/sdhci.h	Thu Feb 28 19:36:22 2013	(r247494)
    +++ head/sys/dev/sdhci/sdhci.h	Thu Feb 28 19:43:14 2013	(r247495)
    @@ -224,8 +224,9 @@ struct sdhci_slot {
     	device_t	dev;		/* Slot device */
     	u_char		num;		/* Slot number */
     	u_char		opt;		/* Slot options */
    +#define SDHCI_HAVE_DMA			1
    +#define SDHCI_PLATFORM_TRANSFER		2
     	u_char		version;
    -#define SDHCI_HAVE_DMA		1
     	uint32_t	max_clk;	/* Max possible freq */
     	uint32_t	timeout_clk;	/* Timeout freq */
     	bus_dma_tag_t 	dmatag;
    @@ -250,6 +251,7 @@ struct sdhci_slot {
     #define CMD_STARTED		1
     #define STOP_STARTED		2
     #define SDHCI_USE_DMA		4	/* Use DMA for this req. */
    +#define PLATFORM_DATA_STARTED	8	/* Data transfer is handled by platform */
     	struct mtx	mtx;		/* Slot mutex */
     };
     
    @@ -257,6 +259,8 @@ int sdhci_generic_read_ivar(device_t bus
     int sdhci_generic_write_ivar(device_t bus, device_t child, int which, uintptr_t value);
     int sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num);
     void sdhci_start_slot(struct sdhci_slot *slot);
    +/* performs generic clean-up for platform transfers */
    +void sdhci_finish_data(struct sdhci_slot *slot);
     int sdhci_cleanup_slot(struct sdhci_slot *slot);
     int sdhci_generic_suspend(struct sdhci_slot *slot);
     int sdhci_generic_resume(struct sdhci_slot *slot);
    
    Modified: head/sys/dev/sdhci/sdhci_if.m
    ==============================================================================
    --- head/sys/dev/sdhci/sdhci_if.m	Thu Feb 28 19:36:22 2013	(r247494)
    +++ head/sys/dev/sdhci/sdhci_if.m	Thu Feb 28 19:43:14 2013	(r247495)
    @@ -131,6 +131,22 @@ METHOD void write_multi_4 {
     	bus_size_t		count;
     }
     
    +METHOD int platform_will_handle {
    +	device_t		brdev;
    +	struct sdhci_slot	*slot;
    +}
    +
    +METHOD void platform_start_transfer {
    +	device_t		brdev;
    +	struct sdhci_slot	*slot;
    +	uint32_t		*intmask;
    +}
    +
    +METHOD void platform_finish_transfer {
    +	device_t		brdev;
    +	struct sdhci_slot	*slot;
    +}
    +
     METHOD uint32_t min_freq {
     	device_t		brdev;
     	struct sdhci_slot	*slot;
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 19:48:20 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id BD6A0A29;
     Thu, 28 Feb 2013 19:48:20 +0000 (UTC)
     (envelope-from gonzo@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id AF951EAC;
     Thu, 28 Feb 2013 19:48:20 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1SJmKjV024120;
     Thu, 28 Feb 2013 19:48:20 GMT (envelope-from gonzo@svn.freebsd.org)
    Received: (from gonzo@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1SJmK3f024116;
     Thu, 28 Feb 2013 19:48:20 GMT (envelope-from gonzo@svn.freebsd.org)
    Message-Id: <201302281948.r1SJmK3f024116@svn.freebsd.org>
    From: Oleksandr Tymoshenko 
    Date: Thu, 28 Feb 2013 19:48:20 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247496 - head/sys/arm/broadcom/bcm2835
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 19:48:20 -0000
    
    Author: gonzo
    Date: Thu Feb 28 19:48:19 2013
    New Revision: 247496
    URL: http://svnweb.freebsd.org/changeset/base/247496
    
    Log:
      Add driver for BCM2835's DMA engine
      
      This is a version of code submitted by Daisuke Aoyama 
      with some architectural changes.
    
    Added:
      head/sys/arm/broadcom/bcm2835/bcm2835_dma.c   (contents, props changed)
      head/sys/arm/broadcom/bcm2835/bcm2835_dma.h   (contents, props changed)
    Modified:
      head/sys/arm/broadcom/bcm2835/files.bcm2835
    
    Added: head/sys/arm/broadcom/bcm2835/bcm2835_dma.c
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/sys/arm/broadcom/bcm2835/bcm2835_dma.c	Thu Feb 28 19:48:19 2013	(r247496)
    @@ -0,0 +1,727 @@
    +/*
    + * Copyright (c) 2013 Daisuke Aoyama 
    + * Copyright (c) 2013 Oleksandr Tymoshenko 
    + *
    + * 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 "bcm2835_dma.h"
    +#include "bcm2835_vcbus.h"
    +
    +#define	MAX_REG			9
    +
    +/* private flags */
    +#define	BCM_DMA_CH_USED		0x00000001
    +#define	BCM_DMA_CH_FREE		0x40000000
    +#define	BCM_DMA_CH_UNMAP	0x80000000
    +
    +/* Register Map (4.2.1.2) */
    +#define	BCM_DMA_CS(n)		(0x100*(n) + 0x00)
    +#define		CS_ACTIVE		(1 <<  0)
    +#define		CS_END			(1 <<  1)
    +#define		CS_INT			(1 <<  2)
    +#define		CS_DREQ			(1 <<  3)
    +#define		CS_ISPAUSED		(1 <<  4)
    +#define		CS_ISHELD		(1 <<  5)
    +#define		CS_ISWAIT		(1 <<  6)
    +#define		CS_ERR			(1 <<  8)
    +#define		CS_WAITWRT		(1 << 28)
    +#define		CS_DISDBG		(1 << 29)
    +#define		CS_ABORT		(1 << 30)
    +#define		CS_RESET		(1 << 31)
    +#define	BCM_DMA_CBADDR(n)	(0x100*(n) + 0x04)
    +#define	BCM_DMA_INFO(n)		(0x100*(n) + 0x08)
    +#define		INFO_INT_EN		(1 << 0)
    +#define		INFO_TDMODE		(1 << 1)
    +#define		INFO_WAIT_RESP		(1 << 3)
    +#define		INFO_D_INC		(1 << 4)
    +#define		INFO_D_WIDTH		(1 << 5)
    +#define		INFO_D_DREQ		(1 << 6)
    +#define		INFO_S_INC		(1 << 8)
    +#define		INFO_S_WIDTH		(1 << 9)
    +#define		INFO_S_DREQ		(1 << 10)
    +#define		INFO_WAITS_SHIFT	(21)
    +#define		INFO_PERMAP_SHIFT	(16)
    +#define		INFO_PERMAP_MASK	(0x1f << INFO_PERMAP_SHIFT)
    +
    +#define	BCM_DMA_SRC(n)		(0x100*(n) + 0x0C)
    +#define	BCM_DMA_DST(n)		(0x100*(n) + 0x10)
    +#define	BCM_DMA_LEN(n)		(0x100*(n) + 0x14)
    +#define	BCM_DMA_STRIDE(n)	(0x100*(n) + 0x18)
    +#define	BCM_DMA_CBNEXT(n)	(0x100*(n) + 0x1C)
    +#define	BCM_DMA_DEBUG(n)	(0x100*(n) + 0x20)
    +#define		DEBUG_ERROR_MASK	(7)
    +
    +#define	BCM_DMA_INT_STATUS	0xfe0
    +#define	BCM_DMA_ENABLE		0xff0
    +
    +/* relative offset from BCM_VC_DMA0_BASE (p.39) */
    +#define	BCM_DMA_CH(n)		(0x100*(n))
    +
    +/* DMA Control Block - 256bit aligned (p.40) */
    +struct bcm_dma_cb {
    +	uint32_t info;		/* Transfer Information */
    +	uint32_t src;		/* Source Address */
    +	uint32_t dst;		/* Destination Address */
    +	uint32_t len;		/* Transfer Length */
    +	uint32_t stride;	/* 2D Mode Stride */
    +	uint32_t next;		/* Next Control Block Address */
    +	uint32_t rsvd1;		/* Reserved */
    +	uint32_t rsvd2;		/* Reserved */
    +};
    +
    +#ifdef DEBUG
    +static void bcm_dma_cb_dump(struct bcm_dma_cb *cb);
    +static void bcm_dma_reg_dump(int ch);
    +#endif
    +
    +/* DMA channel private info */
    +struct bcm_dma_ch {
    +	int			ch;
    +	uint32_t		flags;
    +	struct bcm_dma_cb *	cb;
    +	uint32_t		vc_cb;
    +	bus_dmamap_t		dma_map;
    +	void 			(*intr_func)(int, void *);
    +	void *			intr_arg;
    +};
    +
    +struct bcm_dma_softc {
    +	device_t		sc_dev;
    +	struct mtx		sc_mtx;
    +	struct resource *	sc_mem;
    +	struct resource *	sc_irq[BCM_DMA_CH_MAX];
    +	void *			sc_intrhand[BCM_DMA_CH_MAX];
    +	struct bcm_dma_ch	sc_dma_ch[BCM_DMA_CH_MAX];
    +	bus_dma_tag_t		sc_dma_tag;
    +};
    +
    +static struct bcm_dma_softc *bcm_dma_sc = NULL;
    +
    +static void
    +bcm_dmamap_cb(void *arg, bus_dma_segment_t *segs,
    +	int nseg, int err)
    +{
    +        bus_addr_t *addr;
    +
    +        if (err)
    +                return;
    +
    +        addr = (bus_addr_t*)arg;
    +        *addr = PHYS_TO_VCBUS(segs[0].ds_addr);
    +}
    +
    +static void
    +bcm_dma_reset(device_t dev, int ch)
    +{
    +	struct bcm_dma_softc *sc = device_get_softc(dev);
    +	struct bcm_dma_cb *cb;
    +	uint32_t cs;
    +	int count;
    +
    +	if (ch < 0 || ch >= BCM_DMA_CH_MAX)
    +		return;
    +
    +	cs = bus_read_4(sc->sc_mem, BCM_DMA_CS(ch));
    +
    +	if (cs & CS_ACTIVE) {
    +		/* pause current task */
    +		bus_write_4(sc->sc_mem, BCM_DMA_CS(ch), 0);
    +
    +		count = 1000;
    +		do {
    +			cs = bus_read_4(sc->sc_mem, BCM_DMA_CS(ch));
    +		} while (!(cs & CS_ISPAUSED) && (count-- > 0));
    +
    +		if (!(cs & CS_ISPAUSED)) {
    +			device_printf(dev,
    +			    "Can't abort DMA transfer at channel %d\n", ch);
    +		}
    +
    +		bus_write_4(sc->sc_mem, BCM_DMA_CBNEXT(ch), 0);
    +
    +		/* Complete everything, clear interrupt */
    +		bus_write_4(sc->sc_mem, BCM_DMA_CS(ch),
    +		    CS_ABORT | CS_INT | CS_END| CS_ACTIVE);
    +	}
    +
    +	/* clear control blocks */
    +	bus_write_4(sc->sc_mem, BCM_DMA_CBADDR(ch), 0);
    +	bus_write_4(sc->sc_mem, BCM_DMA_CBNEXT(ch), 0);
    +
    +	/* Reset control block */
    +	cb = sc->sc_dma_ch[ch].cb;
    +	bzero(cb, sizeof(cb));
    +}
    +
    +static int
    +bcm_dma_init(device_t dev)
    +{
    +	struct bcm_dma_softc *sc = device_get_softc(dev);
    +	uint32_t mask;
    +	struct bcm_dma_ch *ch;
    +	void *cb_virt;
    +	vm_paddr_t cb_phys;
    +	int err;
    +	int i;
    +
    +	/* disable and clear interrupt status */
    +	bus_write_4(sc->sc_mem, BCM_DMA_ENABLE, 0);
    +	bus_write_4(sc->sc_mem, BCM_DMA_INT_STATUS, 0);
    +
    +	/* Allocate DMA chunks control blocks */
    +	/* p.40 of spec - control block should be 32-bit aligned */
    +	err = bus_dma_tag_create(bus_get_dma_tag(dev),
    +	    1, 0, BUS_SPACE_MAXADDR_32BIT,
    +	    BUS_SPACE_MAXADDR, NULL, NULL,
    +	    sizeof(struct bcm_dma_cb), 1,
    +	    sizeof(struct bcm_dma_cb),
    +	    BUS_DMA_ALLOCNOW, NULL, NULL,
    +	    &sc->sc_dma_tag);
    +
    +	if (err) {
    +		device_printf(dev, "failed allocate DMA tag");
    +		return (err);
    +	}
    +
    +	/* setup initial settings */
    +	for (i = 0; i < BCM_DMA_CH_MAX; i++) {
    +		ch = &sc->sc_dma_ch[i];
    +
    +		err = bus_dmamem_alloc(sc->sc_dma_tag, &cb_virt,
    +		    BUS_DMA_WAITOK | BUS_DMA_COHERENT | BUS_DMA_ZERO,
    +		    &ch->dma_map);
    +		if (err) {
    +			device_printf(dev, "cannot allocate DMA memory\n");
    +			break;
    +		}
    +
    +		/* 
    +		 * Least alignment for busdma-allocated stuff is cache 
    +		 * line size, so just make sure nothing stupid happend
    +		 * and we got properly aligned address
    +		 */
    +		if ((uintptr_t)cb_virt & 0x1f) {
    +			device_printf(dev,
    +			    "DMA address is not 32-bytes aligned: %p\n",
    +			    (void*)cb_virt);
    +			break;
    +		}
    +
    +		err = bus_dmamap_load(sc->sc_dma_tag, ch->dma_map, cb_virt,
    +		    sizeof(struct bcm_dma_cb), bcm_dmamap_cb, &cb_phys,
    +		    BUS_DMA_WAITOK);
    +		if (err) {
    +			device_printf(dev, "cannot load DMA memory\n");
    +			break;
    +		}
    +
    +		bzero(ch, sizeof(struct bcm_dma_ch));
    +		ch->ch = i;
    +		ch->cb = cb_virt;
    +		ch->vc_cb = cb_phys;
    +		ch->intr_func = NULL;
    +		ch->intr_arg = NULL;
    +		ch->flags = BCM_DMA_CH_UNMAP;
    +
    +		ch->cb->info = INFO_WAIT_RESP;
    +
    +		/* reset DMA engine */
    +		bcm_dma_reset(dev, i);
    +	}
    +
    +	/* now use DMA2/DMA3 only */
    +	sc->sc_dma_ch[2].flags = BCM_DMA_CH_FREE;
    +	sc->sc_dma_ch[3].flags = BCM_DMA_CH_FREE;
    +
    +	/* enable DMAs */
    +	mask = 0;
    +
    +	for (i = 0; i < BCM_DMA_CH_MAX; i++)
    +		if (sc->sc_dma_ch[i].flags & BCM_DMA_CH_FREE)
    +			mask |= (1 << i);
    +
    +	bus_write_4(sc->sc_mem, BCM_DMA_ENABLE, mask);
    +
    +	return (0);
    +}
    +
    +/*
    + * Allocate DMA channel for further use, returns channel # or
    + *     BCM_DMA_CH_INVALID
    + */
    +int
    +bcm_dma_allocate(int req_ch)
    +{
    +	struct bcm_dma_softc *sc = bcm_dma_sc;
    +	int ch = BCM_DMA_CH_INVALID;
    +	int i;
    +
    +	if (req_ch >= BCM_DMA_CH_MAX)
    +		return (BCM_DMA_CH_INVALID);
    +
    +	/* Auto(req_ch < 0) or CH specified */
    +	mtx_lock(&sc->sc_mtx);
    +
    +	if (req_ch < 0) {
    +		for (i = 0; i < BCM_DMA_CH_MAX; i++) {
    +			if (sc->sc_dma_ch[i].flags & BCM_DMA_CH_FREE) {
    +				ch = i;
    +				sc->sc_dma_ch[ch].flags &= ~BCM_DMA_CH_FREE;
    +				sc->sc_dma_ch[ch].flags |= BCM_DMA_CH_USED;
    +				break;
    +			}
    +		}
    +	}
    +	else {
    +		if (sc->sc_dma_ch[req_ch].flags & BCM_DMA_CH_FREE) {
    +			ch = req_ch;
    +			sc->sc_dma_ch[ch].flags &= ~BCM_DMA_CH_FREE;
    +			sc->sc_dma_ch[ch].flags |= BCM_DMA_CH_USED;
    +		}
    +	}
    +
    +	mtx_unlock(&sc->sc_mtx);
    +	return (ch);
    +}
    +
    +/*
    + * Frees allocated channel. Returns 0 on success, -1 otherwise
    + */
    +int
    +bcm_dma_free(int ch)
    +{
    +	struct bcm_dma_softc *sc = bcm_dma_sc;
    +
    +	if (ch < 0 || ch >= BCM_DMA_CH_MAX)
    +		return (-1);
    +
    +	mtx_lock(&sc->sc_mtx);
    +	if (sc->sc_dma_ch[ch].flags & BCM_DMA_CH_USED) {
    +		sc->sc_dma_ch[ch].flags |= BCM_DMA_CH_FREE;
    +		sc->sc_dma_ch[ch].flags &= ~BCM_DMA_CH_USED;
    +		sc->sc_dma_ch[ch].intr_func = NULL;
    +		sc->sc_dma_ch[ch].intr_arg = NULL;
    +
    +		/* reset DMA engine */
    +		bcm_dma_reset(sc->sc_dev, ch);
    +	}
    +
    +	mtx_unlock(&sc->sc_mtx);
    +	return (0);
    +}
    +
    +/*
    + * Assign handler function for channel interrupt
    + * Returns 0 on success, -1 otherwise
    + */
    +int
    +bcm_dma_setup_intr(int ch, void (*func)(int, void *), void *arg)
    +{
    +	struct bcm_dma_softc *sc = bcm_dma_sc;
    +	struct bcm_dma_cb *cb;
    +
    +	if (ch < 0 || ch >= BCM_DMA_CH_MAX)
    +		return (-1);
    +
    +	if (!(sc->sc_dma_ch[ch].flags & BCM_DMA_CH_USED))
    +		return (-1);
    +
    +	sc->sc_dma_ch[ch].intr_func = func;
    +	sc->sc_dma_ch[ch].intr_arg = arg;
    +	cb = sc->sc_dma_ch[ch].cb;
    +	cb->info |= INFO_INT_EN;
    +
    +	return (0);
    +}
    +
    +/*
    + * Setup DMA source parameters
    + *     ch - channel number
    + *     dreq - hardware DREQ # or BCM_DMA_DREQ_NONE if
    + *         source is physical memory
    + *     inc_addr - BCM_DMA_INC_ADDR if source address
    + *         should be increased after each access or 
    + *         BCM_DMA_SAME_ADDR if address should remain 
    + *         the same
    + *     width - size of read operation, BCM_DMA_32BIT
    + *         for 32bit bursts, BCM_DMA_128BIT for 128 bits
    + *	  
    + * Returns 0 on success, -1 otherwise
    + */
    +int
    +bcm_dma_setup_src(int ch, int dreq, int inc_addr, int width)
    +{
    +	struct bcm_dma_softc *sc = bcm_dma_sc;
    +	uint32_t info;
    +
    +	if (ch < 0 || ch >= BCM_DMA_CH_MAX)
    +		return (-1);
    +
    +	if (!(sc->sc_dma_ch[ch].flags & BCM_DMA_CH_USED))
    +		return (-1);
    +
    +	info = sc->sc_dma_ch[ch].cb->info;
    +	info &= ~INFO_PERMAP_MASK;
    +	info |= (dreq << INFO_PERMAP_SHIFT) & INFO_PERMAP_MASK;
    +
    +	if (dreq)
    +		info |= INFO_S_DREQ;
    +	else
    +		info &= ~INFO_S_DREQ;
    +
    +	if (width == BCM_DMA_128BIT)
    +		info |= INFO_S_WIDTH;
    +	else
    +		info &= ~INFO_S_WIDTH;
    +
    +	if (inc_addr == BCM_DMA_INC_ADDR)
    +		info |= INFO_S_INC;
    +	else
    +		info &= ~INFO_S_INC;
    +
    +	sc->sc_dma_ch[ch].cb->info = info;
    +
    +	return (0);
    +}
    +
    +/*
    + * Setup DMA destination parameters
    + *     ch - channel number
    + *     dreq - hardware DREQ # or BCM_DMA_DREQ_NONE if
    + *         destination is physical memory
    + *     inc_addr - BCM_DMA_INC_ADDR if source address
    + *         should be increased after each access or 
    + *         BCM_DMA_SAME_ADDR if address should remain 
    + *         the same
    + *     width - size of write operation, BCM_DMA_32BIT
    + *         for 32bit bursts, BCM_DMA_128BIT for 128 bits
    + *	  
    + * Returns 0 on success, -1 otherwise
    + */
    +int
    +bcm_dma_setup_dst(int ch, int dreq, int inc_addr, int width)
    +{
    +	struct bcm_dma_softc *sc = bcm_dma_sc;
    +	uint32_t info;
    +
    +	if (ch < 0 || ch >= BCM_DMA_CH_MAX)
    +		return (-1);
    +
    +	if (!(sc->sc_dma_ch[ch].flags & BCM_DMA_CH_USED))
    +		return (-1);
    +
    +	info = sc->sc_dma_ch[ch].cb->info;
    +	info &= ~INFO_PERMAP_MASK;
    +	info |= (dreq << INFO_PERMAP_SHIFT) & INFO_PERMAP_MASK;
    +
    +	if (dreq)
    +		info |= INFO_D_DREQ;
    +	else
    +		info &= ~INFO_D_DREQ;
    +
    +	if (width == BCM_DMA_128BIT)
    +		info |= INFO_D_WIDTH;
    +	else
    +		info &= ~INFO_D_WIDTH;
    +
    +	if (inc_addr == BCM_DMA_INC_ADDR)
    +		info |= INFO_D_INC;
    +	else
    +		info &= ~INFO_D_INC;
    +
    +	sc->sc_dma_ch[ch].cb->info = info;
    +
    +	return (0);
    +}
    +
    +#ifdef DEBUG
    +void
    +bcm_dma_cb_dump(struct bcm_dma_cb *cb)
    +{
    +
    +	printf("DMA CB ");
    +	printf("INFO: %8.8x ", cb->info);
    +	printf("SRC: %8.8x ", cb->src);
    +	printf("DST: %8.8x ", cb->dst);
    +	printf("LEN: %8.8x ", cb->len);
    +	printf("\n");
    +	printf("STRIDE: %8.8x ", cb->stride);
    +	printf("NEXT: %8.8x ", cb->next);
    +	printf("RSVD1: %8.8x ", cb->rsvd1);
    +	printf("RSVD2: %8.8x ", cb->rsvd2);
    +	printf("\n");
    +}
    +
    +void
    +bcm_dma_reg_dump(int ch)
    +{
    +	struct bcm_dma_softc *sc = bcm_dma_sc;
    +	int i;
    +	uint32_t reg;
    +
    +	if (ch < 0 || ch >= BCM_DMA_CH_MAX)
    +		return;
    +
    +	printf("DMA%d: ", ch);
    +	for (i = 0; i < MAX_REG; i++) {
    +		reg = bus_read_4(sc->sc_mem, BCM_DMA_CH(ch) + i*4);
    +		printf("%8.8x ", reg);
    +	}
    +	printf("\n");
    +}
    +#endif
    +
    +/*
    + * Start DMA transaction
    + *     ch - channel number
    + *     src, dst - source and destination address in
    + *         ARM physical memory address space. 
    + *     len - amount of bytes to be transfered
    + *	  
    + * Returns 0 on success, -1 otherwise
    + */
    +int
    +bcm_dma_start(int ch, vm_paddr_t src, vm_paddr_t dst, int len)
    +{
    +	struct bcm_dma_softc *sc = bcm_dma_sc;
    +	struct bcm_dma_cb *cb;
    +
    +	if (ch < 0 || ch >= BCM_DMA_CH_MAX)
    +		return (-1);
    +
    +	if (!(sc->sc_dma_ch[ch].flags & BCM_DMA_CH_USED))
    +		return (-1);
    +
    +	cb = sc->sc_dma_ch[ch].cb;
    +	if (BCM2835_ARM_IS_IO(src))
    +		cb->src = IO_TO_VCBUS(src);
    +	else
    +		cb->src = PHYS_TO_VCBUS(src);
    +	if (BCM2835_ARM_IS_IO(dst))
    +		cb->dst = IO_TO_VCBUS(dst);
    +	else
    +		cb->dst = PHYS_TO_VCBUS(dst);
    +	cb->len = len;
    +
    +	bus_dmamap_sync(sc->sc_dma_tag,
    +	    sc->sc_dma_ch[ch].dma_map, BUS_DMASYNC_PREWRITE);
    +
    +	bus_write_4(sc->sc_mem, BCM_DMA_CBADDR(ch),
    +	    sc->sc_dma_ch[ch].vc_cb);
    +	bus_write_4(sc->sc_mem, BCM_DMA_CS(ch), CS_ACTIVE);
    +
    +#ifdef DEBUG
    +	bcm_dma_cb_dump(sc->sc_dma_ch[ch].cb);
    +	bcm_dma_reg_dump(ch);
    +#endif
    +
    +	return (0);
    +}
    +
    +/*
    + * Get length requested for DMA transaction
    + *     ch - channel number
    + *	  
    + * Returns size of transaction, 0 if channel is invalid
    + */
    +uint32_t
    +bcm_dma_length(int ch)
    +{
    +	struct bcm_dma_softc *sc = bcm_dma_sc;
    +	struct bcm_dma_cb *cb;
    +
    +	if (ch < 0 || ch >= BCM_DMA_CH_MAX)
    +		return (0);
    +
    +	if (!(sc->sc_dma_ch[ch].flags & BCM_DMA_CH_USED))
    +		return (0);
    +
    +	cb = sc->sc_dma_ch[ch].cb;
    +
    +	return (cb->len);
    +}
    +
    +static void
    +bcm_dma_intr(void *arg)
    +{
    +	struct bcm_dma_softc *sc = bcm_dma_sc;
    +	struct bcm_dma_ch *ch = (struct bcm_dma_ch *)arg;
    +	uint32_t cs, debug;
    +
    +	/* my interrupt? */
    +	cs = bus_read_4(sc->sc_mem, BCM_DMA_CS(ch->ch));
    +
    +	if (!(cs & (CS_INT | CS_ERR)))
    +		return;
    +
    +	/* running? */
    +	if (!(ch->flags & BCM_DMA_CH_USED)) {
    +		device_printf(sc->sc_dev,
    +		    "unused DMA intr CH=%d, CS=%x\n", ch->ch, cs);
    +		return;
    +	}
    +
    +	if (cs & CS_ERR) {
    +		debug = bus_read_4(sc->sc_mem, BCM_DMA_DEBUG(ch->ch));
    +		device_printf(sc->sc_dev, "DMA error %d on CH%d\n",
    +			debug & DEBUG_ERROR_MASK, ch->ch);
    +		bus_write_4(sc->sc_mem, BCM_DMA_DEBUG(ch->ch), 
    +		    debug & DEBUG_ERROR_MASK);
    +	}
    +
    +	if (cs & CS_INT) {
    +		/* acknowledge interrupt */
    +		bus_write_4(sc->sc_mem, BCM_DMA_CS(ch->ch), 
    +		    CS_INT | CS_END);
    +
    +		/* Prepare for possible access to len field */
    +		bus_dmamap_sync(sc->sc_dma_tag, ch->dma_map,
    +		    BUS_DMASYNC_POSTWRITE);
    +
    +		/* save callback function and argument */
    +		if (ch->intr_func)
    +			ch->intr_func(ch->ch, ch->intr_arg);
    +	}
    +}
    +
    +static int
    +bcm_dma_probe(device_t dev)
    +{
    +
    +	if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-dma"))
    +		return (ENXIO);
    +
    +	device_set_desc(dev, "BCM2835 DMA Controller");
    +	return (BUS_PROBE_DEFAULT);
    +}
    +
    +static int
    +bcm_dma_attach(device_t dev)
    +{
    +	struct bcm_dma_softc *sc = device_get_softc(dev);
    +	int rid, err = 0;
    +	int i;
    +
    +	sc->sc_dev = dev;
    +
    +	if (bcm_dma_sc)
    +		return (ENXIO);
    +
    +	for (i = 0; i < BCM_DMA_CH_MAX; i++) {
    +		sc->sc_irq[i] = NULL;
    +		sc->sc_intrhand[i] = NULL;
    +	}
    +
    +	/* DMA0 - DMA14 */
    +	rid = 0;
    +	sc->sc_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
    +	if (sc->sc_mem == NULL) {
    +		device_printf(dev, "could not allocate memory resource\n");
    +		return (ENXIO);
    +	}
    +
    +	/* IRQ DMA0 - DMA11 XXX NOT USE DMA12(spurious?) */
    +	for (rid = 0; rid < BCM_DMA_CH_MAX; rid++) {
    +		sc->sc_irq[rid] = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
    +						       RF_ACTIVE);
    +		if (sc->sc_irq[rid] == NULL) {
    +			device_printf(dev, "cannot allocate interrupt\n");
    +			err = ENXIO;
    +			goto fail;
    +		}
    +		if (bus_setup_intr(dev, sc->sc_irq[rid], INTR_TYPE_MISC | INTR_MPSAFE,
    +				   NULL, bcm_dma_intr, &sc->sc_dma_ch[rid],
    +				   &sc->sc_intrhand[rid])) {
    +			device_printf(dev, "cannot setup interrupt handler\n");
    +			err = ENXIO;
    +			goto fail;
    +		}
    +	}
    +
    +	mtx_init(&sc->sc_mtx, "bcmdma", "bcmdma", MTX_DEF);
    +	bcm_dma_sc = sc;
    +
    +	err = bcm_dma_init(dev);
    +	if (err)
    +		goto fail;
    +
    +	return (err);
    +
    +fail:
    +	if (sc->sc_mem)
    +		bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem);
    +
    +	for (i = 0; i < BCM_DMA_CH_MAX; i++) {
    +		if (sc->sc_intrhand[i])
    +			bus_teardown_intr(dev, sc->sc_irq[i], sc->sc_intrhand[i]);
    +		if (sc->sc_irq[i])
    +			bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq[i]);
    +	}
    +
    +	return (err);
    +}
    +
    +static device_method_t bcm_dma_methods[] = {
    +	DEVMETHOD(device_probe,		bcm_dma_probe),
    +	DEVMETHOD(device_attach,	bcm_dma_attach),
    +	{ 0, 0 }
    +};
    +
    +static driver_t bcm_dma_driver = {
    +	"bcm_dma",
    +	bcm_dma_methods,
    +	sizeof(struct bcm_dma_softc),
    +};
    +
    +static devclass_t bcm_dma_devclass;
    +
    +DRIVER_MODULE(bcm_dma, simplebus, bcm_dma_driver, bcm_dma_devclass, 0, 0);
    +MODULE_VERSION(bcm_dma, 1);
    
    Added: head/sys/arm/broadcom/bcm2835/bcm2835_dma.h
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/sys/arm/broadcom/bcm2835/bcm2835_dma.h	Thu Feb 28 19:48:19 2013	(r247496)
    @@ -0,0 +1,62 @@
    +/*
    + * Copyright (c) 2013 Daisuke Aoyama 
    + * Copyright (c) 2013 Oleksandr Tymoshenko 
    + *
    + * 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$
    + */
    +
    +#ifndef	_BCM2835_DMA_H_
    +#define	_BCM2835_DMA_H_
    +
    +#define	BCM_DMA_BLOCK_SIZE	512
    +
    +/* DMA0-DMA15 but DMA15 is special */
    +#define	BCM_DMA_CH_MAX		12
    +
    +/* request CH for any nubmer */
    +#define	BCM_DMA_CH_INVALID	(-1)
    +#define	BCM_DMA_CH_ANY		(-1)
    +#define	BCM_DMA_CH_FAST1	(2)
    +#define	BCM_DMA_CH_FAST2	(3)
    +
    +/* Peripheral DREQ Signals (4.2.1.3) */
    +#define	BCM_DMA_DREQ_NONE	0
    +#define	BCM_DMA_DREQ_EMMC	11
    +#define	BCM_DMA_DREQ_SDHOST	13
    +
    +#define	BCM_DMA_SAME_ADDR	0
    +#define	BCM_DMA_INC_ADDR	1
    +
    +#define	BCM_DMA_32BIT		0
    +#define	BCM_DMA_128BIT		1
    +
    +int bcm_dma_allocate(int req_ch);
    +int bcm_dma_free(int ch);
    +int bcm_dma_setup_intr(int ch, void (*func)(int, void *), void *arg);
    +int bcm_dma_setup_src(int ch, int dreq, int inc_addr, int width);
    +int bcm_dma_setup_dst(int ch, int dreq, int inc_addr, int width);
    +int bcm_dma_start(int ch, vm_paddr_t src, vm_paddr_t dst, int len);
    +uint32_t bcm_dma_length(int ch);
    +
    +#endif	/* _BCM2835_DMA_H_ */
    
    Modified: head/sys/arm/broadcom/bcm2835/files.bcm2835
    ==============================================================================
    --- head/sys/arm/broadcom/bcm2835/files.bcm2835	Thu Feb 28 19:43:14 2013	(r247495)
    +++ head/sys/arm/broadcom/bcm2835/files.bcm2835	Thu Feb 28 19:48:19 2013	(r247496)
    @@ -1,5 +1,6 @@
     # $FreeBSD$
     
    +arm/broadcom/bcm2835/bcm2835_dma.c		standard
     arm/broadcom/bcm2835/bcm2835_fb.c		optional sc
     arm/broadcom/bcm2835/bcm2835_gpio.c		optional gpio
     arm/broadcom/bcm2835/bcm2835_intr.c		standard
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 19:51:31 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 69531BC7;
     Thu, 28 Feb 2013 19:51:31 +0000 (UTC)
     (envelope-from gonzo@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 4C400EC4;
     Thu, 28 Feb 2013 19:51:31 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1SJpVg0026152;
     Thu, 28 Feb 2013 19:51:31 GMT (envelope-from gonzo@svn.freebsd.org)
    Received: (from gonzo@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1SJpVc6026151;
     Thu, 28 Feb 2013 19:51:31 GMT (envelope-from gonzo@svn.freebsd.org)
    Message-Id: <201302281951.r1SJpVc6026151@svn.freebsd.org>
    From: Oleksandr Tymoshenko 
    Date: Thu, 28 Feb 2013 19:51:31 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247497 - head/sys/arm/broadcom/bcm2835
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 19:51:31 -0000
    
    Author: gonzo
    Date: Thu Feb 28 19:51:30 2013
    New Revision: 247497
    URL: http://svnweb.freebsd.org/changeset/base/247497
    
    Log:
      Add platform DMA support to SDHCI driver for BCM2835
      
      Submitted by:	Daisuke Aoyama 
      Reviewed by:	ian@
    
    Modified:
      head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
    
    Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
    ==============================================================================
    --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c	Thu Feb 28 19:48:19 2013	(r247496)
    +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c	Thu Feb 28 19:51:30 2013	(r247497)
    @@ -67,8 +67,13 @@ __FBSDID("$FreeBSD$");
     #include 
     #include "sdhci_if.h"
     
    +#include "bcm2835_dma.h"
    +#include "bcm2835_vcbus.h"
    +
     #define	BCM2835_DEFAULT_SDHCI_FREQ	50
     
    +#define	BCM_SDHCI_BUFFER_SIZE		512
    +
     #define	DEBUG
     
     #ifdef DEBUG
    @@ -85,9 +90,11 @@ __FBSDID("$FreeBSD$");
      */
     static int bcm2835_sdhci_min_freq = 400000;
     static int bcm2835_sdhci_hs = 1;
    +static int bcm2835_sdhci_pio_mode = 0;
     
     TUNABLE_INT("hw.bcm2835.sdhci.min_freq", &bcm2835_sdhci_min_freq);
     TUNABLE_INT("hw.bcm2835.sdhci.hs", &bcm2835_sdhci_hs);
    +TUNABLE_INT("hw.bcm2835.sdhci.pio_mode", &bcm2835_sdhci_pio_mode);
     
     struct bcm_sdhci_dmamap_arg {
     	bus_addr_t		sc_dma_busaddr;
    @@ -111,23 +118,41 @@ struct bcm_sdhci_softc {
     	int			sc_xfer_done;
     	int			sc_bus_busy;
     	struct sdhci_slot	sc_slot;
    +	int			sc_dma_inuse;
    +	int			sc_dma_ch;
    +	bus_dma_tag_t		sc_dma_tag;
    +	bus_dmamap_t		sc_dma_map;
    +	void			*sc_dma_buffer;
    +	vm_paddr_t		sc_dma_buffer_phys;
    +	vm_paddr_t		sc_sdhci_buffer_phys;;
     };
     
    -#define	SD_MAX_BLOCKSIZE	1024
    -/* XXX */
    -
     static int bcm_sdhci_probe(device_t);
     static int bcm_sdhci_attach(device_t);
     static int bcm_sdhci_detach(device_t);
     static void bcm_sdhci_intr(void *);
     
     static int bcm_sdhci_get_ro(device_t, device_t);
    +static void bcm_sdhci_dma_intr(int ch, void *arg);
     
     #define	bcm_sdhci_lock(_sc)						\
         mtx_lock(&_sc->sc_mtx);
     #define	bcm_sdhci_unlock(_sc)						\
         mtx_unlock(&_sc->sc_mtx);
     
    +static void
    +bcm_dmamap_cb(void *arg, bus_dma_segment_t *segs,
    +	int nseg, int err)
    +{
    +        bus_addr_t *addr;
    +
    +        if (err)
    +                return;
    +
    +        addr = (bus_addr_t*)arg;
    +        *addr = segs[0].ds_addr;
    +}
    +
     static int
     bcm_sdhci_probe(device_t dev)
     {
    @@ -146,9 +171,13 @@ bcm_sdhci_attach(device_t dev)
     	phandle_t node;
     	pcell_t cell;
     	int default_freq;
    +	void *buffer;
    +	vm_paddr_t buffer_phys;
    +	void *va;
     
     	sc->sc_dev = dev;
     	sc->sc_req = NULL;
    +	err = 0;
     
     	default_freq = BCM2835_DEFAULT_SDHCI_FREQ;
     	node = ofw_bus_get_node(sc->sc_dev);
    @@ -191,6 +220,9 @@ bcm_sdhci_attach(device_t dev)
     		goto fail;
     	}
     
    +	if (!bcm2835_sdhci_pio_mode)
    +		sc->sc_slot.opt = SDHCI_PLATFORM_TRANSFER;
    +
     	sc->sc_slot.caps = SDHCI_CAN_VDD_330 | SDHCI_CAN_VDD_180;
     	if (bcm2835_sdhci_hs)
     		sc->sc_slot.caps |= SDHCI_CAN_DO_HISPD;
    @@ -201,6 +233,61 @@ bcm_sdhci_attach(device_t dev)
      
     	sdhci_init_slot(dev, &sc->sc_slot, 0);
     
    +	sc->sc_dma_ch = bcm_dma_allocate(BCM_DMA_CH_FAST1);
    +	if (sc->sc_dma_ch == BCM_DMA_CH_INVALID)
    +		sc->sc_dma_ch = bcm_dma_allocate(BCM_DMA_CH_FAST2);
    +	if (sc->sc_dma_ch == BCM_DMA_CH_INVALID)
    +		sc->sc_dma_ch = bcm_dma_allocate(BCM_DMA_CH_ANY);
    +	if (sc->sc_dma_ch == BCM_DMA_CH_INVALID)
    +		goto fail;
    +
    +	bcm_dma_setup_intr(sc->sc_dma_ch, bcm_sdhci_dma_intr, sc);
    +
    +	/* Allocate DMA buffers */
    +	err = bus_dma_tag_create(bus_get_dma_tag(dev),
    +	    1, 0, BUS_SPACE_MAXADDR_32BIT,
    +	    BUS_SPACE_MAXADDR, NULL, NULL,
    +	    BCM_SDHCI_BUFFER_SIZE, 1, BCM_SDHCI_BUFFER_SIZE,
    +	    BUS_DMA_ALLOCNOW, NULL, NULL,
    +	    &sc->sc_dma_tag);
    +
    +	if (err) {
    +		device_printf(dev, "failed allocate DMA tag");
    +		goto fail;
    +	}
    +
    +	err = bus_dmamem_alloc(sc->sc_dma_tag, &buffer,
    +	    BUS_DMA_WAITOK | BUS_DMA_COHERENT| BUS_DMA_ZERO,
    +	    &sc->sc_dma_map);
    +
    +	if (err) {
    +		device_printf(dev, "cannot allocate DMA memory\n");
    +		goto fail;
    +	}
    +
    +	err = bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, buffer,
    +	    BCM_SDHCI_BUFFER_SIZE, bcm_dmamap_cb, &buffer_phys,
    +	    BUS_DMA_WAITOK);
    +	if (err) {
    +		device_printf(dev, "cannot load DMA memory\n");
    +		goto fail;
    +	}
    +
    +	/* 
    +	 * Sanity check: two least bits of address should be zero
    +	 */
    +	if ((uintptr_t)buffer & 3) {
    +		device_printf(dev,
    +		    "DMA address is not word-aligned\n");
    +		goto fail;
    +	}
    +
    +	sc->sc_dma_buffer = buffer;
    +	sc->sc_dma_buffer_phys = buffer_phys;
    +	va = (void*)rman_get_start(sc->sc_mem_res);
    +	sc->sc_sdhci_buffer_phys =
    +	    pmap_kextract((vm_offset_t)va) + SDHCI_BUFFER;
    +
     	bus_generic_probe(dev);
     	bus_generic_attach(dev);
     
    @@ -354,6 +441,211 @@ bcm_sdhci_min_freq(device_t dev, struct 
     	return bcm2835_sdhci_min_freq;
     }
     
    +static void
    +bcm_sdhci_dma_intr(int ch, void *arg)
    +{
    +	struct bcm_sdhci_softc *sc = (struct bcm_sdhci_softc *)arg;
    +	struct sdhci_slot *slot = &sc->sc_slot;
    +	uint32_t reg, mask;
    +	void *buffer;
    +	size_t len;
    +	int left;
    +
    +	mtx_lock(&slot->mtx);
    +
    +	/* copy DMA buffer to VA if READ */
    +	len = bcm_dma_length(sc->sc_dma_ch);
    +	if (slot->curcmd->data->flags & MMC_DATA_READ) {
    +		bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map,
    +		    BUS_DMASYNC_POSTREAD);
    +
    +		mask = SDHCI_INT_DATA_AVAIL;
    +		/* all dma data in single or contiguous page */
    +		buffer = (uint8_t*)(slot->curcmd->data->data) + slot->offset;
    +		memcpy(buffer, sc->sc_dma_buffer, len);
    +	} else {
    +		bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map,
    +		    BUS_DMASYNC_POSTWRITE);
    +		mask = SDHCI_INT_SPACE_AVAIL;
    +	}
    +
    +	slot->offset += len;
    +	sc->sc_dma_inuse = 0;
    +
    +	left = min(BCM_SDHCI_BUFFER_SIZE,
    +	    slot->curcmd->data->len - slot->offset);
    +
    +	/* DATA END? */
    +	reg = bcm_sdhci_read_4(slot->bus, slot, SDHCI_INT_STATUS);
    +
    +	if (reg & SDHCI_INT_DATA_END) {
    +		/* ACK for all outstanding interrupts */
    +		bcm_sdhci_write_4(slot->bus, slot, SDHCI_INT_STATUS, reg);
    +
    +		/* enable INT */
    +		slot->intmask |= SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL
    +		    | SDHCI_INT_DATA_END;
    +		bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE,
    +		    slot->intmask);
    +
    +		/* finish this data */
    +		sdhci_finish_data(slot);
    +	} 
    +	else {
    +		/* already available? */
    +		if (reg & mask) {
    +			sc->sc_dma_inuse = 1;
    +
    +			/* ACK for DATA_AVAIL or SPACE_AVAIL */
    +			bcm_sdhci_write_4(slot->bus, slot,
    +			    SDHCI_INT_STATUS, mask);
    +
    +			/* continue next DMA transfer */
    +			if (slot->curcmd->data->flags & MMC_DATA_READ) {
    +				bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map,
    +				    BUS_DMASYNC_PREREAD);
    +
    +				/* DMA start */
    +				if (bcm_dma_start(sc->sc_dma_ch,
    +				    sc->sc_sdhci_buffer_phys,
    +				    sc->sc_dma_buffer_phys, left) != 0)
    +					device_printf(sc->sc_dev, "failed DMA start\n");
    +			} else {
    +				buffer = (char*)slot->curcmd->data->data + slot->offset;
    +				memcpy(sc->sc_dma_buffer, buffer, left);
    +
    +				bus_dmamap_sync(sc->sc_dma_tag,
    +				    sc->sc_dma_map, BUS_DMASYNC_PREWRITE);
    +
    +				/* DMA start */
    +				if (bcm_dma_start(sc->sc_dma_ch, 
    +				    sc->sc_dma_buffer_phys,
    +				    sc->sc_sdhci_buffer_phys, left) != 0)
    +					device_printf(sc->sc_dev, "failed DMA start\n");
    +			}
    +		} else {
    +			/* wait for next data by INT */
    +
    +			/* enable INT */
    +			slot->intmask |= SDHCI_INT_DATA_AVAIL |
    +			    SDHCI_INT_SPACE_AVAIL | SDHCI_INT_DATA_END;
    +			bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE,
    +			    slot->intmask);
    +		}
    +	}
    +
    +	mtx_unlock(&slot->mtx);
    +}
    +
    +static void
    +bcm_sdhci_read_dma(struct sdhci_slot *slot)
    +{
    +	struct bcm_sdhci_softc *sc = device_get_softc(slot->bus);
    +	size_t left;
    +
    +	if (sc->sc_dma_inuse) {
    +		device_printf(sc->sc_dev, "DMA in use\n");
    +		return;
    +	}
    +
    +	sc->sc_dma_inuse = 1;
    +
    +	left = min(BCM_SDHCI_BUFFER_SIZE,
    +	    slot->curcmd->data->len - slot->offset);
    +
    +	KASSERT((left & 3) == 0,
    +	    ("%s: len = %d, not word-aligned", __func__, left));
    +
    +	bcm_dma_setup_src(sc->sc_dma_ch, BCM_DMA_DREQ_EMMC,
    +	    BCM_DMA_SAME_ADDR, BCM_DMA_32BIT); 
    +	bcm_dma_setup_dst(sc->sc_dma_ch, BCM_DMA_DREQ_NONE,
    +	    BCM_DMA_INC_ADDR,
    +	    (left & 0xf) ? BCM_DMA_32BIT : BCM_DMA_128BIT);
    +
    +	bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map,
    +	    BUS_DMASYNC_PREREAD);
    +
    +	/* DMA start */
    +	if (bcm_dma_start(sc->sc_dma_ch, sc->sc_sdhci_buffer_phys,
    +	    sc->sc_dma_buffer_phys, left) != 0)
    +		device_printf(sc->sc_dev, "failed DMA start\n");
    +}
    +
    +static void
    +bcm_sdhci_write_dma(struct sdhci_slot *slot)
    +{
    +	struct bcm_sdhci_softc *sc = device_get_softc(slot->bus);
    +	char *buffer;
    +	size_t left;
    +
    +	if (sc->sc_dma_inuse) {
    +		device_printf(sc->sc_dev, "DMA in use\n");
    +		return;
    +	}
    +
    +	sc->sc_dma_inuse = 1;
    +
    +	left = min(BCM_SDHCI_BUFFER_SIZE,
    +	    slot->curcmd->data->len - slot->offset);
    +
    +	KASSERT((left & 3) == 0,
    +	    ("%s: len = %d, not word-aligned", __func__, left));
    +
    +	buffer = (char*)slot->curcmd->data->data + slot->offset;
    +	memcpy(sc->sc_dma_buffer, buffer, left);
    +
    +	bcm_dma_setup_src(sc->sc_dma_ch, BCM_DMA_DREQ_NONE,
    +	    BCM_DMA_INC_ADDR,
    +	    (left & 0xf) ? BCM_DMA_32BIT : BCM_DMA_128BIT);
    +	bcm_dma_setup_dst(sc->sc_dma_ch, BCM_DMA_DREQ_EMMC,
    +	    BCM_DMA_SAME_ADDR, BCM_DMA_32BIT);
    +
    +	bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map,
    +	    BUS_DMASYNC_PREWRITE);
    +
    +	/* DMA start */
    +	if (bcm_dma_start(sc->sc_dma_ch, sc->sc_dma_buffer_phys,
    +	    sc->sc_sdhci_buffer_phys, left) != 0)
    +		device_printf(sc->sc_dev, "failed DMA start\n");
    +}
    +
    +static int
    +bcm_sdhci_will_handle_transfer(device_t dev, struct sdhci_slot *slot)
    +{
    +	size_t left;
    +
    +	/* Do not use DMA for transfers less then block size */
    +	left = min(BCM_DMA_BLOCK_SIZE,
    +	    slot->curcmd->data->len - slot->offset);
    +	if (left < BCM_DMA_BLOCK_SIZE)
    +		return (0);
    +
    +	return (1);
    +}
    +
    +static void
    +bcm_sdhci_start_transfer(device_t dev, struct sdhci_slot *slot,
    +    uint32_t *intmask)
    +{
    +
    +	/* Disable INT */
    +	slot->intmask &= ~(SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL | SDHCI_INT_DATA_END);
    +	bcm_sdhci_write_4(dev, slot, SDHCI_SIGNAL_ENABLE, slot->intmask);
    +
    +	/* DMA transfer FIFO 1KB */
    +	if (slot->curcmd->data->flags & MMC_DATA_READ)
    +		bcm_sdhci_read_dma(slot);
    +	else
    +		bcm_sdhci_write_dma(slot);
    +}
    +
    +static void
    +bcm_sdhci_finish_transfer(device_t dev, struct sdhci_slot *slot)
    +{
    +
    +	sdhci_finish_data(slot);
    +}
    +
     static device_method_t bcm_sdhci_methods[] = {
     	/* Device interface */
     	DEVMETHOD(device_probe,		bcm_sdhci_probe),
    @@ -372,8 +664,12 @@ static device_method_t bcm_sdhci_methods
     	DEVMETHOD(mmcbr_acquire_host,	sdhci_generic_acquire_host),
     	DEVMETHOD(mmcbr_release_host,	sdhci_generic_release_host),
     
    -	/* SDHCI registers accessors */
     	DEVMETHOD(sdhci_min_freq,	bcm_sdhci_min_freq),
    +	/* Platform transfer methods */
    +	DEVMETHOD(sdhci_platform_will_handle,		bcm_sdhci_will_handle_transfer),
    +	DEVMETHOD(sdhci_platform_start_transfer,	bcm_sdhci_start_transfer),
    +	DEVMETHOD(sdhci_platform_finish_transfer,	bcm_sdhci_finish_transfer),
    +	/* SDHCI registers accessors */
     	DEVMETHOD(sdhci_read_1,		bcm_sdhci_read_1),
     	DEVMETHOD(sdhci_read_2,		bcm_sdhci_read_2),
     	DEVMETHOD(sdhci_read_4,		bcm_sdhci_read_4),
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 20:02:33 2013
    Return-Path: 
    Delivered-To: svn-src-head@FreeBSD.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 7594EEE4;
     Thu, 28 Feb 2013 20:02:33 +0000 (UTC) (envelope-from ian@FreeBSD.org)
    Received: from mho-02-ewr.mailhop.org (mho-04-ewr.mailhop.org [204.13.248.74])
     by mx1.freebsd.org (Postfix) with ESMTP id 4D5FFF4F;
     Thu, 28 Feb 2013 20:02:33 +0000 (UTC)
    Received: from c-24-8-232-202.hsd1.co.comcast.net ([24.8.232.202]
     helo=damnhippie.dyndns.org)
     by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256)
     (Exim 4.72) (envelope-from )
     id 1UB9gW-0009iV-C9; Thu, 28 Feb 2013 20:02:32 +0000
    Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240])
     by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id r1SK2Ufr085696;
     Thu, 28 Feb 2013 13:02:30 -0700 (MST) (envelope-from ian@FreeBSD.org)
    X-Mail-Handler: Dyn Standard SMTP by Dyn
    X-Originating-IP: 24.8.232.202
    X-Report-Abuse-To: abuse@dyndns.com (see
     http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse
     reporting information)
    X-MHO-User: U2FsdGVkX193HzQ61HZO7nWQBJG4J876
    Subject: Re: svn commit: r247495 - head/sys/dev/sdhci
    From: Ian Lepore 
    To: Oleksandr Tymoshenko 
    In-Reply-To: <201302281943.r1SJhEmC023261@svn.freebsd.org>
    References: <201302281943.r1SJhEmC023261@svn.freebsd.org>
    Content-Type: text/plain; charset="us-ascii"
    Date: Thu, 28 Feb 2013 13:02:30 -0700
    Message-ID: <1362081750.1195.65.camel@revolution.hippie.lan>
    Mime-Version: 1.0
    X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port 
    Content-Transfer-Encoding: 7bit
    Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
     src-committers@FreeBSD.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 20:02:33 -0000
    
    On Thu, 2013-02-28 at 19:43 +0000, Oleksandr Tymoshenko wrote:
    > Author: gonzo
    > Date: Thu Feb 28 19:43:14 2013
    > New Revision: 247495
    > URL: http://svnweb.freebsd.org/changeset/base/247495
    > 
    > Log:
    >   Add hooks for plugging platform-provided transfer backend.
    >   
    >   In order to use platorm backend hardware driver should
    >   impement three methods:
    >   - platform_start_transfer and platform_finish_transfer
    >       to start and finish transfer
    >   - platform_will_handle - check whether transaction is
    >       suitable for backend. If not - driver will fall back
    >       to PIO mode.
    >   
    >   Submitted by:	Daisuke Aoyama 
    >   Approved by:	ian@
    > 
    > Modified:
    >   head/sys/dev/sdhci/sdhci.c
    >   head/sys/dev/sdhci/sdhci.h
    >   head/sys/dev/sdhci/sdhci_if.m
    > 
    
    I think that was meant to be "Reviewed by" rather than "Approved by".  I
    do very much approve of the changes, but not in any formal
    administrative sense, I'm just happy the sdcard IO is faster. :)
    
    -- Ian
    
    
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 22:30:04 2013
    Return-Path: 
    Delivered-To: svn-src-head@FreeBSD.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 44E57260;
     Thu, 28 Feb 2013 22:30:04 +0000 (UTC)
     (envelope-from gonzo@id.bluezbox.com)
    Received: from id.bluezbox.com (id.bluezbox.com [88.198.91.248])
     by mx1.freebsd.org (Postfix) with ESMTP id EB69E73F;
     Thu, 28 Feb 2013 22:30:03 +0000 (UTC)
    Received: from [88.198.91.248] (helo=[IPv6:::1])
     by id.bluezbox.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256)
     (Exim 4.77 (FreeBSD)) (envelope-from )
     id 1UBBzE-000DdV-Ps; Thu, 28 Feb 2013 14:30:03 -0800
    Message-ID: <512FDA67.80200@freebsd.org>
    Date: Thu, 28 Feb 2013 14:29:59 -0800
    From: Oleksandr Tymoshenko 
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
     rv:17.0) Gecko/20130215 Thunderbird/17.0.3
    MIME-Version: 1.0
    To: Ian Lepore 
    Subject: Re: svn commit: r247495 - head/sys/dev/sdhci
    References: <201302281943.r1SJhEmC023261@svn.freebsd.org>
     <1362081750.1195.65.camel@revolution.hippie.lan>
    In-Reply-To: <1362081750.1195.65.camel@revolution.hippie.lan>
    Content-Type: text/plain; charset=ISO-8859-1; format=flowed
    Content-Transfer-Encoding: 7bit
    Sender: gonzo@id.bluezbox.com
    X-Spam-Level: --
    X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com",
     has
     identified this incoming email as possible spam.  The original message
     has been attached to this so you can view it (if it isn't spam) or label
     similar future email.  If you have any questions, see
     The administrator of that system for details.
     Content preview:  On 2/28/2013 12:02 PM, Ian Lepore wrote: > On Thu, 2013-02-28
     at 19:43 +0000, Oleksandr Tymoshenko wrote: >> Author: gonzo >> Date: Thu
     Feb 28 19:43:14 2013 >> New Revision: 247495 >> URL:
     http://svnweb.freebsd.org/changeset/base/247495
     >> >> Log: >> Add hooks for plugging platform-provided transfer backend.
     >> >> In order to use platorm backend hardware driver should >> impement three
     methods: >> - platform_start_transfer and platform_finish_transfer >> to
     start and finish transfer >> - platform_will_handle - check whether
     transaction
     is >> suitable for backend. If not - driver will fall back >> to PIO mode.
     >> >> Submitted by: Daisuke Aoyama  >> Approved by:
     ian@ >> >> Modified: >> head/sys/dev/sdhci/sdhci.c >>
     head/sys/dev/sdhci/sdhci.h
     >> head/sys/dev/sdhci/sdhci_if.m >> > I think that was meant to be "Reviewed
     by" rather than "Approved by". I > do very much approve of the changes, but
     not in any formal > administrative sense, I'm just happy the sdcard IO is
     faster. :) > [...] 
     Content analysis details:   (-2.9 points, 5.0 required)
     pts rule name              description
     ---- ---------------------- --------------------------------------------------
     -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
     -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
     [score: 0.0000]
    Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
     src-committers@FreeBSD.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 22:30:04 -0000
    
    On 2/28/2013 12:02 PM, Ian Lepore wrote:
    > On Thu, 2013-02-28 at 19:43 +0000, Oleksandr Tymoshenko wrote:
    >> Author: gonzo
    >> Date: Thu Feb 28 19:43:14 2013
    >> New Revision: 247495
    >> URL: http://svnweb.freebsd.org/changeset/base/247495
    >>
    >> Log:
    >>    Add hooks for plugging platform-provided transfer backend.
    >>    
    >>    In order to use platorm backend hardware driver should
    >>    impement three methods:
    >>    - platform_start_transfer and platform_finish_transfer
    >>        to start and finish transfer
    >>    - platform_will_handle - check whether transaction is
    >>        suitable for backend. If not - driver will fall back
    >>        to PIO mode.
    >>    
    >>    Submitted by:	Daisuke Aoyama 
    >>    Approved by:	ian@
    >>
    >> Modified:
    >>    head/sys/dev/sdhci/sdhci.c
    >>    head/sys/dev/sdhci/sdhci.h
    >>    head/sys/dev/sdhci/sdhci_if.m
    >>
    > I think that was meant to be "Reviewed by" rather than "Approved by".  I
    > do very much approve of the changes, but not in any formal
    > administrative sense, I'm just happy the sdcard IO is faster. :)
    >
    
    Yeah, wrong "to:" field :)
    Thanks for reviewing these patches
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 22:48:00 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id CA82360A;
     Thu, 28 Feb 2013 22:48:00 +0000 (UTC) (envelope-from jfv@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id B36C87DE;
     Thu, 28 Feb 2013 22:48:00 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1SMm0GH079903;
     Thu, 28 Feb 2013 22:48:00 GMT (envelope-from jfv@svn.freebsd.org)
    Received: (from jfv@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1SMm00t079901;
     Thu, 28 Feb 2013 22:48:00 GMT (envelope-from jfv@svn.freebsd.org)
    Message-Id: <201302282248.r1SMm00t079901@svn.freebsd.org>
    From: Jack F Vogel 
    Date: Thu, 28 Feb 2013 22:48:00 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247505 - head/sys/modules/ixgbe
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 22:48:00 -0000
    
    Author: jfv
    Date: Thu Feb 28 22:48:00 2013
    New Revision: 247505
    URL: http://svnweb.freebsd.org/changeset/base/247505
    
    Log:
      Change the ixgbe module name to if_ixgbe to conform
      to the usual naming convention.
    
    Modified:
      head/sys/modules/ixgbe/Makefile
    
    Modified: head/sys/modules/ixgbe/Makefile
    ==============================================================================
    --- head/sys/modules/ixgbe/Makefile	Thu Feb 28 22:31:26 2013	(r247504)
    +++ head/sys/modules/ixgbe/Makefile	Thu Feb 28 22:48:00 2013	(r247505)
    @@ -4,7 +4,7 @@
     
     .PATH:  ${.CURDIR}/../../dev/ixgbe
     
    -KMOD    = ixgbe
    +KMOD    = if_ixgbe
     SRCS    = device_if.h bus_if.h pci_if.h
     SRCS	+= opt_inet.h opt_inet6.h
     SRCS    += ixgbe.c ixv.c
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 23:02:23 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id CC6098D4;
     Thu, 28 Feb 2013 23:02:23 +0000 (UTC)
     (envelope-from delphij@delphij.net)
    Received: from anubis.delphij.net (anubis.delphij.net
     [IPv6:2001:470:1:117::25])
     by mx1.freebsd.org (Postfix) with ESMTP id B15A985C;
     Thu, 28 Feb 2013 23:02:23 +0000 (UTC)
    Received: from epsilon.delphij.net (drawbridge.ixsystems.com [206.40.55.65])
     (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
     (No client certificate requested)
     by anubis.delphij.net (Postfix) with ESMTPSA id 0DE212492D;
     Thu, 28 Feb 2013 15:02:22 -0800 (PST)
    DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis;
     t=1362092543; bh=nX53KiEc98OsaaWafYhLrqM9nz8WSJ4kBIkwlncm4Lo=;
     h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To;
     b=G6KvAKMNMKG3+Ex/LQ4SnD6k9MWT+GDK2WDUs4zuB3q86oYJ3ZXbMQEyJxyFELWft
     HckHAh4eSi8TjL+kmAKhMepoj7LRtMZPzNSJaIq2PjlCytcAGw3bBlC/G8PQ8st9Nb
     zZ2VlIVqI32NVsKcFCy04/WibYW/dtuA/D/6gB0g=
    Message-ID: <512FE1FD.8020502@delphij.net>
    Date: Thu, 28 Feb 2013 15:02:21 -0800
    From: Xin Li 
    Organization: The FreeBSD Project
    MIME-Version: 1.0
    To: Gennady Proskurin 
    Subject: Re: svn commit: r246877 - head/sys/ufs/ffs
    References: <201302161511.r1GFBesh029301@svn.freebsd.org>
     <20130218095640.GA35293@gpr.nnz-home.ru>
    In-Reply-To: <20130218095640.GA35293@gpr.nnz-home.ru>
    X-Enigmail-Version: 1.5.1
    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, Kirk McKusick 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    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 Feb 2013 23:02:23 -0000
    
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA512
    
    On 02/18/13 01:56, Gennady Proskurin wrote:
    > May be a dumb question, but I want to be explicit here.
    > 
    > Can system before this commit crash here or filesystem corruption
    > happen during ordinary work? (I mean no power loss and no crashes
    > in other kernel code)
    > 
    > Or filesystem can be corrupted only if system crashes by other
    > means (power loss or something) during inode block allocation?
    
    There has to be some kind of crashes to get corruption on system
    running without this changeset.
    
    If the system runs and shutdowns normally, eventually the initialized
    inode would be written and therefore there would be no inconsistency.
    
    Kirk, I think this is a good MFC candidate, do you have plan to merge
    it back to stable branches?
    
    Cheers,
    - -- 
    Xin LI     https://www.delphij.net/
    FreeBSD - The Power to Serve!           Live free or die
    -----BEGIN PGP SIGNATURE-----
    
    iQEcBAEBCgAGBQJRL+H9AAoJEG80Jeu8UPuzHHcH/jma0S+9tMpPVD9zODXFaPhU
    Uib+qSBoQ/7pXsidGd+Cm5nI5duvpe2KGbNWomOQFy3Ovllzjg6CPHfTPo6ZXYkX
    FpOr93IPcbkEIiwSVP7yXhgp1r5BH3SmV3ulx6SkgKkf8kd8Ir+dif/X+Z695Ot+
    M1y8suSXlYQs4z7ZHWMkVJcZ3VhH/oPJVpUQCZ7uqXeZQuquW4BLuKBYirGiGZrL
    77QbQa4OunUMJN4XbU/WmEh/TGkvSRKuWfCYq9JHAXiQ4ItqhD5bGCUh0AZ0iOgq
    y94ydCOUojI65VX8yBzlR1VyOi0ba3k3JSt/GmIEGvFu2ZcBW+nPXG+hjRJaKKk=
    =sj5S
    -----END PGP SIGNATURE-----
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 23:31:24 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 13833C01;
     Thu, 28 Feb 2013 23:31:24 +0000 (UTC)
     (envelope-from adrian@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id E27B4935;
     Thu, 28 Feb 2013 23:31:23 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1SNVNVs094382;
     Thu, 28 Feb 2013 23:31:23 GMT (envelope-from adrian@svn.freebsd.org)
    Received: (from adrian@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1SNVNBY094381;
     Thu, 28 Feb 2013 23:31:23 GMT (envelope-from adrian@svn.freebsd.org)
    Message-Id: <201302282331.r1SNVNBY094381@svn.freebsd.org>
    From: Adrian Chadd 
    Date: Thu, 28 Feb 2013 23:31:23 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247506 - head/sys/dev/ath
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 23:31:24 -0000
    
    Author: adrian
    Date: Thu Feb 28 23:31:23 2013
    New Revision: 247506
    URL: http://svnweb.freebsd.org/changeset/base/247506
    
    Log:
      Don't enable the HT flags for legacy rates.
      
      I stumbled across this whilst trying to debug another weird hang reported
      on the freebsd-wireless list.
      
      Whilst here, add in the STBC check to ath_rateseries_setup().
      
      Whilst here, fix the short preamble flag to be set only for legacy rates.
      
      Whilst here, comment that we should be using the full set of decisions
      made by ath_rateseries_setup() rather than recalculating them!
    
    Modified:
      head/sys/dev/ath/if_ath_tx_ht.c
    
    Modified: head/sys/dev/ath/if_ath_tx_ht.c
    ==============================================================================
    --- head/sys/dev/ath/if_ath_tx_ht.c	Thu Feb 28 22:48:00 2013	(r247505)
    +++ head/sys/dev/ath/if_ath_tx_ht.c	Thu Feb 28 23:31:23 2013	(r247506)
    @@ -236,9 +236,9 @@ ath_tx_rate_fill_rcflags(struct ath_soft
     		rate = rt->info[rc[i].rix].rateCode;
     
     		/*
    -		 * XXX only do this for legacy rates?
    +		 * Only enable short preamble for legacy rates
     		 */
    -		if (bf->bf_state.bfs_shpream)
    +		if (IS_HT_RATE(rate) && bf->bf_state.bfs_shpream)
     			rate |= rt->info[rc[i].rix].shortPreamble;
     
     		/*
    @@ -267,6 +267,19 @@ ath_tx_rate_fill_rcflags(struct ath_soft
     			    ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20)
     				rc[i].flags |= ATH_RC_SGI_FLAG;
     
    +			/*
    +			 * If we have STBC TX enabled and the receiver
    +			 * can receive (at least) 1 stream STBC, AND it's
    +			 * MCS 0-7, AND we have at least two chains enabled,
    +			 * enable STBC.
    +			 */
    +			if (ic->ic_htcaps & IEEE80211_HTCAP_TXSTBC &&
    +			    ni->ni_htcap & IEEE80211_HTCAP_RXSTBC_1STREAM &&
    +			    (sc->sc_cur_txchainmask > 1) &&
    +			    HT_RC_2_STREAMS(rate) == 1) {
    +				rc[i].flags |= ATH_RC_STBC_FLAG;
    +			}
    +
     			/* XXX dual stream? and 3-stream? */
     		}
     
    @@ -459,6 +472,9 @@ ath_get_aggr_limit(struct ath_softc *sc,
      *
      * It, along with ath_buf_set_rate, must be called -after- a burst
      * or aggregate is setup.
    + *
    + * XXX TODO: it should use the rate series information from the
    + * ath_buf, rather than recalculating it here!
      */
     static void
     ath_rateseries_setup(struct ath_softc *sc, struct ieee80211_node *ni,
    @@ -507,34 +523,6 @@ ath_rateseries_setup(struct ath_softc *s
     		 */
     		series[i].ChSel = sc->sc_cur_txchainmask;
     
    -		if (flags & (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA))
    -			series[i].RateFlags |= HAL_RATESERIES_RTS_CTS;
    -
    -		/*
    -		 * Transmit 40MHz frames only if the node has negotiated
    -		 * it rather than whether the node is capable of it or not.
    -	 	 * It's subtly different in the hostap case.
    -	 	 */
    -		if (ni->ni_chw == 40)
    -			series[i].RateFlags |= HAL_RATESERIES_2040;
    -
    -		/*
    -		 * Set short-GI only if the node has advertised it
    -		 * the channel width is suitable, and we support it.
    -		 * We don't currently have a "negotiated" set of bits -
    -		 * ni_htcap is what the remote end sends, not what this
    -		 * node is capable of.
    -		 */
    -		if (ni->ni_chw == 40 &&
    -		    ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI40 &&
    -		    ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40)
    -			series[i].RateFlags |= HAL_RATESERIES_HALFGI;
    -
    -		if (ni->ni_chw == 20 &&
    -		    ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI20 &&
    -		    ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20)
    -			series[i].RateFlags |= HAL_RATESERIES_HALFGI;
    -
     		/*
     		 * Setup rate and TX power cap for this series.
     		 */
    @@ -542,23 +530,55 @@ ath_rateseries_setup(struct ath_softc *s
     		series[i].RateIndex = rc[i].rix;
     		series[i].tx_power_cap = 0x3f;	/* XXX for now */
     
    -
     		/*
    -		 * If we have STBC TX enabled and the receiver
    -		 * can receive (at least) 1 stream STBC, AND it's
    -		 * MCS 0-7, AND we have at least two chains enabled,
    -		 * enable STBC.
    +		 * Enable RTS/CTS as appropriate.
     		 */
    -		if (ic->ic_htcaps & IEEE80211_HTCAP_TXSTBC &&
    -		    ni->ni_htcap & IEEE80211_HTCAP_RXSTBC_1STREAM &&
    -		    (sc->sc_cur_txchainmask > 1) &&
    -		    HT_RC_2_STREAMS(series[i].Rate) == 1) {
    -			series[i].RateFlags |= HAL_RATESERIES_STBC;
    -		}
    +		if (flags & (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA))
    +			series[i].RateFlags |= HAL_RATESERIES_RTS_CTS;
     
    -		/*
    -		 * XXX TODO: LDPC if it's possible
    -		 */
    +
    +		if (IS_HT_RATE(rt->info[rc[i].rix].rateCode)) {
    +			/*
    +			 * Transmit 40MHz frames only if the node has negotiated
    +			 * it rather than whether the node is capable of it or not.
    +			 * It's subtly different in the hostap case.
    +			 */
    +			if (ni->ni_chw == 40)
    +				series[i].RateFlags |= HAL_RATESERIES_2040;
    +
    +			/*
    +			 * Set short-GI only if the node has advertised it
    +			 * the channel width is suitable, and we support it.
    +			 * We don't currently have a "negotiated" set of bits -
    +			 * ni_htcap is what the remote end sends, not what this
    +			 * node is capable of.
    +			 */
    +			if (ni->ni_chw == 40 &&
    +			    ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI40 &&
    +			    ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40)
    +				series[i].RateFlags |= HAL_RATESERIES_HALFGI;
    +
    +			if (ni->ni_chw == 20 &&
    +			    ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI20 &&
    +			    ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20)
    +				series[i].RateFlags |= HAL_RATESERIES_HALFGI;
    +
    +			/*
    +			 * If we have STBC TX enabled and the receiver
    +			 * can receive (at least) 1 stream STBC, AND it's
    +			 * MCS 0-7, AND we have at least two chains enabled,
    +			 * enable STBC.
    +			 */
    +			if (ic->ic_htcaps & IEEE80211_HTCAP_TXSTBC &&
    +			    ni->ni_htcap & IEEE80211_HTCAP_RXSTBC_1STREAM &&
    +			    (sc->sc_cur_txchainmask > 1) &&
    +			    HT_RC_2_STREAMS(series[i].Rate) == 1) {
    +				series[i].RateFlags |= HAL_RATESERIES_STBC;
    +			}
    +			/*
    +			 * XXX TODO: LDPC if it's possible
    +			 */
    +		}
     
     		/*
     		 * PktDuration doesn't include slot, ACK, RTS, etc timing -
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 23:39:22 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id E700AECA;
     Thu, 28 Feb 2013 23:39:22 +0000 (UTC)
     (envelope-from adrian@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id D9C5A97A;
     Thu, 28 Feb 2013 23:39:22 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1SNdMLx095488;
     Thu, 28 Feb 2013 23:39:22 GMT (envelope-from adrian@svn.freebsd.org)
    Received: (from adrian@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1SNdMAf095487;
     Thu, 28 Feb 2013 23:39:22 GMT (envelope-from adrian@svn.freebsd.org)
    Message-Id: <201302282339.r1SNdMAf095487@svn.freebsd.org>
    From: Adrian Chadd 
    Date: Thu, 28 Feb 2013 23:39:22 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247507 - head/sys/dev/ath
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 23:39:23 -0000
    
    Author: adrian
    Date: Thu Feb 28 23:39:22 2013
    New Revision: 247507
    URL: http://svnweb.freebsd.org/changeset/base/247507
    
    Log:
      Oops - fix an incorrect test.
    
    Modified:
      head/sys/dev/ath/if_ath_tx_ht.c
    
    Modified: head/sys/dev/ath/if_ath_tx_ht.c
    ==============================================================================
    --- head/sys/dev/ath/if_ath_tx_ht.c	Thu Feb 28 23:31:23 2013	(r247506)
    +++ head/sys/dev/ath/if_ath_tx_ht.c	Thu Feb 28 23:39:22 2013	(r247507)
    @@ -238,7 +238,7 @@ ath_tx_rate_fill_rcflags(struct ath_soft
     		/*
     		 * Only enable short preamble for legacy rates
     		 */
    -		if (IS_HT_RATE(rate) && bf->bf_state.bfs_shpream)
    +		if ((! IS_HT_RATE(rate)) && bf->bf_state.bfs_shpream)
     			rate |= rt->info[rc[i].rix].shortPreamble;
     
     		/*
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 23:39:39 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 246A1CA;
     Thu, 28 Feb 2013 23:39:39 +0000 (UTC)
     (envelope-from adrian@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 176EE97E;
     Thu, 28 Feb 2013 23:39:39 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1SNdcS2095562;
     Thu, 28 Feb 2013 23:39:38 GMT (envelope-from adrian@svn.freebsd.org)
    Received: (from adrian@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1SNdcWu095561;
     Thu, 28 Feb 2013 23:39:38 GMT (envelope-from adrian@svn.freebsd.org)
    Message-Id: <201302282339.r1SNdcWu095561@svn.freebsd.org>
    From: Adrian Chadd 
    Date: Thu, 28 Feb 2013 23:39:38 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247508 - head/sys/dev/ath
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 23:39:39 -0000
    
    Author: adrian
    Date: Thu Feb 28 23:39:38 2013
    New Revision: 247508
    URL: http://svnweb.freebsd.org/changeset/base/247508
    
    Log:
      Add missing flags.
    
    Modified:
      head/sys/dev/ath/if_athrate.h
    
    Modified: head/sys/dev/ath/if_athrate.h
    ==============================================================================
    --- head/sys/dev/ath/if_athrate.h	Thu Feb 28 23:39:22 2013	(r247507)
    +++ head/sys/dev/ath/if_athrate.h	Thu Feb 28 23:39:38 2013	(r247508)
    @@ -84,6 +84,8 @@ void	ath_rate_detach(struct ath_ratectrl
     #define	ATH_RC_SGI_FLAG		0x04	/* use short-GI */
     #define	ATH_RC_HT_FLAG		0x08	/* use HT */
     #define	ATH_RC_RTSCTS_FLAG	0x10	/* enable RTS/CTS protection */
    +#define	ATH_RC_STBC_FLAG	0x20	/* enable STBC */
    +#define	ATH_RC_LDPC_FLAG	0x40	/* enable STBC */
     
     struct ath_rc_series {
     	uint8_t rix;		/* ratetable index, not rate code */
    
    From owner-svn-src-head@FreeBSD.ORG  Thu Feb 28 23:45:41 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id E634F28C;
     Thu, 28 Feb 2013 23:45:41 +0000 (UTC) (envelope-from gjb@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id D7CC19AC;
     Thu, 28 Feb 2013 23:45:41 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1SNjfCg098012;
     Thu, 28 Feb 2013 23:45:41 GMT (envelope-from gjb@svn.freebsd.org)
    Received: (from gjb@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1SNjfbl098011;
     Thu, 28 Feb 2013 23:45:41 GMT (envelope-from gjb@svn.freebsd.org)
    Message-Id: <201302282345.r1SNjfbl098011@svn.freebsd.org>
    From: Glen Barber 
    Date: Thu, 28 Feb 2013 23:45:41 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247509 - head
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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 Feb 2013 23:45:42 -0000
    
    Author: gjb (doc,ports committer)
    Date: Thu Feb 28 23:45:41 2013
    New Revision: 247509
    URL: http://svnweb.freebsd.org/changeset/base/247509
    
    Log:
      Minor wordsmithing.
      
      X-MFC-Needs:	r245617
    
    Modified:
      head/UPDATING
    
    Modified: head/UPDATING
    ==============================================================================
    --- head/UPDATING	Thu Feb 28 23:39:38 2013	(r247508)
    +++ head/UPDATING	Thu Feb 28 23:45:41 2013	(r247509)
    @@ -46,8 +46,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
     	unlikely event that -M was the last option on the command line
     	and the command line contained at least two files and a target
     	directory the first file will have logs appended to it.  The -M
    -	option served little practical purpose in the last decade so it's
    -	used expected to be extremely rare.
    +	option served little practical purpose in the last decade so its
    +	use is expected to be extremely rare.
     
     20121223:
     	After switching to Clang as the default compiler some users of ZFS
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 01:42:33 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 4A58C3A9;
     Fri,  1 Mar 2013 01:42:33 +0000 (UTC)
     (envelope-from ganbold@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 3C767E39;
     Fri,  1 Mar 2013 01:42:33 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r211gWmw035128;
     Fri, 1 Mar 2013 01:42:32 GMT (envelope-from ganbold@svn.freebsd.org)
    Received: (from ganbold@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r211gWjt035125;
     Fri, 1 Mar 2013 01:42:32 GMT (envelope-from ganbold@svn.freebsd.org)
    Message-Id: <201303010142.r211gWjt035125@svn.freebsd.org>
    From: Ganbold Tsagaankhuu 
    Date: Fri, 1 Mar 2013 01:42:32 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247519 - in head/sys/dev: ic uart
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 01:42:33 -0000
    
    Author: ganbold (doc committer)
    Date: Fri Mar  1 01:42:31 2013
    New Revision: 247519
    URL: http://svnweb.freebsd.org/changeset/base/247519
    
    Log:
      Add support for A10 uart.
      A10 uart is derived from Synopsys DesignWare uart and requires
      to read Uart Status Register when IIR_BUSY has detected.
      Also this change includes FDT check, where it checks device
      specific properties defined in dts and sets the busy_detect variable.
      broken_txfifo is also needed to be set in order to make it work for
      A10 uart case.
      
      Reviewed by: marcel@
      Approved by: gonzo@
    
    Modified:
      head/sys/dev/ic/ns16550.h
      head/sys/dev/uart/uart_dev_ns8250.c
    
    Modified: head/sys/dev/ic/ns16550.h
    ==============================================================================
    --- head/sys/dev/ic/ns16550.h	Fri Mar  1 01:03:27 2013	(r247518)
    +++ head/sys/dev/ic/ns16550.h	Fri Mar  1 01:42:31 2013	(r247519)
    @@ -182,6 +182,7 @@
     #define	com_xoff1	6	/* XOFF 1 character (R/W) */
     #define	com_xoff2	7	/* XOFF 2 character (R/W) */
     
    +#define DW_REG_USR	31	/* DesignWare derived Uart Status Reg */
     #define com_usr		39	/* Octeon 16750/16550 Uart Status Reg */
     #define REG_USR		com_usr
     #define USR_TXFIFO_NOTFULL 2    /* Uart TX FIFO Not full */
    
    Modified: head/sys/dev/uart/uart_dev_ns8250.c
    ==============================================================================
    --- head/sys/dev/uart/uart_dev_ns8250.c	Fri Mar  1 01:03:27 2013	(r247518)
    +++ head/sys/dev/uart/uart_dev_ns8250.c	Fri Mar  1 01:42:31 2013	(r247519)
    @@ -24,6 +24,8 @@
      * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      */
     
    +#include "opt_platform.h"
    +
     #include 
     __FBSDID("$FreeBSD$");
     
    @@ -35,6 +37,12 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     
    +#ifdef FDT
    +#include 
    +#include 
    +#include 
    +#endif
    +
     #include 
     #include 
     #include 
    @@ -45,6 +53,11 @@ __FBSDID("$FreeBSD$");
     
     #define	DEFAULT_RCLK	1843200
     
    +static int broken_txfifo = 0;
    +SYSCTL_INT(_hw, OID_AUTO, broken_txfifo, CTLFLAG_RW | CTLFLAG_TUN,
    +	&broken_txfifo, 0, "UART FIFO has QEMU emulation bug");
    +TUNABLE_INT("hw.broken_txfifo", &broken_txfifo);
    +
     /*
      * Clear pending interrupts. THRE is cleared by reading IIR. Data
      * that may have been received gets lost here.
    @@ -350,6 +363,7 @@ struct ns8250_softc {
     	
     	uint8_t		ier_mask;
     	uint8_t		ier_rxbits;
    +	uint8_t		busy_detect;
     };
     
     static int ns8250_bus_attach(struct uart_softc *);
    @@ -401,6 +415,24 @@ ns8250_bus_attach(struct uart_softc *sc)
     	struct ns8250_softc *ns8250 = (struct ns8250_softc*)sc;
     	struct uart_bas *bas;
     	unsigned int ivar;
    +#ifdef FDT
    +	phandle_t node;
    +	pcell_t cell;
    +#endif
    +
    +	ns8250->busy_detect = 0;
    +
    +#ifdef FDT
    +	/* 
    +	 * Check whether uart requires to read USR reg when IIR_BUSY and 
    +	 * has broken txfifo. 
    +	 */
    +	node = ofw_bus_get_node(sc->sc_dev);
    +	if ((OF_getprop(node, "busy-detect", &cell, sizeof(cell))) > 0)
    +		ns8250->busy_detect = 1;
    +	if ((OF_getprop(node, "broken-txfifo", &cell, sizeof(cell))) > 0)
    +		broken_txfifo = 1;
    +#endif
     
     	bas = &sc->sc_bas;
     
    @@ -592,6 +624,12 @@ ns8250_bus_ipend(struct uart_softc *sc)
     	bas = &sc->sc_bas;
     	uart_lock(sc->sc_hwmtx);
     	iir = uart_getreg(bas, REG_IIR);
    +
    +	if (ns8250->busy_detect && (iir & IIR_BUSY) == IIR_BUSY) {
    +		(void)uart_getreg(bas, DW_REG_USR);
    +		uart_unlock(sc->sc_hwmtx);
    +		return (0);
    +	}
     	if (iir & IIR_NOPEND) {
     		uart_unlock(sc->sc_hwmtx);
     		return (0);
    @@ -847,11 +885,6 @@ ns8250_bus_setsig(struct uart_softc *sc,
     	return (0);
     }
     
    -static int broken_txfifo = 0;
    -SYSCTL_INT(_hw, OID_AUTO, broken_txfifo, CTLFLAG_RW | CTLFLAG_TUN,
    -	&broken_txfifo, 0, "UART FIFO has QEMU emulation bug");
    -TUNABLE_INT("hw.broken_txfifo", &broken_txfifo);
    -
     static int
     ns8250_bus_transmit(struct uart_softc *sc)
     {
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 01:47:14 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id E580553A;
     Fri,  1 Mar 2013 01:47:14 +0000 (UTC)
     (envelope-from ganbold@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id BEFF1E53;
     Fri,  1 Mar 2013 01:47:14 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r211lCcQ035811;
     Fri, 1 Mar 2013 01:47:12 GMT (envelope-from ganbold@svn.freebsd.org)
    Received: (from ganbold@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r211lCxP035808;
     Fri, 1 Mar 2013 01:47:12 GMT (envelope-from ganbold@svn.freebsd.org)
    Message-Id: <201303010147.r211lCxP035808@svn.freebsd.org>
    From: Ganbold Tsagaankhuu 
    Date: Fri, 1 Mar 2013 01:47:12 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247520 - in head/sys: arm/allwinner arm/conf boot/fdt/dts
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 01:47:15 -0000
    
    Author: ganbold (doc committer)
    Date: Fri Mar  1 01:47:11 2013
    New Revision: 247520
    URL: http://svnweb.freebsd.org/changeset/base/247520
    
    Log:
      Enable uart driver for A10.
      
      Approved by: gonzo@
    
    Modified:
      head/sys/arm/allwinner/files.a10
      head/sys/arm/conf/CUBIEBOARD
      head/sys/boot/fdt/dts/cubieboard.dts
    
    Modified: head/sys/arm/allwinner/files.a10
    ==============================================================================
    --- head/sys/arm/allwinner/files.a10	Fri Mar  1 01:42:31 2013	(r247519)
    +++ head/sys/arm/allwinner/files.a10	Fri Mar  1 01:47:11 2013	(r247520)
    @@ -17,5 +17,5 @@ arm/allwinner/timer.c			standard
     arm/allwinner/aintc.c			standard
     arm/allwinner/bus_space.c		standard
     arm/allwinner/common.c			standard
    -arm/allwinner/console.c			standard
    +#arm/allwinner/console.c			standard
     arm/allwinner/a10_machdep.c		standard
    
    Modified: head/sys/arm/conf/CUBIEBOARD
    ==============================================================================
    --- head/sys/arm/conf/CUBIEBOARD	Fri Mar  1 01:42:31 2013	(r247519)
    +++ head/sys/arm/conf/CUBIEBOARD	Fri Mar  1 01:47:11 2013	(r247520)
    @@ -87,8 +87,8 @@ options		ROOTDEVNAME=\"ufs:/dev/da0s2\"
     #options	ATA_STATIC_ID	# Static device numbering
     
     # Console and misc
    -#device		uart
    -#device		uart_ns8250
    +device		uart
    +device		uart_ns8250
     device		pty
     device		snp
     device		md
    
    Modified: head/sys/boot/fdt/dts/cubieboard.dts
    ==============================================================================
    --- head/sys/boot/fdt/dts/cubieboard.dts	Fri Mar  1 01:42:31 2013	(r247519)
    +++ head/sys/boot/fdt/dts/cubieboard.dts	Fri Mar  1 01:47:11 2013	(r247520)
    @@ -121,6 +121,8 @@
     			interrupt-parent = <&AINTC>;
     			current-speed = <115200>;
     			clock-frequency = < 24000000 >;
    +			busy-detect = <1>;
    +			broken-txfifo = <1>;
     		};
     	};
     
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 02:26:30 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id E79FCEE3;
     Fri,  1 Mar 2013 02:26:30 +0000 (UTC)
     (envelope-from neel@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id C0D50FBC;
     Fri,  1 Mar 2013 02:26:30 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r212QUZV048349;
     Fri, 1 Mar 2013 02:26:30 GMT (envelope-from neel@svn.freebsd.org)
    Received: (from neel@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r212QTG8048342;
     Fri, 1 Mar 2013 02:26:29 GMT (envelope-from neel@svn.freebsd.org)
    Message-Id: <201303010226.r212QTG8048342@svn.freebsd.org>
    From: Neel Natu 
    Date: Fri, 1 Mar 2013 02:26:29 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247523 - head/usr.sbin/bhyve
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 02:26:31 -0000
    
    Author: neel
    Date: Fri Mar  1 02:26:28 2013
    New Revision: 247523
    URL: http://svnweb.freebsd.org/changeset/base/247523
    
    Log:
      Specify the length of the mapping requested from 'paddr_guest2host()'.
      
      This seems prudent to do in its own right but it also opens up the possibility
      of not having to mmap the entire guest address space in the 'bhyve' process
      context.
      
      Discussed with:	grehan
      Obtained from:	NetApp
    
    Modified:
      head/usr.sbin/bhyve/acpi.c
      head/usr.sbin/bhyve/bhyverun.c
      head/usr.sbin/bhyve/bhyverun.h
      head/usr.sbin/bhyve/mptbl.c
      head/usr.sbin/bhyve/pci_virtio_block.c
      head/usr.sbin/bhyve/pci_virtio_net.c
      head/usr.sbin/bhyve/virtio.h
    
    Modified: head/usr.sbin/bhyve/acpi.c
    ==============================================================================
    --- head/usr.sbin/bhyve/acpi.c	Fri Mar  1 02:09:06 2013	(r247522)
    +++ head/usr.sbin/bhyve/acpi.c	Fri Mar  1 02:26:28 2013	(r247523)
    @@ -683,13 +683,16 @@ static int
     basl_load(int fd, uint64_t off)
     {
             struct stat sb;
    +	void *gaddr;
     	int err;
     
     	err = 0;
    -
    -	if (fstat(fd, &sb) < 0 ||
    -	    read(fd, paddr_guest2host(basl_acpi_base + off), sb.st_size) < 0)
    +	gaddr = paddr_guest2host(basl_acpi_base + off, sb.st_size);
    +	if (gaddr != NULL) {
    +		if (fstat(fd, &sb) < 0 || read(fd, gaddr, sb.st_size) < 0)
     			err = errno;
    +	} else
    +		err = EFAULT;
     
     	return (err);
     }
    
    Modified: head/usr.sbin/bhyve/bhyverun.c
    ==============================================================================
    --- head/usr.sbin/bhyve/bhyverun.c	Fri Mar  1 02:09:06 2013	(r247522)
    +++ head/usr.sbin/bhyve/bhyverun.c	Fri Mar  1 02:26:28 2013	(r247523)
    @@ -157,17 +157,19 @@ usage(int code)
     }
     
     void *
    -paddr_guest2host(uintptr_t gaddr)
    +paddr_guest2host(uintptr_t gaddr, size_t len)
     {
    -	if (lomem_sz == 0)
    -		return (NULL);
     
    -	if (gaddr < lomem_sz) {
    +	if (gaddr < lomem_sz && gaddr + len <= lomem_sz)
     		return ((void *)(lomem_addr + gaddr));
    -	} else if (gaddr >= 4*GB && gaddr < (4*GB + himem_sz)) {
    -		return ((void *)(himem_addr + gaddr - 4*GB));
    -	} else
    -		return (NULL);
    +
    +	if (gaddr >= 4*GB) {
    +		gaddr -= 4*GB;
    +		if (gaddr < himem_sz && gaddr + len <= himem_sz)
    +			return ((void *)(himem_addr + gaddr));
    +	}
    +
    +	return (NULL);
     }
     
     int
    
    Modified: head/usr.sbin/bhyve/bhyverun.h
    ==============================================================================
    --- head/usr.sbin/bhyve/bhyverun.h	Fri Mar  1 02:09:06 2013	(r247522)
    +++ head/usr.sbin/bhyve/bhyverun.h	Fri Mar  1 02:26:28 2013	(r247523)
    @@ -43,7 +43,7 @@ extern char *vmname;
     
     extern u_long lomem_sz, himem_sz;
     
    -void *paddr_guest2host(uintptr_t);
    +void *paddr_guest2host(uintptr_t addr, size_t len);
     
     void fbsdrun_addcpu(struct vmctx *ctx, int cpu, uint64_t rip);
     int  fbsdrun_muxed(void);
    
    Modified: head/usr.sbin/bhyve/mptbl.c
    ==============================================================================
    --- head/usr.sbin/bhyve/mptbl.c	Fri Mar  1 02:09:06 2013	(r247522)
    +++ head/usr.sbin/bhyve/mptbl.c	Fri Mar  1 02:26:28 2013	(r247523)
    @@ -41,6 +41,9 @@ __FBSDID("$FreeBSD$");
     
     #define MPTABLE_BASE		0xF0000
     
    +/* floating pointer length + maximum length of configuration table */
    +#define	MPTABLE_MAX_LENGTH	(65536 + 16)
    +
     #define LAPIC_PADDR		0xFEE00000
     #define LAPIC_VERSION 		16
     
    @@ -346,13 +349,13 @@ mptable_build(struct vmctx *ctx, int ncp
     	char 			*curraddr;
     	char 			*startaddr;
     
    -	if (paddr_guest2host(0) == NULL) {
    +	startaddr = paddr_guest2host(MPTABLE_BASE, MPTABLE_MAX_LENGTH);
    +	if (startaddr == NULL) {
     		printf("mptable requires mapped mem\n");
     		return (ENOMEM);
     	}
     
    -	startaddr = curraddr = paddr_guest2host(MPTABLE_BASE);
    -
    +	curraddr = startaddr;
     	mpfp = (mpfps_t)curraddr;
     	mpt_build_mpfp(mpfp, MPTABLE_BASE);
     	curraddr += sizeof(*mpfp);
    
    Modified: head/usr.sbin/bhyve/pci_virtio_block.c
    ==============================================================================
    --- head/usr.sbin/bhyve/pci_virtio_block.c	Fri Mar  1 02:09:06 2013	(r247522)
    +++ head/usr.sbin/bhyve/pci_virtio_block.c	Fri Mar  1 02:26:28 2013	(r247523)
    @@ -222,13 +222,13 @@ pci_vtblk_proc(struct pci_vtblk_softc *s
     	assert(nsegs >= 3);
     	assert(nsegs < VTBLK_MAXSEGS + 2);
     
    -	vid = paddr_guest2host(vd->vd_addr);
    +	vid = paddr_guest2host(vd->vd_addr, vd->vd_len);
     	assert((vid->vd_flags & VRING_DESC_F_INDIRECT) == 0);
     
     	/*
     	 * The first descriptor will be the read-only fixed header
     	 */
    -	vbh = paddr_guest2host(vid[0].vd_addr);
    +	vbh = paddr_guest2host(vid[0].vd_addr, sizeof(struct virtio_blk_hdr));
     	assert(vid[0].vd_len == sizeof(struct virtio_blk_hdr));
     	assert(vid[0].vd_flags & VRING_DESC_F_NEXT);
     	assert((vid[0].vd_flags & VRING_DESC_F_WRITE) == 0);
    @@ -247,7 +247,8 @@ pci_vtblk_proc(struct pci_vtblk_softc *s
     	 * Build up the iovec based on the guest's data descriptors
     	 */
     	for (i = 1, iolen = 0; i < nsegs - 1; i++) {
    -		iov[i-1].iov_base = paddr_guest2host(vid[i].vd_addr);
    +		iov[i-1].iov_base = paddr_guest2host(vid[i].vd_addr,
    +						     vid[i].vd_len);
     		iov[i-1].iov_len = vid[i].vd_len;
     		iolen += vid[i].vd_len;
     
    @@ -265,7 +266,7 @@ pci_vtblk_proc(struct pci_vtblk_softc *s
     	}
     
     	/* Lastly, get the address of the status byte */
    -	status = paddr_guest2host(vid[nsegs - 1].vd_addr);
    +	status = paddr_guest2host(vid[nsegs - 1].vd_addr, 1);
     	assert(vid[nsegs - 1].vd_len == 1);
     	assert((vid[nsegs - 1].vd_flags & VRING_DESC_F_NEXT) == 0);
     	assert(vid[nsegs - 1].vd_flags & VRING_DESC_F_WRITE);
    @@ -341,7 +342,8 @@ pci_vtblk_ring_init(struct pci_vtblk_sof
     	hq = &sc->vbsc_q;
     	hq->hq_size = VTBLK_RINGSZ;
     
    -	hq->hq_dtable = paddr_guest2host(pfn << VRING_PFN);
    +	hq->hq_dtable = paddr_guest2host(pfn << VRING_PFN,
    +					 vring_size(VTBLK_RINGSZ));
     	hq->hq_avail_flags =  (uint16_t *)(hq->hq_dtable + hq->hq_size);
     	hq->hq_avail_idx = hq->hq_avail_flags + 1;
     	hq->hq_avail_ring = hq->hq_avail_flags + 2;
    @@ -372,13 +374,6 @@ pci_vtblk_init(struct vmctx *ctx, struct
     	}
     
     	/*
    -	 * Access to guest memory is required. Fail if
    -	 * memory not mapped
    -	 */
    -	if (paddr_guest2host(0) == NULL)
    -		return (1);
    -
    -	/*
     	 * The supplied backing file has to exist
     	 */
     	fd = open(opts, O_RDWR);
    
    Modified: head/usr.sbin/bhyve/pci_virtio_net.c
    ==============================================================================
    --- head/usr.sbin/bhyve/pci_virtio_net.c	Fri Mar  1 02:09:06 2013	(r247522)
    +++ head/usr.sbin/bhyve/pci_virtio_net.c	Fri Mar  1 02:26:28 2013	(r247523)
    @@ -326,7 +326,7 @@ pci_vtnet_tap_rx(struct pci_vtnet_softc 
     		 * Get a pointer to the rx header, and use the
     		 * data immediately following it for the packet buffer.
     		 */
    -		vrx = (struct virtio_net_rxhdr *)paddr_guest2host(vd->vd_addr);
    +		vrx = paddr_guest2host(vd->vd_addr, vd->vd_len);
     		buf = (uint8_t *)(vrx + 1);
     
     		len = read(sc->vsc_tapfd, buf,
    @@ -434,7 +434,7 @@ pci_vtnet_proctx(struct pci_vtnet_softc 
     	for (i = 0, plen = 0;
     	     i < VTNET_MAXSEGS;
     	     i++, vd = &hq->hq_dtable[vd->vd_next]) {
    -		iov[i].iov_base = paddr_guest2host(vd->vd_addr);
    +		iov[i].iov_base = paddr_guest2host(vd->vd_addr, vd->vd_len);
     		iov[i].iov_len = vd->vd_len;
     		plen += vd->vd_len;
     		tlen += vd->vd_len;
    @@ -517,7 +517,8 @@ pci_vtnet_ring_init(struct pci_vtnet_sof
     	hq = &sc->vsc_hq[qnum];
     	hq->hq_size = pci_vtnet_qsize(qnum);
     
    -	hq->hq_dtable = paddr_guest2host(pfn << VRING_PFN);
    +	hq->hq_dtable = paddr_guest2host(pfn << VRING_PFN,
    +					 vring_size(hq->hq_size));
     	hq->hq_avail_flags =  (uint16_t *)(hq->hq_dtable + hq->hq_size);
     	hq->hq_avail_idx = hq->hq_avail_flags + 1;
     	hq->hq_avail_ring = hq->hq_avail_flags + 2;
    @@ -541,13 +542,6 @@ pci_vtnet_init(struct vmctx *ctx, struct
     	struct pci_vtnet_softc *sc;
     	const char *env_msi;
     
    -	/*
    -	 * Access to guest memory is required. Fail if
    -	 * memory not mapped
    -	 */
    -	if (paddr_guest2host(0) == NULL)
    -		return (1);
    -
     	sc = malloc(sizeof(struct pci_vtnet_softc));
     	memset(sc, 0, sizeof(struct pci_vtnet_softc));
     
    
    Modified: head/usr.sbin/bhyve/virtio.h
    ==============================================================================
    --- head/usr.sbin/bhyve/virtio.h	Fri Mar  1 02:09:06 2013	(r247522)
    +++ head/usr.sbin/bhyve/virtio.h	Fri Mar  1 02:26:28 2013	(r247523)
    @@ -85,4 +85,19 @@ struct virtio_used {
     #define VTCFG_R_CFG1		24	/* With MSI-X */
     #define VTCFG_R_MSIX		20
     
    +/* From section 2.3, "Virtqueue Configuration", of the virtio specification */
    +static inline u_int
    +vring_size(u_int qsz)
    +{
    +	u_int size;
    +
    +	size = sizeof(struct virtio_desc) * qsz + sizeof(uint16_t) * (3 + qsz);
    +	size = roundup2(size, VRING_ALIGN);
    +
    +	size += sizeof(uint16_t) * 3 + sizeof(struct virtio_used) * qsz;
    +	size = roundup2(size, VRING_ALIGN);
    +
    +	return (size);
    +}
    +
     #endif	/* _VIRTIO_H_ */
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 02:46:41 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: by hub.freebsd.org (Postfix, from userid 1033)
     id 598F728A; Fri,  1 Mar 2013 02:46:41 +0000 (UTC)
    Date: Fri, 1 Mar 2013 02:46:41 +0000
    From: Alexey Dokuchaev 
    To: Alexander Motin 
    Subject: Re: svn commit: r247460 - head/sys/dev/acpica
    Message-ID: <20130301024641.GA88239@FreeBSD.org>
    References: <201302281127.r1SBR2VE068276@svn.freebsd.org>
     <20130228162522.GA41693@FreeBSD.org> <512F95DC.1040005@FreeBSD.org>
    MIME-Version: 1.0
    Content-Type: text/plain; charset=koi8-r
    Content-Disposition: inline
    In-Reply-To: <512F95DC.1040005@FreeBSD.org>
    User-Agent: Mutt/1.5.21 (2010-09-15)
    Cc: Davide Italiano , svn-src-head@freebsd.org,
     svn-src-all@freebsd.org, src-committers@freebsd.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 02:46:41 -0000
    
    On Thu, Feb 28, 2013 at 07:37:32PM +0200, Alexander Motin wrote:
    > SBT_1US is 4294 (0x10c6). The best that compiler may do is replace
    > division with multiplication. In fact, Clang even does this on amd64.
    > But on i386 it calls __divdi3(), doing 64bit division in software. Shift
    > is definitely cheaper and 5% precision is fine here.
    
    I see, thanks for explanation.  I overlooked SBT_1US definition.
    
    ./danfe
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 03:25:43 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id DB0C8B12;
     Fri,  1 Mar 2013 03:25:43 +0000 (UTC)
     (envelope-from brooks@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id B80962C0;
     Fri,  1 Mar 2013 03:25:43 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r213Ph6Q067559;
     Fri, 1 Mar 2013 03:25:43 GMT (envelope-from brooks@svn.freebsd.org)
    Received: (from brooks@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r213PhXh067558;
     Fri, 1 Mar 2013 03:25:43 GMT (envelope-from brooks@svn.freebsd.org)
    Message-Id: <201303010325.r213PhXh067558@svn.freebsd.org>
    From: Brooks Davis 
    Date: Fri, 1 Mar 2013 03:25:43 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247527 - head/share/mk
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 03:25:43 -0000
    
    Author: brooks
    Date: Fri Mar  1 03:25:43 2013
    New Revision: 247527
    URL: http://svnweb.freebsd.org/changeset/base/247527
    
    Log:
      Provide slightly more helpful feedback when we can't figure out what
      compiler the user is using.
      
      PR:		misc/173914
    
    Modified:
      head/share/mk/bsd.compiler.mk
    
    Modified: head/share/mk/bsd.compiler.mk
    ==============================================================================
    --- head/share/mk/bsd.compiler.mk	Fri Mar  1 03:05:08 2013	(r247526)
    +++ head/share/mk/bsd.compiler.mk	Fri Mar  1 03:25:43 2013	(r247527)
    @@ -14,7 +14,7 @@ COMPILER_TYPE:=	gcc
     .  elif ${_COMPILER_VERSION:Mclang}
     COMPILER_TYPE:=	clang
     .  else
    -.error Unable to determine compiler type for ${CC}
    +.error Unable to determine compiler type for ${CC}.  Consider setting COMPILER_TYPE.
     .  endif
     .  undef _COMPILER_VERSION
     . endif
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 04:16:04 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id AEECF31A;
     Fri,  1 Mar 2013 04:16:04 +0000 (UTC)
     (envelope-from brde@optusnet.com.au)
    Received: from fallbackmx07.syd.optusnet.com.au
     (fallbackmx07.syd.optusnet.com.au [211.29.132.9])
     by mx1.freebsd.org (Postfix) with ESMTP id E05326A3;
     Fri,  1 Mar 2013 04:16:03 +0000 (UTC)
    Received: from mail28.syd.optusnet.com.au (mail28.syd.optusnet.com.au
     [211.29.133.169])
     by fallbackmx07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
     r214FvXH023251; Fri, 1 Mar 2013 15:15:57 +1100
    Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au
     (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106])
     by mail28.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r214Fh0f022953
     (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
     Fri, 1 Mar 2013 15:15:44 +1100
    Date: Fri, 1 Mar 2013 15:15:43 +1100 (EST)
    From: Bruce Evans 
    X-X-Sender: bde@besplex.bde.org
    To: Alexander Motin 
    Subject: Re: svn commit: r247460 - head/sys/dev/acpica
    In-Reply-To: <512F95DC.1040005@FreeBSD.org>
    Message-ID: <20130301151538.G959@besplex.bde.org>
    References: <201302281127.r1SBR2VE068276@svn.freebsd.org>
     <20130228162522.GA41693@FreeBSD.org> <512F95DC.1040005@FreeBSD.org>
    MIME-Version: 1.0
    Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
    X-Optus-CM-Score: 0
    X-Optus-CM-Analysis: v=2.0 cv=bNdOu4CZ c=1 sm=1 a=f5xiIF61AdoA:10
     a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=7E17uGdFteIA:10
     a=6I5d2MoRAAAA:8 a=ba2XAj07wnl6R86JeWQA:9 a=CjuIK1q_8ugA:10
     a=TEtd8y5WR3g2ypngnwZWYw==:117
    Cc: Davide Italiano , svn-src-head@freebsd.org,
     Alexey Dokuchaev , src-committers@freebsd.org,
     svn-src-all@freebsd.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 04:16:04 -0000
    
    On Thu, 28 Feb 2013, Alexander Motin wrote:
    
    > On 28.02.2013 18:25, Alexey Dokuchaev wrote:
    >> On Thu, Feb 28, 2013 at 11:27:02AM +0000, Davide Italiano wrote:
    >>> New Revision: 247460
    >>> URL: http://svnweb.freebsd.org/changeset/base/247460
    >>>
    >>> Log:
    >>>   MFcalloutng (r247427 by mav):
    >>>   We don't need any precision here. Let it be fast and dirty shift then
    >>>   slow and excessively precise 64-bit division.
    >>>
    >>> -    if (sbt >= 0 && us > sbt / SBT_1US)
    >>> -	us = sbt / SBT_1US;
    >>> +    if (sbt >= 0 && us > (sbt >> 12))
    >>> +	us = (sbt >> 12);
    >>
    >> Does this really buy us anything?  Modern compilers should be smart enough to
    >> generate correct code.  Do you have evidence that this is not the case here?
    >> Not to mention that it obfuscates the code by using some magic constant.
    >
    > SBT_1US is 4294 (0x10c6). The best that compiler may do is replace
    > division with multiplication. In fact, Clang even does this on amd64.
    > But on i386 it calls __divdi3(), doing 64bit division in software. Shift
    > is definitely cheaper and 5% precision is fine here.
    
    I missed the additional magic in my previous reply.
    
    But you should write the sloppy scaling as division by a sloppy factor:
    
    #define	SSBT_1us	4096		/* power of 2 closest to SSBT_1US */
    
          if (sbt >= 0 && us > (uint64_t)sbt / SSBT_1us)
      	us = (uint64_t)sbt / SSBT_1us;
    
    or provide and use conversion functions that do sloppy and non-sloppy
    scaling.  I don't like having conversion functions for every possible
    conversion, but this one is much more magic than for example
    TIMEVAL_TO_TIMESPEC().  The casts to (uint64_t) are to help the compiler
    understand that the sign bit is not there.
    
    The need for magic scaling shows that the binary representation given
    by sbintime_t isn't very good.  Mose clients want natural units of
    microseconds or nanoseconds and need scale factors like
    (4294.967206 / 4096) to adjust (4294 is already sloppy).  The binary
    representation allows some minor internal optimizations and APIs are
    made unnatural to avoid double conversions.
    
    While here, I will point out style bugs introduced in the above:
    - parentheses in "us = (sbt >> 12);" are redundant and reduce clarity,
        like parentheses in "us = (sbt / N);" would have, since the shift
        operator binds much more tightly than the assignment operator.
    - parentheses in "us > (sbt >> 12);" are redundant but may increase
        clarity, since the shift operator doesn't bind much more tightly
        than the '<' comparison operator.  This one is hard to remember, but
        looking it up confirms that the precedence is not broken as designed
        in this case, but that the precedence is only 1 level higher for the
        shift operator.  The main broken as designed cases are the shift
        operator being 1 level lower than addition and subtraction, and
        bitwise operators being many more levels lower than other aritmetic
        operators and even below all comparision operators.
    
    Bruce
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 07:39:15 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id C3A15C81;
     Fri,  1 Mar 2013 07:39:15 +0000 (UTC) (envelope-from ru@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id ABDC2DA4;
     Fri,  1 Mar 2013 07:39:15 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r217dFkP044413;
     Fri, 1 Mar 2013 07:39:15 GMT (envelope-from ru@svn.freebsd.org)
    Received: (from ru@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r217dElT044409;
     Fri, 1 Mar 2013 07:39:14 GMT (envelope-from ru@svn.freebsd.org)
    Message-Id: <201303010739.r217dElT044409@svn.freebsd.org>
    From: Ruslan Ermilov 
    Date: Fri, 1 Mar 2013 07:39:14 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247534 - head/lib/libutil
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 07:39:15 -0000
    
    Author: ru
    Date: Fri Mar  1 07:39:14 2013
    New Revision: 247534
    URL: http://svnweb.freebsd.org/changeset/base/247534
    
    Log:
      Fixed documented prototype of kinfo_getproc(3).
    
    Modified:
      head/lib/libutil/kinfo_getproc.3
    
    Modified: head/lib/libutil/kinfo_getproc.3
    ==============================================================================
    --- head/lib/libutil/kinfo_getproc.3	Fri Mar  1 07:01:24 2013	(r247533)
    +++ head/lib/libutil/kinfo_getproc.3	Fri Mar  1 07:39:14 2013	(r247534)
    @@ -25,7 +25,7 @@
     .\"
     .\" $FreeBSD$
     .\"
    -.Dd February 25, 2012
    +.Dd March 1, 2013
     .Dt KINFO_GETPROC 3
     .Os
     .Sh NAME
    @@ -37,7 +37,7 @@
     .In sys/types.h
     .In libutil.h
     .Ft struct kinfo_proc *
    -.Fn kinfo_getproc "pid_t pid" "int *cntp"
    +.Fn kinfo_getproc "pid_t pid"
     .Sh DESCRIPTION
     This function is used for obtaining process information from the kernel.
     .Pp
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 08:30:32 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 1AD07B76;
     Fri,  1 Mar 2013 08:30:32 +0000 (UTC) (envelope-from alc@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 08100FD3;
     Fri,  1 Mar 2013 08:30:32 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r218UV1Y060021;
     Fri, 1 Mar 2013 08:30:31 GMT (envelope-from alc@svn.freebsd.org)
    Received: (from alc@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r218UVB8060020;
     Fri, 1 Mar 2013 08:30:31 GMT (envelope-from alc@svn.freebsd.org)
    Message-Id: <201303010830.r218UVB8060020@svn.freebsd.org>
    From: Alan Cox 
    Date: Fri, 1 Mar 2013 08:30:31 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247535 - head/sys/arm/include
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 08:30:32 -0000
    
    Author: alc
    Date: Fri Mar  1 08:30:31 2013
    New Revision: 247535
    URL: http://svnweb.freebsd.org/changeset/base/247535
    
    Log:
      Copy the definition of VM_MAX_AUTOTUNE_MAXUSERS from i386.  (See r242847.)
      
      Tested by:	andrew
    
    Modified:
      head/sys/arm/include/vmparam.h
    
    Modified: head/sys/arm/include/vmparam.h
    ==============================================================================
    --- head/sys/arm/include/vmparam.h	Fri Mar  1 07:39:14 2013	(r247534)
    +++ head/sys/arm/include/vmparam.h	Fri Mar  1 08:30:31 2013	(r247535)
    @@ -178,4 +178,8 @@ extern vm_offset_t vm_max_kernel_address
     
     #define	ZERO_REGION_SIZE	(64 * 1024)	/* 64KB */
     
    +#ifndef VM_MAX_AUTOTUNE_MAXUSERS
    +#define	VM_MAX_AUTOTUNE_MAXUSERS	384
    +#endif
    +
     #endif	/* _MACHINE_VMPARAM_H_ */
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 09:43:00 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 2FEB1883;
     Fri,  1 Mar 2013 09:43:00 +0000 (UTC) (envelope-from mm@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 13FF6283;
     Fri,  1 Mar 2013 09:43:00 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r219h00U082822;
     Fri, 1 Mar 2013 09:43:00 GMT (envelope-from mm@svn.freebsd.org)
    Received: (from mm@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r219gxH0082811;
     Fri, 1 Mar 2013 09:42:59 GMT (envelope-from mm@svn.freebsd.org)
    Message-Id: <201303010942.r219gxH0082811@svn.freebsd.org>
    From: Martin Matuska 
    Date: Fri, 1 Mar 2013 09:42:59 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247540 - in head:
     cddl/contrib/opensolaris/lib/libzfs/common
     sys/cddl/contrib/opensolaris/common/zfs
     sys/cddl/contrib/opensolaris/uts/common/fs/zfs
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 09:43:00 -0000
    
    Author: mm
    Date: Fri Mar  1 09:42:58 2013
    New Revision: 247540
    URL: http://svnweb.freebsd.org/changeset/base/247540
    
    Log:
      Fix the zfs_ioctl compat layer to support zfs_cmd size change introduced
      in r247265 (ZFS deadman thread). Both new utilities now support the old
      kernel and new kernel properly detects old utilities.
      
      For future backwards compatibility, the vfs.zfs.version.ioctl read-only
      sysctl has been introduced. With this sysctl zfs utilities will be able
      to detect the ioctl interface version of the currently loaded zfs module.
      
      As a side effect, the zfs utilities between r247265 and this revision don't
      support the old kernel module. If you are using HEAD newer or equal than
      r247265, install the new kernel module (or whole kernel) first.
      
      MFC after:	10 days
    
    Modified:
      head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h
      head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c
      head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h
      head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
    
    Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h
    ==============================================================================
    --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h	Fri Mar  1 09:40:02 2013	(r247539)
    +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h	Fri Mar  1 09:42:58 2013	(r247540)
    @@ -24,6 +24,7 @@
      * Copyright (c) 2011 Pawel Jakub Dawidek .
      * All rights reserved.
      * Copyright (c) 2011 by Delphix. All rights reserved.
    + * Copyright (c) 2013 Martin Matuska . All rights reserved.
      */
     
     #ifndef	_LIBFS_IMPL_H
    @@ -216,6 +217,7 @@ extern void libzfs_fru_clear(libzfs_hand
     
     #ifndef sun
     static int zfs_kernel_version = 0;
    +static int zfs_ioctl_version = 0;
     
     /*
      * This is FreeBSD version of ioctl, because Solaris' ioctl() updates
    @@ -225,19 +227,34 @@ static int zfs_kernel_version = 0;
     static __inline int
     zcmd_ioctl(int fd, unsigned long cmd, zfs_cmd_t *zc)
     {
    -	size_t oldsize, zfs_kernel_version_size;
    +	size_t oldsize, zfs_kernel_version_size, zfs_ioctl_version_size;
     	int version, ret, cflag = ZFS_CMD_COMPAT_NONE;
     
    -	zfs_kernel_version_size = sizeof(zfs_kernel_version);
    -	if (zfs_kernel_version == 0) {
    -		sysctlbyname("vfs.zfs.version.spa", &zfs_kernel_version,
    -		    &zfs_kernel_version_size, NULL, 0);
    +	zfs_ioctl_version_size = sizeof(zfs_ioctl_version);
    +	if (zfs_ioctl_version == 0) {
    +		sysctlbyname("vfs.zfs.version.ioctl", &zfs_ioctl_version,
    +		    &zfs_ioctl_version_size, NULL, 0);
     	}
     
    -	if (zfs_kernel_version == SPA_VERSION_15 ||
    -	    zfs_kernel_version == SPA_VERSION_14 ||
    -	    zfs_kernel_version == SPA_VERSION_13)
    -		cflag = ZFS_CMD_COMPAT_V15;
    +	/*
    +	 * If vfs.zfs.version.ioctl is not defined, assume we have v28
    +	 * compatible binaries and use vfs.zfs.version.spa to test for v15
    +	 */
    +	if (zfs_ioctl_version < ZFS_IOCVER_DEADMAN) {
    +		cflag = ZFS_CMD_COMPAT_V28;
    +		zfs_kernel_version_size = sizeof(zfs_kernel_version);
    +
    +		if (zfs_kernel_version == 0) {
    +			sysctlbyname("vfs.zfs.version.spa",
    +			    &zfs_kernel_version,
    +			    &zfs_kernel_version_size, NULL, 0);
    +		}
    +
    +		if (zfs_kernel_version == SPA_VERSION_15 ||
    +		    zfs_kernel_version == SPA_VERSION_14 ||
    +		    zfs_kernel_version == SPA_VERSION_13)
    +			cflag = ZFS_CMD_COMPAT_V15;
    +	}
     
     	oldsize = zc->zc_nvlist_dst_size;
     	ret = zcmd_ioctl_compat(fd, cmd, zc, cflag);
    
    Modified: head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c
    ==============================================================================
    --- head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c	Fri Mar  1 09:40:02 2013	(r247539)
    +++ head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c	Fri Mar  1 09:42:58 2013	(r247540)
    @@ -19,7 +19,7 @@
      * CDDL HEADER END
      */
     /*
    - * Copyright 2010 Martin Matuska . All rights reserved.
    + * Copyright 2013 Martin Matuska . All rights reserved.
      * Portions Copyright 2005, 2010, Oracle and/or its affiliates.
      * All rights reserved.
      * Use is subject to license terms.
    @@ -35,22 +35,100 @@
     #include 
     #include "zfs_ioctl_compat.h"
     
    +static int zfs_version_ioctl = ZFS_IOCVER_CURRENT;
    +SYSCTL_DECL(_vfs_zfs_version);
    +SYSCTL_INT(_vfs_zfs_version, OID_AUTO, ioctl, CTLFLAG_RD, &zfs_version_ioctl,
    +    0, "ZFS_IOCTL_VERSION");
    +
     /*
    - * FreeBSD zfs_cmd compatibility with v15 and older binaries
    + * FreeBSD zfs_cmd compatibility with older binaries
      * appropriately remap/extend the zfs_cmd_t structure
      */
     void
     zfs_cmd_compat_get(zfs_cmd_t *zc, caddr_t addr, const int cflag)
     {
     	zfs_cmd_v15_t *zc_c;
    +	zfs_cmd_v28_t *zc28_c;
     
    -	if (cflag == ZFS_CMD_COMPAT_V15) {
    +	switch (cflag) {
    +	case ZFS_CMD_COMPAT_V28:
    +		zc28_c = (void *)addr;
    +
    +		/* zc */
    +		strlcpy(zc->zc_name, zc28_c->zc_name, MAXPATHLEN);
    +		strlcpy(zc->zc_value, zc28_c->zc_value, MAXPATHLEN * 2);
    +		strlcpy(zc->zc_string, zc28_c->zc_string, MAXPATHLEN);
    +		strlcpy(zc->zc_top_ds, zc28_c->zc_top_ds, MAXPATHLEN);
    +		zc->zc_guid = zc28_c->zc_guid;
    +		zc->zc_nvlist_conf = zc28_c->zc_nvlist_conf;
    +		zc->zc_nvlist_conf_size = zc28_c->zc_nvlist_conf_size;
    +		zc->zc_nvlist_src = zc28_c->zc_nvlist_src;
    +		zc->zc_nvlist_src_size = zc28_c->zc_nvlist_src_size;
    +		zc->zc_nvlist_dst = zc28_c->zc_nvlist_dst;
    +		zc->zc_nvlist_dst_size = zc28_c->zc_nvlist_dst_size;
    +		zc->zc_cookie = zc28_c->zc_cookie;
    +		zc->zc_objset_type = zc28_c->zc_objset_type;
    +		zc->zc_perm_action = zc28_c->zc_perm_action;
    +		zc->zc_history = zc28_c->zc_history;
    +		zc->zc_history_len = zc28_c->zc_history_len;
    +		zc->zc_history_offset = zc28_c->zc_history_offset;
    +		zc->zc_obj = zc28_c->zc_obj;
    +		zc->zc_iflags = zc28_c->zc_iflags;
    +		zc->zc_share = zc28_c->zc_share;
    +		zc->zc_jailid = zc28_c->zc_jailid;
    +		zc->zc_objset_stats = zc28_c->zc_objset_stats;
    +		zc->zc_begin_record = zc28_c->zc_begin_record;
    +		zc->zc_defer_destroy = zc28_c->zc_defer_destroy;
    +		zc->zc_temphold = zc28_c->zc_temphold;
    +		zc->zc_action_handle = zc28_c->zc_action_handle;
    +		zc->zc_cleanup_fd = zc28_c->zc_cleanup_fd;
    +		zc->zc_simple = zc28_c->zc_simple;
    +		bcopy(zc28_c->zc_pad, zc->zc_pad, sizeof(zc->zc_pad));
    +		zc->zc_sendobj = zc28_c->zc_sendobj;
    +		zc->zc_fromobj = zc28_c->zc_fromobj;
    +		zc->zc_createtxg = zc28_c->zc_createtxg;
    +		zc->zc_stat = zc28_c->zc_stat;
    +
    +		/* zc->zc_inject_record */
    +		zc->zc_inject_record.zi_objset =
    +		    zc28_c->zc_inject_record.zi_objset;
    +		zc->zc_inject_record.zi_object =
    +		    zc28_c->zc_inject_record.zi_object;
    +		zc->zc_inject_record.zi_start =
    +		    zc28_c->zc_inject_record.zi_start;
    +		zc->zc_inject_record.zi_end =
    +		    zc28_c->zc_inject_record.zi_end;
    +		zc->zc_inject_record.zi_guid =
    +		    zc28_c->zc_inject_record.zi_guid;
    +		zc->zc_inject_record.zi_level =
    +		    zc28_c->zc_inject_record.zi_level;
    +		zc->zc_inject_record.zi_error =
    +		    zc28_c->zc_inject_record.zi_error;
    +		zc->zc_inject_record.zi_type =
    +		    zc28_c->zc_inject_record.zi_type;
    +		zc->zc_inject_record.zi_freq =
    +		    zc28_c->zc_inject_record.zi_freq;
    +		zc->zc_inject_record.zi_failfast =
    +		    zc28_c->zc_inject_record.zi_failfast;
    +		strlcpy(zc->zc_inject_record.zi_func,
    +		    zc28_c->zc_inject_record.zi_func, MAXNAMELEN);
    +		zc->zc_inject_record.zi_iotype =
    +		    zc28_c->zc_inject_record.zi_iotype;
    +		zc->zc_inject_record.zi_duration =
    +		    zc28_c->zc_inject_record.zi_duration;
    +		zc->zc_inject_record.zi_timer =
    +		    zc28_c->zc_inject_record.zi_timer;
    +		zc->zc_inject_record.zi_cmd = ZINJECT_UNINITIALIZED;
    +		zc->zc_inject_record.zi_pad = 0;
    +		break;
    +
    +	case ZFS_CMD_COMPAT_V15:
     		zc_c = (void *)addr;
     
     		/* zc */
    -		strlcpy(zc->zc_name,zc_c->zc_name,MAXPATHLEN);
    -		strlcpy(zc->zc_value,zc_c->zc_value,MAXPATHLEN);
    -		strlcpy(zc->zc_string,zc_c->zc_string,MAXPATHLEN);
    +		strlcpy(zc->zc_name, zc_c->zc_name, MAXPATHLEN);
    +		strlcpy(zc->zc_value, zc_c->zc_value, MAXPATHLEN);
    +		strlcpy(zc->zc_string, zc_c->zc_string, MAXPATHLEN);
     		zc->zc_guid = zc_c->zc_guid;
     		zc->zc_nvlist_conf = zc_c->zc_nvlist_conf;
     		zc->zc_nvlist_conf_size = zc_c->zc_nvlist_conf_size;
    @@ -91,6 +169,7 @@ zfs_cmd_compat_get(zfs_cmd_t *zc, caddr_
     		    zc_c->zc_inject_record.zi_freq;
     		zc->zc_inject_record.zi_failfast =
     		    zc_c->zc_inject_record.zi_failfast;
    +		break;
     	}
     }
     
    @@ -98,15 +177,84 @@ void
     zfs_cmd_compat_put(zfs_cmd_t *zc, caddr_t addr, const int cflag)
     {
     	zfs_cmd_v15_t *zc_c;
    +	zfs_cmd_v28_t *zc28_c;
     
     	switch (cflag) {
    +	case ZFS_CMD_COMPAT_V28:
    +		zc28_c = (void *)addr;
    +
    +		strlcpy(zc28_c->zc_name, zc->zc_name, MAXPATHLEN);
    +		strlcpy(zc28_c->zc_value, zc->zc_value, MAXPATHLEN * 2);
    +		strlcpy(zc28_c->zc_string, zc->zc_string, MAXPATHLEN);
    +		strlcpy(zc28_c->zc_top_ds, zc->zc_top_ds, MAXPATHLEN);
    +		zc28_c->zc_guid = zc->zc_guid;
    +		zc28_c->zc_nvlist_conf = zc->zc_nvlist_conf;
    +		zc28_c->zc_nvlist_conf_size = zc->zc_nvlist_conf_size;
    +		zc28_c->zc_nvlist_src = zc->zc_nvlist_src;
    +		zc28_c->zc_nvlist_src_size = zc->zc_nvlist_src_size;
    +		zc28_c->zc_nvlist_dst = zc->zc_nvlist_dst;
    +		zc28_c->zc_nvlist_dst_size = zc->zc_nvlist_dst_size;
    +		zc28_c->zc_cookie = zc->zc_cookie;
    +		zc28_c->zc_objset_type = zc->zc_objset_type;
    +		zc28_c->zc_perm_action = zc->zc_perm_action;
    +		zc28_c->zc_history = zc->zc_history;
    +		zc28_c->zc_history_len = zc->zc_history_len;
    +		zc28_c->zc_history_offset = zc->zc_history_offset;
    +		zc28_c->zc_obj = zc->zc_obj;
    +		zc28_c->zc_iflags = zc->zc_iflags;
    +		zc28_c->zc_share = zc->zc_share;
    +		zc28_c->zc_jailid = zc->zc_jailid;
    +		zc28_c->zc_objset_stats = zc->zc_objset_stats;
    +		zc28_c->zc_begin_record = zc->zc_begin_record;
    +		zc28_c->zc_defer_destroy = zc->zc_defer_destroy;
    +		zc28_c->zc_temphold = zc->zc_temphold;
    +		zc28_c->zc_action_handle = zc->zc_action_handle;
    +		zc28_c->zc_cleanup_fd = zc->zc_cleanup_fd;
    +		zc28_c->zc_simple = zc->zc_simple;
    +		bcopy(zc->zc_pad, zc28_c->zc_pad, sizeof(zc28_c->zc_pad));
    +		zc28_c->zc_sendobj = zc->zc_sendobj;
    +		zc28_c->zc_fromobj = zc->zc_fromobj;
    +		zc28_c->zc_createtxg = zc->zc_createtxg;
    +		zc28_c->zc_stat = zc->zc_stat;
    +
    +		/* zc_inject_record */
    +		zc28_c->zc_inject_record.zi_objset =
    +		    zc->zc_inject_record.zi_objset;
    +		zc28_c->zc_inject_record.zi_object =
    +		    zc->zc_inject_record.zi_object;
    +		zc28_c->zc_inject_record.zi_start =
    +		    zc->zc_inject_record.zi_start;
    +		zc28_c->zc_inject_record.zi_end =
    +		    zc->zc_inject_record.zi_end;
    +		zc28_c->zc_inject_record.zi_guid =
    +		    zc->zc_inject_record.zi_guid;
    +		zc28_c->zc_inject_record.zi_level =
    +		    zc->zc_inject_record.zi_level;
    +		zc28_c->zc_inject_record.zi_error =
    +		    zc->zc_inject_record.zi_error;
    +		zc28_c->zc_inject_record.zi_type =
    +		    zc->zc_inject_record.zi_type;
    +		zc28_c->zc_inject_record.zi_freq =
    +		    zc->zc_inject_record.zi_freq;
    +		zc28_c->zc_inject_record.zi_failfast =
    +		    zc->zc_inject_record.zi_failfast;
    +		strlcpy(zc28_c->zc_inject_record.zi_func,
    +		    zc->zc_inject_record.zi_func, MAXNAMELEN);
    +		zc28_c->zc_inject_record.zi_iotype =
    +		    zc->zc_inject_record.zi_iotype;
    +		zc28_c->zc_inject_record.zi_duration =
    +		    zc->zc_inject_record.zi_duration;
    +		zc28_c->zc_inject_record.zi_timer =
    +		    zc->zc_inject_record.zi_timer;
    +		break;
    +
     	case ZFS_CMD_COMPAT_V15:
     		zc_c = (void *)addr;
     
     		/* zc */
    -		strlcpy(zc_c->zc_name,zc->zc_name,MAXPATHLEN);
    -		strlcpy(zc_c->zc_value,zc->zc_value,MAXPATHLEN);
    -		strlcpy(zc_c->zc_string,zc->zc_string,MAXPATHLEN);
    +		strlcpy(zc_c->zc_name, zc->zc_name, MAXPATHLEN);
    +		strlcpy(zc_c->zc_value, zc->zc_value, MAXPATHLEN);
    +		strlcpy(zc_c->zc_string, zc->zc_string, MAXPATHLEN);
     		zc_c->zc_guid = zc->zc_guid;
     		zc_c->zc_nvlist_conf = zc->zc_nvlist_conf;
     		zc_c->zc_nvlist_conf_size = zc->zc_nvlist_conf_size;
    @@ -260,7 +408,7 @@ zfs_ioctl_compat_fix_stats_nvlist(nvlist
     }
     
     static int
    -zfs_ioctl_compat_fix_stats(zfs_cmd_t *zc, const int cflag)
    +zfs_ioctl_compat_fix_stats(zfs_cmd_t *zc, const int nc)
     {
     	nvlist_t *nv, *nvp = NULL;
     	nvpair_t *elem;
    @@ -270,7 +418,7 @@ zfs_ioctl_compat_fix_stats(zfs_cmd_t *zc
     	    zc->zc_nvlist_dst_size, zc->zc_iflags, &nv)) != 0)
     		return (error);
     
    -	if (cflag == 5) { /* ZFS_IOC_POOL_STATS */
    +	if (nc == 5) { /* ZFS_IOC_POOL_STATS */
     		elem = NULL;
     		while ((elem = nvlist_next_nvpair(nv, elem)) != NULL) {
     			if (nvpair_value_nvlist(elem, &nvp) == 0)
    @@ -334,17 +482,22 @@ zcmd_ioctl_compat(int fd, unsigned long 
     	void *zc_c;
     	unsigned long ncmd;
     
    -	if (cflag == ZFS_CMD_COMPAT_NONE) {
    +	switch (cflag) {
    +	case ZFS_CMD_COMPAT_NONE:
     		ret = ioctl(fd, cmd, zc);
     		return (ret);
    -	}
    -
    -	if (cflag == ZFS_CMD_COMPAT_V15) {
    +	case ZFS_CMD_COMPAT_V28:
    +		zc_c = malloc(sizeof(zfs_cmd_v28_t));
    +		ncmd = _IOWR('Z', ZFS_IOC(cmd), struct zfs_cmd_v28);
    +		break;
    +	case ZFS_CMD_COMPAT_V15:
     		nc = zfs_ioctl_v28_to_v15[ZFS_IOC(cmd)];
     		zc_c = malloc(sizeof(zfs_cmd_v15_t));
     		ncmd = _IOWR('Z', nc, struct zfs_cmd_v15);
    -	} else
    +		break;
    +	default:
     		return (EINVAL);
    +	}
     
     	if (ZFS_IOC(ncmd) == ZFS_IOC_COMPAT_FAIL)
     		return (ENOTSUP);
    @@ -358,16 +511,18 @@ zcmd_ioctl_compat(int fd, unsigned long 
     	zfs_cmd_compat_get(zc, (caddr_t)zc_c, cflag);
     	free(zc_c);
     
    -	switch (nc) {
    -	case 2:	/* ZFS_IOC_POOL_IMPORT */
    -	case 4: /* ZFS_IOC_POOL_CONFIGS */
    -	case 5: /* ZFS_IOC_POOL_STATS */
    -	case 6: /* ZFS_IOC_POOL_TRYIMPORT */
    -		zfs_ioctl_compat_fix_stats(zc, nc);
    -		break;
    -	case 41: /* ZFS_IOC_POOL_GET_PROPS (v15) */
    -		zfs_ioctl_compat_pool_get_props(zc);
    -		break;
    +	if (cflag == ZFS_CMD_COMPAT_V15) {
    +		switch (nc) {
    +		case 2:	/* ZFS_IOC_POOL_IMPORT */
    +		case 4: /* ZFS_IOC_POOL_CONFIGS */
    +		case 5: /* ZFS_IOC_POOL_STATS */
    +		case 6: /* ZFS_IOC_POOL_TRYIMPORT */
    +			zfs_ioctl_compat_fix_stats(zc, nc);
    +			break;
    +		case 41: /* ZFS_IOC_POOL_GET_PROPS (v15) */
    +			zfs_ioctl_compat_pool_get_props(zc);
    +			break;
    +		}
     	}
     
     	return (ret);
    
    Modified: head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h
    ==============================================================================
    --- head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h	Fri Mar  1 09:40:02 2013	(r247539)
    +++ head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h	Fri Mar  1 09:42:58 2013	(r247540)
    @@ -19,7 +19,7 @@
      * CDDL HEADER END
      */
     /*
    - * Copyright 2010 Martin Matuska .  All rights reserved.
    + * Copyright 2013 Martin Matuska .  All rights reserved.
      * Use is subject to license terms.
      */
     
    @@ -40,11 +40,21 @@
     extern "C" {
     #endif
     
    -#define ZFS_CMD_COMPAT_NONE	0
    +/*
    + * Backwards ioctl compatibility
    + */
    +
    +/* ioctl versions for vfs.zfs.version.ioctl */
    +#define	ZFS_IOCVER_DEADMAN	1
    +#define	ZFS_IOCVER_CURRENT	ZFS_IOCVER_DEADMAN
    +
    +/* compatibility conversion flag */
    +#define	ZFS_CMD_COMPAT_NONE	0
     #define	ZFS_CMD_COMPAT_V15	1
    +#define	ZFS_CMD_COMPAT_V28	2
     
    -#define ZFS_IOC_COMPAT_PASS	254
    -#define ZFS_IOC_COMPAT_FAIL	255
    +#define	ZFS_IOC_COMPAT_PASS	254
    +#define	ZFS_IOC_COMPAT_FAIL	255
     
     typedef struct zinject_record_v15 {
     	uint64_t	zi_objset;
    @@ -84,6 +94,60 @@ typedef struct zfs_cmd_v15 {
     	zinject_record_v15_t zc_inject_record;
     } zfs_cmd_v15_t;
     
    +typedef struct zinject_record_v28 {
    +	uint64_t	zi_objset;
    +	uint64_t	zi_object;
    +	uint64_t	zi_start;
    +	uint64_t	zi_end;
    +	uint64_t	zi_guid;
    +	uint32_t	zi_level;
    +	uint32_t	zi_error;
    +	uint64_t	zi_type;
    +	uint32_t	zi_freq;
    +	uint32_t	zi_failfast;
    +	char		zi_func[MAXNAMELEN];
    +	uint32_t	zi_iotype;
    +	int32_t		zi_duration;
    +	uint64_t	zi_timer;
    +} zinject_record_v28_t;
    +
    +typedef struct zfs_cmd_v28 {
    +	char		zc_name[MAXPATHLEN];
    +	char		zc_value[MAXPATHLEN * 2];
    +	char		zc_string[MAXNAMELEN];
    +	char		zc_top_ds[MAXPATHLEN];
    +	uint64_t	zc_guid;
    +	uint64_t	zc_nvlist_conf;		/* really (char *) */
    +	uint64_t	zc_nvlist_conf_size;
    +	uint64_t	zc_nvlist_src;		/* really (char *) */
    +	uint64_t	zc_nvlist_src_size;
    +	uint64_t	zc_nvlist_dst;		/* really (char *) */
    +	uint64_t	zc_nvlist_dst_size;
    +	uint64_t	zc_cookie;
    +	uint64_t	zc_objset_type;
    +	uint64_t	zc_perm_action;
    +	uint64_t 	zc_history;		/* really (char *) */
    +	uint64_t 	zc_history_len;
    +	uint64_t	zc_history_offset;
    +	uint64_t	zc_obj;
    +	uint64_t	zc_iflags;		/* internal to zfs(7fs) */
    +	zfs_share_t	zc_share;
    +	uint64_t	zc_jailid;
    +	dmu_objset_stats_t zc_objset_stats;
    +	struct drr_begin zc_begin_record;
    +	zinject_record_v28_t zc_inject_record;
    +	boolean_t	zc_defer_destroy;
    +	boolean_t	zc_temphold;
    +	uint64_t	zc_action_handle;
    +	int		zc_cleanup_fd;
    +	uint8_t		zc_simple;
    +	uint8_t		zc_pad[3];		/* alignment */
    +	uint64_t	zc_sendobj;
    +	uint64_t	zc_fromobj;
    +	uint64_t	zc_createtxg;
    +	zfs_stat_t	zc_stat;
    +} zfs_cmd_v28_t;
    +
     #ifdef _KERNEL
     unsigned static long zfs_ioctl_v15_to_v28[] = {
     	0,	/*  0 ZFS_IOC_POOL_CREATE */
    
    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	Fri Mar  1 09:40:02 2013	(r247539)
    +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Fri Mar  1 09:42:58 2013	(r247540)
    @@ -23,7 +23,7 @@
      * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
      * Copyright (c) 2011-2012 Pawel Jakub Dawidek .
      * All rights reserved.
    - * Portions Copyright 2011 Martin Matuska 
    + * Copyright 2013 Martin Matuska . All rights reserved.
      * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
      * Copyright (c) 2012 by Delphix. All rights reserved.
      * Copyright (c) 2012, Joyent, Inc. All rights reserved.
    @@ -5331,12 +5331,14 @@ zfsdev_ioctl(struct cdev *dev, u_long cm
     	len = IOCPARM_LEN(cmd);
     
     	/*
    -	 * Check if we have sufficient kernel memory allocated
    -	 * for the zfs_cmd_t request.  Bail out if not so we
    -	 * will not access undefined memory region.
    +	 * Check if we are talking to supported older binaries
    +	 * and translate zfs_cmd if necessary
     	 */
     	if (len < sizeof(zfs_cmd_t))
    -		if (len == sizeof(zfs_cmd_v15_t)) {
    +		if (len == sizeof(zfs_cmd_v28_t)) {
    +			cflag = ZFS_CMD_COMPAT_V28;
    +			vec = ZFS_IOC(cmd);
    +		} else if (len == sizeof(zfs_cmd_v15_t)) {
     			cflag = ZFS_CMD_COMPAT_V15;
     			vec = zfs_ioctl_v15_to_v28[ZFS_IOC(cmd)];
     		} else
    @@ -5351,6 +5353,11 @@ zfsdev_ioctl(struct cdev *dev, u_long cm
     			return (ENOTSUP);
     	}
     
    +	/*
    +	 * Check if we have sufficient kernel memory allocated
    +	 * for the zfs_cmd_t request.  Bail out if not so we
    +	 * will not access undefined memory region.
    +	 */
     	if (vec >= sizeof (zfs_ioc_vec) / sizeof (zfs_ioc_vec[0]))
     		return (EINVAL);
     
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 14:26:51 2013
    Return-Path: 
    Delivered-To: svn-src-head@FreeBSD.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id EFC8C6BC;
     Fri,  1 Mar 2013 14:26:50 +0000 (UTC) (envelope-from jilles@stack.nl)
    Received: from mx1.stack.nl (unknown [IPv6:2001:610:1108:5012::107])
     by mx1.freebsd.org (Postfix) with ESMTP id 9C811FC8;
     Fri,  1 Mar 2013 14:26:50 +0000 (UTC)
    Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131])
     by mx1.stack.nl (Postfix) with ESMTP id 28AD01203C4;
     Fri,  1 Mar 2013 15:26:34 +0100 (CET)
    Received: by snail.stack.nl (Postfix, from userid 1677)
     id 0A4DA2848C; Fri,  1 Mar 2013 15:26:34 +0100 (CET)
    Date: Fri, 1 Mar 2013 15:26:33 +0100
    From: Jilles Tjoelker 
    To: Peter Jeremy 
    Subject: Re: svn commit: r247274 - in head: bin/test tools/regression/bin/test
    Message-ID: <20130301142633.GA49921@stack.nl>
    References: <201302251905.r1PJ5fKF085179@svn.freebsd.org>
     <20130226000227.GA80718@stack.nl>
     <20130227082548.GF99210@server.rulingia.com>
    MIME-Version: 1.0
    Content-Type: text/plain; charset=iso-8859-1
    Content-Disposition: inline
    Content-Transfer-Encoding: 8bit
    In-Reply-To: <20130227082548.GF99210@server.rulingia.com>
    User-Agent: Mutt/1.5.21 (2010-09-15)
    Cc: grog@FreeBSD.org, svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
     src-committers@FreeBSD.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 14:26:51 -0000
    
    On Wed, Feb 27, 2013 at 07:25:48PM +1100, Peter Jeremy wrote:
    > On 2013-Feb-26 01:02:27 +0100, Jilles Tjoelker  wrote:
    > >>   Enhance test(1) by adding provision to compare any combination of the
    > >>   access, birth, change and modify times of two files, instead of only
    > >>   being able to compare modify times.  The builtin test in sh(1) will
    > >>   automagically acquire the same expansion.
    
    > >What do you need this for? If it is not needed very often, this test can
    > >be done more portably (older FreeBSD and GNU) as
    > >  [ -n "$(find -L FILE1 -prune -newerXY FILE2 2>/dev/null)" ]
    
    > In my case I needed to compare the ctime on one set of files with the
    > mtime in another set.  I had a think about using find(1) and gave it
    > away as too ugly.  That expression needs serious thought to understand
    > and about ½ the tokens in the find(1) are to handle special cases -
    > which is a further indication that it isn't ideal.
    
    Making everything ideal out of the box is not possible; it would bloat
    up things too much and make scripts harder to read. There are many
    possible extensions to avoid problems with special cases that would be
    useful more frequently, such as arrays, ${PARAM/WORD/REPLACEMENT},
    ${PARAM:START:LENGTH} and optional more useful signal handling.
    
    And I don't think this case is particularly bad. By defining the below
    function
    
    file_newer() {
    	test -n "$(find -L -- "$2" -prune -newer$1$3 "$4" 2>/dev/null)"
    }
    
    you can do things like  file_newer m file1 c file2  to compare file1's
    mtime to file2's ctime. The ugliness is isolated to the function
    definition.
    
    The birth time is designated by B instead of b. This is because find(1)
    wants B, and so does stat(1).
    
    Furthermore, it also allows  file_newer m file1 t '2 days ago'  to
    compare to a specified time; however, only the second time can be 't'.
    
    It is also possible to query file times using stat(1). This allows
    intuitive constructions like
      [ $(stat -f %m FILE1) -gt $(stat -f %c FILE2) ]
    lets you compare to things like  $(($(date +%s) - 86400))  and allows
    control whether symlinks should be followed. However, this may fork more
    often than the find(1)-based approach and hard-codes the limitation to
    seconds into the script unless you do something more complicated like
      [ $(stat -f %040.9Fm FILE1) \> $(stat -f %040.9Fc FILE2) ]
    The test(1) syntax will also be incorrect if the files do not exist.
    
    The find(1) and stat(1) approaches also work in other shells such as
    bash, ksh and zsh. An extension to test(1) can only be used by writing
    ugly things like /bin/test. Whatever you may think of it, people write
    scripts for those other shells and it is somewhat unfortunate that they
    cannot use all FreeBSD-specific features.
    
    > >I have generally been rather reluctant in adding things to sh(1) and
    > >even more so if they are completely new. Someone proposed something
    > >rather similar (except that it added a time string parser -- even more
    > >code) in PR bin/57054 and I rejected it in 2009.
    
    > Time parsing is a large can of worms - getting it right is messy (that
    > patch includes 1KLOC of new code and still isn't locale aware).  And
    > the work-around of touching a dummy file to the wanted age isn't too
    > horrrible.  This is a much smaller patch and there's no equally clean
    > work-around.
    
    I think my function definition is a clean enough workaround.
    
    I wouldn't mind having more such functions somewhere part of the base
    system, perhaps somewhat like rc.subr and dteske's bsdconfig scripts.
    There are some such functions in src/bin/sh/funcs/ but they are not
    installed.
    
    When I add things to sh, I usually include the new feature in a message
    to a mailing list like
    http://lists.freebsd.org/pipermail/freebsd-arch/2010-June/010353.html
    and
    http://lists.freebsd.org/pipermail/freebsd-arch/2011-December/011976.html
    first. Randomly adding features interferes with the design and the
    process.
    
    > >> +a=/tmp/test$$.1
    > >> +b=/tmp/test$$.2
    
    > >Please use mktemp(1). Using $$ for temporary files is insecure on
    > >multiuser systems.
    
    > In this case, I want filenames that don't exist.  I will look at using
    > mktemp(1) to create a temporary directory.
    
    That's what I usually do in sh testcases. The directory usually serves
    to contain temporary fifos. Fifos are both faster and more reliable to
    enforce ordering than sleeps.
    
    > >> +sleep 2    # Ensure $b is newer than $a
    > >> +touch $b
    
    > >Please use touch -t instead of sleeping. I'm impatient while running
    > >tests :)
    
    > In this case, I want all the timestamps on $b to be later than $a.  I
    > initially tried without the sleep but that failed with the builtin
    > test(1) because the FS timestamps weren't sufficiently granular to
    > report the difference.  I could create one of the files much earlier
    > during the test and then use a conditional test to only sleep if the
    > timestamps were indistinguishable (this probably needs to use the
    > above find(1) horror to avoid using test(1) to test itself).
    
    You can compare to a file somewhere else on the system.
    
    > I agree the other sleep(1)s should be able to be replaced with
    > touch(1) but I ran into problems with my initial efforts to do
    > everything using touch(1).  I will revisit it.
    
    The tests can still be used to test the above find(1)-based
    implementation. I have done this locally and it works.
    
    -- 
    Jilles Tjoelker
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 15:45:58 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 5F0AE1D0;
     Fri,  1 Mar 2013 15:45:58 +0000 (UTC)
     (envelope-from kevlo@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 50837642;
     Fri,  1 Mar 2013 15:45:58 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21FjwAC092516;
     Fri, 1 Mar 2013 15:45:58 GMT (envelope-from kevlo@svn.freebsd.org)
    Received: (from kevlo@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21FjwtH092514;
     Fri, 1 Mar 2013 15:45:58 GMT (envelope-from kevlo@svn.freebsd.org)
    Message-Id: <201303011545.r21FjwtH092514@svn.freebsd.org>
    From: Kevin Lo 
    Date: Fri, 1 Mar 2013 15:45:58 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247550 - head/lib/libc/rpc
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 15:45:58 -0000
    
    Author: kevlo
    Date: Fri Mar  1 15:45:57 2013
    New Revision: 247550
    URL: http://svnweb.freebsd.org/changeset/base/247550
    
    Log:
      Assign the len field of the netbuf structure to the current length of
      a sockaddr.
      
      Obtained from:	NetBSD
    
    Modified:
      head/lib/libc/rpc/clnt_vc.c
    
    Modified: head/lib/libc/rpc/clnt_vc.c
    ==============================================================================
    --- head/lib/libc/rpc/clnt_vc.c	Fri Mar  1 15:09:23 2013	(r247549)
    +++ head/lib/libc/rpc/clnt_vc.c	Fri Mar  1 15:45:57 2013	(r247550)
    @@ -260,7 +260,7 @@ clnt_vc_create(fd, raddr, prog, vers, se
     	if (ct->ct_addr.buf == NULL)
     		goto err;
     	memcpy(ct->ct_addr.buf, raddr->buf, raddr->len);
    -	ct->ct_addr.len = raddr->maxlen;
    +	ct->ct_addr.len = raddr->len;
     	ct->ct_addr.maxlen = raddr->maxlen;
     
     	/*
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 15:48:31 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id EB7E63B9;
     Fri,  1 Mar 2013 15:48:31 +0000 (UTC)
     (envelope-from kevlo@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id DD798681;
     Fri,  1 Mar 2013 15:48:31 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21FmV5X092922;
     Fri, 1 Mar 2013 15:48:31 GMT (envelope-from kevlo@svn.freebsd.org)
    Received: (from kevlo@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21FmVZ0092921;
     Fri, 1 Mar 2013 15:48:31 GMT (envelope-from kevlo@svn.freebsd.org)
    Message-Id: <201303011548.r21FmVZ0092921@svn.freebsd.org>
    From: Kevin Lo 
    Date: Fri, 1 Mar 2013 15:48:31 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247551 - head/sys/dev/tws
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 15:48:32 -0000
    
    Author: kevlo
    Date: Fri Mar  1 15:48:31 2013
    New Revision: 247551
    URL: http://svnweb.freebsd.org/changeset/base/247551
    
    Log:
      Fix typo.
    
    Modified:
      head/sys/dev/tws/tws_hdm.c
    
    Modified: head/sys/dev/tws/tws_hdm.c
    ==============================================================================
    --- head/sys/dev/tws/tws_hdm.c	Fri Mar  1 15:45:57 2013	(r247550)
    +++ head/sys/dev/tws/tws_hdm.c	Fri Mar  1 15:48:31 2013	(r247551)
    @@ -99,7 +99,7 @@ tws_init_ctlr(struct tws_softc *sc)
             regh = tws_read_reg(sc, TWS_I2O0_IOPOBQPH, 4);
             regl = tws_read_reg(sc, TWS_I2O0_IOPOBQPL, 4);
             reg = (((u_int64_t)regh) << 32) | regl;
    -        TWS_TRACE_DEBUG(sc, "host outbound clenup",reg, regl);
    +        TWS_TRACE_DEBUG(sc, "host outbound cleanup",reg, regl);
             if ( regh == TWS_FIFO_EMPTY32 )
                 break;
         } 
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 17:13:51 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id A72A556A;
     Fri,  1 Mar 2013 17:13:51 +0000 (UTC)
     (envelope-from utisoft@gmail.com)
    Received: from mail-ia0-x230.google.com (mail-ia0-x230.google.com
     [IPv6:2607:f8b0:4001:c02::230])
     by mx1.freebsd.org (Postfix) with ESMTP id 29381A73;
     Fri,  1 Mar 2013 17:13:51 +0000 (UTC)
    Received: by mail-ia0-f176.google.com with SMTP id i18so2829689iac.35
     for ; Fri, 01 Mar 2013 09:13:50 -0800 (PST)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
     h=mime-version:x-received:in-reply-to:references:date:message-id
     :subject:from:to:cc:content-type;
     bh=aGA73waN9C3Lsyks7sCp7WrreV7pL9j1hx1Q5bYRnNM=;
     b=PXsWtY5/taT2rj9Gr7FjtaSPNLAtJya0N8ULNRKuayza2S7gWxkslBb7YQsybcWVUj
     s8+ld7xad0jVL1vInN0kiL7mGfJkryITdjkqv9IYSghQy49cZd016kQpwOtetcyC2gFl
     VA/C5wiZ8+2eJy5v/M3M5txeDDBG+j/BJ54zFizsSHzbhfS7S8x6v7RMVyWlK2FObxkZ
     15s/SjnC05devr2T3rvGiQbw3kGJXLubqYAifQDlKDj8/bu2pNuOqvU7fcBc2y8QR3gY
     X0NyXucrWihgXjltzPFMoxV3WatEszA+wLPz4hXoMAf9C3NQtFXqbgHDZIvyg7dVYSjK
     fq+w==
    MIME-Version: 1.0
    X-Received: by 10.50.42.165 with SMTP id p5mr13594041igl.75.1362158025688;
     Fri, 01 Mar 2013 09:13:45 -0800 (PST)
    Received: by 10.64.63.12 with HTTP; Fri, 1 Mar 2013 09:13:45 -0800 (PST)
    Received: by 10.64.63.12 with HTTP; Fri, 1 Mar 2013 09:13:45 -0800 (PST)
    In-Reply-To: <20130301142633.GA49921@stack.nl>
    References: <201302251905.r1PJ5fKF085179@svn.freebsd.org>
     <20130226000227.GA80718@stack.nl>
     <20130227082548.GF99210@server.rulingia.com>
     <20130301142633.GA49921@stack.nl>
    Date: Fri, 1 Mar 2013 17:13:45 +0000
    Message-ID: 
    Subject: Re: svn commit: r247274 - in head: bin/test tools/regression/bin/test
    From: Chris Rees 
    To: Jilles Tjoelker 
    Content-Type: text/plain; charset=ISO-8859-1
    Content-Transfer-Encoding: quoted-printable
    X-Content-Filtered-By: Mailman/MimeDel 2.1.14
    Cc: svn-src-head@freebsd.org, grog@freebsd.org, svn-src-all@freebsd.org,
     src-committers@freebsd.org, Peter Jeremy 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 17:13:51 -0000
    
    On 1 Mar 2013 14:27, "Jilles Tjoelker"  wrote:
    >
    > On Wed, Feb 27, 2013 at 07:25:48PM +1100, Peter Jeremy wrote:
    > > On 2013-Feb-26 01:02:27 +0100, Jilles Tjoelker  wrote:
    > > >>   Enhance test(1) by adding provision to compare any combination of
    the
    > > >>   access, birth, change and modify times of two files, instead of
    only
    > > >>   being able to compare modify times.  The builtin test in sh(1) wil=
    l
    > > >>   automagically acquire the same expansion.
    >
    > > >What do you need this for? If it is not needed very often, this test
    can
    > > >be done more portably (older FreeBSD and GNU) as
    > > >  [ -n "$(find -L FILE1 -prune -newerXY FILE2 2>/dev/null)" ]
    >
    > > In my case I needed to compare the ctime on one set of files with the
    > > mtime in another set.  I had a think about using find(1) and gave it
    > > away as too ugly.  That expression needs serious thought to understand
    > > and about =BD the tokens in the find(1) are to handle special cases -
    > > which is a further indication that it isn't ideal.
    >
    > Making everything ideal out of the box is not possible; it would bloat
    > up things too much and make scripts harder to read. There are many
    > possible extensions to avoid problems with special cases that would be
    > useful more frequently, such as arrays, ${PARAM/WORD/REPLACEMENT},
    > ${PARAM:START:LENGTH} and optional more useful signal handling.
    >
    > And I don't think this case is particularly bad. By defining the below
    > function
    >
    > file_newer() {
    >         test -n "$(find -L -- "$2" -prune -newer$1$3 "$4" 2>/dev/null)"
    > }
    >
    > you can do things like  file_newer m file1 c file2  to compare file1's
    > mtime to file2's ctime. The ugliness is isolated to the function
    > definition.
    >
    > The birth time is designated by B instead of b. This is because find(1)
    > wants B, and so does stat(1).
    >
    > Furthermore, it also allows  file_newer m file1 t '2 days ago'  to
    > compare to a specified time; however, only the second time can be 't'.
    >
    > It is also possible to query file times using stat(1). This allows
    > intuitive constructions like
    >   [ $(stat -f %m FILE1) -gt $(stat -f %c FILE2) ]
    > lets you compare to things like  $(($(date +%s) - 86400))  and allows
    > control whether symlinks should be followed. However, this may fork more
    > often than the find(1)-based approach and hard-codes the limitation to
    > seconds into the script unless you do something more complicated like
    >   [ $(stat -f %040.9Fm FILE1) \> $(stat -f %040.9Fc FILE2) ]
    > The test(1) syntax will also be incorrect if the files do not exist.
    >
    > The find(1) and stat(1) approaches also work in other shells such as
    > bash, ksh and zsh. An extension to test(1) can only be used by writing
    > ugly things like /bin/test. Whatever you may think of it, people write
    > scripts for those other shells and it is somewhat unfortunate that they
    > cannot use all FreeBSD-specific features.
    
    +1
    
    While I'm aware that we have many very useful extensions to sh, we should
    not sacrifice portability.
    
    We (porters) are on thin ground when complaining at upstream for assuming
    /bin/sh is bash when we have extensions such as these.
    
    Chris
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 18:40:15 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 3EDA9DED;
     Fri,  1 Mar 2013 18:40:15 +0000 (UTC) (envelope-from kib@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 30486F2C;
     Fri,  1 Mar 2013 18:40:15 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21IeFYY046236;
     Fri, 1 Mar 2013 18:40:15 GMT (envelope-from kib@svn.freebsd.org)
    Received: (from kib@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21IeF27046235;
     Fri, 1 Mar 2013 18:40:15 GMT (envelope-from kib@svn.freebsd.org)
    Message-Id: <201303011840.r21IeF27046235@svn.freebsd.org>
    From: Konstantin Belousov 
    Date: Fri, 1 Mar 2013 18:40:15 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247560 - head/sys/kern
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 18:40:15 -0000
    
    Author: kib
    Date: Fri Mar  1 18:40:14 2013
    New Revision: 247560
    URL: http://svnweb.freebsd.org/changeset/base/247560
    
    Log:
      Make the default implementation of the VOP_VPTOCNP() fail if the
      directory entry, matched by the inode number, is ".".
      
      NFSv4 client might instantiate the distinct vnodes which have the same
      inode number, since single v4 export can be combined from several
      filesystems on the server.  For instance, a case when the nested
      server mount point is exactly one directory below the top of the
      export, causes directory and its parent to have the same inode number
      2.  The vop_stdvptocnp() algorithm then returns "." as the name of the
      lower directory.
      
      Filtering out the "." entry with ENOENT works around this behaviour,
      the error forces getcwd(3) to fall back to usermode implementation,
      which compares both st_dev and st_ino.
      
      Based on the submission by:	rmacklem
      Tested by:	rmacklem
      MFC after:	1 week
    
    Modified:
      head/sys/kern/vfs_default.c
    
    Modified: head/sys/kern/vfs_default.c
    ==============================================================================
    --- head/sys/kern/vfs_default.c	Fri Mar  1 18:39:55 2013	(r247559)
    +++ head/sys/kern/vfs_default.c	Fri Mar  1 18:40:14 2013	(r247560)
    @@ -856,8 +856,12 @@ vop_stdvptocnp(struct vop_vptocnp_args *
     				error = ENOMEM;
     				goto out;
     			}
    -			bcopy(dp->d_name, buf + i, dp->d_namlen);
    -			error = 0;
    +			if (dp->d_namlen == 1 && dp->d_name[0] == '.') {
    +				error = ENOENT;
    +			} else {
    +				bcopy(dp->d_name, buf + i, dp->d_namlen);
    +				error = 0;
    +			}
     			goto out;
     		}
     	} while (len > 0 || !eofflag);
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 18:49:14 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id EEDFA127;
     Fri,  1 Mar 2013 18:49:14 +0000 (UTC)
     (envelope-from marius@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id E19EBF67;
     Fri,  1 Mar 2013 18:49:14 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21InEFl047655;
     Fri, 1 Mar 2013 18:49:14 GMT (envelope-from marius@svn.freebsd.org)
    Received: (from marius@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21InEL3047654;
     Fri, 1 Mar 2013 18:49:14 GMT (envelope-from marius@svn.freebsd.org)
    Message-Id: <201303011849.r21InEL3047654@svn.freebsd.org>
    From: Marius Strobl 
    Date: Fri, 1 Mar 2013 18:49:14 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247561 - head/sys/kern
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 18:49:15 -0000
    
    Author: marius
    Date: Fri Mar  1 18:49:14 2013
    New Revision: 247561
    URL: http://svnweb.freebsd.org/changeset/base/247561
    
    Log:
      - Use strdup(9) instead of reimplementing it.
      - Use __DECONST instead of strange casts.
      - Reduce code duplication and simplify name2oid().
      
      PR:		176373
      Submitted by:	Christoph Mallon
      MFC after:	1 week
    
    Modified:
      head/sys/kern/kern_sysctl.c
    
    Modified: head/sys/kern/kern_sysctl.c
    ==============================================================================
    --- head/sys/kern/kern_sysctl.c	Fri Mar  1 18:40:14 2013	(r247560)
    +++ head/sys/kern/kern_sysctl.c	Fri Mar  1 18:49:14 2013	(r247561)
    @@ -444,9 +444,9 @@ sysctl_remove_oid_locked(struct sysctl_o
     				SYSCTL_SLEEP(&oidp->oid_running, "oidrm", 0);
     			}
     			if (oidp->oid_descr)
    -				free((void *)(uintptr_t)(const void *)oidp->oid_descr, M_SYSCTLOID);
    -			free((void *)(uintptr_t)(const void *)oidp->oid_name,
    -			     M_SYSCTLOID);
    +				free(__DECONST(char *, oidp->oid_descr),
    +				    M_SYSCTLOID);
    +			free(__DECONST(char *, oidp->oid_name), M_SYSCTLOID);
     			free(oidp, M_SYSCTLOID);
     		}
     	}
    @@ -462,8 +462,6 @@ sysctl_add_oid(struct sysctl_ctx_list *c
     	int (*handler)(SYSCTL_HANDLER_ARGS), const char *fmt, const char *descr)
     {
     	struct sysctl_oid *oidp;
    -	ssize_t len;
    -	char *newname;
     
     	/* You have to hook up somewhere.. */
     	if (parent == NULL)
    @@ -490,11 +488,7 @@ sysctl_add_oid(struct sysctl_ctx_list *c
     	SLIST_NEXT(oidp, oid_link) = NULL;
     	oidp->oid_number = number;
     	oidp->oid_refcnt = 1;
    -	len = strlen(name);
    -	newname = malloc(len + 1, M_SYSCTLOID, M_WAITOK);
    -	bcopy(name, newname, len + 1);
    -	newname[len] = '\0';
    -	oidp->oid_name = newname;
    +	oidp->oid_name = strdup(name, M_SYSCTLOID);
     	oidp->oid_handler = handler;
     	oidp->oid_kind = CTLFLAG_DYN | kind;
     	if ((kind & CTLTYPE) == CTLTYPE_NODE) {
    @@ -508,12 +502,8 @@ sysctl_add_oid(struct sysctl_ctx_list *c
     		oidp->oid_arg2 = arg2;
     	}
     	oidp->oid_fmt = fmt;
    -	if (descr) {
    -		int len = strlen(descr) + 1;
    -		oidp->oid_descr = malloc(len, M_SYSCTLOID, M_WAITOK);
    -		if (oidp->oid_descr)
    -			strcpy((char *)(uintptr_t)(const void *)oidp->oid_descr, descr);
    -	}
    +	if (descr)
    +		oidp->oid_descr = strdup(descr, M_SYSCTLOID);
     	/* Update the context, if used */
     	if (clist != NULL)
     		sysctl_ctx_entry_add(clist, oidp);
    @@ -529,16 +519,12 @@ sysctl_add_oid(struct sysctl_ctx_list *c
     void
     sysctl_rename_oid(struct sysctl_oid *oidp, const char *name)
     {
    -	ssize_t len;
     	char *newname;
    -	void *oldname;
    +	char *oldname;
     
    -	len = strlen(name);
    -	newname = malloc(len + 1, M_SYSCTLOID, M_WAITOK);
    -	bcopy(name, newname, len + 1);
    -	newname[len] = '\0';
    +	newname = strdup(name, M_SYSCTLOID);
     	SYSCTL_XLOCK();
    -	oldname = (void *)(uintptr_t)(const void *)oidp->oid_name;
    +	oldname = __DECONST(char *, oidp->oid_name);
     	oidp->oid_name = newname;
     	SYSCTL_XUNLOCK();
     	free(oldname, M_SYSCTLOID);
    @@ -823,39 +809,26 @@ static SYSCTL_NODE(_sysctl, 2, next, CTL
     static int
     name2oid(char *name, int *oid, int *len, struct sysctl_oid **oidpp)
     {
    -	int i;
     	struct sysctl_oid *oidp;
     	struct sysctl_oid_list *lsp = &sysctl__children;
     	char *p;
     
     	SYSCTL_ASSERT_XLOCKED();
     
    -	if (!*name)
    -		return (ENOENT);
    +	for (*len = 0; *len < CTL_MAXNAME;) {
    +		p = strsep(&name, ".");
     
    -	p = name + strlen(name) - 1 ;
    -	if (*p == '.')
    -		*p = '\0';
    -
    -	*len = 0;
    -
    -	for (p = name; *p && *p != '.'; p++) 
    -		;
    -	i = *p;
    -	if (i == '.')
    -		*p = '\0';
    -
    -	oidp = SLIST_FIRST(lsp);
    -
    -	while (oidp && *len < CTL_MAXNAME) {
    -		if (strcmp(name, oidp->oid_name)) {
    -			oidp = SLIST_NEXT(oidp, oid_link);
    -			continue;
    +		oidp = SLIST_FIRST(lsp);
    +		for (;; oidp = SLIST_NEXT(oidp, oid_link)) {
    +			if (oidp == NULL)
    +				return (ENOENT);
    +			if (strcmp(p, oidp->oid_name) == 0)
    +				break;
     		}
     		*oid++ = oidp->oid_number;
     		(*len)++;
     
    -		if (!i) {
    +		if (name == NULL || *name == '\0') {
     			if (oidpp)
     				*oidpp = oidp;
     			return (0);
    @@ -868,13 +841,6 @@ name2oid(char *name, int *oid, int *len,
     			break;
     
     		lsp = SYSCTL_CHILDREN(oidp);
    -		oidp = SLIST_FIRST(lsp);
    -		name = p+1;
    -		for (p = name; *p && *p != '.'; p++) 
    -				;
    -		i = *p;
    -		if (i == '.')
    -			*p = '\0';
     	}
     	return (ENOENT);
     }
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 19:02:43 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id B64B399D;
     Fri,  1 Mar 2013 19:02:43 +0000 (UTC) (envelope-from alc@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 9D121102F;
     Fri,  1 Mar 2013 19:02:43 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21J2hji052968;
     Fri, 1 Mar 2013 19:02:43 GMT (envelope-from alc@svn.freebsd.org)
    Received: (from alc@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21J2gDC052959;
     Fri, 1 Mar 2013 19:02:42 GMT (envelope-from alc@svn.freebsd.org)
    Message-Id: <201303011902.r21J2gDC052959@svn.freebsd.org>
    From: Alan Cox 
    Date: Fri, 1 Mar 2013 19:02:42 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247564 - in head/sys/arm: econa s3c2xx0 xscale/i80321
     xscale/i8134x xscale/ixp425 xscale/pxa
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 19:02:43 -0000
    
    Author: alc
    Date: Fri Mar  1 19:02:41 2013
    New Revision: 247564
    URL: http://svnweb.freebsd.org/changeset/base/247564
    
    Log:
      Eliminate a redundant #include: machine/pmap.h is already included
      through vm/pmap.h.
    
    Modified:
      head/sys/arm/econa/econa_machdep.c
      head/sys/arm/s3c2xx0/s3c24x0_machdep.c
      head/sys/arm/xscale/i80321/ep80219_machdep.c
      head/sys/arm/xscale/i80321/iq31244_machdep.c
      head/sys/arm/xscale/i8134x/crb_machdep.c
      head/sys/arm/xscale/ixp425/avila_machdep.c
      head/sys/arm/xscale/pxa/pxa_machdep.c
    
    Modified: head/sys/arm/econa/econa_machdep.c
    ==============================================================================
    --- head/sys/arm/econa/econa_machdep.c	Fri Mar  1 19:01:52 2013	(r247563)
    +++ head/sys/arm/econa/econa_machdep.c	Fri Mar  1 19:02:41 2013	(r247564)
    @@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    Modified: head/sys/arm/s3c2xx0/s3c24x0_machdep.c
    ==============================================================================
    --- head/sys/arm/s3c2xx0/s3c24x0_machdep.c	Fri Mar  1 19:01:52 2013	(r247563)
    +++ head/sys/arm/s3c2xx0/s3c24x0_machdep.c	Fri Mar  1 19:02:41 2013	(r247564)
    @@ -78,7 +78,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c
    ==============================================================================
    --- head/sys/arm/xscale/i80321/ep80219_machdep.c	Fri Mar  1 19:01:52 2013	(r247563)
    +++ head/sys/arm/xscale/i80321/ep80219_machdep.c	Fri Mar  1 19:02:41 2013	(r247564)
    @@ -78,7 +78,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    Modified: head/sys/arm/xscale/i80321/iq31244_machdep.c
    ==============================================================================
    --- head/sys/arm/xscale/i80321/iq31244_machdep.c	Fri Mar  1 19:01:52 2013	(r247563)
    +++ head/sys/arm/xscale/i80321/iq31244_machdep.c	Fri Mar  1 19:02:41 2013	(r247564)
    @@ -78,7 +78,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    Modified: head/sys/arm/xscale/i8134x/crb_machdep.c
    ==============================================================================
    --- head/sys/arm/xscale/i8134x/crb_machdep.c	Fri Mar  1 19:01:52 2013	(r247563)
    +++ head/sys/arm/xscale/i8134x/crb_machdep.c	Fri Mar  1 19:02:41 2013	(r247564)
    @@ -78,7 +78,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    Modified: head/sys/arm/xscale/ixp425/avila_machdep.c
    ==============================================================================
    --- head/sys/arm/xscale/ixp425/avila_machdep.c	Fri Mar  1 19:01:52 2013	(r247563)
    +++ head/sys/arm/xscale/ixp425/avila_machdep.c	Fri Mar  1 19:02:41 2013	(r247564)
    @@ -78,7 +78,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    Modified: head/sys/arm/xscale/pxa/pxa_machdep.c
    ==============================================================================
    --- head/sys/arm/xscale/pxa/pxa_machdep.c	Fri Mar  1 19:01:52 2013	(r247563)
    +++ head/sys/arm/xscale/pxa/pxa_machdep.c	Fri Mar  1 19:02:41 2013	(r247564)
    @@ -80,7 +80,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    -#include 
     #include 
     #include 
     #include 
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 19:12:39 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id C235ED4E;
     Fri,  1 Mar 2013 19:12:39 +0000 (UTC)
     (envelope-from marius@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id AF0B11094;
     Fri,  1 Mar 2013 19:12:39 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21JCd3A056479;
     Fri, 1 Mar 2013 19:12:39 GMT (envelope-from marius@svn.freebsd.org)
    Received: (from marius@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21JCdRw056476;
     Fri, 1 Mar 2013 19:12:39 GMT (envelope-from marius@svn.freebsd.org)
    Message-Id: <201303011912.r21JCdRw056476@svn.freebsd.org>
    From: Marius Strobl 
    Date: Fri, 1 Mar 2013 19:12:38 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247565 - head/sys/dev/bce
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 19:12:39 -0000
    
    Author: marius
    Date: Fri Mar  1 19:12:38 2013
    New Revision: 247565
    URL: http://svnweb.freebsd.org/changeset/base/247565
    
    Log:
      - Make tables, device ID strings etc const.
      - Use NULL instead of 0 for pointers.
      - Remove redundant bzero(9)'ing of the softc.
      - Remove redundant/unused softc members.
      - Don't allocate MSI/MSI-X as RF_SHAREABLE.
      - Re-use bus accessor macros instead of duplicating them.
      - In bce_miibus_{read,write}_reg(), remove superfluous limiting of the PHY
        address (missed in r213893).
      
      MFC after:	1 week
    
    Modified:
      head/sys/dev/bce/if_bce.c
      head/sys/dev/bce/if_bcereg.h
    
    Modified: head/sys/dev/bce/if_bce.c
    ==============================================================================
    --- head/sys/dev/bce/if_bce.c	Fri Mar  1 19:02:41 2013	(r247564)
    +++ head/sys/dev/bce/if_bce.c	Fri Mar  1 19:12:38 2013	(r247565)
    @@ -95,7 +95,7 @@ __FBSDID("$FreeBSD$");
     /****************************************************************************/
     #define BCE_DEVDESC_MAX		64
     
    -static struct bce_type bce_devs[] = {
    +static const struct bce_type bce_devs[] = {
     	/* BCM5706C Controllers and OEM boards. */
     	{ BRCM_VENDORID, BRCM_DEVICEID_BCM5706,  HP_VENDORID, 0x3101,
     		"HP NC370T Multifunction Gigabit Server Adapter" },
    @@ -161,7 +161,7 @@ static struct bce_type bce_devs[] = {
     /****************************************************************************/
     /* Supported Flash NVRAM device data.                                       */
     /****************************************************************************/
    -static struct flash_spec flash_table[] =
    +static const struct flash_spec flash_table[] =
     {
     #define BUFFERED_FLAGS		(BCE_NV_BUFFERED | BCE_NV_TRANSLATE)
     #define NONBUFFERED_FLAGS	(BCE_NV_WREN)
    @@ -258,7 +258,7 @@ static struct flash_spec flash_table[] =
      * logical-to-physical mapping is required in the
      * driver.
      */
    -static struct flash_spec flash_5709 = {
    +static const struct flash_spec flash_5709 = {
     	.flags		= BCE_NV_BUFFERED,
     	.page_bits	= BCM5709_FLASH_PAGE_BITS,
     	.page_size	= BCM5709_FLASH_PAGE_SIZE,
    @@ -481,8 +481,8 @@ MODULE_DEPEND(bce, pci, 1, 1, 1);
     MODULE_DEPEND(bce, ether, 1, 1, 1);
     MODULE_DEPEND(bce, miibus, 1, 1, 1);
     
    -DRIVER_MODULE(bce, pci, bce_driver, bce_devclass, 0, 0);
    -DRIVER_MODULE(miibus, bce, miibus_driver, miibus_devclass, 0, 0);
    +DRIVER_MODULE(bce, pci, bce_driver, bce_devclass, NULL, NULL);
    +DRIVER_MODULE(miibus, bce, miibus_driver, miibus_devclass, NULL, NULL);
     
     
     /****************************************************************************/
    @@ -647,7 +647,7 @@ SYSCTL_UINT(_hw_bce, OID_AUTO, rx_ticks,
     static int
     bce_probe(device_t dev)
     {
    -	struct bce_type *t;
    +	const struct bce_type *t;
     	struct bce_softc *sc;
     	char *descbuf;
     	u16 vid = 0, did = 0, svid = 0, sdid = 0;
    @@ -655,7 +655,6 @@ bce_probe(device_t dev)
     	t = bce_devs;
     
     	sc = device_get_softc(dev);
    -	bzero(sc, sizeof(struct bce_softc));
     	sc->bce_unit = device_get_unit(dev);
     	sc->bce_dev = dev;
     
    @@ -1040,7 +1039,7 @@ bce_attach(device_t dev)
     	struct bce_softc *sc;
     	struct ifnet *ifp;
     	u32 val;
    -	int error, rid, rc = 0;
    +	int count, error, rc = 0, rid;
     
     	sc = device_get_softc(dev);
     	sc->bce_dev = dev;
    @@ -1084,14 +1083,14 @@ bce_attach(device_t dev)
     		((sc->bce_res_irq = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
     		&rid, RF_ACTIVE)) != NULL)) {
     
    -		msi_needed = sc->bce_msi_count = 1;
    +		msi_needed = count = 1;
     
    -		if (((error = pci_alloc_msix(dev, &sc->bce_msi_count)) != 0) ||
    -			(sc->bce_msi_count != msi_needed)) {
    +		if (((error = pci_alloc_msix(dev, &count)) != 0) ||
    +			(count != msi_needed)) {
     			BCE_PRINTF("%s(%d): MSI-X allocation failed! Requested = %d,"
     				"Received = %d, error = %d\n", __FILE__, __LINE__,
    -				msi_needed, sc->bce_msi_count, error);
    -			sc->bce_msi_count = 0;
    +				msi_needed, count, error);
    +			count = 0;
     			pci_release_msi(dev);
     			bus_release_resource(dev, SYS_RES_MEMORY, rid,
     				sc->bce_res_irq);
    @@ -1100,19 +1099,18 @@ bce_attach(device_t dev)
     			DBPRINT(sc, BCE_INFO_LOAD, "%s(): Using MSI-X interrupt.\n",
     				__FUNCTION__);
     			sc->bce_flags |= BCE_USING_MSIX_FLAG;
    -			sc->bce_intr = bce_intr;
     		}
     	}
     #endif
     
     	/* Try allocating a MSI interrupt. */
     	if ((sc->bce_cap_flags & BCE_MSI_CAPABLE_FLAG) &&
    -		(bce_msi_enable >= 1) && (sc->bce_msi_count == 0)) {
    -		sc->bce_msi_count = 1;
    -		if ((error = pci_alloc_msi(dev, &sc->bce_msi_count)) != 0) {
    +		(bce_msi_enable >= 1) && (count == 0)) {
    +		count = 1;
    +		if ((error = pci_alloc_msi(dev, &count)) != 0) {
     			BCE_PRINTF("%s(%d): MSI allocation failed! "
     			    "error = %d\n", __FILE__, __LINE__, error);
    -			sc->bce_msi_count = 0;
    +			count = 0;
     			pci_release_msi(dev);
     		} else {
     			DBPRINT(sc, BCE_INFO_LOAD, "%s(): Using MSI "
    @@ -1120,23 +1118,19 @@ bce_attach(device_t dev)
     			sc->bce_flags |= BCE_USING_MSI_FLAG;
     			if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709)
     				sc->bce_flags |= BCE_ONE_SHOT_MSI_FLAG;
    -			sc->bce_irq_rid = 1;
    -			sc->bce_intr = bce_intr;
    +			rid = 1;
     		}
     	}
     
     	/* Try allocating a legacy interrupt. */
    -	if (sc->bce_msi_count == 0) {
    +	if (count == 0) {
     		DBPRINT(sc, BCE_INFO_LOAD, "%s(): Using INTx interrupt.\n",
     			__FUNCTION__);
     		rid = 0;
    -		sc->bce_intr = bce_intr;
     	}
     
     	sc->bce_res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ,
    -	    &rid, RF_SHAREABLE | RF_ACTIVE);
    -
    -	sc->bce_irq_rid = rid;
    +	    &rid, RF_ACTIVE | (count != 0 ? 0 : RF_SHAREABLE));
     
     	/* Report any IRQ allocation errors. */
     	if (sc->bce_res_irq == NULL) {
    @@ -1635,7 +1629,7 @@ bce_shutdown(device_t dev)
     static u32
     bce_reg_rd(struct bce_softc *sc, u32 offset)
     {
    -	u32 val = bus_space_read_4(sc->bce_btag, sc->bce_bhandle, offset);
    +	u32 val = REG_RD(sc, offset);
     	DBPRINT(sc, BCE_INSANE_REG, "%s(); offset = 0x%08X, val = 0x%08X\n",
     		__FUNCTION__, offset, val);
     	return val;
    @@ -1653,7 +1647,7 @@ bce_reg_wr16(struct bce_softc *sc, u32 o
     {
     	DBPRINT(sc, BCE_INSANE_REG, "%s(); offset = 0x%08X, val = 0x%04X\n",
     		__FUNCTION__, offset, val);
    -	bus_space_write_2(sc->bce_btag, sc->bce_bhandle, offset, val);
    +	REG_WR16(sc, offset, val);
     }
     
     
    @@ -1668,7 +1662,7 @@ bce_reg_wr(struct bce_softc *sc, u32 off
     {
     	DBPRINT(sc, BCE_INSANE_REG, "%s(); offset = 0x%08X, val = 0x%08X\n",
     		__FUNCTION__, offset, val);
    -	bus_space_write_4(sc->bce_btag, sc->bce_bhandle, offset, val);
    +	REG_WR(sc, offset, val);
     }
     #endif
     
    @@ -1879,13 +1873,6 @@ bce_miibus_read_reg(device_t dev, int ph
     
     	sc = device_get_softc(dev);
     
    -	/* Make sure we are accessing the correct PHY address. */
    -	if (phy != sc->bce_phy_addr) {
    -		DBPRINT(sc, BCE_INSANE_PHY, "Invalid PHY address %d "
    -		    "for PHY read!\n", phy);
    -		return(0);
    -	}
    -
         /*
          * The 5709S PHY is an IEEE Clause 45 PHY
          * with special mappings to work with IEEE
    @@ -1968,13 +1955,6 @@ bce_miibus_write_reg(device_t dev, int p
     
     	sc = device_get_softc(dev);
     
    -	/* Make sure we are accessing the correct PHY address. */
    -	if (phy != sc->bce_phy_addr) {
    -		DBPRINT(sc, BCE_INSANE_PHY, "Invalid PHY address %d "
    -		    "for PHY write!\n", phy);
    -		return(0);
    -	}
    -
     	DB_PRINT_PHY_REG(reg, val);
     
     	/*
    @@ -2535,7 +2515,7 @@ bce_init_nvram(struct bce_softc *sc)
     {
     	u32 val;
     	int j, entry_count, rc = 0;
    -	struct flash_spec *flash;
    +	const struct flash_spec *flash;
     
     	DBENTER(BCE_VERBOSE_NVRAM);
     
    @@ -3949,8 +3929,8 @@ bce_release_resources(struct bce_softc *
     
     	if (sc->bce_res_irq != NULL) {
     		DBPRINT(sc, BCE_INFO_RESET, "Releasing IRQ.\n");
    -		bus_release_resource(dev, SYS_RES_IRQ, sc->bce_irq_rid,
    -		    sc->bce_res_irq);
    +		bus_release_resource(dev, SYS_RES_IRQ,
    +		    rman_get_rid(sc->bce_res_irq), sc->bce_res_irq);
     	}
     
     	if (sc->bce_flags & (BCE_USING_MSI_FLAG | BCE_USING_MSIX_FLAG)) {
    @@ -11650,4 +11630,3 @@ bce_breakpoint(struct bce_softc *sc)
     	return;
     }
     #endif
    -
    
    Modified: head/sys/dev/bce/if_bcereg.h
    ==============================================================================
    --- head/sys/dev/bce/if_bcereg.h	Fri Mar  1 19:02:41 2013	(r247564)
    +++ head/sys/dev/bce/if_bcereg.h	Fri Mar  1 19:12:38 2013	(r247565)
    @@ -622,7 +622,7 @@ struct bce_type {
     	u_int16_t bce_did;
     	u_int16_t bce_svid;
     	u_int16_t bce_sdid;
    -	char      *bce_name;
    +	const char *bce_name;
     };
     
     /****************************************************************************/
    @@ -716,7 +716,7 @@ struct flash_spec {
     	u32 page_size;
     	u32 addr_mask;
     	u32 total_size;
    -	u8  *name;
    +	const u8 *name;
     };
     
     
    @@ -2001,7 +2001,7 @@ struct l2_fhdr {
     #define BCE_MISC_ENABLE_CLR_BITS_UMP_ENABLE				(1L<<27)
     #define BCE_MISC_ENABLE_CLR_BITS_RV2P_CMD_SCHEDULER_ENABLE	(1L<<28)
     #define BCE_MISC_ENABLE_CLR_BITS_RSVD_FUTURE_ENABLE		(0x7L<<29)
    -
    +
     #define BCE_MISC_ENABLE_CLR_DEFAULT						0x17ffffff
     
     #define BCE_MISC_CLOCK_CONTROL_BITS			0x00000818
    @@ -6318,19 +6318,19 @@ struct fw_info {
     	u32 text_addr;
     	u32 text_len;
     	u32 text_index;
    -	u32 *text;
    +	const u32 *text;
     
     	/* Data section. */
     	u32 data_addr;
     	u32 data_len;
     	u32 data_index;
    -	u32 *data;
    +	const u32 *data;
     
     	/* SBSS section. */
     	u32 sbss_addr;
     	u32 sbss_len;
     	u32 sbss_index;
    -	u32 *sbss;
    +	const u32 *sbss;
     
     	/* BSS section. */
     	u32 bss_addr;
    @@ -6421,7 +6421,7 @@ struct fw_info {
     
     struct bce_softc
     {
    -	/* Interface info.  Must be first!! */
    +	/* Interface info */
     	struct ifnet		*bce_ifp;
     
     	/* Parent device handle */
    @@ -6451,10 +6451,7 @@ struct bce_softc
     	struct mtx		bce_mtx;
     
     	/* Interrupt handler. */
    -	driver_intr_t		*bce_intr;
     	void			*bce_intrhand;
    -	int			bce_irq_rid;
    -	int			bce_msi_count;
     
     	/* ASIC Chip ID. */
     	u32			bce_chipid;
    @@ -6509,7 +6506,7 @@ struct bce_softc
     	u16			link_speed;
     
     	/* Flash NVRAM settings */
    -	struct flash_spec	*bce_flash_info;
    +	const struct flash_spec	*bce_flash_info;
     
     	/* Flash NVRAM size */
     	u32			bce_flash_size;
    @@ -6518,7 +6515,7 @@ struct bce_softc
     	u32			bce_shmem_base;
     
     	/* Name string */
    -	char			*bce_name;
    +	const char		*bce_name;
     
     	/* Tracks the version of bootcode firmware. */
     	char			bce_bc_ver[32];
    @@ -6834,4 +6831,3 @@ struct bce_softc
     };
     
     #endif /* __BCEREG_H_DEFINED */
    -
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 19:55:12 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 25ECD2F9;
     Fri,  1 Mar 2013 19:55:12 +0000 (UTC)
     (envelope-from marius@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 07A0112DA;
     Fri,  1 Mar 2013 19:55:12 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21JtCff069129;
     Fri, 1 Mar 2013 19:55:12 GMT (envelope-from marius@svn.freebsd.org)
    Received: (from marius@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21JtAqn069123;
     Fri, 1 Mar 2013 19:55:10 GMT (envelope-from marius@svn.freebsd.org)
    Message-Id: <201303011955.r21JtAqn069123@svn.freebsd.org>
    From: Marius Strobl 
    Date: Fri, 1 Mar 2013 19:55:10 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247570 - head/sys/dev/aac
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 19:55:12 -0000
    
    Author: marius
    Date: Fri Mar  1 19:55:10 2013
    New Revision: 247570
    URL: http://svnweb.freebsd.org/changeset/base/247570
    
    Log:
      - Make tables, device ID strings etc const. This includes #ifdef'ing 0
        aac_command_status_table, which is actually unused since r111532.
        While at it, make aac_if a pointer to the now const interface tables
        instead of copying them over to the softc (this alone already reduces the
        size of aac.ko on amd64 by ~1 KiB).
      - Remove redundant softc members.
      - Use DEVMETHOD_END.
      - Use NULL instead of 0 for pointers.
      - Remove redundant bzero(9)'ing of the softc.
      - Use pci_enable_busmaster(9) instead of duplicating it.
      - Remove redundant checking for PCIM_CMD_MEMEN (resource allocation will
        just fail).
      - Canonicalize the error messages in case of resource allocation failures.
      - Add support for using MSI instead of INTx, controllable via the tunable
        hw.aac.enable_msi (defaulting to on).
      
      MFC after:	1 month
    
    Modified:
      head/sys/dev/aac/aac.c
      head/sys/dev/aac/aac_cam.c
      head/sys/dev/aac/aac_disk.c
      head/sys/dev/aac/aac_pci.c
      head/sys/dev/aac/aac_tables.h
      head/sys/dev/aac/aacvar.h
    
    Modified: head/sys/dev/aac/aac.c
    ==============================================================================
    --- head/sys/dev/aac/aac.c	Fri Mar  1 19:54:25 2013	(r247569)
    +++ head/sys/dev/aac/aac.c	Fri Mar  1 19:55:10 2013	(r247570)
    @@ -117,7 +117,7 @@ static void	aac_sa_set_mailbox(struct aa
     static int	aac_sa_get_mailbox(struct aac_softc *sc, int mb);
     static void	aac_sa_set_interrupts(struct aac_softc *sc, int enable);
     
    -struct aac_interface aac_sa_interface = {
    +const struct aac_interface aac_sa_interface = {
     	aac_sa_get_fwstatus,
     	aac_sa_qnotify,
     	aac_sa_get_istatus,
    @@ -142,7 +142,7 @@ static int aac_rx_send_command(struct aa
     static int aac_rx_get_outb_queue(struct aac_softc *sc);
     static void aac_rx_set_outb_queue(struct aac_softc *sc, int index);
     
    -struct aac_interface aac_rx_interface = {
    +const struct aac_interface aac_rx_interface = {
     	aac_rx_get_fwstatus,
     	aac_rx_qnotify,
     	aac_rx_get_istatus,
    @@ -169,7 +169,7 @@ static int aac_rkt_send_command(struct a
     static int aac_rkt_get_outb_queue(struct aac_softc *sc);
     static void aac_rkt_set_outb_queue(struct aac_softc *sc, int index);
     
    -struct aac_interface aac_rkt_interface = {
    +const struct aac_interface aac_rkt_interface = {
     	aac_rkt_get_fwstatus,
     	aac_rkt_qnotify,
     	aac_rkt_get_istatus,
    @@ -183,8 +183,8 @@ struct aac_interface aac_rkt_interface =
     };
     
     /* Debugging and Diagnostics */
    -static void	aac_describe_controller(struct aac_softc *sc);
    -static char	*aac_describe_code(struct aac_code_lookup *table,
    +static void		aac_describe_controller(struct aac_softc *sc);
    +static const char	*aac_describe_code(const struct aac_code_lookup *table,
     				   u_int32_t code);
     
     /* Management Interface */
    @@ -222,7 +222,7 @@ static struct cdevsw aac_cdevsw = {
     static MALLOC_DEFINE(M_AACBUF, "aacbuf", "Buffers for the AAC driver");
     
     /* sysctl node */
    -static SYSCTL_NODE(_hw, OID_AUTO, aac, CTLFLAG_RD, 0, "AAC driver parameters");
    +SYSCTL_NODE(_hw, OID_AUTO, aac, CTLFLAG_RD, 0, "AAC driver parameters");
     
     /*
      * Device Interface
    @@ -634,8 +634,8 @@ aac_free(struct aac_softc *sc)
     	if (sc->aac_intr)
     		bus_teardown_intr(sc->aac_dev, sc->aac_irq, sc->aac_intr);
     	if (sc->aac_irq != NULL)
    -		bus_release_resource(sc->aac_dev, SYS_RES_IRQ, sc->aac_irq_rid,
    -				     sc->aac_irq);
    +		bus_release_resource(sc->aac_dev, SYS_RES_IRQ,
    +		    rman_get_rid(sc->aac_irq), sc->aac_irq);
     
     	/* destroy data-transfer DMA tag */
     	if (sc->aac_buffer_dmat)
    @@ -648,10 +648,10 @@ aac_free(struct aac_softc *sc)
     	/* release the register window mapping */
     	if (sc->aac_regs_res0 != NULL)
     		bus_release_resource(sc->aac_dev, SYS_RES_MEMORY,
    -				     sc->aac_regs_rid0, sc->aac_regs_res0);
    +		    rman_get_rid(sc->aac_regs_res0), sc->aac_regs_res0);
     	if (sc->aac_hwif == AAC_HWIF_NARK && sc->aac_regs_res1 != NULL)
     		bus_release_resource(sc->aac_dev, SYS_RES_MEMORY,
    -				     sc->aac_regs_rid1, sc->aac_regs_res1);
    +		    rman_get_rid(sc->aac_regs_res1), sc->aac_regs_res1);
     }
     
     /*
    @@ -1333,9 +1333,6 @@ aac_bio_complete(struct aac_command *cm)
     	} else {
     		bp->bio_error = EIO;
     		bp->bio_flags |= BIO_ERROR;
    -		/* pass an error string out to the disk layer */
    -		bp->bio_driver1 = aac_describe_code(aac_command_status_table,
    -						    status);
     	}
     	aac_biodone(bp);
     }
    @@ -1687,7 +1684,7 @@ static int
     aac_check_firmware(struct aac_softc *sc)
     {
     	u_int32_t code, major, minor, options = 0, atu_size = 0;
    -	int status;
    +	int rid, status;
     	time_t then;
     
     	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
    @@ -1765,7 +1762,7 @@ aac_check_firmware(struct aac_softc *sc)
     			sc->flags |= AAC_FLAGS_SG_64BIT;
     		}
     		if ((options & AAC_SUPPORTED_NEW_COMM)
    -		 && sc->aac_if.aif_send_command)
    +		 && sc->aac_if->aif_send_command)
     			sc->flags |= AAC_FLAGS_NEW_COMM;
     		if (options & AAC_SUPPORTED_64BIT_ARRAYSIZE)
     			sc->flags |= AAC_FLAGS_ARRAY_64BIT;
    @@ -1776,17 +1773,15 @@ aac_check_firmware(struct aac_softc *sc)
     
     	/* Remap mem. resource, if required */
     	if ((sc->flags & AAC_FLAGS_NEW_COMM) &&
    -		atu_size > rman_get_size(sc->aac_regs_res1)) {
    -		bus_release_resource(
    -			sc->aac_dev, SYS_RES_MEMORY,
    -			sc->aac_regs_rid1, sc->aac_regs_res1);
    -		sc->aac_regs_res1 = bus_alloc_resource(
    -			sc->aac_dev, SYS_RES_MEMORY, &sc->aac_regs_rid1,
    -			0ul, ~0ul, atu_size, RF_ACTIVE);
    +	    atu_size > rman_get_size(sc->aac_regs_res1)) {
    +		rid = rman_get_rid(sc->aac_regs_res1);
    +		bus_release_resource(sc->aac_dev, SYS_RES_MEMORY, rid,
    +		    sc->aac_regs_res1);
    +		sc->aac_regs_res1 = bus_alloc_resource(sc->aac_dev,
    +		    SYS_RES_MEMORY, &rid, 0ul, ~0ul, atu_size, RF_ACTIVE);
     		if (sc->aac_regs_res1 == NULL) {
     			sc->aac_regs_res1 = bus_alloc_resource_any(
    -				sc->aac_dev, SYS_RES_MEMORY,
    -				&sc->aac_regs_rid1, RF_ACTIVE);
    +			    sc->aac_dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
     			if (sc->aac_regs_res1 == NULL) {
     				device_printf(sc->aac_dev,
     				    "couldn't allocate register window\n");
    @@ -1799,7 +1794,6 @@ aac_check_firmware(struct aac_softc *sc)
     
     		if (sc->aac_hwif == AAC_HWIF_NARK) {
     			sc->aac_regs_res0 = sc->aac_regs_res1;
    -			sc->aac_regs_rid0 = sc->aac_regs_rid1;
     			sc->aac_btag0 = sc->aac_btag1;
     			sc->aac_bhandle0 = sc->aac_bhandle1;
     		}
    @@ -2003,14 +1997,7 @@ out:
     static int
     aac_setup_intr(struct aac_softc *sc)
     {
    -	sc->aac_irq_rid = 0;
    -	if ((sc->aac_irq = bus_alloc_resource_any(sc->aac_dev, SYS_RES_IRQ,
    -			   			  &sc->aac_irq_rid,
    -			   			  RF_SHAREABLE |
    -						  RF_ACTIVE)) == NULL) {
    -		device_printf(sc->aac_dev, "can't allocate interrupt\n");
    -		return (EINVAL);
    -	}
    +
     	if (sc->flags & AAC_FLAGS_NEW_COMM) {
     		if (bus_setup_intr(sc->aac_dev, sc->aac_irq,
     				   INTR_MPSAFE|INTR_TYPE_BIO, NULL,
    @@ -2119,7 +2106,7 @@ aac_sync_fib(struct aac_softc *sc, u_int
      * Note that the queue implementation here is a little funky; neither the PI or
      * CI will ever be zero.  This behaviour is a controller feature.
      */
    -static struct {
    +static const struct {
     	int		size;
     	int		notify;
     } aac_qinfo[] = {
    @@ -2786,8 +2773,8 @@ aac_describe_controller(struct aac_softc
      * Look up a text description of a numeric error code and return a pointer to
      * same.
      */
    -static char *
    -aac_describe_code(struct aac_code_lookup *table, u_int32_t code)
    +static const char *
    +aac_describe_code(const struct aac_code_lookup *table, u_int32_t code)
     {
     	int i;
     
    
    Modified: head/sys/dev/aac/aac_cam.c
    ==============================================================================
    --- head/sys/dev/aac/aac_cam.c	Fri Mar  1 19:54:25 2013	(r247569)
    +++ head/sys/dev/aac/aac_cam.c	Fri Mar  1 19:55:10 2013	(r247570)
    @@ -92,7 +92,7 @@ static device_method_t	aac_pass_methods[
     	DEVMETHOD(device_probe,		aac_cam_probe),
     	DEVMETHOD(device_attach,	aac_cam_attach),
     	DEVMETHOD(device_detach,	aac_cam_detach),
    -	{ 0, 0 }
    +	DEVMETHOD_END
     };
     
     static driver_t	aac_pass_driver = {
    @@ -101,7 +101,7 @@ static driver_t	aac_pass_driver = {
     	sizeof(struct aac_cam)
     };
     
    -DRIVER_MODULE(aacp, aac, aac_pass_driver, aac_pass_devclass, 0, 0);
    +DRIVER_MODULE(aacp, aac, aac_pass_driver, aac_pass_devclass, NULL, NULL);
     MODULE_DEPEND(aacp, cam, 1, 1, 1);
     
     static MALLOC_DEFINE(M_AACCAM, "aaccam", "AAC CAM info");
    @@ -685,4 +685,3 @@ aac_cam_term_io(struct cam_sim *sim, uni
     {
     	return (CAM_UA_TERMIO);
     }
    -
    
    Modified: head/sys/dev/aac/aac_disk.c
    ==============================================================================
    --- head/sys/dev/aac/aac_disk.c	Fri Mar  1 19:54:25 2013	(r247569)
    +++ head/sys/dev/aac/aac_disk.c	Fri Mar  1 19:55:10 2013	(r247570)
    @@ -73,7 +73,7 @@ static device_method_t aac_disk_methods[
     	DEVMETHOD(device_probe,	aac_disk_probe),
     	DEVMETHOD(device_attach,	aac_disk_attach),
     	DEVMETHOD(device_detach,	aac_disk_detach),
    -	{ 0, 0 }
    +	DEVMETHOD_END
     };
     
     static driver_t aac_disk_driver = {
    @@ -82,7 +82,7 @@ static driver_t aac_disk_driver = {
     	sizeof(struct aac_disk)
     };
     
    -DRIVER_MODULE(aacd, aac, aac_disk_driver, aac_disk_devclass, 0, 0);
    +DRIVER_MODULE(aacd, aac, aac_disk_driver, aac_disk_devclass, NULL, NULL);
     
     /*
      * Handle open from generic layer.
    
    Modified: head/sys/dev/aac/aac_pci.c
    ==============================================================================
    --- head/sys/dev/aac/aac_pci.c	Fri Mar  1 19:54:25 2013	(r247569)
    +++ head/sys/dev/aac/aac_pci.c	Fri Mar  1 19:55:10 2013	(r247570)
    @@ -60,6 +60,11 @@ __FBSDID("$FreeBSD$");
     static int	aac_pci_probe(device_t dev);
     static int	aac_pci_attach(device_t dev);
     
    +static int aac_enable_msi = 1;
    +TUNABLE_INT("hw.aac.enable_msi", &aac_enable_msi);
    +SYSCTL_INT(_hw_aac, OID_AUTO, enable_msi, CTLFLAG_RDTUN, &aac_enable_msi, 0,
    +    "Enable MSI interrupts");
    +
     static device_method_t aac_methods[] = {
     	/* Device interface */
     	DEVMETHOD(device_probe,		aac_pci_probe),
    @@ -79,11 +84,10 @@ static driver_t aac_pci_driver = {
     
     static devclass_t	aac_devclass;
     
    -DRIVER_MODULE(aac, pci, aac_pci_driver, aac_devclass, 0, 0);
    +DRIVER_MODULE(aac, pci, aac_pci_driver, aac_devclass, NULL, NULL);
     MODULE_DEPEND(aac, pci, 1, 1, 1);
     
    -
    -struct aac_ident
    +static const struct aac_ident
     {
     	u_int16_t		vendor;
     	u_int16_t		device;
    @@ -91,7 +95,7 @@ struct aac_ident
     	u_int16_t		subdevice;
     	int			hwif;
     	int			quirks;
    -	char			*desc;
    +	const char		*desc;
     } aac_identifiers[] = {
     	{0x1028, 0x0001, 0x1028, 0x0001, AAC_HWIF_I960RX, 0,
     	"Dell PERC 2/Si"},
    @@ -139,7 +143,6 @@ struct aac_ident
     	 "Adaptec SCSI RAID 2230S"},
     	{0x9005, 0x0286, 0x9005, 0x028d, AAC_HWIF_RKT, 0,
     	 "Adaptec SCSI RAID 2130S"},
    -
     	{0x9005, 0x0285, 0x9005, 0x0287, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
     	 AAC_FLAGS_256FIBS, "Adaptec SCSI RAID 2200S"},
     	{0x9005, 0x0285, 0x17aa, 0x0286, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
    @@ -276,7 +279,8 @@ struct aac_ident
     	 "AOC-USAS-S8iR-LP"},
     	{0, 0, 0, 0, 0, 0, 0}
     };
    -struct aac_ident
    +
    +static const struct aac_ident
     aac_family_identifiers[] = {
     	{0x9005, 0x0285, 0, 0, AAC_HWIF_I960RX, 0,
     	 "Adaptec RAID Controller"},
    @@ -285,10 +289,10 @@ aac_family_identifiers[] = {
     	{0, 0, 0, 0, 0, 0, 0}
     };
     
    -static struct aac_ident *
    +static const struct aac_ident *
     aac_find_ident(device_t dev)
     {
    -	struct aac_ident *m;
    +	const struct aac_ident *m;
     	u_int16_t vendid, devid, sub_vendid, sub_devid;
     
     	vendid = pci_get_vendor(dev);
    @@ -317,7 +321,7 @@ aac_find_ident(device_t dev)
     static int
     aac_pci_probe(device_t dev)
     {
    -	struct aac_ident *id;
    +	const struct aac_ident *id;
     
     	fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
     
    @@ -335,9 +339,8 @@ static int
     aac_pci_attach(device_t dev)
     {
     	struct aac_softc *sc;
    -	struct aac_ident *id;
    -	int error;
    -	u_int32_t command;
    +	const struct aac_ident *id;
    +	int count, error, reg, rid;
     
     	fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
     
    @@ -345,7 +348,6 @@ aac_pci_attach(device_t dev)
     	 * Initialise softc.
     	 */
     	sc = device_get_softc(dev);
    -	bzero(sc, sizeof(*sc));
     	sc->aac_dev = dev;
     
     	/* assume failure is 'not configured' */
    @@ -354,55 +356,65 @@ aac_pci_attach(device_t dev)
     	/*
     	 * Verify that the adapter is correctly set up in PCI space.
     	 */
    -	command = pci_read_config(sc->aac_dev, PCIR_COMMAND, 2);
    -	command |= PCIM_CMD_BUSMASTEREN;
    -	pci_write_config(dev, PCIR_COMMAND, command, 2);
    -	command = pci_read_config(sc->aac_dev, PCIR_COMMAND, 2);
    -	if (!(command & PCIM_CMD_BUSMASTEREN)) {
    -		device_printf(sc->aac_dev, "can't enable bus-master feature\n");
    -		goto out;
    -	}
    -	if ((command & PCIM_CMD_MEMEN) == 0) {
    -		device_printf(sc->aac_dev, "memory window not available\n");
    +	pci_enable_busmaster(dev);
    +	if (!(pci_read_config(dev, PCIR_COMMAND, 2) & PCIM_CMD_BUSMASTEREN)) {
    +		device_printf(dev, "can't enable bus-master feature\n");
     		goto out;
     	}
     
     	/*
    -	 * Allocate the PCI register window.
    +	 * Allocate the PCI register window(s).
     	 */
    -	sc->aac_regs_rid0 = PCIR_BAR(0);
    -	if ((sc->aac_regs_res0 = bus_alloc_resource_any(sc->aac_dev,
    -	    SYS_RES_MEMORY, &sc->aac_regs_rid0, RF_ACTIVE)) == NULL) {
    -		device_printf(sc->aac_dev,
    -		    "couldn't allocate register window 0\n");
    +	rid = PCIR_BAR(0);
    +	if ((sc->aac_regs_res0 = bus_alloc_resource_any(dev,
    +	    SYS_RES_MEMORY, &rid, RF_ACTIVE)) == NULL) {
    +		device_printf(dev, "can't allocate register window 0\n");
     		goto out;
     	}
     	sc->aac_btag0 = rman_get_bustag(sc->aac_regs_res0);
     	sc->aac_bhandle0 = rman_get_bushandle(sc->aac_regs_res0);
     
     	if (sc->aac_hwif == AAC_HWIF_NARK) {
    -		sc->aac_regs_rid1 = PCIR_BAR(1);
    -		if ((sc->aac_regs_res1 = bus_alloc_resource_any(sc->aac_dev,
    -		    SYS_RES_MEMORY, &sc->aac_regs_rid1, RF_ACTIVE)) == NULL) {
    -			device_printf(sc->aac_dev,
    -			    "couldn't allocate register window 1\n");
    +		rid = PCIR_BAR(1);
    +		if ((sc->aac_regs_res1 = bus_alloc_resource_any(dev,
    +		    SYS_RES_MEMORY, &rid, RF_ACTIVE)) == NULL) {
    +			device_printf(dev,
    +			    "can't allocate register window 1\n");
     			goto out;
     		}
     		sc->aac_btag1 = rman_get_bustag(sc->aac_regs_res1);
     		sc->aac_bhandle1 = rman_get_bushandle(sc->aac_regs_res1);
     	} else {
     		sc->aac_regs_res1 = sc->aac_regs_res0;
    -		sc->aac_regs_rid1 = sc->aac_regs_rid0;
     		sc->aac_btag1 = sc->aac_btag0;
     		sc->aac_bhandle1 = sc->aac_bhandle0;
     	}
     
     	/*
    +	 * Allocate the interrupt.
    +	 */
    +	rid = 0;
    +	if (aac_enable_msi != 0 && pci_find_cap(dev, PCIY_MSI, ®) == 0) {
    +		count = pci_msi_count(dev);
    +		if (count > 1)
    +			count = 1;
    +		else
    +			count = 0;
    +		if (count == 1 && pci_alloc_msi(dev, &count) == 0)
    +			rid = 1;
    +	}
    +	if ((sc->aac_irq = bus_alloc_resource_any(sc->aac_dev, SYS_RES_IRQ,
    +	    &rid, RF_ACTIVE | (count != 0 ? 0 : RF_SHAREABLE))) == NULL) {
    +		device_printf(dev, "can't allocate interrupt\n");
    +		goto out;
    +	}
    +
    +	/*
     	 * Allocate the parent bus DMA tag appropriate for our PCI interface.
     	 *
     	 * Note that some of these controllers are 64-bit capable.
     	 */
    -	if (bus_dma_tag_create(bus_get_dma_tag(sc->aac_dev), /* parent */
    +	if (bus_dma_tag_create(bus_get_dma_tag(dev),	/* parent */
     			       PAGE_SIZE, 0,		/* algnmnt, boundary */
     			       BUS_SPACE_MAXADDR,	/* lowaddr */
     			       BUS_SPACE_MAXADDR, 	/* highaddr */
    @@ -413,7 +425,7 @@ aac_pci_attach(device_t dev)
     			       0,			/* flags */
     			       NULL, NULL,		/* No locking needed */
     			       &sc->aac_parent_dmat)) {
    -		device_printf(sc->aac_dev, "can't allocate parent DMA tag\n");
    +		device_printf(dev, "can't allocate parent DMA tag\n");
     		goto out;
     	}
     
    @@ -427,19 +439,19 @@ aac_pci_attach(device_t dev)
     	case AAC_HWIF_I960RX:
     	case AAC_HWIF_NARK:
     		fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for i960Rx/NARK");
    -		sc->aac_if = aac_rx_interface;
    +		sc->aac_if = &aac_rx_interface;
     		break;
     	case AAC_HWIF_STRONGARM:
     		fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for StrongARM");
    -		sc->aac_if = aac_sa_interface;
    +		sc->aac_if = &aac_sa_interface;
     		break;
     	case AAC_HWIF_RKT:
     		fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for Rocket/MIPS");
    -		sc->aac_if = aac_rkt_interface;
    +		sc->aac_if = &aac_rkt_interface;
     		break;
     	default:
     		sc->aac_hwif = AAC_HWIF_UNKNOWN;
    -		device_printf(sc->aac_dev, "unknown hardware type\n");
    +		device_printf(dev, "unknown hardware type\n");
     		error = ENXIO;
     		goto out;
     	}
    @@ -472,7 +484,7 @@ static device_method_t aacch_methods[] =
     	DEVMETHOD(device_probe,		aacch_probe),
     	DEVMETHOD(device_attach,	aacch_attach),
     	DEVMETHOD(device_detach,	aacch_detach),
    -	{ 0, 0 }
    +	DEVMETHOD_END
     };
     
     struct aacch_softc {
    @@ -486,7 +498,7 @@ static driver_t aacch_driver = {
     };
     
     static devclass_t	aacch_devclass;
    -DRIVER_MODULE(aacch, pci, aacch_driver, aacch_devclass, 0, 0);
    +DRIVER_MODULE(aacch, pci, aacch_driver, aacch_devclass, NULL, NULL);
     
     static int
     aacch_probe(device_t dev)
    
    Modified: head/sys/dev/aac/aac_tables.h
    ==============================================================================
    --- head/sys/dev/aac/aac_tables.h	Fri Mar  1 19:54:25 2013	(r247569)
    +++ head/sys/dev/aac/aac_tables.h	Fri Mar  1 19:55:10 2013	(r247570)
    @@ -27,13 +27,14 @@
      *	$FreeBSD$
      */
     
    +#if 0
     /*
      * Status codes for block read/write commands, etc.
      *
      * XXX many of these would not normally be returned, as they are
      * relevant only to FSA operations.
      */
    -static struct aac_code_lookup aac_command_status_table[] = {
    +static const struct aac_code_lookup aac_command_status_table[] = {
     	{"OK",					ST_OK},
     	{"operation not permitted",		ST_PERM},
     	{"not found",				ST_NOENT},
    @@ -75,8 +76,9 @@ static struct aac_code_lookup aac_comman
     };
     
     #define AAC_COMMAND_STATUS(x)	aac_describe_code(aac_command_status_table, x)
    +#endif
     
    -static struct aac_code_lookup aac_cpu_variant[] = {
    +static const struct aac_code_lookup aac_cpu_variant[] = {
     	{"i960JX",		CPUI960_JX},
     	{"i960CX",		CPUI960_CX},
     	{"i960HX",		CPUI960_HX},
    @@ -93,7 +95,7 @@ static struct aac_code_lookup aac_cpu_va
     	{"Unknown processor",	0}
     };
     
    -static struct aac_code_lookup aac_battery_platform[] = {
    +static const struct aac_code_lookup aac_battery_platform[] = {
     	{"required battery present",		PLATFORM_BAT_REQ_PRESENT},
     	{"REQUIRED BATTERY NOT PRESENT",	PLATFORM_BAT_REQ_NOTPRESENT},
     	{"optional battery present",		PLATFORM_BAT_OPT_PRESENT},
    @@ -103,7 +105,7 @@ static struct aac_code_lookup aac_batter
     	{"unknown battery platform",		0}
     };
     
    -static struct aac_code_lookup aac_container_types[] = {
    +static const struct aac_code_lookup aac_container_types[] = {
     	{"Volume",		CT_VOLUME},
     	{"RAID 1 (Mirror)",	CT_MIRROR},
     	{"RAID 0 (Stripe)",	CT_STRIPE},
    @@ -126,4 +128,3 @@ static struct aac_code_lookup aac_contai
     	{NULL, 0},
     	{"unknown",		0}
     };
    -
    
    Modified: head/sys/dev/aac/aacvar.h
    ==============================================================================
    --- head/sys/dev/aac/aacvar.h	Fri Mar  1 19:54:25 2013	(r247569)
    +++ head/sys/dev/aac/aacvar.h	Fri Mar  1 19:55:10 2013	(r247570)
    @@ -33,10 +33,13 @@
     #include 
     #include 
     #include 
    -#include 
     #include 
    +#include 
    +#include 
     #include 
     
    +SYSCTL_DECL(_hw_aac);
    +
     #define	AAC_TYPE_DEVO			1
     #define	AAC_TYPE_ALPHA			2
     #define	AAC_TYPE_BETA			3
    @@ -242,28 +245,28 @@ struct aac_interface
     	int (*aif_get_outb_queue)(struct aac_softc *sc);
     	void (*aif_set_outb_queue)(struct aac_softc *sc, int index);
     };
    -extern struct aac_interface	aac_rx_interface;
    -extern struct aac_interface	aac_sa_interface;
    -extern struct aac_interface	aac_fa_interface;
    -extern struct aac_interface	aac_rkt_interface;
    -
    -#define AAC_GET_FWSTATUS(sc)		((sc)->aac_if.aif_get_fwstatus((sc)))
    -#define AAC_QNOTIFY(sc, qbit)		((sc)->aac_if.aif_qnotify((sc), (qbit)))
    -#define AAC_GET_ISTATUS(sc)		((sc)->aac_if.aif_get_istatus((sc)))
    -#define AAC_CLEAR_ISTATUS(sc, mask)	((sc)->aac_if.aif_clr_istatus((sc), \
    +extern const struct aac_interface	aac_rx_interface;
    +extern const struct aac_interface	aac_sa_interface;
    +extern const struct aac_interface	aac_fa_interface;
    +extern const struct aac_interface	aac_rkt_interface;
    +
    +#define AAC_GET_FWSTATUS(sc)		((sc)->aac_if->aif_get_fwstatus((sc)))
    +#define AAC_QNOTIFY(sc, qbit)		((sc)->aac_if->aif_qnotify((sc), (qbit)))
    +#define AAC_GET_ISTATUS(sc)		((sc)->aac_if->aif_get_istatus((sc)))
    +#define AAC_CLEAR_ISTATUS(sc, mask)	((sc)->aac_if->aif_clr_istatus((sc), \
     					(mask)))
     #define AAC_SET_MAILBOX(sc, command, arg0, arg1, arg2, arg3) \
    -	((sc)->aac_if.aif_set_mailbox((sc), (command), (arg0), (arg1), (arg2), \
    +	((sc)->aac_if->aif_set_mailbox((sc), (command), (arg0), (arg1), (arg2), \
     	(arg3)))
    -#define AAC_GET_MAILBOX(sc, mb)		((sc)->aac_if.aif_get_mailbox((sc), \
    +#define AAC_GET_MAILBOX(sc, mb)		((sc)->aac_if->aif_get_mailbox((sc), \
     					(mb)))
    -#define	AAC_MASK_INTERRUPTS(sc)		((sc)->aac_if.aif_set_interrupts((sc), \
    +#define	AAC_MASK_INTERRUPTS(sc)		((sc)->aac_if->aif_set_interrupts((sc), \
     					0))
    -#define AAC_UNMASK_INTERRUPTS(sc)	((sc)->aac_if.aif_set_interrupts((sc), \
    +#define AAC_UNMASK_INTERRUPTS(sc)	((sc)->aac_if->aif_set_interrupts((sc), \
     					1))
    -#define AAC_SEND_COMMAND(sc, cm)	((sc)->aac_if.aif_send_command((sc), (cm)))
    -#define AAC_GET_OUTB_QUEUE(sc)		((sc)->aac_if.aif_get_outb_queue((sc)))
    -#define AAC_SET_OUTB_QUEUE(sc, idx)	((sc)->aac_if.aif_set_outb_queue((sc), (idx)))
    +#define AAC_SEND_COMMAND(sc, cm)	((sc)->aac_if->aif_send_command((sc), (cm)))
    +#define AAC_GET_OUTB_QUEUE(sc)		((sc)->aac_if->aif_get_outb_queue((sc)))
    +#define AAC_SET_OUTB_QUEUE(sc, idx)	((sc)->aac_if->aif_set_outb_queue((sc), (idx)))
     
     #define AAC_MEM0_SETREG4(sc, reg, val)	bus_space_write_4(sc->aac_btag0, \
     					sc->aac_bhandle0, reg, val)
    @@ -307,14 +310,12 @@ struct aac_softc
     	/* bus connections */
     	device_t		aac_dev;
     	struct resource		*aac_regs_res0, *aac_regs_res1; /* reg. if. window */
    -	int			aac_regs_rid0, aac_regs_rid1;		/* resource ID */
     	bus_space_handle_t	aac_bhandle0, aac_bhandle1;		/* bus space handle */
     	bus_space_tag_t		aac_btag0, aac_btag1;		/* bus space tag */
     	bus_dma_tag_t		aac_parent_dmat;	/* parent DMA tag */
     	bus_dma_tag_t		aac_buffer_dmat;	/* data buffer/command
     							 * DMA tag */
     	struct resource		*aac_irq;		/* interrupt */
    -	int			aac_irq_rid;
     	void			*aac_intr;		/* interrupt handle */
     	eventhandler_tag	eh;
     
    @@ -339,7 +340,7 @@ struct aac_softc
     							 * DMA map */
     	struct aac_common	*aac_common;
     	u_int32_t		aac_common_busaddr;
    -	struct aac_interface	aac_if;
    +	const struct aac_interface	*aac_if;
     
     	/* command/fib resources */
     	bus_dma_tag_t		aac_fib_dmat;	/* DMA tag for allocing FIBs */
    @@ -499,7 +500,7 @@ extern void	aac_print_aif(struct aac_sof
     #endif
     
     struct aac_code_lookup {
    -	char	*string;
    +	const char	*string;
     	u_int32_t	code;
     };
     
    @@ -581,7 +582,6 @@ aac_remove_ ## name (struct aac_command 
     	cm->cm_flags &= ~AAC_ON_ ## index;				\
     	AACQ_REMOVE(cm->cm_sc, index);					\
     }									\
    -struct hack
     
     AACQ_COMMAND_QUEUE(free, AACQ_FREE);
     AACQ_COMMAND_QUEUE(ready, AACQ_READY);
    @@ -644,4 +644,3 @@ aac_release_sync_fib(struct aac_softc *s
     
     	mtx_assert(&sc->aac_io_lock, MA_OWNED);
     }
    -
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 20:16:07 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 84537C41;
     Fri,  1 Mar 2013 20:16:07 +0000 (UTC)
     (envelope-from marius@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 67C76158A;
     Fri,  1 Mar 2013 20:16:07 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21KG7Jx076008;
     Fri, 1 Mar 2013 20:16:07 GMT (envelope-from marius@svn.freebsd.org)
    Received: (from marius@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21KG7ne076007;
     Fri, 1 Mar 2013 20:16:07 GMT (envelope-from marius@svn.freebsd.org)
    Message-Id: <201303012016.r21KG7ne076007@svn.freebsd.org>
    From: Marius Strobl 
    Date: Fri, 1 Mar 2013 20:16:07 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247571 - head/sys/dev/puc
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 20:16:07 -0000
    
    Author: marius
    Date: Fri Mar  1 20:16:06 2013
    New Revision: 247571
    URL: http://svnweb.freebsd.org/changeset/base/247571
    
    Log:
      - Apparently, r186520 was just wrong and the clock of Oxford OX16PCI958 is
        neither DEFAULT_RCLK * 2 nor DEFAULT_RCLK * 10 but plain DEFAULT_RCLK
        and there's no (open) source indicating otherwise. This was tested with
        an EXSYS EX-41098-2, whose clock is not configurable and identifies as:
        puc0@pci0:5:1:0:        class=0x070200 card=0x06711415 chip=0x95381415 rev=0x01 hdr=0x00
            vendor     = 'Oxford Semiconductor Ltd'
            class      = simple comms
            subclass   = multiport serial
      
        Note that this exactly matches the card mentioned in PR 129665 so no
        sub-device/sub-vendor based quirking of the latter is possible. So maybe
        we should grow some sort of tunable, in case non-default cards such as
        the latter aren't configurable either (this also wouldn't be the first
        time an allegedly tested commit turns out to be wrong though).
      - Make the TiMedia tables const.
      
      MFC after:	1 week
    
    Modified:
      head/sys/dev/puc/pucdata.c
    
    Modified: head/sys/dev/puc/pucdata.c
    ==============================================================================
    --- head/sys/dev/puc/pucdata.c	Fri Mar  1 19:55:10 2013	(r247570)
    +++ head/sys/dev/puc/pucdata.c	Fri Mar  1 20:16:06 2013	(r247571)
    @@ -769,7 +769,7 @@ const struct puc_cfg puc_pci_devices[] =
     
     	{   0x1415, 0x9538, 0xffff, 0,
     	    "Oxford Semiconductor OX16PCI958 UARTs",
    -	    DEFAULT_RCLK * 10,
    +	    DEFAULT_RCLK,
     	    PUC_PORT_8S, 0x18, 0, 8,
     	},
     
    @@ -918,6 +918,7 @@ const struct puc_cfg puc_pci_devices[] =
     	    DEFAULT_RCLK * 8,
     	    PUC_PORT_4S, 0x10, 0, 8,
     	},
    +
     	{   0x14d2, 0xa004, 0xffff, 0,
     	    "Titan PCI-800H",
     	    DEFAULT_RCLK * 8,
    @@ -1060,7 +1061,7 @@ const struct puc_cfg puc_pci_devices[] =
     	{   0x9710, 0x9865, 0xa000, 0x3004,
     	    "NetMos NM9865 Quad UART",
     	    DEFAULT_RCLK,
    -	    PUC_PORT_4S, 0x10, 4, 0,0
    +	    PUC_PORT_4S, 0x10, 4, 0,
     	},
     
     	{   0x9710, 0x9865, 0xa000, 0x3011,
    @@ -1420,26 +1421,26 @@ static int
     puc_config_timedia(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
         intptr_t *res)
     {
    -	static uint16_t dual[] = {
    +	static const uint16_t dual[] = {
     	    0x0002, 0x4036, 0x4037, 0x4038, 0x4078, 0x4079, 0x4085,
     	    0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079, 
     	    0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079, 
     	    0x9137, 0x9138, 0x9237, 0x9238, 0xA079, 0xB079, 0xC079,
     	    0xD079, 0
     	};
    -	static uint16_t quad[] = {
    +	static const uint16_t quad[] = {
     	    0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157, 
     	    0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159, 
     	    0x9256, 0x9257, 0xA056, 0xA157, 0xA158, 0xA159, 0xB056,
     	    0xB157, 0
     	};
    -	static uint16_t octa[] = {
    +	static const uint16_t octa[] = {
     	    0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166, 
     	    0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0
     	};
    -	static struct {
    +	static const struct {
     		int ports;
    -		uint16_t *ids;
    +		const uint16_t *ids;
     	} subdevs[] = {
     	    { 2, dual },
     	    { 4, quad },
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 20:34:02 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id A8328318;
     Fri,  1 Mar 2013 20:34:02 +0000 (UTC)
     (envelope-from marius@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 9AEE4166B;
     Fri,  1 Mar 2013 20:34:02 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21KY2KL081718;
     Fri, 1 Mar 2013 20:34:02 GMT (envelope-from marius@svn.freebsd.org)
    Received: (from marius@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21KY2jv081717;
     Fri, 1 Mar 2013 20:34:02 GMT (envelope-from marius@svn.freebsd.org)
    Message-Id: <201303012034.r21KY2jv081717@svn.freebsd.org>
    From: Marius Strobl 
    Date: Fri, 1 Mar 2013 20:34:02 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247573 - head/sys/sparc64/pci
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 20:34:02 -0000
    
    Author: marius
    Date: Fri Mar  1 20:34:02 2013
    New Revision: 247573
    URL: http://svnweb.freebsd.org/changeset/base/247573
    
    Log:
      - Remove an unused header.
      - Use NULL instead of 0 for pointers.
      - Let ofw_pcib_probe() return BUS_PROBE_DEFAULT instead of 0 so specialized
        PCI-PCI-bridge drivers may attach instead.
      - Add WARs for PLX Technology PEX 8114 bridges and PEX 8532 switches.
        Ideally, these should live in MI code but at least for the latter we're
        missing the necessary infrastructure there.
      
      MFC after:	1 week
    
    Modified:
      head/sys/sparc64/pci/ofw_pcib.c
    
    Modified: head/sys/sparc64/pci/ofw_pcib.c
    ==============================================================================
    --- head/sys/sparc64/pci/ofw_pcib.c	Fri Mar  1 20:33:35 2013	(r247572)
    +++ head/sys/sparc64/pci/ofw_pcib.c	Fri Mar  1 20:34:02 2013	(r247573)
    @@ -47,8 +47,6 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     
    -#include 
    -
     #include 
     #include 
     #include 
    @@ -58,8 +56,12 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     
    +#define	PCI_DEVID_ALI_M5249	0x524910b9
    +#define	PCI_VENDOR_PLX		0x10b5
    +
     static device_probe_t ofw_pcib_probe;
     static device_attach_t ofw_pcib_attach;
    +static ofw_pci_setup_device_t ofw_pcib_setup_device;
     
     static device_method_t ofw_pcib_methods[] = {
     	/* Device interface */
    @@ -73,6 +75,7 @@ static device_method_t ofw_pcib_methods[
     
     	/* ofw_bus interface */
     	DEVMETHOD(ofw_bus_get_node,	ofw_pcib_gen_get_node),
    +	DEVMETHOD(ofw_pci_setup_device, ofw_pcib_setup_device),
     
     	DEVMETHOD_END
     };
    @@ -81,7 +84,7 @@ static devclass_t pcib_devclass;
     
     DEFINE_CLASS_1(pcib, ofw_pcib_driver, ofw_pcib_methods,
         sizeof(struct ofw_pcib_gen_softc), pcib_driver);
    -EARLY_DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_driver, pcib_devclass, 0, 0,
    +EARLY_DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_driver, pcib_devclass, NULL, NULL,
         BUS_PASS_BUS);
     MODULE_DEPEND(ofw_pcib, pci, 1, 1, 1);
     
    @@ -104,7 +107,7 @@ ofw_pcib_probe(device_t dev)
     		    ISDTYPE(pbdtype, OFW_TYPE_PCIE) ? "e" : "",
     		    ISDTYPE(dtype, OFW_TYPE_PCIE) ? "e" : "");
     		device_set_desc_copy(dev, desc);
    -		return (0);
    +		return (BUS_PROBE_DEFAULT);
     	}
     
     #undef ISDTYPE
    @@ -119,7 +122,6 @@ ofw_pcib_attach(device_t dev)
     
     	sc = device_get_softc(dev);
     
    -	/* Quirk handling */
     	switch (pci_get_devid(dev)) {
     	/*
     	 * The ALi M5249 found in Fire-based machines by definition must me
    @@ -127,13 +129,46 @@ ofw_pcib_attach(device_t dev)
     	 * don't indicate this in the class code although the ISA I/O range
     	 * isn't included in their bridge decode.
     	 */
    -	case 0x524910b9:
    +	case PCI_DEVID_ALI_M5249:
     		sc->ops_pcib_sc.flags |= PCIB_SUBTRACTIVE;
     		break;
     	}
     
    +	switch (pci_get_vendor(dev)) {
    +	/*
    +	 * Concurrently write the primary and secondary bus numbers in order
    +	 * to work around a bug in PLX PEX 8114 causing the internal shadow
    +	 * copies of these not to be updated when setting them bytewise.
    +	 */
    +	case PCI_VENDOR_PLX:
    +		pci_write_config(dev, PCIR_PRIBUS_1,
    +		    pci_read_config(dev, PCIR_SECBUS_1, 1) << 8 |
    +		    pci_read_config(dev, PCIR_PRIBUS_1, 1), 2);
    +		break;
    +	}
    +
     	ofw_pcib_gen_setup(dev);
     	pcib_attach_common(dev);
     	device_add_child(dev, "pci", -1);
     	return (bus_generic_attach(dev));
     }
    +
    +static void
    +ofw_pcib_setup_device(device_t bus, device_t child)
    +{
    +	int i;
    +	uint16_t reg;
    +
    +	switch (pci_get_vendor(bus)) {
    +	/*
    +	 * For PLX PEX 8532 issue 64 TLPs to the child from the downstream
    +	 * port to the child device in order to work around a hardware bug.
    +	 */
    +	case PCI_VENDOR_PLX:
    +		for (i = 0, reg = 0; i < 64; i++)
    +			reg |= pci_get_devid(child);
    +		break;
    +	}
    +
    +	OFW_PCI_SETUP_DEVICE(device_get_parent(bus), child);
    +}
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 20:37:00 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 4C21A76B;
     Fri,  1 Mar 2013 20:37:00 +0000 (UTC)
     (envelope-from marius@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 3EF3316B1;
     Fri,  1 Mar 2013 20:37:00 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21Kb0cT082138;
     Fri, 1 Mar 2013 20:37:00 GMT (envelope-from marius@svn.freebsd.org)
    Received: (from marius@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21Kb0Zg082137;
     Fri, 1 Mar 2013 20:37:00 GMT (envelope-from marius@svn.freebsd.org)
    Message-Id: <201303012037.r21Kb0Zg082137@svn.freebsd.org>
    From: Marius Strobl 
    Date: Fri, 1 Mar 2013 20:37:00 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247574 - head/sys/sparc64/pci
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 20:37:00 -0000
    
    Author: marius
    Date: Fri Mar  1 20:36:59 2013
    New Revision: 247574
    URL: http://svnweb.freebsd.org/changeset/base/247574
    
    Log:
      - In sbbc_pci_attach() just pass the already obtained bus tag and handle
        instead of acquiring these anew.
      - Use NULL instead of 0 for pointers.
      
      MFC after:	1 week
    
    Modified:
      head/sys/sparc64/pci/sbbc.c
    
    Modified: head/sys/sparc64/pci/sbbc.c
    ==============================================================================
    --- head/sys/sparc64/pci/sbbc.c	Fri Mar  1 20:34:02 2013	(r247573)
    +++ head/sys/sparc64/pci/sbbc.c	Fri Mar  1 20:36:59 2013	(r247574)
    @@ -299,7 +299,7 @@ static device_method_t sbbc_pci_methods[
     static devclass_t sbbc_devclass;
     
     DEFINE_CLASS_0(sbbc, sbbc_driver, sbbc_pci_methods, sizeof(struct sbbc_softc));
    -DRIVER_MODULE(sbbc, pci, sbbc_driver, sbbc_devclass, 0, 0);
    +DRIVER_MODULE(sbbc, pci, sbbc_driver, sbbc_devclass, NULL, NULL);
     
     static int
     sbbc_pci_probe(device_t dev)
    @@ -358,8 +358,7 @@ sbbc_pci_attach(device_t dev)
     		if (error != 0)
     			device_printf(dev, "failed to attach UART device\n");
     	} else {
    -		error = sbbc_parse_toc(rman_get_bustag(sc->sc_res),
    -		    rman_get_bushandle(sc->sc_res));
    +		error = sbbc_parse_toc(bst, bsh);
     		if (error != 0) {
     			device_printf(dev, "failed to parse TOC\n");
     			if (sbbc_console != 0) {
    @@ -609,7 +608,7 @@ static device_method_t sbbc_uart_sbbc_me
     
     DEFINE_CLASS_0(uart, sbbc_uart_driver, sbbc_uart_sbbc_methods,
         sizeof(struct uart_softc));
    -DRIVER_MODULE(uart, sbbc, sbbc_uart_driver, uart_devclass, 0, 0);
    +DRIVER_MODULE(uart, sbbc, sbbc_uart_driver, uart_devclass, NULL, NULL);
     
     static int
     sbbc_uart_sbbc_probe(device_t dev)
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 20:51:54 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 7B7BD378;
     Fri,  1 Mar 2013 20:51:54 +0000 (UTC)
     (envelope-from marius@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 55B8A1774;
     Fri,  1 Mar 2013 20:51:54 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21Kpskw087513;
     Fri, 1 Mar 2013 20:51:54 GMT (envelope-from marius@svn.freebsd.org)
    Received: (from marius@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21Kps4k087512;
     Fri, 1 Mar 2013 20:51:54 GMT (envelope-from marius@svn.freebsd.org)
    Message-Id: <201303012051.r21Kps4k087512@svn.freebsd.org>
    From: Marius Strobl 
    Date: Fri, 1 Mar 2013 20:51:54 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247579 - head/sys/dev/cas
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 20:51:54 -0000
    
    Author: marius
    Date: Fri Mar  1 20:51:53 2013
    New Revision: 247579
    URL: http://svnweb.freebsd.org/changeset/base/247579
    
    Log:
      - Move reporting of failures to disable RX/TX MAC under bootverbose as at
        least the Saturn chips of 501-6738 cards may fail to do so the first
        time, which isn't fatal though.
        Reported by: Paul Keusemann
      - Explain why we don't enable infinite bursts on sparc64.
      - Given that these chips support memory write invalidate, make sure that
        it's enabled in the command register. Also make sure that PERR# and
        SERR# assertion is enabled.
      
      MFC after:	1 week
    
    Modified:
      head/sys/dev/cas/if_cas.c
    
    Modified: head/sys/dev/cas/if_cas.c
    ==============================================================================
    --- head/sys/dev/cas/if_cas.c	Fri Mar  1 20:49:56 2013	(r247578)
    +++ head/sys/dev/cas/if_cas.c	Fri Mar  1 20:51:53 2013	(r247579)
    @@ -824,7 +824,8 @@ cas_disable_rx(struct cas_softc *sc)
     	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
     	if (cas_bitwait(sc, CAS_MAC_RX_CONF, CAS_MAC_RX_CONF_EN, 0))
     		return (1);
    -	device_printf(sc->sc_dev, "cannot disable RX MAC\n");
    +	if (bootverbose)
    +		device_printf(sc->sc_dev, "cannot disable RX MAC\n");
     	return (0);
     }
     
    @@ -838,7 +839,8 @@ cas_disable_tx(struct cas_softc *sc)
     	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
     	if (cas_bitwait(sc, CAS_MAC_TX_CONF, CAS_MAC_TX_CONF_EN, 0))
     		return (1);
    -	device_printf(sc->sc_dev, "cannot disable TX MAC\n");
    +	if (bootverbose)
    +		device_printf(sc->sc_dev, "cannot disable TX MAC\n");
     	return (0);
     }
     
    @@ -1041,7 +1043,8 @@ cas_init_locked(struct cas_softc *sc)
     	/*
     	 * Enable infinite bursts for revisions without PCI issues if
     	 * applicable.  Doing so greatly improves the TX performance on
    -	 * !__sparc64__.
    +	 * !__sparc64__ (on sparc64, setting CAS_INF_BURST improves TX
    +	 * performance only marginally but hurts RX throughput quite a bit).
     	 */
     	CAS_WRITE_4(sc, CAS_INF_BURST,
     #if !defined(__sparc64__)
    @@ -2691,7 +2694,10 @@ cas_pci_attach(device_t dev)
     		return (ENXIO);
     	}
     
    -	pci_enable_busmaster(dev);
    +	/* PCI configuration */
    +	pci_write_config(dev, PCIR_COMMAND,
    +	    pci_read_config(dev, PCIR_COMMAND, 2) | PCIM_CMD_BUSMASTEREN |
    +	    PCIM_CMD_MWRICEN | PCIM_CMD_PERRESPEN | PCIM_CMD_SERRESPEN, 2);
     
     	sc->sc_dev = dev;
     	if (sc->sc_variant == CAS_CAS && pci_get_devid(dev) < 0x02)
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 21:57:03 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 1B35D471;
     Fri,  1 Mar 2013 21:57:03 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id EB6B11981;
     Fri,  1 Mar 2013 21:57:02 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21Lv2UO006767;
     Fri, 1 Mar 2013 21:57:02 GMT (envelope-from pjd@svn.freebsd.org)
    Received: (from pjd@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21Lv2aO006765;
     Fri, 1 Mar 2013 21:57:02 GMT (envelope-from pjd@svn.freebsd.org)
    Message-Id: <201303012157.r21Lv2aO006765@svn.freebsd.org>
    From: Pawel Jakub Dawidek 
    Date: Fri, 1 Mar 2013 21:57:02 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247584 - head/sys/kern
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 21:57:03 -0000
    
    Author: pjd
    Date: Fri Mar  1 21:57:02 2013
    New Revision: 247584
    URL: http://svnweb.freebsd.org/changeset/base/247584
    
    Log:
      Reduce lock scope a little.
    
    Modified:
      head/sys/kern/vfs_syscalls.c
    
    Modified: head/sys/kern/vfs_syscalls.c
    ==============================================================================
    --- head/sys/kern/vfs_syscalls.c	Fri Mar  1 21:35:53 2013	(r247583)
    +++ head/sys/kern/vfs_syscalls.c	Fri Mar  1 21:57:02 2013	(r247584)
    @@ -2633,9 +2633,9 @@ setfflags(td, vp, flags)
     
     	if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
     		return (error);
    -	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
     	VATTR_NULL(&vattr);
     	vattr.va_flags = flags;
    +	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
     #ifdef MAC
     	error = mac_vnode_check_setflags(td->td_ucred, vp, vattr.va_flags);
     	if (error == 0)
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 21:58:52 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id AB5A57AD;
     Fri,  1 Mar 2013 21:58:52 +0000 (UTC) (envelope-from mm@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 8095A1999;
     Fri,  1 Mar 2013 21:58:52 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21LwqQB007074;
     Fri, 1 Mar 2013 21:58:52 GMT (envelope-from mm@svn.freebsd.org)
    Received: (from mm@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21Lwprk007068;
     Fri, 1 Mar 2013 21:58:51 GMT (envelope-from mm@svn.freebsd.org)
    Message-Id: <201303012158.r21Lwprk007068@svn.freebsd.org>
    From: Martin Matuska 
    Date: Fri, 1 Mar 2013 21:58:51 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247585 - in head: cddl/contrib/opensolaris/cmd/zfs
     sys/cddl/contrib/opensolaris/common/zfs
     sys/cddl/contrib/opensolaris/uts/common/fs/zfs
     sys/cddl/contrib/opensolaris/uts/common/sys/fs
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 21:58:52 -0000
    
    Author: mm
    Date: Fri Mar  1 21:58:51 2013
    New Revision: 247585
    URL: http://svnweb.freebsd.org/changeset/base/247585
    
    Log:
      MFV r247316:
      Merge new read-only zfs properties from vendor (illumos)
      
      Illumos ZFS issues:
        3588 provide zfs properties for logical (uncompressed) space used and
             referenced
      
      References:
        https://www.illumos.org/issues/3588
      
      MFC after:	2 weeks
    
    Modified:
      head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
      head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c
      head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
      head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
      head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
    Directory Properties:
      head/sys/cddl/contrib/opensolaris/   (props changed)
    
    Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
    ==============================================================================
    --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8	Fri Mar  1 21:57:02 2013	(r247584)
    +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8	Fri Mar  1 21:58:51 2013	(r247585)
    @@ -526,6 +526,39 @@ if the snapshot has been marked for defe
     .Qq Nm Cm destroy -d
     command. Otherwise, the property is
     .Cm off .
    +.It Sy logicalreferenced
    +The amount of space that is
    +.Qq logically
    +accessible by this dataset.
    +See the
    +.Sy referenced
    +property.
    +The logical space ignores the effect of the
    +.Sy compression
    +and
    +.Sy copies
    +properties, giving a quantity closer to the amount of data that applications
    +see.
    +However, it does include space consumed by metadata.
    +.Pp
    +This property can also be referred to by its shortened column name,
    +.Sy lrefer .
    +.It Sy logicalused
    +The amount of space that is
    +.Qq logically
    +consumed by this dataset and all its descendents.
    +See the
    +.Sy used
    +property.
    +The logical space ignores the effect of the
    +.Sy compression
    +and
    +.Sy copies
    +properties, giving a quantity closer to the amount of data that applications
    +see.
    +.Pp
    +This property can also be referred to by its shortened column name,
    +.Sy lused .
     .It Sy mounted
     For file systems, indicates whether the file system is currently mounted. This
     property can be either
    
    Modified: head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c
    ==============================================================================
    --- head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c	Fri Mar  1 21:57:02 2013	(r247584)
    +++ head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c	Fri Mar  1 21:58:51 2013	(r247585)
    @@ -20,7 +20,7 @@
      */
     /*
      * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    - * Copyright (c) 2011 by Delphix. All rights reserved.
    + * Copyright (c) 2012 by Delphix. All rights reserved.
      * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
      */
     
    @@ -350,6 +350,10 @@ zfs_prop_init(void)
     	    ZFS_TYPE_SNAPSHOT, "", "USERREFS");
     	zprop_register_number(ZFS_PROP_WRITTEN, "written", 0, PROP_READONLY,
     	    ZFS_TYPE_DATASET, "", "WRITTEN");
    +	zprop_register_number(ZFS_PROP_LOGICALUSED, "logicalused", 0,
    +	    PROP_READONLY, ZFS_TYPE_DATASET, "", "LUSED");
    +	zprop_register_number(ZFS_PROP_LOGICALREFERENCED, "logicalreferenced",
    +	    0, PROP_READONLY, ZFS_TYPE_DATASET, "", "LREFER");
     
     	/* default number properties */
     	zprop_register_number(ZFS_PROP_QUOTA, "quota", 0, PROP_DEFAULT,
    
    Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
    ==============================================================================
    --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c	Fri Mar  1 21:57:02 2013	(r247584)
    +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c	Fri Mar  1 21:58:51 2013	(r247585)
    @@ -2344,6 +2344,8 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvl
     	    (ds->ds_phys->ds_uncompressed_bytes * 100 /
     	    ds->ds_phys->ds_compressed_bytes);
     	dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_REFRATIO, ratio);
    +	dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALREFERENCED,
    +	    ds->ds_phys->ds_uncompressed_bytes);
     
     	if (ds->ds_phys->ds_next_snap_obj) {
     		/*
    
    Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
    ==============================================================================
    --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c	Fri Mar  1 21:57:02 2013	(r247584)
    +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c	Fri Mar  1 21:58:51 2013	(r247585)
    @@ -541,6 +541,8 @@ dsl_dir_stats(dsl_dir_t *dd, nvlist_t *n
     	    dd->dd_phys->dd_compressed_bytes == 0 ? 100 :
     	    (dd->dd_phys->dd_uncompressed_bytes * 100 /
     	    dd->dd_phys->dd_compressed_bytes));
    +	dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALUSED,
    +	    dd->dd_phys->dd_uncompressed_bytes);
     	if (dd->dd_phys->dd_flags & DD_FLAG_USED_BREAKDOWN) {
     		dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USEDSNAP,
     		    dd->dd_phys->dd_used_breakdown[DD_USED_SNAP]);
    
    Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
    ==============================================================================
    --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h	Fri Mar  1 21:57:02 2013	(r247584)
    +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h	Fri Mar  1 21:58:51 2013	(r247585)
    @@ -131,6 +131,8 @@ typedef enum {
     	ZFS_PROP_REFRATIO,
     	ZFS_PROP_WRITTEN,
     	ZFS_PROP_CLONES,
    +	ZFS_PROP_LOGICALUSED,
    +	ZFS_PROP_LOGICALREFERENCED,
     	ZFS_NUM_PROPS
     } zfs_prop_t;
     
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 21:58:56 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id A92E47B0;
     Fri,  1 Mar 2013 21:58:56 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 9C024199B;
     Fri,  1 Mar 2013 21:58:56 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21LwuBM007120;
     Fri, 1 Mar 2013 21:58:56 GMT (envelope-from pjd@svn.freebsd.org)
    Received: (from pjd@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21Lwu9k007119;
     Fri, 1 Mar 2013 21:58:56 GMT (envelope-from pjd@svn.freebsd.org)
    Message-Id: <201303012158.r21Lwu9k007119@svn.freebsd.org>
    From: Pawel Jakub Dawidek 
    Date: Fri, 1 Mar 2013 21:58:56 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247586 - head/sys/kern
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 21:58:56 -0000
    
    Author: pjd
    Date: Fri Mar  1 21:58:56 2013
    New Revision: 247586
    URL: http://svnweb.freebsd.org/changeset/base/247586
    
    Log:
      Remove unnecessary variables.
    
    Modified:
      head/sys/kern/vfs_vnops.c
    
    Modified: head/sys/kern/vfs_vnops.c
    ==============================================================================
    --- head/sys/kern/vfs_vnops.c	Fri Mar  1 21:58:51 2013	(r247585)
    +++ head/sys/kern/vfs_vnops.c	Fri Mar  1 21:58:56 2013	(r247586)
    @@ -1860,7 +1860,6 @@ vn_chmod(struct file *fp, mode_t mode, s
         struct thread *td)
     {
     	struct vnode *vp;
    -	int error;
     
     	vp = fp->f_vnode;
     #ifdef AUDIT
    @@ -1868,8 +1867,7 @@ vn_chmod(struct file *fp, mode_t mode, s
     	AUDIT_ARG_VNODE1(vp);
     	VOP_UNLOCK(vp, 0);
     #endif
    -	error = setfmode(td, active_cred, vp, mode);
    -	return (error);
    +	return (setfmode(td, active_cred, vp, mode));
     }
     
     int
    @@ -1877,7 +1875,6 @@ vn_chown(struct file *fp, uid_t uid, gid
         struct thread *td)
     {
     	struct vnode *vp;
    -	int error;
     
     	vp = fp->f_vnode;
     #ifdef AUDIT
    @@ -1885,8 +1882,7 @@ vn_chown(struct file *fp, uid_t uid, gid
     	AUDIT_ARG_VNODE1(vp);
     	VOP_UNLOCK(vp, 0);
     #endif
    -	error = setfown(td, active_cred, vp, uid, gid);
    -	return (error);
    +	return (setfown(td, active_cred, vp, uid, gid));
     }
     
     void
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 21:59:24 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 67C2BA8D;
     Fri,  1 Mar 2013 21:59:24 +0000 (UTC)
     (envelope-from andrew@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 5AFAA19A7;
     Fri,  1 Mar 2013 21:59:24 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21LxOUg007244;
     Fri, 1 Mar 2013 21:59:24 GMT (envelope-from andrew@svn.freebsd.org)
    Received: (from andrew@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21LxOgj007243;
     Fri, 1 Mar 2013 21:59:24 GMT (envelope-from andrew@svn.freebsd.org)
    Message-Id: <201303012159.r21LxOgj007243@svn.freebsd.org>
    From: Andrew Turner 
    Date: Fri, 1 Mar 2013 21:59:24 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247587 - head/sys/arm/include
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 21:59:24 -0000
    
    Author: andrew
    Date: Fri Mar  1 21:59:23 2013
    New Revision: 247587
    URL: http://svnweb.freebsd.org/changeset/base/247587
    
    Log:
      Increase the maximum text size on ARM to 64MiB. Without this clang would be
      sent a SIGABRT when it is loaded as it is too large. This is the smallest
      power of two MiB value that allows us to execute clang.
      
      While here wrap it in an #ifndef to be consistent with the other
      architectures.
      
      Submitted by:	Daisuke Aoyama 
    
    Modified:
      head/sys/arm/include/vmparam.h
    
    Modified: head/sys/arm/include/vmparam.h
    ==============================================================================
    --- head/sys/arm/include/vmparam.h	Fri Mar  1 21:58:56 2013	(r247586)
    +++ head/sys/arm/include/vmparam.h	Fri Mar  1 21:59:23 2013	(r247587)
    @@ -153,7 +153,9 @@
         VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
     #endif
     
    -#define MAXTSIZ 	(16*1024*1024)
    +#ifndef MAXTSIZ
    +#define MAXTSIZ 	(64*1024*1024)
    +#endif
     #ifndef DFLDSIZ
     #define DFLDSIZ         (128*1024*1024)
     #endif
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 22:03:33 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 4819FC38;
     Fri,  1 Mar 2013 22:03:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 22C2D19C9;
     Fri,  1 Mar 2013 22:03:33 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21M3X4x009668;
     Fri, 1 Mar 2013 22:03:33 GMT (envelope-from jhb@svn.freebsd.org)
    Received: (from jhb@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21M3WU8009662;
     Fri, 1 Mar 2013 22:03:32 GMT (envelope-from jhb@svn.freebsd.org)
    Message-Id: <201303012203.r21M3WU8009662@svn.freebsd.org>
    From: John Baldwin 
    Date: Fri, 1 Mar 2013 22:03:32 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247588 - in head/sys: dev/mps kern sys
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 22:03:33 -0000
    
    Author: jhb
    Date: Fri Mar  1 22:03:31 2013
    New Revision: 247588
    URL: http://svnweb.freebsd.org/changeset/base/247588
    
    Log:
      Replace the TDP_NOSLEEPING flag with a counter so that the
      THREAD_NO_SLEEPING() and THREAD_SLEEPING_OK() macros can nest.
      
      Reviewed by:	attilio
    
    Modified:
      head/sys/dev/mps/mps.c
      head/sys/kern/subr_sleepqueue.c
      head/sys/kern/subr_trap.c
      head/sys/sys/proc.h
      head/sys/sys/rmlock.h
    
    Modified: head/sys/dev/mps/mps.c
    ==============================================================================
    --- head/sys/dev/mps/mps.c	Fri Mar  1 21:59:23 2013	(r247587)
    +++ head/sys/dev/mps/mps.c	Fri Mar  1 22:03:31 2013	(r247588)
    @@ -136,8 +136,8 @@ mps_diag_reset(struct mps_softc *sc,int 
     
     	/*Force NO_SLEEP for threads prohibited to sleep
      	* e.a Thread from interrupt handler are prohibited to sleep.
    - 	*/	
    -	if(curthread->td_pflags & TDP_NOSLEEPING)
    + 	*/
    +	if (curthread->td_no_sleeping != 0)
     		sleep_flag = NO_SLEEP;
      
     	/* Push the magic sequence */
    @@ -469,8 +469,8 @@ mps_request_sync(struct mps_softc *sc, v
     	uint16_t *data16;
     	int i, count, ioc_sz, residual;
     	int sleep_flags = CAN_SLEEP;
    -	
    -	if(curthread->td_pflags & TDP_NOSLEEPING)
    +
    +	if (curthread->td_no_sleeping != 0)
     		sleep_flags = NO_SLEEP;
     
     	/* Step 1 */
    
    Modified: head/sys/kern/subr_sleepqueue.c
    ==============================================================================
    --- head/sys/kern/subr_sleepqueue.c	Fri Mar  1 21:59:23 2013	(r247587)
    +++ head/sys/kern/subr_sleepqueue.c	Fri Mar  1 22:03:31 2013	(r247588)
    @@ -296,8 +296,8 @@ sleepq_add(void *wchan, struct lock_obje
     	MPASS((queue >= 0) && (queue < NR_SLEEPQS));
     
     	/* If this thread is not allowed to sleep, die a horrible death. */
    -	KASSERT(!(td->td_pflags & TDP_NOSLEEPING),
    -	    ("%s: td %p to sleep on wchan %p with TDP_NOSLEEPING on",
    +	KASSERT(td->td_no_sleeping == 0,
    +	    ("%s: td %p to sleep on wchan %p with sleeping prohibited",
     	    __func__, td, wchan));
     
     	/* Look up the sleep queue associated with the wait channel 'wchan'. */
    
    Modified: head/sys/kern/subr_trap.c
    ==============================================================================
    --- head/sys/kern/subr_trap.c	Fri Mar  1 21:59:23 2013	(r247587)
    +++ head/sys/kern/subr_trap.c	Fri Mar  1 22:03:31 2013	(r247588)
    @@ -158,7 +158,7 @@ userret(struct thread *td, struct trapfr
     	    ("userret: Returning with %d locks held", td->td_locks));
     	KASSERT((td->td_pflags & TDP_NOFAULTING) == 0,
     	    ("userret: Returning with pagefaults disabled"));
    -	KASSERT((td->td_pflags & TDP_NOSLEEPING) == 0,
    +	KASSERT(td->td_no_sleeping == 0,
     	    ("userret: Returning with sleep disabled"));
     	KASSERT(td->td_pinned == 0 || (td->td_pflags & TDP_CALLCHAIN) != 0,
     	    ("userret: Returning with with pinned thread"));
    
    Modified: head/sys/sys/proc.h
    ==============================================================================
    --- head/sys/sys/proc.h	Fri Mar  1 21:59:23 2013	(r247587)
    +++ head/sys/sys/proc.h	Fri Mar  1 22:03:31 2013	(r247588)
    @@ -273,6 +273,7 @@ struct thread {
     	struct vm_map_entry *td_map_def_user; /* (k) Deferred entries. */
     	pid_t		td_dbg_forked;	/* (c) Child pid for debugger. */
     	u_int		td_vp_reserv;	/* (k) Count of reserved vnodes. */
    +	int		td_no_sleeping;	/* (k) Sleeping disabled count. */
     #define	td_endzero td_sigmask
     
     /* Copied during fork1() or create_thread(). */
    @@ -404,7 +405,7 @@ do {									\
     #define	TDP_ALTSTACK	0x00000020 /* Have alternate signal stack. */
     #define	TDP_DEADLKTREAT	0x00000040 /* Lock aquisition - deadlock treatment. */
     #define	TDP_NOFAULTING	0x00000080 /* Do not handle page faults. */
    -#define	TDP_NOSLEEPING	0x00000100 /* Thread is not allowed to sleep on a sq. */
    +#define	TDP_UNUSED9	0x00000100 /* --available-- */
     #define	TDP_OWEUPC	0x00000200 /* Call addupc() at next AST. */
     #define	TDP_ITHREAD	0x00000400 /* Thread is an interrupt thread. */
     #define	TDP_SYNCIO	0x00000800 /* Local override, disable async i/o. */
    @@ -790,17 +791,9 @@ extern pid_t pid_max;
     #define	thread_safetoswapout(td)	((td)->td_flags & TDF_CANSWAP)
     
     /* Control whether or not it is safe for curthread to sleep. */
    -#define	THREAD_NO_SLEEPING() do {					\
    -	KASSERT(!(curthread->td_pflags & TDP_NOSLEEPING),		\
    -	    ("nested no sleeping"));					\
    -	curthread->td_pflags |= TDP_NOSLEEPING;				\
    -} while (0)
    +#define	THREAD_NO_SLEEPING()		((curthread)->td_no_sleeping++)
     
    -#define	THREAD_SLEEPING_OK() do {					\
    -	KASSERT((curthread->td_pflags & TDP_NOSLEEPING),		\
    -	    ("nested sleeping ok"));					\
    -	curthread->td_pflags &= ~TDP_NOSLEEPING;			\
    -} while (0)
    +#define	THREAD_SLEEPING_OK()		((curthread)->td_no_sleeping--)
     
     #define	PIDHASH(pid)	(&pidhashtbl[(pid) & pidhash])
     extern LIST_HEAD(pidhashhead, proc) *pidhashtbl;
    
    Modified: head/sys/sys/rmlock.h
    ==============================================================================
    --- head/sys/sys/rmlock.h	Fri Mar  1 21:59:23 2013	(r247587)
    +++ head/sys/sys/rmlock.h	Fri Mar  1 22:03:31 2013	(r247588)
    @@ -40,7 +40,7 @@
     #ifdef _KERNEL
     
     /*
    - * Flags passed to rm_init(9).
    + * Flags passed to rm_init_flags(9).
      */
     #define	RM_NOWITNESS	0x00000001
     #define	RM_RECURSE	0x00000002
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 22:05:21 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id A8166F2C;
     Fri,  1 Mar 2013 22:05:21 +0000 (UTC)
     (envelope-from marius@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 82F0B19DD;
     Fri,  1 Mar 2013 22:05:21 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21M5L7V010104;
     Fri, 1 Mar 2013 22:05:21 GMT (envelope-from marius@svn.freebsd.org)
    Received: (from marius@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21M5L6Y010103;
     Fri, 1 Mar 2013 22:05:21 GMT (envelope-from marius@svn.freebsd.org)
    Message-Id: <201303012205.r21M5L6Y010103@svn.freebsd.org>
    From: Marius Strobl 
    Date: Fri, 1 Mar 2013 22:05:21 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247590 - head/sys/dev/bce
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 22:05:21 -0000
    
    Author: marius
    Date: Fri Mar  1 22:05:20 2013
    New Revision: 247590
    URL: http://svnweb.freebsd.org/changeset/base/247590
    
    Log:
      Initialize count in order to appease clang.
      
      Submitted by:	delphij
    
    Modified:
      head/sys/dev/bce/if_bce.c
    
    Modified: head/sys/dev/bce/if_bce.c
    ==============================================================================
    --- head/sys/dev/bce/if_bce.c	Fri Mar  1 22:03:57 2013	(r247589)
    +++ head/sys/dev/bce/if_bce.c	Fri Mar  1 22:05:20 2013	(r247590)
    @@ -1076,6 +1076,7 @@ bce_attach(device_t dev)
     	bce_probe_pci_caps(dev, sc);
     
     	rid = 1;
    +	count = 0;
     #if 0
     	/* Try allocating MSI-X interrupts. */
     	if ((sc->bce_cap_flags & BCE_MSIX_CAPABLE_FLAG) &&
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 22:09:08 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id D4C1E150;
     Fri,  1 Mar 2013 22:09:08 +0000 (UTC)
     (envelope-from marius@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id C36B719F4;
     Fri,  1 Mar 2013 22:09:08 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21M98fm010789;
     Fri, 1 Mar 2013 22:09:08 GMT (envelope-from marius@svn.freebsd.org)
    Received: (from marius@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21M98S4010788;
     Fri, 1 Mar 2013 22:09:08 GMT (envelope-from marius@svn.freebsd.org)
    Message-Id: <201303012209.r21M98S4010788@svn.freebsd.org>
    From: Marius Strobl 
    Date: Fri, 1 Mar 2013 22:09:08 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247591 - head/sys/dev/aac
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 22:09:08 -0000
    
    Author: marius
    Date: Fri Mar  1 22:09:08 2013
    New Revision: 247591
    URL: http://svnweb.freebsd.org/changeset/base/247591
    
    Log:
      Initialize count in order to appease clang.
      
      Submitted by:	delphij
    
    Modified:
      head/sys/dev/aac/aac_pci.c
    
    Modified: head/sys/dev/aac/aac_pci.c
    ==============================================================================
    --- head/sys/dev/aac/aac_pci.c	Fri Mar  1 22:05:20 2013	(r247590)
    +++ head/sys/dev/aac/aac_pci.c	Fri Mar  1 22:09:08 2013	(r247591)
    @@ -394,6 +394,7 @@ aac_pci_attach(device_t dev)
     	 * Allocate the interrupt.
     	 */
     	rid = 0;
    +	count = 0;
     	if (aac_enable_msi != 0 && pci_find_cap(dev, PCIY_MSI, ®) == 0) {
     		count = pci_msi_count(dev);
     		if (count > 1)
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 22:20:14 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 74444397;
     Fri,  1 Mar 2013 22:20:14 +0000 (UTC)
     (envelope-from delphij@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 5D2E41A3E;
     Fri,  1 Mar 2013 22:20:14 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21MKEbT014258;
     Fri, 1 Mar 2013 22:20:14 GMT (envelope-from delphij@svn.freebsd.org)
    Received: (from delphij@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21MKEWl014257;
     Fri, 1 Mar 2013 22:20:14 GMT (envelope-from delphij@svn.freebsd.org)
    Message-Id: <201303012220.r21MKEWl014257@svn.freebsd.org>
    From: Xin LI 
    Date: Fri, 1 Mar 2013 22:20:13 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247592 -
     head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 22:20:14 -0000
    
    Author: delphij
    Date: Fri Mar  1 22:20:13 2013
    New Revision: 247592
    URL: http://svnweb.freebsd.org/changeset/base/247592
    
    Log:
      MFV r247575:
      
      Import a fix tighten assertion on SPA versions from vendor (Illumos).
      
      Illumos ZFS issue:
      
        3543 Feature flags causes assertion in spa.c to miss certain cases
      
      MFC after:	2 weeks
    
    Modified:
      head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
    Directory Properties:
      head/sys/cddl/contrib/opensolaris/   (props changed)
    
    Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
    ==============================================================================
    --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c	Fri Mar  1 22:09:08 2013	(r247591)
    +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c	Fri Mar  1 22:20:13 2013	(r247592)
    @@ -6018,7 +6018,7 @@ spa_sync_version(void *arg1, void *arg2,
     	 */
     	ASSERT(tx->tx_txg != TXG_INITIAL);
     
    -	ASSERT(version <= SPA_VERSION);
    +	ASSERT(SPA_VERSION_IS_SUPPORTED(version));
     	ASSERT(version >= spa_version(spa));
     
     	spa->spa_uberblock.ub_version = version;
    @@ -6559,7 +6559,7 @@ spa_upgrade(spa_t *spa, uint64_t version
     	 * future version would result in an unopenable pool, this shouldn't be
     	 * possible.
     	 */
    -	ASSERT(spa->spa_uberblock.ub_version <= SPA_VERSION);
    +	ASSERT(SPA_VERSION_IS_SUPPORTED(spa->spa_uberblock.ub_version));
     	ASSERT(version >= spa->spa_uberblock.ub_version);
     
     	spa->spa_uberblock.ub_version = version;
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 23:10:00 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id D71AA3A5;
     Fri,  1 Mar 2013 23:10:00 +0000 (UTC)
     (envelope-from asmrookie@gmail.com)
    Received: from mail-ie0-x229.google.com (mail-ie0-x229.google.com
     [IPv6:2607:f8b0:4001:c03::229])
     by mx1.freebsd.org (Postfix) with ESMTP id 900CB1C05;
     Fri,  1 Mar 2013 23:10:00 +0000 (UTC)
    Received: by mail-ie0-f169.google.com with SMTP id 13so4295422iea.0
     for ; Fri, 01 Mar 2013 15:10:00 -0800 (PST)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
     h=mime-version:x-received:reply-to:sender:in-reply-to:references:date
     :x-google-sender-auth:message-id:subject:from:to:cc:content-type;
     bh=mJrTczQxM0XIjOCVC/F6aKZff1EDdDin3ir/qI7CWsg=;
     b=JJj7B73Qvl9YnTt7fxCXEPgH0bxiwpd3xb6k67uGPugzJwOuuGs6sNPjRL2U6upevT
     w4Do2yzIJAAQ1VQLpNy9hI+7p2I+6pWB1aqwaOnb1sD0y4b3hjOQdMNQMGgL4O+1JzpV
     SdN8dwR+0szt64wcWpHtL41KbGmUVhlF9rGxFB9sROJdfE63YKxKSlS3WWvCqTW9jDr3
     WyS8rYNccdU6/ZRCYgxdCEpNmUciZ/w6AHi5gUPYAK2460DqIOAgYebNTNLov84aqyMk
     kGtAOs5u6WbWR772yv96vehdO1emhywm/GS+18F5JD9d9nzEGfc1S0punaDLxhbZ237c
     usCg==
    MIME-Version: 1.0
    X-Received: by 10.42.54.5 with SMTP id p5mr8469565icg.49.1362179400090; Fri,
     01 Mar 2013 15:10:00 -0800 (PST)
    Sender: asmrookie@gmail.com
    Received: by 10.42.117.134 with HTTP; Fri, 1 Mar 2013 15:09:59 -0800 (PST)
    In-Reply-To: <201303012203.r21M3WU8009662@svn.freebsd.org>
    References: <201303012203.r21M3WU8009662@svn.freebsd.org>
    Date: Sat, 2 Mar 2013 00:09:59 +0100
    X-Google-Sender-Auth: tiQbcJt0lrO7FbE-QsUaXLJzNLs
    Message-ID: 
    Subject: Re: svn commit: r247588 - in head/sys: dev/mps kern sys
    From: Attilio Rao 
    To: John Baldwin 
    Content-Type: text/plain; charset=UTF-8
    Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
     src-committers@freebsd.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    Reply-To: attilio@FreeBSD.org
    List-Id: 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, 01 Mar 2013 23:10:00 -0000
    
    On Fri, Mar 1, 2013 at 11:03 PM, John Baldwin  wrote:
    > Author: jhb
    > Date: Fri Mar  1 22:03:31 2013
    > New Revision: 247588
    > URL: http://svnweb.freebsd.org/changeset/base/247588
    >
    > Log:
    >   Replace the TDP_NOSLEEPING flag with a counter so that the
    >   THREAD_NO_SLEEPING() and THREAD_SLEEPING_OK() macros can nest.
    >
    >   Reviewed by:  attilio
    
    My cleanup had some small tweaks like:
    - No trailing white space cleanup in mps
    - td_no_sleeping u_int rather than int
    - s/TDP_UNUSED9/TDP_UNUSED09 (consistency with others definitions)
    - There is no need to use braces around curthread
    
    Also the rmlock part doesn't belong to this patchset.
    
    http://www.freebsd.org/~attilio/jhbnosleep.patch
    
    Attilio
    
    
    -- 
    Peace can only be achieved by understanding - A. Einstein
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 23:18:20 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id CCEB868D;
     Fri,  1 Mar 2013 23:18:20 +0000 (UTC)
     (envelope-from delphij@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id BD0E01C3B;
     Fri,  1 Mar 2013 23:18:20 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21NIKcH032715;
     Fri, 1 Mar 2013 23:18:20 GMT (envelope-from delphij@svn.freebsd.org)
    Received: (from delphij@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21NIKw8032714;
     Fri, 1 Mar 2013 23:18:20 GMT (envelope-from delphij@svn.freebsd.org)
    Message-Id: <201303012318.r21NIKw8032714@svn.freebsd.org>
    From: Xin LI 
    Date: Fri, 1 Mar 2013 23:18:20 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247594 - head/sys/dev/mfi
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 23:18:20 -0000
    
    Author: delphij
    Date: Fri Mar  1 23:18:20 2013
    New Revision: 247594
    URL: http://svnweb.freebsd.org/changeset/base/247594
    
    Log:
      Fix a typo in mfi_stp_cmd() that would give wrong assignment.
      
      Submitted by:	Sascha Wildner 
      Obtained from:	DragonFly rev 0dc98fff2206d7bb78ce5e07ac34d6954e4bd96a
      MFC after:	3 days
    
    Modified:
      head/sys/dev/mfi/mfi.c
    
    Modified: head/sys/dev/mfi/mfi.c
    ==============================================================================
    --- head/sys/dev/mfi/mfi.c	Fri Mar  1 22:40:30 2013	(r247593)
    +++ head/sys/dev/mfi/mfi.c	Fri Mar  1 23:18:20 2013	(r247594)
    @@ -2997,7 +2997,7 @@ mfi_stp_cmd(struct mfi_softc *sc, struct
     			cm->cm_frame->stp.sgl.sg64[i].len =
     			    ioc->mfi_sgl[i].iov_len;
     		} else {
    -			cm->cm_frame->stp.sgl.sg32[i].len =
    +			cm->cm_frame->stp.sgl.sg32[i].addr =
     			    kern_sge[i].phys_addr;
     			cm->cm_frame->stp.sgl.sg32[i].len =
     			    ioc->mfi_sgl[i].iov_len;
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 23:21:19 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id C3956855;
     Fri,  1 Mar 2013 23:21:19 +0000 (UTC)
     (envelope-from delphij@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id AC54A1C5B;
     Fri,  1 Mar 2013 23:21:19 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21NLJk5034725;
     Fri, 1 Mar 2013 23:21:19 GMT (envelope-from delphij@svn.freebsd.org)
    Received: (from delphij@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21NLJtU034724;
     Fri, 1 Mar 2013 23:21:19 GMT (envelope-from delphij@svn.freebsd.org)
    Message-Id: <201303012321.r21NLJtU034724@svn.freebsd.org>
    From: Xin LI 
    Date: Fri, 1 Mar 2013 23:21:19 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247595 - head/sys/compat/ndis
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 23:21:19 -0000
    
    Author: delphij
    Date: Fri Mar  1 23:21:18 2013
    New Revision: 247595
    URL: http://svnweb.freebsd.org/changeset/base/247595
    
    Log:
      Fix wrong assignment.
      
      Submitted by:	Sascha Wildner 
      Obtained from:	DragonFly rev 9568dd07a22a136e380e6c19a8ea188eb92976d5
      MFC after:	2 weeks
    
    Modified:
      head/sys/compat/ndis/kern_ndis.c
    
    Modified: head/sys/compat/ndis/kern_ndis.c
    ==============================================================================
    --- head/sys/compat/ndis/kern_ndis.c	Fri Mar  1 23:18:20 2013	(r247594)
    +++ head/sys/compat/ndis/kern_ndis.c	Fri Mar  1 23:21:18 2013	(r247595)
    @@ -566,7 +566,7 @@ ndis_convert_res(arg)
     		return (ENOMEM);
     
     	rl->cprl_version = 5;
    -	rl->cprl_version = 1;
    +	rl->cprl_revision = 1;
     	rl->cprl_count = sc->ndis_rescnt;
     	prd = rl->cprl_partial_descs;
     
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 23:24:26 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 490809E9;
     Fri,  1 Mar 2013 23:24:26 +0000 (UTC) (envelope-from grog@lemis.com)
    Received: from w3.lemis.com (w3.lemis.com [208.86.224.149])
     by mx1.freebsd.org (Postfix) with ESMTP id F1DBF1C72;
     Fri,  1 Mar 2013 23:24:25 +0000 (UTC)
    Received: from eureka.lemis.com (1032.x.rootbsd.net [208.86.224.149])
     by w3.lemis.com (Postfix) with ESMTP id 369DD3B952;
     Fri,  1 Mar 2013 23:24:18 +0000 (UTC)
    Received: by eureka.lemis.com (Postfix, from userid 1004)
     id 6058DF74FA; Sat,  2 Mar 2013 10:24:14 +1100 (EST)
    Date: Sat, 2 Mar 2013 10:24:14 +1100
    From: Greg 'groggy' Lehey 
    To: Chris Rees 
    Subject: Re: svn commit: r247274 - in head: bin/test tools/regression/bin/test
    Message-ID: <20130301232414.GO7223@eureka.lemis.com>
    References: <201302251905.r1PJ5fKF085179@svn.freebsd.org>
     <20130226000227.GA80718@stack.nl>
     <20130227082548.GF99210@server.rulingia.com>
     <20130301142633.GA49921@stack.nl>
     
    Mime-Version: 1.0
    Content-Type: multipart/signed; micalg=pgp-sha1;
     protocol="application/pgp-signature"; boundary="8RsyD0KswhpoK73Z"
    Content-Disposition: inline
    In-Reply-To: 
    User-Agent: Mutt/1.4.2.3i
    Organization: The FreeBSD Project
    Phone: +61-3-5346-1370
    Mobile: +61-418-838-708
    WWW-Home-Page: http://www.FreeBSD.org/
    X-PGP-Fingerprint: 9A1B 8202 BCCE B846 F92F  09AC 22E6 F290 507A 4223
    Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
     src-committers@freebsd.org, Peter Jeremy ,
     Jilles Tjoelker 
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 23:24:26 -0000
    
    
    --8RsyD0KswhpoK73Z
    Content-Type: text/plain; charset=us-ascii
    Content-Disposition: inline
    
    On Friday,  1 March 2013 at 17:13:45 +0000, Chris Rees wrote:
    > On 1 Mar 2013 14:27, "Jilles Tjoelker"  wrote:
    >> The find(1) and stat(1) approaches also work in other shells such as
    >> bash, ksh and zsh. An extension to test(1) can only be used by writing
    >> ugly things like /bin/test. Whatever you may think of it, people write
    >> scripts for those other shells and it is somewhat unfortunate that they
    >> cannot use all FreeBSD-specific features.
    >
    > +1
    >
    > While I'm aware that we have many very useful extensions to sh, we
    > should not sacrifice portability.
    
    This doesn't sacrifice portability.  If you're aiming for complete
    portability, you may choose not to use these extensions, or to find
    alternatives for non-FreeBSD systems.  This goes for just about every
    utility.
    
    > We (porters) are on thin ground when complaining at upstream for
    > assuming /bin/sh is bash when we have extensions such as these.
    
    There's a difference between having extensions and expecting them to
    be present everywhere.  But you have a point: it should be documented
    that these extensions (and also <, >, -nt, -ot and -ef) are not
    portable.
    
    Greg
    --
    Sent from my desktop computer.
    Finger grog@FreeBSD.org for PGP public key.
    See complete headers for address and phone numbers.
    This message is digitally signed.  If your Microsoft MUA reports
    problems, please read http://tinyurl.com/broken-mua
    
    --8RsyD0KswhpoK73Z
    Content-Type: application/pgp-signature
    Content-Disposition: inline
    
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.19 (FreeBSD)
    
    iEYEARECAAYFAlExOJ0ACgkQIubykFB6QiMy6ACdGQB9OTQRtNA5oxWcQeTBV4RP
    WHIAnjjthY1lzHsSlbmADE1qfG09LID7
    =x2mO
    -----END PGP SIGNATURE-----
    
    --8RsyD0KswhpoK73Z--
    
    From owner-svn-src-head@FreeBSD.ORG  Fri Mar  1 23:26:13 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id D9483B8C;
     Fri,  1 Mar 2013 23:26:13 +0000 (UTC)
     (envelope-from delphij@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id C14AD1C8A;
     Fri,  1 Mar 2013 23:26:13 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21NQD8m035440;
     Fri, 1 Mar 2013 23:26:13 GMT (envelope-from delphij@svn.freebsd.org)
    Received: (from delphij@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21NQDFT035439;
     Fri, 1 Mar 2013 23:26:13 GMT (envelope-from delphij@svn.freebsd.org)
    Message-Id: <201303012326.r21NQDFT035439@svn.freebsd.org>
    From: Xin LI 
    Date: Fri, 1 Mar 2013 23:26:13 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247596 - head/lib/libc/regex
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 01 Mar 2013 23:26:13 -0000
    
    Author: delphij
    Date: Fri Mar  1 23:26:13 2013
    New Revision: 247596
    URL: http://svnweb.freebsd.org/changeset/base/247596
    
    Log:
      Fix assignment of maximum bounadary.
      
      Submitted by:	Sascha Wildner 
      Obtained from:	DragonFly rev fd39c81ba220f7ad6e4dc9b30d45e828cf58a1ad
      MFC after:	2 weeks
    
    Modified:
      head/lib/libc/regex/regcomp.c
    
    Modified: head/lib/libc/regex/regcomp.c
    ==============================================================================
    --- head/lib/libc/regex/regcomp.c	Fri Mar  1 23:21:18 2013	(r247595)
    +++ head/lib/libc/regex/regcomp.c	Fri Mar  1 23:26:13 2013	(r247596)
    @@ -1212,7 +1212,7 @@ CHaddrange(struct parse *p, cset *cs, wi
     	}
     	cs->ranges = newranges;
     	cs->ranges[cs->nranges].min = min;
    -	cs->ranges[cs->nranges].min = max;
    +	cs->ranges[cs->nranges].max = max;
     	cs->nranges++;
     }
     
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 00:11:28 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 8DB8B4F4;
     Sat,  2 Mar 2013 00:11:28 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 748FF1DFC;
     Sat,  2 Mar 2013 00:11:28 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r220BSYv050400;
     Sat, 2 Mar 2013 00:11:28 GMT (envelope-from pjd@svn.freebsd.org)
    Received: (from pjd@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r220BRPg050395;
     Sat, 2 Mar 2013 00:11:27 GMT (envelope-from pjd@svn.freebsd.org)
    Message-Id: <201303020011.r220BRPg050395@svn.freebsd.org>
    From: Pawel Jakub Dawidek 
    Date: Sat, 2 Mar 2013 00:11:27 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247598 - in head/lib/libc: gen sys
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 00:11:28 -0000
    
    Author: pjd
    Date: Sat Mar  2 00:11:27 2013
    New Revision: 247598
    URL: http://svnweb.freebsd.org/changeset/base/247598
    
    Log:
      Provide cap_sandboxed(3) function, which is a wrapper around cap_getmode(2)
      system call, which has a nice property - it never fails, so it is a bit
      easier to use. If there is no support for capability mode in the kernel
      the function will return false (not in a sandbox). If the kernel is compiled
      with the support for capability mode, the function will return true or false
      depending if the calling process is in the capability mode sandbox or not
      respectively.
      
      Sponsored by:	The FreeBSD Foundation
    
    Added:
      head/lib/libc/gen/cap_sandboxed.3   (contents, props changed)
      head/lib/libc/gen/cap_sandboxed.c   (contents, props changed)
    Modified:
      head/lib/libc/gen/Makefile.inc
      head/lib/libc/sys/Symbol.map
      head/lib/libc/sys/cap_enter.2
    
    Modified: head/lib/libc/gen/Makefile.inc
    ==============================================================================
    --- head/lib/libc/gen/Makefile.inc	Sat Mar  2 00:04:07 2013	(r247597)
    +++ head/lib/libc/gen/Makefile.inc	Sat Mar  2 00:11:27 2013	(r247598)
    @@ -16,6 +16,7 @@ SRCS+=	__getosreldate.c \
     	assert.c \
     	auxv.c \
     	basename.c \
    +	cap_sandboxed.c \
     	check_utility_compat.c \
     	clock.c \
     	clock_getcpuclockid.c \
    @@ -168,6 +169,7 @@ SYM_MAPS+=${.CURDIR}/gen/Symbol.map
     MAN+=	alarm.3 \
     	arc4random.3 \
     	basename.3 \
    +	cap_sandboxed.3 \
     	check_utility_compat.3 \
     	clock.3 \
     	clock_getcpuclockid.3 \
    
    Added: head/lib/libc/gen/cap_sandboxed.3
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/lib/libc/gen/cap_sandboxed.3	Sat Mar  2 00:11:27 2013	(r247598)
    @@ -0,0 +1,70 @@
    +.\" Copyright (c) 2012 The FreeBSD Foundation
    +.\" All rights reserved.
    +.\"
    +.\" This documentation was written by Pawel Jakub Dawidek under sponsorship
    +.\" from the FreeBSD Foundation.
    +.\"
    +.\" Redistribution and use in source and binary forms, with or without
    +.\" modification, are permitted provided that the following conditions
    +.\" are met:
    +.\" 1. Redistributions of source code must retain the above copyright
    +.\"    notice, this list of conditions and the following disclaimer.
    +.\" 2. 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 September 18, 2012
    +.Dt CAP_SANDBOXED 3
    +.Os
    +.Sh NAME
    +.Nm cap_sandboxed
    +.Nd Check if in a capability mode sandbox
    +.Sh LIBRARY
    +.Lb libc
    +.Sh SYNOPSIS
    +.In sys/capability.h
    +.In stdbool.h
    +.Ft bool
    +.Fn cap_sandboxed "void"
    +.Sh DESCRIPTION
    +.Fn cap_sandboxed
    +returns
    +.Va true
    +if the process is in a capability mode sandbox or
    +.Va false
    +if it is not.
    +This function is a more handy alternative to the
    +.Xr cap_getmode 2
    +system call as it always succeeds, so there is no need for error checking.
    +If the support for capability mode is not compiled into the kernel,
    +.Fn cap_sandboxed
    +will always return
    +.Va false .
    +.Sh RETURN VALUES
    +Function
    +.Fn cap_sandboxed
    +is always successful and will return either
    +.Va true
    +or
    +.Va false .
    +.Sh SEE ALSO
    +.Xr cap_enter 2 ,
    +.Xr capsicum 4
    +.Sh AUTHORS
    +This function was implemented and manual page was written by
    +.An Pawel Jakub Dawidek Aq pawel@dawidek.net
    +under sponsorship of the FreeBSD Foundation.
    
    Added: head/lib/libc/gen/cap_sandboxed.c
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/lib/libc/gen/cap_sandboxed.c	Sat Mar  2 00:11:27 2013	(r247598)
    @@ -0,0 +1,50 @@
    +/*-
    + * Copyright (c) 2012 The FreeBSD Foundation
    + * All rights reserved.
    + *
    + * This software was developed by Pawel Jakub Dawidek under sponsorship from
    + * the FreeBSD Foundation.
    + *
    + * Redistribution and use in source and binary forms, with or without
    + * modification, are permitted provided that the following conditions
    + * are met:
    + * 1. Redistributions of source code must retain the above copyright
    + *    notice, this list of conditions and the following disclaimer.
    + * 2. 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 AUTHORS 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 AUTHORS 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 
    +
    +bool
    +cap_sandboxed(void)
    +{
    +	u_int mode;
    +
    +	if (cap_getmode(&mode) != 0) {
    +		assert(errno == ENOSYS);
    +		return (false);
    +	}
    +	assert(mode == 0 || mode == 1);
    +	return (mode == 1);
    +}
    
    Modified: head/lib/libc/sys/Symbol.map
    ==============================================================================
    --- head/lib/libc/sys/Symbol.map	Sat Mar  2 00:04:07 2013	(r247597)
    +++ head/lib/libc/sys/Symbol.map	Sat Mar  2 00:11:27 2013	(r247598)
    @@ -379,6 +379,7 @@ FBSD_1.2 {
     };
     
     FBSD_1.3 {
    +	cap_sandboxed;
     	clock_getcpuclockid2;
     	ffclock_getcounter;
     	ffclock_getestimate;
    
    Modified: head/lib/libc/sys/cap_enter.2
    ==============================================================================
    --- head/lib/libc/sys/cap_enter.2	Sat Mar  2 00:04:07 2013	(r247597)
    +++ head/lib/libc/sys/cap_enter.2	Sat Mar  2 00:11:27 2013	(r247598)
    @@ -90,6 +90,7 @@ acquired rights as possible.
     .Sh SEE ALSO
     .Xr cap_new 2 ,
     .Xr fexecve 2 ,
    +.Xr cap_sandboxed 3 ,
     .Xr capsicum 4
     .Sh HISTORY
     Support for capabilities and capabilities mode was developed as part of the
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 00:37:32 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id BD9DE9F1;
     Sat,  2 Mar 2013 00:37:32 +0000 (UTC)
     (envelope-from marius@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id AFB331EC0;
     Sat,  2 Mar 2013 00:37:32 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r220bWta057331;
     Sat, 2 Mar 2013 00:37:32 GMT (envelope-from marius@svn.freebsd.org)
    Received: (from marius@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r220bWJg057328;
     Sat, 2 Mar 2013 00:37:32 GMT (envelope-from marius@svn.freebsd.org)
    Message-Id: <201303020037.r220bWJg057328@svn.freebsd.org>
    From: Marius Strobl 
    Date: Sat, 2 Mar 2013 00:37:32 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247600 - in head/sys: conf sparc64/pci
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 00:37:32 -0000
    
    Author: marius
    Date: Sat Mar  2 00:37:31 2013
    New Revision: 247600
    URL: http://svnweb.freebsd.org/changeset/base/247600
    
    Log:
      - While Netra X1 generally show no ill effects when registering a power
        fail interrupt handler, there seems to be either a broken batch of them
        or a tendency to develop a defect which causes this interrupt to fire
        inadvertedly. Given that apart from this problem these machines work
        just fine, add a tunable allowing the setup of the power fail interrupt
        to be disabled.
        While at it, remove the DEBUGGER_ON_POWERFAIL compile time option and
        make that behavior also selectable via the newly added tunable.
      - Apparently, it's no longer a problem to call shutdown_nice(9) from within
        an interrupt filter (some other drivers in the tree do the same). So
        change the power fail interrupt from an handler in order to simplify the
        code and get rid of a !INTR_MPSAFE handler.
      - Use NULL instead of 0 for pointers.
      
      MFC after:	1 week
    
    Modified:
      head/sys/conf/options.sparc64
      head/sys/sparc64/pci/psycho.c
    
    Modified: head/sys/conf/options.sparc64
    ==============================================================================
    --- head/sys/conf/options.sparc64	Sat Mar  2 00:21:29 2013	(r247599)
    +++ head/sys/conf/options.sparc64	Sat Mar  2 00:37:31 2013	(r247600)
    @@ -23,7 +23,6 @@ PSM_DEBUG		opt_psm.h
     PSM_HOOKRESUME		opt_psm.h
     PSM_RESETAFTERSUSPEND	opt_psm.h
     
    -DEBUGGER_ON_POWERFAIL	opt_psycho.h
     PSYCHO_DEBUG		opt_psycho.h
     
     SCHIZO_DEBUG		opt_schizo.h
    
    Modified: head/sys/sparc64/pci/psycho.c
    ==============================================================================
    --- head/sys/sparc64/pci/psycho.c	Sat Mar  2 00:21:29 2013	(r247599)
    +++ head/sys/sparc64/pci/psycho.c	Sat Mar  2 00:37:31 2013	(r247600)
    @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    +#include 
     
     #include 
     #include 
    @@ -80,7 +81,7 @@ static const struct psycho_desc *psycho_
         const char *);
     static const struct psycho_desc *psycho_get_desc(device_t);
     static void psycho_set_intr(struct psycho_softc *, u_int, bus_addr_t,
    -    driver_filter_t, driver_intr_t);
    +    driver_filter_t);
     static int psycho_find_intrmap(struct psycho_softc *, u_int, bus_addr_t *,
         bus_addr_t *, u_long *);
     static void sabre_dmamap_sync(bus_dma_tag_t dt, bus_dmamap_t map,
    @@ -94,8 +95,9 @@ static void psycho_intr_clear(void *);
     static driver_filter_t psycho_ue;
     static driver_filter_t psycho_ce;
     static driver_filter_t psycho_pci_bus;
    -static driver_filter_t psycho_powerfail;
    -static driver_intr_t psycho_overtemp;
    +static driver_filter_t psycho_powerdebug;
    +static driver_filter_t psycho_powerdown;
    +static driver_filter_t psycho_overtemp;
     #ifdef PSYCHO_MAP_WAKEUP
     static driver_filter_t psycho_wakeup;
     #endif
    @@ -159,9 +161,16 @@ static devclass_t psycho_devclass;
     
     DEFINE_CLASS_0(pcib, psycho_driver, psycho_methods,
         sizeof(struct psycho_softc));
    -EARLY_DRIVER_MODULE(psycho, nexus, psycho_driver, psycho_devclass, 0, 0,
    +EARLY_DRIVER_MODULE(psycho, nexus, psycho_driver, psycho_devclass, NULL, NULL,
         BUS_PASS_BUS);
     
    +static SYSCTL_NODE(_hw, OID_AUTO, psycho, CTLFLAG_RD, 0, "psycho parameters");
    +
    +static u_int psycho_powerfail = 1;
    +TUNABLE_INT("hw.psycho.powerfail", &psycho_powerfail);
    +SYSCTL_UINT(_hw_psycho, OID_AUTO, powerfail, CTLFLAG_RDTUN, &psycho_powerfail,
    +    0, "powerfail action (0: none, 1: shutdown (default), 2: debugger)");
    +
     static SLIST_HEAD(, psycho_softc) psycho_softcs =
         SLIST_HEAD_INITIALIZER(psycho_softcs);
     
    @@ -610,15 +619,20 @@ psycho_attach(device_t dev)
     		 * XXX Not all controllers have these, but installing them
     		 * is better than trying to sort through this mess.
     		 */
    -		psycho_set_intr(sc, 1, PSR_UE_INT_MAP, psycho_ue, NULL);
    -		psycho_set_intr(sc, 2, PSR_CE_INT_MAP, psycho_ce, NULL);
    -#ifdef DEBUGGER_ON_POWERFAIL
    -		psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, psycho_powerfail,
    -		    NULL);
    -#else
    -		psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, NULL,
    -		    (driver_intr_t *)psycho_powerfail);
    -#endif
    +		psycho_set_intr(sc, 1, PSR_UE_INT_MAP, psycho_ue);
    +		psycho_set_intr(sc, 2, PSR_CE_INT_MAP, psycho_ce);
    +		switch (psycho_powerfail) {
    +		case 0:
    +			break;
    +		case 2:
    +			psycho_set_intr(sc, 3, PSR_POWER_INT_MAP,
    +			    psycho_powerdebug);
    +			break;
    +		default:
    +			psycho_set_intr(sc, 3, PSR_POWER_INT_MAP,
    +			    psycho_powerdown);
    +			break;
    +		}
     		if (sc->sc_mode == PSYCHO_MODE_PSYCHO) {
     			/*
     			 * Hummingbirds/Sabres do not have the following two
    @@ -630,14 +644,14 @@ psycho_attach(device_t dev)
     			 * over-temperature interrupt.
     			 */
     			psycho_set_intr(sc, 4, PSR_SPARE_INT_MAP,
    -			    NULL, psycho_overtemp);
    +			    psycho_overtemp);
     #ifdef PSYCHO_MAP_WAKEUP
     			/*
     			 * psycho_wakeup() doesn't do anything useful right
     			 * now.
     			 */
     			psycho_set_intr(sc, 5, PSR_PWRMGT_INT_MAP,
    -			    psycho_wakeup, NULL);
    +			    psycho_wakeup);
     #endif /* PSYCHO_MAP_WAKEUP */
     		}
     	}
    @@ -647,7 +661,7 @@ psycho_attach(device_t dev)
     	 * interrupt but they are also only used for PCI bus A.
     	 */
     	psycho_set_intr(sc, 0, sc->sc_half == 0 ? PSR_PCIAERR_INT_MAP :
    -	    PSR_PCIBERR_INT_MAP, psycho_pci_bus, NULL);
    +	    PSR_PCIBERR_INT_MAP, psycho_pci_bus);
     
     	/*
     	 * Set the latency timer register as this isn't always done by the
    @@ -687,7 +701,7 @@ psycho_attach(device_t dev)
     
     static void
     psycho_set_intr(struct psycho_softc *sc, u_int index, bus_addr_t intrmap,
    -    driver_filter_t filt, driver_intr_t intr)
    +    driver_filter_t handler)
     {
     	u_long vec;
     	int rid;
    @@ -708,7 +722,7 @@ psycho_set_intr(struct psycho_softc *sc,
     	    INTVEC(PSYCHO_READ8(sc, intrmap)) != vec ||
     	    intr_vectors[vec].iv_ic != &psycho_ic ||
     	    bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index],
    -	    INTR_TYPE_MISC | INTR_BRIDGE, filt, intr, sc,
    +	    INTR_TYPE_MISC | INTR_BRIDGE, handler, NULL, sc,
     	    &sc->sc_ihand[index]) != 0)
     		panic("%s: failed to set up interrupt %d", __func__, index);
     }
    @@ -837,13 +851,16 @@ psycho_pci_bus(void *arg)
     }
     
     static int
    -psycho_powerfail(void *arg)
    +psycho_powerdebug(void *arg __unused)
     {
    -#ifdef DEBUGGER_ON_POWERFAIL
    -	struct psycho_softc *sc = arg;
     
     	kdb_enter(KDB_WHY_POWERFAIL, "powerfail");
    -#else
    +	return (FILTER_HANDLED);
    +}
    +
    +static int
    +psycho_powerdown(void *arg __unused)
    +{
     	static int shutdown;
     
     	/* As the interrupt is cleared we may be called multiple times. */
    @@ -851,22 +868,22 @@ psycho_powerfail(void *arg)
     		return (FILTER_HANDLED);
     	shutdown++;
     	printf("Power Failure Detected: Shutting down NOW.\n");
    -	shutdown_nice(0);
    -#endif
    +	shutdown_nice(RB_POWEROFF);
     	return (FILTER_HANDLED);
     }
     
    -static void
    -psycho_overtemp(void *arg)
    +static int
    +psycho_overtemp(void *arg __unused)
     {
     	static int shutdown;
     
     	/* As the interrupt is cleared we may be called multiple times. */
     	if (shutdown != 0)
    -		return;
    +		return (FILTER_HANDLED);
     	shutdown++;
     	printf("DANGER: OVER TEMPERATURE detected.\nShutting down NOW.\n");
     	shutdown_nice(RB_POWEROFF);
    +	return (FILTER_HANDLED);
     }
     
     #ifdef PSYCHO_MAP_WAKEUP
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 00:41:53 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 0DD86C6C;
     Sat,  2 Mar 2013 00:41:53 +0000 (UTC)
     (envelope-from marius@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id E9E1A1EE3;
     Sat,  2 Mar 2013 00:41:52 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r220fqwh059800;
     Sat, 2 Mar 2013 00:41:52 GMT (envelope-from marius@svn.freebsd.org)
    Received: (from marius@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r220fq5N059799;
     Sat, 2 Mar 2013 00:41:52 GMT (envelope-from marius@svn.freebsd.org)
    Message-Id: <201303020041.r220fq5N059799@svn.freebsd.org>
    From: Marius Strobl 
    Date: Sat, 2 Mar 2013 00:41:52 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247601 - head/sys/sparc64/sbus
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 00:41:53 -0000
    
    Author: marius
    Date: Sat Mar  2 00:41:51 2013
    New Revision: 247601
    URL: http://svnweb.freebsd.org/changeset/base/247601
    
    Log:
      - Apparently, it's no longer a problem to call shutdown_nice(9) from within
        an interrupt filter (some other drivers in the tree do the same). So
        change the overtemperature and power fail interrupts from handlers in order
        to code and get rid of a !INTR_MPSAFE handlers.
      - Mark unused parameters as such.
      - Use NULL instead of 0 for pointers.
      
      MFC after:	1 week
    
    Modified:
      head/sys/sparc64/sbus/sbus.c
    
    Modified: head/sys/sparc64/sbus/sbus.c
    ==============================================================================
    --- head/sys/sparc64/sbus/sbus.c	Sat Mar  2 00:37:31 2013	(r247600)
    +++ head/sys/sparc64/sbus/sbus.c	Sat Mar  2 00:41:51 2013	(r247601)
    @@ -152,8 +152,8 @@ static void sbus_intr_assign(void *);
     static void sbus_intr_clear(void *);
     static int sbus_find_intrmap(struct sbus_softc *, u_int, bus_addr_t *,
         bus_addr_t *);
    -static driver_intr_t sbus_overtemp;
    -static driver_intr_t sbus_pwrfail;
    +static driver_filter_t sbus_overtemp;
    +static driver_filter_t sbus_pwrfail;
     static int sbus_print_res(struct sbus_devinfo *);
     
     static device_method_t sbus_methods[] = {
    @@ -199,7 +199,7 @@ static driver_t sbus_driver = {
     
     static devclass_t sbus_devclass;
     
    -EARLY_DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, 0, 0,
    +EARLY_DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, NULL, NULL,
         BUS_PASS_BUS);
     MODULE_DEPEND(sbus, nexus, 1, 1, 1);
     MODULE_VERSION(sbus, 1);
    @@ -410,7 +410,7 @@ sbus_attach(device_t dev)
     	    INTVEC(SYSIO_READ8(sc, SBR_THERM_INT_MAP)) != vec ||
     	    intr_vectors[vec].iv_ic != &sbus_ic ||
     	    bus_setup_intr(dev, sc->sc_ot_ires, INTR_TYPE_MISC | INTR_BRIDGE,
    -	    NULL, sbus_overtemp, sc, &sc->sc_ot_ihand) != 0)
    +	    sbus_overtemp, NULL, sc, &sc->sc_ot_ihand) != 0)
     		panic("%s: failed to set up temperature interrupt", __func__);
     	i = 3;
     	sc->sc_pf_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i,
    @@ -420,7 +420,7 @@ sbus_attach(device_t dev)
     	    INTVEC(SYSIO_READ8(sc, SBR_POWER_INT_MAP)) != vec ||
     	    intr_vectors[vec].iv_ic != &sbus_ic ||
     	    bus_setup_intr(dev, sc->sc_pf_ires, INTR_TYPE_MISC | INTR_BRIDGE,
    -	    NULL, sbus_pwrfail, sc, &sc->sc_pf_ihand) != 0)
    +	    sbus_pwrfail, NULL, sc, &sc->sc_pf_ihand) != 0)
     		panic("%s: failed to set up power fail interrupt", __func__);
     
     	/* Initialize the counter-timer. */
    @@ -897,31 +897,33 @@ sbus_get_devinfo(device_t bus, device_t 
      * This handles the interrupt and powers off the machine.
      * The same needs to be done to PCI controller drivers.
      */
    -static void
    -sbus_overtemp(void *arg)
    +static int
    +sbus_overtemp(void *arg __unused)
     {
     	static int shutdown;
     
     	/* As the interrupt is cleared we may be called multiple times. */
     	if (shutdown != 0)
    -		return;
    +		return (FILTER_HANDLED);
     	shutdown++;
     	printf("DANGER: OVER TEMPERATURE detected\nShutting down NOW.\n");
     	shutdown_nice(RB_POWEROFF);
    +	return (FILTER_HANDLED);
     }
     
     /* Try to shut down in time in case of power failure. */
    -static void
    -sbus_pwrfail(void *arg)
    +static int
    +sbus_pwrfail(void *arg __unused)
     {
     	static int shutdown;
     
     	/* As the interrupt is cleared we may be called multiple times. */
     	if (shutdown != 0)
    -		return;
    +		return (FILTER_HANDLED);
     	shutdown++;
     	printf("Power failure detected\nShutting down NOW.\n");
    -	shutdown_nice(0);
    +	shutdown_nice(FILTER_HANDLED);
    +	return (FILTER_HANDLED);
     }
     
     static int
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 00:53:14 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id EF6687B;
     Sat,  2 Mar 2013 00:53:14 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id DFB611F3C;
     Sat,  2 Mar 2013 00:53:14 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r220rEmT063453;
     Sat, 2 Mar 2013 00:53:14 GMT (envelope-from pjd@svn.freebsd.org)
    Received: (from pjd@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r220rDU7063441;
     Sat, 2 Mar 2013 00:53:13 GMT (envelope-from pjd@svn.freebsd.org)
    Message-Id: <201303020053.r220rDU7063441@svn.freebsd.org>
    From: Pawel Jakub Dawidek 
    Date: Sat, 2 Mar 2013 00:53:13 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247602 - in head: contrib/openbsm/etc lib/libc/include
     lib/libc/sys lib/libprocstat sys/bsm sys/cddl/compat/opensolaris/sys
     sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/fr...
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 00:53:15 -0000
    
    Author: pjd
    Date: Sat Mar  2 00:53:12 2013
    New Revision: 247602
    URL: http://svnweb.freebsd.org/changeset/base/247602
    
    Log:
      Merge Capsicum overhaul:
      
      - Capability is no longer separate descriptor type. Now every descriptor
        has set of its own capability rights.
      
      - The cap_new(2) system call is left, but it is no longer documented and
        should not be used in new code.
      
      - The new syscall cap_rights_limit(2) should be used instead of
        cap_new(2), which limits capability rights of the given descriptor
        without creating a new one.
      
      - The cap_getrights(2) syscall is renamed to cap_rights_get(2).
      
      - If CAP_IOCTL capability right is present we can further reduce allowed
        ioctls list with the new cap_ioctls_limit(2) syscall. List of allowed
        ioctls can be retrived with cap_ioctls_get(2) syscall.
      
      - If CAP_FCNTL capability right is present we can further reduce fcntls
        that can be used with the new cap_fcntls_limit(2) syscall and retrive
        them with cap_fcntls_get(2).
      
      - To support ioctl and fcntl white-listing the filedesc structure was
        heavly modified.
      
      - The audit subsystem, kdump and procstat tools were updated to
        recognize new syscalls.
      
      - Capability rights were revised and eventhough I tried hard to provide
        backward API and ABI compatibility there are some incompatible changes
        that are described in detail below:
      
      	CAP_CREATE old behaviour:
      	- Allow for openat(2)+O_CREAT.
      	- Allow for linkat(2).
      	- Allow for symlinkat(2).
      	CAP_CREATE new behaviour:
      	- Allow for openat(2)+O_CREAT.
      
      	Added CAP_LINKAT:
      	- Allow for linkat(2). ABI: Reuses CAP_RMDIR bit.
      	- Allow to be target for renameat(2).
      
      	Added CAP_SYMLINKAT:
      	- Allow for symlinkat(2).
      
      	Removed CAP_DELETE. Old behaviour:
      	- Allow for unlinkat(2) when removing non-directory object.
      	- Allow to be source for renameat(2).
      
      	Removed CAP_RMDIR. Old behaviour:
      	- Allow for unlinkat(2) when removing directory.
      
      	Added CAP_RENAMEAT:
      	- Required for source directory for the renameat(2) syscall.
      
      	Added CAP_UNLINKAT (effectively it replaces CAP_DELETE and CAP_RMDIR):
      	- Allow for unlinkat(2) on any object.
      	- Required if target of renameat(2) exists and will be removed by this
      	  call.
      
      	Removed CAP_MAPEXEC.
      
      	CAP_MMAP old behaviour:
      	- Allow for mmap(2) with any combination of PROT_NONE, PROT_READ and
      	  PROT_WRITE.
      	CAP_MMAP new behaviour:
      	- Allow for mmap(2)+PROT_NONE.
      
      	Added CAP_MMAP_R:
      	- Allow for mmap(PROT_READ).
      	Added CAP_MMAP_W:
      	- Allow for mmap(PROT_WRITE).
      	Added CAP_MMAP_X:
      	- Allow for mmap(PROT_EXEC).
      	Added CAP_MMAP_RW:
      	- Allow for mmap(PROT_READ | PROT_WRITE).
      	Added CAP_MMAP_RX:
      	- Allow for mmap(PROT_READ | PROT_EXEC).
      	Added CAP_MMAP_WX:
      	- Allow for mmap(PROT_WRITE | PROT_EXEC).
      	Added CAP_MMAP_RWX:
      	- Allow for mmap(PROT_READ | PROT_WRITE | PROT_EXEC).
      
      	Renamed CAP_MKDIR to CAP_MKDIRAT.
      	Renamed CAP_MKFIFO to CAP_MKFIFOAT.
      	Renamed CAP_MKNODE to CAP_MKNODEAT.
      
      	CAP_READ old behaviour:
      	- Allow pread(2).
      	- Disallow read(2), readv(2) (if there is no CAP_SEEK).
      	CAP_READ new behaviour:
      	- Allow read(2), readv(2).
      	- Disallow pread(2) (CAP_SEEK was also required).
      
      	CAP_WRITE old behaviour:
      	- Allow pwrite(2).
      	- Disallow write(2), writev(2) (if there is no CAP_SEEK).
      	CAP_WRITE new behaviour:
      	- Allow write(2), writev(2).
      	- Disallow pwrite(2) (CAP_SEEK was also required).
      
      	Added convinient defines:
      
      	#define	CAP_PREAD		(CAP_SEEK | CAP_READ)
      	#define	CAP_PWRITE		(CAP_SEEK | CAP_WRITE)
      	#define	CAP_MMAP_R		(CAP_MMAP | CAP_SEEK | CAP_READ)
      	#define	CAP_MMAP_W		(CAP_MMAP | CAP_SEEK | CAP_WRITE)
      	#define	CAP_MMAP_X		(CAP_MMAP | CAP_SEEK | 0x0000000000000008ULL)
      	#define	CAP_MMAP_RW		(CAP_MMAP_R | CAP_MMAP_W)
      	#define	CAP_MMAP_RX		(CAP_MMAP_R | CAP_MMAP_X)
      	#define	CAP_MMAP_WX		(CAP_MMAP_W | CAP_MMAP_X)
      	#define	CAP_MMAP_RWX		(CAP_MMAP_R | CAP_MMAP_W | CAP_MMAP_X)
      	#define	CAP_RECV		CAP_READ
      	#define	CAP_SEND		CAP_WRITE
      
      	#define	CAP_SOCK_CLIENT \
      		(CAP_CONNECT | CAP_GETPEERNAME | CAP_GETSOCKNAME | CAP_GETSOCKOPT | \
      		 CAP_PEELOFF | CAP_RECV | CAP_SEND | CAP_SETSOCKOPT | CAP_SHUTDOWN)
      	#define	CAP_SOCK_SERVER \
      		(CAP_ACCEPT | CAP_BIND | CAP_GETPEERNAME | CAP_GETSOCKNAME | \
      		 CAP_GETSOCKOPT | CAP_LISTEN | CAP_PEELOFF | CAP_RECV | CAP_SEND | \
      		 CAP_SETSOCKOPT | CAP_SHUTDOWN)
      
      	Added defines for backward API compatibility:
      
      	#define	CAP_MAPEXEC		CAP_MMAP_X
      	#define	CAP_DELETE		CAP_UNLINKAT
      	#define	CAP_MKDIR		CAP_MKDIRAT
      	#define	CAP_RMDIR		CAP_UNLINKAT
      	#define	CAP_MKFIFO		CAP_MKFIFOAT
      	#define	CAP_MKNOD		CAP_MKNODAT
      	#define	CAP_SOCK_ALL		(CAP_SOCK_CLIENT | CAP_SOCK_SERVER)
      
      Sponsored by:	The FreeBSD Foundation
      Reviewed by:	Christoph Mallon 
      Many aspects discussed with:	rwatson, benl, jonathan
      ABI compatibility discussed with:	kib
    
    Added:
      head/lib/libc/sys/cap_fcntls_limit.2   (contents, props changed)
      head/lib/libc/sys/cap_ioctls_limit.2   (contents, props changed)
      head/lib/libc/sys/cap_rights_limit.2   (contents, props changed)
    Deleted:
      head/lib/libc/sys/cap_new.2
    Modified:
      head/contrib/openbsm/etc/audit_event
      head/lib/libc/include/compat.h
      head/lib/libc/sys/Makefile.inc
      head/lib/libc/sys/Symbol.map
      head/lib/libc/sys/cap_enter.2
      head/lib/libc/sys/dup.2
      head/lib/libprocstat/libprocstat.c
      head/lib/libprocstat/libprocstat.h
      head/sys/bsm/audit_kevents.h
      head/sys/cddl/compat/opensolaris/sys/file.h
      head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
      head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_onexit.c
      head/sys/compat/freebsd32/syscalls.master
      head/sys/compat/linux/linux_file.c
      head/sys/compat/svr4/svr4_fcntl.c
      head/sys/compat/svr4/svr4_filio.c
      head/sys/compat/svr4/svr4_misc.c
      head/sys/compat/svr4/svr4_stream.c
      head/sys/dev/iscsi/initiator/iscsi.c
      head/sys/fs/fdescfs/fdesc_vfsops.c
      head/sys/fs/fdescfs/fdesc_vnops.c
      head/sys/fs/nfs/nfsdport.h
      head/sys/fs/nfsclient/nfs_clport.c
      head/sys/fs/nfsserver/nfs_nfsdport.c
      head/sys/i386/ibcs2/ibcs2_misc.c
      head/sys/kern/capabilities.conf
      head/sys/kern/kern_descrip.c
      head/sys/kern/kern_exec.c
      head/sys/kern/kern_exit.c
      head/sys/kern/kern_fork.c
      head/sys/kern/sys_capability.c
      head/sys/kern/sys_generic.c
      head/sys/kern/syscalls.master
      head/sys/kern/tty.c
      head/sys/kern/uipc_mqueue.c
      head/sys/kern/uipc_sem.c
      head/sys/kern/uipc_shm.c
      head/sys/kern/uipc_syscalls.c
      head/sys/kern/uipc_usrreq.c
      head/sys/kern/vfs_aio.c
      head/sys/kern/vfs_lookup.c
      head/sys/kern/vfs_syscalls.c
      head/sys/netsmb/smb_dev.c
      head/sys/nfsserver/nfs_srvkrpc.c
      head/sys/ofed/include/linux/file.h
      head/sys/security/audit/audit.h
      head/sys/security/audit/audit_arg.c
      head/sys/security/audit/audit_bsm.c
      head/sys/security/audit/audit_private.h
      head/sys/sys/capability.h
      head/sys/sys/file.h
      head/sys/sys/filedesc.h
      head/sys/sys/namei.h
      head/sys/sys/user.h
      head/sys/vm/vm_mmap.c
      head/usr.bin/kdump/kdump.c
      head/usr.bin/kdump/mksubr
      head/usr.bin/procstat/procstat_files.c
    
    Modified: head/contrib/openbsm/etc/audit_event
    ==============================================================================
    --- head/contrib/openbsm/etc/audit_event	Sat Mar  2 00:41:51 2013	(r247601)
    +++ head/contrib/openbsm/etc/audit_event	Sat Mar  2 00:53:12 2013	(r247602)
    @@ -548,7 +548,7 @@
     43184:AUE_OPENAT:openat(2) - attr only:fa
     43185:AUE_POSIX_OPENPT:posix_openpt(2):ip
     43186:AUE_CAP_NEW:cap_new(2):fm
    -43187:AUE_CAP_GETRIGHTS:cap_getrights(2):fm
    +43187:AUE_CAP_RIGHTS_GET:cap_rights_get(2):fm
     43188:AUE_CAP_ENTER:cap_enter(2):pc
     43189:AUE_CAP_GETMODE:cap_getmode(2):pc
     43190:AUE_POSIX_SPAWN:posix_spawn(2):pc
    @@ -563,6 +563,11 @@
     43199:AUE_PDGETPID:pdgetpid(2):pc
     43200:AUE_PDWAIT:pdwait(2):pc
     43201:AUE_WAIT6:wait6(2):pc
    +43202:AUE_CAP_RIGHTS_LIMIT:cap_rights_limit(2):fm
    +43203:AUE_CAP_IOCTLS_LIMIT:cap_ioctls_limit(2):fm
    +43204:AUE_CAP_IOCTLS_GET:cap_ioctls_get(2):fm
    +43205:AUE_CAP_FCNTLS_LIMIT:cap_fcntls_limit(2):fm
    +43206:AUE_CAP_FCNTLS_GET:cap_fcntls_get(2):fm
     #
     # Solaris userspace events.
     #
    
    Modified: head/lib/libc/include/compat.h
    ==============================================================================
    --- head/lib/libc/include/compat.h	Sat Mar  2 00:41:51 2013	(r247601)
    +++ head/lib/libc/include/compat.h	Sat Mar  2 00:53:12 2013	(r247602)
    @@ -42,6 +42,8 @@ __sym_compat(__semctl, freebsd7___semctl
     __sym_compat(msgctl, freebsd7_msgctl, FBSD_1.0);
     __sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0);
     
    +__sym_compat(cap_getrights, cap_rights_get, FBSD_1.2);
    +
     #undef __sym_compat
     
     #endif	/* __LIBC_COMPAT_H__ */
    
    Modified: head/lib/libc/sys/Makefile.inc
    ==============================================================================
    --- head/lib/libc/sys/Makefile.inc	Sat Mar  2 00:41:51 2013	(r247601)
    +++ head/lib/libc/sys/Makefile.inc	Sat Mar  2 00:53:12 2013	(r247602)
    @@ -93,7 +93,9 @@ MAN+=	abort2.2 \
     	bind.2 \
     	brk.2 \
     	cap_enter.2 \
    -	cap_new.2 \
    +	cap_fcntls_limit.2 \
    +	cap_ioctls_limit.2 \
    +	cap_rights_limit.2 \
     	chdir.2 \
     	chflags.2 \
     	chmod.2 \
    @@ -270,7 +272,9 @@ MLINKS+=access.2 eaccess.2 \
     	access.2 faccessat.2
     MLINKS+=brk.2 sbrk.2
     MLINKS+=cap_enter.2 cap_getmode.2
    -MLINKS+=cap_new.2 cap_getrights.2
    +MLINKS+=cap_fcntls_limit.2 cap_fcntls_get.2
    +MLINKS+=cap_ioctls_limit.2 cap_ioctls_get.2
    +MLINKS+=cap_rights_limit.2 cap_rights_get.2
     MLINKS+=chdir.2 fchdir.2
     MLINKS+=chflags.2 fchflags.2 \
     	chflags.2 lchflags.2
    
    Modified: head/lib/libc/sys/Symbol.map
    ==============================================================================
    --- head/lib/libc/sys/Symbol.map	Sat Mar  2 00:41:51 2013	(r247601)
    +++ head/lib/libc/sys/Symbol.map	Sat Mar  2 00:53:12 2013	(r247602)
    @@ -364,7 +364,6 @@ FBSD_1.2 {
     	cap_enter;
     	cap_getmode;
     	cap_new;
    -	cap_getrights;
     	getloginclass;
     	pdfork;
     	pdgetpid;
    @@ -379,6 +378,12 @@ FBSD_1.2 {
     };
     
     FBSD_1.3 {
    +	cap_fcntls_get;
    +	cap_fcntls_limit;
    +	cap_ioctls_get;
    +	cap_ioctls_limit;
    +	cap_rights_get;
    +	cap_rights_limit;
     	cap_sandboxed;
     	clock_getcpuclockid2;
     	ffclock_getcounter;
    
    Modified: head/lib/libc/sys/cap_enter.2
    ==============================================================================
    --- head/lib/libc/sys/cap_enter.2	Sat Mar  2 00:41:51 2013	(r247601)
    +++ head/lib/libc/sys/cap_enter.2	Sat Mar  2 00:53:12 2013	(r247602)
    @@ -58,8 +58,10 @@ or
     .Xr pdfork 2
     will be placed in capability mode from inception.
     .Pp
    -When combined with capabilities created with
    -.Xr cap_new 2 ,
    +When combined with
    +.Xr cap_rights_limit 2 ,
    +.Xr cap_ioctls_limit 2 ,
    +.Xr cap_fcntls_limit 2 ,
     .Fn cap_enter
     may be used to create kernel-enforced sandboxes in which
     appropriately-crafted applications or application components may be run.
    @@ -71,11 +73,6 @@ sandbox.
     Creating effective process sandboxes is a tricky process that involves
     identifying the least possible rights required by the process and then
     passing those rights into the process in a safe manner.
    -See the CAVEAT
    -section of
    -.Xr cap_new 2
    -for why this is particularly tricky with UNIX file descriptors as the
    -canonical representation of a right.
     Consumers of
     .Fn cap_enter
     should also be aware of other inherited rights, such as access to VM
    @@ -87,8 +84,33 @@ to create a runtime environment inside t
     acquired rights as possible.
     .Sh RETURN VALUES
     .Rv -std cap_enter cap_getmode
    +.Sh ERRORS
    +The
    +.Fn cap_enter
    +and
    +.Fn cap_getmode
    +system calls
    +will fail if:
    +.Bl -tag -width Er
    +.It Bq Er ENOSYS
    +The kernel is compiled without:
    +.Pp
    +.Cd "options CAPABILITY_MODE"
    +.El
    +.Pp
    +The
    +.Fn cap_getmode
    +system call may also return the following error:
    +.Bl -tag -width Er
    +.It Bq Er EFAULT
    +Pointer
    +.Fa modep
    +points outside the process's allocated address space.
    +.El
     .Sh SEE ALSO
    -.Xr cap_new 2 ,
    +.Xr cap_fcntls_limit 2 ,
    +.Xr cap_ioctls_limit 2 ,
    +.Xr cap_rights_limit 2 ,
     .Xr fexecve 2 ,
     .Xr cap_sandboxed 3 ,
     .Xr capsicum 4
    
    Added: head/lib/libc/sys/cap_fcntls_limit.2
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/lib/libc/sys/cap_fcntls_limit.2	Sat Mar  2 00:53:12 2013	(r247602)
    @@ -0,0 +1,127 @@
    +.\"
    +.\" Copyright (c) 2012 The FreeBSD Foundation
    +.\" All rights reserved.
    +.\"
    +.\" This documentation was written by Pawel Jakub Dawidek under sponsorship
    +.\" the FreeBSD Foundation.
    +.\"
    +.\" Redistribution and use in source and binary forms, with or without
    +.\" modification, are permitted provided that the following conditions
    +.\" are met:
    +.\" 1. Redistributions of source code must retain the above copyright
    +.\"    notice, this list of conditions and the following disclaimer.
    +.\" 2. Redistributions in binary form must reproduce the above copyright
    +.\"    notice, this list of conditions and the following disclaimer in the
    +.\"    documentation and/or other materials provided with the distribution.
    +.\"
    +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
    +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    +.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
    +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    +.\" SUCH DAMAGE.
    +.\"
    +.\" $FreeBSD$
    +.\"
    +.Dd September 20, 2012
    +.Dt CAP_FCNTLS_LIMIT 2
    +.Os
    +.Sh NAME
    +.Nm cap_fcntls_limit ,
    +.Nm cap_fcntls_get
    +.Nd manage allowed fcntl commands
    +.Sh LIBRARY
    +.Lb libc
    +.Sh SYNOPSIS
    +.In sys/capability.h
    +.Ft int
    +.Fn cap_fcntls_limit "int fd" "uint32_t fcntlrights"
    +.Ft int
    +.Fn cap_fcntls_get "int fd" "uint32_t *fcntlrightsp"
    +.Sh DESCRIPTION
    +If a file descriptor is granted the
    +.Dv CAP_FCNTL
    +capability right, the list of allowed
    +.Xr fcntl 2
    +commands can be selectively reduced (but never expanded) with the
    +.Fn cap_fcntls_limit
    +system call.
    +.Pp
    +A bitmask of allowed fcntls commands for a given file descriptor can be obtained
    +with the
    +.Fn cap_fcntls_get
    +system call.
    +.Sh FLAGS
    +The following flags may be specified in the
    +.Fa fcntlrights
    +argument or returned in the
    +.Fa fcntlrightsp
    +argument:
    +.Bl -tag -width CAP_FCNTL_GETOWN
    +.It Dv CAP_FCNTL_GETFL
    +Permit
    +.Dv F_GETFL
    +command.
    +.It Dv CAP_FCNTL_SETFL
    +Permit
    +.Dv F_SETFL
    +command.
    +.It Dv CAP_FCNTL_GETOWN
    +Permit
    +.Dv F_GETOWN
    +command.
    +.It Dv CAP_FCNTL_SETOWN
    +Permit
    +.Dv F_SETOWN
    +command.
    +.El
    +.Sh RETURN VALUES
    +.Rv -std
    +.Sh ERRORS
    +.Fn cap_fcntls_limit
    +succeeds unless:
    +.Bl -tag -width Er
    +.It Bq Er EBADF
    +The
    +.Fa fd
    +argument is not a valid descriptor.
    +.It Bq Er EINVAL
    +An invalid flag has been passed in
    +.Fa fcntlrights .
    +.It Bq Er ENOTCAPABLE
    +.Fa fcntlrights
    +would expand the list of allowed
    +.Xr fcntl 2
    +commands.
    +.El
    +.Pp
    +.Fn cap_fcntls_get
    +succeeds unless:
    +.Bl -tag -width Er
    +.It Bq Er EBADF
    +The
    +.Fa fd
    +argument is not a valid descriptor.
    +.It Bq Er EFAULT
    +The
    +.Fa fcntlrightsp
    +argument points at an invalid address.
    +.El
    +.Sh SEE ALSO
    +.Xr cap_ioctls_limit 2 ,
    +.Xr cap_rights_limit 2 ,
    +.Xr fcntl 2
    +.Sh HISTORY
    +Support for capabilities and capabilities mode was developed as part of the
    +.Tn TrustedBSD
    +Project.
    +.Pp
    +.Sh AUTHORS
    +This function was created by
    +.An Pawel Jakub Dawidek Aq pawel@dawidek.net
    +under sponsorship of the FreeBSD Foundation.
    
    Added: head/lib/libc/sys/cap_ioctls_limit.2
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/lib/libc/sys/cap_ioctls_limit.2	Sat Mar  2 00:53:12 2013	(r247602)
    @@ -0,0 +1,158 @@
    +.\"
    +.\" Copyright (c) 2012 The FreeBSD Foundation
    +.\" All rights reserved.
    +.\"
    +.\" This documentation was written by Pawel Jakub Dawidek under sponsorship
    +.\" the FreeBSD Foundation.
    +.\"
    +.\" Redistribution and use in source and binary forms, with or without
    +.\" modification, are permitted provided that the following conditions
    +.\" are met:
    +.\" 1. Redistributions of source code must retain the above copyright
    +.\"    notice, this list of conditions and the following disclaimer.
    +.\" 2. Redistributions in binary form must reproduce the above copyright
    +.\"    notice, this list of conditions and the following disclaimer in the
    +.\"    documentation and/or other materials provided with the distribution.
    +.\"
    +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
    +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    +.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
    +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    +.\" SUCH DAMAGE.
    +.\"
    +.\" $FreeBSD$
    +.\"
    +.Dd September 20, 2012
    +.Dt CAP_IOCTLS_LIMIT 2
    +.Os
    +.Sh NAME
    +.Nm cap_ioctls_limit ,
    +.Nm cap_ioctls_get
    +.Nd manage allowed ioctl commands
    +.Sh LIBRARY
    +.Lb libc
    +.Sh SYNOPSIS
    +.In sys/capability.h
    +.Ft int
    +.Fn cap_ioctls_limit "int fd" "const unsigned long *cmds" "size_t ncmds"
    +.Ft ssize_t
    +.Fn cap_ioctls_get "int fd" "unsigned long *cmds" "size_t maxcmds"
    +.Sh DESCRIPTION
    +If a file descriptor is granted the
    +.Dv CAP_IOCTL
    +capability right, the list of allowed
    +.Xr ioctl 2
    +commands can be selectively reduced (but never expanded) with the
    +.Fn cap_ioctls_limit
    +system call.
    +The
    +.Fa cmds
    +argument is an array of
    +.Xr ioctl 2
    +commands and the
    +.Fa ncmds
    +argument specifies the number of elements in the array.
    +There might be up to
    +.Va 256
    +elements in the array.
    +.Pp
    +The list of allowed ioctl commands for a given file descriptor can be obtained
    +with the
    +.Fn cap_ioctls_get
    +system call.
    +The
    +.Fa cmds
    +argument points at memory that can hold up to
    +.Fa maxcmds
    +values.
    +The function populates the provided buffer with up to
    +.Fa maxcmds
    +elements, but always returns the total number of ioctl commands allowed for the
    +given file descriptor.
    +The total number of ioctls commands for the given file descriptor can be
    +obtained by passing
    +.Dv NULL as the
    +.Fa cmds
    +argument and
    +.Va 0
    +as the
    +.Fa maxcmds
    +argument.
    +If all ioctl commands are allowed
    +.Dv ( CAP_IOCTL
    +capability right is assigned to the file descriptor and the
    +.Fn cap_ioctls_limit
    +system call was never called for this file descriptor), the
    +.Fn cap_ioctls_get
    +system call will return
    +.Dv CAP_IOCTLS_ALL
    +and won't modify the buffer pointed out by the
    +.Fa cmds
    +argument.
    +.Sh RETURN VALUES
    +.Rv -std cap_ioctls_limit
    +.Pp
    +The
    +.Fn cap_ioctls_limit
    +function, if successfull, returns the total number of allowed ioctl commands or
    +the value
    +.Dv INT_MAX
    +if all ioctls commands are allowed.
    +On failure the value
    +.Va -1
    +is returned and the global variable errno is set to indicate the error.
    +.Sh ERRORS
    +.Fn cap_ioctls_limit
    +succeeds unless:
    +.Bl -tag -width Er
    +.It Bq Er EBADF
    +The
    +.Fa fd
    +argument is not a valid descriptor.
    +.It Bq Er EFAULT
    +The
    +.Fa cmds
    +argument points at an invalid address.
    +.It Bq Er EINVAL
    +The
    +.Fa ncmds
    +argument is greater than
    +.Va 256 .
    +.It Bq Er ENOTCAPABLE
    +.Fa cmds
    +would expand the list of allowed
    +.Xr ioctl 2
    +commands.
    +.El
    +.Pp
    +.Fn cap_ioctls_get
    +succeeds unless:
    +.Bl -tag -width Er
    +.It Bq Er EBADF
    +The
    +.Fa fd
    +argument is not a valid descriptor.
    +.It Bq Er EFAULT
    +The
    +.Fa cmds
    +argument points at invalid address.
    +.El
    +.Sh SEE ALSO
    +.Xr cap_fcntls_limit 2 ,
    +.Xr cap_rights_limit 2 ,
    +.Xr ioctl 2
    +.Sh HISTORY
    +Support for capabilities and capabilities mode was developed as part of the
    +.Tn TrustedBSD
    +Project.
    +.Pp
    +.Sh AUTHORS
    +This function was created by
    +.An Pawel Jakub Dawidek Aq pawel@dawidek.net
    +under sponsorship of the FreeBSD Foundation.
    
    Added: head/lib/libc/sys/cap_rights_limit.2
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/lib/libc/sys/cap_rights_limit.2	Sat Mar  2 00:53:12 2013	(r247602)
    @@ -0,0 +1,603 @@
    +.\"
    +.\" Copyright (c) 2008-2010 Robert N. M. Watson
    +.\" Copyright (c) 2012-2013 The FreeBSD Foundation
    +.\" All rights reserved.
    +.\"
    +.\" This software was developed at the University of Cambridge Computer
    +.\" Laboratory with support from a grant from Google, Inc.
    +.\"
    +.\" Portions of this documentation were written by Pawel Jakub Dawidek
    +.\" under sponsorship from the FreeBSD Foundation.
    +.\"
    +.\" Redistribution and use in source and binary forms, with or without
    +.\" modification, are permitted provided that the following conditions
    +.\" are met:
    +.\" 1. Redistributions of source code must retain the above copyright
    +.\"    notice, this list of conditions and the following disclaimer.
    +.\" 2. 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 February 23, 2013
    +.Dt CAP_RIGHTS_LIMIT 2
    +.Os
    +.Sh NAME
    +.Nm cap_rights_limit ,
    +.Nm cap_rights_get
    +.Nd manage capability rights
    +.Sh LIBRARY
    +.Lb libc
    +.Sh SYNOPSIS
    +.In sys/capability.h
    +.Ft int
    +.Fn cap_rights_limit "int fd" "cap_rights_t rights"
    +.Ft int
    +.Fn cap_rights_get "int fd" "cap_rights_t *rightsp"
    +.Sh DESCRIPTION
    +When a file descriptor is created by a function such as
    +.Xr fhopen 2 ,
    +.Xr kqueue 2 ,
    +.Xr mq_open 2 ,
    +.Xr open 2 ,
    +.Xr openat 2 ,
    +.Xr pdfork 2 ,
    +.Xr pipe 2 ,
    +.Xr shm_open 2 ,
    +.Xr socket 2 ,
    +or
    +.Xr socketpair 2 ,
    +it is assigned all capability rights.
    +Those rights can be reduced (but never expanded) by using the
    +.Fn cap_rights_limit
    +system call.
    +Once capability rights are reduced, operations on the file descriptor will be
    +limited to those permitted by
    +.Fa rights .
    +.Pp
    +A bitmask of capability rights assigned to a file descriptor can be obtained with
    +the
    +.Fn cap_rights_get
    +system call.
    +.Sh RIGHTS
    +The following rights may be specified in a rights mask:
    +.Bl -tag -width CAP_EXTATTR_DELETE
    +.It Dv CAP_ACCEPT
    +Permit
    +.Xr accept 2 .
    +.It Dv CAP_ACL_CHECK
    +Permit checking of an ACL on a file descriptor; there is no cross-reference
    +for this system call.
    +.It Dv CAP_ACL_DELETE
    +Permit
    +.Xr acl_delete_fd_np 3 .
    +.It Dv CAP_ACL_GET
    +Permit
    +.Xr acl_get_fd 3
    +and
    +.Xr acl_get_fd_np 3 .
    +.It Dv CAP_ACL_SET
    +Permit
    +.Xr acl_set_fd 3
    +and
    +.Xr acl_set_fd_np 3 .
    +.It Dv CAP_BIND
    +Permit
    +.Xr bind 2 .
    +Note that sockets can also become bound implicitly as a result of
    +.Xr connect 2
    +or
    +.Xr send 2 ,
    +and that socket options set with
    +.Xr setsockopt 2
    +may also affect binding behavior.
    +.It Dv CAP_CONNECT
    +Permit
    +.Xr connect 2 ;
    +also required for
    +.Xr sendto 2
    +with a non-NULL destination address.
    +.It Dv CAP_CREATE
    +Permit
    +.Xr openat 2
    +with the
    +.Dv O_CREAT
    +flag.
    +.\" XXXPJD: Doesn't exist anymore.
    +.It Dv CAP_EVENT
    +Permit
    +.Xr select 2 ,
    +.Xr poll 2 ,
    +and
    +.Xr kevent 2
    +to be used in monitoring the file descriptor for events.
    +.It Dv CAP_FEXECVE
    +Permit
    +.Xr fexecve 2
    +and
    +.Xr openat 2
    +with the
    +.Dv O_EXEC
    +flag;
    +.Dv CAP_READ
    +will also be required.
    +.It Dv CAP_EXTATTR_DELETE
    +Permit
    +.Xr extattr_delete_fd 2 .
    +.It Dv CAP_EXTATTR_GET
    +Permit
    +.Xr extattr_get_fd 2 .
    +.It Dv CAP_EXTATTR_LIST
    +Permit
    +.Xr extattr_list_fd 2 .
    +.It Dv CAP_EXTATTR_SET
    +Permit
    +.Xr extattr_set_fd 2 .
    +.It Dv CAP_FCHDIR
    +Permit
    +.Xr fchdir 2 .
    +.It Dv CAP_FCHFLAGS
    +Permit
    +.Xr fchflags 2 .
    +.It Dv CAP_FCHMOD
    +Permit
    +.Xr fchmod 2
    +and
    +.Xr fchmodat 2 .
    +.It Dv CAP_FCHMODAT
    +An alias to
    +.Dv CAP_FCHMOD .
    +.It Dv CAP_FCHOWN
    +Permit
    +.Xr fchown 2
    +and
    +.Xr fchownat 2 .
    +.It Dv CAP_FCHOWNAT
    +An alias to
    +.Dv CAP_FCHOWN .
    +.It Dv CAP_FCNTL
    +Permit
    +.Xr fcntl 2 .
    +Note that only the
    +.Dv F_GETFL ,
    +.Dv F_SETFL ,
    +.Dv F_GETOWN
    +and
    +.Dv F_SETOWN
    +commands require this capability right.
    +Also note that the list of permitted commands can be further limited with the
    +.Xr cap_fcntls_limit 2
    +system call.
    +.It Dv CAP_FLOCK
    +Permit
    +.Xr flock 2 ,
    +.Xr fcntl 2
    +(with
    +.Dv F_GETLK ,
    +.Dv F_SETLK
    +or
    +.Dv F_SETLKW
    +flag) and
    +.Xr openat 2
    +(with
    +.Dv O_EXLOCK
    +or
    +.Dv O_SHLOCK
    +flag).
    +.It Dv CAP_FPATHCONF
    +Permit
    +.Xr fpathconf 2 .
    +.It Dv CAP_FSCK
    +Permit UFS background-fsck operations on the descriptor.
    +.It Dv CAP_FSTAT
    +Permit
    +.Xr fstat 2
    +and
    +.Xr fstatat 2 .
    +.It Dv CAP_FSTATAT
    +An alias to
    +.Dv CAP_FSTAT .
    +.It Dv CAP_FSTATFS
    +Permit
    +.Xr fstatfs 2 .
    +.It Dv CAP_FSYNC
    +Permit
    +.Xr aio_fsync 2 ,
    +.Xr fsync 2
    +and
    +.Xr openat 2
    +with
    +.Dv O_FSYNC
    +or
    +.Dv O_SYNC
    +flag.
    +.It Dv CAP_FTRUNCATE
    +Permit
    +.Xr ftruncate 2
    +and
    +.Xr openat 2
    +with the
    +.Dv O_TRUNC
    +flag.
    +.It Dv CAP_FUTIMES
    +Permit
    +.Xr futimes 2
    +and
    +.Xr futimesat 2 .
    +.It Dv CAP_FUTIMESAT
    +An alias to
    +.Dv CAP_FUTIMES .
    +.It Dv CAP_GETPEERNAME
    +Permit
    +.Xr getpeername 2 .
    +.It Dv CAP_GETSOCKNAME
    +Permit
    +.Xr getsockname 2 .
    +.It Dv CAP_GETSOCKOPT
    +Permit
    +.Xr getsockopt 2 .
    +.It Dv CAP_IOCTL
    +Permit
    +.Xr ioctl 2 .
    +Be aware that this system call has enormous scope, including potentially
    +global scope for some objects.
    +The list of permitted ioctl commands can be further limited with the
    +.Xr cap_ioctls_limit 2
    +system call.
    +.\" XXXPJD: Doesn't exist anymore.
    +.It Dv CAP_KEVENT
    +Permit
    +.Xr kevent 2 ;
    +.Dv CAP_EVENT
    +is also required on file descriptors that will be monitored using
    +.Xr kevent 2 .
    +.It Dv CAP_LINKAT
    +Permit
    +.Xr linkat 2
    +and
    +.Xr renameat 2 .
    +This right is required for the destination directory descriptor.
    +.It Dv CAP_LISTEN
    +Permit
    +.Xr listen 2 ;
    +not much use (generally) without
    +.Dv CAP_BIND .
    +.It Dv CAP_LOOKUP
    +Permit the file descriptor to be used as a starting directory for calls such as
    +.Xr linkat 2 ,
    +.Xr openat 2 ,
    +and
    +.Xr unlinkat 2 .
    +.It Dv CAP_MAC_GET
    +Permit
    +.Xr mac_get_fd 3 .
    +.It Dv CAP_MAC_SET
    +Permit
    +.Xr mac_set_fd 3 .
    +.It Dv CAP_MKDIRAT
    +Permit
    +.Xr mkdirat 2 .
    +.It Dv CAP_MKFIFOAT
    +Permit
    +.Xr mkfifoat 2 .
    +.It Dv CAP_MKNODAT
    +Permit
    +.Xr mknodat 2 .
    +.It Dv CAP_MMAP
    +Permit
    +.Xr mmap 2
    +with the
    +.Dv PROT_NONE
    +protection.
    +.It Dv CAP_MMAP_R
    +Permit
    +.Xr mmap 2
    +with the
    +.Dv PROT_READ
    +protection.
    +This also implies
    +.Dv CAP_READ
    +and
    +.Dv CAP_SEEK
    +rights.
    +.It Dv CAP_MMAP_W
    +Permit
    +.Xr mmap 2
    +with the
    +.Dv PROT_WRITE
    +protection.
    +This also implies
    +.Dv CAP_WRITE
    +and
    +.Dv CAP_SEEK
    +rights.
    +.It Dv CAP_MMAP_X
    +Permit
    +.Xr mmap 2
    +with the
    +.Dv PROT_EXEC
    +protection.
    +This also implies
    +.Dv CAP_SEEK
    +right.
    +.It Dv CAP_MMAP_RW
    +Implies
    +.Dv CAP_MMAP_R
    +and
    +.Dv CAP_MMAP_W .
    +.It Dv CAP_MMAP_RX
    +Implies
    +.Dv CAP_MMAP_R
    +and
    +.Dv CAP_MMAP_X .
    +.It Dv CAP_MMAP_WX
    +Implies
    +.Dv CAP_MMAP_W
    +and
    +.Dv CAP_MMAP_X .
    +.It Dv CAP_MMAP_RWX
    +Implies
    +.Dv CAP_MMAP_R ,
    +.Dv CAP_MMAP_W
    +and
    +.Dv CAP_MMAP_X .
    +.It Dv CAP_PDGETPID
    +Permit
    +.Xr pdgetpid 2 .
    +.It Dv CAP_PDKILL
    +Permit
    +.Xr pdkill 2 .
    +.It Dv CAP_PDWAIT
    +Permit
    +.Xr pdwait4 2 .
    +.It Dv CAP_PEELOFF
    +Permit
    +.Xr sctp_peeloff 2 .
    +.\" XXXPJD: Not documented.
    +.It Dv CAP_POLL_EVENT
    +.\" XXXPJD: Not documented.
    +.It Dv CAP_POST_EVENT
    +.It Dv CAP_PREAD
    +Implies
    +.Dv CAP_SEEK
    +and
    +.Dv CAP_READ .
    +.It Dv CAP_PWRITE
    +Implies
    +.Dv CAP_SEEK
    +and
    +.Dv CAP_WRITE .
    +.It Dv CAP_READ
    +Allow
    +.Xr aio_read 2 ,
    +.Xr openat
    +with the
    +.Dv O_RDONLY flag,
    +.Xr read 2 ,
    +.Xr recv 2 ,
    +.Xr recvfrom 2 ,
    +.Xr recvmsg 2
    +and related system calls.
    +.It Dv CAP_RECV
    +An alias to
    +.Dv CAP_READ .
    +.It Dv CAP_RENAMEAT
    +Permit
    +.Xr renameat 2 .
    +This right is required for the source directory descriptor.
    +.It Dv CAP_SEEK
    +Permit operations that seek on the file descriptor, such as
    +.Xr lseek 2 ,
    +but also required for I/O system calls that can read or write at any position
    +in the file, such as
    +.Xr pread 2
    +and
    +.Xr pwrite 2 .
    +.It Dv CAP_SEM_GETVALUE
    +Permit
    +.Xr sem_getvalue 3 .
    +.It Dv CAP_SEM_POST
    +Permit
    +.Xr sem_post 3 .
    +.It Dv CAP_SEM_WAIT
    +Permit
    +.Xr sem_wait 3
    +and
    +.Xr sem_trywait 3 .
    +.It Dv CAP_SEND
    +An alias to
    +.Dv CAP_WRITE .
    +.It Dv CAP_SETSOCKOPT
    +Permit
    +.Xr setsockopt 2 ;
    +this controls various aspects of socket behavior and may affect binding,
    +connecting, and other behaviors with global scope.
    +.It Dv CAP_SHUTDOWN
    +Permit explicit
    +.Xr shutdown 2 ;
    +closing the socket will also generally shut down any connections on it.
    +.It Dv CAP_SYMLINKAT
    +Permit
    +.Xr symlinkat 2 .
    +.It Dv CAP_TTYHOOK
    +Allow configuration of TTY hooks, such as
    +.Xr snp 4 ,
    +on the file descriptor.
    +.It Dv CAP_UNLINKAT
    +Permit
    +.Xr unlinkat 2
    +and
    +.Xr renameat 2 .
    +This right is only required for
    +.Xr renameat 2
    +on the destination directory descriptor if the destination object already
    +exists and will be removed by the rename.
    +.It Dv CAP_WRITE
    +Allow
    +.Xr aio_write 2 ,
    +.Xr openat 2
    +with
    +.Dv O_WRONLY
    +and
    +.Dv O_APPEND
    +flags,
    +.Xr send 2 ,
    +.Xr sendmsg 2 ,
    +.Xr sendto 2 ,
    +.Xr write 2 ,
    +and related system calls.
    +For
    +.Xr sendto 2
    +with a non-NULL connection address,
    +.Dv CAP_CONNECT
    +is also required.
    +For
    +.Xr openat 2
    +with the
    +.Dv O_WRONLY
    +flag, but without the
    +.Dv O_APPEND
    +flag,
    +.Dv CAP_SEEK
    +is also required.
    +.El
    +.Sh RETURN VALUES
    +.Rv -std
    +.Sh ERRORS
    +.Fn cap_rights_limit
    +succeeds unless:
    +.Bl -tag -width Er
    +.It Bq Er EBADF
    +The
    +.Fa fd
    +argument is not a valid active descriptor.
    +.It Bq Er EINVAL
    +An invalid right has been requested in
    +.Fa rights .
    +.It Bq Er ENOTCAPABLE
    +.Fa rights
    +contains requested rights not present in the current rights mask associated
    +with the given file descriptor.
    +.El
    +.Pp
    +.Fn cap_rights_get
    +succeeds unless:
    +.Bl -tag -width Er
    +.It Bq Er EBADF
    +The
    +.Fa fd
    +argument is not a valid active descriptor.
    +.It Bq Er EFAULT
    +The
    +.Fa rightsp
    +argument points at an invalid address.
    +.El
    +.Sh SEE ALSO
    +.Xr accept 2 ,
    +.Xr aio_fsync 2 ,
    +.Xr aio_read 2 ,
    +.Xr aio_write 2 ,
    +.Xr bind 2 ,
    +.Xr cap_enter 2 ,
    +.Xr cap_fcntls_limit 2 ,
    +.Xr cap_ioctls_limit 2 ,
    +.Xr cap_rights_limit 2 ,
    +.Xr connect 2 ,
    +.Xr dup 2 ,
    +.Xr dup2 2 ,
    +.Xr extattr_delete_fd 2 ,
    +.Xr extattr_get_fd 2 ,
    +.Xr extattr_list_fd 2 ,
    +.Xr extattr_set_fd 2 ,
    +.Xr fchflags 2 ,
    +.Xr fchown 2 ,
    +.Xr fcntl 2 ,
    +.Xr fexecve 2 ,
    +.Xr fhopen 2 ,
    +.Xr flock 2 ,
    +.Xr fpathconf 2 ,
    +.Xr fstat 2 ,
    +.Xr fstatfs 2 ,
    +.Xr fsync 2 ,
    +.Xr ftruncate 2 ,
    +.Xr futimes 2 ,
    +.Xr getpeername 2 ,
    +.Xr getsockname 2 ,
    +.Xr getsockopt 2 ,
    +.Xr ioctl 2 ,
    +.Xr kevent 2 ,
    +.Xr kqueue 2 ,
    +.Xr linkat 2 ,
    +.Xr listen 2 ,
    +.Xr mmap 2 ,
    +.Xr mq_open 2 ,
    +.Xr open 2 ,
    +.Xr openat 2 ,
    +.Xr pdfork 2 ,
    +.Xr pdgetpid 2 ,
    +.Xr pdkill 2 ,
    +.Xr pdwait4 2 ,
    +.Xr pipe 2 ,
    +.Xr poll 2 ,
    +.Xr pread 2 ,
    +.Xr pwrite 2 ,
    +.Xr read 2 ,
    +.Xr recv 2 ,
    +.Xr recvfrom 2 ,
    +.Xr recvmsg 2 ,
    +.Xr renameat 2 ,
    +.Xr sctp_peeloff 2 ,
    +.Xr select 2 ,
    
    *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 00:55:12 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 4BBAA370;
     Sat,  2 Mar 2013 00:55:12 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 23D3F1F59;
     Sat,  2 Mar 2013 00:55:12 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r220tChN063862;
     Sat, 2 Mar 2013 00:55:12 GMT (envelope-from pjd@svn.freebsd.org)
    Received: (from pjd@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r220tAE1063847;
     Sat, 2 Mar 2013 00:55:10 GMT (envelope-from pjd@svn.freebsd.org)
    Message-Id: <201303020055.r220tAE1063847@svn.freebsd.org>
    From: Pawel Jakub Dawidek 
    Date: Sat, 2 Mar 2013 00:55:10 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247604 - in head/sys: compat/freebsd32 kern sys
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 00:55:12 -0000
    
    Author: pjd
    Date: Sat Mar  2 00:55:09 2013
    New Revision: 247604
    URL: http://svnweb.freebsd.org/changeset/base/247604
    
    Log:
      Regen after r247602.
    
    Modified:
      head/sys/compat/freebsd32/freebsd32_proto.h
      head/sys/compat/freebsd32/freebsd32_syscall.h
      head/sys/compat/freebsd32/freebsd32_syscalls.c
      head/sys/compat/freebsd32/freebsd32_sysent.c
      head/sys/compat/freebsd32/freebsd32_systrace_args.c
      head/sys/kern/init_sysent.c
      head/sys/kern/syscalls.c
      head/sys/kern/systrace_args.c
      head/sys/sys/syscall.h
      head/sys/sys/syscall.mk
      head/sys/sys/sysproto.h
    
    Modified: head/sys/compat/freebsd32/freebsd32_proto.h
    ==============================================================================
    --- head/sys/compat/freebsd32/freebsd32_proto.h	Sat Mar  2 00:53:16 2013	(r247603)
    +++ head/sys/compat/freebsd32/freebsd32_proto.h	Sat Mar  2 00:55:09 2013	(r247604)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 242958 2012-11-13 12:52:31Z kib 
    + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
      */
     
     #ifndef _FREEBSD32_SYSPROTO_H_
    
    Modified: head/sys/compat/freebsd32/freebsd32_syscall.h
    ==============================================================================
    --- head/sys/compat/freebsd32/freebsd32_syscall.h	Sat Mar  2 00:53:16 2013	(r247603)
    +++ head/sys/compat/freebsd32/freebsd32_syscall.h	Sat Mar  2 00:55:09 2013	(r247604)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 242958 2012-11-13 12:52:31Z kib 
    + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
      */
     
     #define	FREEBSD32_SYS_syscall	0
    @@ -416,7 +416,7 @@
     #define	FREEBSD32_SYS_freebsd32_shmctl	512
     #define	FREEBSD32_SYS_lpathconf	513
     #define	FREEBSD32_SYS_cap_new	514
    -#define	FREEBSD32_SYS_cap_getrights	515
    +#define	FREEBSD32_SYS_cap_rights_get	515
     #define	FREEBSD32_SYS_cap_enter	516
     #define	FREEBSD32_SYS_cap_getmode	517
     #define	FREEBSD32_SYS_freebsd32_pselect	522
    @@ -430,4 +430,9 @@
     #define	FREEBSD32_SYS_freebsd32_posix_fallocate	530
     #define	FREEBSD32_SYS_freebsd32_posix_fadvise	531
     #define	FREEBSD32_SYS_freebsd32_wait6	532
    -#define	FREEBSD32_SYS_MAXSYSCALL	533
    +#define	FREEBSD32_SYS_cap_rights_limit	533
    +#define	FREEBSD32_SYS_cap_ioctls_limit	534
    +#define	FREEBSD32_SYS_cap_ioctls_get	535
    +#define	FREEBSD32_SYS_cap_fcntls_limit	536
    +#define	FREEBSD32_SYS_cap_fcntls_get	537
    +#define	FREEBSD32_SYS_MAXSYSCALL	538
    
    Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c
    ==============================================================================
    --- head/sys/compat/freebsd32/freebsd32_syscalls.c	Sat Mar  2 00:53:16 2013	(r247603)
    +++ head/sys/compat/freebsd32/freebsd32_syscalls.c	Sat Mar  2 00:55:09 2013	(r247604)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 242958 2012-11-13 12:52:31Z kib 
    + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
      */
     
     const char *freebsd32_syscallnames[] = {
    @@ -538,7 +538,7 @@ const char *freebsd32_syscallnames[] = {
     	"freebsd32_shmctl",			/* 512 = freebsd32_shmctl */
     	"lpathconf",			/* 513 = lpathconf */
     	"cap_new",			/* 514 = cap_new */
    -	"cap_getrights",			/* 515 = cap_getrights */
    +	"cap_rights_get",			/* 515 = cap_rights_get */
     	"cap_enter",			/* 516 = cap_enter */
     	"cap_getmode",			/* 517 = cap_getmode */
     	"#518",			/* 518 = pdfork */
    @@ -556,4 +556,9 @@ const char *freebsd32_syscallnames[] = {
     	"freebsd32_posix_fallocate",			/* 530 = freebsd32_posix_fallocate */
     	"freebsd32_posix_fadvise",			/* 531 = freebsd32_posix_fadvise */
     	"freebsd32_wait6",			/* 532 = freebsd32_wait6 */
    +	"cap_rights_limit",			/* 533 = cap_rights_limit */
    +	"cap_ioctls_limit",			/* 534 = cap_ioctls_limit */
    +	"cap_ioctls_get",			/* 535 = cap_ioctls_get */
    +	"cap_fcntls_limit",			/* 536 = cap_fcntls_limit */
    +	"cap_fcntls_get",			/* 537 = cap_fcntls_get */
     };
    
    Modified: head/sys/compat/freebsd32/freebsd32_sysent.c
    ==============================================================================
    --- head/sys/compat/freebsd32/freebsd32_sysent.c	Sat Mar  2 00:53:16 2013	(r247603)
    +++ head/sys/compat/freebsd32/freebsd32_sysent.c	Sat Mar  2 00:55:09 2013	(r247604)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 242958 2012-11-13 12:52:31Z kib 
    + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
      */
     
     #include "opt_compat.h"
    @@ -575,7 +575,7 @@ struct sysent freebsd32_sysent[] = {
     	{ AS(freebsd32_shmctl_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },	/* 512 = freebsd32_shmctl */
     	{ AS(lpathconf_args), (sy_call_t *)sys_lpathconf, AUE_LPATHCONF, NULL, 0, 0, 0, SY_THR_STATIC },	/* 513 = lpathconf */
     	{ AS(cap_new_args), (sy_call_t *)sys_cap_new, AUE_CAP_NEW, NULL, 0, 0, 0, SY_THR_STATIC },	/* 514 = cap_new */
    -	{ AS(cap_getrights_args), (sy_call_t *)sys_cap_getrights, AUE_CAP_GETRIGHTS, NULL, 0, 0, 0, SY_THR_STATIC },	/* 515 = cap_getrights */
    +	{ AS(cap_rights_get_args), (sy_call_t *)sys_cap_rights_get, AUE_CAP_RIGHTS_GET, NULL, 0, 0, 0, SY_THR_STATIC },	/* 515 = cap_rights_get */
     	{ 0, (sy_call_t *)sys_cap_enter, AUE_CAP_ENTER, NULL, 0, 0, 0, SY_THR_STATIC },	/* 516 = cap_enter */
     	{ AS(cap_getmode_args), (sy_call_t *)sys_cap_getmode, AUE_CAP_GETMODE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 517 = cap_getmode */
     	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 518 = pdfork */
    @@ -593,4 +593,9 @@ struct sysent freebsd32_sysent[] = {
     	{ AS(freebsd32_posix_fallocate_args), (sy_call_t *)freebsd32_posix_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 530 = freebsd32_posix_fallocate */
     	{ AS(freebsd32_posix_fadvise_args), (sy_call_t *)freebsd32_posix_fadvise, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 531 = freebsd32_posix_fadvise */
     	{ AS(freebsd32_wait6_args), (sy_call_t *)freebsd32_wait6, AUE_WAIT6, NULL, 0, 0, 0, SY_THR_STATIC },	/* 532 = freebsd32_wait6 */
    +	{ AS(cap_rights_limit_args), (sy_call_t *)sys_cap_rights_limit, AUE_CAP_RIGHTS_LIMIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 533 = cap_rights_limit */
    +	{ AS(cap_ioctls_limit_args), (sy_call_t *)sys_cap_ioctls_limit, AUE_CAP_IOCTLS_LIMIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 534 = cap_ioctls_limit */
    +	{ AS(cap_ioctls_get_args), (sy_call_t *)sys_cap_ioctls_get, AUE_CAP_IOCTLS_GET, NULL, 0, 0, 0, SY_THR_STATIC },	/* 535 = cap_ioctls_get */
    +	{ AS(cap_fcntls_limit_args), (sy_call_t *)sys_cap_fcntls_limit, AUE_CAP_FCNTLS_LIMIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 536 = cap_fcntls_limit */
    +	{ AS(cap_fcntls_get_args), (sy_call_t *)sys_cap_fcntls_get, AUE_CAP_FCNTLS_GET, NULL, 0, 0, 0, SY_THR_STATIC },	/* 537 = cap_fcntls_get */
     };
    
    Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c
    ==============================================================================
    --- head/sys/compat/freebsd32/freebsd32_systrace_args.c	Sat Mar  2 00:53:16 2013	(r247603)
    +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c	Sat Mar  2 00:55:09 2013	(r247604)
    @@ -2956,9 +2956,9 @@ systrace_args(int sysnum, void *params, 
     		*n_args = 2;
     		break;
     	}
    -	/* cap_getrights */
    +	/* cap_rights_get */
     	case 515: {
    -		struct cap_getrights_args *p = params;
    +		struct cap_rights_get_args *p = params;
     		iarg[0] = p->fd; /* int */
     		uarg[1] = (intptr_t) p->rightsp; /* uint64_t * */
     		*n_args = 2;
    @@ -3088,6 +3088,48 @@ systrace_args(int sysnum, void *params, 
     		*n_args = 6;
     		break;
     	}
    +	/* cap_rights_limit */
    +	case 533: {
    +		struct cap_rights_limit_args *p = params;
    +		iarg[0] = p->fd; /* int */
    +		uarg[1] = p->rights; /* uint64_t */
    +		*n_args = 2;
    +		break;
    +	}
    +	/* cap_ioctls_limit */
    +	case 534: {
    +		struct cap_ioctls_limit_args *p = params;
    +		iarg[0] = p->fd; /* int */
    +		uarg[1] = (intptr_t) p->cmds; /* const u_long * */
    +		uarg[2] = p->ncmds; /* size_t */
    +		*n_args = 3;
    +		break;
    +	}
    +	/* cap_ioctls_get */
    +	case 535: {
    +		struct cap_ioctls_get_args *p = params;
    +		iarg[0] = p->fd; /* int */
    +		uarg[1] = (intptr_t) p->cmds; /* u_long * */
    +		uarg[2] = p->maxcmds; /* size_t */
    +		*n_args = 3;
    +		break;
    +	}
    +	/* cap_fcntls_limit */
    +	case 536: {
    +		struct cap_fcntls_limit_args *p = params;
    +		iarg[0] = p->fd; /* int */
    +		uarg[1] = p->fcntlrights; /* uint32_t */
    +		*n_args = 2;
    +		break;
    +	}
    +	/* cap_fcntls_get */
    +	case 537: {
    +		struct cap_fcntls_get_args *p = params;
    +		iarg[0] = p->fd; /* int */
    +		uarg[1] = (intptr_t) p->fcntlrightsp; /* uint32_t * */
    +		*n_args = 2;
    +		break;
    +	}
     	default:
     		*n_args = 0;
     		break;
    @@ -8002,7 +8044,7 @@ systrace_entry_setargdesc(int sysnum, in
     			break;
     		};
     		break;
    -	/* cap_getrights */
    +	/* cap_rights_get */
     	case 515:
     		switch(ndx) {
     		case 0:
    @@ -8243,6 +8285,77 @@ systrace_entry_setargdesc(int sysnum, in
     			break;
     		};
     		break;
    +	/* cap_rights_limit */
    +	case 533:
    +		switch(ndx) {
    +		case 0:
    +			p = "int";
    +			break;
    +		case 1:
    +			p = "uint64_t";
    +			break;
    +		default:
    +			break;
    +		};
    +		break;
    +	/* cap_ioctls_limit */
    +	case 534:
    +		switch(ndx) {
    +		case 0:
    +			p = "int";
    +			break;
    +		case 1:
    +			p = "const u_long *";
    +			break;
    +		case 2:
    +			p = "size_t";
    +			break;
    +		default:
    +			break;
    +		};
    +		break;
    +	/* cap_ioctls_get */
    +	case 535:
    +		switch(ndx) {
    +		case 0:
    +			p = "int";
    +			break;
    +		case 1:
    +			p = "u_long *";
    +			break;
    +		case 2:
    +			p = "size_t";
    +			break;
    +		default:
    +			break;
    +		};
    +		break;
    +	/* cap_fcntls_limit */
    +	case 536:
    +		switch(ndx) {
    +		case 0:
    +			p = "int";
    +			break;
    +		case 1:
    +			p = "uint32_t";
    +			break;
    +		default:
    +			break;
    +		};
    +		break;
    +	/* cap_fcntls_get */
    +	case 537:
    +		switch(ndx) {
    +		case 0:
    +			p = "int";
    +			break;
    +		case 1:
    +			p = "uint32_t *";
    +			break;
    +		default:
    +			break;
    +		};
    +		break;
     	default:
     		break;
     	};
    @@ -9938,7 +10051,7 @@ systrace_return_setargdesc(int sysnum, i
     		if (ndx == 0 || ndx == 1)
     			p = "int";
     		break;
    -	/* cap_getrights */
    +	/* cap_rights_get */
     	case 515:
     		if (ndx == 0 || ndx == 1)
     			p = "int";
    @@ -10005,6 +10118,31 @@ systrace_return_setargdesc(int sysnum, i
     		if (ndx == 0 || ndx == 1)
     			p = "int";
     		break;
    +	/* cap_rights_limit */
    +	case 533:
    +		if (ndx == 0 || ndx == 1)
    +			p = "int";
    +		break;
    +	/* cap_ioctls_limit */
    +	case 534:
    +		if (ndx == 0 || ndx == 1)
    +			p = "int";
    +		break;
    +	/* cap_ioctls_get */
    +	case 535:
    +		if (ndx == 0 || ndx == 1)
    +			p = "ssize_t";
    +		break;
    +	/* cap_fcntls_limit */
    +	case 536:
    +		if (ndx == 0 || ndx == 1)
    +			p = "int";
    +		break;
    +	/* cap_fcntls_get */
    +	case 537:
    +		if (ndx == 0 || ndx == 1)
    +			p = "int";
    +		break;
     	default:
     		break;
     	};
    
    Modified: head/sys/kern/init_sysent.c
    ==============================================================================
    --- head/sys/kern/init_sysent.c	Sat Mar  2 00:53:16 2013	(r247603)
    +++ head/sys/kern/init_sysent.c	Sat Mar  2 00:55:09 2013	(r247604)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/kern/syscalls.master 242958 2012-11-13 12:52:31Z kib 
    + * created from FreeBSD: head/sys/kern/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
      */
     
     #include "opt_compat.h"
    @@ -88,7 +88,7 @@ struct sysent sysent[] = {
     	{ AS(acct_args), (sy_call_t *)sys_acct, AUE_ACCT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 51 = acct */
     	{ compat(0,sigpending), AUE_SIGPENDING, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 52 = old sigpending */
     	{ AS(sigaltstack_args), (sy_call_t *)sys_sigaltstack, AUE_SIGALTSTACK, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 53 = sigaltstack */
    -	{ AS(ioctl_args), (sy_call_t *)sys_ioctl, AUE_IOCTL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 54 = ioctl */
    +	{ AS(ioctl_args), (sy_call_t *)sys_ioctl, AUE_IOCTL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 54 = ioctl */
     	{ AS(reboot_args), (sy_call_t *)sys_reboot, AUE_REBOOT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 55 = reboot */
     	{ AS(revoke_args), (sy_call_t *)sys_revoke, AUE_REVOKE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 56 = revoke */
     	{ AS(symlink_args), (sy_call_t *)sys_symlink, AUE_SYMLINK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 57 = symlink */
    @@ -549,7 +549,7 @@ struct sysent sysent[] = {
     	{ AS(shmctl_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },	/* 512 = shmctl */
     	{ AS(lpathconf_args), (sy_call_t *)sys_lpathconf, AUE_LPATHCONF, NULL, 0, 0, 0, SY_THR_STATIC },	/* 513 = lpathconf */
     	{ AS(cap_new_args), (sy_call_t *)sys_cap_new, AUE_CAP_NEW, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 514 = cap_new */
    -	{ AS(cap_getrights_args), (sy_call_t *)sys_cap_getrights, AUE_CAP_GETRIGHTS, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 515 = cap_getrights */
    +	{ AS(cap_rights_get_args), (sy_call_t *)sys_cap_rights_get, AUE_CAP_RIGHTS_GET, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 515 = cap_rights_get */
     	{ 0, (sy_call_t *)sys_cap_enter, AUE_CAP_ENTER, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 516 = cap_enter */
     	{ AS(cap_getmode_args), (sy_call_t *)sys_cap_getmode, AUE_CAP_GETMODE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 517 = cap_getmode */
     	{ AS(pdfork_args), (sy_call_t *)sys_pdfork, AUE_PDFORK, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 518 = pdfork */
    @@ -567,4 +567,9 @@ struct sysent sysent[] = {
     	{ AS(posix_fallocate_args), (sy_call_t *)sys_posix_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 530 = posix_fallocate */
     	{ AS(posix_fadvise_args), (sy_call_t *)sys_posix_fadvise, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 531 = posix_fadvise */
     	{ AS(wait6_args), (sy_call_t *)sys_wait6, AUE_WAIT6, NULL, 0, 0, 0, SY_THR_STATIC },	/* 532 = wait6 */
    +	{ AS(cap_rights_limit_args), (sy_call_t *)sys_cap_rights_limit, AUE_CAP_RIGHTS_LIMIT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 533 = cap_rights_limit */
    +	{ AS(cap_ioctls_limit_args), (sy_call_t *)sys_cap_ioctls_limit, AUE_CAP_IOCTLS_LIMIT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 534 = cap_ioctls_limit */
    +	{ AS(cap_ioctls_get_args), (sy_call_t *)sys_cap_ioctls_get, AUE_CAP_IOCTLS_GET, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 535 = cap_ioctls_get */
    +	{ AS(cap_fcntls_limit_args), (sy_call_t *)sys_cap_fcntls_limit, AUE_CAP_FCNTLS_LIMIT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 536 = cap_fcntls_limit */
    +	{ AS(cap_fcntls_get_args), (sy_call_t *)sys_cap_fcntls_get, AUE_CAP_FCNTLS_GET, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 537 = cap_fcntls_get */
     };
    
    Modified: head/sys/kern/syscalls.c
    ==============================================================================
    --- head/sys/kern/syscalls.c	Sat Mar  2 00:53:16 2013	(r247603)
    +++ head/sys/kern/syscalls.c	Sat Mar  2 00:55:09 2013	(r247604)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/kern/syscalls.master 242958 2012-11-13 12:52:31Z kib 
    + * created from FreeBSD: head/sys/kern/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
      */
     
     const char *syscallnames[] = {
    @@ -522,7 +522,7 @@ const char *syscallnames[] = {
     	"shmctl",			/* 512 = shmctl */
     	"lpathconf",			/* 513 = lpathconf */
     	"cap_new",			/* 514 = cap_new */
    -	"cap_getrights",			/* 515 = cap_getrights */
    +	"cap_rights_get",			/* 515 = cap_rights_get */
     	"cap_enter",			/* 516 = cap_enter */
     	"cap_getmode",			/* 517 = cap_getmode */
     	"pdfork",			/* 518 = pdfork */
    @@ -540,4 +540,9 @@ const char *syscallnames[] = {
     	"posix_fallocate",			/* 530 = posix_fallocate */
     	"posix_fadvise",			/* 531 = posix_fadvise */
     	"wait6",			/* 532 = wait6 */
    +	"cap_rights_limit",			/* 533 = cap_rights_limit */
    +	"cap_ioctls_limit",			/* 534 = cap_ioctls_limit */
    +	"cap_ioctls_get",			/* 535 = cap_ioctls_get */
    +	"cap_fcntls_limit",			/* 536 = cap_fcntls_limit */
    +	"cap_fcntls_get",			/* 537 = cap_fcntls_get */
     };
    
    Modified: head/sys/kern/systrace_args.c
    ==============================================================================
    --- head/sys/kern/systrace_args.c	Sat Mar  2 00:53:16 2013	(r247603)
    +++ head/sys/kern/systrace_args.c	Sat Mar  2 00:55:09 2013	(r247604)
    @@ -3134,9 +3134,9 @@ systrace_args(int sysnum, void *params, 
     		*n_args = 2;
     		break;
     	}
    -	/* cap_getrights */
    +	/* cap_rights_get */
     	case 515: {
    -		struct cap_getrights_args *p = params;
    +		struct cap_rights_get_args *p = params;
     		iarg[0] = p->fd; /* int */
     		uarg[1] = (intptr_t) p->rightsp; /* uint64_t * */
     		*n_args = 2;
    @@ -3286,6 +3286,48 @@ systrace_args(int sysnum, void *params, 
     		*n_args = 6;
     		break;
     	}
    +	/* cap_rights_limit */
    +	case 533: {
    +		struct cap_rights_limit_args *p = params;
    +		iarg[0] = p->fd; /* int */
    +		uarg[1] = p->rights; /* uint64_t */
    +		*n_args = 2;
    +		break;
    +	}
    +	/* cap_ioctls_limit */
    +	case 534: {
    +		struct cap_ioctls_limit_args *p = params;
    +		iarg[0] = p->fd; /* int */
    +		uarg[1] = (intptr_t) p->cmds; /* const u_long * */
    +		uarg[2] = p->ncmds; /* size_t */
    +		*n_args = 3;
    +		break;
    +	}
    +	/* cap_ioctls_get */
    +	case 535: {
    +		struct cap_ioctls_get_args *p = params;
    +		iarg[0] = p->fd; /* int */
    +		uarg[1] = (intptr_t) p->cmds; /* u_long * */
    +		uarg[2] = p->maxcmds; /* size_t */
    +		*n_args = 3;
    +		break;
    +	}
    +	/* cap_fcntls_limit */
    +	case 536: {
    +		struct cap_fcntls_limit_args *p = params;
    +		iarg[0] = p->fd; /* int */
    +		uarg[1] = p->fcntlrights; /* uint32_t */
    +		*n_args = 2;
    +		break;
    +	}
    +	/* cap_fcntls_get */
    +	case 537: {
    +		struct cap_fcntls_get_args *p = params;
    +		iarg[0] = p->fd; /* int */
    +		uarg[1] = (intptr_t) p->fcntlrightsp; /* uint32_t * */
    +		*n_args = 2;
    +		break;
    +	}
     	default:
     		*n_args = 0;
     		break;
    @@ -8477,7 +8519,7 @@ systrace_entry_setargdesc(int sysnum, in
     			break;
     		};
     		break;
    -	/* cap_getrights */
    +	/* cap_rights_get */
     	case 515:
     		switch(ndx) {
     		case 0:
    @@ -8745,6 +8787,77 @@ systrace_entry_setargdesc(int sysnum, in
     			break;
     		};
     		break;
    +	/* cap_rights_limit */
    +	case 533:
    +		switch(ndx) {
    +		case 0:
    +			p = "int";
    +			break;
    +		case 1:
    +			p = "uint64_t";
    +			break;
    +		default:
    +			break;
    +		};
    +		break;
    +	/* cap_ioctls_limit */
    +	case 534:
    +		switch(ndx) {
    +		case 0:
    +			p = "int";
    +			break;
    +		case 1:
    +			p = "const u_long *";
    +			break;
    +		case 2:
    +			p = "size_t";
    +			break;
    +		default:
    +			break;
    +		};
    +		break;
    +	/* cap_ioctls_get */
    +	case 535:
    +		switch(ndx) {
    +		case 0:
    +			p = "int";
    +			break;
    +		case 1:
    +			p = "u_long *";
    +			break;
    +		case 2:
    +			p = "size_t";
    +			break;
    +		default:
    +			break;
    +		};
    +		break;
    +	/* cap_fcntls_limit */
    +	case 536:
    +		switch(ndx) {
    +		case 0:
    +			p = "int";
    +			break;
    +		case 1:
    +			p = "uint32_t";
    +			break;
    +		default:
    +			break;
    +		};
    +		break;
    +	/* cap_fcntls_get */
    +	case 537:
    +		switch(ndx) {
    +		case 0:
    +			p = "int";
    +			break;
    +		case 1:
    +			p = "uint32_t *";
    +			break;
    +		default:
    +			break;
    +		};
    +		break;
     	default:
     		break;
     	};
    @@ -10556,7 +10669,7 @@ systrace_return_setargdesc(int sysnum, i
     		if (ndx == 0 || ndx == 1)
     			p = "int";
     		break;
    -	/* cap_getrights */
    +	/* cap_rights_get */
     	case 515:
     		if (ndx == 0 || ndx == 1)
     			p = "int";
    @@ -10638,6 +10751,31 @@ systrace_return_setargdesc(int sysnum, i
     		if (ndx == 0 || ndx == 1)
     			p = "int";
     		break;
    +	/* cap_rights_limit */
    +	case 533:
    +		if (ndx == 0 || ndx == 1)
    +			p = "int";
    +		break;
    +	/* cap_ioctls_limit */
    +	case 534:
    +		if (ndx == 0 || ndx == 1)
    +			p = "int";
    +		break;
    +	/* cap_ioctls_get */
    +	case 535:
    +		if (ndx == 0 || ndx == 1)
    +			p = "ssize_t";
    +		break;
    +	/* cap_fcntls_limit */
    +	case 536:
    +		if (ndx == 0 || ndx == 1)
    +			p = "int";
    +		break;
    +	/* cap_fcntls_get */
    +	case 537:
    +		if (ndx == 0 || ndx == 1)
    +			p = "int";
    +		break;
     	default:
     		break;
     	};
    
    Modified: head/sys/sys/syscall.h
    ==============================================================================
    --- head/sys/sys/syscall.h	Sat Mar  2 00:53:16 2013	(r247603)
    +++ head/sys/sys/syscall.h	Sat Mar  2 00:55:09 2013	(r247604)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/kern/syscalls.master 242958 2012-11-13 12:52:31Z kib 
    + * created from FreeBSD: head/sys/kern/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
      */
     
     #define	SYS_syscall	0
    @@ -435,7 +435,7 @@
     #define	SYS_shmctl	512
     #define	SYS_lpathconf	513
     #define	SYS_cap_new	514
    -#define	SYS_cap_getrights	515
    +#define	SYS_cap_rights_get	515
     #define	SYS_cap_enter	516
     #define	SYS_cap_getmode	517
     #define	SYS_pdfork	518
    @@ -452,4 +452,9 @@
     #define	SYS_posix_fallocate	530
     #define	SYS_posix_fadvise	531
     #define	SYS_wait6	532
    -#define	SYS_MAXSYSCALL	533
    +#define	SYS_cap_rights_limit	533
    +#define	SYS_cap_ioctls_limit	534
    +#define	SYS_cap_ioctls_get	535
    +#define	SYS_cap_fcntls_limit	536
    +#define	SYS_cap_fcntls_get	537
    +#define	SYS_MAXSYSCALL	538
    
    Modified: head/sys/sys/syscall.mk
    ==============================================================================
    --- head/sys/sys/syscall.mk	Sat Mar  2 00:53:16 2013	(r247603)
    +++ head/sys/sys/syscall.mk	Sat Mar  2 00:55:09 2013	(r247604)
    @@ -1,7 +1,7 @@
     # FreeBSD system call names.
     # DO NOT EDIT-- this file is automatically generated.
     # $FreeBSD$
    -# created from FreeBSD: head/sys/kern/syscalls.master 242958 2012-11-13 12:52:31Z kib 
    +# created from FreeBSD: head/sys/kern/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
     MIASM =  \
     	syscall.o \
     	exit.o \
    @@ -384,7 +384,7 @@ MIASM =  \
     	shmctl.o \
     	lpathconf.o \
     	cap_new.o \
    -	cap_getrights.o \
    +	cap_rights_get.o \
     	cap_enter.o \
     	cap_getmode.o \
     	pdfork.o \
    @@ -400,4 +400,9 @@ MIASM =  \
     	rctl_remove_rule.o \
     	posix_fallocate.o \
     	posix_fadvise.o \
    -	wait6.o
    +	wait6.o \
    +	cap_rights_limit.o \
    +	cap_ioctls_limit.o \
    +	cap_ioctls_get.o \
    +	cap_fcntls_limit.o \
    +	cap_fcntls_get.o
    
    Modified: head/sys/sys/sysproto.h
    ==============================================================================
    --- head/sys/sys/sysproto.h	Sat Mar  2 00:53:16 2013	(r247603)
    +++ head/sys/sys/sysproto.h	Sat Mar  2 00:55:09 2013	(r247604)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/kern/syscalls.master 242958 2012-11-13 12:52:31Z kib 
    + * created from FreeBSD: head/sys/kern/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
      */
     
     #ifndef _SYS_SYSPROTO_H_
    @@ -1676,7 +1676,7 @@ struct cap_new_args {
     	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
     	char rights_l_[PADL_(uint64_t)]; uint64_t rights; char rights_r_[PADR_(uint64_t)];
     };
    -struct cap_getrights_args {
    +struct cap_rights_get_args {
     	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
     	char rightsp_l_[PADL_(uint64_t *)]; uint64_t * rightsp; char rightsp_r_[PADR_(uint64_t *)];
     };
    @@ -1762,6 +1762,28 @@ struct wait6_args {
     	char wrusage_l_[PADL_(struct __wrusage *)]; struct __wrusage * wrusage; char wrusage_r_[PADR_(struct __wrusage *)];
     	char info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)];
     };
    +struct cap_rights_limit_args {
    +	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
    +	char rights_l_[PADL_(uint64_t)]; uint64_t rights; char rights_r_[PADR_(uint64_t)];
    +};
    +struct cap_ioctls_limit_args {
    +	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
    +	char cmds_l_[PADL_(const u_long *)]; const u_long * cmds; char cmds_r_[PADR_(const u_long *)];
    +	char ncmds_l_[PADL_(size_t)]; size_t ncmds; char ncmds_r_[PADR_(size_t)];
    +};
    +struct cap_ioctls_get_args {
    +	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
    +	char cmds_l_[PADL_(u_long *)]; u_long * cmds; char cmds_r_[PADR_(u_long *)];
    +	char maxcmds_l_[PADL_(size_t)]; size_t maxcmds; char maxcmds_r_[PADR_(size_t)];
    +};
    +struct cap_fcntls_limit_args {
    +	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
    +	char fcntlrights_l_[PADL_(uint32_t)]; uint32_t fcntlrights; char fcntlrights_r_[PADR_(uint32_t)];
    +};
    +struct cap_fcntls_get_args {
    +	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
    +	char fcntlrightsp_l_[PADL_(uint32_t *)]; uint32_t * fcntlrightsp; char fcntlrightsp_r_[PADR_(uint32_t *)];
    +};
     int	nosys(struct thread *, struct nosys_args *);
     void	sys_sys_exit(struct thread *, struct sys_exit_args *);
     int	sys_fork(struct thread *, struct fork_args *);
    @@ -2127,7 +2149,7 @@ int	sys_msgctl(struct thread *, struct m
     int	sys_shmctl(struct thread *, struct shmctl_args *);
     int	sys_lpathconf(struct thread *, struct lpathconf_args *);
     int	sys_cap_new(struct thread *, struct cap_new_args *);
    -int	sys_cap_getrights(struct thread *, struct cap_getrights_args *);
    +int	sys_cap_rights_get(struct thread *, struct cap_rights_get_args *);
     int	sys_cap_enter(struct thread *, struct cap_enter_args *);
     int	sys_cap_getmode(struct thread *, struct cap_getmode_args *);
     int	sys_pdfork(struct thread *, struct pdfork_args *);
    @@ -2144,6 +2166,11 @@ int	sys_rctl_remove_rule(struct thread *
     int	sys_posix_fallocate(struct thread *, struct posix_fallocate_args *);
     int	sys_posix_fadvise(struct thread *, struct posix_fadvise_args *);
     int	sys_wait6(struct thread *, struct wait6_args *);
    +int	sys_cap_rights_limit(struct thread *, struct cap_rights_limit_args *);
    +int	sys_cap_ioctls_limit(struct thread *, struct cap_ioctls_limit_args *);
    +int	sys_cap_ioctls_get(struct thread *, struct cap_ioctls_get_args *);
    +int	sys_cap_fcntls_limit(struct thread *, struct cap_fcntls_limit_args *);
    +int	sys_cap_fcntls_get(struct thread *, struct cap_fcntls_get_args *);
     
     #ifdef COMPAT_43
     
    @@ -2823,7 +2850,7 @@ int	freebsd7_shmctl(struct thread *, str
     #define	SYS_AUE_shmctl	AUE_SHMCTL
     #define	SYS_AUE_lpathconf	AUE_LPATHCONF
     #define	SYS_AUE_cap_new	AUE_CAP_NEW
    -#define	SYS_AUE_cap_getrights	AUE_CAP_GETRIGHTS
    +#define	SYS_AUE_cap_rights_get	AUE_CAP_RIGHTS_GET
     #define	SYS_AUE_cap_enter	AUE_CAP_ENTER
     #define	SYS_AUE_cap_getmode	AUE_CAP_GETMODE
     #define	SYS_AUE_pdfork	AUE_PDFORK
    @@ -2840,6 +2867,11 @@ int	freebsd7_shmctl(struct thread *, str
     #define	SYS_AUE_posix_fallocate	AUE_NULL
     #define	SYS_AUE_posix_fadvise	AUE_NULL
     #define	SYS_AUE_wait6	AUE_WAIT6
    +#define	SYS_AUE_cap_rights_limit	AUE_CAP_RIGHTS_LIMIT
    +#define	SYS_AUE_cap_ioctls_limit	AUE_CAP_IOCTLS_LIMIT
    +#define	SYS_AUE_cap_ioctls_get	AUE_CAP_IOCTLS_GET
    +#define	SYS_AUE_cap_fcntls_limit	AUE_CAP_FCNTLS_LIMIT
    +#define	SYS_AUE_cap_fcntls_get	AUE_CAP_FCNTLS_GET
     
     #undef PAD_
     #undef PADL_
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 00:56:54 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 5B9B3505;
     Sat,  2 Mar 2013 00:56:54 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 4CFE31F70;
     Sat,  2 Mar 2013 00:56:54 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r220usbO064141;
     Sat, 2 Mar 2013 00:56:54 GMT (envelope-from pjd@svn.freebsd.org)
    Received: (from pjd@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r220us8E064137;
     Sat, 2 Mar 2013 00:56:54 GMT (envelope-from pjd@svn.freebsd.org)
    Message-Id: <201303020056.r220us8E064137@svn.freebsd.org>
    From: Pawel Jakub Dawidek 
    Date: Sat, 2 Mar 2013 00:56:54 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247605 - head/tools/regression/security/cap_test
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 00:56:54 -0000
    
    Author: pjd
    Date: Sat Mar  2 00:56:53 2013
    New Revision: 247605
    URL: http://svnweb.freebsd.org/changeset/base/247605
    
    Log:
      Update existing regression tests after Capsicum overhaul.
    
    Modified:
      head/tools/regression/security/cap_test/cap_test_capabilities.c
      head/tools/regression/security/cap_test/cap_test_relative.c
    
    Modified: head/tools/regression/security/cap_test/cap_test_capabilities.c
    ==============================================================================
    --- head/tools/regression/security/cap_test/cap_test_capabilities.c	Sat Mar  2 00:55:09 2013	(r247604)
    +++ head/tools/regression/security/cap_test/cap_test_capabilities.c	Sat Mar  2 00:56:53 2013	(r247605)
    @@ -1,8 +1,12 @@
     /*-
      * Copyright (c) 2009-2011 Robert N. M. Watson
      * Copyright (c) 2011 Jonathan Anderson
    + * Copyright (c) 2012 FreeBSD Foundation
      * All rights reserved.
      *
    + * Portions of this software were developed by Pawel Jakub Dawidek under
    + * sponsorship from the FreeBSD Foundation.
    + *
      * Redistribution and use in source and binary forms, with or without
      * modification, are permitted provided that the following conditions
      * are met:
    @@ -43,6 +47,7 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     #include 
    +#include 
     #include 
     #include 
     #include 
    @@ -60,14 +65,20 @@ __FBSDID("$FreeBSD$");
      */
     #define	CHECK_RESULT(syscall, rights_needed, succeeded)	do {		\
     	if ((rights & (rights_needed)) == (rights_needed)) {		\
    -		if (!(succeeded))					\
    +		if (succeeded) {					\
    +			if (success == -1)				\
    +				success = PASSED;			\
    +		} else {						\
     			SYSCALL_FAIL(syscall, "failed");		\
    +		}							\
     	} else {							\
    -		if (succeeded)						\
    +		if (succeeded) {					\
     			FAILX("%s:\tsucceeded when it shouldn't have"	\
    -			    " (rights 0x%jx)", #syscall, rights);	\
    -		else if (errno != ENOTCAPABLE)				\
    +			    " (rights 0x%jx)", #syscall,		\
    +			    (uintmax_t)rights);				\
    +		} else if (errno != ENOTCAPABLE) {			\
     			SYSCALL_FAIL(syscall, "errno != ENOTCAPABLE");	\
    +		}							\
     	}								\
     	errno = 0;							\
     } while (0)
    @@ -79,8 +90,11 @@ __FBSDID("$FreeBSD$");
     	if ((rights & (rights_needed)) == (rights_needed)) {		\
     		if (p == MAP_FAILED)					\
     			SYSCALL_FAIL(mmap, "failed");			\
    -		else							\
    +		else {							\
     			(void)munmap(p, getpagesize());			\
    +			if (success == -1)				\
    +				success = PASSED;			\
    +		}							\
     	} else {							\
     		if (p != MAP_FAILED) {					\
     			FAILX("%s:\tsucceeded when it shouldn't have"	\
    @@ -97,96 +111,200 @@ __FBSDID("$FreeBSD$");
      * make sure only those rights work. 
     */
     static int
    -try_file_ops(int fd, cap_rights_t rights)
    +try_file_ops(int filefd, int dirfd, cap_rights_t rights)
     {
     	struct stat sb;
     	struct statfs sf;
    -	int fd_cap, fd_capcap;
    +	cap_rights_t erights;
    +	int fd_cap, fd_capcap, dfd_cap;
     	ssize_t ssize, ssize2;
     	off_t off;
     	void *p;
     	char ch;
     	int ret, is_nfs;
     	struct pollfd pollfd;
    -	int success = PASSED;
    +	int success = -1;
     
    -	REQUIRE(fstatfs(fd, &sf));
    -	is_nfs = (strncmp("nfs", sf.f_fstypename, sizeof(sf.f_fstypename))
    -	    == 0);
    +	REQUIRE(fstatfs(filefd, &sf));
    +	is_nfs = (strcmp("nfs", sf.f_fstypename) == 0);
     
    -	REQUIRE(fd_cap = cap_new(fd, rights));
    +	REQUIRE(fd_cap = cap_new(filefd, rights));
    +	CHECK(cap_getrights(fd_cap, &erights) == 0);
    +	CHECK(rights == erights);
     	REQUIRE(fd_capcap = cap_new(fd_cap, rights));
    +	CHECK(cap_getrights(fd_capcap, &erights) == 0);
    +	CHECK(rights == erights);
     	CHECK(fd_capcap != fd_cap);
    -
    -	pollfd.fd = fd_cap;
    -	pollfd.events = POLLIN | POLLERR | POLLHUP;
    -	pollfd.revents = 0;
    +	REQUIRE(dfd_cap = cap_new(dirfd, rights));
    +	CHECK(cap_getrights(dfd_cap, &erights) == 0);
    +	CHECK(rights == erights);
     
     	ssize = read(fd_cap, &ch, sizeof(ch));
    -	CHECK_RESULT(read, CAP_READ | CAP_SEEK, ssize >= 0);
    -
    -	ssize = pread(fd_cap, &ch, sizeof(ch), 0);
    -	ssize2 = pread(fd_cap, &ch, sizeof(ch), 0);
    -	CHECK_RESULT(pread, CAP_READ, ssize >= 0);
    -	CHECK(ssize == ssize2);
    +	CHECK_RESULT(read, CAP_READ, ssize >= 0);
     
     	ssize = write(fd_cap, &ch, sizeof(ch));
    -	CHECK_RESULT(write, CAP_WRITE | CAP_SEEK, ssize >= 0);
    -
    -	ssize = pwrite(fd_cap, &ch, sizeof(ch), 0);
    -	CHECK_RESULT(pwrite, CAP_WRITE, ssize >= 0);
    +	CHECK_RESULT(write, CAP_WRITE, ssize >= 0);
     
     	off = lseek(fd_cap, 0, SEEK_SET);
     	CHECK_RESULT(lseek, CAP_SEEK, off >= 0);
     
    -	/*
    -	 * Note: this is not expected to work over NFS.
    -	 */
    -	ret = fchflags(fd_cap, UF_NODUMP);
    -	CHECK_RESULT(fchflags, CAP_FCHFLAGS,
    -	    (ret == 0) || (is_nfs && (errno == EOPNOTSUPP)));
    +	ssize = pread(fd_cap, &ch, sizeof(ch), 0);
    +	ssize2 = pread(fd_cap, &ch, sizeof(ch), 0);
    +	CHECK_RESULT(pread, CAP_PREAD, ssize >= 0);
    +	CHECK(ssize == ssize2);
     
    -	ret = fstat(fd_cap, &sb);
    -	CHECK_RESULT(fstat, CAP_FSTAT, ret == 0);
    +	ssize = pwrite(fd_cap, &ch, sizeof(ch), 0);
    +	CHECK_RESULT(pwrite, CAP_PWRITE, ssize >= 0);
    +
    +	p = mmap(NULL, getpagesize(), PROT_NONE, MAP_SHARED, fd_cap, 0);
    +	CHECK_MMAP_RESULT(CAP_MMAP);
     
     	p = mmap(NULL, getpagesize(), PROT_READ, MAP_SHARED, fd_cap, 0);
    -	CHECK_MMAP_RESULT(CAP_MMAP | CAP_READ);
    +	CHECK_MMAP_RESULT(CAP_MMAP_R);
     
     	p = mmap(NULL, getpagesize(), PROT_WRITE, MAP_SHARED, fd_cap, 0);
    -	CHECK_MMAP_RESULT(CAP_MMAP | CAP_WRITE);
    +	CHECK_MMAP_RESULT(CAP_MMAP_W);
     
     	p = mmap(NULL, getpagesize(), PROT_EXEC, MAP_SHARED, fd_cap, 0);
    -	CHECK_MMAP_RESULT(CAP_MMAP | CAP_MAPEXEC);
    +	CHECK_MMAP_RESULT(CAP_MMAP_X);
     
     	p = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_SHARED,
     	    fd_cap, 0);
    -	CHECK_MMAP_RESULT(CAP_MMAP | CAP_READ | CAP_WRITE);
    +	CHECK_MMAP_RESULT(CAP_MMAP_RW);
     
     	p = mmap(NULL, getpagesize(), PROT_READ | PROT_EXEC, MAP_SHARED,
     	    fd_cap, 0);
    -	CHECK_MMAP_RESULT(CAP_MMAP | CAP_READ | CAP_MAPEXEC);
    +	CHECK_MMAP_RESULT(CAP_MMAP_RX);
     
     	p = mmap(NULL, getpagesize(), PROT_EXEC | PROT_WRITE, MAP_SHARED,
     	    fd_cap, 0);
    -	CHECK_MMAP_RESULT(CAP_MMAP | CAP_MAPEXEC | CAP_WRITE);
    +	CHECK_MMAP_RESULT(CAP_MMAP_WX);
     
     	p = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE | PROT_EXEC,
     	    MAP_SHARED, fd_cap, 0);
    -	CHECK_MMAP_RESULT(CAP_MMAP | CAP_READ | CAP_WRITE | CAP_MAPEXEC);
    +	CHECK_MMAP_RESULT(CAP_MMAP_RWX);
    +
    +	/* TODO: openat(O_APPEND) */
    +	ret = openat(dfd_cap, "cap_create", O_CREAT | O_RDONLY, 0600);
    +	CHECK_RESULT(openat(O_CREATE | O_RDONLY),
    +	    CAP_CREATE | CAP_READ | CAP_LOOKUP, ret >= 0);
    +	CHECK(ret == -1 || close(ret) == 0);
    +	CHECK(ret == -1 || unlinkat(dirfd, "cap_create", 0) == 0);
    +	ret = openat(dfd_cap, "cap_create", O_CREAT | O_WRONLY, 0600);
    +	CHECK_RESULT(openat(O_CREATE | O_WRONLY),
    +	    CAP_CREATE | CAP_WRITE | CAP_LOOKUP, ret >= 0);
    +	CHECK(ret == -1 || close(ret) == 0);
    +	CHECK(ret == -1 || unlinkat(dirfd, "cap_create", 0) == 0);
    +	ret = openat(dfd_cap, "cap_create", O_CREAT | O_RDWR, 0600);
    +	CHECK_RESULT(openat(O_CREATE | O_RDWR),
    +	    CAP_CREATE | CAP_READ | CAP_WRITE | CAP_LOOKUP, ret >= 0);
    +	CHECK(ret == -1 || close(ret) == 0);
    +	CHECK(ret == -1 || unlinkat(dirfd, "cap_create", 0) == 0);
     
     	ret = fsync(fd_cap);
     	CHECK_RESULT(fsync, CAP_FSYNC, ret == 0);
     
    +	ret = openat(dirfd, "cap_fsync", O_CREAT, 0600);
    +	CHECK(ret >= 0);
    +	CHECK(close(ret) == 0);
    +	ret = openat(dfd_cap, "cap_fsync", O_FSYNC | O_RDONLY, 0600);
    +	CHECK_RESULT(openat(O_FSYNC | O_RDONLY),
    +	    CAP_FSYNC | CAP_READ | CAP_LOOKUP, ret >= 0);
    +	CHECK(ret == -1 || close(ret) == 0);
    +	ret = openat(dfd_cap, "cap_fsync", O_FSYNC | O_WRONLY, 0600);
    +	CHECK_RESULT(openat(O_FSYNC | O_WRONLY),
    +	    CAP_FSYNC | CAP_WRITE | CAP_LOOKUP, ret >= 0);
    +	CHECK(ret == -1 || close(ret) == 0);
    +	ret = openat(dfd_cap, "cap_fsync", O_FSYNC | O_RDWR, 0600);
    +	CHECK_RESULT(openat(O_FSYNC | O_RDWR),
    +	    CAP_FSYNC | CAP_READ | CAP_WRITE | CAP_LOOKUP, ret >= 0);
    +	CHECK(ret == -1 || close(ret) == 0);
    +	ret = openat(dfd_cap, "cap_fsync", O_SYNC | O_RDONLY, 0600);
    +	CHECK_RESULT(openat(O_SYNC | O_RDONLY),
    +	    CAP_FSYNC | CAP_READ | CAP_LOOKUP, ret >= 0);
    +	CHECK(ret == -1 || close(ret) == 0);
    +	ret = openat(dfd_cap, "cap_fsync", O_SYNC | O_WRONLY, 0600);
    +	CHECK_RESULT(openat(O_SYNC | O_WRONLY),
    +	    CAP_FSYNC | CAP_WRITE | CAP_LOOKUP, ret >= 0);
    +	CHECK(ret == -1 || close(ret) == 0);
    +	ret = openat(dfd_cap, "cap_fsync", O_SYNC | O_RDWR, 0600);
    +	CHECK_RESULT(openat(O_SYNC | O_RDWR),
    +	    CAP_FSYNC | CAP_READ | CAP_WRITE | CAP_LOOKUP, ret >= 0);
    +	CHECK(ret == -1 || close(ret) == 0);
    +	CHECK(unlinkat(dirfd, "cap_fsync", 0) == 0);
    +
    +	ret = ftruncate(fd_cap, 0);
    +	CHECK_RESULT(ftruncate, CAP_FTRUNCATE, ret == 0);
    +
    +	ret = openat(dirfd, "cap_ftruncate", O_CREAT, 0600);
    +	CHECK(ret >= 0);
    +	CHECK(close(ret) == 0);
    +	ret = openat(dfd_cap, "cap_ftruncate", O_TRUNC | O_RDONLY);
    +	CHECK_RESULT(openat(O_TRUNC | O_RDONLY),
    +	    CAP_FTRUNCATE | CAP_READ | CAP_LOOKUP, ret >= 0);
    +	CHECK(ret == -1 || close(ret) == 0);
    +	ret = openat(dfd_cap, "cap_ftruncate", O_TRUNC | O_WRONLY);
    +	CHECK_RESULT(openat(O_TRUNC | O_WRONLY),
    +	    CAP_FTRUNCATE | CAP_WRITE | CAP_LOOKUP, ret >= 0);
    +	CHECK(ret == -1 || close(ret) == 0);
    +	ret = openat(dfd_cap, "cap_ftruncate", O_TRUNC | O_RDWR);
    +	CHECK_RESULT(openat(O_TRUNC | O_RDWR),
    +	    CAP_FTRUNCATE | CAP_READ | CAP_WRITE | CAP_LOOKUP, ret >= 0);
    +	CHECK(ret == -1 || close(ret) == 0);
    +	CHECK(unlinkat(dirfd, "cap_ftruncate", 0) == 0);
    +
    +	/*
    +	 * Note: this is not expected to work over NFS.
    +	 */
    +	ret = fchflags(fd_cap, UF_NODUMP);
    +	CHECK_RESULT(fchflags, CAP_FCHFLAGS,
    +	    ret == 0 || (is_nfs && errno == EOPNOTSUPP));
    +
    +#ifdef TODO	/* No such syscalls yet. */
    +	ret = openat(dirfd, "cap_fchflagsat", O_CREAT, 0600);
    +	CHECK(ret >= 0);
    +	CHECK(close(ret) == 0);
    +	ret = fchflagsat(dfd_cap, "cap_fchflagsat", UF_NODUMP, 0);
    +	CHECK_RESULT(fchflagsat, CAP_FCHFLAGSAT | CAP_LOOKUP, ret == 0);
    +	CHECK(unlinkat(dirfd, "cap_fchflagsat", 0) == 0);
    +#endif
    +
     	ret = fchown(fd_cap, -1, -1);
     	CHECK_RESULT(fchown, CAP_FCHOWN, ret == 0);
     
    +	ret = openat(dirfd, "cap_fchownat", O_CREAT, 0600);
    +	CHECK(ret >= 0);
    +	CHECK(close(ret) == 0);
    +	ret = fchownat(dfd_cap, "cap_fchownat", -1, -1, 0);
    +	CHECK_RESULT(fchownat, CAP_FCHOWN | CAP_LOOKUP, ret == 0);
    +	CHECK(unlinkat(dirfd, "cap_fchownat", 0) == 0);
    +
     	ret = fchmod(fd_cap, 0644);
     	CHECK_RESULT(fchmod, CAP_FCHMOD, ret == 0);
     
    +	ret = openat(dirfd, "cap_fchmodat", O_CREAT, 0600);
    +	CHECK(ret >= 0);
    +	CHECK(close(ret) == 0);
    +	ret = fchmodat(dfd_cap, "cap_fchmodat", 0600, 0);
    +	CHECK_RESULT(fchmodat, CAP_FCHMOD | CAP_LOOKUP, ret == 0);
    +	CHECK(unlinkat(dirfd, "cap_fchmodat", 0) == 0);
    +
    +	ret = fcntl(fd_cap, F_GETFL);
    +	CHECK_RESULT(fcntl(F_GETFL), CAP_FCNTL, ret >= 0);
    +	ret = fcntl(fd_cap, F_SETFL, ret);
    +	CHECK_RESULT(fcntl(F_SETFL), CAP_FCNTL, ret == 0);
    +
     	/* XXX flock */
     
    -	ret = ftruncate(fd_cap, 0);
    -	CHECK_RESULT(ftruncate, CAP_FTRUNCATE, ret == 0);
    +	ret = fstat(fd_cap, &sb);
    +	CHECK_RESULT(fstat, CAP_FSTAT, ret == 0);
    +
    +	ret = openat(dirfd, "cap_fstatat", O_CREAT, 0600);
    +	CHECK(ret >= 0);
    +	CHECK(close(ret) == 0);
    +	ret = fstatat(dfd_cap, "cap_fstatat", &sb, 0);
    +	CHECK_RESULT(fstatat, CAP_FSTAT | CAP_LOOKUP, ret == 0);
    +	CHECK(unlinkat(dirfd, "cap_fstatat", 0) == 0);
     
     	ret = fstatfs(fd_cap, &sf);
     	CHECK_RESULT(fstatfs, CAP_FSTATFS, ret == 0);
    @@ -197,6 +315,55 @@ try_file_ops(int fd, cap_rights_t rights
     	ret = futimes(fd_cap, NULL);
     	CHECK_RESULT(futimes, CAP_FUTIMES, ret == 0);
     
    +	ret = openat(dirfd, "cap_futimesat", O_CREAT, 0600);
    +	CHECK(ret >= 0);
    +	CHECK(close(ret) == 0);
    +	ret = futimesat(dfd_cap, "cap_futimesat", NULL);
    +	CHECK_RESULT(futimesat, CAP_FUTIMES | CAP_LOOKUP, ret == 0);
    +	CHECK(unlinkat(dirfd, "cap_futimesat", 0) == 0);
    +
    +	ret = openat(dirfd, "cap_linkat_src", O_CREAT, 0600);
    +	CHECK(ret >= 0);
    +	CHECK(close(ret) == 0);
    +	ret = linkat(dirfd, "cap_linkat_src", dfd_cap, "cap_linkat_dst", 0);
    +	CHECK_RESULT(linkat, CAP_LINKAT | CAP_LOOKUP, ret == 0);
    +	CHECK(unlinkat(dirfd, "cap_linkat_src", 0) == 0);
    +	CHECK(ret == -1 || unlinkat(dirfd, "cap_linkat_dst", 0) == 0);
    +
    +	ret = mkdirat(dfd_cap, "cap_mkdirat", 0700);
    +	CHECK_RESULT(mkdirat, CAP_MKDIRAT | CAP_LOOKUP, ret == 0);
    +	CHECK(ret == -1 || unlinkat(dirfd, "cap_mkdirat", AT_REMOVEDIR) == 0);
    +
    +	ret = mkfifoat(dfd_cap, "cap_mkfifoat", 0600);
    +	CHECK_RESULT(mkfifoat, CAP_MKFIFOAT | CAP_LOOKUP, ret == 0);
    +	CHECK(ret == -1 || unlinkat(dirfd, "cap_mkfifoat", 0) == 0);
    +
    +	ret = mknodat(dfd_cap, "cap_mknodat", S_IFCHR | 0600, 0);
    +	CHECK_RESULT(mknodat, CAP_MKNODAT | CAP_LOOKUP, ret == 0);
    +	CHECK(ret == -1 || unlinkat(dirfd, "cap_mknodat", 0) == 0);
    +
    +	/* TODO: renameat(2) */
    +
    +	ret = symlinkat("test", dfd_cap, "cap_symlinkat");
    +	CHECK_RESULT(symlinkat, CAP_SYMLINKAT | CAP_LOOKUP, ret == 0);
    +	CHECK(ret == -1 || unlinkat(dirfd, "cap_symlinkat", 0) == 0);
    +
    +	ret = openat(dirfd, "cap_unlinkat", O_CREAT, 0600);
    +	CHECK(ret >= 0);
    +	CHECK(close(ret) == 0);
    +	ret = unlinkat(dfd_cap, "cap_unlinkat", 0);
    +	CHECK_RESULT(unlinkat, CAP_UNLINKAT | CAP_LOOKUP, ret == 0);
    +	CHECK(ret == 0 || unlinkat(dirfd, "cap_unlinkat", 0) == 0);
    +	ret = mkdirat(dirfd, "cap_unlinkat", 0700);
    +	CHECK(ret == 0);
    +	ret = unlinkat(dfd_cap, "cap_unlinkat", AT_REMOVEDIR);
    +	CHECK_RESULT(unlinkat, CAP_UNLINKAT | CAP_LOOKUP, ret == 0);
    +	CHECK(ret == 0 || unlinkat(dirfd, "cap_unlinkat", AT_REMOVEDIR) == 0);
    +
    +	pollfd.fd = fd_cap;
    +	pollfd.events = POLLIN | POLLERR | POLLHUP;
    +	pollfd.revents = 0;
    +
     	ret = poll(&pollfd, 1, 0);
     	if (rights & CAP_POLL_EVENT)
     		CHECK((pollfd.revents & POLLNVAL) == 0);
    @@ -205,79 +372,159 @@ try_file_ops(int fd, cap_rights_t rights
     
     	/* XXX: select, kqueue */
     
    -	close (fd_cap);
    +	close(fd_cap);
    +	close(fd_capcap);
    +
    +	if (success == -1) {
    +		fprintf(stderr, "No tests for rights 0x%jx.\n",
    +		    (uintmax_t)rights);
    +		success = FAILED;
    +	}
     	return (success);
     }
     
    -#define TRY(fd, rights) \
    +#define TRY(rights) \
     do { \
     	if (success == PASSED) \
    -		success = try_file_ops(fd, rights); \
    +		success = try_file_ops(filefd, dirfd, (rights)); \
     	else \
     		/* We've already failed, but try the test anyway. */ \
    -		try_file_ops(fd, rights); \
    +		try_file_ops(filefd, dirfd, (rights)); \
     } while (0)
     
    +#define	KEEP_ERRNO(...)	do {						\
    +	int _saved_errno = errno;					\
    +	__VA_ARGS__;							\
    +	errno = _saved_errno;						\
    +} while (0);
    +
     int
     test_capabilities(void)
     {
    -	int fd;
    +	int filefd, dirfd, tmpfd;
     	int success = PASSED;
    +	char file[] = "/tmp/cap_test.XXXXXXXXXX";
    +	char dir[] = "/tmp/cap_test.XXXXXXXXXX";
     
    -	fd = open("/tmp/cap_test_capabilities", O_RDWR | O_CREAT, 0644);
    -	if (fd < 0)
    +	filefd = mkstemp(file);
    +	if (filefd < 0)
    +		err(-1, "mkstemp");
    +	if (mkdtemp(dir) == NULL) {
    +		KEEP_ERRNO(unlink(file));
    +		err(-1, "mkdtemp");
    +	}
    +	dirfd = open(dir, O_RDONLY | O_DIRECTORY);
    +	if (dirfd == -1) {
    +		KEEP_ERRNO(unlink(file));
    +		KEEP_ERRNO(rmdir(dir));
     		err(-1, "open");
    +	}
    +	tmpfd = open("/tmp", O_RDONLY | O_DIRECTORY);
    +	if (tmpfd == -1) {
    +		KEEP_ERRNO(unlink(file));
    +		KEEP_ERRNO(rmdir(dir));
    +		err(-1, "open");
    +	}
     
    -	if (cap_enter() < 0)
    +	if (cap_enter() == -1) {
    +		KEEP_ERRNO(unlink(file));
    +		KEEP_ERRNO(rmdir(dir));
     		err(-1, "cap_enter");
    +	}
     
    -	/* XXX: Really want to try all combinations. */
    -	TRY(fd, CAP_READ);
    -	TRY(fd, CAP_READ | CAP_SEEK);
    -	TRY(fd, CAP_WRITE);
    -	TRY(fd, CAP_WRITE | CAP_SEEK);
    -	TRY(fd, CAP_READ | CAP_WRITE);
    -	TRY(fd, CAP_READ | CAP_WRITE | CAP_SEEK);
    -	TRY(fd, CAP_SEEK);
    -	TRY(fd, CAP_FCHFLAGS);
    -	TRY(fd, CAP_IOCTL);
    -	TRY(fd, CAP_FSTAT);
    -	TRY(fd, CAP_MMAP);
    -	TRY(fd, CAP_MMAP | CAP_READ);
    -	TRY(fd, CAP_MMAP | CAP_WRITE);
    -	TRY(fd, CAP_MMAP | CAP_MAPEXEC);
    -	TRY(fd, CAP_MMAP | CAP_READ | CAP_WRITE);
    -	TRY(fd, CAP_MMAP | CAP_READ | CAP_MAPEXEC);
    -	TRY(fd, CAP_MMAP | CAP_MAPEXEC | CAP_WRITE);
    -	TRY(fd, CAP_MMAP | CAP_READ | CAP_WRITE | CAP_MAPEXEC);
    -	TRY(fd, CAP_FCNTL);
    -	TRY(fd, CAP_POST_EVENT);
    -	TRY(fd, CAP_POLL_EVENT);
    -	TRY(fd, CAP_FSYNC);
    -	TRY(fd, CAP_FCHOWN);
    -	TRY(fd, CAP_FCHMOD);
    -	TRY(fd, CAP_FTRUNCATE);
    -	TRY(fd, CAP_FLOCK);
    -	TRY(fd, CAP_FSTATFS);
    -	TRY(fd, CAP_FPATHCONF);
    -	TRY(fd, CAP_FUTIMES);
    -	TRY(fd, CAP_ACL_GET);
    -	TRY(fd, CAP_ACL_SET);
    -	TRY(fd, CAP_ACL_DELETE);
    -	TRY(fd, CAP_ACL_CHECK);
    -	TRY(fd, CAP_EXTATTR_GET);
    -	TRY(fd, CAP_EXTATTR_SET);
    -	TRY(fd, CAP_EXTATTR_DELETE);
    -	TRY(fd, CAP_EXTATTR_LIST);
    -	TRY(fd, CAP_MAC_GET);
    -	TRY(fd, CAP_MAC_SET);
    +	TRY(CAP_READ);
    +	TRY(CAP_WRITE);
    +	TRY(CAP_SEEK);
    +	TRY(CAP_PREAD);
    +	TRY(CAP_PWRITE);
    +	TRY(CAP_READ | CAP_WRITE);
    +	TRY(CAP_PREAD | CAP_PWRITE);
    +	TRY(CAP_MMAP);
    +	TRY(CAP_MMAP_R);
    +	TRY(CAP_MMAP_W);
    +	TRY(CAP_MMAP_X);
    +	TRY(CAP_MMAP_RW);
    +	TRY(CAP_MMAP_RX);
    +	TRY(CAP_MMAP_WX);
    +	TRY(CAP_MMAP_RWX);
    +	TRY(CAP_CREATE | CAP_READ | CAP_LOOKUP);
    +	TRY(CAP_CREATE | CAP_WRITE | CAP_LOOKUP);
    +	TRY(CAP_CREATE | CAP_READ | CAP_WRITE | CAP_LOOKUP);
    +#ifdef TODO
    +	TRY(CAP_FEXECVE);
    +#endif
    +	TRY(CAP_FSYNC);
    +	TRY(CAP_FSYNC | CAP_READ | CAP_LOOKUP);
    +	TRY(CAP_FSYNC | CAP_WRITE | CAP_LOOKUP);
    +	TRY(CAP_FSYNC | CAP_READ | CAP_WRITE | CAP_LOOKUP);
    +	TRY(CAP_FTRUNCATE);
    +	TRY(CAP_FTRUNCATE | CAP_READ | CAP_LOOKUP);
    +	TRY(CAP_FTRUNCATE | CAP_WRITE | CAP_LOOKUP);
    +	TRY(CAP_FTRUNCATE | CAP_READ | CAP_WRITE | CAP_LOOKUP);
    +#ifdef TODO
    +	TRY(CAP_FCHDIR);
    +#endif
    +	TRY(CAP_FCHFLAGS);
    +	TRY(CAP_FCHOWN);
    +	TRY(CAP_FCHOWN | CAP_LOOKUP);
    +	TRY(CAP_FCHMOD | CAP_LOOKUP);
    +	TRY(CAP_FCNTL);
    +#ifdef TODO
    +	TRY(CAP_FLOCK);
    +#endif
    +	TRY(CAP_FPATHCONF);
    +#ifdef TODO
    +	TRY(CAP_FSCK);
    +#endif
    +	TRY(CAP_FSTAT | CAP_LOOKUP);
    +	TRY(CAP_FSTATFS);
    +	TRY(CAP_FUTIMES | CAP_LOOKUP);
    +	TRY(CAP_LINKAT | CAP_LOOKUP);
    +	TRY(CAP_MKDIRAT | CAP_LOOKUP);
    +	TRY(CAP_MKFIFOAT | CAP_LOOKUP);
    +	TRY(CAP_MKNODAT | CAP_LOOKUP);
    +	TRY(CAP_SYMLINKAT | CAP_LOOKUP);
    +	TRY(CAP_UNLINKAT | CAP_LOOKUP);
    +	/* Rename needs CAP_RENAMEAT on source directory and CAP_LINKAT on destination directory. */
    +	TRY(CAP_RENAMEAT | CAP_UNLINKAT | CAP_LOOKUP);
    +#ifdef TODO
    +	TRY(CAP_LOOKUP);
    +	TRY(CAP_EXTATTR_DELETE);
    +	TRY(CAP_EXTATTR_GET);
    +	TRY(CAP_EXTATTR_LIST);
    +	TRY(CAP_EXTATTR_SET);
    +	TRY(CAP_ACL_CHECK);
    +	TRY(CAP_ACL_DELETE);
    +	TRY(CAP_ACL_GET);
    +	TRY(CAP_ACL_SET);
    +	TRY(CAP_ACCEPT);
    +	TRY(CAP_BIND);
    +	TRY(CAP_CONNECT);
    +	TRY(CAP_GETPEERNAME);
    +	TRY(CAP_GETSOCKNAME);
    +	TRY(CAP_GETSOCKOPT);
    +	TRY(CAP_LISTEN);
    +	TRY(CAP_PEELOFF);
    +	TRY(CAP_RECV);
    +	TRY(CAP_SEND);
    +	TRY(CAP_SETSOCKOPT);
    +	TRY(CAP_SHUTDOWN);
    +	TRY(CAP_MAC_GET);
    +	TRY(CAP_MAC_SET);
    +	TRY(CAP_SEM_GETVALUE);
    +	TRY(CAP_SEM_POST);
    +	TRY(CAP_SEM_WAIT);
    +	TRY(CAP_POST_EVENT);
    +	TRY(CAP_POLL_EVENT);
    +	TRY(CAP_IOCTL);
    +	TRY(CAP_TTYHOOK);
    +	TRY(CAP_PDGETPID);
    +	TRY(CAP_PDWAIT);
    +	TRY(CAP_PDKILL);
    +#endif
     
    -	/*
    -	 * Socket-specific.
    -	 */
    -	TRY(fd, CAP_GETPEERNAME);
    -	TRY(fd, CAP_GETSOCKNAME);
    -	TRY(fd, CAP_ACCEPT);
    +	(void)unlinkat(tmpfd, file + strlen("/tmp/"), 0);
    +	(void)unlinkat(tmpfd, dir + strlen("/tmp/"), AT_REMOVEDIR);
     
     	return (success);
     }
    
    Modified: head/tools/regression/security/cap_test/cap_test_relative.c
    ==============================================================================
    --- head/tools/regression/security/cap_test/cap_test_relative.c	Sat Mar  2 00:55:09 2013	(r247604)
    +++ head/tools/regression/security/cap_test/cap_test_relative.c	Sat Mar  2 00:56:53 2013	(r247605)
    @@ -61,7 +61,8 @@ test_relative(void)
     	cap_rights_t rights;
     
     	REQUIRE(etc = open("/etc/", O_RDONLY));
    -	CHECK_SYSCALL_FAILS(EINVAL, cap_getrights, etc, &rights);
    +	CHECK_SYSCALL_SUCCEEDS(cap_getrights, etc, &rights);
    +	CHECK_RIGHTS(rights, CAP_ALL);
     
     	MAKE_CAPABILITY(etc_cap, etc, CAP_READ);
     	MAKE_CAPABILITY(etc_cap_ro, etc, CAP_READ | CAP_LOOKUP);
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 01:00:27 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id C76BB889;
     Sat,  2 Mar 2013 01:00:27 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id B8B1E1FA8;
     Sat,  2 Mar 2013 01:00:27 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r2210RIk064836;
     Sat, 2 Mar 2013 01:00:27 GMT (envelope-from pjd@svn.freebsd.org)
    Received: (from pjd@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r2210RLG064831;
     Sat, 2 Mar 2013 01:00:27 GMT (envelope-from pjd@svn.freebsd.org)
    Message-Id: <201303020100.r2210RLG064831@svn.freebsd.org>
    From: Pawel Jakub Dawidek 
    Date: Sat, 2 Mar 2013 01:00:27 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247606 - in head/tools/regression/capsicum: . syscalls
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 01:00:27 -0000
    
    Author: pjd
    Date: Sat Mar  2 01:00:26 2013
    New Revision: 247606
    URL: http://svnweb.freebsd.org/changeset/base/247606
    
    Log:
      Add regression tests for the new Capsicum system calls.
      
      Sponsored by:	The FreeBSD Foundation
    
    Added:
      head/tools/regression/capsicum/
      head/tools/regression/capsicum/syscalls/
      head/tools/regression/capsicum/syscalls/Makefile   (contents, props changed)
      head/tools/regression/capsicum/syscalls/cap_fcntls_limit.c   (contents, props changed)
      head/tools/regression/capsicum/syscalls/cap_getmode.c   (contents, props changed)
      head/tools/regression/capsicum/syscalls/cap_ioctls_limit.c   (contents, props changed)
      head/tools/regression/capsicum/syscalls/misc.c   (contents, props changed)
      head/tools/regression/capsicum/syscalls/misc.h   (contents, props changed)
    
    Added: head/tools/regression/capsicum/syscalls/Makefile
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/tools/regression/capsicum/syscalls/Makefile	Sat Mar  2 01:00:26 2013	(r247606)
    @@ -0,0 +1,28 @@
    +# $FreeBSD$
    +
    +SYSCALLS=	cap_fcntls_limit cap_getmode cap_ioctls_limit
    +
    +CFLAGS=		-O2 -pipe -std=gnu99 -fstack-protector
    +CFLAGS+=	-Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter
    +CFLAGS+=	-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type
    +CFLAGS+=	-Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter
    +CFLAGS+=	-Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
    +CFLAGS+=	-Wold-style-definition -Wno-pointer-sign
    +
    +all:	${SYSCALLS} ${SYSCALLS:=.t}
    +
    +.for SYSCALL in ${SYSCALLS}
    +
    +${SYSCALL}:	${SYSCALL}.c misc.c
    +	${CC} ${CFLAGS} ${@}.c misc.c -o $@
    +
    +${SYSCALL}.t:	${SYSCALL}
    +	@printf "#!/bin/sh\n\n%s/%s\n" ${.CURDIR} ${@:.t=} > $@
    +
    +.endfor
    +
    +test:	all
    +	@prove -r ${.CURDIR}
    +
    +clean:
    +	rm -f ${SYSCALLS} ${SYSCALLS:=.t}
    
    Added: head/tools/regression/capsicum/syscalls/cap_fcntls_limit.c
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/tools/regression/capsicum/syscalls/cap_fcntls_limit.c	Sat Mar  2 01:00:26 2013	(r247606)
    @@ -0,0 +1,540 @@
    +/*-
    + * Copyright (c) 2012 The FreeBSD Foundation
    + * All rights reserved.
    + *
    + * This software was developed by Pawel Jakub Dawidek under sponsorship from
    + * the FreeBSD Foundation.
    + *
    + * Redistribution and use in source and binary forms, with or without
    + * modification, are permitted provided that the following conditions
    + * are met:
    + * 1. Redistributions of source code must retain the above copyright
    + *    notice, this list of conditions and the following disclaimer.
    + * 2. 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 AUTHORS 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 AUTHORS 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 "misc.h"
    +
    +static void
    +fcntl_tests_0(int fd)
    +{
    +	uint32_t fcntlrights;
    +
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == CAP_FCNTL_ALL);
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(fcntl(fd, F_SETFD, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +
    +	CHECK(fcntl(fd, F_GETFL) == O_RDWR);
    +	CHECK(fcntl(fd, F_SETFL, O_NONBLOCK) == 0);
    +	CHECK(fcntl(fd, F_GETFL) == (O_RDWR | O_NONBLOCK));
    +	CHECK(fcntl(fd, F_SETFL, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFL) == O_RDWR);
    +
    +	errno = 0;
    +	CHECK(cap_fcntls_limit(fd, ~CAP_FCNTL_ALL) == -1);
    +	CHECK(errno == EINVAL);
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL | CAP_FCNTL_SETFL) == 0);
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == (CAP_FCNTL_GETFL | CAP_FCNTL_SETFL));
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL | CAP_FCNTL_SETFL) == 0);
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == (CAP_FCNTL_GETFL | CAP_FCNTL_SETFL));
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(fcntl(fd, F_SETFD, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +
    +	CHECK(fcntl(fd, F_GETFL) == O_RDWR);
    +	CHECK(fcntl(fd, F_SETFL, O_NONBLOCK) == 0);
    +	CHECK(fcntl(fd, F_GETFL) == (O_RDWR | O_NONBLOCK));
    +	CHECK(fcntl(fd, F_SETFL, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFL) == O_RDWR);
    +
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL) == 0);
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == CAP_FCNTL_GETFL);
    +	errno = 0;
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL | CAP_FCNTL_SETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == CAP_FCNTL_GETFL);
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(fcntl(fd, F_SETFD, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +
    +	CHECK(fcntl(fd, F_GETFL) == O_RDWR);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_SETFL, O_NONBLOCK) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(fcntl(fd, F_GETFL) == O_RDWR);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_SETFL, 0) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(fcntl(fd, F_GETFL) == O_RDWR);
    +
    +	CHECK(cap_fcntls_limit(fd, 0) == 0);
    +	fcntlrights = CAP_FCNTL_ALL;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == 0);
    +	errno = 0;
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL | CAP_FCNTL_SETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	fcntlrights = CAP_FCNTL_ALL;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == 0);
    +	errno = 0;
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	fcntlrights = CAP_FCNTL_ALL;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == 0);
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(fcntl(fd, F_SETFD, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +
    +	errno = 0;
    +	CHECK(fcntl(fd, F_GETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_SETFL, O_NONBLOCK) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_SETFL, 0) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_GETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +}
    +
    +static void
    +fcntl_tests_1(int fd)
    +{
    +	uint32_t fcntlrights;
    +
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL) == 0);
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == CAP_FCNTL_GETFL);
    +
    +	CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_FCNTL) == 0);
    +
    +	fcntlrights = CAP_FCNTL_ALL;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == 0);
    +
    +	errno = 0;
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL | CAP_FCNTL_SETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	fcntlrights = CAP_FCNTL_ALL;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == 0);
    +	errno = 0;
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	fcntlrights = CAP_FCNTL_ALL;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == 0);
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(fcntl(fd, F_SETFD, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +
    +	errno = 0;
    +	CHECK(fcntl(fd, F_GETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_SETFL, O_NONBLOCK) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_SETFL, 0) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_GETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +}
    +
    +static void
    +fcntl_tests_2(int fd)
    +{
    +	uint32_t fcntlrights;
    +
    +	CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_FCNTL) == 0);
    +
    +	fcntlrights = CAP_FCNTL_ALL;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == 0);
    +
    +	errno = 0;
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL | CAP_FCNTL_SETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	fcntlrights = CAP_FCNTL_ALL;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == 0);
    +	errno = 0;
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	fcntlrights = CAP_FCNTL_ALL;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == 0);
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(fcntl(fd, F_SETFD, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +
    +	errno = 0;
    +	CHECK(fcntl(fd, F_GETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_SETFL, O_NONBLOCK) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_SETFL, 0) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_GETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +}
    +
    +static void
    +fcntl_tests_send_0(int sock)
    +{
    +	int fd;
    +
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	CHECK(descriptor_send(sock, fd) == 0);
    +	CHECK(close(fd) == 0);
    +
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL | CAP_FCNTL_SETFL) == 0);
    +	CHECK(descriptor_send(sock, fd) == 0);
    +	CHECK(close(fd) == 0);
    +
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL) == 0);
    +	CHECK(descriptor_send(sock, fd) == 0);
    +	CHECK(close(fd) == 0);
    +
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	CHECK(cap_fcntls_limit(fd, 0) == 0);
    +	CHECK(descriptor_send(sock, fd) == 0);
    +	CHECK(close(fd) == 0);
    +}
    +
    +static void
    +fcntl_tests_recv_0(int sock)
    +{
    +	uint32_t fcntlrights;
    +	int fd;
    +
    +	CHECK(descriptor_recv(sock, &fd) == 0);
    +
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == CAP_FCNTL_ALL);
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(fcntl(fd, F_SETFD, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +
    +	CHECK(fcntl(fd, F_GETFL) == O_RDWR);
    +	CHECK(fcntl(fd, F_SETFL, O_NONBLOCK) == 0);
    +	CHECK(fcntl(fd, F_GETFL) == (O_RDWR | O_NONBLOCK));
    +	CHECK(fcntl(fd, F_SETFL, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFL) == O_RDWR);
    +
    +	CHECK(close(fd) == 0);
    +
    +	CHECK(descriptor_recv(sock, &fd) == 0);
    +
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == (CAP_FCNTL_GETFL | CAP_FCNTL_SETFL));
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL | CAP_FCNTL_SETFL) == 0);
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == (CAP_FCNTL_GETFL | CAP_FCNTL_SETFL));
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(fcntl(fd, F_SETFD, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +
    +	CHECK(fcntl(fd, F_GETFL) == O_RDWR);
    +	CHECK(fcntl(fd, F_SETFL, O_NONBLOCK) == 0);
    +	CHECK(fcntl(fd, F_GETFL) == (O_RDWR | O_NONBLOCK));
    +	CHECK(fcntl(fd, F_SETFL, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFL) == O_RDWR);
    +
    +	CHECK(close(fd) == 0);
    +
    +	CHECK(descriptor_recv(sock, &fd) == 0);
    +
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == CAP_FCNTL_GETFL);
    +	errno = 0;
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL | CAP_FCNTL_SETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == CAP_FCNTL_GETFL);
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL) == 0);
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == CAP_FCNTL_GETFL);
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(fcntl(fd, F_SETFD, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +
    +	CHECK(fcntl(fd, F_GETFL) == O_RDWR);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_SETFL, O_NONBLOCK) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(fcntl(fd, F_GETFL) == O_RDWR);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_SETFL, 0) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(fcntl(fd, F_GETFL) == O_RDWR);
    +
    +	CHECK(close(fd) == 0);
    +
    +	CHECK(descriptor_recv(sock, &fd) == 0);
    +
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == 0);
    +	errno = 0;
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL | CAP_FCNTL_SETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == 0);
    +	errno = 0;
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == 0);
    +	errno = 0;
    +	CHECK(cap_fcntls_limit(fd, CAP_FCNTL_SETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	fcntlrights = 0;
    +	CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
    +	CHECK(fcntlrights == 0);
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(fcntl(fd, F_SETFD, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +
    +	errno = 0;
    +	CHECK(fcntl(fd, F_GETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_SETFL, O_NONBLOCK) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_SETFL, 0) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	errno = 0;
    +	CHECK(fcntl(fd, F_GETFL) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +
    +	CHECK(close(fd) == 0);
    +}
    +
    +int
    +main(void)
    +{
    +	int fd, pfd, sp[2];
    +	pid_t pid;
    +
    +	printf("1..870\n");
    +
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	fcntl_tests_0(fd);
    +	CHECK(close(fd) == 0);
    +
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	fcntl_tests_1(fd);
    +	CHECK(close(fd) == 0);
    +
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	fcntl_tests_2(fd);
    +	CHECK(close(fd) == 0);
    +
    +	/* Child inherits descriptor and operates on it first. */
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	CHECK((pid = fork()) >= 0);
    +	if (pid == 0) {
    +		fcntl_tests_0(fd);
    +		CHECK(close(fd) == 0);
    +		exit(0);
    +	} else {
    +		CHECK(waitpid(pid, NULL, 0) == pid);
    +		fcntl_tests_0(fd);
    +	}
    +	CHECK(close(fd) == 0);
    +
    +	/* Child inherits descriptor, but operates on it after parent. */
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	CHECK((pid = fork()) >= 0);
    +	if (pid == 0) {
    +		sleep(1);
    +		fcntl_tests_0(fd);
    +		CHECK(close(fd) == 0);
    +		exit(0);
    +	} else {
    +		fcntl_tests_0(fd);
    +		CHECK(waitpid(pid, NULL, 0) == pid);
    +	}
    +	CHECK(close(fd) == 0);
    +
    +	/* Child inherits descriptor and operates on it first. */
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	CHECK((pid = pdfork(&pfd, 0)) >= 0);
    +	if (pid == 0) {
    +		fcntl_tests_1(fd);
    +		exit(0);
    +	} else {
    +		CHECK(pdwait(pfd) == 0);
    +/*
    +		It fails with EBADF, which I believe is a bug.
    +		CHECK(close(pfd) == 0);
    +*/
    +		fcntl_tests_1(fd);
    +	}
    +	CHECK(close(fd) == 0);
    +
    +	/* Child inherits descriptor, but operates on it after parent. */
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	CHECK((pid = pdfork(&pfd, 0)) >= 0);
    +	if (pid == 0) {
    +		sleep(1);
    +		fcntl_tests_1(fd);
    +		exit(0);
    +	} else {
    +		fcntl_tests_1(fd);
    +		CHECK(pdwait(pfd) == 0);
    +/*
    +		It fails with EBADF, which I believe is a bug.
    +		CHECK(close(pfd) == 0);
    +*/
    +	}
    +	CHECK(close(fd) == 0);
    +
    +	/* Child inherits descriptor and operates on it first. */
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	CHECK((pid = fork()) >= 0);
    +	if (pid == 0) {
    +		fcntl_tests_2(fd);
    +		exit(0);
    +	} else {
    +		CHECK(waitpid(pid, NULL, 0) == pid);
    +		fcntl_tests_2(fd);
    +	}
    +	CHECK(close(fd) == 0);
    +
    +	/* Child inherits descriptor, but operates on it after parent. */
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	CHECK((pid = fork()) >= 0);
    +	if (pid == 0) {
    +		sleep(1);
    +		fcntl_tests_2(fd);
    +		exit(0);
    +	} else {
    +		fcntl_tests_2(fd);
    +		CHECK(waitpid(pid, NULL, 0) == pid);
    +	}
    +	CHECK(close(fd) == 0);
    +
    +	/* Send descriptors from parent to child. */
    +	CHECK(socketpair(AF_UNIX, SOCK_STREAM, 0, sp) == 0);
    +	CHECK((pid = fork()) >= 0);
    +	if (pid == 0) {
    +		CHECK(close(sp[0]) == 0);
    +		fcntl_tests_recv_0(sp[1]);
    +		CHECK(close(sp[1]) == 0);
    +		exit(0);
    +	} else {
    +		CHECK(close(sp[1]) == 0);
    +		fcntl_tests_send_0(sp[0]);
    +		CHECK(waitpid(pid, NULL, 0) == pid);
    +		CHECK(close(sp[0]) == 0);
    +	}
    +
    +	/* Send descriptors from child to parent. */
    +	CHECK(socketpair(AF_UNIX, SOCK_STREAM, 0, sp) == 0);
    +	CHECK((pid = fork()) >= 0);
    +	if (pid == 0) {
    +		CHECK(close(sp[0]) == 0);
    +		fcntl_tests_send_0(sp[1]);
    +		CHECK(close(sp[1]) == 0);
    +		exit(0);
    +	} else {
    +		CHECK(close(sp[1]) == 0);
    +		fcntl_tests_recv_0(sp[0]);
    +		CHECK(waitpid(pid, NULL, 0) == pid);
    +		CHECK(close(sp[0]) == 0);
    +	}
    +
    +	exit(0);
    +}
    
    Added: head/tools/regression/capsicum/syscalls/cap_getmode.c
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/tools/regression/capsicum/syscalls/cap_getmode.c	Sat Mar  2 01:00:26 2013	(r247606)
    @@ -0,0 +1,167 @@
    +/*-
    + * Copyright (c) 2012 The FreeBSD Foundation
    + * All rights reserved.
    + *
    + * This software was developed by Pawel Jakub Dawidek under sponsorship from
    + * the FreeBSD Foundation.
    + *
    + * Redistribution and use in source and binary forms, with or without
    + * modification, are permitted provided that the following conditions
    + * are met:
    + * 1. Redistributions of source code must retain the above copyright
    + *    notice, this list of conditions and the following disclaimer.
    + * 2. 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 AUTHORS 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 AUTHORS 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 "misc.h"
    +
    +int
    +main(void)
    +{
    +	unsigned int mode;
    +	pid_t pid;
    +	int pfd;
    +
    +	printf("1..27\n");
    +
    +	mode = 666;
    +	CHECK(cap_getmode(&mode) == 0);
    +	/* If cap_getmode() succeeded mode should be modified. */
    +	CHECK(mode != 666);
    +	/* We are not in capability mode. */
    +	CHECK(mode == 0);
    +
    +	/* Expect EFAULT. */
    +	errno = 0;
    +	CHECK(cap_getmode(NULL) == -1);
    +	CHECK(errno == EFAULT);
    +	errno = 0;
    +	CHECK(cap_getmode((void *)(uintptr_t)0xdeadc0de) == -1);
    +	CHECK(errno == EFAULT);
    +
    +	/* If parent is not in capability mode, child after fork() also won't be. */
    +	pid = fork();
    +	switch (pid) {
    +	case -1:
    +		err(1, "fork() failed");
    +	case 0:
    +		mode = 666;
    +		CHECK(cap_getmode(&mode) == 0);
    +		/* If cap_getmode() succeeded mode should be modified. */
    +		CHECK(mode != 666);
    +		/* We are not in capability mode. */
    +		CHECK(mode == 0);
    +		exit(0);
    +	default:
    +		if (waitpid(pid, NULL, 0) == -1)
    +			err(1, "waitpid() failed");
    +	}
    +
    +	/* If parent is not in capability mode, child after pdfork() also won't be. */
    +	pid = pdfork(&pfd, 0);
    +	switch (pid) {
    +	case -1:
    +		err(1, "pdfork() failed");
    +	case 0:
    +		mode = 666;
    +		CHECK(cap_getmode(&mode) == 0);
    +		/* If cap_getmode() succeeded mode should be modified. */
    +		CHECK(mode != 666);
    +		/* We are not in capability mode. */
    +		CHECK(mode == 0);
    +		exit(0);
    +	default:
    +		if (pdwait(pfd) == -1)
    +			err(1, "pdwait() failed");
    +		close(pfd);
    +	}
    +
    +	/* In capability mode... */
    +
    +	CHECK(cap_enter() == 0);
    +
    +	mode = 666;
    +	CHECK(cap_getmode(&mode) == 0);
    +	/* If cap_getmode() succeeded mode should be modified. */
    +	CHECK(mode != 666);
    +	/* We are in capability mode. */
    +	CHECK(mode == 1);
    +
    +	/* Expect EFAULT. */
    +	errno = 0;
    +	CHECK(cap_getmode(NULL) == -1);
    +	CHECK(errno == EFAULT);
    +	errno = 0;
    +	CHECK(cap_getmode((void *)(uintptr_t)0xdeadc0de) == -1);
    +	CHECK(errno == EFAULT);
    +
    +	/* If parent is in capability mode, child after fork() also will be. */
    +	pid = fork();
    +	switch (pid) {
    +	case -1:
    +		err(1, "fork() failed");
    +	case 0:
    +		mode = 666;
    +		CHECK(cap_getmode(&mode) == 0);
    +		/* If cap_getmode() succeeded mode should be modified. */
    +		CHECK(mode != 666);
    +		/* We are in capability mode. */
    +		CHECK(mode == 1);
    +		exit(0);
    +	default:
    +		/*
    +		 * wait(2) and friends are not permitted in the capability mode,
    +		 * so we can only just wait for a while.
    +		 */
    +		sleep(1);
    +	}
    +
    +	/* If parent is in capability mode, child after pdfork() also will be. */
    +	pid = pdfork(&pfd, 0);
    +	switch (pid) {
    +	case -1:
    +		err(1, "pdfork() failed");
    +	case 0:
    +		mode = 666;
    +		CHECK(cap_getmode(&mode) == 0);
    +		/* If cap_getmode() succeeded mode should be modified. */
    +		CHECK(mode != 666);
    +		/* We are in capability mode. */
    +		CHECK(mode == 1);
    +		exit(0);
    +	default:
    +		if (pdwait(pfd) == -1)
    +			err(1, "pdwait() failed");
    +		close(pfd);
    +	}
    +
    +	exit(0);
    +}
    
    Added: head/tools/regression/capsicum/syscalls/cap_ioctls_limit.c
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/tools/regression/capsicum/syscalls/cap_ioctls_limit.c	Sat Mar  2 01:00:26 2013	(r247606)
    @@ -0,0 +1,462 @@
    +/*-
    + * Copyright (c) 2012 The FreeBSD Foundation
    + * All rights reserved.
    + *
    + * This software was developed by Pawel Jakub Dawidek under sponsorship from
    + * the FreeBSD Foundation.
    + *
    + * Redistribution and use in source and binary forms, with or without
    + * modification, are permitted provided that the following conditions
    + * are met:
    + * 1. Redistributions of source code must retain the above copyright
    + *    notice, this list of conditions and the following disclaimer.
    + * 2. 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 AUTHORS 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 AUTHORS 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 "misc.h"
    +
    +static void
    +ioctl_tests_0(int fd)
    +{
    +	unsigned long cmds[2];
    +
    +	CHECK(cap_ioctls_get(fd, NULL, 0) == INT_MAX);
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(ioctl(fd, FIOCLEX) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(ioctl(fd, FIONCLEX) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +
    +	cmds[0] = FIOCLEX;
    +	cmds[1] = FIONCLEX;
    +	CHECK(cap_ioctls_limit(fd, cmds, nitems(cmds)) == 0);
    +	cmds[0] = cmds[1] = 0;
    +	CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == nitems(cmds));
    +	CHECK((cmds[0] == FIOCLEX && cmds[1] == FIONCLEX) ||
    +	    (cmds[0] == FIONCLEX && cmds[1] == FIOCLEX));
    +	cmds[0] = FIOCLEX;
    +	cmds[1] = FIONCLEX;
    +	CHECK(cap_ioctls_limit(fd, cmds, nitems(cmds)) == 0);
    +	cmds[0] = cmds[1] = 0;
    +	CHECK(cap_ioctls_get(fd, cmds, 1) == nitems(cmds));
    +	CHECK(cmds[0] == FIOCLEX || cmds[0] == FIONCLEX);
    +	CHECK(cmds[1] == 0);
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(ioctl(fd, FIOCLEX) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(ioctl(fd, FIONCLEX) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +
    +	cmds[0] = FIOCLEX;
    +	CHECK(cap_ioctls_limit(fd, cmds, 1) == 0);
    +	cmds[0] = cmds[1] = 0;
    +	CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 1);
    +	CHECK(cmds[0] == FIOCLEX);
    +	cmds[0] = FIOCLEX;
    +	cmds[1] = FIONCLEX;
    +	errno = 0;
    +	CHECK(cap_ioctls_limit(fd, cmds, nitems(cmds)) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	cmds[0] = cmds[1] = 0;
    +	CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 1);
    +	CHECK(cmds[0] == FIOCLEX);
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(ioctl(fd, FIOCLEX) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	errno = 0;
    +	CHECK(ioctl(fd, FIONCLEX) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(fcntl(fd, F_SETFD, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +
    +	CHECK(cap_ioctls_limit(fd, NULL, 0) == 0);
    +	CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 0);
    +	cmds[0] = FIOCLEX;
    +	errno = 0;
    +	CHECK(cap_ioctls_limit(fd, cmds, 1) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 0);
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	errno = 0;
    +	CHECK(ioctl(fd, FIOCLEX) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	errno = 0;
    +	CHECK(ioctl(fd, FIONCLEX) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(fcntl(fd, F_SETFD, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +}
    +
    +static void
    +ioctl_tests_1(int fd)
    +{
    +	unsigned long cmds[2];
    +
    +	cmds[0] = FIOCLEX;
    +	CHECK(cap_ioctls_limit(fd, cmds, 1) == 0);
    +	cmds[0] = cmds[1] = 0;
    +	CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 1);
    +	CHECK(cmds[0] == FIOCLEX);
    +	CHECK(cmds[1] == 0);
    +
    +	CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_IOCTL) == 0);
    +	CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 0);
    +
    +	cmds[0] = FIOCLEX;
    +	cmds[1] = FIONCLEX;
    +	errno = 0;
    +	CHECK(cap_ioctls_limit(fd, cmds, nitems(cmds)) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 0);
    +	cmds[0] = FIOCLEX;
    +	errno = 0;
    +	CHECK(cap_ioctls_limit(fd, cmds, 1) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 0);
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	errno = 0;
    +	CHECK(ioctl(fd, FIOCLEX) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	errno = 0;
    +	CHECK(ioctl(fd, FIONCLEX) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(fcntl(fd, F_SETFD, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +}
    +
    +static void
    +ioctl_tests_2(int fd)
    +{
    +	unsigned long cmds[2];
    +
    +	CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_IOCTL) == 0);
    +	CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 0);
    +
    +	cmds[0] = FIOCLEX;
    +	cmds[1] = FIONCLEX;
    +	errno = 0;
    +	CHECK(cap_ioctls_limit(fd, cmds, nitems(cmds)) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 0);
    +	cmds[0] = FIOCLEX;
    +	errno = 0;
    +	CHECK(cap_ioctls_limit(fd, cmds, 1) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 0);
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	errno = 0;
    +	CHECK(ioctl(fd, FIOCLEX) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	errno = 0;
    +	CHECK(ioctl(fd, FIONCLEX) == -1);
    +	CHECK(errno == ENOTCAPABLE);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(fcntl(fd, F_SETFD, 0) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +}
    +
    +static void
    +ioctl_tests_send_0(int sock)
    +{
    +	unsigned long cmds[2];
    +	int fd;
    +
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	CHECK(descriptor_send(sock, fd) == 0);
    +	CHECK(close(fd) == 0);
    +
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	cmds[0] = FIOCLEX;
    +	cmds[1] = FIONCLEX;
    +	CHECK(cap_ioctls_limit(fd, cmds, nitems(cmds)) == 0);
    +	CHECK(descriptor_send(sock, fd) == 0);
    +	CHECK(close(fd) == 0);
    +
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	cmds[0] = FIOCLEX;
    +	CHECK(cap_ioctls_limit(fd, cmds, 1) == 0);
    +	CHECK(descriptor_send(sock, fd) == 0);
    +	CHECK(close(fd) == 0);
    +
    +	CHECK((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
    +	CHECK(cap_ioctls_limit(fd, NULL, 0) == 0);
    +	CHECK(descriptor_send(sock, fd) == 0);
    +	CHECK(close(fd) == 0);
    +}
    +
    +static void
    +ioctl_tests_recv_0(int sock)
    +{
    +	unsigned long cmds[2];
    +	int fd;
    +
    +	CHECK(descriptor_recv(sock, &fd) == 0);
    +
    +	CHECK(cap_ioctls_get(fd, NULL, 0) == INT_MAX);
    +
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +	CHECK(ioctl(fd, FIOCLEX) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC);
    +	CHECK(ioctl(fd, FIONCLEX) == 0);
    +	CHECK(fcntl(fd, F_GETFD) == 0);
    +
    +	CHECK(close(fd) == 0);
    +
    
    *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 02:19:05 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 125E8C66;
     Sat,  2 Mar 2013 02:19:05 +0000 (UTC)
     (envelope-from andrew@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id EF2D3286;
     Sat,  2 Mar 2013 02:19:04 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r222J4Ni090048;
     Sat, 2 Mar 2013 02:19:04 GMT (envelope-from andrew@svn.freebsd.org)
    Received: (from andrew@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r222J4hZ090047;
     Sat, 2 Mar 2013 02:19:04 GMT (envelope-from andrew@svn.freebsd.org)
    Message-Id: <201303020219.r222J4hZ090047@svn.freebsd.org>
    From: Andrew Turner 
    Date: Sat, 2 Mar 2013 02:19:04 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247608 - head/sys/arm/arm
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 02:19:05 -0000
    
    Author: andrew
    Date: Sat Mar  2 02:19:04 2013
    New Revision: 247608
    URL: http://svnweb.freebsd.org/changeset/base/247608
    
    Log:
      Ensure the stack is correctly aligned before calling the first C function.
    
    Modified:
      head/sys/arm/arm/locore.S
    
    Modified: head/sys/arm/arm/locore.S
    ==============================================================================
    --- head/sys/arm/arm/locore.S	Sat Mar  2 01:04:02 2013	(r247607)
    +++ head/sys/arm/arm/locore.S	Sat Mar  2 02:19:04 2013	(r247608)
    @@ -204,6 +204,7 @@ mmu_done:
     virt_done:
     	mov	r1, #20			/* loader info size is 20 bytes also second arg */
     	subs	sp, sp, r1		/* allocate arm_boot_params struct on stack */
    +	bic	sp, sp, #7		/* align stack to 8 bytes */
     	mov	r0, sp			/* loader info pointer is first arg */
     	str	r1, [r0]		/* Store length of loader info */
     	str	r9, [r0, #4]		/* Store r0 from boot loader */
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 03:23:15 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 71A36627;
     Sat,  2 Mar 2013 03:23:15 +0000 (UTC)
     (envelope-from andrew@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 63152709;
     Sat,  2 Mar 2013 03:23:15 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r223NFiT011937;
     Sat, 2 Mar 2013 03:23:15 GMT (envelope-from andrew@svn.freebsd.org)
    Received: (from andrew@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r223NFPS011936;
     Sat, 2 Mar 2013 03:23:15 GMT (envelope-from andrew@svn.freebsd.org)
    Message-Id: <201303020323.r223NFPS011936@svn.freebsd.org>
    From: Andrew Turner 
    Date: Sat, 2 Mar 2013 03:23:15 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247609 - head/sys/arm/conf
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 03:23:15 -0000
    
    Author: andrew
    Date: Sat Mar  2 03:23:14 2013
    New Revision: 247609
    URL: http://svnweb.freebsd.org/changeset/base/247609
    
    Log:
      Build the Raspberry Pi dtb file when building the kernel so we can copy it
      to the boot partition for U-Boot.
    
    Modified:
      head/sys/arm/conf/RPI-B
    
    Modified: head/sys/arm/conf/RPI-B
    ==============================================================================
    --- head/sys/arm/conf/RPI-B	Sat Mar  2 02:19:04 2013	(r247608)
    +++ head/sys/arm/conf/RPI-B	Sat Mar  2 03:23:14 2013	(r247609)
    @@ -117,4 +117,4 @@ options         FDT
     # Note:  DTB is normally loaded and modified by RPi boot loader, then
     # handed to kernel via U-Boot and ubldr.
     #options         FDT_DTB_STATIC
    -#makeoptions     FDT_DTS_FILE=bcm2835-rpi-b.dts
    +makeoptions     FDT_DTS_FILE=bcm2835-rpi-b.dts
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 03:32:20 2013
    Return-Path: 
    Delivered-To: svn-src-head@FreeBSD.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 6DCD592D;
     Sat,  2 Mar 2013 03:32:20 +0000 (UTC)
     (envelope-from tim@kientzle.com)
    Received: from monday.kientzle.com (99-115-135-74.uvs.sntcca.sbcglobal.net
     [99.115.135.74]) by mx1.freebsd.org (Postfix) with ESMTP id 4117F769;
     Sat,  2 Mar 2013 03:32:19 +0000 (UTC)
    Received: (from root@localhost)
     by monday.kientzle.com (8.14.4/8.14.4) id r223WI13056116;
     Sat, 2 Mar 2013 03:32:19 GMT (envelope-from tim@kientzle.com)
    Received: from [192.168.2.143] (CiscoE3000 [192.168.1.65])
     by kientzle.com with SMTP id qky5wd6t62wwvrgfhwbeysnmea;
     Sat, 02 Mar 2013 03:32:18 +0000 (UTC)
     (envelope-from tim@kientzle.com)
    Subject: Re: svn commit: r247609 - head/sys/arm/conf
    Mime-Version: 1.0 (Apple Message framework v1283)
    Content-Type: text/plain; charset=us-ascii
    From: Tim Kientzle 
    In-Reply-To: <201303020323.r223NFPS011936@svn.freebsd.org>
    Date: Fri, 1 Mar 2013 19:32:17 -0800
    Content-Transfer-Encoding: quoted-printable
    Message-Id: 
    References: <201303020323.r223NFPS011936@svn.freebsd.org>
    To: Andrew Turner 
    X-Mailer: Apple Mail (2.1283)
    Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
     src-committers@FreeBSD.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 03:32:20 -0000
    
    
    On Mar 1, 2013, at 7:23 PM, Andrew Turner wrote:
    
    > Author: andrew
    > Date: Sat Mar  2 03:23:14 2013
    > New Revision: 247609
    > URL: http://svnweb.freebsd.org/changeset/base/247609
    >=20
    > Log:
    >  Build the Raspberry Pi dtb file when building the kernel so we can =
    copy it
    >  to the boot partition for U-Boot.
    >=20
    > Modified:
    >  head/sys/arm/conf/RPI-B
    >=20
    > Modified: head/sys/arm/conf/RPI-B
    > =
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D=3D=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/sys/arm/conf/RPI-B	Sat Mar  2 02:19:04 2013	=
    (r247608)
    > +++ head/sys/arm/conf/RPI-B	Sat Mar  2 03:23:14 2013	=
    (r247609)
    > @@ -117,4 +117,4 @@ options         FDT
    > # Note:  DTB is normally loaded and modified by RPi boot loader, then
    > # handed to kernel via U-Boot and ubldr.
    > #options         FDT_DTB_STATIC
    > -#makeoptions     FDT_DTS_FILE=3Dbcm2835-rpi-b.dts
    > +makeoptions     FDT_DTS_FILE=3Dbcm2835-rpi-b.dts
    
    FWIW, I personally find it easier to just run dtc to
    compile the DTS file as required.
    
    Tim
    
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 05:02:30 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 0484168D;
     Sat,  2 Mar 2013 05:02:30 +0000 (UTC)
     (envelope-from andrew@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id BAF4A9EA;
     Sat,  2 Mar 2013 05:02:29 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r2252T3o042939;
     Sat, 2 Mar 2013 05:02:29 GMT (envelope-from andrew@svn.freebsd.org)
    Received: (from andrew@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r2252TAl042938;
     Sat, 2 Mar 2013 05:02:29 GMT (envelope-from andrew@svn.freebsd.org)
    Message-Id: <201303020502.r2252TAl042938@svn.freebsd.org>
    From: Andrew Turner 
    Date: Sat, 2 Mar 2013 05:02:29 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247610 - head/sys/arm/include
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 05:02:30 -0000
    
    Author: andrew
    Date: Sat Mar  2 05:02:29 2013
    New Revision: 247610
    URL: http://svnweb.freebsd.org/changeset/base/247610
    
    Log:
      Move some virtual memory constants to the top of the file where they are on
      other architectures [1].
      
      While here:
       - Remove an unused and commented out include.
       - Add a comment describing the file that other copies have.
       - Fix the style of the defines and add a comment on what each one is.
      
      Suggested by:	[1] alc
    
    Modified:
      head/sys/arm/include/vmparam.h
    
    Modified: head/sys/arm/include/vmparam.h
    ==============================================================================
    --- head/sys/arm/include/vmparam.h	Sat Mar  2 03:23:14 2013	(r247609)
    +++ head/sys/arm/include/vmparam.h	Sat Mar  2 05:02:29 2013	(r247610)
    @@ -34,9 +34,32 @@
     #ifndef	_MACHINE_VMPARAM_H_
     #define	_MACHINE_VMPARAM_H_
     
    +/*
    + * Machine dependent constants for ARM.
    + */
    +
    +/*
    + * Virtual memory related constants, all in bytes
    + */
    +#ifndef	MAXTSIZ
    +#define	MAXTSIZ		(64UL*1024*1024)	/* max text size */
    +#endif
    +#ifndef	DFLDSIZ
    +#define	DFLDSIZ		(128UL*1024*1024)	/* initial data size limit */
    +#endif
    +#ifndef	MAXDSIZ
    +#define	MAXDSIZ		(512UL*1024*1024)	/* max data size */
    +#endif
    +#ifndef	DFLSSIZ
    +#define	DFLSSIZ		(2UL*1024*1024)		/* initial stack size limit */
    +#endif
    +#ifndef	MAXSSIZ
    +#define	MAXSSIZ		(8UL*1024*1024)		/* max stack size */
    +#endif
    +#ifndef	SGROWSIZ
    +#define	SGROWSIZ	(128UL*1024)		/* amount to grow stack */
    +#endif
     
    -/*#include 
    -*/
     /*
      * Address space constants
      */
    @@ -153,25 +176,6 @@
         VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
     #endif
     
    -#ifndef MAXTSIZ
    -#define MAXTSIZ 	(64*1024*1024)
    -#endif
    -#ifndef DFLDSIZ
    -#define DFLDSIZ         (128*1024*1024)
    -#endif
    -#ifndef MAXDSIZ
    -#define MAXDSIZ         (512*1024*1024)
    -#endif
    -#ifndef DFLSSIZ
    -#define DFLSSIZ         (2*1024*1024)
    -#endif
    -#ifndef MAXSSIZ
    -#define MAXSSIZ         (8*1024*1024)
    -#endif
    -#ifndef SGROWSIZ
    -#define SGROWSIZ        (128*1024)
    -#endif
    -
     #ifdef ARM_USE_SMALL_ALLOC
     #define UMA_MD_SMALL_ALLOC
     #endif /* ARM_USE_SMALL_ALLOC */
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 05:03:36 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id DE770804;
     Sat,  2 Mar 2013 05:03:36 +0000 (UTC)
     (envelope-from marcel@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id CF90A9F4;
     Sat,  2 Mar 2013 05:03:36 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r2253aN0043159;
     Sat, 2 Mar 2013 05:03:36 GMT (envelope-from marcel@svn.freebsd.org)
    Received: (from marcel@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r2253anY043158;
     Sat, 2 Mar 2013 05:03:36 GMT (envelope-from marcel@svn.freebsd.org)
    Message-Id: <201303020503.r2253anY043158@svn.freebsd.org>
    From: Marcel Moolenaar 
    Date: Sat, 2 Mar 2013 05:03:36 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247611 - head/lib/libstand
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 05:03:36 -0000
    
    Author: marcel
    Date: Sat Mar  2 05:03:36 2013
    New Revision: 247611
    URL: http://svnweb.freebsd.org/changeset/base/247611
    
    Log:
      Fix nandfs support by providing the same crc32 function as is used
      in newfs_nandfs. In libstand we get crc32 from libz. The polynomial
      is not the same as used for nandfs, which is the crc32 used in the
      kernel.
    
    Modified:
      head/lib/libstand/nandfs.c
    
    Modified: head/lib/libstand/nandfs.c
    ==============================================================================
    --- head/lib/libstand/nandfs.c	Sat Mar  2 05:02:29 2013	(r247610)
    +++ head/lib/libstand/nandfs.c	Sat Mar  2 05:03:36 2013	(r247611)
    @@ -125,6 +125,27 @@ struct fs_ops nandfs_fsops = {
     
     #define	NINDIR(fs)	((fs)->nf_blocksize / sizeof(nandfs_daddr_t))
     
    +/* from NetBSD's src/sys/net/if_ethersubr.c */
    +static uint32_t
    +nandfs_crc32(uint32_t crc, const uint8_t *buf, size_t len)
    +{
    +	static const uint32_t crctab[] = {
    +		0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac,
    +		0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c,
    +		0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c,
    +		0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c
    +	};
    +	size_t i;
    +
    +	crc = crc ^ ~0U;
    +	for (i = 0; i < len; i++) {
    +		crc ^= buf[i];
    +		crc = (crc >> 4) ^ crctab[crc & 0xf];
    +		crc = (crc >> 4) ^ crctab[crc & 0xf];
    +	}
    +	return (crc ^ ~0U);
    +}
    +
     static int
     nandfs_check_fsdata_crc(struct nandfs_fsdata *fsdata)
     {
    @@ -138,7 +159,7 @@ nandfs_check_fsdata_crc(struct nandfs_fs
     
     	/* Calculate */
     	fsdata->f_sum = (0);
    -	comp_crc = crc32(0, (uint8_t *)fsdata, fsdata->f_bytes);
    +	comp_crc = nandfs_crc32(0, (uint8_t *)fsdata, fsdata->f_bytes);
     
     	/* Restore */
     	fsdata->f_sum = fsdata_crc;
    @@ -162,7 +183,7 @@ nandfs_check_superblock_crc(struct nandf
     
     	/* Calculate */
     	super->s_sum = (0);
    -	comp_crc = crc32(0, (uint8_t *)super, fsdata->f_sbbytes);
    +	comp_crc = nandfs_crc32(0, (uint8_t *)super, fsdata->f_sbbytes);
     
     	/* Restore */
     	super->s_sum = super_crc;
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 05:07:52 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 78C8A9E5;
     Sat,  2 Mar 2013 05:07:52 +0000 (UTC)
     (envelope-from marcel@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 584FCA1C;
     Sat,  2 Mar 2013 05:07:52 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r2257q4n043904;
     Sat, 2 Mar 2013 05:07:52 GMT (envelope-from marcel@svn.freebsd.org)
    Received: (from marcel@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r2257qMQ043903;
     Sat, 2 Mar 2013 05:07:52 GMT (envelope-from marcel@svn.freebsd.org)
    Message-Id: <201303020507.r2257qMQ043903@svn.freebsd.org>
    From: Marcel Moolenaar 
    Date: Sat, 2 Mar 2013 05:07:52 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247612 - head/lib/libstand
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 05:07:52 -0000
    
    Author: marcel
    Date: Sat Mar  2 05:07:51 2013
    New Revision: 247612
    URL: http://svnweb.freebsd.org/changeset/base/247612
    
    Log:
      Fix warnings (control reaches end of non-void function).
    
    Modified:
      head/lib/libstand/nandfs.c
    
    Modified: head/lib/libstand/nandfs.c
    ==============================================================================
    --- head/lib/libstand/nandfs.c	Sat Mar  2 05:03:36 2013	(r247611)
    +++ head/lib/libstand/nandfs.c	Sat Mar  2 05:07:51 2013	(r247612)
    @@ -418,7 +418,7 @@ nandfs_open(const char *path, struct ope
     	return (0);
     }
     
    -static int
    +static void
     nandfs_free_node(struct nandfs_node *node)
     {
     	struct bmap_buf *bmap, *tmp;
    @@ -445,6 +445,7 @@ nandfs_close(struct open_file *f)
     	nandfs_free_node(fs->nf_opened_node);
     	free(fs->nf_sb);
     	free(fs);
    +	return (0);
     }
     
     static int
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 05:11:28 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id EE096B7F;
     Sat,  2 Mar 2013 05:11:28 +0000 (UTC)
     (envelope-from andrew@fubar.geek.nz)
    Received: from smtp3.clear.net.nz (smtp3.clear.net.nz [203.97.33.64])
     by mx1.freebsd.org (Postfix) with ESMTP id BD50AA34;
     Sat,  2 Mar 2013 05:11:28 +0000 (UTC)
    Received: from mxin2-orange.clear.net.nz
     (lb2-srcnat.clear.net.nz [203.97.32.237])
     by smtp3.clear.net.nz (CLEAR Net Mail)
     with ESMTP id <0MJ000NNZP2V0T30@smtp3.clear.net.nz>; Sat,
     02 Mar 2013 18:11:20 +1300 (NZDT)
    Received: from 202-0-48-19.paradise.net.nz (HELO bender) ([202.0.48.19])
     by smtpin2.paradise.net.nz with ESMTP; Sat, 02 Mar 2013 18:11:20 +1300
    Date: Sat, 02 Mar 2013 18:11:22 +1300
    From: Andrew Turner 
    Subject: Re: svn commit: r247609 - head/sys/arm/conf
    In-reply-to: 
    To: Tim Kientzle 
    Message-id: <20130302181122.0e5fe477@bender>
    MIME-version: 1.0
    Content-type: text/plain; charset=US-ASCII
    Content-transfer-encoding: 7bit
    References: <201303020323.r223NFPS011936@svn.freebsd.org>
     
    Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
     src-committers@FreeBSD.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 05:11:29 -0000
    
    On Fri, 1 Mar 2013 19:32:17 -0800
    Tim Kientzle  wrote:
    
    > 
    > On Mar 1, 2013, at 7:23 PM, Andrew Turner wrote:
    > 
    > > Author: andrew
    > > Date: Sat Mar  2 03:23:14 2013
    > > New Revision: 247609
    > > URL: http://svnweb.freebsd.org/changeset/base/247609
    > > 
    > > Log:
    > >  Build the Raspberry Pi dtb file when building the kernel so we can
    > > copy it to the boot partition for U-Boot.
    > > 
    > > Modified:
    > >  head/sys/arm/conf/RPI-B
    > > 
    > > Modified: head/sys/arm/conf/RPI-B
    > > ==============================================================================
    > > --- head/sys/arm/conf/RPI-B	Sat Mar  2 02:19:04 2013
    > > (r247608) +++ head/sys/arm/conf/RPI-B	Sat Mar  2 03:23:14
    > > 2013	(r247609) @@ -117,4 +117,4 @@ options         FDT
    > > # Note:  DTB is normally loaded and modified by RPi boot loader,
    > > then # handed to kernel via U-Boot and ubldr.
    > > #options         FDT_DTB_STATIC
    > > -#makeoptions     FDT_DTS_FILE=bcm2835-rpi-b.dts
    > > +makeoptions     FDT_DTS_FILE=bcm2835-rpi-b.dts
    > 
    > FWIW, I personally find it easier to just run dtc to
    > compile the DTS file as required.
    
    I know at least one user has been caught out by this, and I was as an
    old version of the dtb was where I was expecting the new one to be.
    
    When we move to a GENERIC kernel for armv6 I would not expect
    FDT_DTS_FILE to be set, but for a single board kernel config it can
    help as the user doesn't have to search around for dtc in the case it's
    not installed on the build host.
    
    Andrew
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 05:28:55 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id BBC0FF11;
     Sat,  2 Mar 2013 05:28:55 +0000 (UTC)
     (envelope-from marcel@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id AECDFA9D;
     Sat,  2 Mar 2013 05:28:55 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r225StOd050056;
     Sat, 2 Mar 2013 05:28:55 GMT (envelope-from marcel@svn.freebsd.org)
    Received: (from marcel@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r225StAp050055;
     Sat, 2 Mar 2013 05:28:55 GMT (envelope-from marcel@svn.freebsd.org)
    Message-Id: <201303020528.r225StAp050055@svn.freebsd.org>
    From: Marcel Moolenaar 
    Date: Sat, 2 Mar 2013 05:28:55 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247613 - head/lib/libstand
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 05:28:55 -0000
    
    Author: marcel
    Date: Sat Mar  2 05:28:55 2013
    New Revision: 247613
    URL: http://svnweb.freebsd.org/changeset/base/247613
    
    Log:
      Make this WARNS=9 clean on i386 w/ clang.
    
    Modified:
      head/lib/libstand/nandfs.c
    
    Modified: head/lib/libstand/nandfs.c
    ==============================================================================
    --- head/lib/libstand/nandfs.c	Sat Mar  2 05:07:51 2013	(r247612)
    +++ head/lib/libstand/nandfs.c	Sat Mar  2 05:28:55 2013	(r247613)
    @@ -95,8 +95,7 @@ static off_t nandfs_seek(struct open_fil
     static int nandfs_stat(struct open_file *, struct stat *);
     static int nandfs_readdir(struct open_file *, struct dirent *);
     
    -static int nandfs_buf_read(struct nandfs *, char **, size_t *);
    -static struct nandfs_node *nandfs_lookup_inode(struct nandfs *, nandfs_daddr_t);
    +static int nandfs_buf_read(struct nandfs *, void **, size_t *);
     static struct nandfs_node *nandfs_lookup_path(struct nandfs *, const char *);
     static int nandfs_read_inode(struct nandfs *, struct nandfs_node *,
         nandfs_lbn_t, u_int, void *, int);
    @@ -453,7 +452,7 @@ nandfs_read(struct open_file *f, void *a
     {
     	struct nandfs *fs = (struct nandfs *)f->f_fsdata;
     	size_t csize, buf_size;
    -	uint8_t *buf;
    +	void *buf;
     	int error = 0;
     
     	NANDFS_DEBUG("nandfs_read(file=%p, addr=%p, size=%d)\n", f, addr, size);
    @@ -462,7 +461,7 @@ nandfs_read(struct open_file *f, void *a
     		if (fs->nf_offset >= fs->nf_opened_node->inode->i_size)
     			break;
     
    -		error = nandfs_buf_read(fs, (void *)&buf, &buf_size);
    +		error = nandfs_buf_read(fs, &buf, &buf_size);
     		if (error)
     			break;
     
    @@ -539,7 +538,7 @@ nandfs_readdir(struct open_file *f, stru
     {
     	struct nandfs *fs = f->f_fsdata;
     	struct nandfs_dir_entry *dirent;
    -	uint8_t *buf;
    +	void *buf;
     	size_t buf_size;
     
     	NANDFS_DEBUG("nandfs_readdir(file=%p, dirent=%p)\n", f, d);
    @@ -550,7 +549,7 @@ nandfs_readdir(struct open_file *f, stru
     		return (ENOENT);
     	}
     
    -	if (nandfs_buf_read(fs, (void *)&buf, &buf_size)) {
    +	if (nandfs_buf_read(fs, &buf, &buf_size)) {
     		NANDFS_DEBUG("nandfs_readdir(file=%p, dirent=%p)"
     		    "buf_read failed\n", f, d);
     		return (EIO);
    @@ -568,7 +567,7 @@ nandfs_readdir(struct open_file *f, stru
     }
     
     static int
    -nandfs_buf_read(struct nandfs *fs, char **buf_p, size_t *size_p)
    +nandfs_buf_read(struct nandfs *fs, void **buf_p, size_t *size_p)
     {
     	nandfs_daddr_t blknr, blkoff;
     
    @@ -634,8 +633,8 @@ nandfs_lookup_path(struct nandfs *fs, co
     	struct nandfs_node *node;
     	struct nandfs_dir_entry *dirent;
     	char *namebuf;
    -	uint64_t i, j, done, counter, pinode, inode;
    -	int nlinks = 0, len, link_len, nameidx;
    +	uint64_t i, done, pinode, inode;
    +	int nlinks = 0, counter, len, link_len, nameidx;
     	uint8_t *buffer, *orig;
     	char *strp, *lpath;
     
    @@ -672,7 +671,8 @@ nandfs_lookup_path(struct nandfs *fs, co
     			buffer = orig;
     			done = counter = 0;
     			while (1) {
    -				dirent = (struct nandfs_dir_entry *)buffer;
    +				dirent = 
    +				    (struct nandfs_dir_entry *)(void *)buffer;
     				NANDFS_DEBUG("%s: dirent.name = %s\n",
     				    __func__, dirent->name);
     				NANDFS_DEBUG("%s: dirent.rec_len = %d\n",
    @@ -768,9 +768,9 @@ static int
     nandfs_read_inode(struct nandfs *fs, struct nandfs_node *node,
         nandfs_daddr_t blknr, u_int nblks, void *buf, int raw)
     {
    -	int i;
     	uint64_t *pblks;
     	uint64_t *vblks;
    +	u_int i;
     	int error;
     
     	pblks = malloc(nblks * sizeof(uint64_t));
    @@ -799,7 +799,7 @@ nandfs_read_inode(struct nandfs *fs, str
     			return (EIO);
     		}
     
    -		buf += fs->nf_blocksize;
    +		buf = (void *)((uintptr_t)buf + fs->nf_blocksize);
     	}
     
     	free(pblks);
    @@ -881,8 +881,7 @@ nandfs_bmap_lookup(struct nandfs *fs, st
     {
     	struct nandfs_inode *ino;
     	nandfs_daddr_t ind_block_num;
    -	uint64_t *map, *indir;
    -	uint64_t idx0, idx1, vblk, tmp;
    +	uint64_t *map;
     	int idx;
     	int level;
     
    @@ -1028,7 +1027,7 @@ ioread(struct open_file *f, off_t pos, v
     	err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, pos,
     	    nsec * bsize, buffer, NULL);
     
    -	memcpy(buf, buffer + off, length);
    +	memcpy(buf, (void *)((uintptr_t)buffer + off), length);
     	free(buffer);
     
     	return (err);
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 06:34:50 2013
    Return-Path: 
    Delivered-To: svn-src-head@FreeBSD.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id F1EBDC39;
     Sat,  2 Mar 2013 06:34:49 +0000 (UTC)
     (envelope-from brde@optusnet.com.au)
    Received: from fallbackmx08.syd.optusnet.com.au
     (fallbackmx08.syd.optusnet.com.au [211.29.132.10])
     by mx1.freebsd.org (Postfix) with ESMTP id 90578D44;
     Sat,  2 Mar 2013 06:34:48 +0000 (UTC)
    Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au
     [211.29.132.190])
     by fallbackmx08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
     r226Yes6030356; Sat, 2 Mar 2013 17:34:40 +1100
    Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au
     (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106])
     by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r226YRvk006040
     (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
     Sat, 2 Mar 2013 17:34:31 +1100
    Date: Sat, 2 Mar 2013 17:34:27 +1100 (EST)
    From: Bruce Evans 
    X-X-Sender: bde@besplex.bde.org
    To: Marius Strobl 
    Subject: Re: svn commit: r247600 - in head/sys: conf sparc64/pci
    In-Reply-To: <201303020037.r220bWJg057328@svn.freebsd.org>
    Message-ID: <20130302153017.O1121@besplex.bde.org>
    References: <201303020037.r220bWJg057328@svn.freebsd.org>
    MIME-Version: 1.0
    Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
    X-Optus-CM-Score: 0
    X-Optus-CM-Analysis: v=2.0 cv=DdhPMYRW c=1 sm=1 a=OATcr5XPpMsA:10
     a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=s5sLUIhH2asA:10
     a=nh50T69upB6EW8B8ixgA:9 a=CjuIK1q_8ugA:10 a=TEtd8y5WR3g2ypngnwZWYw==:117
    Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
     src-committers@FreeBSD.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 06:34:50 -0000
    
    On Sat, 2 Mar 2013, Marius Strobl wrote:
    
    > Log:
    >  - While Netra X1 generally show no ill effects when registering a power
    >    fail interrupt handler, there seems to be either a broken batch of them
    >    or a tendency to develop a defect which causes this interrupt to fire
    >    inadvertedly. Given that apart from this problem these machines work
    >    just fine, add a tunable allowing the setup of the power fail interrupt
    >    to be disabled.
    >    While at it, remove the DEBUGGER_ON_POWERFAIL compile time option and
    >    make that behavior also selectable via the newly added tunable.
    >  - Apparently, it's no longer a problem to call shutdown_nice(9) from within
    >    an interrupt filter (some other drivers in the tree do the same). So
    >    change the power fail interrupt from an handler in order to simplify the
    >    code and get rid of a !INTR_MPSAFE handler.
    
    Gak!  It it is any error to call any() from within a fast interrupt
    handler.  Even with fast interrupt handlers broken to be interrupt
    filters, it is an error to call almost any().  shutdown_nice() is an
    especially invalid any().  It sends a signal to init, and uses many
    sleep locks for this.  So you have the interrupt filter which is locked
    by critical_enter() and probably also by hard-disabling interrupts on
    the current CPU, calling up to code locked by sleep mutexes.  This
    asks for deadlock, and gets it when the interrupt preempts code holding
    one of the sleep locks that is wandered into.
    
    The other broken drivers that do this seem to be mainly serial console
    drivers.  Their debugger entry was subverted into calling panic() or
    shutdown_nice() according to an escape sequence.  Even the debugger
    entry part of this was broken by changing it from a hard breakpoint
    to a kdb_enter() call which does invalid things (it accesses global
    state without locking, and calls printf() before entering debugger
    context).  shutdown_nice() is also called from acpi and from syscons.
    I think the latter still uses an ordinary (Giant locked) interrupt
    handler.  Calling shutdown_nice() from there has a chance of never
    deadlocking.  It would just have to wait if the interrupt interrupted
    something holding shutdown_nice()'s locks.
    
    The dangerous calls in syscons are actually from scgetc().  I think
    they are reachable in debugger mode too.  Then they are invalid.  So
    are ddb's commands for rebooting and panicing.  You can't call any()
    from ddb either, but these commands do.  A non-broken version of these
    commands (or "call any()) would exit from ddb context after arranging
    to make the call using a trampoline.  The call might fail, but then
    it is not the fault of ddb's context.  The trampoline is needed to
    regain control if the call can return.  The reboot and panic commands
    are safer than most of the unsafe ones since they are supposed to give
    an unclean shutdown and if they don't work then nothing much worse than
    a recursive unclean shutdown can happen.
    
    Bruce
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 06:55:56 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id A033C3FF;
     Sat,  2 Mar 2013 06:55:56 +0000 (UTC)
     (envelope-from joel@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 7C999DF0;
     Sat,  2 Mar 2013 06:55:56 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r226tugP078647;
     Sat, 2 Mar 2013 06:55:56 GMT (envelope-from joel@svn.freebsd.org)
    Received: (from joel@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r226ttYc078644;
     Sat, 2 Mar 2013 06:55:55 GMT (envelope-from joel@svn.freebsd.org)
    Message-Id: <201303020655.r226ttYc078644@svn.freebsd.org>
    From: Joel Dahl 
    Date: Sat, 2 Mar 2013 06:55:55 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247614 - head/lib/libc/sys
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 06:55:56 -0000
    
    Author: joel (doc committer)
    Date: Sat Mar  2 06:55:55 2013
    New Revision: 247614
    URL: http://svnweb.freebsd.org/changeset/base/247614
    
    Log:
      mdoc: remove superfluous paragraph macro.
    
    Modified:
      head/lib/libc/sys/cap_fcntls_limit.2
      head/lib/libc/sys/cap_ioctls_limit.2
      head/lib/libc/sys/cap_rights_limit.2
    
    Modified: head/lib/libc/sys/cap_fcntls_limit.2
    ==============================================================================
    --- head/lib/libc/sys/cap_fcntls_limit.2	Sat Mar  2 05:28:55 2013	(r247613)
    +++ head/lib/libc/sys/cap_fcntls_limit.2	Sat Mar  2 06:55:55 2013	(r247614)
    @@ -120,7 +120,6 @@ argument points at an invalid address.
     Support for capabilities and capabilities mode was developed as part of the
     .Tn TrustedBSD
     Project.
    -.Pp
     .Sh AUTHORS
     This function was created by
     .An Pawel Jakub Dawidek Aq pawel@dawidek.net
    
    Modified: head/lib/libc/sys/cap_ioctls_limit.2
    ==============================================================================
    --- head/lib/libc/sys/cap_ioctls_limit.2	Sat Mar  2 05:28:55 2013	(r247613)
    +++ head/lib/libc/sys/cap_ioctls_limit.2	Sat Mar  2 06:55:55 2013	(r247614)
    @@ -151,7 +151,6 @@ argument points at invalid address.
     Support for capabilities and capabilities mode was developed as part of the
     .Tn TrustedBSD
     Project.
    -.Pp
     .Sh AUTHORS
     This function was created by
     .An Pawel Jakub Dawidek Aq pawel@dawidek.net
    
    Modified: head/lib/libc/sys/cap_rights_limit.2
    ==============================================================================
    --- head/lib/libc/sys/cap_rights_limit.2	Sat Mar  2 05:28:55 2013	(r247613)
    +++ head/lib/libc/sys/cap_rights_limit.2	Sat Mar  2 06:55:55 2013	(r247614)
    @@ -590,7 +590,6 @@ argument points at an invalid address.
     Support for capabilities and capabilities mode was developed as part of the
     .Tn TrustedBSD
     Project.
    -.Pp
     .Sh AUTHORS
     This function was created by
     .An Pawel Jakub Dawidek Aq pawel@dawidek.net
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 07:51:04 2013
    Return-Path: 
    Delivered-To: svn-src-head@FreeBSD.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 6E6C9AAB;
     Sat,  2 Mar 2013 07:51:04 +0000 (UTC)
     (envelope-from brde@optusnet.com.au)
    Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au
     [211.29.132.190])
     by mx1.freebsd.org (Postfix) with ESMTP id F39DFF3D;
     Sat,  2 Mar 2013 07:51:03 +0000 (UTC)
    Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au
     (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106])
     by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r227oxEJ023049
     (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
     Sat, 2 Mar 2013 18:51:01 +1100
    Date: Sat, 2 Mar 2013 18:50:59 +1100 (EST)
    From: Bruce Evans 
    X-X-Sender: bde@besplex.bde.org
    To: Marius Strobl 
    Subject: Re: svn commit: r247601 - head/sys/sparc64/sbus
    In-Reply-To: <201303020041.r220fq5N059799@svn.freebsd.org>
    Message-ID: <20130302182026.Y1572@besplex.bde.org>
    References: <201303020041.r220fq5N059799@svn.freebsd.org>
    MIME-Version: 1.0
    Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
    X-Optus-CM-Score: 0
    X-Optus-CM-Analysis: v=2.0 cv=D4sfsYtj c=1 sm=1 a=VnOwEx96OuMA:10
     a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=av8Homa3Ie4A:10
     a=AVZOoVRqcIQJYAXkCC4A:9 a=CjuIK1q_8ugA:10 a=53MiY31mBRR9oVUS:21
     a=J_TLFwbwM9nZ-CZZ:21 a=TEtd8y5WR3g2ypngnwZWYw==:117
    Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
     src-committers@FreeBSD.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 07:51:04 -0000
    
    On Sat, 2 Mar 2013, Marius Strobl wrote:
    
    > Log:
    >  - Apparently, it's no longer a problem to call shutdown_nice(9) from within
    >    an interrupt filter (some other drivers in the tree do the same). So
    >    change the overtemperature and power fail interrupts from handlers in order
    >    to code and get rid of a !INTR_MPSAFE handlers.
    
    Sigh.
    
    Maybe the only thing that "works" better with a filter is that LOR detection
    for it is broken since filters don't use normal mutexes?
    
    > Modified: head/sys/sparc64/sbus/sbus.c
    > ==============================================================================
    > --- head/sys/sparc64/sbus/sbus.c	Sat Mar  2 00:37:31 2013	(r247600)
    > +++ head/sys/sparc64/sbus/sbus.c	Sat Mar  2 00:41:51 2013	(r247601)
    > @@ -199,7 +199,7 @@ static driver_t sbus_driver = {
    >
    > static devclass_t sbus_devclass;
    >
    > -EARLY_DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, 0, 0,
    > +EARLY_DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, NULL, NULL,
    >     BUS_PASS_BUS);
    > MODULE_DEPEND(sbus, nexus, 1, 1, 1);
    > MODULE_VERSION(sbus, 1);
    > @@ -410,7 +410,7 @@ sbus_attach(device_t dev)
    > 	    INTVEC(SYSIO_READ8(sc, SBR_THERM_INT_MAP)) != vec ||
    > 	    intr_vectors[vec].iv_ic != &sbus_ic ||
    > 	    bus_setup_intr(dev, sc->sc_ot_ires, INTR_TYPE_MISC | INTR_BRIDGE,
    > -	    NULL, sbus_overtemp, sc, &sc->sc_ot_ihand) != 0)
    > +	    sbus_overtemp, NULL, sc, &sc->sc_ot_ihand) != 0)
    > 		panic("%s: failed to set up temperature interrupt", __func__);
    > 	i = 3;
    > 	sc->sc_pf_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i,
    
    It still doesn't claim INTR_MPSAFE.  Maybe that is meaningless for filters.
    But some filters claim it.
    
    > @@ -897,31 +897,33 @@ sbus_get_devinfo(device_t bus, device_t
    >  * This handles the interrupt and powers off the machine.
    >  * The same needs to be done to PCI controller drivers.
    >  */
    > -static void
    > -sbus_overtemp(void *arg)
    > +static int
    > +sbus_overtemp(void *arg __unused)
    > {
    > 	static int shutdown;
    >
    > 	/* As the interrupt is cleared we may be called multiple times. */
    > 	if (shutdown != 0)
    > -		return;
    > +		return (FILTER_HANDLED);
    > 	shutdown++;
    > 	printf("DANGER: OVER TEMPERATURE detected\nShutting down NOW.\n");
    
    Calling the any() function printf() is also invalid in fast interrupt
    handlers.  It is especially unsafe in practice in versions that serialize
    the output -- this printf() may be long delayed.
    
    > 	shutdown_nice(RB_POWEROFF);
    > +	return (FILTER_HANDLED);
    > }
    >
    > /* Try to shut down in time in case of power failure. */
    > -static void
    > -sbus_pwrfail(void *arg)
    > +static int
    > +sbus_pwrfail(void *arg __unused)
    > {
    > 	static int shutdown;
    >
    > 	/* As the interrupt is cleared we may be called multiple times. */
    > 	if (shutdown != 0)
    > -		return;
    > +		return (FILTER_HANDLED);
    > 	shutdown++;
    > 	printf("Power failure detected\nShutting down NOW.\n");
    > -	shutdown_nice(0);
    > +	shutdown_nice(FILTER_HANDLED);
    
    FILTER_HANDLED is a garbage arg for shutdown_nice().  It happens to be
    2, which happens to be RB_SINGLE, which is a boot flag and not a reboot
    flag, and is also not really used, so this bug has little effect.
    
    > +	return (FILTER_HANDLED);
    > }
    >
    > static int
    >
    
    I don't see anything to make these more MPSAFE than before.  They seem
    to be basically correct and MPSAFE as ordinary interrupt handlers, but
    basically incorrect and MPSAFE as filters.  The shutdown_nice() call
    is MPSAFE if calling it is safe at all.  You just need to ensure that
    the handlers are not connected to multiple interrupt sources (including
    ones for other devies), so that rest of the global state accessed by
    the handlers doesn't need locking.  This state is just the `shutdown'
    variable in each, so it could easily be protected by an atomic op.
    The locking is just as missing for the filter version as for the normal
    version if there can be multiple interrupt sources.  However, the worst
    that can happen if the counter gets messed up seems to be multiple
    printf()s and multiple SIGINTs sent to init.  Both are probably
    harmless.
    
    Bruce
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 08:12:43 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 2DFD4D22;
     Sat,  2 Mar 2013 08:12:43 +0000 (UTC)
     (envelope-from adrian@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id E577AFC0;
     Sat,  2 Mar 2013 08:12:42 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r228Cg3O002880;
     Sat, 2 Mar 2013 08:12:42 GMT (envelope-from adrian@svn.freebsd.org)
    Received: (from adrian@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r228Cflx002877;
     Sat, 2 Mar 2013 08:12:41 GMT (envelope-from adrian@svn.freebsd.org)
    Message-Id: <201303020812.r228Cflx002877@svn.freebsd.org>
    From: Adrian Chadd 
    Date: Sat, 2 Mar 2013 08:12:41 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247615 - in head: . sys/amd64/conf sys/i386/conf
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 08:12:43 -0000
    
    Author: adrian
    Date: Sat Mar  2 08:12:41 2013
    New Revision: 247615
    URL: http://svnweb.freebsd.org/changeset/base/247615
    
    Log:
      Disable the ctl driver in GENERIC.
      
      It unfortunately steals a fair chunk of RAM at startup even if it's not
      actively used, which prevents FreeBSD VMs of 128MB from successfully
      booting and running.
    
    Modified:
      head/UPDATING
      head/sys/amd64/conf/GENERIC
      head/sys/i386/conf/GENERIC
    
    Modified: head/UPDATING
    ==============================================================================
    --- head/UPDATING	Sat Mar  2 06:55:55 2013	(r247614)
    +++ head/UPDATING	Sat Mar  2 08:12:41 2013	(r247615)
    @@ -26,6 +26,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
     	disable the most expensive debugging functionality run
     	"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
     
    +20130301:
    +	The ctl device has been disabled in GENERIC for i386 and amd64.
    +	This was done due to the extra memory being allocated at system
    +	initialisation time by the ctl driver which was only used if
    +	a CAM target device was created.  This makes a FreeBSD system
    +	unusable on 128MB or less of RAM.
    +
     20130208:
     	A new compression method (lz4) has been merged to -HEAD.  Please
     	refer to zpool-features(7) for more information.
    
    Modified: head/sys/amd64/conf/GENERIC
    ==============================================================================
    --- head/sys/amd64/conf/GENERIC	Sat Mar  2 06:55:55 2013	(r247614)
    +++ head/sys/amd64/conf/GENERIC	Sat Mar  2 08:12:41 2013	(r247615)
    @@ -138,7 +138,7 @@ device		sa		# Sequential Access (tape et
     device		cd		# CD
     device		pass		# Passthrough device (direct ATA/SCSI access)
     device		ses		# Enclosure Services (SES and SAF-TE)
    -device		ctl		# CAM Target Layer
    +#device		ctl		# CAM Target Layer
     
     # RAID controllers interfaced to the SCSI subsystem
     device		amr		# AMI MegaRAID
    
    Modified: head/sys/i386/conf/GENERIC
    ==============================================================================
    --- head/sys/i386/conf/GENERIC	Sat Mar  2 06:55:55 2013	(r247614)
    +++ head/sys/i386/conf/GENERIC	Sat Mar  2 08:12:41 2013	(r247615)
    @@ -146,7 +146,7 @@ device		sa		# Sequential Access (tape et
     device		cd		# CD
     device		pass		# Passthrough device (direct ATA/SCSI access)
     device		ses		# Enclosure Services (SES and SAF-TE)
    -device		ctl		# CAM Target Layer
    +#device		ctl		# CAM Target Layer
     
     # RAID controllers interfaced to the SCSI subsystem
     device		amr		# AMI MegaRAID
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 09:58:49 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 15D2EFAA;
     Sat,  2 Mar 2013 09:58:49 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id F21652E4;
     Sat,  2 Mar 2013 09:58:48 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r229wm4j033190;
     Sat, 2 Mar 2013 09:58:48 GMT (envelope-from pjd@svn.freebsd.org)
    Received: (from pjd@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r229wm1M033189;
     Sat, 2 Mar 2013 09:58:48 GMT (envelope-from pjd@svn.freebsd.org)
    Message-Id: <201303020958.r229wm1M033189@svn.freebsd.org>
    From: Pawel Jakub Dawidek 
    Date: Sat, 2 Mar 2013 09:58:48 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247617 - head/sys/kern
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 09:58:49 -0000
    
    Author: pjd
    Date: Sat Mar  2 09:58:47 2013
    New Revision: 247617
    URL: http://svnweb.freebsd.org/changeset/base/247617
    
    Log:
      If the target file already exists, check for the CAP_UNLINKAT capabiity right
      on the target directory descriptor, but only if this is renameat(2) and real
      target directory descriptor is given (not AT_FDCWD). Without this fix regular
      rename(2) fails if the target file already exists.
      
      Reported by:	Michael Butler 
      Reported by:	Larry Rosenman 
      Sponsored by:	The FreeBSD Foundation
    
    Modified:
      head/sys/kern/vfs_syscalls.c
    
    Modified: head/sys/kern/vfs_syscalls.c
    ==============================================================================
    --- head/sys/kern/vfs_syscalls.c	Sat Mar  2 09:26:59 2013	(r247616)
    +++ head/sys/kern/vfs_syscalls.c	Sat Mar  2 09:58:47 2013	(r247617)
    @@ -3556,13 +3556,16 @@ kern_renameat(struct thread *td, int old
     			goto out;
     		}
     #ifdef CAPABILITIES
    -		/*
    -		 * If the target already exists we require CAP_UNLINKAT
    -		 * from 'newfd'.
    -		 */
    -		error = cap_check(tond.ni_filecaps.fc_rights, CAP_UNLINKAT);
    -		if (error != 0)
    -			goto out;
    +		if (newfd != AT_FDCWD) {
    +			/*
    +			 * If the target already exists we require CAP_UNLINKAT
    +			 * from 'newfd'.
    +			 */
    +			error = cap_check(tond.ni_filecaps.fc_rights,
    +			    CAP_UNLINKAT);
    +			if (error != 0)
    +				goto out;
    +		}
     #endif
     	}
     	if (fvp == tdvp) {
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 12:42:24 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 25D718EC;
     Sat,  2 Mar 2013 12:42:24 +0000 (UTC)
     (envelope-from jilles@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 010CF90F;
     Sat,  2 Mar 2013 12:42:24 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22CgNbG083436;
     Sat, 2 Mar 2013 12:42:23 GMT (envelope-from jilles@svn.freebsd.org)
    Received: (from jilles@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22CgNQ6083435;
     Sat, 2 Mar 2013 12:42:23 GMT (envelope-from jilles@svn.freebsd.org)
    Message-Id: <201303021242.r22CgNQ6083435@svn.freebsd.org>
    From: Jilles Tjoelker 
    Date: Sat, 2 Mar 2013 12:42:23 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247619 - head/sys/fs/nullfs
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 12:42:24 -0000
    
    Author: jilles
    Date: Sat Mar  2 12:42:23 2013
    New Revision: 247619
    URL: http://svnweb.freebsd.org/changeset/base/247619
    
    Log:
      nullfs: Improve f_flags in statfs().
      
      Include some flags of the nullfs mount itself:
      MNT_RDONLY, MNT_NOEXEC, MNT_NOSUID, MNT_UNION, MNT_NOSYMFOLLOW.
      
      This allows userland code calling statfs() or fstatfs() to see these flags.
      In particular, this allows opendir() to detect that a -t nullfs -o union
      mount needs deduplication (otherwise at least . and .. are returned twice)
      and allows rtld to detect a -t nullfs -o noexec mount as noexec.
      
      Turn off the MNT_ROOTFS flag from the underlying filesystem because the
      nullfs mount is definitely not the root filesystem.
      
      Reviewed by:	kib
      MFC after:	1 week
    
    Modified:
      head/sys/fs/nullfs/null_vfsops.c
    
    Modified: head/sys/fs/nullfs/null_vfsops.c
    ==============================================================================
    --- head/sys/fs/nullfs/null_vfsops.c	Sat Mar  2 11:33:21 2013	(r247618)
    +++ head/sys/fs/nullfs/null_vfsops.c	Sat Mar  2 12:42:23 2013	(r247619)
    @@ -313,7 +313,8 @@ nullfs_statfs(mp, sbp)
     
     	/* now copy across the "interesting" information and fake the rest */
     	sbp->f_type = mstat.f_type;
    -	sbp->f_flags = mstat.f_flags;
    +	sbp->f_flags = (sbp->f_flags & (MNT_RDONLY | MNT_NOEXEC | MNT_NOSUID |
    +	    MNT_UNION | MNT_NOSYMFOLLOW)) | (mstat.f_flags & ~MNT_ROOTFS);
     	sbp->f_bsize = mstat.f_bsize;
     	sbp->f_iosize = mstat.f_iosize;
     	sbp->f_blocks = mstat.f_blocks;
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 13:04:59 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 5D105D79;
     Sat,  2 Mar 2013 13:04:59 +0000 (UTC)
     (envelope-from marius@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 4AB1C997;
     Sat,  2 Mar 2013 13:04:59 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22D4xFs089887;
     Sat, 2 Mar 2013 13:04:59 GMT (envelope-from marius@svn.freebsd.org)
    Received: (from marius@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22D4xoI089886;
     Sat, 2 Mar 2013 13:04:59 GMT (envelope-from marius@svn.freebsd.org)
    Message-Id: <201303021304.r22D4xoI089886@svn.freebsd.org>
    From: Marius Strobl 
    Date: Sat, 2 Mar 2013 13:04:59 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247620 - head/sys/sparc64/pci
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 13:04:59 -0000
    
    Author: marius
    Date: Sat Mar  2 13:04:58 2013
    New Revision: 247620
    URL: http://svnweb.freebsd.org/changeset/base/247620
    
    Log:
      Revert the part of r247600 which turned the overtemperature and power fail
      interrupt shutdown handlers into filters. Shutdown_nice(9) acquires a sleep
      lock, which filters shouldn't do. It also seems that kern_reboot(9) still
      may require Giant to be hold.
      
      Submitted by:	bde
    
    Modified:
      head/sys/sparc64/pci/psycho.c
    
    Modified: head/sys/sparc64/pci/psycho.c
    ==============================================================================
    --- head/sys/sparc64/pci/psycho.c	Sat Mar  2 12:42:23 2013	(r247619)
    +++ head/sys/sparc64/pci/psycho.c	Sat Mar  2 13:04:58 2013	(r247620)
    @@ -81,7 +81,7 @@ static const struct psycho_desc *psycho_
         const char *);
     static const struct psycho_desc *psycho_get_desc(device_t);
     static void psycho_set_intr(struct psycho_softc *, u_int, bus_addr_t,
    -    driver_filter_t);
    +    driver_filter_t, driver_intr_t);
     static int psycho_find_intrmap(struct psycho_softc *, u_int, bus_addr_t *,
         bus_addr_t *, u_long *);
     static void sabre_dmamap_sync(bus_dma_tag_t dt, bus_dmamap_t map,
    @@ -96,8 +96,8 @@ static driver_filter_t psycho_ue;
     static driver_filter_t psycho_ce;
     static driver_filter_t psycho_pci_bus;
     static driver_filter_t psycho_powerdebug;
    -static driver_filter_t psycho_powerdown;
    -static driver_filter_t psycho_overtemp;
    +static driver_intr_t psycho_powerdown;
    +static driver_intr_t psycho_overtemp;
     #ifdef PSYCHO_MAP_WAKEUP
     static driver_filter_t psycho_wakeup;
     #endif
    @@ -619,17 +619,17 @@ psycho_attach(device_t dev)
     		 * XXX Not all controllers have these, but installing them
     		 * is better than trying to sort through this mess.
     		 */
    -		psycho_set_intr(sc, 1, PSR_UE_INT_MAP, psycho_ue);
    -		psycho_set_intr(sc, 2, PSR_CE_INT_MAP, psycho_ce);
    +		psycho_set_intr(sc, 1, PSR_UE_INT_MAP, psycho_ue, NULL);
    +		psycho_set_intr(sc, 2, PSR_CE_INT_MAP, psycho_ce, NULL);
     		switch (psycho_powerfail) {
     		case 0:
     			break;
     		case 2:
     			psycho_set_intr(sc, 3, PSR_POWER_INT_MAP,
    -			    psycho_powerdebug);
    +			    psycho_powerdebug, NULL);
     			break;
     		default:
    -			psycho_set_intr(sc, 3, PSR_POWER_INT_MAP,
    +			psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, NULL,
     			    psycho_powerdown);
     			break;
     		}
    @@ -643,7 +643,7 @@ psycho_attach(device_t dev)
     			 * The spare hardware interrupt is used for the
     			 * over-temperature interrupt.
     			 */
    -			psycho_set_intr(sc, 4, PSR_SPARE_INT_MAP,
    +			psycho_set_intr(sc, 4, PSR_SPARE_INT_MAP, NULL,
     			    psycho_overtemp);
     #ifdef PSYCHO_MAP_WAKEUP
     			/*
    @@ -651,7 +651,7 @@ psycho_attach(device_t dev)
     			 * now.
     			 */
     			psycho_set_intr(sc, 5, PSR_PWRMGT_INT_MAP,
    -			    psycho_wakeup);
    +			    psycho_wakeup, NULL);
     #endif /* PSYCHO_MAP_WAKEUP */
     		}
     	}
    @@ -661,7 +661,7 @@ psycho_attach(device_t dev)
     	 * interrupt but they are also only used for PCI bus A.
     	 */
     	psycho_set_intr(sc, 0, sc->sc_half == 0 ? PSR_PCIAERR_INT_MAP :
    -	    PSR_PCIBERR_INT_MAP, psycho_pci_bus);
    +	    PSR_PCIBERR_INT_MAP, psycho_pci_bus, NULL);
     
     	/*
     	 * Set the latency timer register as this isn't always done by the
    @@ -701,7 +701,7 @@ psycho_attach(device_t dev)
     
     static void
     psycho_set_intr(struct psycho_softc *sc, u_int index, bus_addr_t intrmap,
    -    driver_filter_t handler)
    +    driver_filter_t filt, driver_intr_t intr)
     {
     	u_long vec;
     	int rid;
    @@ -722,7 +722,7 @@ psycho_set_intr(struct psycho_softc *sc,
     	    INTVEC(PSYCHO_READ8(sc, intrmap)) != vec ||
     	    intr_vectors[vec].iv_ic != &psycho_ic ||
     	    bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index],
    -	    INTR_TYPE_MISC | INTR_BRIDGE, handler, NULL, sc,
    +	    INTR_TYPE_MISC | INTR_BRIDGE, filt, intr, sc,
     	    &sc->sc_ihand[index]) != 0)
     		panic("%s: failed to set up interrupt %d", __func__, index);
     }
    @@ -858,32 +858,30 @@ psycho_powerdebug(void *arg __unused)
     	return (FILTER_HANDLED);
     }
     
    -static int
    +static void
     psycho_powerdown(void *arg __unused)
     {
     	static int shutdown;
     
     	/* As the interrupt is cleared we may be called multiple times. */
     	if (shutdown != 0)
    -		return (FILTER_HANDLED);
    +		return;
     	shutdown++;
     	printf("Power Failure Detected: Shutting down NOW.\n");
     	shutdown_nice(RB_POWEROFF);
    -	return (FILTER_HANDLED);
     }
     
    -static int
    +static void
     psycho_overtemp(void *arg __unused)
     {
     	static int shutdown;
     
     	/* As the interrupt is cleared we may be called multiple times. */
     	if (shutdown != 0)
    -		return (FILTER_HANDLED);
    +		return;
     	shutdown++;
     	printf("DANGER: OVER TEMPERATURE detected.\nShutting down NOW.\n");
     	shutdown_nice(RB_POWEROFF);
    -	return (FILTER_HANDLED);
     }
     
     #ifdef PSYCHO_MAP_WAKEUP
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 13:08:14 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 92720F24;
     Sat,  2 Mar 2013 13:08:14 +0000 (UTC)
     (envelope-from marius@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 766FA9BB;
     Sat,  2 Mar 2013 13:08:14 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22D8Efi090460;
     Sat, 2 Mar 2013 13:08:14 GMT (envelope-from marius@svn.freebsd.org)
    Received: (from marius@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22D8E0C090459;
     Sat, 2 Mar 2013 13:08:14 GMT (envelope-from marius@svn.freebsd.org)
    Message-Id: <201303021308.r22D8E0C090459@svn.freebsd.org>
    From: Marius Strobl 
    Date: Sat, 2 Mar 2013 13:08:14 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247621 - head/sys/sparc64/sbus
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 13:08:14 -0000
    
    Author: marius
    Date: Sat Mar  2 13:08:13 2013
    New Revision: 247621
    URL: http://svnweb.freebsd.org/changeset/base/247621
    
    Log:
      - Revert the part of r247601 which turned the overtemperature and power fail
        interrupt shutdown handlers into filters. Shutdown_nice(9) acquires a sleep
        lock, which filters shouldn't do. It also seems that kern_reboot(9) still
        may require Giant to be hold.
      - Correct an incorrect argument to shutdown_nice(9).
      
      Submitted by:	bde
    
    Modified:
      head/sys/sparc64/sbus/sbus.c
    
    Modified: head/sys/sparc64/sbus/sbus.c
    ==============================================================================
    --- head/sys/sparc64/sbus/sbus.c	Sat Mar  2 13:04:58 2013	(r247620)
    +++ head/sys/sparc64/sbus/sbus.c	Sat Mar  2 13:08:13 2013	(r247621)
    @@ -152,8 +152,8 @@ static void sbus_intr_assign(void *);
     static void sbus_intr_clear(void *);
     static int sbus_find_intrmap(struct sbus_softc *, u_int, bus_addr_t *,
         bus_addr_t *);
    -static driver_filter_t sbus_overtemp;
    -static driver_filter_t sbus_pwrfail;
    +static driver_intr_t sbus_overtemp;
    +static driver_intr_t sbus_pwrfail;
     static int sbus_print_res(struct sbus_devinfo *);
     
     static device_method_t sbus_methods[] = {
    @@ -410,7 +410,7 @@ sbus_attach(device_t dev)
     	    INTVEC(SYSIO_READ8(sc, SBR_THERM_INT_MAP)) != vec ||
     	    intr_vectors[vec].iv_ic != &sbus_ic ||
     	    bus_setup_intr(dev, sc->sc_ot_ires, INTR_TYPE_MISC | INTR_BRIDGE,
    -	    sbus_overtemp, NULL, sc, &sc->sc_ot_ihand) != 0)
    +	    NULL, sbus_overtemp, sc, &sc->sc_ot_ihand) != 0)
     		panic("%s: failed to set up temperature interrupt", __func__);
     	i = 3;
     	sc->sc_pf_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i,
    @@ -420,7 +420,7 @@ sbus_attach(device_t dev)
     	    INTVEC(SYSIO_READ8(sc, SBR_POWER_INT_MAP)) != vec ||
     	    intr_vectors[vec].iv_ic != &sbus_ic ||
     	    bus_setup_intr(dev, sc->sc_pf_ires, INTR_TYPE_MISC | INTR_BRIDGE,
    -	    sbus_pwrfail, NULL, sc, &sc->sc_pf_ihand) != 0)
    +	    NULL, sbus_pwrfail, sc, &sc->sc_pf_ihand) != 0)
     		panic("%s: failed to set up power fail interrupt", __func__);
     
     	/* Initialize the counter-timer. */
    @@ -897,33 +897,31 @@ sbus_get_devinfo(device_t bus, device_t 
      * This handles the interrupt and powers off the machine.
      * The same needs to be done to PCI controller drivers.
      */
    -static int
    +static void
     sbus_overtemp(void *arg __unused)
     {
     	static int shutdown;
     
     	/* As the interrupt is cleared we may be called multiple times. */
     	if (shutdown != 0)
    -		return (FILTER_HANDLED);
    +		return;
     	shutdown++;
     	printf("DANGER: OVER TEMPERATURE detected\nShutting down NOW.\n");
     	shutdown_nice(RB_POWEROFF);
    -	return (FILTER_HANDLED);
     }
     
     /* Try to shut down in time in case of power failure. */
    -static int
    +static void
     sbus_pwrfail(void *arg __unused)
     {
     	static int shutdown;
     
     	/* As the interrupt is cleared we may be called multiple times. */
     	if (shutdown != 0)
    -		return (FILTER_HANDLED);
    +		return;
     	shutdown++;
     	printf("Power failure detected\nShutting down NOW.\n");
    -	shutdown_nice(FILTER_HANDLED);
    -	return (FILTER_HANDLED);
    +	shutdown_nice(RB_POWEROFF);
     }
     
     static int
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 14:19:08 2013
    Return-Path: 
    Delivered-To: svn-src-head@FreeBSD.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 32A6385F;
     Sat,  2 Mar 2013 14:19:08 +0000 (UTC)
     (envelope-from brde@optusnet.com.au)
    Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au
     [211.29.132.190])
     by mx1.freebsd.org (Postfix) with ESMTP id A78DCD7A;
     Sat,  2 Mar 2013 14:19:07 +0000 (UTC)
    Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au
     (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106])
     by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r22EJ2tV020291
     (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
     Sun, 3 Mar 2013 01:19:05 +1100
    Date: Sun, 3 Mar 2013 01:19:02 +1100 (EST)
    From: Bruce Evans 
    X-X-Sender: bde@besplex.bde.org
    To: Marius Strobl 
    Subject: Re: svn commit: r247620 - head/sys/sparc64/pci
    In-Reply-To: <201303021304.r22D4xoI089886@svn.freebsd.org>
    Message-ID: <20130303005613.A3532@besplex.bde.org>
    References: <201303021304.r22D4xoI089886@svn.freebsd.org>
    MIME-Version: 1.0
    Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
    X-Optus-CM-Score: 0
    X-Optus-CM-Analysis: v=2.0 cv=DdhPMYRW c=1 sm=1 a=qBJJwPPf2HcA:10
     a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=shoyfQpYrMMA:10
     a=1nWYaaUoRXj36-mlhGAA:9 a=CjuIK1q_8ugA:10 a=TEtd8y5WR3g2ypngnwZWYw==:117
    Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
     src-committers@FreeBSD.org
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 14:19:08 -0000
    
    On Sat, 2 Mar 2013, Marius Strobl wrote:
    
    > Log:
    >  Revert the part of r247600 which turned the overtemperature and power fail
    >  interrupt shutdown handlers into filters. Shutdown_nice(9) acquires a sleep
    >  lock, which filters shouldn't do. It also seems that kern_reboot(9) still
    >  may require Giant to be hold.
    >
    >  Submitted by:	bde
    
    Thanks.
    
    Ithreads shouldn't normally use sleep locks either, but I think that is
    OK here since the sleeping mainly prevents new interrupts on the same
    interrupt source being handledm but when this interrupt should shut down
    that doesn't matter (even if the the interrupt is multiplexed so that the
    new interrupts may be for another device).
    
    Maybe interrupt handlers for urgent events should increase their priority
    as much as possible.  They should start with highest interrupt priority.
    This is not very high but is hard to change.  Then if the interrupt handler
    can be reached, it is easy for it to raise its priority so that it doesn't
    get preempted.
    
    > Modified: head/sys/sparc64/pci/psycho.c
    > ...
    > @@ -643,7 +643,7 @@ psycho_attach(device_t dev)
    > 			 * The spare hardware interrupt is used for the
    > 			 * over-temperature interrupt.
    > 			 */
    > -			psycho_set_intr(sc, 4, PSR_SPARE_INT_MAP,
    > +			psycho_set_intr(sc, 4, PSR_SPARE_INT_MAP, NULL,
    > 			    psycho_overtemp);
    > #ifdef PSYCHO_MAP_WAKEUP
    > 			/*
    
    I hope this asks for a high hardware interrupt priority.
    
    > @@ -722,7 +722,7 @@ psycho_set_intr(struct psycho_softc *sc,
    > 	    INTVEC(PSYCHO_READ8(sc, intrmap)) != vec ||
    > 	    intr_vectors[vec].iv_ic != &psycho_ic ||
    > 	    bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index],
    > -	    INTR_TYPE_MISC | INTR_BRIDGE, handler, NULL, sc,
    > +	    INTR_TYPE_MISC | INTR_BRIDGE, filt, intr, sc,
    > 	    &sc->sc_ihand[index]) != 0)
    > 		panic("%s: failed to set up interrupt %d", __func__, index);
    > }
    
    INTR_TYPE_MISC is not very high.  In fact, it is mapped to PI_DULL =
    don't care = lowest hardware interrupt priority.
    
    > @@ -858,32 +858,30 @@ psycho_powerdebug(void *arg __unused)
    > 	return (FILTER_HANDLED);
    > }
    >
    > -static int
    > +static void
    > psycho_powerdown(void *arg __unused)
    > {
    > 	static int shutdown;
    >
    > 	/* As the interrupt is cleared we may be called multiple times. */
    > 	if (shutdown != 0)
    > -		return (FILTER_HANDLED);
    > +		return;
    > 	shutdown++;
    > 	printf("Power Failure Detected: Shutting down NOW.\n");
    > 	shutdown_nice(RB_POWEROFF);
    > -	return (FILTER_HANDLED);
    > }
    
    Since shutdown_nice() just signals init, raising the priority here
    wouldn't help run most of the shutdown at high priority or quickly.
    There are even intentional long delays in normal shutdowns, to let the
    operator read the messages.  So these events need to be not very urgent
    and allow a few seconds or even minutes to shut down.
    
    Bruce
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 14:19:09 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id E24FE861;
     Sat,  2 Mar 2013 14:19:09 +0000 (UTC)
     (envelope-from attilio@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id C6466D7B;
     Sat,  2 Mar 2013 14:19:09 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22EJ9BR012008;
     Sat, 2 Mar 2013 14:19:09 GMT (envelope-from attilio@svn.freebsd.org)
    Received: (from attilio@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22EJ9hE012002;
     Sat, 2 Mar 2013 14:19:09 GMT (envelope-from attilio@svn.freebsd.org)
    Message-Id: <201303021419.r22EJ9hE012002@svn.freebsd.org>
    From: Attilio Rao 
    Date: Sat, 2 Mar 2013 14:19:09 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247622 - in head/sys: amd64/amd64 amd64/include
     i386/i386 i386/include
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 14:19:10 -0000
    
    Author: attilio
    Date: Sat Mar  2 14:19:08 2013
    New Revision: 247622
    URL: http://svnweb.freebsd.org/changeset/base/247622
    
    Log:
      Merge from vmc-playground branch:
      Rename the pv_entry_t iterator from pv_list to pv_next.
      Besides being more correct technically (as the name seems to suggest
      this is a list while it is an iterator), it will also be needed by
      vm_radix work to avoid a nameclash on macro expansions.
      
      Sponsored by:	EMC / Isilon storage division
      Reviewed by:	alc, jeff
      Tested by:	flo, pho, jhb, davide
    
    Modified:
      head/sys/amd64/amd64/pmap.c
      head/sys/amd64/include/pmap.h
      head/sys/i386/i386/pmap.c
      head/sys/i386/include/pmap.h
    
    Modified: head/sys/amd64/amd64/pmap.c
    ==============================================================================
    --- head/sys/amd64/amd64/pmap.c	Sat Mar  2 13:08:13 2013	(r247621)
    +++ head/sys/amd64/amd64/pmap.c	Sat Mar  2 14:19:08 2013	(r247622)
    @@ -2222,7 +2222,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, str
     				if ((tpte & PG_A) != 0)
     					vm_page_aflag_set(m, PGA_REFERENCED);
     				CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lockp, m);
    -				TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
    +				TAILQ_REMOVE(&m->md.pv_list, pv, pv_next);
     				if (TAILQ_EMPTY(&m->md.pv_list) &&
     				    (m->flags & PG_FICTITIOUS) == 0) {
     					pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
    @@ -2506,9 +2506,9 @@ pmap_pvh_remove(struct md_page *pvh, pma
     	pv_entry_t pv;
     
     	rw_assert(&pvh_global_lock, RA_LOCKED);
    -	TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) {
     		if (pmap == PV_PMAP(pv) && va == pv->pv_va) {
    -			TAILQ_REMOVE(&pvh->pv_list, pv, pv_list);
    +			TAILQ_REMOVE(&pvh->pv_list, pv, pv_next);
     			break;
     		}
     	}
    @@ -2547,7 +2547,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse
     	pv = pmap_pvh_remove(pvh, pmap, va);
     	KASSERT(pv != NULL, ("pmap_pv_demote_pde: pv not found"));
     	m = PHYS_TO_VM_PAGE(pa);
    -	TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
    +	TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next);
     	/* Instantiate the remaining NPTEPG - 1 pv entries. */
     	PV_STAT(atomic_add_long(&pv_entry_allocs, NPTEPG - 1));
     	va_last = va + NBPDR - PAGE_SIZE;
    @@ -2565,7 +2565,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse
     				m++;
     				KASSERT((m->oflags & VPO_UNMANAGED) == 0,
     			    ("pmap_pv_demote_pde: page %p is not managed", m));
    -				TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
    +				TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next);
     				if (va == va_last)
     					goto out;
     			}
    @@ -2613,7 +2613,7 @@ pmap_pv_promote_pde(pmap_t pmap, vm_offs
     	pv = pmap_pvh_remove(&m->md, pmap, va);
     	KASSERT(pv != NULL, ("pmap_pv_promote_pde: pv not found"));
     	pvh = pa_to_pvh(pa);
    -	TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_list);
    +	TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_next);
     	/* Free the remaining NPTEPG - 1 pv entries. */
     	va_last = va + NBPDR - PAGE_SIZE;
     	do {
    @@ -2654,7 +2654,7 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm
     	if ((pv = get_pv_entry(pmap, NULL)) != NULL) {
     		pv->pv_va = va;
     		CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lockp, m);
    -		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
    +		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next);
     		return (TRUE);
     	} else
     		return (FALSE);
    @@ -2678,7 +2678,7 @@ pmap_pv_insert_pde(pmap_t pmap, vm_offse
     		pv->pv_va = va;
     		CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, pa);
     		pvh = pa_to_pvh(pa);
    -		TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_list);
    +		TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_next);
     		return (TRUE);
     	} else
     		return (FALSE);
    @@ -3157,7 +3157,7 @@ small_mappings:
     			vm_page_dirty(m);
     		pmap_unuse_pt(pmap, pv->pv_va, *pde, &free);
     		pmap_invalidate_page(pmap, pv->pv_va);
    -		TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
    +		TAILQ_REMOVE(&m->md.pv_list, pv, pv_next);
     		free_pv_entry(pmap, pv);
     		PMAP_UNLOCK(pmap);
     	}
    @@ -3602,7 +3602,7 @@ retry:
     		pv = get_pv_entry(pmap, &lock);
     		pv->pv_va = va;
     		CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, pa);
    -		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
    +		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next);
     		if ((newpte & PG_RW) != 0)
     			vm_page_aflag_set(m, PGA_WRITEABLE);
     	}
    @@ -4295,7 +4295,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p
     	rw_rlock(&pvh_global_lock);
     	lock = VM_PAGE_TO_PV_LIST_LOCK(m);
     	rw_rlock(lock);
    -	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) {
     		if (PV_PMAP(pv) == pmap) {
     			rv = TRUE;
     			break;
    @@ -4306,7 +4306,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p
     	}
     	if (!rv && loops < 16 && (m->flags & PG_FICTITIOUS) == 0) {
     		pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
    -		TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) {
    +		TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) {
     			if (PV_PMAP(pv) == pmap) {
     				rv = TRUE;
     				break;
    @@ -4358,7 +4358,7 @@ pmap_pvh_wired_mappings(struct md_page *
     	pv_entry_t pv;
     
     	rw_assert(&pvh_global_lock, RA_WLOCKED);
    -	TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		pte = pmap_pte(pmap, pv->pv_va);
    @@ -4489,7 +4489,7 @@ pmap_remove_pages(pmap_t pmap)
     				if ((tpte & PG_PS) != 0) {
     					pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE);
     					pvh = pa_to_pvh(tpte & PG_PS_FRAME);
    -					TAILQ_REMOVE(&pvh->pv_list, pv, pv_list);
    +					TAILQ_REMOVE(&pvh->pv_list, pv, pv_next);
     					if (TAILQ_EMPTY(&pvh->pv_list)) {
     						for (mt = m; mt < &m[NBPDR / PAGE_SIZE]; mt++)
     							if ((mt->aflags & PGA_WRITEABLE) != 0 &&
    @@ -4508,7 +4508,7 @@ pmap_remove_pages(pmap_t pmap)
     					}
     				} else {
     					pmap_resident_count_dec(pmap, 1);
    -					TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
    +					TAILQ_REMOVE(&m->md.pv_list, pv, pv_next);
     					if ((m->aflags & PGA_WRITEABLE) != 0 &&
     					    TAILQ_EMPTY(&m->md.pv_list) &&
     					    (m->flags & PG_FICTITIOUS) == 0) {
    @@ -4583,7 +4583,7 @@ pmap_is_modified_pvh(struct md_page *pvh
     
     	rw_assert(&pvh_global_lock, RA_WLOCKED);
     	rv = FALSE;
    -	TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		pte = pmap_pte(pmap, pv->pv_va);
    @@ -4654,7 +4654,7 @@ pmap_is_referenced_pvh(struct md_page *p
     
     	rw_assert(&pvh_global_lock, RA_WLOCKED);
     	rv = FALSE;
    -	TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		pte = pmap_pte(pmap, pv->pv_va);
    @@ -4695,7 +4695,7 @@ pmap_remove_write(vm_page_t m)
     	if ((m->flags & PG_FICTITIOUS) != 0)
     		goto small_mappings;
     	pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
    -	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, next_pv) {
    +	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_next, next_pv) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		va = pv->pv_va;
    @@ -4705,7 +4705,7 @@ pmap_remove_write(vm_page_t m)
     		PMAP_UNLOCK(pmap);
     	}
     small_mappings:
    -	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		pde = pmap_pde(pmap, pv->pv_va);
    @@ -4758,7 +4758,7 @@ pmap_ts_referenced(vm_page_t m)
     	if ((m->flags & PG_FICTITIOUS) != 0)
     		goto small_mappings;
     	pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
    -	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, pvn) {
    +	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_next, pvn) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		va = pv->pv_va;
    @@ -4792,9 +4792,9 @@ small_mappings:
     	if ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) {
     		pvf = pv;
     		do {
    -			pvn = TAILQ_NEXT(pv, pv_list);
    -			TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
    -			TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
    +			pvn = TAILQ_NEXT(pv, pv_next);
    +			TAILQ_REMOVE(&m->md.pv_list, pv, pv_next);
    +			TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next);
     			pmap = PV_PMAP(pv);
     			PMAP_LOCK(pmap);
     			pde = pmap_pde(pmap, pv->pv_va);
    @@ -4846,7 +4846,7 @@ pmap_clear_modify(vm_page_t m)
     	if ((m->flags & PG_FICTITIOUS) != 0)
     		goto small_mappings;
     	pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
    -	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, next_pv) {
    +	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_next, next_pv) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		va = pv->pv_va;
    @@ -4878,7 +4878,7 @@ pmap_clear_modify(vm_page_t m)
     		PMAP_UNLOCK(pmap);
     	}
     small_mappings:
    -	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		pde = pmap_pde(pmap, pv->pv_va);
    @@ -4915,7 +4915,7 @@ pmap_clear_reference(vm_page_t m)
     	if ((m->flags & PG_FICTITIOUS) != 0)
     		goto small_mappings;
     	pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
    -	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, next_pv) {
    +	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_next, next_pv) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		va = pv->pv_va;
    @@ -4938,7 +4938,7 @@ pmap_clear_reference(vm_page_t m)
     		PMAP_UNLOCK(pmap);
     	}
     small_mappings:
    -	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		pde = pmap_pde(pmap, pv->pv_va);
    
    Modified: head/sys/amd64/include/pmap.h
    ==============================================================================
    --- head/sys/amd64/include/pmap.h	Sat Mar  2 13:08:13 2013	(r247621)
    +++ head/sys/amd64/include/pmap.h	Sat Mar  2 14:19:08 2013	(r247622)
    @@ -277,7 +277,7 @@ extern struct pmap	kernel_pmap_store;
      */
     typedef struct pv_entry {
     	vm_offset_t	pv_va;		/* virtual address for mapping */
    -	TAILQ_ENTRY(pv_entry)	pv_list;
    +	TAILQ_ENTRY(pv_entry)	pv_next;
     } *pv_entry_t;
     
     /*
    
    Modified: head/sys/i386/i386/pmap.c
    ==============================================================================
    --- head/sys/i386/i386/pmap.c	Sat Mar  2 13:08:13 2013	(r247621)
    +++ head/sys/i386/i386/pmap.c	Sat Mar  2 14:19:08 2013	(r247622)
    @@ -2286,7 +2286,7 @@ pmap_pv_reclaim(pmap_t locked_pmap)
     					vm_page_dirty(m);
     				if ((tpte & PG_A) != 0)
     					vm_page_aflag_set(m, PGA_REFERENCED);
    -				TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
    +				TAILQ_REMOVE(&m->md.pv_list, pv, pv_next);
     				if (TAILQ_EMPTY(&m->md.pv_list) &&
     				    (m->flags & PG_FICTITIOUS) == 0) {
     					pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
    @@ -2491,9 +2491,9 @@ pmap_pvh_remove(struct md_page *pvh, pma
     	pv_entry_t pv;
     
     	rw_assert(&pvh_global_lock, RA_WLOCKED);
    -	TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) {
     		if (pmap == PV_PMAP(pv) && va == pv->pv_va) {
    -			TAILQ_REMOVE(&pvh->pv_list, pv, pv_list);
    +			TAILQ_REMOVE(&pvh->pv_list, pv, pv_next);
     			break;
     		}
     	}
    @@ -2521,7 +2521,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse
     	pv = pmap_pvh_remove(pvh, pmap, va);
     	KASSERT(pv != NULL, ("pmap_pv_demote_pde: pv not found"));
     	m = PHYS_TO_VM_PAGE(pa);
    -	TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
    +	TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next);
     	/* Instantiate the remaining NPTEPG - 1 pv entries. */
     	va_last = va + NBPDR - PAGE_SIZE;
     	do {
    @@ -2557,7 +2557,7 @@ pmap_pv_promote_pde(pmap_t pmap, vm_offs
     	pv = pmap_pvh_remove(&m->md, pmap, va);
     	KASSERT(pv != NULL, ("pmap_pv_promote_pde: pv not found"));
     	pvh = pa_to_pvh(pa);
    -	TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_list);
    +	TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_next);
     	/* Free the remaining NPTEPG - 1 pv entries. */
     	va_last = va + NBPDR - PAGE_SIZE;
     	do {
    @@ -2604,7 +2604,7 @@ pmap_insert_entry(pmap_t pmap, vm_offset
     	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
     	pv = get_pv_entry(pmap, FALSE);
     	pv->pv_va = va;
    -	TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
    +	TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next);
     }
     
     /*
    @@ -2620,7 +2620,7 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm
     	if (pv_entry_count < pv_entry_high_water && 
     	    (pv = get_pv_entry(pmap, TRUE)) != NULL) {
     		pv->pv_va = va;
    -		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
    +		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next);
     		return (TRUE);
     	} else
     		return (FALSE);
    @@ -2640,7 +2640,7 @@ pmap_pv_insert_pde(pmap_t pmap, vm_offse
     	    (pv = get_pv_entry(pmap, TRUE)) != NULL) {
     		pv->pv_va = va;
     		pvh = pa_to_pvh(pa);
    -		TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_list);
    +		TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_next);
     		return (TRUE);
     	} else
     		return (FALSE);
    @@ -3095,7 +3095,7 @@ small_mappings:
     			vm_page_dirty(m);
     		pmap_unuse_pt(pmap, pv->pv_va, &free);
     		pmap_invalidate_page(pmap, pv->pv_va);
    -		TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
    +		TAILQ_REMOVE(&m->md.pv_list, pv, pv_next);
     		free_pv_entry(pmap, pv);
     		PMAP_UNLOCK(pmap);
     	}
    @@ -3550,7 +3550,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
     		if (pv == NULL)
     			pv = get_pv_entry(pmap, FALSE);
     		pv->pv_va = va;
    -		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
    +		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next);
     		pa |= PG_MANAGED;
     	} else if (pv != NULL)
     		free_pv_entry(pmap, pv);
    @@ -4258,7 +4258,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p
     	    ("pmap_page_exists_quick: page %p is not managed", m));
     	rv = FALSE;
     	rw_wlock(&pvh_global_lock);
    -	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) {
     		if (PV_PMAP(pv) == pmap) {
     			rv = TRUE;
     			break;
    @@ -4269,7 +4269,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p
     	}
     	if (!rv && loops < 16 && (m->flags & PG_FICTITIOUS) == 0) {
     		pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
    -		TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) {
    +		TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) {
     			if (PV_PMAP(pv) == pmap) {
     				rv = TRUE;
     				break;
    @@ -4321,7 +4321,7 @@ pmap_pvh_wired_mappings(struct md_page *
     
     	rw_assert(&pvh_global_lock, RA_WLOCKED);
     	sched_pin();
    -	TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		pte = pmap_pte_quick(pmap, pv->pv_va);
    @@ -4448,7 +4448,7 @@ pmap_remove_pages(pmap_t pmap)
     				if ((tpte & PG_PS) != 0) {
     					pmap->pm_stats.resident_count -= NBPDR / PAGE_SIZE;
     					pvh = pa_to_pvh(tpte & PG_PS_FRAME);
    -					TAILQ_REMOVE(&pvh->pv_list, pv, pv_list);
    +					TAILQ_REMOVE(&pvh->pv_list, pv, pv_next);
     					if (TAILQ_EMPTY(&pvh->pv_list)) {
     						for (mt = m; mt < &m[NBPDR / PAGE_SIZE]; mt++)
     							if (TAILQ_EMPTY(&mt->md.pv_list))
    @@ -4466,7 +4466,7 @@ pmap_remove_pages(pmap_t pmap)
     					}
     				} else {
     					pmap->pm_stats.resident_count--;
    -					TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
    +					TAILQ_REMOVE(&m->md.pv_list, pv, pv_next);
     					if (TAILQ_EMPTY(&m->md.pv_list) &&
     					    (m->flags & PG_FICTITIOUS) == 0) {
     						pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
    @@ -4536,7 +4536,7 @@ pmap_is_modified_pvh(struct md_page *pvh
     	rw_assert(&pvh_global_lock, RA_WLOCKED);
     	rv = FALSE;
     	sched_pin();
    -	TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		pte = pmap_pte_quick(pmap, pv->pv_va);
    @@ -4609,7 +4609,7 @@ pmap_is_referenced_pvh(struct md_page *p
     	rw_assert(&pvh_global_lock, RA_WLOCKED);
     	rv = FALSE;
     	sched_pin();
    -	TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		pte = pmap_pte_quick(pmap, pv->pv_va);
    @@ -4652,7 +4652,7 @@ pmap_remove_write(vm_page_t m)
     	if ((m->flags & PG_FICTITIOUS) != 0)
     		goto small_mappings;
     	pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
    -	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, next_pv) {
    +	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_next, next_pv) {
     		va = pv->pv_va;
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
    @@ -4662,7 +4662,7 @@ pmap_remove_write(vm_page_t m)
     		PMAP_UNLOCK(pmap);
     	}
     small_mappings:
    -	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		pde = pmap_pde(pmap, pv->pv_va);
    @@ -4721,7 +4721,7 @@ pmap_ts_referenced(vm_page_t m)
     	sched_pin();
     	if ((m->flags & PG_FICTITIOUS) != 0)
     		goto small_mappings;
    -	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, pvn) {
    +	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_next, pvn) {
     		va = pv->pv_va;
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
    @@ -4755,9 +4755,9 @@ small_mappings:
     	if ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) {
     		pvf = pv;
     		do {
    -			pvn = TAILQ_NEXT(pv, pv_list);
    -			TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
    -			TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
    +			pvn = TAILQ_NEXT(pv, pv_next);
    +			TAILQ_REMOVE(&m->md.pv_list, pv, pv_next);
    +			TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next);
     			pmap = PV_PMAP(pv);
     			PMAP_LOCK(pmap);
     			pde = pmap_pde(pmap, pv->pv_va);
    @@ -4811,7 +4811,7 @@ pmap_clear_modify(vm_page_t m)
     	if ((m->flags & PG_FICTITIOUS) != 0)
     		goto small_mappings;
     	pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
    -	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, next_pv) {
    +	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_next, next_pv) {
     		va = pv->pv_va;
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
    @@ -4848,7 +4848,7 @@ pmap_clear_modify(vm_page_t m)
     		PMAP_UNLOCK(pmap);
     	}
     small_mappings:
    -	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		pde = pmap_pde(pmap, pv->pv_va);
    @@ -4892,7 +4892,7 @@ pmap_clear_reference(vm_page_t m)
     	if ((m->flags & PG_FICTITIOUS) != 0)
     		goto small_mappings;
     	pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
    -	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, next_pv) {
    +	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_next, next_pv) {
     		va = pv->pv_va;
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
    @@ -4915,7 +4915,7 @@ pmap_clear_reference(vm_page_t m)
     		PMAP_UNLOCK(pmap);
     	}
     small_mappings:
    -	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) {
     		pmap = PV_PMAP(pv);
     		PMAP_LOCK(pmap);
     		pde = pmap_pde(pmap, pv->pv_va);
    @@ -5426,7 +5426,7 @@ pmap_pvdump(vm_paddr_t pa)
     
     	printf("pa %x", pa);
     	m = PHYS_TO_VM_PAGE(pa);
    -	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
    +	TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) {
     		pmap = PV_PMAP(pv);
     		printf(" -> pmap %p, va %x", (void *)pmap, pv->pv_va);
     		pads(pmap);
    
    Modified: head/sys/i386/include/pmap.h
    ==============================================================================
    --- head/sys/i386/include/pmap.h	Sat Mar  2 13:08:13 2013	(r247621)
    +++ head/sys/i386/include/pmap.h	Sat Mar  2 14:19:08 2013	(r247622)
    @@ -468,7 +468,7 @@ extern struct pmap	kernel_pmap_store;
      */
     typedef struct pv_entry {
     	vm_offset_t	pv_va;		/* virtual address for mapping */
    -	TAILQ_ENTRY(pv_entry)	pv_list;
    +	TAILQ_ENTRY(pv_entry)	pv_next;
     } *pv_entry_t;
     
     /*
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 14:47:11 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 1AD851A9;
     Sat,  2 Mar 2013 14:47:11 +0000 (UTC)
     (envelope-from melifaro@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 0D581EF8;
     Sat,  2 Mar 2013 14:47:11 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22ElA14022010;
     Sat, 2 Mar 2013 14:47:10 GMT (envelope-from melifaro@svn.freebsd.org)
    Received: (from melifaro@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22ElAxh022009;
     Sat, 2 Mar 2013 14:47:10 GMT (envelope-from melifaro@svn.freebsd.org)
    Message-Id: <201303021447.r22ElAxh022009@svn.freebsd.org>
    From: "Alexander V. Chernikov" 
    Date: Sat, 2 Mar 2013 14:47:10 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247626 - head/sys/netpfil/ipfw
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 14:47:11 -0000
    
    Author: melifaro
    Date: Sat Mar  2 14:47:10 2013
    New Revision: 247626
    URL: http://svnweb.freebsd.org/changeset/base/247626
    
    Log:
      Fix callout expiring dynamic rules.
      
      PR:		kern/175530
      Submitted by:	Vladimir Spiridenkov 
      MFC after:	2 weeks
    
    Modified:
      head/sys/netpfil/ipfw/ip_fw_dynamic.c
    
    Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c
    ==============================================================================
    --- head/sys/netpfil/ipfw/ip_fw_dynamic.c	Sat Mar  2 14:39:48 2013	(r247625)
    +++ head/sys/netpfil/ipfw/ip_fw_dynamic.c	Sat Mar  2 14:47:10 2013	(r247626)
    @@ -980,8 +980,8 @@ ipfw_dyn_tick(void * vnetx) 
     
     	chain = &V_layer3_chain;
     
    -	/* Run keepalive checks every keepalive_interval iff ka is enabled */
    -	if ((V_dyn_keepalive_last + V_dyn_keepalive_interval >= time_uptime) &&
    +	/* Run keepalive checks every keepalive_period iff ka is enabled */
    +	if ((V_dyn_keepalive_last + V_dyn_keepalive_period <= time_uptime) &&
     	    (V_dyn_keepalive != 0)) {
     		V_dyn_keepalive_last = time_uptime;
     		check_ka = 1;
    @@ -1320,7 +1320,7 @@ ipfw_dyn_init(struct ip_fw_chain *chain)
             V_dyn_keepalive_interval = 20;
             V_dyn_keepalive_period = 5;
             V_dyn_keepalive = 1;    /* do send keepalives */
    -	V_dyn_keepalive = time_uptime;
    +	V_dyn_keepalive_last = time_uptime;
             
             V_dyn_max = 4096;       /* max # of dynamic rules */
     
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 14:54:34 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 730BABAE;
     Sat,  2 Mar 2013 14:54:34 +0000 (UTC)
     (envelope-from attilio@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 4D861F5A;
     Sat,  2 Mar 2013 14:54:34 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22EsYVp025186;
     Sat, 2 Mar 2013 14:54:34 GMT (envelope-from attilio@svn.freebsd.org)
    Received: (from attilio@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22EsYIs025185;
     Sat, 2 Mar 2013 14:54:34 GMT (envelope-from attilio@svn.freebsd.org)
    Message-Id: <201303021454.r22EsYIs025185@svn.freebsd.org>
    From: Attilio Rao 
    Date: Sat, 2 Mar 2013 14:54:34 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247628 - in head: sbin/mount_hpfs sys/fs/hpfs
     sys/modules/hpfs
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 14:54:34 -0000
    
    Author: attilio
    Date: Sat Mar  2 14:54:33 2013
    New Revision: 247628
    URL: http://svnweb.freebsd.org/changeset/base/247628
    
    Log:
      Garbage collect HPFS bits which are now already completely disconnected
      from the tree since few months (please note that the userland bits
      were already disconnected since a long time, thus there is no need
      to update the OLD* entries).
      
      This is not targeted for MFC.
    
    Deleted:
      head/sbin/mount_hpfs/
      head/sys/fs/hpfs/
      head/sys/modules/hpfs/
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 15:33:54 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id CD3DF244;
     Sat,  2 Mar 2013 15:33:54 +0000 (UTC)
     (envelope-from attilio@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id A67141C3;
     Sat,  2 Mar 2013 15:33:54 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22FXst6038238;
     Sat, 2 Mar 2013 15:33:54 GMT (envelope-from attilio@svn.freebsd.org)
    Received: (from attilio@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22FXsqR038237;
     Sat, 2 Mar 2013 15:33:54 GMT (envelope-from attilio@svn.freebsd.org)
    Message-Id: <201303021533.r22FXsqR038237@svn.freebsd.org>
    From: Attilio Rao 
    Date: Sat, 2 Mar 2013 15:33:54 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247631 - in head: . share/man/man5 sys/gnu/fs/xfs
     sys/modules/xfs
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 15:33:54 -0000
    
    Author: attilio
    Date: Sat Mar  2 15:33:54 2013
    New Revision: 247631
    URL: http://svnweb.freebsd.org/changeset/base/247631
    
    Log:
      Garbage collect XFS bits which are now already completely disconnected
      from the tree since few months.
      
      This is not targeted for MFC.
    
    Deleted:
      head/share/man/man5/xfs.5
      head/sys/gnu/fs/xfs/
      head/sys/modules/xfs/
    Modified:
      head/ObsoleteFiles.inc
    
    Modified: head/ObsoleteFiles.inc
    ==============================================================================
    --- head/ObsoleteFiles.inc	Sat Mar  2 15:33:06 2013	(r247630)
    +++ head/ObsoleteFiles.inc	Sat Mar  2 15:33:54 2013	(r247631)
    @@ -38,6 +38,8 @@
     #   xargs -n1 | sort | uniq -d;
     # done
     
    +# 20130302: XFS support removed
    +OLD_FILES+=usr/share/man/man5/xfs.5.gz
     # 20130116: removed long unused directories for .1aout section manpages
     OLD_FILES+=usr/share/man/en.ISO8859-1/man1aout
     OLD_FILES+=usr/share/man/en.UTF-8/man1aout
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 15:54:03 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 54803955;
     Sat,  2 Mar 2013 15:54:03 +0000 (UTC)
     (envelope-from marius@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 01F5329C;
     Sat,  2 Mar 2013 15:54:03 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22Fs2Zv044157;
     Sat, 2 Mar 2013 15:54:02 GMT (envelope-from marius@svn.freebsd.org)
    Received: (from marius@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22Fs2Lj044156;
     Sat, 2 Mar 2013 15:54:02 GMT (envelope-from marius@svn.freebsd.org)
    Message-Id: <201303021554.r22Fs2Lj044156@svn.freebsd.org>
    From: Marius Strobl 
    Date: Sat, 2 Mar 2013 15:54:02 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247632 - head/sys/dev/pci
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 15:54:03 -0000
    
    Author: marius
    Date: Sat Mar  2 15:54:02 2013
    New Revision: 247632
    URL: http://svnweb.freebsd.org/changeset/base/247632
    
    Log:
      - Complete r231621 by also blacklisting the bridge used by VMware for PCIe
        devices. While at it, update the comment now that we know that MSI-X
        doesn't work with ESXi 5.1 for Intel 82576 either and the underlying issue
        is a bug in the MSI-X allocation code of the hypervisor.
        Reported by: Harald Schmalzbauer
      - Make the nomatch table const.
      
      MFC after:	1 week
    
    Modified:
      head/sys/dev/pci/pci.c
    
    Modified: head/sys/dev/pci/pci.c
    ==============================================================================
    --- head/sys/dev/pci/pci.c	Sat Mar  2 15:33:54 2013	(r247631)
    +++ head/sys/dev/pci/pci.c	Sat Mar  2 15:54:02 2013	(r247632)
    @@ -234,10 +234,11 @@ static const struct pci_quirk pci_quirks
     	{ 0x74501022, PCI_QUIRK_DISABLE_MSI,	0,	0 },
     
     	/*
    -	 * MSI-X doesn't work with at least LSI SAS1068E passed through by
    -	 * VMware.
    +	 * MSI-X allocation doesn't work properly for devices passed through
    +	 * by VMware up to at least ESXi 5.1.
     	 */
    -	{ 0x079015ad, PCI_QUIRK_DISABLE_MSI,	0,	0 },
    +	{ 0x079015ad, PCI_QUIRK_DISABLE_MSI,	0,	0 }, /* PCI/PCI-X */
    +	{ 0x07a015ad, PCI_QUIRK_DISABLE_MSI,	0,	0 }, /* PCIe */
     
     	/*
     	 * Some virtualization environments emulate an older chipset
    @@ -3643,11 +3644,11 @@ pci_print_child(device_t dev, device_t c
     	return (retval);
     }
     
    -static struct
    +static const struct
     {
    -	int	class;
    -	int	subclass;
    -	char	*desc;
    +	int		class;
    +	int		subclass;
    +	const char	*desc;
     } pci_nomatch_tab[] = {
     	{PCIC_OLD,		-1,			"old"},
     	{PCIC_OLD,		PCIS_OLD_NONVGA,	"non-VGA display device"},
    @@ -3739,8 +3740,9 @@ static struct
     void
     pci_probe_nomatch(device_t dev, device_t child)
     {
    -	int	i;
    -	char	*cp, *scp, *device;
    +	int i;
    +	const char *cp, *scp;
    +	char *device;
     
     	/*
     	 * Look for a listing for this device in a loaded device database.
    @@ -3773,7 +3775,6 @@ pci_probe_nomatch(device_t dev, device_t
     	printf(" at device %d.%d (no driver attached)\n",
     	    pci_get_slot(child), pci_get_function(child));
     	pci_cfg_save(child, device_get_ivars(child), 1);
    -	return;
     }
     
     /*
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 16:30:19 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 79157C85;
     Sat,  2 Mar 2013 16:30:19 +0000 (UTC)
     (envelope-from attilio@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 6A17769B;
     Sat,  2 Mar 2013 16:30:19 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22GUJH0054936;
     Sat, 2 Mar 2013 16:30:19 GMT (envelope-from attilio@svn.freebsd.org)
    Received: (from attilio@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22GUJCv054935;
     Sat, 2 Mar 2013 16:30:19 GMT (envelope-from attilio@svn.freebsd.org)
    Message-Id: <201303021630.r22GUJCv054935@svn.freebsd.org>
    From: Attilio Rao 
    Date: Sat, 2 Mar 2013 16:30:19 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247635 - in head: . share/man/man4 sys/fs/coda
     sys/modules/coda sys/modules/coda5
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 16:30:19 -0000
    
    Author: attilio
    Date: Sat Mar  2 16:30:18 2013
    New Revision: 247635
    URL: http://svnweb.freebsd.org/changeset/base/247635
    
    Log:
      Garbage collect CODAFS bits which are now completely disconnected from
      the tree since few months.
      
      This patch is not targeted for MFC.
    
    Deleted:
      head/share/man/man4/coda.4
      head/sys/fs/coda/
      head/sys/modules/coda/
      head/sys/modules/coda5/
    Modified:
      head/ObsoleteFiles.inc
    
    Modified: head/ObsoleteFiles.inc
    ==============================================================================
    --- head/ObsoleteFiles.inc	Sat Mar  2 16:18:40 2013	(r247634)
    +++ head/ObsoleteFiles.inc	Sat Mar  2 16:30:18 2013	(r247635)
    @@ -38,6 +38,8 @@
     #   xargs -n1 | sort | uniq -d;
     # done
     
    +# 20130302: CODAFS support removed
    +OLD_FILES+=usr/share/man/man4/coda.4.gz
     # 20130302: XFS support removed
     OLD_FILES+=usr/share/man/man5/xfs.5.gz
     # 20130116: removed long unused directories for .1aout section manpages
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 16:43:28 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id EF78C92C;
     Sat,  2 Mar 2013 16:43:28 +0000 (UTC)
     (envelope-from attilio@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id E158F725;
     Sat,  2 Mar 2013 16:43:28 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22GhSir060395;
     Sat, 2 Mar 2013 16:43:28 GMT (envelope-from attilio@svn.freebsd.org)
    Received: (from attilio@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22GhStG060394;
     Sat, 2 Mar 2013 16:43:28 GMT (envelope-from attilio@svn.freebsd.org)
    Message-Id: <201303021643.r22GhStG060394@svn.freebsd.org>
    From: Attilio Rao 
    Date: Sat, 2 Mar 2013 16:43:28 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247640 - in head: . share/examples/portal
     sys/fs/portalfs sys/modules/portalfs usr.sbin/mount_portalfs
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 16:43:29 -0000
    
    Author: attilio
    Date: Sat Mar  2 16:43:28 2013
    New Revision: 247640
    URL: http://svnweb.freebsd.org/changeset/base/247640
    
    Log:
      Garbage collect PORTALFS bits which are now completely disconnected from
      the tree since few months.
      
      This patch is not targeted for MFC.
    
    Deleted:
      head/share/examples/portal/
      head/sys/fs/portalfs/
      head/sys/modules/portalfs/
      head/usr.sbin/mount_portalfs/
    Modified:
      head/ObsoleteFiles.inc
    
    Modified: head/ObsoleteFiles.inc
    ==============================================================================
    --- head/ObsoleteFiles.inc	Sat Mar  2 16:39:00 2013	(r247639)
    +++ head/ObsoleteFiles.inc	Sat Mar  2 16:43:28 2013	(r247640)
    @@ -38,6 +38,13 @@
     #   xargs -n1 | sort | uniq -d;
     # done
     
    +# 20130302: PORTALFS support removed
    +OLD_FILES+=usr/include/fs/portalfs/portal.h
    +OLD_DIRS+=usr/include/fs/portalfs
    +OLD_FILES+=usr/share/examples/portal/README
    +OLD_FILES+=usr/share/examples/portal/portal.conf
    +OLD_DIRS+=usr/share/examples/portal
    +OLD_FILES+=usr/share/man/man8/mount_portalfs.8.gz
     # 20130302: CODAFS support removed
     OLD_FILES+=usr/share/man/man4/coda.4.gz
     # 20130302: XFS support removed
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 18:07:30 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 39F54E94;
     Sat,  2 Mar 2013 18:07:30 +0000 (UTC) (envelope-from alc@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 21ACAA95;
     Sat,  2 Mar 2013 18:07:30 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22I7UsE087067;
     Sat, 2 Mar 2013 18:07:30 GMT (envelope-from alc@svn.freebsd.org)
    Received: (from alc@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22I7UKl087066;
     Sat, 2 Mar 2013 18:07:30 GMT (envelope-from alc@svn.freebsd.org)
    Message-Id: <201303021807.r22I7UKl087066@svn.freebsd.org>
    From: Alan Cox 
    Date: Sat, 2 Mar 2013 18:07:29 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247659 - head/sys/vm
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 18:07:30 -0000
    
    Author: alc
    Date: Sat Mar  2 18:07:29 2013
    New Revision: 247659
    URL: http://svnweb.freebsd.org/changeset/base/247659
    
    Log:
      The value held by the vm object's field pg_color is only considered
      valid if the flag OBJ_COLORED is set.  Since _vm_object_allocate()
      doesn't set this flag, it needn't initialize pg_color.
      
      Sponsored by:	EMC / Isilon Storage Division
    
    Modified:
      head/sys/vm/vm_object.c
    
    Modified: head/sys/vm/vm_object.c
    ==============================================================================
    --- head/sys/vm/vm_object.c	Sat Mar  2 17:51:22 2013	(r247658)
    +++ head/sys/vm/vm_object.c	Sat Mar  2 18:07:29 2013	(r247659)
    @@ -241,7 +241,6 @@ _vm_object_allocate(objtype_t type, vm_p
     	object->memattr = VM_MEMATTR_DEFAULT;
     	object->cred = NULL;
     	object->charge = 0;
    -	object->pg_color = 0;
     	object->handle = NULL;
     	object->backing_object = NULL;
     	object->backing_object_offset = (vm_ooffset_t) 0;
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 18:08:04 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 041021A3;
     Sat,  2 Mar 2013 18:08:04 +0000 (UTC)
     (envelope-from schweikh@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id E0E75A9E;
     Sat,  2 Mar 2013 18:08:03 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22I83GX087253;
     Sat, 2 Mar 2013 18:08:03 GMT (envelope-from schweikh@svn.freebsd.org)
    Received: (from schweikh@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22I831R087252;
     Sat, 2 Mar 2013 18:08:03 GMT (envelope-from schweikh@svn.freebsd.org)
    Message-Id: <201303021808.r22I831R087252@svn.freebsd.org>
    From: Jens Schweikhardt 
    Date: Sat, 2 Mar 2013 18:08:03 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247660 - head/etc
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 18:08:04 -0000
    
    Author: schweikh
    Date: Sat Mar  2 18:08:03 2013
    New Revision: 247660
    URL: http://svnweb.freebsd.org/changeset/base/247660
    
    Log:
      Comment cosmetics: capitalize SCSI
      Fix some hard tabs in the wrong place.
      
      MFC after:	2 weeks
    
    Modified:
      head/etc/devd.conf
    
    Modified: head/etc/devd.conf
    ==============================================================================
    --- head/etc/devd.conf	Sat Mar  2 18:07:29 2013	(r247659)
    +++ head/etc/devd.conf	Sat Mar  2 18:08:03 2013	(r247660)
    @@ -34,7 +34,7 @@ options {
     # NB: DETACH events are ignored; the kernel should handle all cleanup
     #     (routes, arp cache).  Beware of races against immediate create
     #     of a device with the same name; e.g.
    -#	ifconfig bridge0 destroy; ifconfig bridge0 create
    +#     ifconfig bridge0 destroy; ifconfig bridge0 create
     #
     notify 0 {
     	match "system"		"IFNET";
    @@ -165,7 +165,7 @@ notify 100 {
     };
     
     #
    -# Rescan scsi device-names on attach, but not detach.  However, it is
    +# Rescan SCSI device-names on attach, but not detach.  However, it is
     # disabled by default due to reports of problems.
     #
     attach 0 {
    @@ -305,13 +305,13 @@ detach 10 {
     # events.  See the ACPI specification for more information about
     # notifies.  Here is the information returned for each subsystem:
     #
    -# ACAD:		AC line state (0 is offline, 1 is online)
    -# Button:	Button pressed (0 for power, 1 for sleep)
    -# CMBAT:	ACPI battery events
    -# Lid:		Lid state (0 is closed, 1 is open)
    -# RCTL:		Resource limits
    +# ACAD:            AC line state (0 is offline, 1 is online)
    +# Button:          Button pressed (0 for power, 1 for sleep)
    +# CMBAT:           ACPI battery events
    +# Lid:             Lid state (0 is closed, 1 is open)
    +# RCTL:            Resource limits
     # Suspend, Resume: Suspend and resume notification
    -# Thermal:	ACPI thermal zone events
    +# Thermal:         ACPI thermal zone events
     #
     # This example calls a script when the AC state changes, passing the
     # notify value as the first argument.  If the state is 0x00, it might
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 18:24:00 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 6449079B;
     Sat,  2 Mar 2013 18:24:00 +0000 (UTC)
     (envelope-from attilio@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 55C35B56;
     Sat,  2 Mar 2013 18:24:00 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22IO0BO092741;
     Sat, 2 Mar 2013 18:24:00 GMT (envelope-from attilio@svn.freebsd.org)
    Received: (from attilio@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22IO07F092740;
     Sat, 2 Mar 2013 18:24:00 GMT (envelope-from attilio@svn.freebsd.org)
    Message-Id: <201303021824.r22IO07F092740@svn.freebsd.org>
    From: Attilio Rao 
    Date: Sat, 2 Mar 2013 18:24:00 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247662 - head/sys/geom/label
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 18:24:00 -0000
    
    Author: attilio
    Date: Sat Mar  2 18:23:59 2013
    New Revision: 247662
    URL: http://svnweb.freebsd.org/changeset/base/247662
    
    Log:
      Remove ntfs headers dependency for g_label_ntfs.c by redefining the
      used structs and values.
      
      This patch is not targeted for MFC.
    
    Modified:
      head/sys/geom/label/g_label_ntfs.c
    
    Modified: head/sys/geom/label/g_label_ntfs.c
    ==============================================================================
    --- head/sys/geom/label/g_label_ntfs.c	Sat Mar  2 18:18:30 2013	(r247661)
    +++ head/sys/geom/label/g_label_ntfs.c	Sat Mar  2 18:23:59 2013	(r247662)
    @@ -32,21 +32,72 @@ __FBSDID("$FreeBSD$");
     #include 
     #include 
     
    -#include 
    -
     #include 
     #include 
     
    +#define	NTFS_A_VOLUMENAME	0x60
    +#define	NTFS_FILEMAGIC		((uint32_t)(0x454C4946))
    +#define	NTFS_VOLUMEINO		3
    +
     #define G_LABEL_NTFS_DIR	"ntfs"
     
    +struct ntfs_attr {
    +	uint32_t	a_type;
    +	uint32_t	reclen;
    +	uint8_t		a_flag;
    +	uint8_t		a_namelen;
    +	uint8_t		a_nameoff;
    +	uint8_t		reserved1;
    +	uint8_t		a_compression;
    +	uint8_t		reserved2;
    +	uint16_t	a_index;
    +	uint16_t	a_datalen;
    +	uint16_t	reserved3;
    +	uint16_t	a_dataoff;
    +	uint16_t	a_indexed;
    +};
    +
    +struct ntfs_filerec {
    +	uint32_t	fr_hdrmagic;
    +	uint16_t	fr_hdrfoff;
    +	uint16_t	fr_hdrfnum;
    +	uint8_t		reserved[8];
    +	uint16_t	fr_seqnum;
    +	uint16_t	fr_nlink;
    +	uint16_t	fr_attroff;
    +	uint16_t	fr_flags;
    +	uint32_t	fr_size;
    +	uint32_t	fr_allocated;
    +	uint64_t	fr_mainrec;
    +	uint16_t	fr_attrnum;
    +};
    +
    +struct ntfs_bootfile {
    +	uint8_t		reserved1[3];
    +	uint8_t		bf_sysid[8];
    +	uint16_t	bf_bps;
    +	uint8_t		bf_spc;
    +	uint8_t		reserved2[7];
    +	uint8_t		bf_media;
    +	uint8_t		reserved3[2];
    +	uint16_t	bf_spt;
    +	uint16_t	bf_heads;
    +	uint8_t		reserver4[12];
    +	uint64_t	bf_spv;
    +	uint64_t	bf_mftcn;
    +	uint64_t	bf_mftmirrcn;
    +	uint8_t		bf_mftrecsz;
    +	uint32_t	bf_ibsz;
    +	uint32_t	bf_volsn;
    +};
     
     static void
     g_label_ntfs_taste(struct g_consumer *cp, char *label, size_t size)
     {
     	struct g_provider *pp;
    -	struct bootfile *bf;
    -	struct filerec *fr;
    -	struct attr *atr;
    +	struct ntfs_bootfile *bf;
    +	struct ntfs_filerec *fr;
    +	struct ntfs_attr *atr;
     	off_t voloff;
     	char *filerecp, *ap;
     	char mftrecsz, vnchar;
    @@ -58,7 +109,7 @@ g_label_ntfs_taste(struct g_consumer *cp
     	pp = cp->provider;
     	filerecp = NULL;
     
    -	bf = (struct bootfile *)g_read_data(cp, 0, pp->sectorsize, NULL);
    +	bf = (struct ntfs_bootfile *)g_read_data(cp, 0, pp->sectorsize, NULL);
     	if (bf == NULL || strncmp(bf->bf_sysid, "NTFS    ", 8) != 0)
     		goto done;
     
    @@ -75,16 +126,16 @@ g_label_ntfs_taste(struct g_consumer *cp
     	filerecp = g_read_data(cp, voloff, recsize, NULL);
     	if (filerecp == NULL)
     		goto done;
    -	fr = (struct filerec *)filerecp;
    +	fr = (struct ntfs_filerec *)filerecp;
     
    -	if (fr->fr_fixup.fh_magic != NTFS_FILEMAGIC)
    +	if (fr->fr_hdrmagic != NTFS_FILEMAGIC)
     		goto done;
     
     	for (ap = filerecp + fr->fr_attroff;
    -	    atr = (struct attr *)ap, atr->a_hdr.a_type != -1;
    -	    ap += atr->a_hdr.reclen) {
    -		if (atr->a_hdr.a_type == NTFS_A_VOLUMENAME) {
    -			if(atr->a_r.a_datalen >= size *2){
    +	    atr = (struct ntfs_attr *)ap, atr->a_type != -1;
    +	    ap += atr->reclen) {
    +		if (atr->a_type == NTFS_A_VOLUMENAME) {
    +			if(atr->a_datalen >= size *2){
     				label[0] = 0;
     				goto done;
     			}
    @@ -92,8 +143,8 @@ g_label_ntfs_taste(struct g_consumer *cp
     			 *UNICODE to ASCII.
     			 * Should we need to use iconv(9)?
     			 */
    -			for (j = 0; j < atr->a_r.a_datalen; j++) {
    -				vnchar = *(ap + atr->a_r.a_dataoff + j);
    +			for (j = 0; j < atr->a_datalen; j++) {
    +				vnchar = *(ap + atr->a_dataoff + j);
     				if (j & 1) {
     					if (vnchar) {
     						label[0] = 0;
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 18:40:04 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id A97752CA;
     Sat,  2 Mar 2013 18:40:04 +0000 (UTC)
     (envelope-from attilio@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 9B39CD12;
     Sat,  2 Mar 2013 18:40:04 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22Ie4c5096795;
     Sat, 2 Mar 2013 18:40:04 GMT (envelope-from attilio@svn.freebsd.org)
    Received: (from attilio@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22Ie4ro096794;
     Sat, 2 Mar 2013 18:40:04 GMT (envelope-from attilio@svn.freebsd.org)
    Message-Id: <201303021840.r22Ie4ro096794@svn.freebsd.org>
    From: Attilio Rao 
    Date: Sat, 2 Mar 2013 18:40:04 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247665 - in head: . lib/libprocstat sbin/mount_ntfs
     sys/fs/ntfs sys/modules/ntfs sys/modules/ntfs_iconv
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 18:40:04 -0000
    
    Author: attilio
    Date: Sat Mar  2 18:40:04 2013
    New Revision: 247665
    URL: http://svnweb.freebsd.org/changeset/base/247665
    
    Log:
      Garbage collect NTFS bits which are now completely disconnected from
      the tree since few months.
      
      This patch is not targeted for MFC.
    
    Deleted:
      head/lib/libprocstat/ntfs.c
      head/sbin/mount_ntfs/
      head/sys/fs/ntfs/
      head/sys/modules/ntfs/
      head/sys/modules/ntfs_iconv/
    Modified:
      head/ObsoleteFiles.inc
    
    Modified: head/ObsoleteFiles.inc
    ==============================================================================
    --- head/ObsoleteFiles.inc	Sat Mar  2 18:38:29 2013	(r247664)
    +++ head/ObsoleteFiles.inc	Sat Mar  2 18:40:04 2013	(r247665)
    @@ -38,6 +38,16 @@
     #   xargs -n1 | sort | uniq -d;
     # done
     
    +# 20130302: NTFS support removed
    +OLD_FILES+=usr/include/fs/ntfs/ntfs.h
    +OLD_FILES+=usr/include/fs/ntfs/ntfs_compr.h
    +OLD_FILES+=usr/include/fs/ntfs/ntfs_ihash.h
    +OLD_FILES+=usr/include/fs/ntfs/ntfs_inode.h
    +OLD_FILES+=usr/include/fs/ntfs/ntfs_subr.h
    +OLD_FILES+=usr/include/fs/ntfs/ntfs_vfsops.h
    +OLD_FILES+=usr/include/fs/ntfs/ntfsmount.h
    +OLD_DIRS+=usr/include/fs/ntfs
    +OLD_FILES+=usr/share/man/man8/mount_ntfs.8.gz
     # 20130302: PORTALFS support removed
     OLD_FILES+=usr/include/fs/portalfs/portal.h
     OLD_DIRS+=usr/include/fs/portalfs
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 18:51:27 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 1FDAA987;
     Sat,  2 Mar 2013 18:51:27 +0000 (UTC)
     (envelope-from melifaro@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 0307DDB6;
     Sat,  2 Mar 2013 18:51:27 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22IpQgs001548;
     Sat, 2 Mar 2013 18:51:26 GMT (envelope-from melifaro@svn.freebsd.org)
    Received: (from melifaro@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22IpQK4001547;
     Sat, 2 Mar 2013 18:51:26 GMT (envelope-from melifaro@svn.freebsd.org)
    Message-Id: <201303021851.r22IpQK4001547@svn.freebsd.org>
    From: "Alexander V. Chernikov" 
    Date: Sat, 2 Mar 2013 18:51:26 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247666 - head/sbin/ipfw
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 18:51:27 -0000
    
    Author: melifaro
    Date: Sat Mar  2 18:51:26 2013
    New Revision: 247666
    URL: http://svnweb.freebsd.org/changeset/base/247666
    
    Log:
      Fix ipfw table argument parsing/printing.
      Fix style.
      
      PR:		kern/175909
      Submitted by:	Daniel Hagerty 
      MFC after:	2 weeks
    
    Modified:
      head/sbin/ipfw/ipfw2.c
    
    Modified: head/sbin/ipfw/ipfw2.c
    ==============================================================================
    --- head/sbin/ipfw/ipfw2.c	Sat Mar  2 18:40:04 2013	(r247665)
    +++ head/sbin/ipfw/ipfw2.c	Sat Mar  2 18:51:26 2013	(r247666)
    @@ -3912,6 +3912,7 @@ ipfw_flush(int force)
     
     
     static void table_list(uint16_t num, int need_header);
    +static void table_fill_xentry(char *arg, ipfw_table_xentry *xent);
     
     /*
      * This one handles all table-related commands
    @@ -3927,8 +3928,7 @@ ipfw_table_handler(int ac, char *av[])
     	int do_add;
     	int is_all;
     	size_t len;
    -	char *p;
    -	uint32_t a, type, mask, addrlen;
    +	uint32_t a, mask;
     	uint32_t tables_max;
     
     	mask = 0;	// XXX uninitialized ?
    @@ -3965,57 +3965,8 @@ ipfw_table_handler(int ac, char *av[])
     		ac--; av++;
     		if (!ac)
     			errx(EX_USAGE, "address required");
    -		/* 
    -		 * Let's try to guess type by agrument.
    -		 * Possible types: 
    -		 * 1) IPv4[/mask]
    -		 * 2) IPv6[/mask]
    -		 * 3) interface name
    -		 * 4) port ?
    -		 */
    -		type = 0;
    -		if (ishexnumber(*av[0])) {
    -			/* Remove / if exists */
    -			if ((p = strchr(*av, '/')) != NULL) {
    -				*p = '\0';
    -				mask = atoi(p + 1);
    -			}
    -
    -			if (inet_pton(AF_INET, *av, &xent.k.addr6) == 1) {
    -				type = IPFW_TABLE_CIDR;
    -				if ((p != NULL) && (mask > 32))
    -					errx(EX_DATAERR, "bad IPv4 mask width: %s", p + 1);
    -				xent.masklen = p ? mask : 32;
    -				addrlen = sizeof(struct in_addr);
    -			} else if (inet_pton(AF_INET6, *av, &xent.k.addr6) == 1) {
    -				type = IPFW_TABLE_CIDR;
    -				if ((p != NULL) && (mask > 128))
    -					errx(EX_DATAERR, "bad IPv6 mask width: %s", p + 1);
    -				xent.masklen = p ? mask : 128;
    -				addrlen = sizeof(struct in6_addr);
    -			}
    -		}
    -
    -		if ((type == 0) && (strchr(*av, '.') == NULL)) {
    -			/* Assume interface name. Copy significant data only */
    -			mask = MIN(strlen(*av), IF_NAMESIZE - 1);
    -			memcpy(xent.k.iface, *av, mask);
    -			/* Set mask to exact match */
    -			xent.masklen = 8 * IF_NAMESIZE;
    -			type = IPFW_TABLE_INTERFACE;
    -			addrlen = IF_NAMESIZE;
    -		}
     
    -		if (type == 0) {
    -			if (lookup_host(*av, (struct in_addr *)&xent.k.addr6) != 0)
    -				errx(EX_NOHOST, "hostname ``%s'' unknown", *av);
    -			xent.masklen = 32;
    -			type = IPFW_TABLE_CIDR;
    -			addrlen = sizeof(struct in_addr);
    -		}
    -
    -		xent.type = type;
    -		xent.len = offsetof(ipfw_table_xentry, k) + addrlen;
    +		table_fill_xentry(*av, &xent);
     
     		ac--; av++;
     		if (do_add && ac) {
    @@ -4065,6 +4016,93 @@ ipfw_table_handler(int ac, char *av[])
     }
     
     static void
    +table_fill_xentry(char *arg, ipfw_table_xentry *xent)
    +{
    +	int addrlen, mask, masklen, type;
    +	struct in6_addr *paddr;
    +	uint32_t *pkey;
    +	char *p;
    +	uint32_t key;
    +
    +	mask = 0;
    +	type = 0;
    +	addrlen = 0;
    +	masklen = 0;
    +
    +	/* 
    +	 * Let's try to guess type by agrument.
    +	 * Possible types: 
    +	 * 1) IPv4[/mask]
    +	 * 2) IPv6[/mask]
    +	 * 3) interface name
    +	 * 4) port, uid/gid or other u32 key (base 10 format)
    +	 * 5) hostname
    +	 */
    +	paddr = &xent->k.addr6;
    +	if (ishexnumber(*arg) != 0 || *arg == ':') {
    +		/* Remove / if exists */
    +		if ((p = strchr(arg, '/')) != NULL) {
    +			*p = '\0';
    +			mask = atoi(p + 1);
    +		}
    +
    +		if (inet_pton(AF_INET, arg, paddr) == 1) {
    +			if (p != NULL && mask > 32)
    +				errx(EX_DATAERR, "bad IPv4 mask width: %s",
    +				    p + 1);
    +
    +			type = IPFW_TABLE_CIDR;
    +			masklen = p ? mask : 32;
    +			addrlen = sizeof(struct in_addr);
    +		} else if (inet_pton(AF_INET6, arg, paddr) == 1) {
    +			if (IN6_IS_ADDR_V4COMPAT(paddr))
    +				errx(EX_DATAERR,
    +				    "Use IPv4 instead of v4-compatible");
    +			if (p != NULL && mask > 128)
    +				errx(EX_DATAERR, "bad IPv6 mask width: %s",
    +				    p + 1);
    +
    +			type = IPFW_TABLE_CIDR;
    +			masklen = p ? mask : 128;
    +			addrlen = sizeof(struct in6_addr);
    +		} else {
    +			/* Port or any other key */
    +			key = strtol(arg, &p, 10);
    +			/* Skip non-base 10 entries like 'fa1' */
    +			if (p != arg) {
    +				pkey = (uint32_t *)paddr;
    +				*pkey = htonl(key);
    +				type = IPFW_TABLE_CIDR;
    +				addrlen = sizeof(uint32_t);
    +			}
    +		}
    +	}
    +
    +	if (type == 0 && strchr(arg, '.') == NULL) {
    +		/* Assume interface name. Copy significant data only */
    +		mask = MIN(strlen(arg), IF_NAMESIZE - 1);
    +		memcpy(xent->k.iface, arg, mask);
    +		/* Set mask to exact match */
    +		masklen = 8 * IF_NAMESIZE;
    +		type = IPFW_TABLE_INTERFACE;
    +		addrlen = IF_NAMESIZE;
    +	}
    +
    +	if (type == 0) {
    +		if (lookup_host(arg, (struct in_addr *)paddr) != 0)
    +			errx(EX_NOHOST, "hostname ``%s'' unknown", arg);
    +
    +		masklen = 32;
    +		type = IPFW_TABLE_CIDR;
    +		addrlen = sizeof(struct in_addr);
    +	}
    +
    +	xent->type = type;
    +	xent->masklen = masklen;
    +	xent->len = offsetof(ipfw_table_xentry, k) + addrlen;
    +}
    +
    +static void
     table_list(uint16_t num, int need_header)
     {
     	ipfw_xtable *tbl;
    @@ -4107,8 +4145,8 @@ table_list(uint16_t num, int need_header
     			tval = xent->value;
     			addr6 = &xent->k.addr6;
     
    -			if ((addr6->s6_addr32[0] == 0) && (addr6->s6_addr32[1] == 0) && 
    -			    (addr6->s6_addr32[2] == 0)) {
    +
    +			if (IN6_IS_ADDR_V4COMPAT(addr6)) {
     				/* IPv4 address */
     				inet_ntop(AF_INET, &addr6->s6_addr32[3], tbuf, sizeof(tbuf));
     			} else {
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 21:11:35 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 9A72B8BF;
     Sat,  2 Mar 2013 21:11:35 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 6DCE1273;
     Sat,  2 Mar 2013 21:11:35 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22LBZix045616;
     Sat, 2 Mar 2013 21:11:35 GMT (envelope-from pjd@svn.freebsd.org)
    Received: (from pjd@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22LBVEd045583;
     Sat, 2 Mar 2013 21:11:31 GMT (envelope-from pjd@svn.freebsd.org)
    Message-Id: <201303022111.r22LBVEd045583@svn.freebsd.org>
    From: Pawel Jakub Dawidek 
    Date: Sat, 2 Mar 2013 21:11:31 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247667 - in head: contrib/openbsm/etc lib/libc/sys
     sys/bsm sys/compat/freebsd32 sys/kern sys/security/audit sys/sys
     usr.bin/procstat
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 21:11:35 -0000
    
    Author: pjd
    Date: Sat Mar  2 21:11:30 2013
    New Revision: 247667
    URL: http://svnweb.freebsd.org/changeset/base/247667
    
    Log:
      - Implement two new system calls:
      
      	int bindat(int fd, int s, const struct sockaddr *addr, socklen_t addrlen);
      	int connectat(int fd, int s, const struct sockaddr *name, socklen_t namelen);
      
        which allow to bind and connect respectively to a UNIX domain socket with a
        path relative to the directory associated with the given file descriptor 'fd'.
      
      - Add manual pages for the new syscalls.
      
      - Make the new syscalls available for processes in capability mode sandbox.
      
      - Add capability rights CAP_BINDAT and CAP_CONNECTAT that has to be present on
        the directory descriptor for the syscalls to work.
      
      - Update audit(4) to support those two new syscalls and to handle path
        in sockaddr_un structure relative to the given directory descriptor.
      
      - Update procstat(1) to recognize the new capability rights.
      
      - Document the new capability rights in cap_rights_limit(2).
      
      Sponsored by:	The FreeBSD Foundation
      Discussed with:	rwatson, jilles, kib, des
    
    Added:
      head/lib/libc/sys/bindat.2   (contents, props changed)
      head/lib/libc/sys/connectat.2   (contents, props changed)
    Modified:
      head/contrib/openbsm/etc/audit_event
      head/lib/libc/sys/Makefile.inc
      head/lib/libc/sys/Symbol.map
      head/lib/libc/sys/cap_rights_limit.2
      head/sys/bsm/audit_kevents.h
      head/sys/compat/freebsd32/syscalls.master
      head/sys/kern/capabilities.conf
      head/sys/kern/syscalls.master
      head/sys/kern/uipc_domain.c
      head/sys/kern/uipc_socket.c
      head/sys/kern/uipc_syscalls.c
      head/sys/kern/uipc_usrreq.c
      head/sys/security/audit/audit.h
      head/sys/security/audit/audit_arg.c
      head/sys/security/audit/audit_bsm.c
      head/sys/sys/capability.h
      head/sys/sys/protosw.h
      head/sys/sys/socket.h
      head/sys/sys/socketvar.h
      head/usr.bin/procstat/procstat_files.c
    
    Modified: head/contrib/openbsm/etc/audit_event
    ==============================================================================
    --- head/contrib/openbsm/etc/audit_event	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/contrib/openbsm/etc/audit_event	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -568,6 +568,8 @@
     43204:AUE_CAP_IOCTLS_GET:cap_ioctls_get(2):fm
     43205:AUE_CAP_FCNTLS_LIMIT:cap_fcntls_limit(2):fm
     43206:AUE_CAP_FCNTLS_GET:cap_fcntls_get(2):fm
    +43207:AUE_BINDAT:bindat(2):nt
    +43208:AUE_CONNECTAT:connectat(2):nt
     #
     # Solaris userspace events.
     #
    
    Modified: head/lib/libc/sys/Makefile.inc
    ==============================================================================
    --- head/lib/libc/sys/Makefile.inc	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/lib/libc/sys/Makefile.inc	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -91,6 +91,7 @@ MAN+=	abort2.2 \
     	aio_waitcomplete.2 \
     	aio_write.2 \
     	bind.2 \
    +	bindat.2 \
     	brk.2 \
     	cap_enter.2 \
     	cap_fcntls_limit.2 \
    @@ -105,6 +106,7 @@ MAN+=	abort2.2 \
     	close.2 \
     	closefrom.2 \
     	connect.2 \
    +	connectat.2 \
     	cpuset.2 \
     	cpuset_getaffinity.2 \
     	dup.2 \
    
    Modified: head/lib/libc/sys/Symbol.map
    ==============================================================================
    --- head/lib/libc/sys/Symbol.map	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/lib/libc/sys/Symbol.map	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -378,6 +378,7 @@ FBSD_1.2 {
     };
     
     FBSD_1.3 {
    +	bindat;
     	cap_fcntls_get;
     	cap_fcntls_limit;
     	cap_ioctls_get;
    @@ -386,6 +387,7 @@ FBSD_1.3 {
     	cap_rights_limit;
     	cap_sandboxed;
     	clock_getcpuclockid2;
    +	connectat;
     	ffclock_getcounter;
     	ffclock_getestimate;
     	ffclock_setestimate;
    
    Added: head/lib/libc/sys/bindat.2
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/lib/libc/sys/bindat.2	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -0,0 +1,109 @@
    +.\" Copyright (c) 2013 The FreeBSD Foundation
    +.\" All rights reserved.
    +.\"
    +.\" This documentation was written by Pawel Jakub Dawidek under sponsorship from
    +.\" the FreeBSD Foundation.
    +.\"
    +.\" Redistribution and use in source and binary forms, with or without
    +.\" modification, are permitted provided that the following conditions
    +.\" are met:
    +.\" 1. Redistributions of source code must retain the above copyright
    +.\"    notice, this list of conditions and the following disclaimer.
    +.\" 2. 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 AUTHORS 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 AUTHORS 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 February 13, 2013
    +.Dt BINDAT 2
    +.Os
    +.Sh NAME
    +.Nm bindat
    +.Nd assign a local protocol address to a socket
    +.Sh LIBRARY
    +.Lb libc
    +.Sh SYNOPSIS
    +.In sys/types.h
    +.In sys/socket.h
    +.Pp
    +.In fcntl.h
    +.Ft int
    +.Fn bindat "int fd" "int s" "const struct sockaddr *addr" "socklen_t addrlen"
    +.Sh DESCRIPTION
    +The
    +.Fn bindat
    +system call assigns the local protocol address to a socket.
    +It works just like the
    +.Xr bind 2
    +system call with two exceptions:
    +.Pp
    +.Bl -enum -offset indent -compact
    +.It
    +It is limited to sockets in the PF_LOCAL domain.
    +.Pp
    +.It
    +If the file path stored in the
    +.Fa sun_path
    +field of the sockaddr_un structure is a relative path, it is located relative
    +to the directory associated with the file descriptor
    +.Fa fd .
    +If
    +.Fn bindat
    +is passed the special value
    +.Dv AT_FDCWD
    +in the
    +.Fa fd
    +parameter, the current working directory is used and the behavior is identical
    +to a call to
    +.Xr bind 2 .
    +.El
    +.Sh RETURN VALUES
    +.Rv -std bindat
    +.Sh ERRORS
    +The
    +.Fn bindat
    +system call may fail with the same errors as the
    +.Xr bind 2
    +system call for a UNIX domain socket or with the following errors:
    +.Bl -tag -width Er
    +.It Bq Er EBADF
    +The
    +.Fa sun_path
    +field does not specify an absolute path and the
    +.Fa fd
    +argument is neither
    +.Dv AT_FDCWD
    +nor a valid file descriptor.
    +.It Bq Er ENOTDIR
    +The
    +.Fa sun_path
    +field is not an absolute path and
    +.Fa fd
    +is neither
    +.Dv AT_FDCWD
    +nor a file descriptor associated with a directory.
    +.El
    +.Sh SEE ALSO
    +.Xr bind 2 ,
    +.Xr connectat 2 ,
    +.Xr socket 2 ,
    +.Xr unix 4
    +.Sh AUTHORS
    +The
    +.Nm
    +was developed by
    +.An Pawel Jakub Dawidek Aq pawel@dawidek.net
    +under sponsorship from the FreeBSD Foundation.
    
    Modified: head/lib/libc/sys/cap_rights_limit.2
    ==============================================================================
    --- head/lib/libc/sys/cap_rights_limit.2	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/lib/libc/sys/cap_rights_limit.2	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -104,12 +104,20 @@ or
     and that socket options set with
     .Xr setsockopt 2
     may also affect binding behavior.
    +.It Dv CAP_BINDAT
    +Permit
    +.Xr bindat 2 .
    +This right has to be present on the directory descriptor.
     .It Dv CAP_CONNECT
     Permit
     .Xr connect 2 ;
     also required for
     .Xr sendto 2
     with a non-NULL destination address.
    +.It Dv CAP_CONNECTAT
    +Permit
    +.Xr connectat 2 .
    +This right has to be present on the directory descriptor.
     .It Dv CAP_CREATE
     Permit
     .Xr openat 2
    @@ -511,11 +519,13 @@ argument points at an invalid address.
     .Xr aio_read 2 ,
     .Xr aio_write 2 ,
     .Xr bind 2 ,
    +.Xr bindat 2 ,
     .Xr cap_enter 2 ,
     .Xr cap_fcntls_limit 2 ,
     .Xr cap_ioctls_limit 2 ,
     .Xr cap_rights_limit 2 ,
     .Xr connect 2 ,
    +.Xr connectat 2 ,
     .Xr dup 2 ,
     .Xr dup2 2 ,
     .Xr extattr_delete_fd 2 ,
    
    Added: head/lib/libc/sys/connectat.2
    ==============================================================================
    --- /dev/null	00:00:00 1970	(empty, because file is newly added)
    +++ head/lib/libc/sys/connectat.2	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -0,0 +1,109 @@
    +.\" Copyright (c) 2013 The FreeBSD Foundation
    +.\" All rights reserved.
    +.\"
    +.\" This documentation was written by Pawel Jakub Dawidek under sponsorship from
    +.\" the FreeBSD Foundation.
    +.\"
    +.\" Redistribution and use in source and binary forms, with or without
    +.\" modification, are permitted provided that the following conditions
    +.\" are met:
    +.\" 1. Redistributions of source code must retain the above copyright
    +.\"    notice, this list of conditions and the following disclaimer.
    +.\" 2. 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 AUTHORS 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 AUTHORS 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 February 13, 2013
    +.Dt CONNECTAT 2
    +.Os
    +.Sh NAME
    +.Nm connectat
    +.Nd initiate a connection on a socket
    +.Sh LIBRARY
    +.Lb libc
    +.Sh SYNOPSIS
    +.In sys/types.h
    +.In sys/socket.h
    +.Pp
    +.In fcntl.h
    +.Ft int
    +.Fn connectat "int fd" "int s" "const struct sockaddr *name" "socklen_t namelen"
    +.Sh DESCRIPTION
    +The
    +.Fn connectat
    +system call initiates a connection on a socket.
    +It works just like the
    +.Xr connect 2
    +system call with two exceptions:
    +.Pp
    +.Bl -enum -offset indent -compact
    +.It
    +It is limited to sockets in the PF_LOCAL domain.
    +.Pp
    +.It
    +If the file path stored in the
    +.Fa sun_path
    +field of the sockaddr_un structure is a relative path, it is located relative
    +to the directory associated with the file descriptor
    +.Fa fd .
    +If
    +.Fn connectat
    +is passed the special value
    +.Dv AT_FDCWD
    +in the
    +.Fa fd
    +parameter, the current working directory is used and the behavior is identical
    +to a call to
    +.Xr connect 2 .
    +.El
    +.Sh RETURN VALUES
    +.Rv -std connectat
    +.Sh ERRORS
    +The
    +.Fn connectat
    +system call may fail with the same errors as the
    +.Xr connect 2
    +system call for a UNIX domain socket or with the following errors:
    +.Bl -tag -width Er
    +.It Bq Er EBADF
    +The
    +.Fa sun_path
    +field does not specify an absolute path and the
    +.Fa fd
    +argument is neither
    +.Dv AT_FDCWD
    +nor a valid file descriptor.
    +.It Bq Er ENOTDIR
    +The
    +.Fa sun_path
    +field is not an absolute path and
    +.Fa fd
    +is neither
    +.Dv AT_FDCWD
    +nor a file descriptor associated with a directory.
    +.El
    +.Sh SEE ALSO
    +.Xr bindat 2 ,
    +.Xr connect 2 ,
    +.Xr socket 2 ,
    +.Xr unix 4
    +.Sh AUTHORS
    +The
    +.Nm
    +was developed by
    +.An Pawel Jakub Dawidek Aq pawel@dawidek.net
    +under sponsorship from the FreeBSD Foundation.
    
    Modified: head/sys/bsm/audit_kevents.h
    ==============================================================================
    --- head/sys/bsm/audit_kevents.h	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/sys/bsm/audit_kevents.h	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -608,6 +608,8 @@
     #define	AUE_CAP_IOCTLS_GET	43204	/* TrustedBSD. */
     #define	AUE_CAP_FCNTLS_LIMIT	43205	/* TrustedBSD. */
     #define	AUE_CAP_FCNTLS_GET	43206	/* TrustedBSD. */
    +#define	AUE_BINDAT		43207	/* TrustedBSD. */
    +#define	AUE_CONNECTAT		43208	/* TrustedBSD. */
     
     /*
      * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the
    
    Modified: head/sys/compat/freebsd32/syscalls.master
    ==============================================================================
    --- head/sys/compat/freebsd32/syscalls.master	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/sys/compat/freebsd32/syscalls.master	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -1015,3 +1015,7 @@
     				    uint32_t fcntlrights); }
     537	AUE_CAP_FCNTLS_GET	NOPROTO	{ int cap_fcntls_get(int fd, \
     				    uint32_t *fcntlrightsp); }
    +538	AUE_BINDAT	NOPROTO	{ int bindat(int fd, int s, caddr_t name, \
    +				    int namelen); }
    +539	AUE_CONNECTAT	NOPROTO	{ int connectat(int fd, int s, caddr_t name, \
    +				    int namelen); }
    
    Modified: head/sys/kern/capabilities.conf
    ==============================================================================
    --- head/sys/kern/capabilities.conf	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/sys/kern/capabilities.conf	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -100,11 +100,9 @@ aio_write
     #audit
     
     ##
    -## Disllow bind(2) for now, even though we support CAP_BIND.
    +## Allow bindat(2).
     ##
    -## XXXRW: Revisit this.
    -##
    -#bind
    +bindat
     
     ##
     ## Allow capability mode and capability system calls.
    @@ -132,11 +130,9 @@ close
     closefrom
     
     ##
    -## Disallow connect(2) for now, despite CAP_CONNECT.
    -##
    -## XXXRW: Revisit this.
    +## Allow connectat(2).
     ##
    -#connect
    +connectat
     
     ##
     ## cpuset(2) and related calls require scoping by process, but should
    
    Modified: head/sys/kern/syscalls.master
    ==============================================================================
    --- head/sys/kern/syscalls.master	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/sys/kern/syscalls.master	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -965,5 +965,9 @@
     					    uint32_t fcntlrights); }
     537	AUE_CAP_FCNTLS_GET	STD	{ int cap_fcntls_get(int fd, \
     					    uint32_t *fcntlrightsp); }
    +538	AUE_BINDAT	STD	{ int bindat(int fd, int s, caddr_t name, \
    +				    int namelen); }
    +539	AUE_CONNECTAT	STD	{ int connectat(int fd, int s, caddr_t name, \
    +				    int namelen); }
     ; Please copy any additions and changes to the following compatability tables:
     ; sys/compat/freebsd32/syscalls.master
    
    Modified: head/sys/kern/uipc_domain.c
    ==============================================================================
    --- head/sys/kern/uipc_domain.c	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/sys/kern/uipc_domain.c	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -136,8 +136,10 @@ protosw_init(struct protosw *pr)
     #define DEFAULT(foo, bar)	if ((foo) == NULL)  (foo) = (bar)
     	DEFAULT(pu->pru_accept, pru_accept_notsupp);
     	DEFAULT(pu->pru_bind, pru_bind_notsupp);
    +	DEFAULT(pu->pru_bindat, pru_bindat_notsupp);
     	DEFAULT(pu->pru_connect, pru_connect_notsupp);
     	DEFAULT(pu->pru_connect2, pru_connect2_notsupp);
    +	DEFAULT(pu->pru_connectat, pru_connectat_notsupp);
     	DEFAULT(pu->pru_control, pru_control_notsupp);
     	DEFAULT(pu->pru_disconnect, pru_disconnect_notsupp);
     	DEFAULT(pu->pru_listen, pru_listen_notsupp);
    
    Modified: head/sys/kern/uipc_socket.c
    ==============================================================================
    --- head/sys/kern/uipc_socket.c	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/sys/kern/uipc_socket.c	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -615,7 +615,18 @@ sobind(struct socket *so, struct sockadd
     	CURVNET_SET(so->so_vnet);
     	error = (*so->so_proto->pr_usrreqs->pru_bind)(so, nam, td);
     	CURVNET_RESTORE();
    -	return error;
    +	return (error);
    +}
    +
    +int
    +sobindat(int fd, struct socket *so, struct sockaddr *nam, struct thread *td)
    +{
    +	int error;
    +
    +	CURVNET_SET(so->so_vnet);
    +	error = (*so->so_proto->pr_usrreqs->pru_bindat)(fd, so, nam, td);
    +	CURVNET_RESTORE();
    +	return (error);
     }
     
     /*
    @@ -638,7 +649,7 @@ solisten(struct socket *so, int backlog,
     	CURVNET_SET(so->so_vnet);
     	error = (*so->so_proto->pr_usrreqs->pru_listen)(so, backlog, td);
     	CURVNET_RESTORE();
    -	return error;
    +	return (error);
     }
     
     int
    @@ -896,6 +907,13 @@ soaccept(struct socket *so, struct socka
     int
     soconnect(struct socket *so, struct sockaddr *nam, struct thread *td)
     {
    +
    +	return (soconnectat(AT_FDCWD, so, nam, td));
    +}
    +
    +int
    +soconnectat(int fd, struct socket *so, struct sockaddr *nam, struct thread *td)
    +{
     	int error;
     
     	if (so->so_options & SO_ACCEPTCONN)
    @@ -917,7 +935,13 @@ soconnect(struct socket *so, struct sock
     		 * biting us.
     		 */
     		so->so_error = 0;
    -		error = (*so->so_proto->pr_usrreqs->pru_connect)(so, nam, td);
    +		if (fd == AT_FDCWD) {
    +			error = (*so->so_proto->pr_usrreqs->pru_connect)(so,
    +			    nam, td);
    +		} else {
    +			error = (*so->so_proto->pr_usrreqs->pru_connectat)(fd,
    +			    so, nam, td);
    +		}
     	}
     	CURVNET_RESTORE();
     
    @@ -3141,6 +3165,14 @@ pru_bind_notsupp(struct socket *so, stru
     }
     
     int
    +pru_bindat_notsupp(int fd, struct socket *so, struct sockaddr *nam,
    +    struct thread *td)
    +{
    +
    +	return EOPNOTSUPP;
    +}
    +
    +int
     pru_connect_notsupp(struct socket *so, struct sockaddr *nam, struct thread *td)
     {
     
    @@ -3148,6 +3180,14 @@ pru_connect_notsupp(struct socket *so, s
     }
     
     int
    +pru_connectat_notsupp(int fd, struct socket *so, struct sockaddr *nam,
    +    struct thread *td)
    +{
    +
    +	return EOPNOTSUPP;
    +}
    +
    +int
     pru_connect2_notsupp(struct socket *so1, struct socket *so2)
     {
     
    
    Modified: head/sys/kern/uipc_syscalls.c
    ==============================================================================
    --- head/sys/kern/uipc_syscalls.c	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/sys/kern/uipc_syscalls.c	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -201,26 +201,23 @@ sys_bind(td, uap)
     	struct sockaddr *sa;
     	int error;
     
    -	if ((error = getsockaddr(&sa, uap->name, uap->namelen)) != 0)
    -		return (error);
    -
    -	error = kern_bind(td, uap->s, sa);
    -	free(sa, M_SONAME);
    +	error = getsockaddr(&sa, uap->name, uap->namelen);
    +	if (error == 0) {
    +		error = kern_bind(td, uap->s, sa);
    +		free(sa, M_SONAME);
    +	}
     	return (error);
     }
     
    -int
    -kern_bind(td, fd, sa)
    -	struct thread *td;
    -	int fd;
    -	struct sockaddr *sa;
    +static int
    +kern_bindat(struct thread *td, int dirfd, int fd, struct sockaddr *sa)
     {
     	struct socket *so;
     	struct file *fp;
     	int error;
     
     	AUDIT_ARG_FD(fd);
    -	AUDIT_ARG_SOCKADDR(td, sa);
    +	AUDIT_ARG_SOCKADDR(td, dirfd, sa);
     	error = getsock_cap(td->td_proc->p_fd, fd, CAP_BIND, &fp, NULL);
     	if (error)
     		return (error);
    @@ -231,13 +228,48 @@ kern_bind(td, fd, sa)
     #endif
     #ifdef MAC
     	error = mac_socket_check_bind(td->td_ucred, so, sa);
    -	if (error == 0)
    +	if (error == 0) {
    +#endif
    +		if (dirfd == AT_FDCWD)
    +			error = sobind(so, sa, td);
    +		else
    +			error = sobindat(dirfd, so, sa, td);
    +#ifdef MAC
    +	}
     #endif
    -		error = sobind(so, sa, td);
     	fdrop(fp, td);
     	return (error);
     }
     
    +int
    +kern_bind(struct thread *td, int fd, struct sockaddr *sa)
    +{
    +
    +	return (kern_bindat(td, AT_FDCWD, fd, sa));
    +}
    +
    +/* ARGSUSED */
    +int
    +sys_bindat(td, uap)
    +	struct thread *td;
    +	struct bindat_args /* {
    +		int	fd;
    +		int	s;
    +		caddr_t	name;
    +		int	namelen;
    +	} */ *uap;
    +{
    +	struct sockaddr *sa;
    +	int error;
    +
    +	error = getsockaddr(&sa, uap->name, uap->namelen);
    +	if (error == 0) {
    +		error = kern_bindat(td, uap->fd, uap->s, sa);
    +		free(sa, M_SONAME);
    +	}
    +	return (error);
    +}
    +
     /* ARGSUSED */
     int
     sys_listen(td, uap)
    @@ -435,7 +467,7 @@ kern_accept(struct thread *td, int s, st
     			*namelen = 0;
     		goto done;
     	}
    -	AUDIT_ARG_SOCKADDR(td, sa);
    +	AUDIT_ARG_SOCKADDR(td, AT_FDCWD, sa);
     	if (name) {
     		/* check sa_len before it is destroyed */
     		if (*namelen > sa->sa_len)
    @@ -510,20 +542,15 @@ sys_connect(td, uap)
     	int error;
     
     	error = getsockaddr(&sa, uap->name, uap->namelen);
    -	if (error)
    -		return (error);
    -
    -	error = kern_connect(td, uap->s, sa);
    -	free(sa, M_SONAME);
    +	if (error == 0) {
    +		error = kern_connect(td, uap->s, sa);
    +		free(sa, M_SONAME);
    +	}
     	return (error);
     }
     
    -
    -int
    -kern_connect(td, fd, sa)
    -	struct thread *td;
    -	int fd;
    -	struct sockaddr *sa;
    +static int
    +kern_connectat(struct thread *td, int dirfd, int fd, struct sockaddr *sa)
     {
     	struct socket *so;
     	struct file *fp;
    @@ -531,7 +558,7 @@ kern_connect(td, fd, sa)
     	int interrupted = 0;
     
     	AUDIT_ARG_FD(fd);
    -	AUDIT_ARG_SOCKADDR(td, sa);
    +	AUDIT_ARG_SOCKADDR(td, dirfd, sa);
     	error = getsock_cap(td->td_proc->p_fd, fd, CAP_CONNECT, &fp, NULL);
     	if (error)
     		return (error);
    @@ -549,7 +576,10 @@ kern_connect(td, fd, sa)
     	if (error)
     		goto bad;
     #endif
    -	error = soconnect(so, sa, td);
    +	if (dirfd == AT_FDCWD)
    +		error = soconnect(so, sa, td);
    +	else
    +		error = soconnectat(dirfd, so, sa, td);
     	if (error)
     		goto bad;
     	if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {
    @@ -582,6 +612,35 @@ done1:
     }
     
     int
    +kern_connect(struct thread *td, int fd, struct sockaddr *sa)
    +{
    +
    +	return (kern_connectat(td, AT_FDCWD, fd, sa));
    +}
    +
    +/* ARGSUSED */
    +int
    +sys_connectat(td, uap)
    +	struct thread *td;
    +	struct connectat_args /* {
    +		int	fd;
    +		int	s;
    +		caddr_t	name;
    +		int	namelen;
    +	} */ *uap;
    +{
    +	struct sockaddr *sa;
    +	int error;
    +
    +	error = getsockaddr(&sa, uap->name, uap->namelen);
    +	if (error == 0) {
    +		error = kern_connectat(td, uap->fd, uap->s, sa);
    +		free(sa, M_SONAME);
    +	}
    +	return (error);
    +}
    +
    +int
     kern_socketpair(struct thread *td, int domain, int type, int protocol,
         int *rsv)
     {
    @@ -749,7 +808,7 @@ kern_sendit(td, s, mp, flags, control, s
     	AUDIT_ARG_FD(s);
     	rights = CAP_SEND;
     	if (mp->msg_name != NULL) {
    -		AUDIT_ARG_SOCKADDR(td, mp->msg_name);
    +		AUDIT_ARG_SOCKADDR(td, AT_FDCWD, mp->msg_name);
     		rights |= CAP_CONNECT;
     	}
     	error = getsock_cap(td->td_proc->p_fd, s, rights, &fp, NULL);
    @@ -997,7 +1056,7 @@ kern_recvit(td, s, mp, fromseg, controlp
     			error = 0;
     	}
     	if (fromsa != NULL)
    -		AUDIT_ARG_SOCKADDR(td, fromsa);
    +		AUDIT_ARG_SOCKADDR(td, AT_FDCWD, fromsa);
     #ifdef KTRACE
     	if (ktruio != NULL) {
     		ktruio->uio_resid = len - auio.uio_resid;
    
    Modified: head/sys/kern/uipc_usrreq.c
    ==============================================================================
    --- head/sys/kern/uipc_usrreq.c	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/sys/kern/uipc_usrreq.c	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
     #include "opt_ddb.h"
     
     #include 
    +#include 
     #include 
     #include 
     #include 		/* XXX must be before  */
    @@ -271,6 +272,8 @@ static int	uipc_connect2(struct socket *
     static int	uipc_ctloutput(struct socket *, struct sockopt *);
     static int	unp_connect(struct socket *, struct sockaddr *,
     		    struct thread *);
    +static int	unp_connectat(int, struct socket *, struct sockaddr *,
    +		    struct thread *);
     static int	unp_connect2(struct socket *so, struct socket *so2, int);
     static void	unp_disconnect(struct unpcb *unp, struct unpcb *unp2);
     static void	unp_dispose(struct mbuf *);
    @@ -450,7 +453,7 @@ uipc_attach(struct socket *so, int proto
     }
     
     static int
    -uipc_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
    +uipc_bindat(int fd, struct socket *so, struct sockaddr *nam, struct thread *td)
     {
     	struct sockaddr_un *soun = (struct sockaddr_un *)nam;
     	struct vattr vattr;
    @@ -496,8 +499,8 @@ uipc_bind(struct socket *so, struct sock
     	buf[namelen] = 0;
     
     restart:
    -	NDINIT(&nd, CREATE, NOFOLLOW | LOCKPARENT | SAVENAME,
    -	    UIO_SYSSPACE, buf, td);
    +	NDINIT_ATRIGHTS(&nd, CREATE, NOFOLLOW | LOCKPARENT | SAVENAME,
    +	    UIO_SYSSPACE, buf, fd, CAP_BINDAT, td);
     /* SHOULD BE ABLE TO ADOPT EXISTING AND wakeup() ALA FIFO's */
     	error = namei(&nd);
     	if (error)
    @@ -560,6 +563,13 @@ error:
     }
     
     static int
    +uipc_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
    +{
    +
    +	return (uipc_bindat(AT_FDCWD, so, nam, td));
    +}
    +
    +static int
     uipc_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
     {
     	int error;
    @@ -571,6 +581,19 @@ uipc_connect(struct socket *so, struct s
     	return (error);
     }
     
    +static int
    +uipc_connectat(int fd, struct socket *so, struct sockaddr *nam,
    +    struct thread *td)
    +{
    +	int error;
    +
    +	KASSERT(td == curthread, ("uipc_connectat: td != curthread"));
    +	UNP_LINK_WLOCK();
    +	error = unp_connectat(fd, so, nam, td);
    +	UNP_LINK_WUNLOCK();
    +	return (error);
    +}
    +
     static void
     uipc_close(struct socket *so)
     {
    @@ -1081,7 +1104,9 @@ static struct pr_usrreqs uipc_usrreqs_dg
     	.pru_accept =		uipc_accept,
     	.pru_attach =		uipc_attach,
     	.pru_bind =		uipc_bind,
    +	.pru_bindat =		uipc_bindat,
     	.pru_connect =		uipc_connect,
    +	.pru_connectat =	uipc_connectat,
     	.pru_connect2 =		uipc_connect2,
     	.pru_detach =		uipc_detach,
     	.pru_disconnect =	uipc_disconnect,
    @@ -1101,7 +1126,9 @@ static struct pr_usrreqs uipc_usrreqs_se
     	.pru_accept =		uipc_accept,
     	.pru_attach =		uipc_attach,
     	.pru_bind =		uipc_bind,
    +	.pru_bindat =		uipc_bindat,
     	.pru_connect =		uipc_connect,
    +	.pru_connectat =	uipc_connectat,
     	.pru_connect2 =		uipc_connect2,
     	.pru_detach =		uipc_detach,
     	.pru_disconnect =	uipc_disconnect,
    @@ -1121,7 +1148,9 @@ static struct pr_usrreqs uipc_usrreqs_st
     	.pru_accept =		uipc_accept,
     	.pru_attach =		uipc_attach,
     	.pru_bind =		uipc_bind,
    +	.pru_bindat =		uipc_bindat,
     	.pru_connect =		uipc_connect,
    +	.pru_connectat =	uipc_connectat,
     	.pru_connect2 =		uipc_connect2,
     	.pru_detach =		uipc_detach,
     	.pru_disconnect =	uipc_disconnect,
    @@ -1233,6 +1262,14 @@ uipc_ctloutput(struct socket *so, struct
     static int
     unp_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
     {
    +
    +	return (unp_connectat(AT_FDCWD, so, nam, td));
    +}
    +
    +static int
    +unp_connectat(int fd, struct socket *so, struct sockaddr *nam,
    +    struct thread *td)
    +{
     	struct sockaddr_un *soun = (struct sockaddr_un *)nam;
     	struct vnode *vp;
     	struct socket *so2, *so3;
    @@ -1265,8 +1302,8 @@ unp_connect(struct socket *so, struct so
     	UNP_PCB_UNLOCK(unp);
     
     	sa = malloc(sizeof(struct sockaddr_un), M_SONAME, M_WAITOK);
    -	NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
    -	    UIO_SYSSPACE, buf, td);
    +	NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
    +	    UIO_SYSSPACE, buf, fd, CAP_CONNECTAT, td);
     	error = namei(&nd);
     	if (error)
     		vp = NULL;
    
    Modified: head/sys/security/audit/audit.h
    ==============================================================================
    --- head/sys/security/audit/audit.h	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/sys/security/audit/audit.h	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -95,7 +95,7 @@ void	 audit_arg_pid(pid_t pid);
     void	 audit_arg_process(struct proc *p);
     void	 audit_arg_signum(u_int signum);
     void	 audit_arg_socket(int sodomain, int sotype, int soprotocol);
    -void	 audit_arg_sockaddr(struct thread *td, struct sockaddr *sa);
    +void	 audit_arg_sockaddr(struct thread *td, int dirfd, struct sockaddr *sa);
     void	 audit_arg_auid(uid_t auid);
     void	 audit_arg_auditinfo(struct auditinfo *au_info);
     void	 audit_arg_auditinfo_addr(struct auditinfo_addr *au_info);
    @@ -267,9 +267,9 @@ void	 audit_thread_free(struct thread *t
     		audit_arg_socket((sodomain), (sotype), (soprotocol));	\
     } while (0)
     
    -#define	AUDIT_ARG_SOCKADDR(td, sa) do {					\
    +#define	AUDIT_ARG_SOCKADDR(td, dirfd, sa) do {				\
     	if (AUDITING_TD(curthread))					\
    -		audit_arg_sockaddr((td), (sa));				\
    +		audit_arg_sockaddr((td), (dirfd), (sa));		\
     } while (0)
     
     #define	AUDIT_ARG_SUID(suid) do {					\
    @@ -365,7 +365,7 @@ void	 audit_thread_free(struct thread *t
     #define	AUDIT_ARG_SIGNUM(signum)
     #define	AUDIT_ARG_SGID(sgid)
     #define	AUDIT_ARG_SOCKET(sodomain, sotype, soprotocol)
    -#define	AUDIT_ARG_SOCKADDR(td, sa)
    +#define	AUDIT_ARG_SOCKADDR(td, dirfd, sa)
     #define	AUDIT_ARG_SUID(suid)
     #define	AUDIT_ARG_TEXT(text)
     #define	AUDIT_ARG_UID(uid)
    
    Modified: head/sys/security/audit/audit_arg.c
    ==============================================================================
    --- head/sys/security/audit/audit_arg.c	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/sys/security/audit/audit_arg.c	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -441,7 +441,7 @@ audit_arg_socket(int sodomain, int sotyp
     }
     
     void
    -audit_arg_sockaddr(struct thread *td, struct sockaddr *sa)
    +audit_arg_sockaddr(struct thread *td, int dirfd, struct sockaddr *sa)
     {
     	struct kaudit_record *ar;
     
    @@ -463,7 +463,9 @@ audit_arg_sockaddr(struct thread *td, st
     		break;
     
     	case AF_UNIX:
    -		audit_arg_upath1(td, AT_FDCWD,
    +		if (dirfd != AT_FDCWD)
    +			audit_arg_atfd1(dirfd);
    +		audit_arg_upath1(td, dirfd,
     		    ((struct sockaddr_un *)sa)->sun_path);
     		ARG_SET_VALID(ar, ARG_SADDRUNIX);
     		break;
    
    Modified: head/sys/security/audit/audit_bsm.c
    ==============================================================================
    --- head/sys/security/audit/audit_bsm.c	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/sys/security/audit/audit_bsm.c	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -554,6 +554,21 @@ kaudit_to_bsm(struct kaudit_record *kar,
     		/* XXX Need to handle ARG_SADDRINET6 */
     		break;
     
    +	case AUE_BINDAT:
    +	case AUE_CONNECTAT:
    +		ATFD1_TOKENS(1);
    +		if (ARG_IS_VALID(kar, ARG_FD)) {
    +			tok = au_to_arg32(2, "fd", ar->ar_arg_fd);
    +			kau_write(rec, tok);
    +		}
    +		if (ARG_IS_VALID(kar, ARG_SADDRUNIX)) {
    +			tok = au_to_sock_unix((struct sockaddr_un *)
    +			    &ar->ar_arg_sockaddr);
    +			kau_write(rec, tok);
    +			UPATH1_TOKENS;
    +		}
    +		break;
    +
     	case AUE_SOCKET:
     	case AUE_SOCKETPAIR:
     		if (ARG_IS_VALID(kar, ARG_SOCKINFO)) {
    
    Modified: head/sys/sys/capability.h
    ==============================================================================
    --- head/sys/sys/capability.h	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/sys/sys/capability.h	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -182,13 +182,18 @@
     #define	CAP_PDWAIT		0x0020000000000000ULL
     #define	CAP_PDKILL		0x0040000000000000ULL
     
    +/*
    + * Rights that allow to use bindat(2) and connectat(2) syscalls on a
    + * directory descriptor.
    + */
    +#define	CAP_BINDAT		0x0400000000000000ULL
    +#define	CAP_CONNECTAT		0x0800000000000000ULL
    +
     /* The mask of all valid method rights. */
    -#define	CAP_MASK_VALID		0x03ffffffffffffffULL
    +#define	CAP_MASK_VALID		0x0fffffffffffffffULL
     #define	CAP_ALL			CAP_MASK_VALID
     
     /* Available bits. */
    -#define	CAP_UNUSED5		0x0400000000000000ULL
    -#define	CAP_UNUSED4		0x0800000000000000ULL
     #define	CAP_UNUSED3		0x1000000000000000ULL
     #define	CAP_UNUSED2		0x2000000000000000ULL
     #define	CAP_UNUSED1		0x4000000000000000ULL
    
    Modified: head/sys/sys/protosw.h
    ==============================================================================
    --- head/sys/sys/protosw.h	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/sys/sys/protosw.h	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -223,6 +223,10 @@ struct pr_usrreqs {
     		    struct ucred *cred, struct thread *td);
     	void	(*pru_sosetlabel)(struct socket *so);
     	void	(*pru_close)(struct socket *so);
    +	int	(*pru_bindat)(int fd, struct socket *so, struct sockaddr *nam,
    +		    struct thread *td);
    +	int	(*pru_connectat)(int fd, struct socket *so,
    +		    struct sockaddr *nam, struct thread *td);
     };
     
     /*
    @@ -232,8 +236,12 @@ int	pru_accept_notsupp(struct socket *so
     int	pru_attach_notsupp(struct socket *so, int proto, struct thread *td);
     int	pru_bind_notsupp(struct socket *so, struct sockaddr *nam,
     	    struct thread *td);
    +int	pru_bindat_notsupp(int fd, struct socket *so, struct sockaddr *nam,
    +	    struct thread *td);
     int	pru_connect_notsupp(struct socket *so, struct sockaddr *nam,
     	    struct thread *td);
    +int	pru_connectat_notsupp(int fd, struct socket *so, struct sockaddr *nam,
    +	    struct thread *td);
     int	pru_connect2_notsupp(struct socket *so1, struct socket *so2);
     int	pru_control_notsupp(struct socket *so, u_long cmd, caddr_t data,
     	    struct ifnet *ifp, struct thread *td);
    
    Modified: head/sys/sys/socket.h
    ==============================================================================
    --- head/sys/sys/socket.h	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/sys/sys/socket.h	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -620,7 +620,9 @@ struct sf_hdtr {
     __BEGIN_DECLS
     int	accept(int, struct sockaddr * __restrict, socklen_t * __restrict);
     int	bind(int, const struct sockaddr *, socklen_t);
    +int	bindat(int, int, const struct sockaddr *, socklen_t);
     int	connect(int, const struct sockaddr *, socklen_t);
    +int	connectat(int, int, const struct sockaddr *, socklen_t);
     int	getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict);
     int	getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict);
     int	getsockopt(int, int, int, void * __restrict, socklen_t * __restrict);
    
    Modified: head/sys/sys/socketvar.h
    ==============================================================================
    --- head/sys/sys/socketvar.h	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/sys/sys/socketvar.h	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -318,8 +318,12 @@ void	soabort(struct socket *so);
     int	soaccept(struct socket *so, struct sockaddr **nam);
     int	socheckuid(struct socket *so, uid_t uid);
     int	sobind(struct socket *so, struct sockaddr *nam, struct thread *td);
    +int	sobindat(int fd, struct socket *so, struct sockaddr *nam,
    +	    struct thread *td);
     int	soclose(struct socket *so);
     int	soconnect(struct socket *so, struct sockaddr *nam, struct thread *td);
    +int	soconnectat(int fd, struct socket *so, struct sockaddr *nam,
    +	    struct thread *td);
     int	soconnect2(struct socket *so1, struct socket *so2);
     int	socow_setup(struct mbuf *m0, struct uio *uio);
     int	socreate(int dom, struct socket **aso, int type, int proto,
    
    Modified: head/usr.bin/procstat/procstat_files.c
    ==============================================================================
    --- head/usr.bin/procstat/procstat_files.c	Sat Mar  2 18:51:26 2013	(r247666)
    +++ head/usr.bin/procstat/procstat_files.c	Sat Mar  2 21:11:30 2013	(r247667)
    @@ -215,6 +215,13 @@ static struct cap_desc {
     	{ CAP_PDWAIT,		"pw" },
     	{ CAP_PDKILL,		"pk" },
     
    +	/*
    +	 * Rights that allow to use bindat(2) and connectat(2) syscalls on a
    +	 * directory descriptor.
    +	 */
    +	{ CAP_BINDAT,		"ba" },
    +	{ CAP_CONNECTAT,	"ca" },
    +
     	/* Aliases and defines that combine multiple rights. */
     	{ CAP_PREAD,		"prd" },
     	{ CAP_PWRITE,		"pwr" },
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 21:12:57 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 8210BA43;
     Sat,  2 Mar 2013 21:12:57 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 6E2D7282;
     Sat,  2 Mar 2013 21:12:57 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22LCvWY045901;
     Sat, 2 Mar 2013 21:12:57 GMT (envelope-from pjd@svn.freebsd.org)
    Received: (from pjd@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22LCtCZ045885;
     Sat, 2 Mar 2013 21:12:55 GMT (envelope-from pjd@svn.freebsd.org)
    Message-Id: <201303022112.r22LCtCZ045885@svn.freebsd.org>
    From: Pawel Jakub Dawidek 
    Date: Sat, 2 Mar 2013 21:12:55 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247668 - in head/sys: compat/freebsd32 kern sys
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 21:12:57 -0000
    
    Author: pjd
    Date: Sat Mar  2 21:12:54 2013
    New Revision: 247668
    URL: http://svnweb.freebsd.org/changeset/base/247668
    
    Log:
      Regen after r247667.
    
    Modified:
      head/sys/compat/freebsd32/freebsd32_proto.h
      head/sys/compat/freebsd32/freebsd32_syscall.h
      head/sys/compat/freebsd32/freebsd32_syscalls.c
      head/sys/compat/freebsd32/freebsd32_sysent.c
      head/sys/compat/freebsd32/freebsd32_systrace_args.c
      head/sys/kern/init_sysent.c
      head/sys/kern/syscalls.c
      head/sys/kern/systrace_args.c
      head/sys/sys/syscall.h
      head/sys/sys/syscall.mk
      head/sys/sys/sysproto.h
    
    Modified: head/sys/compat/freebsd32/freebsd32_proto.h
    ==============================================================================
    --- head/sys/compat/freebsd32/freebsd32_proto.h	Sat Mar  2 21:11:30 2013	(r247667)
    +++ head/sys/compat/freebsd32/freebsd32_proto.h	Sat Mar  2 21:12:54 2013	(r247668)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
    + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247667 2013-03-02 21:11:30Z pjd 
      */
     
     #ifndef _FREEBSD32_SYSPROTO_H_
    
    Modified: head/sys/compat/freebsd32/freebsd32_syscall.h
    ==============================================================================
    --- head/sys/compat/freebsd32/freebsd32_syscall.h	Sat Mar  2 21:11:30 2013	(r247667)
    +++ head/sys/compat/freebsd32/freebsd32_syscall.h	Sat Mar  2 21:12:54 2013	(r247668)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
    + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247667 2013-03-02 21:11:30Z pjd 
      */
     
     #define	FREEBSD32_SYS_syscall	0
    @@ -435,4 +435,6 @@
     #define	FREEBSD32_SYS_cap_ioctls_get	535
     #define	FREEBSD32_SYS_cap_fcntls_limit	536
     #define	FREEBSD32_SYS_cap_fcntls_get	537
    -#define	FREEBSD32_SYS_MAXSYSCALL	538
    +#define	FREEBSD32_SYS_bindat	538
    +#define	FREEBSD32_SYS_connectat	539
    +#define	FREEBSD32_SYS_MAXSYSCALL	540
    
    Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c
    ==============================================================================
    --- head/sys/compat/freebsd32/freebsd32_syscalls.c	Sat Mar  2 21:11:30 2013	(r247667)
    +++ head/sys/compat/freebsd32/freebsd32_syscalls.c	Sat Mar  2 21:12:54 2013	(r247668)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
    + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247667 2013-03-02 21:11:30Z pjd 
      */
     
     const char *freebsd32_syscallnames[] = {
    @@ -561,4 +561,6 @@ const char *freebsd32_syscallnames[] = {
     	"cap_ioctls_get",			/* 535 = cap_ioctls_get */
     	"cap_fcntls_limit",			/* 536 = cap_fcntls_limit */
     	"cap_fcntls_get",			/* 537 = cap_fcntls_get */
    +	"bindat",			/* 538 = bindat */
    +	"connectat",			/* 539 = connectat */
     };
    
    Modified: head/sys/compat/freebsd32/freebsd32_sysent.c
    ==============================================================================
    --- head/sys/compat/freebsd32/freebsd32_sysent.c	Sat Mar  2 21:11:30 2013	(r247667)
    +++ head/sys/compat/freebsd32/freebsd32_sysent.c	Sat Mar  2 21:12:54 2013	(r247668)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
    + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247667 2013-03-02 21:11:30Z pjd 
      */
     
     #include "opt_compat.h"
    @@ -598,4 +598,6 @@ struct sysent freebsd32_sysent[] = {
     	{ AS(cap_ioctls_get_args), (sy_call_t *)sys_cap_ioctls_get, AUE_CAP_IOCTLS_GET, NULL, 0, 0, 0, SY_THR_STATIC },	/* 535 = cap_ioctls_get */
     	{ AS(cap_fcntls_limit_args), (sy_call_t *)sys_cap_fcntls_limit, AUE_CAP_FCNTLS_LIMIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 536 = cap_fcntls_limit */
     	{ AS(cap_fcntls_get_args), (sy_call_t *)sys_cap_fcntls_get, AUE_CAP_FCNTLS_GET, NULL, 0, 0, 0, SY_THR_STATIC },	/* 537 = cap_fcntls_get */
    +	{ AS(bindat_args), (sy_call_t *)sys_bindat, AUE_BINDAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 538 = bindat */
    +	{ AS(connectat_args), (sy_call_t *)sys_connectat, AUE_CONNECTAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 539 = connectat */
     };
    
    Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c
    ==============================================================================
    --- head/sys/compat/freebsd32/freebsd32_systrace_args.c	Sat Mar  2 21:11:30 2013	(r247667)
    +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c	Sat Mar  2 21:12:54 2013	(r247668)
    @@ -3130,6 +3130,26 @@ systrace_args(int sysnum, void *params, 
     		*n_args = 2;
     		break;
     	}
    +	/* bindat */
    +	case 538: {
    +		struct bindat_args *p = params;
    +		iarg[0] = p->fd; /* int */
    +		iarg[1] = p->s; /* int */
    +		uarg[2] = (intptr_t) p->name; /* caddr_t */
    +		iarg[3] = p->namelen; /* int */
    +		*n_args = 4;
    +		break;
    +	}
    +	/* connectat */
    +	case 539: {
    +		struct connectat_args *p = params;
    +		iarg[0] = p->fd; /* int */
    +		iarg[1] = p->s; /* int */
    +		uarg[2] = (intptr_t) p->name; /* caddr_t */
    +		iarg[3] = p->namelen; /* int */
    +		*n_args = 4;
    +		break;
    +	}
     	default:
     		*n_args = 0;
     		break;
    @@ -8356,6 +8376,44 @@ systrace_entry_setargdesc(int sysnum, in
     			break;
     		};
     		break;
    +	/* bindat */
    +	case 538:
    +		switch(ndx) {
    +		case 0:
    +			p = "int";
    +			break;
    +		case 1:
    +			p = "int";
    +			break;
    +		case 2:
    +			p = "caddr_t";
    +			break;
    +		case 3:
    +			p = "int";
    +			break;
    +		default:
    +			break;
    +		};
    +		break;
    +	/* connectat */
    +	case 539:
    +		switch(ndx) {
    +		case 0:
    +			p = "int";
    +			break;
    +		case 1:
    +			p = "int";
    +			break;
    +		case 2:
    +			p = "caddr_t";
    +			break;
    +		case 3:
    +			p = "int";
    +			break;
    +		default:
    +			break;
    +		};
    +		break;
     	default:
     		break;
     	};
    @@ -10143,6 +10201,16 @@ systrace_return_setargdesc(int sysnum, i
     		if (ndx == 0 || ndx == 1)
     			p = "int";
     		break;
    +	/* bindat */
    +	case 538:
    +		if (ndx == 0 || ndx == 1)
    +			p = "int";
    +		break;
    +	/* connectat */
    +	case 539:
    +		if (ndx == 0 || ndx == 1)
    +			p = "int";
    +		break;
     	default:
     		break;
     	};
    
    Modified: head/sys/kern/init_sysent.c
    ==============================================================================
    --- head/sys/kern/init_sysent.c	Sat Mar  2 21:11:30 2013	(r247667)
    +++ head/sys/kern/init_sysent.c	Sat Mar  2 21:12:54 2013	(r247668)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/kern/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
    + * created from FreeBSD: head/sys/kern/syscalls.master 247667 2013-03-02 21:11:30Z pjd 
      */
     
     #include "opt_compat.h"
    @@ -572,4 +572,6 @@ struct sysent sysent[] = {
     	{ AS(cap_ioctls_get_args), (sy_call_t *)sys_cap_ioctls_get, AUE_CAP_IOCTLS_GET, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 535 = cap_ioctls_get */
     	{ AS(cap_fcntls_limit_args), (sy_call_t *)sys_cap_fcntls_limit, AUE_CAP_FCNTLS_LIMIT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 536 = cap_fcntls_limit */
     	{ AS(cap_fcntls_get_args), (sy_call_t *)sys_cap_fcntls_get, AUE_CAP_FCNTLS_GET, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 537 = cap_fcntls_get */
    +	{ AS(bindat_args), (sy_call_t *)sys_bindat, AUE_BINDAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 538 = bindat */
    +	{ AS(connectat_args), (sy_call_t *)sys_connectat, AUE_CONNECTAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 539 = connectat */
     };
    
    Modified: head/sys/kern/syscalls.c
    ==============================================================================
    --- head/sys/kern/syscalls.c	Sat Mar  2 21:11:30 2013	(r247667)
    +++ head/sys/kern/syscalls.c	Sat Mar  2 21:12:54 2013	(r247668)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/kern/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
    + * created from FreeBSD: head/sys/kern/syscalls.master 247667 2013-03-02 21:11:30Z pjd 
      */
     
     const char *syscallnames[] = {
    @@ -545,4 +545,6 @@ const char *syscallnames[] = {
     	"cap_ioctls_get",			/* 535 = cap_ioctls_get */
     	"cap_fcntls_limit",			/* 536 = cap_fcntls_limit */
     	"cap_fcntls_get",			/* 537 = cap_fcntls_get */
    +	"bindat",			/* 538 = bindat */
    +	"connectat",			/* 539 = connectat */
     };
    
    Modified: head/sys/kern/systrace_args.c
    ==============================================================================
    --- head/sys/kern/systrace_args.c	Sat Mar  2 21:11:30 2013	(r247667)
    +++ head/sys/kern/systrace_args.c	Sat Mar  2 21:12:54 2013	(r247668)
    @@ -3328,6 +3328,26 @@ systrace_args(int sysnum, void *params, 
     		*n_args = 2;
     		break;
     	}
    +	/* bindat */
    +	case 538: {
    +		struct bindat_args *p = params;
    +		iarg[0] = p->fd; /* int */
    +		iarg[1] = p->s; /* int */
    +		uarg[2] = (intptr_t) p->name; /* caddr_t */
    +		iarg[3] = p->namelen; /* int */
    +		*n_args = 4;
    +		break;
    +	}
    +	/* connectat */
    +	case 539: {
    +		struct connectat_args *p = params;
    +		iarg[0] = p->fd; /* int */
    +		iarg[1] = p->s; /* int */
    +		uarg[2] = (intptr_t) p->name; /* caddr_t */
    +		iarg[3] = p->namelen; /* int */
    +		*n_args = 4;
    +		break;
    +	}
     	default:
     		*n_args = 0;
     		break;
    @@ -8858,6 +8878,44 @@ systrace_entry_setargdesc(int sysnum, in
     			break;
     		};
     		break;
    +	/* bindat */
    +	case 538:
    +		switch(ndx) {
    +		case 0:
    +			p = "int";
    +			break;
    +		case 1:
    +			p = "int";
    +			break;
    +		case 2:
    +			p = "caddr_t";
    +			break;
    +		case 3:
    +			p = "int";
    +			break;
    +		default:
    +			break;
    +		};
    +		break;
    +	/* connectat */
    +	case 539:
    +		switch(ndx) {
    +		case 0:
    +			p = "int";
    +			break;
    +		case 1:
    +			p = "int";
    +			break;
    +		case 2:
    +			p = "caddr_t";
    +			break;
    +		case 3:
    +			p = "int";
    +			break;
    +		default:
    +			break;
    +		};
    +		break;
     	default:
     		break;
     	};
    @@ -10776,6 +10834,16 @@ systrace_return_setargdesc(int sysnum, i
     		if (ndx == 0 || ndx == 1)
     			p = "int";
     		break;
    +	/* bindat */
    +	case 538:
    +		if (ndx == 0 || ndx == 1)
    +			p = "int";
    +		break;
    +	/* connectat */
    +	case 539:
    +		if (ndx == 0 || ndx == 1)
    +			p = "int";
    +		break;
     	default:
     		break;
     	};
    
    Modified: head/sys/sys/syscall.h
    ==============================================================================
    --- head/sys/sys/syscall.h	Sat Mar  2 21:11:30 2013	(r247667)
    +++ head/sys/sys/syscall.h	Sat Mar  2 21:12:54 2013	(r247668)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/kern/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
    + * created from FreeBSD: head/sys/kern/syscalls.master 247667 2013-03-02 21:11:30Z pjd 
      */
     
     #define	SYS_syscall	0
    @@ -457,4 +457,6 @@
     #define	SYS_cap_ioctls_get	535
     #define	SYS_cap_fcntls_limit	536
     #define	SYS_cap_fcntls_get	537
    -#define	SYS_MAXSYSCALL	538
    +#define	SYS_bindat	538
    +#define	SYS_connectat	539
    +#define	SYS_MAXSYSCALL	540
    
    Modified: head/sys/sys/syscall.mk
    ==============================================================================
    --- head/sys/sys/syscall.mk	Sat Mar  2 21:11:30 2013	(r247667)
    +++ head/sys/sys/syscall.mk	Sat Mar  2 21:12:54 2013	(r247668)
    @@ -1,7 +1,7 @@
     # FreeBSD system call names.
     # DO NOT EDIT-- this file is automatically generated.
     # $FreeBSD$
    -# created from FreeBSD: head/sys/kern/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
    +# created from FreeBSD: head/sys/kern/syscalls.master 247667 2013-03-02 21:11:30Z pjd 
     MIASM =  \
     	syscall.o \
     	exit.o \
    @@ -405,4 +405,6 @@ MIASM =  \
     	cap_ioctls_limit.o \
     	cap_ioctls_get.o \
     	cap_fcntls_limit.o \
    -	cap_fcntls_get.o
    +	cap_fcntls_get.o \
    +	bindat.o \
    +	connectat.o
    
    Modified: head/sys/sys/sysproto.h
    ==============================================================================
    --- head/sys/sys/sysproto.h	Sat Mar  2 21:11:30 2013	(r247667)
    +++ head/sys/sys/sysproto.h	Sat Mar  2 21:12:54 2013	(r247668)
    @@ -3,7 +3,7 @@
      *
      * DO NOT EDIT-- this file is automatically generated.
      * $FreeBSD$
    - * created from FreeBSD: head/sys/kern/syscalls.master 247602 2013-03-02 00:53:12Z pjd 
    + * created from FreeBSD: head/sys/kern/syscalls.master 247667 2013-03-02 21:11:30Z pjd 
      */
     
     #ifndef _SYS_SYSPROTO_H_
    @@ -1784,6 +1784,18 @@ struct cap_fcntls_get_args {
     	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
     	char fcntlrightsp_l_[PADL_(uint32_t *)]; uint32_t * fcntlrightsp; char fcntlrightsp_r_[PADR_(uint32_t *)];
     };
    +struct bindat_args {
    +	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
    +	char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
    +	char name_l_[PADL_(caddr_t)]; caddr_t name; char name_r_[PADR_(caddr_t)];
    +	char namelen_l_[PADL_(int)]; int namelen; char namelen_r_[PADR_(int)];
    +};
    +struct connectat_args {
    +	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
    +	char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
    +	char name_l_[PADL_(caddr_t)]; caddr_t name; char name_r_[PADR_(caddr_t)];
    +	char namelen_l_[PADL_(int)]; int namelen; char namelen_r_[PADR_(int)];
    +};
     int	nosys(struct thread *, struct nosys_args *);
     void	sys_sys_exit(struct thread *, struct sys_exit_args *);
     int	sys_fork(struct thread *, struct fork_args *);
    @@ -2171,6 +2183,8 @@ int	sys_cap_ioctls_limit(struct thread *
     int	sys_cap_ioctls_get(struct thread *, struct cap_ioctls_get_args *);
     int	sys_cap_fcntls_limit(struct thread *, struct cap_fcntls_limit_args *);
     int	sys_cap_fcntls_get(struct thread *, struct cap_fcntls_get_args *);
    +int	sys_bindat(struct thread *, struct bindat_args *);
    +int	sys_connectat(struct thread *, struct connectat_args *);
     
     #ifdef COMPAT_43
     
    @@ -2872,6 +2886,8 @@ int	freebsd7_shmctl(struct thread *, str
     #define	SYS_AUE_cap_ioctls_get	AUE_CAP_IOCTLS_GET
     #define	SYS_AUE_cap_fcntls_limit	AUE_CAP_FCNTLS_LIMIT
     #define	SYS_AUE_cap_fcntls_get	AUE_CAP_FCNTLS_GET
    +#define	SYS_AUE_bindat	AUE_BINDAT
    +#define	SYS_AUE_connectat	AUE_CONNECTAT
     
     #undef PAD_
     #undef PADL_
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 21:16:41 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 87A90C30;
     Sat,  2 Mar 2013 21:16:41 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 630A72AC;
     Sat,  2 Mar 2013 21:16:41 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22LGfnF046516;
     Sat, 2 Mar 2013 21:16:41 GMT (envelope-from pjd@svn.freebsd.org)
    Received: (from pjd@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22LGfP8046514;
     Sat, 2 Mar 2013 21:16:41 GMT (envelope-from pjd@svn.freebsd.org)
    Message-Id: <201303022116.r22LGfP8046514@svn.freebsd.org>
    From: Pawel Jakub Dawidek 
    Date: Sat, 2 Mar 2013 21:16:41 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247669 - head/tools/regression/pjdfstest
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 21:16:41 -0000
    
    Author: pjd
    Date: Sat Mar  2 21:16:40 2013
    New Revision: 247669
    URL: http://svnweb.freebsd.org/changeset/base/247669
    
    Log:
      Add support for bindat(2) and connectat(2).
      
      Sponsored by:	The FreeBSD Foundation
    
    Modified:
      head/tools/regression/pjdfstest/Makefile
      head/tools/regression/pjdfstest/pjdfstest.c
    
    Modified: head/tools/regression/pjdfstest/Makefile
    ==============================================================================
    --- head/tools/regression/pjdfstest/Makefile	Sat Mar  2 21:12:54 2013	(r247668)
    +++ head/tools/regression/pjdfstest/Makefile	Sat Mar  2 21:16:40 2013	(r247669)
    @@ -6,7 +6,7 @@ ${PROG}:	${PROG}.c
     	@OSTYPE=`uname`; \
     	CFLAGS=-D__OS_$${OSTYPE}__; \
     	if [ $$OSTYPE = "FreeBSD" ]; then \
    -		CFLAGS="$$CFLAGS -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_FCHFLAGS -DHAS_LCHFLAGS -DHAS_FREEBSD_ACL"; \
    +		CFLAGS="$$CFLAGS -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_FCHFLAGS -DHAS_LCHFLAGS -DHAS_FREEBSD_ACL -DHAS_BINDAT -DHAS_CONNECTAT"; \
     	elif [ $$OSTYPE = "SunOS" ]; then \
     		CFLAGS="$$CFLAGS -DHAS_TRUNCATE64 -DHAS_STAT64"; \
     		CFLAGS="$$CFLAGS -lsocket"; \
    
    Modified: head/tools/regression/pjdfstest/pjdfstest.c
    ==============================================================================
    --- head/tools/regression/pjdfstest/pjdfstest.c	Sat Mar  2 21:12:54 2013	(r247668)
    +++ head/tools/regression/pjdfstest/pjdfstest.c	Sat Mar  2 21:16:40 2013	(r247669)
    @@ -82,7 +82,13 @@ enum action {
     	ACTION_MKNOD,
     	ACTION_MKNODAT,
     	ACTION_BIND,
    +#ifdef HAS_BINDAT
    +	ACTION_BINDAT,
    +#endif
     	ACTION_CONNECT,
    +#ifdef HAS_CONNECTAT
    +	ACTION_CONNECTAT,
    +#endif
     	ACTION_CHMOD,
     	ACTION_FCHMOD,
     #ifdef HAS_LCHMOD
    @@ -154,7 +160,13 @@ static struct syscall_desc syscalls[] = 
     	{ "mknod", ACTION_MKNOD, { TYPE_STRING, TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE} },
     	{ "mknodat", ACTION_MKNODAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE} },
     	{ "bind", ACTION_BIND, { TYPE_STRING, TYPE_NONE } },
    +#ifdef HAS_BINDAT
    +	{ "bindat", ACTION_BINDAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } },
    +#endif
     	{ "connect", ACTION_CONNECT, { TYPE_STRING, TYPE_NONE } },
    +#ifdef HAS_CONNECTAT
    +	{ "connectat", ACTION_CONNECTAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } },
    +#endif
     	{ "chmod", ACTION_CHMOD, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } },
     	{ "fchmod", ACTION_FCHMOD, { TYPE_DESCRIPTOR, TYPE_NUMBER, TYPE_NONE } },
     #ifdef HAS_LCHMOD
    @@ -732,6 +744,22 @@ call_syscall(struct syscall_desc *scall,
     		rval = bind(rval, (struct sockaddr *)&sunx, sizeof(sunx));
     		break;
     	    }
    +#ifdef HAS_BINDAT
    +	case ACTION_BINDAT:
    +	    {
    +		struct sockaddr_un sunx;
    +
    +		sunx.sun_family = AF_UNIX;
    +		strncpy(sunx.sun_path, STR(1), sizeof(sunx.sun_path) - 1);
    +		sunx.sun_path[sizeof(sunx.sun_path) - 1] = '\0';
    +		rval = socket(AF_UNIX, SOCK_STREAM, 0);
    +		if (rval < 0)
    +			break;
    +		rval = bindat(NUM(0), rval, (struct sockaddr *)&sunx,
    +		    sizeof(sunx));
    +		break;
    +	    }
    +#endif
     	case ACTION_CONNECT:
     	    {
     		struct sockaddr_un sunx;
    @@ -745,6 +773,22 @@ call_syscall(struct syscall_desc *scall,
     		rval = connect(rval, (struct sockaddr *)&sunx, sizeof(sunx));
     		break;
     	    }
    +#ifdef HAS_CONNECTAT
    +	case ACTION_CONNECTAT:
    +	    {
    +		struct sockaddr_un sunx;
    +
    +		sunx.sun_family = AF_UNIX;
    +		strncpy(sunx.sun_path, STR(1), sizeof(sunx.sun_path) - 1);
    +		sunx.sun_path[sizeof(sunx.sun_path) - 1] = '\0';
    +		rval = socket(AF_UNIX, SOCK_STREAM, 0);
    +		if (rval < 0)
    +			break;
    +		rval = connectat(NUM(0), rval, (struct sockaddr *)&sunx,
    +		    sizeof(sunx));
    +		break;
    +	    }
    +#endif
     	case ACTION_CHMOD:
     		rval = chmod(STR(0), (mode_t)NUM(1));
     		break;
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 22:19:18 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 06A8699B;
     Sat,  2 Mar 2013 22:19:18 +0000 (UTC) (envelope-from mav@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id D66666CF;
     Sat,  2 Mar 2013 22:19:17 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22MJH6c065174;
     Sat, 2 Mar 2013 22:19:17 GMT (envelope-from mav@svn.freebsd.org)
    Received: (from mav@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22MJHKh065172;
     Sat, 2 Mar 2013 22:19:17 GMT (envelope-from mav@svn.freebsd.org)
    Message-Id: <201303022219.r22MJHKh065172@svn.freebsd.org>
    From: Alexander Motin 
    Date: Sat, 2 Mar 2013 22:19:17 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247671 - head/sys/ofed/include/linux
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 22:19:18 -0000
    
    Author: mav
    Date: Sat Mar  2 22:19:17 2013
    New Revision: 247671
    URL: http://svnweb.freebsd.org/changeset/base/247671
    
    Log:
      MFcalloutng:
      Give OFED Linux wrapper own "expires" field instead of abusing callout's
      c_time, which will change its type and units with calloutng commit.
    
    Modified:
      head/sys/ofed/include/linux/timer.h
    
    Modified: head/sys/ofed/include/linux/timer.h
    ==============================================================================
    --- head/sys/ofed/include/linux/timer.h	Sat Mar  2 21:59:07 2013	(r247670)
    +++ head/sys/ofed/include/linux/timer.h	Sat Mar  2 22:19:17 2013	(r247671)
    @@ -37,11 +37,10 @@
     struct timer_list {
     	struct callout	timer_callout;
     	void		(*function)(unsigned long);
    -        unsigned long	data;
    +	unsigned long	data;
    +	unsigned long	expires;
     };
     
    -#define	expires	timer_callout.c_time
    -
     static inline void
     _timer_fn(void *context)
     {
    @@ -65,13 +64,16 @@ do {									\
     	callout_init(&(timer)->timer_callout, CALLOUT_MPSAFE);		\
     } while (0)
     
    -#define	mod_timer(timer, expire)					\
    -	callout_reset(&(timer)->timer_callout, (expire) - jiffies,	\
    -	    _timer_fn, (timer))
    +#define	mod_timer(timer, exp)						\
    +do {									\
    +	(timer)->expires = exp;						\
    +	callout_reset(&(timer)->timer_callout, (exp) - jiffies,		\
    +	    _timer_fn, (timer));					\
    +} while (0)
     
     #define	add_timer(timer)						\
     	callout_reset(&(timer)->timer_callout,				\
    -	    (timer)->timer_callout.c_time - jiffies, _timer_fn, (timer))
    +	    (timer)->expires - jiffies, _timer_fn, (timer))
     
     #define	del_timer(timer)	callout_stop(&(timer)->timer_callout)
     #define	del_timer_sync(timer)	callout_drain(&(timer)->timer_callout)
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 22:28:21 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 187E8D73;
     Sat,  2 Mar 2013 22:28:21 +0000 (UTC) (envelope-from mav@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 0B7E271D;
     Sat,  2 Mar 2013 22:28:21 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22MSKla068111;
     Sat, 2 Mar 2013 22:28:20 GMT (envelope-from mav@svn.freebsd.org)
    Received: (from mav@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22MSKUV068110;
     Sat, 2 Mar 2013 22:28:20 GMT (envelope-from mav@svn.freebsd.org)
    Message-Id: <201303022228.r22MSKUV068110@svn.freebsd.org>
    From: Alexander Motin 
    Date: Sat, 2 Mar 2013 22:28:20 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247673 - head/sys/sys
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 22:28:21 -0000
    
    Author: mav
    Date: Sat Mar  2 22:28:20 2013
    New Revision: 247673
    URL: http://svnweb.freebsd.org/changeset/base/247673
    
    Log:
      Polish few spaces/tabs.
    
    Modified:
      head/sys/sys/time.h
    
    Modified: head/sys/sys/time.h
    ==============================================================================
    --- head/sys/sys/time.h	Sat Mar  2 22:24:43 2013	(r247672)
    +++ head/sys/sys/time.h	Sat Mar  2 22:28:20 2013	(r247673)
    @@ -113,7 +113,7 @@ bintime_mul(struct bintime *bt, u_int x)
     #define	SBT_1M	(SBT_1S * 60)
     #define	SBT_1MS	(SBT_1S / 1000)
     #define	SBT_1US	(SBT_1S / 1000000)
    -#define	SBT_1NS (SBT_1S / 1000000000)  
    +#define	SBT_1NS	(SBT_1S / 1000000000)
     
     static __inline int
     sbintime_getsec(sbintime_t sbt)
    @@ -133,7 +133,7 @@ static __inline struct bintime
     sbttobt(sbintime_t sbt)
     {
     	struct bintime bt;
    -	
    +
     	bt.sec = sbt >> 32;
     	bt.frac = sbt << 32;
     	return (bt);
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 22:41:06 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id AC98426F;
     Sat,  2 Mar 2013 22:41:06 +0000 (UTC) (envelope-from mav@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 9F2E077B;
     Sat,  2 Mar 2013 22:41:06 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22Mf6Pr073478;
     Sat, 2 Mar 2013 22:41:06 GMT (envelope-from mav@svn.freebsd.org)
    Received: (from mav@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22Mf66f073477;
     Sat, 2 Mar 2013 22:41:06 GMT (envelope-from mav@svn.freebsd.org)
    Message-Id: <201303022241.r22Mf66f073477@svn.freebsd.org>
    From: Alexander Motin 
    Date: Sat, 2 Mar 2013 22:41:06 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247675 - head/sys/ofed/include/linux
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 22:41:06 -0000
    
    Author: mav
    Date: Sat Mar  2 22:41:06 2013
    New Revision: 247675
    URL: http://svnweb.freebsd.org/changeset/base/247675
    
    Log:
      Add protective parentheses for macro argument, missed in r247671.
    
    Modified:
      head/sys/ofed/include/linux/timer.h
    
    Modified: head/sys/ofed/include/linux/timer.h
    ==============================================================================
    --- head/sys/ofed/include/linux/timer.h	Sat Mar  2 22:34:33 2013	(r247674)
    +++ head/sys/ofed/include/linux/timer.h	Sat Mar  2 22:41:06 2013	(r247675)
    @@ -66,7 +66,7 @@ do {									\
     
     #define	mod_timer(timer, exp)						\
     do {									\
    -	(timer)->expires = exp;						\
    +	(timer)->expires = (exp);					\
     	callout_reset(&(timer)->timer_callout, (exp) - jiffies,		\
     	    _timer_fn, (timer));					\
     } while (0)
    
    From owner-svn-src-head@FreeBSD.ORG  Sat Mar  2 23:40:43 2013
    Return-Path: 
    Delivered-To: svn-src-head@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 4CE0320B;
     Sat,  2 Mar 2013 23:40:43 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 2723898F;
     Sat,  2 Mar 2013 23:40:43 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r22Nehdd090163;
     Sat, 2 Mar 2013 23:40:43 GMT (envelope-from pjd@svn.freebsd.org)
    Received: (from pjd@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r22NehE2090162;
     Sat, 2 Mar 2013 23:40:43 GMT (envelope-from pjd@svn.freebsd.org)
    Message-Id: <201303022340.r22NehE2090162@svn.freebsd.org>
    From: Pawel Jakub Dawidek 
    Date: Sat, 2 Mar 2013 23:40:42 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-head@freebsd.org
    Subject: svn commit: r247676 - head/tools/regression/capsicum/syscalls
    X-SVN-Group: head
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-head@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: 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, 02 Mar 2013 23:40:43 -0000
    
    Author: pjd
    Date: Sat Mar  2 23:40:42 2013
    New Revision: 247676
    URL: http://svnweb.freebsd.org/changeset/base/247676
    
    Log:
      If all ioctls are allowed, cap_ioctls_get(2) will return CAP_IOCTLS_ALL.
      Update regression tests.
    
    Modified:
      head/tools/regression/capsicum/syscalls/cap_ioctls_limit.c
    
    Modified: head/tools/regression/capsicum/syscalls/cap_ioctls_limit.c
    ==============================================================================
    --- head/tools/regression/capsicum/syscalls/cap_ioctls_limit.c	Sat Mar  2 22:41:06 2013	(r247675)
    +++ head/tools/regression/capsicum/syscalls/cap_ioctls_limit.c	Sat Mar  2 23:40:42 2013	(r247676)
    @@ -51,7 +51,7 @@ ioctl_tests_0(int fd)
     {
     	unsigned long cmds[2];
     
    -	CHECK(cap_ioctls_get(fd, NULL, 0) == INT_MAX);
    +	CHECK(cap_ioctls_get(fd, NULL, 0) == CAP_IOCTLS_ALL);
     
     	CHECK(fcntl(fd, F_GETFD) == 0);
     	CHECK(ioctl(fd, FIOCLEX) == 0);
    @@ -241,7 +241,7 @@ ioctl_tests_recv_0(int sock)
     
     	CHECK(descriptor_recv(sock, &fd) == 0);
     
    -	CHECK(cap_ioctls_get(fd, NULL, 0) == INT_MAX);
    +	CHECK(cap_ioctls_get(fd, NULL, 0) == CAP_IOCTLS_ALL);
     
     	CHECK(fcntl(fd, F_GETFD) == 0);
     	CHECK(ioctl(fd, FIOCLEX) == 0);