From sam at FreeBSD.org Sun Mar 1 00:01:39 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 00:01:50 2009 Subject: svn commit: r189220 - head/usr.sbin/wpa/wpa_supplicant Message-ID: <200903010801.n2181cM5035771@svn.freebsd.org> Author: sam Date: Sun Mar 1 08:01:38 2009 New Revision: 189220 URL: http://svn.freebsd.org/changeset/base/189220 Log: use ansi prototypes Submitted by: Pawel Worach Modified: head/usr.sbin/wpa/wpa_supplicant/Packet32.c Modified: head/usr.sbin/wpa/wpa_supplicant/Packet32.c ============================================================================== --- head/usr.sbin/wpa/wpa_supplicant/Packet32.c Sun Mar 1 07:24:26 2009 (r189219) +++ head/usr.sbin/wpa/wpa_supplicant/Packet32.c Sun Mar 1 08:01:38 2009 (r189220) @@ -109,8 +109,7 @@ PacketGetVersion(void) } void * -PacketOpenAdapter(iface) - CHAR *iface; +PacketOpenAdapter(CHAR *iface) { struct adapter *a; int s; @@ -164,10 +163,7 @@ PacketOpenAdapter(iface) } int -PacketRequest(iface, set, oid) - void *iface; - BOOLEAN set; - PACKET_OID_DATA *oid; +PacketRequest(void *iface, BOOLEAN set, PACKET_OID_DATA *oid) { struct adapter *a; uint32_t retval; @@ -239,9 +235,7 @@ PacketRequest(iface, set, oid) } int -PacketGetAdapterNames(namelist, len) - CHAR *namelist; - ULONG *len; +PacketGetAdapterNames(CHAR *namelist, ULONG *len) { int mib[6]; size_t needed; @@ -341,8 +335,7 @@ PacketGetAdapterNames(namelist, len) } void -PacketCloseAdapter(iface) - void *iface; +PacketCloseAdapter(void *iface) { struct adapter *a; struct ifreq ifr; From bz at FreeBSD.org Sun Mar 1 01:35:41 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Sun Mar 1 01:35:53 2009 Subject: svn commit: r189221 - head/sys/sys Message-ID: <200903010935.n219ZfwD037465@svn.freebsd.org> Author: bz Date: Sun Mar 1 09:35:41 2009 New Revision: 189221 URL: http://svn.freebsd.org/changeset/base/189221 Log: Add the new compile-time assertion macro CTASSERT_EQUAL(). It takes a positive integer constant (the expected value) and another positive integer, usually compile-time evaluated, e.g. CTASSERT_EQUAL(FOO_EXPECTED_SIZE, sizeof (struct foo)); While the classic CTASSERT() gives: error: size of array '__assert60' is negative this gives you: In function '__ctassert_equal_at_line_60': warning: '__expected_42_but_got[464ul]' is used uninitialized in this function and you can directly see the difference in the expected and the real value. CTASSERT_EQUAL() needs special compile time options to trigger thus keep it locally to this header. If it proves to be of general interest it can be moved to systm.h. Submitted by: jmallett Reviewed by: sam, warner, rwatson, jmallett (earlier versions) Modified: head/sys/sys/vimage.h Modified: head/sys/sys/vimage.h ============================================================================== --- head/sys/sys/vimage.h Sun Mar 1 08:01:38 2009 (r189220) +++ head/sys/sys/vimage.h Sun Mar 1 09:35:41 2009 (r189221) @@ -112,4 +112,28 @@ struct vnet_modlink { int vi_symlookup(struct kld_sym_lookup *, char *); void vnet_mod_register(const struct vnet_modinfo *); +/* + * x must be a positive integer constant (expected value), + * y must be compile-time evaluated to a positive integer, + * e.g. CTASSERT_EQUAL(FOO_EXPECTED_SIZE, sizeof (struct foo)); + * One needs to compile with -Wuninitialized and thus at least -O + * for this to trigger and -Werror if it should be fatal. + */ +#define CTASSERT_EQUAL(x, y) \ + static int __attribute__((__used__)) \ + __attribute__((__section__(".debug_ctassert_equal"))) \ + __CONCAT(__ctassert_equal_at_line_, __LINE__)(void); \ + \ + static int __attribute__((__used__)) \ + __attribute__((__section__(".debug_ctassert_equal"))) \ + __CONCAT(__ctassert_equal_at_line_, __LINE__)(void) \ + { \ + int __CONCAT(__CONCAT(__expected_, x), \ + _but_got)[(y) + (x)]; \ + __CONCAT(__CONCAT(__expected_, x), _but_got)[(x)] = 1; \ + return (__CONCAT(__CONCAT(__expected_, x), \ + _but_got)[(y)]); \ + } \ + struct __hack + #endif /* !_SYS_VIMAGE_H_ */ From ed at FreeBSD.org Sun Mar 1 01:50:14 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Mar 1 01:50:28 2009 Subject: svn commit: r189222 - head/sys/kern Message-ID: <200903010950.n219oDtL037775@svn.freebsd.org> Author: ed Date: Sun Mar 1 09:50:13 2009 New Revision: 189222 URL: http://svn.freebsd.org/changeset/base/189222 Log: Improve my previous changes to the TTY code: also remove memcpy(). It's better to just use internal language constructs, because it is likely the compiler has a better opinion on whether to perform inlining, which is very likely to happen to struct winsize. Submitted by: Christoph Mallon Modified: head/sys/kern/tty.c head/sys/kern/tty_pts.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Sun Mar 1 09:35:41 2009 (r189221) +++ head/sys/kern/tty.c Sun Mar 1 09:50:13 2009 (r189222) @@ -724,14 +724,14 @@ ttyil_ioctl(struct cdev *dev, u_long cmd switch (cmd) { case TIOCGETA: /* Obtain terminal flags through tcgetattr(). */ - memcpy(data, dev->si_drv2, sizeof(struct termios)); + *(struct termios*)data = *(struct termios*)dev->si_drv2; break; case TIOCSETA: /* Set terminal flags through tcsetattr(). */ error = priv_check(td, PRIV_TTY_SETA); if (error) break; - memcpy(dev->si_drv2, data, sizeof(struct termios)); + *(struct termios*)dev->si_drv2 = *(struct termios*)data; break; case TIOCGETD: *(int *)data = TTYDISC; @@ -1344,7 +1344,7 @@ tty_generic_ioctl(struct tty *tp, u_long return (0); case TIOCGETA: /* Obtain terminal flags through tcgetattr(). */ - memcpy(data, &tp->t_termios, sizeof(struct termios)); + *(struct termios*)data = tp->t_termios; return (0); case TIOCSETA: case TIOCSETAW: @@ -1568,13 +1568,13 @@ tty_generic_ioctl(struct tty *tp, u_long return (0); case TIOCGWINSZ: /* Obtain window size. */ - memcpy(data, &tp->t_winsize, sizeof(struct winsize)); + *(struct winsize*)data = tp->t_winsize; return (0); case TIOCSWINSZ: /* Set window size. */ if (bcmp(&tp->t_winsize, data, sizeof(struct winsize)) == 0) return (0); - memcpy(&tp->t_winsize, data, sizeof(struct winsize)); + tp->t_winsize = *(struct winsize*)data; tty_signal_pgrp(tp, SIGWINCH); return (0); case TIOCEXCL: Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Sun Mar 1 09:35:41 2009 (r189221) +++ head/sys/kern/tty_pts.c Sun Mar 1 09:50:13 2009 (r189222) @@ -310,7 +310,7 @@ ptsdev_ioctl(struct file *fp, u_long cmd case TIOCGETA: /* Obtain terminal flags through tcgetattr(). */ tty_lock(tp); - memcpy(data, &tp->t_termios, sizeof(struct termios)); + *(struct termios*)data = tp->t_termios; tty_unlock(tp); return (0); #endif /* PTS_LINUX */ From bz at FreeBSD.org Sun Mar 1 01:51:51 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Sun Mar 1 01:52:03 2009 Subject: svn commit: r189223 - head/sys/sys Message-ID: <200903010951.n219po8x037835@svn.freebsd.org> Author: bz Date: Sun Mar 1 09:51:50 2009 New Revision: 189223 URL: http://svn.freebsd.org/changeset/base/189223 Log: Add the infrastructure and expected sizeof() values for each supported architecture to implement size-guards on the vimage vnet_* structures. As CTASSERT_EQUAL() needs special compile time options we back it by CTASSERT() in the default case. Unfortunately CTASSERT() triggers first, thus add an option to allow compilation with CTASSERT_EQUAL() only. See the comments how to get new values if you trigger the assert and what to do in that case. Reviewed by: rwatson, zec (earlier versions) Modified: head/sys/sys/vimage.h Modified: head/sys/sys/vimage.h ============================================================================== --- head/sys/sys/vimage.h Sun Mar 1 09:50:13 2009 (r189222) +++ head/sys/sys/vimage.h Sun Mar 1 09:51:50 2009 (r189223) @@ -113,6 +113,79 @@ int vi_symlookup(struct kld_sym_lookup * void vnet_mod_register(const struct vnet_modinfo *); /* + * Size-guards for the vimage structures. + * If you need to update the values you MUST increment __FreeBSD_version. + * See description further down to see how to get the new values. + */ +#ifdef __amd64__ +#define SIZEOF_vnet_net 464 +#define SIZEOF_vnet_net_LINT 5144 +#define SIZEOF_vnet_inet 4160 +#define SIZEOF_vnet_inet6 8800 +#define SIZEOF_vnet_ipsec 31160 +#endif +#ifdef __arm__ +#define SIZEOF_vnet_net 236 +#define SIZEOF_vnet_net_LINT 1 /* No LINT kernel yet. */ +#define SIZEOF_vnet_inet 2396 +#define SIZEOF_vnet_inet6 8536 +#define SIZEOF_vnet_ipsec 1 +#endif +#ifdef __i386__ /* incl. pc98 */ +#define SIZEOF_vnet_net 236 +#define SIZEOF_vnet_net_LINT 2576 +#define SIZEOF_vnet_inet 2396 +#define SIZEOF_vnet_inet6 8528 +#define SIZEOF_vnet_ipsec 31016 +#endif +#ifdef __ia64__ +#define SIZEOF_vnet_net 464 +#define SIZEOF_vnet_net_LINT 5144 +#define SIZEOF_vnet_inet 4160 +#define SIZEOF_vnet_inet6 8800 +#define SIZEOF_vnet_ipsec 31160 +#endif +#ifdef __mips__ +#define SIZEOF_vnet_net 236 +#define SIZEOF_vnet_net_LINT 1 /* No LINT kernel yet. */ +#define SIZEOF_vnet_inet 2432 +#define SIZEOF_vnet_inet6 8552 +#define SIZEOF_vnet_ipsec 1 +#endif +#ifdef __powerpc__ +#define SIZEOF_vnet_net 236 +#define SIZEOF_vnet_net_LINT 2576 +#define SIZEOF_vnet_inet 2432 +#define SIZEOF_vnet_inet6 8536 +#define SIZEOF_vnet_ipsec 31048 +#endif +#ifdef __sparc64__ /* incl. sun4v */ +#define SIZEOF_vnet_net 464 +#define SIZEOF_vnet_net_LINT 5144 +#define SIZEOF_vnet_inet 4160 +#define SIZEOF_vnet_inet6 8800 +#define SIZEOF_vnet_ipsec 31160 +#endif + +#ifdef COMPILING_LINT +#undef SIZEOF_vnet_net +#define SIZEOF_vnet_net SIZEOF_vnet_net_LINT +#endif + +#ifndef SIZEOF_vnet_net +#error "SIZEOF_vnet_net no defined for this architecture." +#endif +#ifndef SIZEOF_vnet_inet +#error "SIZEOF_vnet_inet no defined for this architecture." +#endif +#ifndef SIZEOF_vnet_inet6 +#error "SIZEOF_vnet_inet6 no defined for this architecture." +#endif +#ifndef SIZEOF_vnet_ipsec +#error "SIZEOF_vnet_ipsec no defined for this architecture." +#endif + +/* * x must be a positive integer constant (expected value), * y must be compile-time evaluated to a positive integer, * e.g. CTASSERT_EQUAL(FOO_EXPECTED_SIZE, sizeof (struct foo)); @@ -136,4 +209,30 @@ void vnet_mod_register(const struct vnet } \ struct __hack +/* + * x shall be the expected value (SIZEOF_vnet_* from above) + * and y shall be the real size (sizeof(struct vnet_*)). + * If you run into the CTASSERT() you want to compile a universe + * with COPTFLAGS+="-O -Wuninitialized -DVIMAGE_CHECK_SIZES". + * This should give you the errors for the proper values defined above. + * Make sure to re-run universe with the proper values afterwards - + * -DMAKE_JUST_KERNELS should be enough. + * + * Note: + * CTASSERT() takes precedence in the current FreeBSD world thus the + * CTASSERT_EQUAL() will not neccessarily trigger if one uses both. + * But as CTASSERT_EQUAL() needs special compile time options, we + * want the default case to be backed by CTASSERT(). + */ +#ifndef VIMAGE_CTASSERT +#ifdef VIMAGE_CHECK_SIZES +#define VIMAGE_CTASSERT(x, y) \ + CTASSERT_EQUAL(x, y) +#else +#define VIMAGE_CTASSERT(x, y) \ + CTASSERT_EQUAL(x, y); \ + CTASSERT(x == 0 || x == y) +#endif +#endif + #endif /* !_SYS_VIMAGE_H_ */ From peterjeremy at optushome.com.au Sun Mar 1 02:22:30 2009 From: peterjeremy at optushome.com.au (Peter Jeremy) Date: Sun Mar 1 02:22:37 2009 Subject: svn commit: r189109 - head/gnu/games In-Reply-To: <20090227160618.GF19161@hoeg.nl> References: <200902271601.n1RG1eLE074671@svn.freebsd.org> <20090227160618.GF19161@hoeg.nl> Message-ID: <20090301102201.GC3540@server.vk2pj.dyndns.org> On 2009-Feb-27 17:06:18 +0100, Ed Schouten wrote: >* Ed Schouten wrote: >> Remove empty directory structure. > >Hmmmm... Looks like there are many more: ... > contrib/groff/addftinfo > contrib/groff/afmtodit > contrib/groff/eqn > contrib/groff/grn > contrib/groff/grodvi > contrib/groff/groff > contrib/groff/grog > contrib/groff/grohtml > contrib/groff/grolbp > contrib/groff/grolj4 > contrib/groff/grops > contrib/groff/grotty > contrib/groff/hpftodit > contrib/groff/include > contrib/groff/indxbib > contrib/groff/libbib > contrib/groff/libdriver > contrib/groff/libgroff > contrib/groff/lkbib > contrib/groff/lookbib > contrib/groff/mm/examples > contrib/groff/mm/mm > contrib/groff/nroff > contrib/groff/pfbtops > contrib/groff/pic > contrib/groff/refer > contrib/groff/soelim > contrib/groff/src/xditview > contrib/groff/tbl > contrib/groff/tfmtodit > contrib/groff/troff > contrib/groff/xditview Looking in the CVS repo, it looks like the files in these directories were all removed in the vendor branch of the groff v1.17 import but not from the trunk. This occurred in 2001 (ie well before the SVN conversion) so those directories are empty in head. I suspect something similar is true of the other directories. -- Peter Jeremy -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090301/9c07a845/attachment.pgp From trasz at FreeBSD.org Sun Mar 1 02:51:35 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Sun Mar 1 02:51:53 2009 Subject: svn commit: r189224 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern Message-ID: <200903011051.n21ApYYP041203@svn.freebsd.org> Author: trasz Date: Sun Mar 1 10:51:34 2009 New Revision: 189224 URL: http://svn.freebsd.org/changeset/base/189224 Log: MFC r174937 by imp. Reviewed by: imp Approved by: rwatson (mentor) Original commit log: A partial solution to some of the 'pull the umass device with a mounted FS' problems. These are more along the lines of 'avoiding an avoidable panic' than a complete solution to removable devices. We now close the barn door after the horse has gotten lose and has been hit by a truck, as it were. The barn no longer catches fire in this case, but the horse is still dead :-). The vfs_bio.c fix causes us not to put a failed write back into the dirty pool if the error returned was ENXIO. In that case, the buffer is treated like any other clean buffer that's being retured. ENXIO means the device isn't there anymore and will never be there again in the future, so retrying is futile. The vfs_mount.c fix treats 'ENXIO' as success for unmounting a file system. If the device is gone, retrying later won't help and we'll never be able to unmount the device. These two are part of a larger patch set submitted by the author. The other patches will be forth coming. I added comments to these two patches. Submitted by: Henrik Gulbrandsen Reviewed by: phk@ PR: usb/46176 (partial) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/vfs_bio.c stable/7/sys/kern/vfs_mount.c Modified: stable/7/sys/kern/vfs_bio.c ============================================================================== --- stable/7/sys/kern/vfs_bio.c Sun Mar 1 09:51:50 2009 (r189223) +++ stable/7/sys/kern/vfs_bio.c Sun Mar 1 10:51:34 2009 (r189224) @@ -1170,6 +1170,7 @@ brelse(struct buf *bp) if (bp->b_iocmd == BIO_WRITE && (bp->b_ioflags & BIO_ERROR) && + bp->b_error != ENXIO && !(bp->b_flags & B_INVAL)) { /* * Failed write, redirty. Must clear BIO_ERROR to prevent @@ -1177,6 +1178,9 @@ brelse(struct buf *bp) * this case is not run and the next case is run to * destroy the buffer. B_INVAL can occur if the buffer * is outside the range supported by the underlying device. + * If the error is that the device went away (ENXIO), we + * shouldn't redirty the buffer either, but discard the + * data too. */ bp->b_ioflags &= ~BIO_ERROR; bdirty(bp); Modified: stable/7/sys/kern/vfs_mount.c ============================================================================== --- stable/7/sys/kern/vfs_mount.c Sun Mar 1 09:51:50 2009 (r189223) +++ stable/7/sys/kern/vfs_mount.c Sun Mar 1 10:51:34 2009 (r189224) @@ -1293,8 +1293,13 @@ dounmount(mp, flags, td) error = VFS_UNMOUNT(mp, flags, td); } vn_finished_write(mp); - if (error) { - /* Undo cdir/rdir and rootvnode changes made above. */ + /* + * If we failed to flush the dirty blocks for this mount point, + * undo all the cdir/rdir and rootvnode changes we made above. + * Unless we failed to do so because the device is reporting that + * it doesn't exist anymore. + */ + if (error && error != ENXIO) { if ((flags & MNT_FORCE) && VFS_ROOT(mp, LK_EXCLUSIVE, &fsrootvp, td) == 0) { if (mp->mnt_vnodecovered != NULL) From bz at FreeBSD.org Sun Mar 1 03:01:02 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Sun Mar 1 03:01:09 2009 Subject: svn commit: r189225 - in head/sys: net netinet netinet6 netipsec Message-ID: <200903011101.n21B11eV041462@svn.freebsd.org> Author: bz Date: Sun Mar 1 11:01:00 2009 New Revision: 189225 URL: http://svn.freebsd.org/changeset/base/189225 Log: Add size-guards evaluated at compile-time to the main struct vnet_* which are not in a module of their own like gif. Single kernel compiles and universe will fail if the size of the struct changes. Th expected values are given in sys/vimage.h. See the comments where how to handle this. Requested by: peter Modified: head/sys/net/vnet.h head/sys/netinet/vinet.h head/sys/netinet6/vinet6.h head/sys/netipsec/vipsec.h Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Sun Mar 1 10:51:34 2009 (r189224) +++ head/sys/net/vnet.h Sun Mar 1 11:01:00 2009 (r189225) @@ -56,6 +56,9 @@ struct vnet_net { int _ether_ipfw; }; +/* Size guard. See sys/vimage.h. */ +VIMAGE_CTASSERT(SIZEOF_vnet_net, sizeof(struct vnet_net)); + #ifndef VIMAGE #ifndef VIMAGE_GLOBALS extern struct vnet_net vnet_net_0; Modified: head/sys/netinet/vinet.h ============================================================================== --- head/sys/netinet/vinet.h Sun Mar 1 10:51:34 2009 (r189224) +++ head/sys/netinet/vinet.h Sun Mar 1 11:01:00 2009 (r189225) @@ -196,6 +196,9 @@ struct vnet_inet { int _fw_one_pass; }; +/* Size guard. See sys/vimage.h. */ +VIMAGE_CTASSERT(SIZEOF_vnet_inet, sizeof(struct vnet_inet)); + #ifndef VIMAGE #ifndef VIMAGE_GLOBALS extern struct vnet_inet vnet_inet_0; Modified: head/sys/netinet6/vinet6.h ============================================================================== --- head/sys/netinet6/vinet6.h Sun Mar 1 10:51:34 2009 (r189224) +++ head/sys/netinet6/vinet6.h Sun Mar 1 11:01:00 2009 (r189225) @@ -155,6 +155,9 @@ struct vnet_inet6 { struct ip6_pktopts _ip6_opts; }; +/* Size guard. See sys/vimage.h. */ +VIMAGE_CTASSERT(SIZEOF_vnet_inet6, sizeof(struct vnet_inet6)); + #ifndef VIMAGE #ifndef VIMAGE_GLOBALS extern struct vnet_inet6 vnet_inet6_0; Modified: head/sys/netipsec/vipsec.h ============================================================================== --- head/sys/netipsec/vipsec.h Sun Mar 1 10:51:34 2009 (r189224) +++ head/sys/netipsec/vipsec.h Sun Mar 1 11:01:00 2009 (r189225) @@ -107,6 +107,9 @@ struct vnet_ipsec { LIST_HEAD(, secspacq) _spacqtree; }; +/* Size guard. See sys/vimage.h. */ +VIMAGE_CTASSERT(SIZEOF_vnet_ipsec, sizeof(struct vnet_ipsec)); + #ifndef VIMAGE #ifndef VIMAGE_GLOBALS extern struct vnet_ipsec vnet_ipsec_0; From trasz at FreeBSD.org Sun Mar 1 03:02:39 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Sun Mar 1 03:02:51 2009 Subject: svn commit: r189226 - in stable/7: share/man/man9 sys sys/contrib/pf sys/dev/cxgb sys/fs/hpfs sys/fs/msdosfs sys/fs/ntfs sys/fs/nwfs sys/fs/smbfs sys/gnu/fs/ext2fs sys/gnu/fs/reiserfs sys/gnu/fs/xf... Message-ID: <200903011102.n21B2b6G041531@svn.freebsd.org> Author: trasz Date: Sun Mar 1 11:02:37 2009 New Revision: 189226 URL: http://svn.freebsd.org/changeset/base/189226 Log: MFC r186194: According to phk@, VOP_STRATEGY should never, _ever_, return anything other than 0. Make it so. This fixes "panic: VOP_STRATEGY failed bp=0xc320dd90 vp=0xc3b9f648", encountered when writing to an orphaned filesystem. Reason for the panic was the following assert: KASSERT(i == 0, ("VOP_STRATEGY failed bp=%p vp=%p", bp, bp->b_vp)); at vfs_bio:bufstrategy(). Reviewed by: scottl, phk Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/share/man/man9/ (props changed) stable/7/share/man/man9/VOP_STRATEGY.9 stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/fs/hpfs/hpfs_vnops.c stable/7/sys/fs/msdosfs/msdosfs_vnops.c stable/7/sys/fs/ntfs/ntfs_vnops.c stable/7/sys/fs/nwfs/nwfs_vnops.c stable/7/sys/fs/smbfs/smbfs_vnops.c stable/7/sys/gnu/fs/ext2fs/ext2_vnops.c stable/7/sys/gnu/fs/reiserfs/reiserfs_vnops.c stable/7/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c stable/7/sys/ufs/ufs/ufs_vnops.c Modified: stable/7/share/man/man9/VOP_STRATEGY.9 ============================================================================== --- stable/7/share/man/man9/VOP_STRATEGY.9 Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/share/man/man9/VOP_STRATEGY.9 Sun Mar 1 11:02:37 2009 (r189226) @@ -53,7 +53,9 @@ This call either reads or writes data fr .Pp The call may block. .Sh RETURN VALUES -Zero is returned on success, otherwise an error is returned. +Always zero. +Errors should be signalled by setting BIO_ERROR on b_ioflags field in struct buf, +and setting b_error to the appropriate errno value. .Sh SEE ALSO .\" .Xr buf 9 , .Xr vnode 9 Modified: stable/7/sys/fs/hpfs/hpfs_vnops.c ============================================================================== --- stable/7/sys/fs/hpfs/hpfs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/fs/hpfs/hpfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -663,7 +663,7 @@ hpfs_strategy(ap) bp->b_error = error; bp->b_ioflags |= BIO_ERROR; bufdone(bp); - return (error); + return (0); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); Modified: stable/7/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- stable/7/sys/fs/msdosfs/msdosfs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/fs/msdosfs/msdosfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -1880,7 +1880,7 @@ msdosfs_strategy(ap) bp->b_error = error; bp->b_ioflags |= BIO_ERROR; bufdone(bp); - return (error); + return (0); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); Modified: stable/7/sys/fs/ntfs/ntfs_vnops.c ============================================================================== --- stable/7/sys/fs/ntfs/ntfs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/fs/ntfs/ntfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -339,7 +339,7 @@ ntfs_strategy(ap) } } bufdone(bp); - return (error); + return (0); } static int Modified: stable/7/sys/fs/nwfs/nwfs_vnops.c ============================================================================== --- stable/7/sys/fs/nwfs/nwfs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/fs/nwfs/nwfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -807,7 +807,7 @@ static int nwfs_strategy (ap) */ if ((bp->b_flags & B_ASYNC) == 0 ) error = nwfs_doio(ap->a_vp, bp, cr, td); - return (error); + return (0); } Modified: stable/7/sys/fs/smbfs/smbfs_vnops.c ============================================================================== --- stable/7/sys/fs/smbfs/smbfs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/fs/smbfs/smbfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -864,7 +864,7 @@ smbfs_strategy (ap) if ((bp->b_flags & B_ASYNC) == 0 ) error = smbfs_doio(ap->a_vp, bp, cr, td); - return error; + return (0); } int Modified: stable/7/sys/gnu/fs/ext2fs/ext2_vnops.c ============================================================================== --- stable/7/sys/gnu/fs/ext2fs/ext2_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/gnu/fs/ext2fs/ext2_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -1408,7 +1408,7 @@ ext2_strategy(ap) bp->b_error = error; bp->b_ioflags |= BIO_ERROR; bufdone(bp); - return (error); + return (0); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); Modified: stable/7/sys/gnu/fs/reiserfs/reiserfs_vnops.c ============================================================================== --- stable/7/sys/gnu/fs/reiserfs/reiserfs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/gnu/fs/reiserfs/reiserfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -350,8 +350,13 @@ reiserfs_strategy(struct vop_strategy_ar bp->b_ioflags |= BIO_ERROR; } + if (error) { + bp->b_ioflags |= BIO_ERROR; + bp->b_error = error; + } + bufdone(bp); - return (error); + return (0); } /* Modified: stable/7/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c ============================================================================== --- stable/7/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -1138,7 +1138,7 @@ _xfs_strategy( bp->b_error = error; bp->b_ioflags |= BIO_ERROR; bufdone(bp); - return (error); + return (0); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); Modified: stable/7/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/7/sys/ufs/ufs/ufs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/ufs/ufs/ufs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -2015,7 +2015,7 @@ ufs_strategy(ap) bp->b_error = error; bp->b_ioflags |= BIO_ERROR; bufdone(bp); - return (error); + return (0); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); From bz at FreeBSD.org Sun Mar 1 03:10:07 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Sun Mar 1 03:10:14 2009 Subject: svn commit: r186057 - head/sys/netinet In-Reply-To: References: <200812132159.mBDLxIQv040799@svn.freebsd.org> Message-ID: <20090301101142.V96785@maildrop.int.zabbadoz.net> On Tue, 16 Dec 2008, Peter Wemm wrote: > On Sat, Dec 13, 2008 at 1:59 PM, Bjoern A. Zeeb wrote: >> De-virtualize the MD5 context for TCP initial seq number generation >> and make it a function local variable like we do almost everywhere >> inside the kernel. > [..] >> --- head/sys/netinet/vinet.h Sat Dec 13 21:17:46 2008 (r186056) >> +++ head/sys/netinet/vinet.h Sat Dec 13 21:59:18 2008 (r186057) >> @@ -142,7 +142,6 @@ struct vnet_inet { ... > I'm bitterly unhappy with this. Every time these structs are touched, > either directly or indirectly, there is a guaranteed ABI breakage with > kernel modules. > > There needs to be a __FreeBSD_version bump (or something similar) > every time any of these structures change, and any kernel modules > *must* be prevented from loading. It can't be a >= some version, it > has to be an exact match. ... > In the mean time, I'd like to see some compile-time asserts in there > to make sure there are no accidental size changes of this structure. This has finally happened, thanks to Juli Mallett now finding a good CTASSERT-a-like way that also prints the expected and the actual size. Without that I had found it was impossible to get the proper values for all architectures we support to be able to (cross) build or finish a universe when trying to implement this end of last year. /bz -- Bjoern A. Zeeb The greatest risk is not taking one. From trasz at FreeBSD.org Sun Mar 1 03:11:16 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Sun Mar 1 03:11:27 2009 Subject: svn commit: r189227 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb fs/devfs Message-ID: <200903011111.n21BBFCD041749@svn.freebsd.org> Author: trasz Date: Sun Mar 1 11:11:14 2009 New Revision: 189227 URL: http://svn.freebsd.org/changeset/base/189227 Log: MFC r186911: Don't panic with "vinvalbuf: dirty bufs" when the mounted device that was being written to goes away. Reviewed by: kib, scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/fs/devfs/devfs_vnops.c Modified: stable/7/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/7/sys/fs/devfs/devfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) +++ stable/7/sys/fs/devfs/devfs_vnops.c Sun Mar 1 11:11:14 2009 (r189227) @@ -481,12 +481,28 @@ devfs_close_f(struct file *fp, struct th return (error); } -/* ARGSUSED */ static int devfs_fsync(struct vop_fsync_args *ap) { - if (!vn_isdisk(ap->a_vp, NULL)) + int error; + struct bufobj *bo; + struct devfs_dirent *de; + + if (!vn_isdisk(ap->a_vp, &error)) { + bo = &ap->a_vp->v_bufobj; + de = ap->a_vp->v_data; + if (error == ENXIO && bo->bo_dirty.bv_cnt > 0) { + printf("Device %s went missing before all of the data " + "could be written to it; expect data loss.\n", + de->de_dirent->d_name); + + error = vop_stdfsync(ap); + if (bo->bo_dirty.bv_cnt != 0 || error != 0) + panic("devfs_fsync: vop_stdfsync failed."); + } + return (0); + } return (vop_stdfsync(ap)); } From trasz at FreeBSD.org Sun Mar 1 03:17:39 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Sun Mar 1 03:17:56 2009 Subject: svn commit: r189228 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb fs/msdosfs Message-ID: <200903011117.n21BHdnY041897@svn.freebsd.org> Author: trasz Date: Sun Mar 1 11:17:38 2009 New Revision: 189228 URL: http://svn.freebsd.org/changeset/base/189228 Log: MFC r187199: Turn a "panic: non-decreasing id" into an error printf. This seems to be caused by a metadata corruption that occurs quite often after unplugging a pendrive during write activity. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/fs/msdosfs/msdosfs_conv.c Modified: stable/7/sys/fs/msdosfs/msdosfs_conv.c ============================================================================== --- stable/7/sys/fs/msdosfs/msdosfs_conv.c Sun Mar 1 11:11:14 2009 (r189227) +++ stable/7/sys/fs/msdosfs/msdosfs_conv.c Sun Mar 1 11:17:38 2009 (r189228) @@ -1060,8 +1060,11 @@ mbnambuf_write(struct mbnambuf *nbp, cha char *slot; size_t count, newlen; - KASSERT(nbp->nb_len == 0 || id == nbp->nb_last_id - 1, - ("non-decreasing id: id %d, last id %d", id, nbp->nb_last_id)); + if (nbp->nb_len != 0 && id != nbp->nb_last_id - 1) { + printf("msdosfs: non-decreasing id: id %d, last id %d\n", + id, nbp->nb_last_id); + return; + } /* Will store this substring in a WIN_CHARS-aligned slot. */ slot = &nbp->nb_buf[id * WIN_CHARS]; From trasz at FreeBSD.org Sun Mar 1 03:20:37 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Sun Mar 1 03:20:53 2009 Subject: svn commit: r189229 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb ufs/ffs Message-ID: <200903011120.n21BKZOQ041999@svn.freebsd.org> Author: trasz Date: Sun Mar 1 11:20:35 2009 New Revision: 189229 URL: http://svn.freebsd.org/changeset/base/189229 Log: MFC r188240: When a device containing mounted UFS filesystem disappears, the type of devvp becomes VBAD, which UFS incorrectly interprets as snapshot vnode, which in turns causes panic. Fix it by replacing '!= VCHR' with '== VREG'. With this fix in place, you should no longer be able to panic the system by removing a device with an UFS filesystem mounted from it - assuming you don't use softupdates. Reviewed by: kib Tested by: pho Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/ufs/ffs/ffs_alloc.c Modified: stable/7/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_alloc.c Sun Mar 1 11:17:38 2009 (r189228) +++ stable/7/sys/ufs/ffs/ffs_alloc.c Sun Mar 1 11:20:35 2009 (r189229) @@ -1858,7 +1858,7 @@ ffs_blkfree(ump, fs, devvp, bno, size, i struct cdev *dev; cg = dtog(fs, bno); - if (devvp->v_type != VCHR) { + if (devvp->v_type == VREG) { /* devvp is a snapshot */ dev = VTOI(devvp)->i_devvp->v_rdev; cgblkno = fragstoblks(fs, cgtod(fs, cg)); @@ -1903,7 +1903,7 @@ ffs_blkfree(ump, fs, devvp, bno, size, i if (size == fs->fs_bsize) { fragno = fragstoblks(fs, cgbno); if (!ffs_isfreeblock(fs, blksfree, fragno)) { - if (devvp->v_type != VCHR) { + if (devvp->v_type == VREG) { UFS_UNLOCK(ump); /* devvp is a snapshot */ brelse(bp); @@ -2056,7 +2056,7 @@ ffs_freefile(ump, fs, devvp, ino, mode) struct cdev *dev; cg = ino_to_cg(fs, ino); - if (devvp->v_type != VCHR) { + if (devvp->v_type == VREG) { /* devvp is a snapshot */ dev = VTOI(devvp)->i_devvp->v_rdev; cgbno = fragstoblks(fs, cgtod(fs, cg)); @@ -2122,7 +2122,7 @@ ffs_checkfreefile(fs, devvp, ino) u_int8_t *inosused; cg = ino_to_cg(fs, ino); - if (devvp->v_type != VCHR) { + if (devvp->v_type == VREG) { /* devvp is a snapshot */ cgbno = fragstoblks(fs, cgtod(fs, cg)); } else { From rwatson at FreeBSD.org Sun Mar 1 04:42:57 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Mar 1 04:43:10 2009 Subject: svn commit: r189230 - head/sys/net Message-ID: <200903011242.n21CgsV1043573@svn.freebsd.org> Author: rwatson Date: Sun Mar 1 12:42:54 2009 New Revision: 189230 URL: http://svn.freebsd.org/changeset/base/189230 Log: Do a bit of struct ifnet cleanup in preparation for 8.0: group function pointers together, move padding to the bottom of the structure, and add two new integer spares due to attrition over time. Remove unused spare "flags" field, we can use one of the spare ints if we need it later. This change requires a rebuild of device driver modules that depend on the layout of ifnet for binary compatibility reasons. Discussed with: kmacy Modified: head/sys/net/if_var.h Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Sun Mar 1 11:20:35 2009 (r189229) +++ head/sys/net/if_var.h Sun Mar 1 12:42:54 2009 (r189230) @@ -162,10 +162,13 @@ struct ifnet { (void *); int (*if_resolvemulti) /* validate/resolve multicast */ (struct ifnet *, struct sockaddr **, struct sockaddr *); + void (*if_qflush) /* flush any queues */ + (struct ifnet *); + int (*if_transmit) /* initiate output routine */ + (struct ifnet *, struct mbuf *); struct ifaddr *if_addr; /* pointer to link-level address */ void *if_llsoftc; /* link layer softc */ int if_drv_flags; /* driver-managed status flags */ - u_int if_spare_flags2; /* spare flags 2 */ struct ifaltq if_snd; /* output queue (includes altq) */ const u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */ @@ -187,12 +190,14 @@ struct ifnet { /* protected by if_addr_mtx */ void *if_pf_kif; void *if_lagg; /* lagg glue */ - void *if_pspare[8]; /* TOE 3; vimage 3; general use 4 */ - void (*if_qflush) /* flush any queues */ - (struct ifnet *); - int (*if_transmit) /* initiate output routine */ - (struct ifnet *, struct mbuf *); - int if_ispare[2]; /* general use 2 */ + + /* + * Spare fields are added so that we can modify sensitive data + * structures without changing the kernel binary interface, and must + * be used with care where binary compatibility is required. + */ + void *if_pspare[8]; + int if_ispare[4]; }; typedef void if_init_f_t(void *); From rwatson at FreeBSD.org Sun Mar 1 04:44:34 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Mar 1 04:44:41 2009 Subject: svn commit: r189231 - head Message-ID: <200903011244.n21CiX26043659@svn.freebsd.org> Author: rwatson Date: Sun Mar 1 12:44:33 2009 New Revision: 189231 URL: http://svn.freebsd.org/changeset/base/189231 Log: Note that network device driver modules need rebuilding. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Mar 1 12:42:54 2009 (r189230) +++ head/UPDATING Sun Mar 1 12:44:33 2009 (r189231) @@ -22,6 +22,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20090301: + The layout of struct ifnet has changed, requiring a rebuild of all + network device driver modules. + 20090227: The /dev handling for the new USB stack has changed, a buildworld/installworld is required for libusb20. From rizzo at iet.unipi.it Sun Mar 1 05:18:55 2009 From: rizzo at iet.unipi.it (Luigi Rizzo) Date: Sun Mar 1 05:19:06 2009 Subject: svn commit: r189230 - head/sys/net In-Reply-To: <200903011242.n21CgsV1043573@svn.freebsd.org> References: <200903011242.n21CgsV1043573@svn.freebsd.org> Message-ID: <20090301132350.GB54337@onelab2.iet.unipi.it> On Sun, Mar 01, 2009 at 12:42:54PM +0000, Robert Watson wrote: > Author: rwatson > Date: Sun Mar 1 12:42:54 2009 > New Revision: 189230 > URL: http://svn.freebsd.org/changeset/base/189230 > > Log: > Do a bit of struct ifnet cleanup in preparation for 8.0: group function > pointers together, move padding to the bottom of the structure, and add > two new integer spares due to attrition over time. Remove unused spare > "flags" field, we can use one of the spare ints if we need it later. > > This change requires a rebuild of device driver modules that depend on > the layout of ifnet for binary compatibility reasons. any chance to do similar things for other key kernel structures, such as mbufs and struct bio ? As an example, "struct bio" would benefit from at least one extra intptr_t field to be used for classification purposes (see some recent work we have been doing on disk scheduling). This is a rather trivial and unintrusive change. struct mbuf would benefit from a 'length' field, replacing the hardcoded MLEN/MHLEN. This field would allow us to do several things, e.g.: - use part of the data area to store m_tags instead of having to malloc() them separately; - support multiple (or perhaps even runtime-configurable) mbuf sizes (and corresponding uma zones), so people could experiment with larger MBUFS and perhaps figure out what is the performance impact of using mbuf+clusters instead of individual mbufs for basically every incoming packet. cheers luigi From rwatson at FreeBSD.org Sun Mar 1 05:33:50 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Mar 1 05:33:57 2009 Subject: svn commit: r189230 - head/sys/net In-Reply-To: <20090301132350.GB54337@onelab2.iet.unipi.it> References: <200903011242.n21CgsV1043573@svn.freebsd.org> <20090301132350.GB54337@onelab2.iet.unipi.it> Message-ID: On Sun, 1 Mar 2009, Luigi Rizzo wrote: > On Sun, Mar 01, 2009 at 12:42:54PM +0000, Robert Watson wrote: >> Author: rwatson >> Date: Sun Mar 1 12:42:54 2009 >> New Revision: 189230 >> URL: http://svn.freebsd.org/changeset/base/189230 >> >> Log: >> Do a bit of struct ifnet cleanup in preparation for 8.0: group function >> pointers together, move padding to the bottom of the structure, and add >> two new integer spares due to attrition over time. Remove unused spare >> "flags" field, we can use one of the spare ints if we need it later. >> >> This change requires a rebuild of device driver modules that depend on >> the layout of ifnet for binary compatibility reasons. > > any chance to do similar things for other key kernel structures, such as > mbufs and struct bio ? > > As an example, "struct bio" would benefit from at least one extra intptr_t > field to be used for classification purposes (see some recent work we have > been doing on disk scheduling). This is a rather trivial and unintrusive > change. > > struct mbuf would benefit from a 'length' field, replacing the hardcoded > MLEN/MHLEN. This field would allow us to do several things, e.g.: Jeff has a large work-in-progress on mbufs, and so I don't want to go near that until all that work has shaken out. This includes support for variable-size mbufs and eliminating large amounts of cluster use (while retaining support for external storage, a we require that for zero-copy foo). If you haven't seen his posts about that work, you might want to give them a skim -- I think they were on arch@/net@. I thought bio was less sensitive to change since it was centrally allocated these days, or is that not the case? ifnet is decreasingly sensitive. Robert N M Watson Computer Laboratory University of Cambridge > - use part of the data area to store m_tags instead of having > to malloc() them separately; > - support multiple (or perhaps even runtime-configurable) mbuf sizes > (and corresponding uma zones), so people could experiment with > larger MBUFS and perhaps figure out what is the performance impact > of using mbuf+clusters instead of individual mbufs for basically > every incoming packet. > > cheers > luigi > From dchagin at FreeBSD.org Sun Mar 1 06:26:25 2009 From: dchagin at FreeBSD.org (Dmitry Chagin) Date: Sun Mar 1 06:26:31 2009 Subject: svn commit: r189232 - head/sys/kern Message-ID: <200903011426.n21EQOdp045591@svn.freebsd.org> Author: dchagin Date: Sun Mar 1 14:26:24 2009 New Revision: 189232 URL: http://svn.freebsd.org/changeset/base/189232 Log: Fix range-check error introduced in r182292. Also do not do anything if all processors in the map are not available, simply return. Approved by: kib (mentor) MFC after: 1 week Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Sun Mar 1 12:44:33 2009 (r189231) +++ head/sys/kern/subr_smp.c Sun Mar 1 14:26:24 2009 (r189232) @@ -362,9 +362,11 @@ smp_rendezvous_cpus(cpumask_t map, return; } - for (i = 0; i < mp_maxid; i++) + for (i = 0; i <= mp_maxid; i++) if (((1 << i) & map) != 0 && !CPU_ABSENT(i)) ncpus++; + if (ncpus == 0) + return; /* obtain rendezvous lock */ mtx_lock_spin(&smp_ipi_mtx); From rizzo at iet.unipi.it Sun Mar 1 06:27:56 2009 From: rizzo at iet.unipi.it (Luigi Rizzo) Date: Sun Mar 1 06:28:06 2009 Subject: svn commit: r189230 - head/sys/net In-Reply-To: References: <200903011242.n21CgsV1043573@svn.freebsd.org> <20090301132350.GB54337@onelab2.iet.unipi.it> Message-ID: <20090301143250.GA57294@onelab2.iet.unipi.it> On Sun, Mar 01, 2009 at 01:33:49PM +0000, Robert Watson wrote: > On Sun, 1 Mar 2009, Luigi Rizzo wrote: ... > >any chance to do similar things for other key kernel structures, such as > >mbufs and struct bio ? > > > >As an example, "struct bio" would benefit from at least one extra intptr_t > >field to be used for classification purposes (see some recent work we have > >been doing on disk scheduling). This is a rather trivial and unintrusive > >change. > > > >struct mbuf would benefit from a 'length' field, replacing the hardcoded > >MLEN/MHLEN. This field would allow us to do several things, e.g.: > > Jeff has a large work-in-progress on mbufs, and so I don't want to go near > that until all that work has shaken out. This includes support for > variable-size mbufs and eliminating large amounts of cluster use (while > retaining support for external storage, a we require that for zero-copy > foo). If you haven't seen his posts about that work, you might want to give > them a skim -- I think they were on arch@/net@. ok thanks -- i did not see the posts but the things you explain are perfectly in sync with what I had in mind. > I thought bio was less sensitive to change since it was centrally allocated > these days, or is that not the case? you are probably right, probably it's just the case to add the field at the end so binary geom modules will not be affected by the change. cheers luigi From sos at FreeBSD.org Sun Mar 1 06:44:04 2009 From: sos at FreeBSD.org (Søren Schmidt) Date: Sun Mar 1 06:44:10 2009 Subject: svn commit: r189233 - head Message-ID: <200903011444.n21Ei3Ma046016@svn.freebsd.org> Author: sos Date: Sun Mar 1 14:44:03 2009 New Revision: 189233 URL: http://svn.freebsd.org/changeset/base/189233 Log: Remove self. Modified: head/MAINTAINERS Modified: head/MAINTAINERS ============================================================================== --- head/MAINTAINERS Sun Mar 1 14:26:24 2009 (r189232) +++ head/MAINTAINERS Sun Mar 1 14:44:03 2009 (r189233) @@ -29,7 +29,6 @@ MAC Framework rwatson Pre-commit review MAC Modules rwatson Pre-commit review requested. contrib/openbsm rwatson Pre-commit review requested. sys/security/audit rwatson Pre-commit review requested. -ATA/IDE sos Pre-commit review requested. ahc(4) gibbs Pre-commit review requested. ahd(4) gibbs Pre-commit review requested. NEWCARD imp Pre-commit review requested. From luigi at FreeBSD.org Sun Mar 1 06:51:08 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Sun Mar 1 06:51:14 2009 Subject: svn commit: r189234 - head/release/picobsd/bridge Message-ID: <200903011451.n21Ep7jE046242@svn.freebsd.org> Author: luigi Date: Sun Mar 1 14:51:07 2009 New Revision: 189234 URL: http://svn.freebsd.org/changeset/base/189234 Log: remove duplicate entries for isa and npx, they are in by default now Modified: head/release/picobsd/bridge/PICOBSD Modified: head/release/picobsd/bridge/PICOBSD ============================================================================== --- head/release/picobsd/bridge/PICOBSD Sun Mar 1 14:44:03 2009 (r189233) +++ head/release/picobsd/bridge/PICOBSD Sun Mar 1 14:51:07 2009 (r189234) @@ -45,7 +45,6 @@ options DUMMYNET device if_bridge options HZ=1000 -device isa device pci # Floppy drives @@ -68,9 +67,6 @@ device vga # VGA screen device sc -# Floating point support - do not disable. -device npx - # Serial (COM) ports device uart From luigi at FreeBSD.org Sun Mar 1 06:57:34 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Sun Mar 1 06:57:56 2009 Subject: svn commit: r189235 - stable/7/release/picobsd/bridge Message-ID: <200903011457.n21EvXB8046412@svn.freebsd.org> Author: luigi Date: Sun Mar 1 14:57:33 2009 New Revision: 189235 URL: http://svn.freebsd.org/changeset/base/189235 Log: document the possibility of hardwiring kenv/getenv values; remove duplicate isa and npx entries; remove DEVICE_POLLING add tap, bpf devices; add re and nfe drivers Modified: stable/7/release/picobsd/bridge/PICOBSD Modified: stable/7/release/picobsd/bridge/PICOBSD ============================================================================== --- stable/7/release/picobsd/bridge/PICOBSD Sun Mar 1 14:51:07 2009 (r189234) +++ stable/7/release/picobsd/bridge/PICOBSD Sun Mar 1 14:57:33 2009 (r189235) @@ -7,6 +7,10 @@ options MD_ROOT_SIZE=3200 # same as def_sz hints "PICOBSD.hints" + +# values accessible through getenv() +# env "PICOBSD.env" + cpu I486_CPU cpu I586_CPU cpu I686_CPU @@ -41,7 +45,6 @@ options DUMMYNET device if_bridge options HZ=1000 -device isa device pci # Floppy drives @@ -64,9 +67,6 @@ device vga # VGA screen device sc -# Floating point support - do not disable. -device npx - # Serial (COM) ports device sio @@ -91,8 +91,10 @@ device miibus #device de # DEC/Intel DC21x4x (``Tulip'') #device lnc device fxp # Intel EtherExpress PRO/100B (82557, 82558) +device nfe # nVidia nForce MCP on-board Ethernet #device xl # 3Com device rl # RealTek 8129/8139 +device re # RealTek 8139C+/8169/8169S/8110S device sis # National/SiS #device vx # 3Com 3c590, 3c595 (``Vortex'') #device wx # Intel Gigabit Ethernet Card (``Wiseman'') @@ -107,10 +109,10 @@ device pty # Pseudo-ttys (telnet etc) device md # Memory "disks" #device gif 4 # IPv6 and IPv4 tunneling #device faith 1 # IPv6-to-IPv4 relaying (translation) -#device tap +device tap -options DEVICE_POLLING +#options DEVICE_POLLING # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! -#device bpf # Berkeley packet filter +device bpf # Berkeley packet filter From trasz at FreeBSD.org Sun Mar 1 07:01:02 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Sun Mar 1 07:01:08 2009 Subject: svn commit: r189236 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb ufs/ffs Message-ID: <200903011501.n21F10gv046543@svn.freebsd.org> Author: trasz Date: Sun Mar 1 15:01:00 2009 New Revision: 189236 URL: http://svn.freebsd.org/changeset/base/189236 Log: MFC r187894. Note that r188501 should be merged too. Make sure the cdev doesn't go away while the filesystem is still mounted. Otherwise dev2udev() could return garbage. Reviewed by: kib Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/ufs/ffs/ffs_vfsops.c Modified: stable/7/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_vfsops.c Sun Mar 1 14:57:33 2009 (r189235) +++ stable/7/sys/ufs/ffs/ffs_vfsops.c Sun Mar 1 15:01:00 2009 (r189236) @@ -641,6 +641,7 @@ ffs_mountfs(devvp, mp, td) VOP_UNLOCK(devvp, 0, td); if (error) return (error); + dev_ref(dev); if (devvp->v_rdev->si_iosize_max != 0) mp->mnt_iosize_max = devvp->v_rdev->si_iosize_max; if (mp->mnt_iosize_max > MAXPHYS) @@ -921,6 +922,7 @@ out: free(ump, M_UFSMNT); mp->mnt_data = (qaddr_t)0; } + dev_rel(dev); return (error); } @@ -1107,6 +1109,7 @@ ffs_unmount(mp, mntflags, td) g_topology_unlock(); PICKUP_GIANT(); vrele(ump->um_devvp); + dev_rel(ump->um_dev); mtx_destroy(UFS_MTX(ump)); if (mp->mnt_gjprovider != NULL) { free(mp->mnt_gjprovider, M_UFSMNT); From luigi at FreeBSD.org Sun Mar 1 07:03:22 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Sun Mar 1 07:04:55 2009 Subject: svn commit: r189237 - stable/7/release/picobsd/build Message-ID: <200903011503.n21F38RH046613@svn.freebsd.org> Author: luigi Date: Sun Mar 1 15:03:08 2009 New Revision: 189237 URL: http://svn.freebsd.org/changeset/base/189237 Log: sync the build script with the version in -current. The most relevant changes are the building of libraries in the --init call, and the ability to use /boot/loader (on by default) which seems to be necessary for large kernels. Modified: stable/7/release/picobsd/build/picobsd Modified: stable/7/release/picobsd/build/picobsd ============================================================================== --- stable/7/release/picobsd/build/picobsd Sun Mar 1 15:01:00 2009 (r189236) +++ stable/7/release/picobsd/build/picobsd Sun Mar 1 15:03:08 2009 (r189237) @@ -21,7 +21,6 @@ # Makefile.conf Makefile used to build the kernel # config shell variables, sourced here. # mfs.mtree mtree config file -# # floppy.tree/ files which go on the floppy # mfs_tree/ files which go onto the mfs # @@ -29,10 +28,13 @@ # PICOBSD kernel config file # config shell variables, sourced here. # crunch.conf crunchgen configuration +# mfs.mtree overrides ${PICO_TREE}/mfs.mtree # floppy.tree.exclude files from floppy.tree/ which we do not need here. -# floppy.tree/ local additions to the floppy.tree +# floppy.tree/ local additions to ${PICO_TREE}/mfs_free # floppy.tree.${site}/ same as above, site specific. # mfs_tree/ local additions to the mfs_free +# buildtree.mk optional makefile to build an extension for floppy tree +# (generated in buildtree/ ) # #--- The main entry point is at the end. @@ -98,6 +100,7 @@ set_defaults() { EDITOR=${EDITOR:-vi} fd_size=${fd_size:-1440} + o_use_loader="yes" # use /boot/loader o_all_in_mfs="yes" # put all files in mfs so you can boot and run # the image via diskless boot. o_clean="" # do not clean @@ -127,6 +130,7 @@ set_defaults() { # mountpoint used to build memory filesystems c_fs=fs.PICOBSD # filename used for the memory filesystem c_img=picobsd.bin # filename used for the picobsd image + generate_iso="NO" # don't generate the iso image # select the right memory disk name case `uname -r` in @@ -146,6 +150,7 @@ set_defaults() { trap fail 15 } +# use the new build infrastructure create_includes_and_libraries2() { local no log "create_includes_and_libraries2() for ${SRC}" @@ -158,7 +163,7 @@ create_includes_and_libraries2() { export MAKEOBJDIRPREFIX ( cd ${SRC}; # make -DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R -DPICOBSD buildworld - make _+_= $no toolchain + make _+_= $no toolchain _includes _libraries ) } @@ -207,7 +212,7 @@ create_includes_and_libraries() { # set_type looks in user or system directories for the floppy type # specified as first argument, and sets variables according to the config. -# file. Sets THETYPE, SITE, name, MY_TREE and BUILDDIR +# file. Also sets MY_TREE and BUILDDIR and SITE set_type() { local a i @@ -220,17 +225,17 @@ set_type() { for i in ${c_startdir}/${a} ${PICO_TREE}/${a} ; do log "set_type: checking $i" [ -d $i -a -f $i/PICOBSD -a -f $i/crunch.conf ] || continue - set -- `cat $i/PICOBSD | \ + set -- `cat $i/PICOBSD | \ awk '/^#PicoBSD/ {print $2, $3, $4, $5, $6}'` [ x"$1" != "x" ] || continue - MFS_SIZE=$1 ; init_name=$2 - mfs_inodes=$3 ; fd_inodes=$4 - name=`(cd $i ; pwd) ` - name=`basename $name` - MY_TREE=$i - BUILDDIR=${c_startdir}/build_dir-${name} - log "Matching file $name in $i" - return ; + MFS_SIZE=$1 ; init_name=$2 + mfs_inodes=$3 ; fd_inodes=$4 + name=`(cd $i ; pwd) ` + name=`basename $name` + MY_TREE=$i + BUILDDIR=${c_startdir}/build_dir-${name} + log "Matching file $name in $i" + return ; done logverbose "Type $a NOT FOUND" } @@ -255,6 +260,13 @@ set_msgs() { # OK \t3. Site-info: ${SITE}\n\t4. Full-path: ${MY_TREE}\n" } +# build the iso image +build_iso_image() { + log "build_iso_image()" + clear + set_msgs + printf "${MSG}---> Build the iso image not ready yet\n\n" +} # Main build procedure. build_image() { @@ -307,10 +319,6 @@ build_package() { echo "##############################################" >>build.status for z in bridge dial router net isp ; do set_type ${z} - if [ "${name}" = "" ] ; then - echo "*** TYPE=${z} not found" >>build.status - continue - fi echo "---------------------------------------------">>build.status echo "Building TYPE=${z}, SIZE=${MFS_SIZE}" >>build.status msg="(ok)" # error message @@ -484,10 +492,10 @@ populate_floppy_fs() { # OK dst=${BUILDDIR}/floppy.tree log "pwd=`pwd` Populating floppy filesystem..." - # clean relics from old compilations. - rm -rf ${dst} || true - mkdir ${dst} + rm -rf ${dst} || true # clean relics from old compilations. + mkdir ${dst} # create a clean tree + # compute exclude list for generic tree excl=${MY_TREE}/floppy.tree.exclude if [ -f ${excl} ] ; then log "Files excluded from generic tree: `echo;cat ${excl}`" @@ -495,29 +503,26 @@ populate_floppy_fs() { # OK else excl="" fi - (cd ${PICO_TREE}/floppy.tree ; tar -cf - --exclude CVS --exclude .svn \ - ${excl} . ) | \ + # copy from the floppy trees into the destination + for FLOPPY_TREE in ${PICO_TREE}/floppy.tree ${MY_TREE}/floppy.tree \ + ${MY_TREE}/floppy.tree.${SITE} ; do + if [ -d ${FLOPPY_TREE} ] ; then + (cd ${FLOPPY_TREE} ; tar -cf - --exclude CVS \ + --exclude .svn ${excl} . ) | \ (cd ${dst} ; tar x${o_tarv}f - ) - log "Copied from generic floppy-tree `echo; ls -laR ${dst}`" - - srcdir=${MY_TREE}/floppy.tree - if [ -d ${srcdir} ] ; then - log "update with type-specific files:" - (cd ${srcdir} ; tar -cf - --exclude CVS --exclude .svn . ) | \ - (cd ${dst} ; tar x${o_tarv}f - ) - log "Copied from type floppy-tree `echo; ls -laR ${dst}`" - else - log "No type-specific floppy-tree" - fi - if [ -d ${srcdir}.${SITE} ] ; then - log "Update with site-specific (${SITE}) files:" - (cd ${srcdir}.${SITE} ; tar -cf - --exclude CVS --exclude .svn . ) | \ - (cd ${dst} ; tar x${o_tarv}f - ) - log "Copied from site floppy-tree `echo; ls -laR ${dst}`" - else - log "No site-specific floppy-tree" - fi + log "Copied from ${FLOPPY_TREE}" + fi + excl="" # reset the exclude list. + done + # add local manipulation + if [ -f ${MY_TREE}/buildtree.mk ] ; then + log "building local floppy tree" + ${BINMAKE} -C ${dst} -f ${MY_TREE}/buildtree.mk floppy.tree + fi + + # compress the files in etc/, just in case + # XXX this should be done in the makefile. # gzip returns an error if it fails to compress some file (cd $dst ; gzip -9 etc/* log "Compressed files in etc/ `echo; ls -l etc`" @@ -532,13 +537,12 @@ populate_floppy_fs() { # OK # Finally, if required, make a copy of the floppy.tree onto /fd populate_mfs_tree() { - local a dst + local a dst MFS_TREE log "populate_mfs_tree()" dst=${BUILDDIR}/mfs.tree - # clean relics from old compilations. - rm -rf ${dst} || true - mkdir ${dst} + rm -rf ${dst} || true # clean relics from old compilations. + mkdir ${dst} # create a fresh tree log "pwd=`pwd`, Populating MFS tree..." @@ -555,7 +559,7 @@ populate_mfs_tree() { ln -s /dev/null ${dst}/var/run/log ln -s /etc/termcap ${dst}/usr/share/misc/termcap - + ### now build the crunched binaries ### ( cd ${BUILDDIR}/crunch log "Making and installing crunch1 from `pwd` src ${SRC}..." @@ -599,12 +603,18 @@ populate_mfs_tree() { fi done + if [ -f ${MY_TREE}/buildtree.mk ] ; then + log "building local floppy tree" + ${BINMAKE} -C ${dst} -f ${MY_TREE}/buildtree.mk mfs.tree + fi + if [ "${o_all_in_mfs}" = "yes" ]; then log "Copy generic floppy_tree into MFS..." - # this may fail in case the floppy is empty + # ignore failure in case the floppy is empty cp -Rp ${BUILDDIR}/floppy.tree/* ${dst}/fd || true fi + # 4.x compatibility - create device nodes if [ "${o_no_devfs}" != "" ] ; then # create device entries using MAKEDEV (cd ${dst}/dev @@ -623,19 +633,21 @@ populate_mfs_tree() { log "importing ${import_files} into mfs" # We do it in a chroot environment on the target so # symlinks are followed correctly. - cp `which tar` ${dst}/my_copy_of_tar + # Make sure we have a statically linked tar there. + mkdir -p ${dst}/rescue + cp /rescue/tar ${dst}/rescue (cd ${l_usrtree}/.. ; tar cf - ${import_files} ) | \ - (chroot ${dst} /my_copy_of_tar xf - ) - rm ${dst}/my_copy_of_tar + (chroot ${dst} /rescue/tar xPf - ) + rm -rf ${dst}/rescue fi (cd ${BUILDDIR} # override the owner echo "/set uid=0 gid=0" > mtree.out - mtree -c -p ${dst} -k "" >> mtree.out + mtree -ic -p ${dst} -k "" >> mtree.out log "mtre.out at ${BUILDDIR}/mtree.out" makefs -t ffs -o bsize=4096 -o fsize=512 \ - -s ${MFS_SIZE}k -f 100 -F mtree.out ${c_fs} ${dst} + -s ${MFS_SIZE}k -f 1000 -F mtree.out ${c_fs} ${dst} ls -l ${c_fs} ) log "done mfs image" } @@ -712,14 +724,16 @@ fill_floppy_image() { fi log "Labeling floppy image" - log "patch ${c_boot2} to boot /kernel right away" b2=${BUILDDIR}/boot2 # modified boot2 cp -f ${c_boot2} ${b2} chmod 0644 ${b2} - set `strings -at d ${b2} | grep "/boot/loader"` - echo -e "/kernel\0\0\0\0\0" | \ - dd of=${b2} obs=$1 oseek=1 conv=notrunc 2>/dev/null + if [ ${o_use_loader} = "no" ] ; then + log "patch ${c_boot2} to boot /kernel right away" + set `strings -at d ${b2} | grep "/boot/loader"` + echo -e "/kernel\0\0\0\0\0" | \ + dd of=${b2} obs=$1 oseek=1 conv=notrunc 2>/dev/null + fi chmod 0444 ${b2} dst=${BUILDDIR}/image.tree @@ -739,22 +753,39 @@ fill_floppy_image() { if [ ${mfs_start} -gt 0 -a ${mfs_size} -ge ${imgsize} ] ; then mfs_ofs=$((${mfs_start} + 8192)) log "Preload kernel with file ${c_fs} at ${mfs_ofs}" + logverbose "`ls -l ${c_fs}` to fit in ${mfs_size}" dd if=${c_fs} ibs=8192 iseek=1 of=kernel obs=${mfs_ofs} \ - oseek=1 conv=notrunc 2> /dev/null + oseek=1 conv=notrunc # 2> /dev/null else log "not loading mfs, size ${mfs_size} img ${imgsize}" fi log "Compress with kgzip and copy to floppy image" - kgzip -o kernel.gz kernel - cp -p kernel.gz ${dst}/kernel || fail $? no_space "copying kernel" + if [ ${o_use_loader} = "no" ] ; then + kgzip -o kernel.gz kernel + cp -p kernel.gz ${dst}/kernel || fail $? no_space "copying kernel" + else + gzip kernel + mkdir -p ${dst}/boot/kernel + echo "hint.acpi.0.disabled=\"1\"" > ${dst}/boot/loader.conf + echo "console=\"comconsole\"" >> ${dst}/boot/loader.conf + cp -p /boot/loader ${dst}/boot/loader || fail $? no_space "copying bootloader" + cp -p kernel.gz ${dst}/boot/kernel/kernel.gz || fail $? no_space "copying kernel" + fi - log "Now transfer floppy tree if not already in MFS image" # now transfer the floppy tree. If it is already in mfs, dont bother. if [ "${o_all_in_mfs}" != "yes" ] ; then + log "Now transfer floppy tree if not already in MFS image" cp -Rp floppy.tree/* ${dst} || \ fail $? no_space "copying floppy tree" fi ) + + # add local manipulation to the image + if [ -f ${MY_TREE}/buildtree.mk ] ; then + ${BINMAKE} -C ${dst} -f ${MY_TREE}/buildtree.mk image.tree + fi + + log "image used `du -s ${dst}` of ${blocks}k" (cd ${BUILDDIR} makefs -t ffs -o bsize=4096 -o fsize=512 \ -s ${blocks}k -f 50 ${c_img} ${dst} @@ -764,9 +795,19 @@ fill_floppy_image() { ${l_label} -f `pwd`/${c_img} | sed -e '/ c:/{p;s/c:/a:/;}' | \ ${l_label} -R -f `pwd`/${c_img} /dev/stdin ${l_label} -f `pwd`/${c_img} + ls -l ${c_img} - logverbose "after disklabel" - ) + ${l_label} -f `pwd`/${c_img} + logverbose "after disklabel" + ) + + echo "BUILDDIR ${BUILDDIR}" + if [ "${generate_iso}" = "YES" ]; then + echo "generate_iso ${generate_iso}" + #build_iso_image() + exit 1 + fi + # dump the primary and secondary boot # XXX primary is 512 bytes dd if=${c_boot1} of=${BUILDDIR}/${c_img} conv=notrunc 2>/dev/null @@ -781,7 +822,8 @@ fill_floppy_image() { rm -rf ${BUILDDIR}/floppy.tree || true # cleanup # df -ik ${dst} | colrm 70 > .build.reply rm -rf ${dst} - rm ${BUILDDIR}/kernel.gz ${BUILDDIR}/${c_fs} + rm ${BUILDDIR}/${c_fs} + # rm ${BUILDDIR}/kernel.gz } # This function creates variables which depend on the source tree in use: @@ -824,8 +866,7 @@ set_build_parameters() { # arguments. set_defaults -args="" -while [ x"$1" != x ]; do +while [ true ]; do case $1 in --src) # set the source path instead of /usr/src SRC=`(cd $2; pwd)` @@ -840,12 +881,17 @@ while [ x"$1" != x ]; do shift ;; + --no_loader) # omit /boot/loader, just rely on boot2 + # (it may have problems with kernels > 4MB) + o_use_loader="no" + ;; + --all_in_mfs) o_all_in_mfs="yes" ;; --no_all_in_mfs) - o_all_in_mfs="" + o_all_in_mfs="no" ;; --modules) # also build kernel modules @@ -865,21 +911,24 @@ while [ x"$1" != x ]; do o_tarv="v" # tar verbose flag o_makeopts="-d l" # be verbose ;; + + --iso) # generate iso image + generate_iso="YES" + ;; + *) - args="$args $1" # accumulate args + break ;; esac shift done set_build_parameters # things that depend on ${SRC} +set_type $1 $2 # type and site, respectively # If $1="package", it creates a neat set of floppies -set -- ${args} [ "$1" = "package" ] && build_package -set_type $args # type and site, respectively - [ "${o_interactive}" != "NO" ] && main_dialog if [ "${o_clean}" = "YES" ] ; then From ed at FreeBSD.org Sun Mar 1 07:08:35 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Mar 1 07:08:42 2009 Subject: svn commit: r189238 - svnadmin/conf Message-ID: <200903011508.n21F8YVY046747@svn.freebsd.org> Author: ed Date: Sun Mar 1 15:08:33 2009 New Revision: 189238 URL: http://svn.freebsd.org/changeset/base/189238 Log: As discussed with kib, take over rdivacky's mentorship. Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Sun Mar 1 15:03:08 2009 (r189237) +++ svnadmin/conf/mentors Sun Mar 1 15:08:33 2009 (r189238) @@ -16,7 +16,7 @@ dchagin kib eri mlaier Co-mentor: thompsa jamie bz Co-mentor: brooks pho kib -rdivacky kib Co-mentor: ed +rdivacky ed remko imp sbruno scottl sson jb From scottl at FreeBSD.org Sun Mar 1 08:24:58 2009 From: scottl at FreeBSD.org (Scott Long) Date: Sun Mar 1 08:25:12 2009 Subject: svn commit: r189239 - in stable/7/sys: . cam/scsi contrib/pf dev/ath/ath_hal dev/cxgb Message-ID: <200903011624.n21GOvOi048222@svn.freebsd.org> Author: scottl Date: Sun Mar 1 16:24:57 2009 New Revision: 189239 URL: http://svn.freebsd.org/changeset/base/189239 Log: Merge 181381: Update SCSI opcodes and ASCs from t10.org. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/scsi/scsi_all.c stable/7/sys/cam/scsi/scsi_all.h stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/7/sys/cam/scsi/scsi_all.c Sun Mar 1 15:08:33 2009 (r189238) +++ stable/7/sys/cam/scsi/scsi_all.c Sun Mar 1 16:24:57 2009 (r189239) @@ -103,23 +103,27 @@ static int set_scsi_delay(int delay); #if !defined(SCSI_NO_OP_STRINGS) -#define D 0x001 -#define T 0x002 -#define L 0x004 -#define P 0x008 -#define W 0x010 -#define R 0x020 -#define S 0x040 -#define O 0x080 -#define M 0x100 -#define C 0x200 -#define A 0x400 -#define E 0x800 +#define D (1 << T_DIRECT) +#define T (1 << T_SEQUENTIAL) +#define L (1 << T_PRINTER) +#define P (1 << T_PROCESSOR) +#define W (1 << T_WORM) +#define R (1 << T_CDROM) +#define O (1 << T_OPTICAL) +#define M (1 << T_CHANGER) +#define A (1 << T_STORARRAY) +#define E (1 << T_ENCLOSURE) +#define B (1 << T_RBC) +#define K (1 << T_OCRW) +#define V (1 << T_ADC) +#define F (1 << T_OSD) +#define S (1 << T_SCANNER) +#define C (1 << T_COMM) -#define ALL 0xFFF +#define ALL (D | T | L | P | W | R | O | M | A | E | B | K | V | F | S | C) static struct op_table_entry plextor_cd_ops[] = { - {0xD8, R, "CD-DA READ"} + { 0xD8, R, "CD-DA READ" } }; static struct scsi_op_quirk_entry scsi_op_quirk_table[] = { @@ -140,519 +144,456 @@ static struct scsi_op_quirk_entry scsi_o }; static struct op_table_entry scsi_op_codes[] = { -/* - * From: ftp://ftp.symbios.com/pub/standards/io/t10/drafts/spc/op-num.txt - * Modifications by Kenneth Merry (ken@FreeBSD.ORG) - * - * Note: order is important in this table, scsi_op_desc() currently - * depends on the opcodes in the table being in order to save search time. - */ -/* - * File: OP-NUM.TXT - * - * SCSI Operation Codes - * Numeric Sorted Listing - * as of 11/13/96 - * - * D - DIRECT ACCESS DEVICE (SBC) device column key - * .T - SEQUENTIAL ACCESS DEVICE (SSC) ------------------- - * . L - PRINTER DEVICE (SSC) M = Mandatory - * . P - PROCESSOR DEVICE (SPC) O = Optional - * . .W - WRITE ONCE READ MULTIPLE DEVICE (SBC) V = Vendor specific - * . . R - CD DEVICE (MMC) R = Reserved - * . . S - SCANNER DEVICE (SGC) Z = Obsolete - * . . .O - OPTICAL MEMORY DEVICE (SBC) - * . . . M - MEDIA CHANGER DEVICE (SMC) - * . . . C - COMMUNICATION DEVICE (SSC) - * . . . .A - STORAGE ARRAY DEVICE (SCC) - * . . . . E - ENCLOSURE SERVICES DEVICE (SES) - * OP DTLPWRSOMCAE Description - * -- ------------ ---------------------------------------------------- */ -/* 00 MMMMMMMMMMMM TEST UNIT READY */ -{0x00, ALL, "TEST UNIT READY"}, - -/* 01 M REWIND */ -{0x01, T, "REWIND"}, -/* 01 Z V ZO ZO REZERO UNIT */ -{0x01, D|L|W|O|M, "REZERO UNIT"}, - -/* 02 VVVVVV V */ - -/* 03 MMMMMMMMMMMM REQUEST SENSE */ -{0x03, ALL, "REQUEST SENSE"}, - -/* 04 M O O FORMAT UNIT */ -{0x04, D|R|O, "FORMAT UNIT"}, -/* 04 O FORMAT MEDIUM */ -{0x04, T, "FORMAT MEDIUM"}, -/* 04 O FORMAT */ -{0x04, L, "FORMAT"}, - -/* 05 VMVVVV V READ BLOCK LIMITS */ -{0x05, T, "READ BLOCK LIMITS"}, - -/* 06 VVVVVV V */ - -/* 07 OVV O OV REASSIGN BLOCKS */ -{0x07, D|W|O, "REASSIGN BLOCKS"}, -/* 07 O INITIALIZE ELEMENT STATUS */ -{0x07, M, "INITIALIZE ELEMENT STATUS"}, - -/* 08 OMV OO OV READ(06) */ -{0x08, D|T|W|R|O, "READ(06)"}, -/* 08 O RECEIVE */ -{0x08, P, "RECEIVE"}, -/* 08 M GET MESSAGE(06) */ -{0x08, C, "GET MESSAGE(06)"}, - -/* 09 VVVVVV V */ - -/* 0A OM O OV WRITE(06) */ -{0x0A, D|T|W|O, "WRITE(06)"}, -/* 0A M SEND(06) */ -{0x0A, P, "SEND(06)"}, -/* 0A M SEND MESSAGE(06) */ -{0x0A, C, "SEND MESSAGE(06)"}, -/* 0A M PRINT */ -{0x0A, L, "PRINT"}, - -/* 0B Z ZO ZV SEEK(06) */ -{0x0B, D|W|R|O, "SEEK(06)"}, -/* 0B O SLEW AND PRINT */ -{0x0B, L, "SLEW AND PRINT"}, - -/* 0C VVVVVV V */ -/* 0D VVVVVV V */ -/* 0E VVVVVV V */ -/* 0F VOVVVV V READ REVERSE */ -{0x0F, T, "READ REVERSE"}, - -/* 10 VM VVV WRITE FILEMARKS */ -{0x10, T, "WRITE FILEMARKS"}, -/* 10 O O SYNCHRONIZE BUFFER */ -{0x10, L|W, "SYNCHRONIZE BUFFER"}, - -/* 11 VMVVVV SPACE */ -{0x11, T, "SPACE"}, - -/* 12 MMMMMMMMMMMM INQUIRY */ -{0x12, ALL, "INQUIRY"}, - -/* 13 VOVVVV VERIFY(06) */ -{0x13, T, "VERIFY(06)"}, - -/* 14 VOOVVV RECOVER BUFFERED DATA */ -{0x14, T|L, "RECOVER BUFFERED DATA"}, - -/* 15 OMO OOOOOOOO MODE SELECT(06) */ -{0x15, ALL & ~(P), "MODE SELECT(06)"}, - -/* 16 MMMOMMMM O RESERVE(06) */ -{0x16, D|T|L|P|W|R|S|O|E, "RESERVE(06)"}, -/* 16 M RESERVE ELEMENT(06) */ -{0x16, M, "RESERVE ELEMENT(06)"}, - -/* 17 MMMOMMMM O RELEASE(06) */ -{0x17, ALL & ~(M|C|A), "RELEASE(06)"}, -/* 17 M RELEASE ELEMENT(06) */ -{0x17, M, "RELEASE ELEMENT(06)"}, - -/* 18 OOOOOOOO COPY */ -{0x18, ALL & ~(M|C|A|E), "COPY"}, - -/* 19 VMVVVV ERASE */ -{0x19, T, "ERASE"}, - -/* 1A OMO OOOOOOOO MODE SENSE(06) */ -{0x1A, ALL & ~(P), "MODE SENSE(06)"}, - -/* 1B O OM O STOP START UNIT */ -{0x1B, D|W|R|O, "STOP START UNIT"}, -/* 1B O LOAD UNLOAD */ -{0x1B, T, "LOAD UNLOAD"}, -/* 1B O SCAN */ -{0x1B, S, "SCAN"}, -/* 1B O STOP PRINT */ -{0x1B, L, "STOP PRINT"}, - -/* 1C OOOOOOOOOO M RECEIVE DIAGNOSTIC RESULTS */ -{0x1C, ALL & ~(A), "RECEIVE DIAGNOSTIC RESULTS"}, - -/* 1D MMMMMMMMMMMM SEND DIAGNOSTIC */ -{0x1D, ALL, "SEND DIAGNOSTIC"}, - -/* 1E OO OM OO PREVENT ALLOW MEDIUM REMOVAL */ -{0x1E, D|T|W|R|O|M, "PREVENT ALLOW MEDIUM REMOVAL"}, - -/* 1F */ -/* 20 V VV V */ -/* 21 V VV V */ -/* 22 V VV V */ -/* 23 V VV V */ - -/* 24 V VVM SET WINDOW */ -{0x24, S, "SET WINDOW"}, - -/* 25 M M M READ CAPACITY */ -{0x25, D|W|O, "READ CAPACITY"}, -/* 25 M READ CD RECORDED CAPACITY */ -{0x25, R, "READ CD RECORDED CAPACITY"}, -/* 25 O GET WINDOW */ -{0x25, S, "GET WINDOW"}, - -/* 26 V VV */ -/* 27 V VV */ - -/* 28 M MMMM READ(10) */ -{0x28, D|W|R|S|O, "READ(10)"}, -/* 28 O GET MESSAGE(10) */ -{0x28, C, "GET MESSAGE(10)"}, - -/* 29 V VV O READ GENERATION */ -{0x29, O, "READ GENERATION"}, - -/* 2A M MM M WRITE(10) */ -{0x2A, D|W|R|O, "WRITE(10)"}, -/* 2A O SEND(10) */ -{0x2A, S, "SEND(10)"}, -/* 2A O SEND MESSAGE(10) */ -{0x2A, C, "SEND MESSAGE(10)"}, - -/* 2B O OM O SEEK(10) */ -{0x2B, D|W|R|O, "SEEK(10)"}, -/* 2B O LOCATE */ -{0x2B, T, "LOCATE"}, -/* 2B O POSITION TO ELEMENT */ -{0x2B, M, "POSITION TO ELEMENT"}, - -/* 2C V O ERASE(10) */ -{0x2C, O, "ERASE(10)"}, - -/* 2D V O O READ UPDATED BLOCK */ -{0x2D, W|O, "READ UPDATED BLOCK"}, - -/* 2E O O O WRITE AND VERIFY(10) */ -{0x2E, D|W|O, "WRITE AND VERIFY(10)"}, - -/* 2F O OO O VERIFY(10) */ -{0x2F, D|W|R|O, "VERIFY(10)"}, - -/* 30 Z ZO Z SEARCH DATA HIGH(10) */ -{0x30, D|W|R|O, "SEARCH DATA HIGH(10)"}, - -/* 31 Z ZO Z SEARCH DATA EQUAL(10) */ -{0x31, D|W|R|O, "SEARCH DATA EQUAL(10)"}, -/* 31 O OBJECT POSITION */ -{0x31, S, "OBJECT POSITION"}, - -/* 32 Z ZO Z SEARCH DATA LOW(10) */ -{0x32, D|W|R|O, "SEARCH DATA LOW(10"}, - -/* 33 O OO O SET LIMITS(10) */ -{0x33, D|W|R|O, "SET LIMITS(10)"}, - -/* 34 O OO O PRE-FETCH */ -{0x34, D|W|R|O, "PRE-FETCH"}, -/* 34 O READ POSITION */ -{0x34, T, "READ POSITION"}, -/* 34 O GET DATA BUFFER STATUS */ -{0x34, S, "GET DATA BUFFER STATUS"}, - -/* 35 O OM O SYNCHRONIZE CACHE */ -{0x35, D|W|R|O, "SYNCHRONIZE CACHE"}, - -/* 36 O OO O LOCK UNLOCK CACHE */ -{0x36, D|W|R|O, "LOCK UNLOCK CACHE"}, - -/* 37 O O READ DEFECT DATA(10) */ -{0x37, D|O, "READ DEFECT DATA(10)"}, - -/* 38 O O MEDIUM SCAN */ -{0x38, W|O, "MEDIUM SCAN"}, - -/* 39 OOOOOOOO COMPARE */ -{0x39, ALL & ~(M|C|A|E), "COMPARE"}, - -/* 3A OOOOOOOO COPY AND VERIFY */ -{0x3A, ALL & ~(M|C|A|E), "COPY AND VERIFY"}, - -/* 3B OOOOOOOOOO O WRITE BUFFER */ -{0x3B, ALL & ~(A), "WRITE BUFFER"}, - -/* 3C OOOOOOOOOO READ BUFFER */ -{0x3C, ALL & ~(A|E),"READ BUFFER"}, - -/* 3D O O UPDATE BLOCK */ -{0x3D, W|O, "UPDATE BLOCK"}, - -/* 3E O OO O READ LONG */ -{0x3E, D|W|R|O, "READ LONG"}, - -/* 3F O O O WRITE LONG */ -{0x3F, D|W|O, "WRITE LONG"}, - -/* 40 OOOOOOOOOO CHANGE DEFINITION */ -{0x40, ALL & ~(A|E),"CHANGE DEFINITION"}, - -/* 41 O WRITE SAME */ -{0x41, D, "WRITE SAME"}, - -/* 42 M READ SUB-CHANNEL */ -{0x42, R, "READ SUB-CHANNEL"}, - -/* 43 M READ TOC/PMA/ATIP {MMC Proposed} */ -{0x43, R, "READ TOC/PMA/ATIP {MMC Proposed}"}, - -/* 44 M REPORT DENSITY SUPPORT */ -{0x44, T, "REPORT DENSITY SUPPORT"}, -/* 44 M READ HEADER */ -{0x44, R, "READ HEADER"}, - -/* 45 O PLAY AUDIO(10) */ -{0x45, R, "PLAY AUDIO(10)"}, - -/* 46 */ - -/* 47 O PLAY AUDIO MSF */ -{0x47, R, "PLAY AUDIO MSF"}, - -/* 48 O PLAY AUDIO TRACK INDEX */ -{0x48, R, "PLAY AUDIO TRACK INDEX"}, - -/* 49 O PLAY TRACK RELATIVE(10) */ -{0x49, R, "PLAY TRACK RELATIVE(10)"}, - -/* 4A */ - -/* 4B O PAUSE/RESUME */ -{0x4B, R, "PAUSE/RESUME"}, - -/* 4C OOOOOOOOOOO LOG SELECT */ -{0x4C, ALL & ~(E), "LOG SELECT"}, - -/* 4D OOOOOOOOOOO LOG SENSE */ -{0x4D, ALL & ~(E), "LOG SENSE"}, - -/* 4E O STOP PLAY/SCAN {MMC Proposed} */ -{0x4E, R, "STOP PLAY/SCAN {MMC Proposed}"}, - -/* 4F */ - -/* 50 O XDWRITE(10) */ -{0x50, D, "XDWRITE(10)"}, - -/* 51 O XPWRITE(10) */ -{0x51, D, "XPWRITE(10)"}, -/* 51 M READ DISC INFORMATION {MMC Proposed} */ -{0x51, R, "READ DISC INFORMATION {MMC Proposed}"}, - -/* 52 O XDREAD(10) */ -{0x52, D, "XDREAD(10)"}, -/* 52 M READ TRACK INFORMATION {MMC Proposed} */ -{0x52, R, "READ TRACK INFORMATION {MMC Proposed}"}, - -/* 53 M RESERVE TRACK {MMC Proposed} */ -{0x53, R, "RESERVE TRACK {MMC Proposed}"}, - -/* 54 O SEND OPC INFORMATION {MMC Proposed} */ -{0x54, R, "SEND OPC INFORMATION {MMC Proposed}"}, - -/* 55 OOO OOOOOOOO MODE SELECT(10) */ -{0x55, ALL & ~(P), "MODE SELECT(10)"}, - -/* 56 MMMOMMMM O RESERVE(10) */ -{0x56, ALL & ~(M|C|A), "RESERVE(10)"}, -/* 56 M RESERVE ELEMENT(10) */ -{0x56, M, "RESERVE ELEMENT(10)"}, - -/* 57 MMMOMMMM O RELEASE(10) */ -{0x57, ALL & ~(M|C|A), "RELEASE(10"}, -/* 57 M RELEASE ELEMENT(10) */ -{0x57, M, "RELEASE ELEMENT(10)"}, - -/* 58 O REPAIR TRACK {MMC Proposed} */ -{0x58, R, "REPAIR TRACK {MMC Proposed}"}, - -/* 59 O READ MASTER CUE {MMC Proposed} */ -{0x59, R, "READ MASTER CUE {MMC Proposed}"}, - -/* 5A OOO OOOOOOOO MODE SENSE(10) */ -{0x5A, ALL & ~(P), "MODE SENSE(10)"}, - -/* 5B M CLOSE TRACK/SESSION {MMC Proposed} */ -{0x5B, R, "CLOSE TRACK/SESSION {MMC Proposed}"}, - -/* 5C O READ BUFFER CAPACITY {MMC Proposed} */ -{0x5C, R, "READ BUFFER CAPACITY {MMC Proposed}"}, - -/* 5D O SEND CUE SHEET {MMC Proposed} */ -{0x5D, R, "SEND CUE SHEET {MMC Proposed}"}, - -/* 5E OOOOOOOOO O PERSISTENT RESERVE IN */ -{0x5E, ALL & ~(C|A),"PERSISTENT RESERVE IN"}, - -/* 5F OOOOOOOOO O PERSISTENT RESERVE OUT */ -{0x5F, ALL & ~(C|A),"PERSISTENT RESERVE OUT"}, - -/* 80 O XDWRITE EXTENDED(16) */ -{0x80, D, "XDWRITE EXTENDED(16)"}, - -/* 81 O REBUILD(16) */ -{0x81, D, "REBUILD(16)"}, - -/* 82 O REGENERATE(16) */ -{0x82, D, "REGENERATE(16)"}, - -/* 83 */ -/* 84 */ -/* 85 */ -/* 86 */ -/* 87 */ -/* 88 MM OO O O READ(16) */ -{0x88, D|T|W|R|O, "READ(16)"}, -/* 89 */ -/* 8A OM O O O WRITE(16) */ -{0x8A, D|T|W|R|O, "WRITE(16)"}, -/* 8B */ -/* 8C */ -/* 8D */ -/* 8E */ -/* 8F */ -/* 90 */ -/* 91 */ -/* 92 */ -/* 93 */ -/* 94 */ -/* 95 */ -/* 96 */ -/* 97 */ -/* 98 */ -/* 99 */ -/* 9A */ -/* 9B */ -/* 9C */ -/* 9D */ -/* XXX KDM ALL for these? op-num.txt defines them for none.. */ -/* 9E SERVICE ACTION IN(16) */ -{0x9E, ALL, "SERVICE ACTION IN(16)"}, -/* 9F SERVICE ACTION OUT(16) */ -{0x9F, ALL, "SERVICE ACTION OUT(16)"}, - -/* A0 OOOOOOOOOOO REPORT LUNS */ -{0xA0, ALL & ~(E), "REPORT LUNS"}, - -/* A1 O BLANK {MMC Proposed} */ -{0xA1, R, "BLANK {MMC Proposed}"}, - -/* A2 O WRITE CD MSF {MMC Proposed} */ -{0xA2, R, "WRITE CD MSF {MMC Proposed}"}, - -/* A3 M MAINTENANCE (IN) */ -{0xA3, A, "MAINTENANCE (IN)"}, - -/* A4 O MAINTENANCE (OUT) */ -{0xA4, A, "MAINTENANCE (OUT)"}, - -/* A5 O M MOVE MEDIUM */ -{0xA5, T|M, "MOVE MEDIUM"}, -/* A5 O PLAY AUDIO(12) */ -{0xA5, R, "PLAY AUDIO(12)"}, - -/* A6 O EXCHANGE MEDIUM */ -{0xA6, M, "EXCHANGE MEDIUM"}, -/* A6 O LOAD/UNLOAD CD {MMC Proposed} */ -{0xA6, R, "LOAD/UNLOAD CD {MMC Proposed}"}, - -/* A7 OO OO OO MOVE MEDIUM ATTACHED */ -{0xA7, D|T|W|R|O|M, "MOVE MEDIUM ATTACHED"}, - -/* A8 O OM O READ(12) */ -{0xA8,D|W|R|O, "READ(12)"}, -/* A8 O GET MESSAGE(12) */ -{0xA8, C, "GET MESSAGE(12)"}, - -/* A9 O PLAY TRACK RELATIVE(12) */ -{0xA9, R, "PLAY TRACK RELATIVE(12)"}, - -/* AA O O O WRITE(12) */ -{0xAA,D|W|O, "WRITE(12)"}, -/* AA O WRITE CD(12) {MMC Proposed} */ -{0xAA, R, "WRITE CD(12) {MMC Proposed}"}, -/* AA O SEND MESSAGE(12) */ -{0xAA, C, "SEND MESSAGE(12)"}, - -/* AB */ - -/* AC O ERASE(12) */ -{0xAC, O, "ERASE(12)"}, - -/* AD */ - -/* AE O O WRITE AND VERIFY(12) */ -{0xAE, W|O, "WRITE AND VERIFY(12)"}, - -/* AF OO O VERIFY(12) */ -{0xAF, W|R|O, "VERIFY(12)"}, - -/* B0 ZO Z SEARCH DATA HIGH(12) */ -{0xB0, W|R|O, "SEARCH DATA HIGH(12)"}, - -/* B1 ZO Z SEARCH DATA EQUAL(12) */ -{0xB1, W|R|O, "SEARCH DATA EQUAL(12)"}, - -/* B2 ZO Z SEARCH DATA LOW(12) */ -{0xB2, W|R|O, "SEARCH DATA LOW(12)"}, - -/* B3 OO O SET LIMITS(12) */ -{0xB3, W|R|O, "SET LIMITS(12)"}, - -/* B4 OO OO OO READ ELEMENT STATUS ATTACHED */ -{0xB4, D|T|W|R|O|M, "READ ELEMENT STATUS ATTACHED"}, - -/* B5 O REQUEST VOLUME ELEMENT ADDRESS */ -{0xB5, M, "REQUEST VOLUME ELEMENT ADDRESS"}, - -/* B6 O SEND VOLUME TAG */ -{0xB6, M, "SEND VOLUME TAG"}, - -/* B7 O READ DEFECT DATA(12) */ -{0xB7, O, "READ DEFECT DATA(12)"}, - -/* B8 O M READ ELEMENT STATUS */ -{0xB8, T|M, "READ ELEMENT STATUS"}, -/* B8 O SET CD SPEED {MMC Proposed} */ -{0xB8, R, "SET CD SPEED {MMC Proposed}"}, - -/* B9 M READ CD MSF {MMC Proposed} */ -{0xB9, R, "READ CD MSF {MMC Proposed}"}, - -/* BA O SCAN {MMC Proposed} */ -{0xBA, R, "SCAN {MMC Proposed}"}, -/* BA M REDUNDANCY GROUP (IN) */ -{0xBA, A, "REDUNDANCY GROUP (IN)"}, - -/* BB O SET CD-ROM SPEED {proposed} */ -{0xBB, R, "SET CD-ROM SPEED {proposed}"}, -/* BB O REDUNDANCY GROUP (OUT) */ -{0xBB, A, "REDUNDANCY GROUP (OUT)"}, - -/* BC O PLAY CD {MMC Proposed} */ -{0xBC, R, "PLAY CD {MMC Proposed}"}, -/* BC M SPARE (IN) */ -{0xBC, A, "SPARE (IN)"}, - -/* BD M MECHANISM STATUS {MMC Proposed} */ -{0xBD, R, "MECHANISM STATUS {MMC Proposed}"}, -/* BD O SPARE (OUT) */ -{0xBD, A, "SPARE (OUT)"}, - -/* BE O READ CD {MMC Proposed} */ -{0xBE, R, "READ CD {MMC Proposed}"}, -/* BE M VOLUME SET (IN) */ -{0xBE, A, "VOLUME SET (IN)"}, - -/* BF O VOLUME SET (OUT) */ -{0xBF, A, "VOLUME SET (OUT)"} + /* + * From: http://www.t10.org/lists/op-num.txt + * Modifications by Kenneth Merry (ken@FreeBSD.ORG) + * and Jung-uk Kim (jkim@FreeBSD.org) + * + * Note: order is important in this table, scsi_op_desc() currently + * depends on the opcodes in the table being in order to save + * search time. + * Note: scanner and comm. devices are carried over from the previous + * version because they were removed in the latest spec. + */ + /* File: OP-NUM.TXT + * + * SCSI Operation Codes + * Numeric Sorted Listing + * as of 3/11/08 + * + * D - DIRECT ACCESS DEVICE (SBC-2) device column key + * .T - SEQUENTIAL ACCESS DEVICE (SSC-2) ----------------- + * . L - PRINTER DEVICE (SSC) M = Mandatory + * . P - PROCESSOR DEVICE (SPC) O = Optional + * . .W - WRITE ONCE READ MULTIPLE DEVICE (SBC-2) V = Vendor spec. + * . . R - CD/DVE DEVICE (MMC-3) Z = Obsolete + * . . O - OPTICAL MEMORY DEVICE (SBC-2) + * . . .M - MEDIA CHANGER DEVICE (SMC-2) + * . . . A - STORAGE ARRAY DEVICE (SCC-2) + * . . . .E - ENCLOSURE SERVICES DEVICE (SES) + * . . . .B - SIMPLIFIED DIRECT-ACCESS DEVICE (RBC) + * . . . . K - OPTICAL CARD READER/WRITER DEVICE (OCRW) + * . . . . V - AUTOMATION/DRIVE INTERFACE (ADC) + * . . . . .F - OBJECT-BASED STORAGE (OSD) + * OP DTLPWROMAEBKVF Description + * -- -------------- ---------------------------------------------- */ + /* 00 MMMMMMMMMMMMMM TEST UNIT READY */ + { 0x00, ALL, "TEST UNIT READY" }, + /* 01 M REWIND */ + { 0x01, T, "REWIND" }, + /* 01 Z V ZZZZ REZERO UNIT */ + { 0x01, D | W | R | O | M, "REZERO UNIT" }, + /* 02 VVVVVV V */ + /* 03 MMMMMMMMMMOMMM REQUEST SENSE */ + { 0x03, ALL, "REQUEST SENSE" }, + /* 04 M OO FORMAT UNIT */ + { 0x04, D | R | O, "FORMAT UNIT" }, + /* 04 O FORMAT MEDIUM */ + { 0x04, T, "FORMAT MEDIUM" }, + /* 04 O FORMAT */ + { 0x04, L, "FORMAT" }, + /* 05 VMVVVV V READ BLOCK LIMITS */ + { 0x05, T, "READ BLOCK LIMITS" }, + /* 06 VVVVVV V */ + /* 07 OVV O OV REASSIGN BLOCKS */ + { 0x07, D | W | O, "REASSIGN BLOCKS" }, + /* 07 O INITIALIZE ELEMENT STATUS */ + { 0x07, M, "INITIALIZE ELEMENT STATUS" }, + /* 08 MOV O OV READ(6) */ + { 0x08, D | T | W | O, "READ(6)" }, + /* 08 O RECEIVE */ + { 0x08, P, "RECEIVE" }, + /* 08 GET MESSAGE(6) */ + { 0x08, C, "GET MESSAGE(6)" }, + /* 09 VVVVVV V */ + /* 0A OO O OV WRITE(6) */ + { 0x0A, D | T | W | O, "WRITE(6)" }, + /* 0A M SEND(6) */ + { 0x0A, P, "SEND(6)" }, + /* 0A SEND MESSAGE(6) */ + { 0x0A, C, "SEND MESSAGE(6)" }, + /* 0A M PRINT */ + { 0x0A, L, "PRINT" }, + /* 0B Z ZOZV SEEK(6) */ + { 0x0B, D | W | R | O, "SEEK(6)" }, + /* 0B O SET CAPACITY */ + { 0x0B, T, "SET CAPACITY" }, + /* 0B O SLEW AND PRINT */ + { 0x0B, L, "SLEW AND PRINT" }, + /* 0C VVVVVV V */ + /* 0D VVVVVV V */ + /* 0E VVVVVV V */ + /* 0F VOVVVV V READ REVERSE(6) */ + { 0x0F, T, "READ REVERSE(6)" }, + /* 10 VM VVV WRITE FILEMARKS(6) */ + { 0x10, T, "WRITE FILEMARKS(6)" }, + /* 10 O SYNCHRONIZE BUFFER */ + { 0x10, L, "SYNCHRONIZE BUFFER" }, + /* 11 VMVVVV SPACE(6) */ + { 0x11, T, "SPACE(6)" }, + /* 12 MMMMMMMMMMMMMM INQUIRY */ + { 0x12, ALL, "INQUIRY" }, + /* 13 V VVVV */ + /* 13 O VERIFY(6) */ + { 0x13, T, "VERIFY(6)" }, + /* 14 VOOVVV RECOVER BUFFERED DATA */ + { 0x14, T | L, "RECOVER BUFFERED DATA" }, + /* 15 OMO O OOOO OO MODE SELECT(6) */ + { 0x15, ALL & ~(P | R | B | F), "MODE SELECT(6)" }, + /* 16 ZZMZO OOOZ O RESERVE(6) */ + { 0x16, ALL & ~(R | B | V | F | C), "RESERVE(6)" }, + /* 16 Z RESERVE ELEMENT(6) */ + { 0x16, M, "RESERVE ELEMENT(6)" }, + /* 17 ZZMZO OOOZ O RELEASE(6) */ + { 0x17, ALL & ~(R | B | V | F | C), "RELEASE(6)" }, + /* 17 Z RELEASE ELEMENT(6) */ + { 0x17, M, "RELEASE ELEMENT(6)" }, + /* 18 ZZZZOZO Z COPY */ + { 0x18, D | T | L | P | W | R | O | K | S, "COPY" }, + /* 19 VMVVVV ERASE(6) */ + { 0x19, T, "ERASE(6)" }, + /* 1A OMO O OOOO OO MODE SENSE(6) */ + { 0x1A, ALL & ~(P | R | B | F), "MODE SENSE(6)" }, + /* 1B O OOO O MO O START STOP UNIT */ + { 0x1B, D | W | R | O | A | B | K | F, "START STOP UNIT" }, + /* 1B O M LOAD UNLOAD */ + { 0x1B, T | V, "LOAD UNLOAD" }, + /* 1B SCAN */ + { 0x1B, S, "SCAN" }, + /* 1B O STOP PRINT */ + { 0x1B, L, "STOP PRINT" }, + /* 1B O OPEN/CLOSE IMPORT/EXPORT ELEMENT */ + { 0x1B, M, "OPEN/CLOSE IMPORT/EXPORT ELEMENT" }, + /* 1C OOOOO OOOM OOO RECEIVE DIAGNOSTIC RESULTS */ + { 0x1C, ALL & ~(R | B), "RECEIVE DIAGNOSTIC RESULTS" }, + /* 1D MMMMM MMOM MMM SEND DIAGNOSTIC */ + { 0x1D, ALL & ~(R | B), "SEND DIAGNOSTIC" }, + /* 1E OO OOOO O O PREVENT ALLOW MEDIUM REMOVAL */ + { 0x1E, D | T | W | R | O | M | K | F, "PREVENT ALLOW MEDIUM REMOVAL" }, + /* 1F */ + /* 20 V VVV V */ + /* 21 V VVV V */ + /* 22 V VVV V */ + /* 23 V V V V */ + /* 23 O READ FORMAT CAPACITIES */ + { 0x23, R, "READ FORMAT CAPACITIES" }, + /* 24 V VV SET WINDOW */ + { 0x24, S, "SET WINDOW" }, + /* 25 M M M M READ CAPACITY(10) */ + { 0x25, D | W | O | B, "READ CAPACITY(10)" }, + /* 25 O READ CAPACITY */ + { 0x25, R, "READ CAPACITY" }, + /* 25 M READ CARD CAPACITY */ + { 0x25, K, "READ CARD CAPACITY" }, + /* 25 GET WINDOW */ + { 0x25, S, "GET WINDOW" }, + /* 26 V VV */ + /* 27 V VV */ + /* 28 M MOM MM READ(10) */ + { 0x28, D | W | R | O | B | K | S, "READ(10)" }, + /* 28 GET MESSAGE(10) */ + { 0x28, C, "GET MESSAGE(10)" }, + /* 29 V VVO READ GENERATION */ + { 0x29, O, "READ GENERATION" }, + /* 2A O MOM MO WRITE(10) */ + { 0x2A, D | W | R | O | B | K, "WRITE(10)" }, + /* 2A SEND(10) */ + { 0x2A, S, "SEND(10)" }, + /* 2A SEND MESSAGE(10) */ + { 0x2A, C, "SEND MESSAGE(10)" }, + /* 2B Z OOO O SEEK(10) */ + { 0x2B, D | W | R | O | K, "SEEK(10)" }, + /* 2B O LOCATE(10) */ + { 0x2B, T, "LOCATE(10)" }, + /* 2B O POSITION TO ELEMENT */ + { 0x2B, M, "POSITION TO ELEMENT" }, + /* 2C V OO ERASE(10) */ + { 0x2C, R | O, "ERASE(10)" }, + /* 2D O READ UPDATED BLOCK */ + { 0x2D, O, "READ UPDATED BLOCK" }, + /* 2D V */ + /* 2E O OOO MO WRITE AND VERIFY(10) */ + { 0x2E, D | W | R | O | B | K, "WRITE AND VERIFY(10)" }, + /* 2F O OOO VERIFY(10) */ + { 0x2F, D | W | R | O, "VERIFY(10)" }, + /* 30 Z ZZZ SEARCH DATA HIGH(10) */ + { 0x30, D | W | R | O, "SEARCH DATA HIGH(10)" }, + /* 31 Z ZZZ SEARCH DATA EQUAL(10) */ + { 0x31, D | W | R | O, "SEARCH DATA EQUAL(10)" }, + /* 31 OBJECT POSITION */ + { 0x31, S, "OBJECT POSITION" }, + /* 32 Z ZZZ SEARCH DATA LOW(10) */ + { 0x32, D | W | R | O, "SEARCH DATA LOW(10)" }, + /* 33 Z OZO SET LIMITS(10) */ + { 0x33, D | W | R | O, "SET LIMITS(10)" }, + /* 34 O O O O PRE-FETCH(10) */ + { 0x34, D | W | O | K, "PRE-FETCH(10)" }, + /* 34 M READ POSITION */ + { 0x34, T, "READ POSITION" }, + /* 34 GET DATA BUFFER STATUS */ + { 0x34, S, "GET DATA BUFFER STATUS" }, + /* 35 O OOO MO SYNCHRONIZE CACHE(10) */ + { 0x35, D | W | R | O | B | K, "SYNCHRONIZE CACHE(10)" }, + /* 36 Z O O O LOCK UNLOCK CACHE(10) */ + { 0x36, D | W | O | K, "LOCK UNLOCK CACHE(10)" }, + /* 37 O O READ DEFECT DATA(10) */ + { 0x37, D | O, "READ DEFECT DATA(10)" }, + /* 37 O INITIALIZE ELEMENT STATUS WITH RANGE */ + { 0x37, M, "INITIALIZE ELEMENT STATUS WITH RANGE" }, + /* 38 O O O MEDIUM SCAN */ + { 0x38, W | O | K, "MEDIUM SCAN" }, + /* 39 ZZZZOZO Z COMPARE */ + { 0x39, D | T | L | P | W | R | O | K | S, "COMPARE" }, + /* 3A ZZZZOZO Z COPY AND VERIFY */ + { 0x3A, D | T | L | P | W | R | O | K | S, "COPY AND VERIFY" }, + /* 3B OOOOOOOOOOMOOO WRITE BUFFER */ + { 0x3B, ALL, "WRITE BUFFER" }, + /* 3C OOOOOOOOOO OOO READ BUFFER */ + { 0x3C, ALL & ~(B), "READ BUFFER" }, + /* 3D O UPDATE BLOCK */ + { 0x3D, O, "UPDATE BLOCK" }, + /* 3E O O O READ LONG(10) */ + { 0x3E, D | W | O, "READ LONG(10)" }, + /* 3F O O O WRITE LONG(10) */ + { 0x3F, D | W | O, "WRITE LONG(10)" }, + /* 40 ZZZZOZOZ CHANGE DEFINITION */ + { 0x40, D | T | L | P | W | R | O | M | S | C, "CHANGE DEFINITION" }, + /* 41 O WRITE SAME(10) */ + { 0x41, D, "WRITE SAME(10)" }, + /* 42 O READ SUB-CHANNEL */ + { 0x42, R, "READ SUB-CHANNEL" }, + /* 43 O READ TOC/PMA/ATIP */ + { 0x43, R, "READ TOC/PMA/ATIP" }, + /* 44 M M REPORT DENSITY SUPPORT */ + { 0x44, T | V, "REPORT DENSITY SUPPORT" }, + /* 44 READ HEADER */ + /* 45 O PLAY AUDIO(10) */ + { 0x45, R, "PLAY AUDIO(10)" }, + /* 46 M GET CONFIGURATION */ + { 0x46, R, "GET CONFIGURATION" }, + /* 47 O PLAY AUDIO MSF */ + { 0x47, R, "PLAY AUDIO MSF" }, + /* 48 */ + /* 49 */ + /* 4A M GET EVENT STATUS NOTIFICATION */ + { 0x4A, R, "GET EVENT STATUS NOTIFICATION" }, + /* 4B O PAUSE/RESUME */ + { 0x4B, R, "PAUSE/RESUME" }, + /* 4C OOOOO OOOO OOO LOG SELECT */ + { 0x4C, ALL & ~(R | B), "LOG SELECT" }, + /* 4D OOOOO OOOO OMO LOG SENSE */ + { 0x4D, ALL & ~(R | B), "LOG SENSE" }, + /* 4E O STOP PLAY/SCAN */ + { 0x4E, R, "STOP PLAY/SCAN" }, + /* 4F */ + /* 50 O XDWRITE(10) */ + { 0x50, D, "XDWRITE(10)" }, + /* 51 O XPWRITE(10) */ + { 0x51, D, "XPWRITE(10)" }, + /* 51 O READ DISC INFORMATION */ + { 0x51, R, "READ DISC INFORMATION" }, + /* 52 O XDREAD(10) */ + { 0x52, D, "XDREAD(10)" }, + /* 52 O READ TRACK INFORMATION */ + { 0x52, R, "READ TRACK INFORMATION" }, + /* 53 O RESERVE TRACK */ + { 0x53, R, "RESERVE TRACK" }, + /* 54 O SEND OPC INFORMATION */ + { 0x54, R, "SEND OPC INFORMATION" }, + /* 55 OOO OMOOOOMOMO MODE SELECT(10) */ + { 0x55, ALL & ~(P), "MODE SELECT(10)" }, + /* 56 ZZMZO OOOZ RESERVE(10) */ + { 0x56, ALL & ~(R | B | K | V | F | C), "RESERVE(10)" }, + /* 56 Z RESERVE ELEMENT(10) */ + { 0x56, M, "RESERVE ELEMENT(10)" }, + /* 57 ZZMZO OOOZ RELEASE(10) */ + { 0x57, ALL & ~(R | B | K | V | F | C), "RELEASE(10)" }, + /* 57 Z RELEASE ELEMENT(10) */ + { 0x57, M, "RELEASE ELEMENT(10)" }, + /* 58 O REPAIR TRACK */ + { 0x58, R, "REPAIR TRACK" }, + /* 59 */ + /* 5A OOO OMOOOOMOMO MODE SENSE(10) */ + { 0x5A, ALL & ~(P), "MODE SENSE(10)" }, + /* 5B O CLOSE TRACK/SESSION */ + { 0x5B, R, "CLOSE TRACK/SESSION" }, + /* 5C O READ BUFFER CAPACITY */ + { 0x5C, R, "READ BUFFER CAPACITY" }, + /* 5D O SEND CUE SHEET */ + { 0x5D, R, "SEND CUE SHEET" }, + /* 5E OOOOO OOOO M PERSISTENT RESERVE IN */ + { 0x5E, ALL & ~(R | B | K | V | C), "PERSISTENT RESERVE IN" }, + /* 5F OOOOO OOOO M PERSISTENT RESERVE OUT */ + { 0x5F, ALL & ~(R | B | K | V | C), "PERSISTENT RESERVE OUT" }, + /* 7E OO O OOOO O extended CDB */ + { 0x7E, D | T | R | M | A | E | B | V, "extended CDB" }, + /* 7F O M variable length CDB (more than 16 bytes) */ + { 0x7F, D | F, "variable length CDB (more than 16 bytes)" }, + /* 80 Z XDWRITE EXTENDED(16) */ + { 0x80, D, "XDWRITE EXTENDED(16)" }, + /* 80 M WRITE FILEMARKS(16) */ + { 0x80, T, "WRITE FILEMARKS(16)" }, + /* 81 Z REBUILD(16) */ + { 0x81, D, "REBUILD(16)" }, + /* 81 O READ REVERSE(16) */ + { 0x81, T, "READ REVERSE(16)" }, + /* 82 Z REGENERATE(16) */ + { 0x82, D, "REGENERATE(16)" }, + /* 83 OOOOO O OO EXTENDED COPY */ + { 0x83, D | T | L | P | W | O | K | V, "EXTENDED COPY" }, + /* 84 OOOOO O OO RECEIVE COPY RESULTS */ + { 0x84, D | T | L | P | W | O | K | V, "RECEIVE COPY RESULTS" }, + /* 85 O O O ATA COMMAND PASS THROUGH(16) */ + { 0x85, D | R | B, "ATA COMMAND PASS THROUGH(16)" }, + /* 86 OO OO OOOOOOO ACCESS CONTROL IN */ + { 0x86, ALL & ~(L | R | F), "ACCESS CONTROL IN" }, + /* 87 OO OO OOOOOOO ACCESS CONTROL OUT */ + { 0x87, ALL & ~(L | R | F), "ACCESS CONTROL OUT" }, + /* + * XXX READ(16)/WRITE(16) were not listed for CD/DVE in op-num.txt + * but we had it since r1.40. Do we really want them? + */ + /* 88 MM O O O READ(16) */ + { 0x88, D | T | W | O | B, "READ(16)" }, + /* 89 */ + /* 8A OM O O O WRITE(16) */ + { 0x8A, D | T | W | O | B, "WRITE(16)" }, + /* 8B O ORWRITE */ + { 0x8B, D, "ORWRITE" }, + /* 8C OO O OO O M READ ATTRIBUTE */ + { 0x8C, D | T | W | O | M | B | V, "READ ATTRIBUTE" }, + /* 8D OO O OO O O WRITE ATTRIBUTE */ + { 0x8D, D | T | W | O | M | B | V, "WRITE ATTRIBUTE" }, + /* 8E O O O O WRITE AND VERIFY(16) */ + { 0x8E, D | W | O | B, "WRITE AND VERIFY(16)" }, + /* 8F OO O O O VERIFY(16) */ + { 0x8F, D | T | W | O | B, "VERIFY(16)" }, + /* 90 O O O O PRE-FETCH(16) */ + { 0x90, D | W | O | B, "PRE-FETCH(16)" }, + /* 91 O O O O SYNCHRONIZE CACHE(16) */ + { 0x91, D | W | O | B, "SYNCHRONIZE CACHE(16)" }, + /* 91 O SPACE(16) */ + { 0x91, T, "SPACE(16)" }, + /* 92 Z O O LOCK UNLOCK CACHE(16) */ + { 0x92, D | W | O, "LOCK UNLOCK CACHE(16)" }, + /* 92 O LOCATE(16) */ + { 0x92, T, "LOCATE(16)" }, + /* 93 O WRITE SAME(16) */ + { 0x93, D, "WRITE SAME(16)" }, + /* 93 M ERASE(16) */ + { 0x93, T, "ERASE(16)" }, + /* 94 [usage proposed by SCSI Socket Services project] */ + /* 95 [usage proposed by SCSI Socket Services project] */ + /* 96 [usage proposed by SCSI Socket Services project] */ + /* 97 [usage proposed by SCSI Socket Services project] */ + /* 98 */ + /* 99 */ + /* 9A */ + /* 9B */ + /* 9C */ + /* 9D */ + /* XXX KDM ALL for this? op-num.txt defines it for none.. */ + /* 9E SERVICE ACTION IN(16) */ + { 0x9E, ALL, "SERVICE ACTION IN(16)" }, + /* XXX KDM ALL for this? op-num.txt defines it for ADC.. */ + /* 9F M SERVICE ACTION OUT(16) */ + { 0x9F, ALL, "SERVICE ACTION OUT(16)" }, + /* A0 MMOOO OMMM OMO REPORT LUNS */ + { 0xA0, ALL & ~(R | B), "REPORT LUNS" }, + /* A1 O BLANK */ + { 0xA1, R, "BLANK" }, + /* A1 O O ATA COMMAND PASS THROUGH(12) */ + { 0xA1, D | B, "ATA COMMAND PASS THROUGH(12)" }, + /* A2 OO O O SECURITY PROTOCOL IN */ + { 0xA2, D | T | R | V, "SECURITY PROTOCOL IN" }, + /* A3 OOO O OOMOOOM MAINTENANCE (IN) */ + { 0xA3, ALL & ~(P | R | F), "MAINTENANCE (IN)" }, + /* A3 O SEND KEY */ + { 0xA3, R, "SEND KEY" }, + /* A4 OOO O OOOOOOO MAINTENANCE (OUT) */ + { 0xA4, ALL & ~(P | R | F), "MAINTENANCE (OUT)" }, + /* A4 O REPORT KEY */ + { 0xA4, R, "REPORT KEY" }, + /* A5 O O OM MOVE MEDIUM */ + { 0xA5, T | W | O | M, "MOVE MEDIUM" }, + /* A5 O PLAY AUDIO(12) */ + { 0xA5, R, "PLAY AUDIO(12)" }, + /* A6 O EXCHANGE MEDIUM */ + { 0xA6, M, "EXCHANGE MEDIUM" }, + /* A6 O LOAD/UNLOAD C/DVD */ + { 0xA6, R, "LOAD/UNLOAD C/DVD" }, + /* A7 ZZ O O MOVE MEDIUM ATTACHED */ + { 0xA7, D | T | W | O, "MOVE MEDIUM ATTACHED" }, + /* A7 O SET READ AHEAD */ + { 0xA7, R, "SET READ AHEAD" }, + /* A8 O OOO READ(12) */ + { 0xA8, D | W | R | O, "READ(12)" }, + /* A8 GET MESSAGE(12) */ + { 0xA8, C, "GET MESSAGE(12)" }, + /* A9 O SERVICE ACTION OUT(12) */ + { 0xA9, V, "SERVICE ACTION OUT(12)" }, + /* AA O OOO WRITE(12) */ + { 0xAA, D | W | R | O, "WRITE(12)" }, + /* AA SEND MESSAGE(12) */ + { 0xAA, C, "SEND MESSAGE(12)" }, + /* AB O O SERVICE ACTION IN(12) */ + { 0xAB, R | V, "SERVICE ACTION IN(12)" }, + /* AC O ERASE(12) */ + { 0xAC, O, "ERASE(12)" }, + /* AC O GET PERFORMANCE */ + { 0xAC, R, "GET PERFORMANCE" }, + /* AD O READ DVD STRUCTURE */ + { 0xAD, R, "READ DVD STRUCTURE" }, + /* AE O O O WRITE AND VERIFY(12) */ + { 0xAE, D | W | O, "WRITE AND VERIFY(12)" }, + /* AF O OZO VERIFY(12) */ + { 0xAF, D | W | R | O, "VERIFY(12)" }, + /* B0 ZZZ SEARCH DATA HIGH(12) */ + { 0xB0, W | R | O, "SEARCH DATA HIGH(12)" }, + /* B1 ZZZ SEARCH DATA EQUAL(12) */ + { 0xB1, W | R | O, "SEARCH DATA EQUAL(12)" }, + /* B2 ZZZ SEARCH DATA LOW(12) */ + { 0xB2, W | R | O, "SEARCH DATA LOW(12)" }, + /* B3 Z OZO SET LIMITS(12) */ + { 0xB3, D | W | R | O, "SET LIMITS(12)" }, + /* B4 ZZ OZO READ ELEMENT STATUS ATTACHED */ + { 0xB4, D | T | W | R | O, "READ ELEMENT STATUS ATTACHED" }, + /* B5 OO O O SECURITY PROTOCOL OUT */ + { 0xB5, D | T | R | V, "SECURITY PROTOCOL OUT" }, + /* B5 O REQUEST VOLUME ELEMENT ADDRESS */ + { 0xB5, M, "REQUEST VOLUME ELEMENT ADDRESS" }, + /* B6 O SEND VOLUME TAG */ + { 0xB6, M, "SEND VOLUME TAG" }, + /* B6 O SET STREAMING */ + { 0xB6, R, "SET STREAMING" }, + /* B7 O O READ DEFECT DATA(12) */ + { 0xB7, D | O, "READ DEFECT DATA(12)" }, + /* B8 O OZOM READ ELEMENT STATUS */ + { 0xB8, T | W | R | O | M, "READ ELEMENT STATUS" }, + /* B9 O READ CD MSF */ + { 0xB9, R, "READ CD MSF" }, + /* BA O O OOMO REDUNDANCY GROUP (IN) */ + { 0xBA, D | W | O | M | A | E, "REDUNDANCY GROUP (IN)" }, + /* BA O SCAN */ + { 0xBA, R, "SCAN" }, + /* BB O O OOOO REDUNDANCY GROUP (OUT) */ + { 0xBB, D | W | O | M | A | E, "REDUNDANCY GROUP (OUT)" }, + /* BB O SET CD SPEED */ + { 0xBB, R, "SET CD SPEED" }, + /* BC O O OOMO SPARE (IN) */ + { 0xBC, D | W | O | M | A | E, "SPARE (IN)" }, + /* BD O O OOOO SPARE (OUT) */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From scottl at FreeBSD.org Sun Mar 1 08:26:40 2009 From: scottl at FreeBSD.org (Scott Long) Date: Sun Mar 1 08:26:56 2009 Subject: svn commit: r189240 - in stable/7/sys: . cam/scsi contrib/pf dev/ath/ath_hal dev/cxgb Message-ID: <200903011626.n21GQdw2048329@svn.freebsd.org> Author: scottl Date: Sun Mar 1 16:26:38 2009 New Revision: 189240 URL: http://svn.freebsd.org/changeset/base/189240 Log: Merge 181791: SCSI_DELAY is specified in milliseconds. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/scsi/scsi_all.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/7/sys/cam/scsi/scsi_all.c Sun Mar 1 16:24:57 2009 (r189239) +++ stable/7/sys/cam/scsi/scsi_all.c Sun Mar 1 16:26:38 2009 (r189240) @@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$"); #endif /* !_KERNEL */ /* - * This is the default number of seconds we wait for devices to settle + * This is the default number of milliseconds we wait for devices to settle * after a SCSI bus reset. */ #ifndef SCSI_DELAY From scottl at FreeBSD.org Sun Mar 1 08:28:18 2009 From: scottl at FreeBSD.org (Scott Long) Date: Sun Mar 1 08:28:30 2009 Subject: svn commit: r189241 - in stable/7/sys: . cam/scsi contrib/pf dev/cxgb Message-ID: <200903011628.n21GSH8g048420@svn.freebsd.org> Author: scottl Date: Sun Mar 1 16:28:17 2009 New Revision: 189241 URL: http://svn.freebsd.org/changeset/base/189241 Log: Merge 186371: Fix refcount locking in cd, pass, and sg periphs. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/scsi/scsi_cd.c stable/7/sys/cam/scsi/scsi_pass.c stable/7/sys/cam/scsi/scsi_sg.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/7/sys/cam/scsi/scsi_cd.c Sun Mar 1 16:26:38 2009 (r189240) +++ stable/7/sys/cam/scsi/scsi_cd.c Sun Mar 1 16:28:17 2009 (r189241) @@ -996,12 +996,6 @@ cdopen(struct disk *dp) return (error); } - /* Closes aren't symmetrical with opens, so fix up the refcounting. */ - if (softc->flags & CD_FLAG_OPEN) - cam_periph_release(periph); - else - softc->flags |= CD_FLAG_OPEN; - /* * Check for media, and set the appropriate flags. We don't bail * if we don't have media, but then we don't allow anything but the @@ -1011,7 +1005,15 @@ cdopen(struct disk *dp) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("leaving cdopen\n")); cam_periph_unhold(periph); - cam_periph_unlock(periph); + + /* Closes aren't symmetrical with opens, so fix up the refcounting. */ + if ((softc->flags & CD_FLAG_OPEN) == 0) { + softc->flags |= CD_FLAG_OPEN; + cam_periph_unlock(periph); + } else { + cam_periph_unlock(periph); + cam_periph_release(periph); + } return (0); } Modified: stable/7/sys/cam/scsi/scsi_pass.c ============================================================================== --- stable/7/sys/cam/scsi/scsi_pass.c Sun Mar 1 16:26:38 2009 (r189240) +++ stable/7/sys/cam/scsi/scsi_pass.c Sun Mar 1 16:28:17 2009 (r189241) @@ -345,13 +345,13 @@ passopen(struct cdev *dev, int flags, in if ((softc->flags & PASS_FLAG_OPEN) == 0) { softc->flags |= PASS_FLAG_OPEN; + cam_periph_unlock(periph); } else { /* Device closes aren't symmertical, so fix up the refcount */ + cam_periph_unlock(periph); cam_periph_release(periph); } - cam_periph_unlock(periph); - return (error); } Modified: stable/7/sys/cam/scsi/scsi_sg.c ============================================================================== --- stable/7/sys/cam/scsi/scsi_sg.c Sun Mar 1 16:26:38 2009 (r189240) +++ stable/7/sys/cam/scsi/scsi_sg.c Sun Mar 1 16:28:17 2009 (r189241) @@ -400,13 +400,13 @@ sgopen(struct cdev *dev, int flags, int if ((softc->flags & SG_FLAG_OPEN) == 0) { softc->flags |= SG_FLAG_OPEN; + cam_periph_unlock(periph); } else { /* Device closes aren't symmetrical, fix up the refcount. */ + cam_periph_unlock(periph); cam_periph_release(periph); } - cam_periph_unlock(periph); - return (error); } From scottl at FreeBSD.org Sun Mar 1 08:31:36 2009 From: scottl at FreeBSD.org (Scott Long) Date: Sun Mar 1 08:31:48 2009 Subject: svn commit: r189242 - in stable/7/sys: . cam/scsi contrib/pf dev/ath/ath_hal dev/cxgb Message-ID: <200903011631.n21GVZho048598@svn.freebsd.org> Author: scottl Date: Sun Mar 1 16:31:35 2009 New Revision: 189242 URL: http://svn.freebsd.org/changeset/base/189242 Log: Merge 182433: Fix locking mistake in the da driver. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/scsi/scsi_da.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/7/sys/cam/scsi/scsi_da.c Sun Mar 1 16:28:17 2009 (r189241) +++ stable/7/sys/cam/scsi/scsi_da.c Sun Mar 1 16:31:35 2009 (r189242) @@ -674,18 +674,19 @@ daopen(struct disk *dp) softc->disk->d_fwheads = softc->params.heads; softc->disk->d_devstat->block_size = softc->params.secsize; softc->disk->d_devstat->flags &= ~DEVSTAT_BS_UNAVAILABLE; - } - - if (error == 0) { + if ((softc->flags & DA_FLAG_PACK_REMOVABLE) != 0 && (softc->quirks & DA_Q_NO_PREVENT) == 0) daprevent(periph, PR_PREVENT); - } else { + } else softc->flags &= ~DA_FLAG_OPEN; - cam_periph_release(periph); - } + cam_periph_unhold(periph); cam_periph_unlock(periph); + + if (error != 0) { + cam_periph_release(periph); + } return (error); } From scottl at FreeBSD.org Sun Mar 1 08:41:49 2009 From: scottl at FreeBSD.org (Scott Long) Date: Sun Mar 1 08:42:01 2009 Subject: svn commit: r189243 - in stable/7/sys: . contrib/pf dev/arcmsr dev/ath/ath_hal dev/cxgb Message-ID: <200903011641.n21Gfmqc048858@svn.freebsd.org> Author: scottl Date: Sun Mar 1 16:41:48 2009 New Revision: 189243 URL: http://svn.freebsd.org/changeset/base/189243 Log: Merge 188844: Fix pseudo-scsi parameters so that more than one i/o can be queued at a time. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/arcmsr/arcmsr.c stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/dev/arcmsr/arcmsr.c ============================================================================== --- stable/7/sys/dev/arcmsr/arcmsr.c Sun Mar 1 16:31:35 2009 (r189242) +++ stable/7/sys/dev/arcmsr/arcmsr.c Sun Mar 1 16:41:48 2009 (r189243) @@ -2150,7 +2150,8 @@ static void arcmsr_action(struct cam_sim spi->sync_offset=32; spi->bus_width=MSG_EXT_WDTR_BUS_16_BIT; scsi->flags = CTS_SCSI_FLAGS_TAG_ENB; - spi->valid = CTS_SPI_VALID_SYNC_RATE + spi->valid = CTS_SPI_VALID_DISC + | CTS_SPI_VALID_SYNC_RATE | CTS_SPI_VALID_SYNC_OFFSET | CTS_SPI_VALID_BUS_WIDTH; scsi->valid = CTS_SCSI_VALID_TQ; From scottl at FreeBSD.org Sun Mar 1 08:43:47 2009 From: scottl at FreeBSD.org (Scott Long) Date: Sun Mar 1 08:44:04 2009 Subject: svn commit: r189244 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/ciss dev/cxgb Message-ID: <200903011643.n21GhkPu048955@svn.freebsd.org> Author: scottl Date: Sun Mar 1 16:43:45 2009 New Revision: 189244 URL: http://svn.freebsd.org/changeset/base/189244 Log: Merge 188845: Fix pseudo-scsi parameters so that more than 2 commands will be queued to the device at once. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/ciss/ciss.c stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/dev/ciss/ciss.c ============================================================================== --- stable/7/sys/dev/ciss/ciss.c Sun Mar 1 16:41:48 2009 (r189243) +++ stable/7/sys/dev/ciss/ciss.c Sun Mar 1 16:43:45 2009 (r189244) @@ -2696,8 +2696,8 @@ ciss_cam_action(struct cam_sim *sim, uni { struct ccb_trans_settings *cts = &ccb->cts; int bus, target; - struct ccb_trans_settings_spi *spi = - &cts->xport_specific.spi; + struct ccb_trans_settings_spi *spi = &cts->xport_specific.spi; + struct ccb_trans_settings_scsi *scsi = &cts->proto_specific.scsi; bus = cam_sim_bus(sim); target = cts->ccb_h.target_id; @@ -2712,6 +2712,9 @@ ciss_cam_action(struct cam_sim *sim, uni spi->valid = CTS_SPI_VALID_DISC; spi->flags = CTS_SPI_FLAGS_DISC_ENB; + scsi->valid = CTS_SCSI_VALID_TQ; + scsi->flags = CTS_SCSI_FLAGS_TAG_ENB; + cts->ccb_h.status = CAM_REQ_CMP; break; } From mav at FreeBSD.org Sun Mar 1 08:47:50 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sun Mar 1 08:48:03 2009 Subject: svn commit: r189245 - head/sys/dev/ata/chipsets Message-ID: <200903011647.n21GlnAQ049101@svn.freebsd.org> Author: mav Date: Sun Mar 1 16:47:49 2009 New Revision: 189245 URL: http://svn.freebsd.org/changeset/base/189245 Log: Comment out enabling FIS Based Switching inside ata_ahci_issue_cmd() as it done in other places. Until we have no support for command queueing we have no any benefit from FBS, while enabling it only here somehow leads to "port not ready" errors on Intel 63XXESB2 controller. Tested by: Larry Rosenman Modified: head/sys/dev/ata/chipsets/ata-ahci.c Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Sun Mar 1 16:43:45 2009 (r189244) +++ head/sys/dev/ata/chipsets/ata-ahci.c Sun Mar 1 16:47:49 2009 (r189245) @@ -470,7 +470,7 @@ ata_ahci_issue_cmd(device_t dev, u_int16 clp->cmd_table_phys = htole64(ch->dma.work_bus + ATA_AHCI_CT_OFFSET); /* set PM port */ - ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FBS + offset, (port << 8) | 0x00000001); + //ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FBS + offset, (port << 8) | 0x00000001); /* issue command to controller */ ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CI + offset, 1); From scottl at FreeBSD.org Sun Mar 1 08:50:51 2009 From: scottl at FreeBSD.org (Scott Long) Date: Sun Mar 1 08:51:04 2009 Subject: svn commit: r189246 - in stable/7/sys: . contrib/pf dev/ata dev/ath/ath_hal dev/cxgb Message-ID: <200903011650.n21GokYf049195@svn.freebsd.org> Author: scottl Date: Sun Mar 1 16:50:46 2009 New Revision: 189246 URL: http://svn.freebsd.org/changeset/base/189246 Log: Merge 188840: Add DDF metadata support, found commonly on motherboards with Adaptec branding. For Entertainment Purposes Only! Added: stable/7/sys/dev/ata/ata-raid-ddf.h - copied unchanged from r188840, head/sys/dev/ata/ata-raid-ddf.h Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ata/ata-raid.c stable/7/sys/dev/ata/ata-raid.h stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Copied: stable/7/sys/dev/ata/ata-raid-ddf.h (from r188840, head/sys/dev/ata/ata-raid-ddf.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sys/dev/ata/ata-raid-ddf.h Sun Mar 1 16:50:46 2009 (r189246, copy of r188840, head/sys/dev/ata/ata-raid-ddf.h) @@ -0,0 +1,333 @@ +/*- + * Copyright (c) 2008 Scott Long + * 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, + * without modification, immediately at the beginning of the file. + * 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef ATA_RAID_DDF_H +#define ATA_RAID_DDF_H + +/* Definitions from the SNIA DDF spec, rev 1.2 */ + +#define DDF_HEADER_LENGTH 512 +struct ddf_header { + uint32_t Signature; +#define DDF_HEADER_SIGNATURE 0xde11de11 + uint32_t CRC; + uint8_t DDF_Header_GUID[24]; + uint8_t DDF_rev[8]; + uint32_t Sequence_Number; + uint32_t TimeStamp; + uint8_t Open_Flag; +#define DDF_HEADER_CLOSED 0x00 +#define DDF_HEADER_OPENED_MASK 0x0f +#define DDF_HEADER_OPEN_ANCHOR 0xff + uint8_t Foreign_Flag; + uint8_t Diskgrouping; + uint8_t pad1[13]; + uint8_t Header_ext[32]; + uint64_t Primary_Header_LBA; + uint64_t Secondary_Header_LBA; + uint8_t Header_Type; +#define DDF_HEADER_ANCHOR 0x00 +#define DDF_HEADER_PRIMARY 0x01 +#define DDF_HEADER_SECONDARY 0x02 + uint8_t pad2[3]; + uint32_t WorkSpace_Length; + uint64_t WorkSpace_LBA; + uint16_t Max_PD_Entries; + uint16_t Max_VD_Entries; + uint16_t Max_Partitions; + uint16_t Configuration_Record_Length; + uint16_t Max_Primary_Element_Entries; + uint8_t pad3[54]; + uint32_t cd_section; /* Controller_Data_Section */ + uint32_t cd_length; /* Controller_Data_Section_Length */ + uint32_t pdr_section; /* Physical_Drive_Records_Section */ + uint32_t pdr_length; /* Physical_Drive_Records_Length */ + uint32_t vdr_section; /* Virtual_Drive_Records_Section */ + uint32_t vdr_length; /* Virtual_Drive_Records_Length */ + uint32_t cr_section; /* Configuration_Records_Section */ + uint32_t cr_length; /* Configuration_Records_Length */ + uint32_t pdd_section; /* Physical_Drive_Data_Section */ + uint32_t pdd_length; /* Physical_Drive_Data_Length */ + uint32_t bbmlog_section; /* BBM_Log_Section */ + uint32_t bbmlog_length; /* BBM_Log_Section_Length */ + uint32_t Diagnostic_Space; + uint32_t Diagnostic_Space_Length; + uint32_t Vendor_Specific_Logs; + uint32_t Vendor_Specific_Logs_Length; + uint8_t pad4[256]; +} __packed; + +struct ddf_cd_record { + uint32_t Signature; +#define DDF_CONTROLLER_DATA_SIGNATURE 0xad111111 + uint32_t CRC; + uint8_t Controller_GUID[24]; + struct { + uint16_t Vendor_ID; + uint16_t Device_ID; + uint16_t SubVendor_ID; + uint16_t SubDevice_ID; + } Controller_Type __packed; + uint8_t Product_ID[16]; + uint8_t pad1[8]; + uint8_t Controller_Data[448]; +} __packed; + +struct ddf_device_scsi { + uint8_t Lun; + uint8_t Id; + uint8_t Channel; + uint8_t Path_Flags; +#define DDF_DEVICE_SCSI_FLAG_BROKEN (1 << 7) +} __packed; + +struct ddf_device_sas { + uint64_t Initiator_Path; +} __packed; + +union ddf_pathinfo { + struct { + struct ddf_device_scsi Path0; + struct ddf_device_scsi Path1; + uint8_t pad[10]; + } __packed scsi; + struct { + struct ddf_device_sas Path0; + struct ddf_device_sas Path1; + uint8_t Path0_Flags; + uint8_t Path1_Flags; +#define DDF_DEVICE_SAS_FLAG_BROKEN (1 << 7) + } __packed sas; +} __packed; + +struct ddf_pd_entry { + uint8_t PD_GUID[24]; + uint32_t PD_Reference; + uint16_t PD_Type; +#define DDF_PDE_GUID_FORCE (1 << 0) +#define DDF_PDE_PARTICIPATING (1 << 1) +#define DDF_PDE_GLOBAL_SPARE (1 << 2) +#define DDF_PDE_CONFIG_SPARE (1 << 3) +#define DDF_PDE_FOREIGN (1 << 4) +#define DDF_PDE_LEGACY (1 << 5) +#define DDF_PDE_TYPE_MASK (0x0f << 12) +#define DDF_PDE_UNKNOWN (0x00 << 12) +#define DDF_PDE_SCSI (0x01 << 12) +#define DDF_PDE_SAS (0x02 << 12) +#define DDF_PDE_SATA (0x03 << 12) +#define DDF_PDE_FC (0x04 << 12) + uint16_t PD_State; +#define DDF_PDE_ONLINE (1 << 0) +#define DDF_PDE_FAILED (1 << 1) +#define DDF_PDE_REBUILD (1 << 2) +#define DDF_PDE_TRANSITION (1 << 3) +#define DDF_PDE_PFA (1 << 4) +#define DDF_PDE_UNRECOVERED (1 << 5) +#define DDF_PDE_MISSING (1 << 6) + uint64_t Configured_Size; + union ddf_pathinfo Path_Information; + uint8_t pad1[6]; +} __packed; + +struct ddf_pd_record { + uint32_t Signature; +#define DDF_PDR_SIGNATURE 0x22222222 + uint32_t CRC; + uint16_t Populated_PDEs; + uint16_t Max_PDE_Supported; + uint8_t pad1[52]; + struct ddf_pd_entry entry[0]; +} __packed; + +struct ddf_vd_entry { + uint8_t VD_GUID[24]; + uint16_t VD_Number; + uint8_t pad1[2]; + uint16_t VD_Type; +#define DDF_VDE_SHARED (1 << 0) +#define DDF_VDE_ENFORCE_GROUP (1 << 1) +#define DDF_VDE_UNICODE_NAME (1 << 2) +#define DDF_VDE_OWNER_ID_VALID (1 << 3) + uint16_t Controller_GUID_CRC; + uint8_t VD_State; +#define DDF_VDE_OPTIMAL 0x00 +#define DDF_VDE_DEGRADED 0x01 +#define DDF_VDE_DELETED 0x02 +#define DDF_VDE_MISSING 0x03 +#define DDF_VDE_FAILED 0x04 +#define DDF_VDE_PARTIAL 0x05 +#define DDF_VDE_STATE_MASK 0x07 +#define DDF_VDE_MORPH (1 << 3) +#define DDF_VDE_DIRTY (1 << 4) + uint8_t Init_State; +#define DDF_VDE_UNINTIALIZED 0x00 +#define DDF_VDE_INIT_QUICK 0x01 +#define DDF_VDE_INIT_FULL 0x02 +#define DDF_VDE_INIT_MASK 0x03 +#define DDF_VDE_UACCESS_RW 0x00 +#define DDF_VDE_UACCESS_RO 0x80 +#define DDF_VDE_UACCESS_BLOCKED 0xc0 +#define DDF_VDE_UACCESS_MASK 0xc0 + uint8_t pad2[14]; + uint8_t VD_Name[16]; +} __packed; + +struct ddf_vd_record { + uint32_t Signature; +#define DDF_VD_RECORD_SIGNATURE 0xdddddddd + uint32_t CRC; + uint16_t Populated_VDEs; + uint16_t Max_VDE_Supported; + uint8_t pad1[52]; + struct ddf_vd_entry entry[0]; +} __packed; + +#define DDF_CR_INVALID 0xffffffff + +struct ddf_vdc_record { + uint32_t Signature; +#define DDF_VDCR_SIGNATURE 0xeeeeeeee + uint32_t CRC; + uint8_t VD_GUID[24]; + uint32_t Timestamp; + uint32_t Sequence_Number; + uint8_t pad1[24]; + uint16_t Primary_Element_Count; + uint8_t Stripe_Size; + uint8_t Primary_RAID_Level; +#define DDF_VDCR_RAID0 0x00 +#define DDF_VDCR_RAID1 0x01 +#define DDF_VDCR_RAID3 0x03 +#define DDF_VDCR_RAID4 0x04 +#define DDF_VDCR_RAID5 0x05 +#define DDF_VDCR_RAID6 0x06 +#define DDF_VDCR_RAID1E 0x11 +#define DDF_VDCR_SINGLE 0x0f +#define DDF_VDCR_CONCAT 0x1f +#define DDF_VDCR_RAID5E 0x15 +#define DDF_VDCR_RAID5EE 0x25 + uint8_t RLQ; + uint8_t Secondary_Element_Count; + uint8_t Secondary_Element_Seq; + uint8_t Secondary_RAID_Level; + uint64_t Block_Count; + uint64_t VD_Size; + uint8_t pad2[8]; + uint32_t Associated_Spares[8]; + uint64_t Cache_Flags; +#define DDF_VDCR_CACHE_WB (1 << 0) +#define DDF_VDCR_CACHE_WB_ADAPTIVE (1 << 1) +#define DDF_VDCR_CACHE_RA (1 << 2) +#define DDF_VDCR_CACHE_RA_ADAPTIVE (1 << 3) +#define DDF_VDCR_CACHE_WCACHE_NOBATTERY (1 << 4) +#define DDF_VDCR_CACHE_WCACHE_ALLOW (1 << 5) +#define DDF_VDCR_CACHE_RCACHE_ALLOW (1 << 6) +#define DDF_VDCR_CACHE_VENDOR (1 << 7) + uint8_t BG_Rate; + uint8_t pad3[3]; + uint8_t pad4[52]; + uint8_t pad5[192]; + uint8_t V0[32]; + uint8_t V1[32]; + uint8_t V2[16]; + uint8_t V3[16]; + uint8_t Vendor_Scratch[32]; + uint32_t Physical_Disk_Sequence[0]; +} __packed; + +struct ddf_vuc_record { + uint32_t Signature; +#define DDF_VUCR_SIGNATURE 0x88888888 + uint32_t CRC; + uint8_t VD_GUID[24]; +} __packed; + +struct ddf_sa_entry { + uint8_t VD_GUID[24]; + uint16_t Secondary_Element; + uint8_t rsrvd2[6]; +} __packed; + +struct ddf_sa_record { + uint32_t Signature; +#define DDF_SA_SIGNATURE 0x55555555 + uint32_t CRC; + uint32_t Timestamp; + uint8_t pad1[7]; + uint8_t Spare_Type; +#define DDF_SAR_TYPE_DEDICATED (1 << 0) +#define DDF_SAR_TYPE_REVERTIBLE (1 << 1) +#define DDF_SAR_TYPE_ACTIVE (1 << 2) +#define DDF_SAR_TYPE_ENCL_AFFINITY (1 << 3) + uint16_t Populated_SAEs; + uint16_t MAX_SAE_Supported; + uint8_t pad2[8]; + struct ddf_sa_entry entry[0]; +} __packed; + +struct ddf_pdd_record { + uint32_t Signature; +#define DDF_PDD_SIGNATURE 0x33333333 + uint32_t CRC; + uint8_t PD_GUID[24]; + uint32_t PD_Reference; + uint8_t Forced_Ref_Flag; +#define DDF_PDD_FORCED_REF 0x01 + uint8_t Forced_PD_GUID_Flag; +#define DDF_PDD_FORCED_GUID 0x01 + uint8_t Vendor_Scratch[32]; + uint8_t pad2[442]; +} __packed; + +struct ddf_bbm_entry { + uint64_t Defective_Block_Start; + uint32_t Spare_Block_Offset; + uint16_t Remapped_Count; + uint8_t pad[2]; +}; + +struct ddf_bbm_log { + uint32_t Signature; +#define DDF_BBML_SIGNATURE 0xabadb10c + uint32_t CRC; + uint16_t Entry_Count; + uint32_t Spare_Block_Count; + uint8_t pad1[10]; + uint64_t First_Spare_LBA; + uint64_t Mapped_Block_Entry[0]; +} __packed; + +struct ddf_vendor_log { + uint32_t Signature; +#define DDF_VENDOR_LOG_SIGNATURE 0x01dbeef0 + uint32_t CRC; + uint64_t Log_Owner; + uint8_t pad1[16]; +} __packed; + +#endif Modified: stable/7/sys/dev/ata/ata-raid.c ============================================================================== --- stable/7/sys/dev/ata/ata-raid.c Sun Mar 1 16:47:49 2009 (r189245) +++ stable/7/sys/dev/ata/ata-raid.c Sun Mar 1 16:50:46 2009 (r189246) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -65,6 +66,7 @@ static int ata_raid_read_metadata(device static int ata_raid_write_metadata(struct ar_softc *rdp); static int ata_raid_wipe_metadata(struct ar_softc *rdp); static int ata_raid_adaptec_read_meta(device_t dev, struct ar_softc **raidp); +static int ata_raid_ddf_read_meta(device_t dev, struct ar_softc **raidp); static int ata_raid_hptv2_read_meta(device_t dev, struct ar_softc **raidp); static int ata_raid_hptv2_write_meta(struct ar_softc *rdp); static int ata_raid_hptv3_read_meta(device_t dev, struct ar_softc **raidp); @@ -93,6 +95,7 @@ static char * ata_raid_flags(struct ar_s /* debugging only */ static void ata_raid_print_meta(struct ar_softc *meta); static void ata_raid_adaptec_print_meta(struct adaptec_raid_conf *meta); +static void ata_raid_ddf_print_meta(uint8_t *meta); static void ata_raid_hptv2_print_meta(struct hptv2_raid_conf *meta); static void ata_raid_hptv3_print_meta(struct hptv3_raid_conf *meta); static void ata_raid_intel_print_meta(struct intel_raid_conf *meta); @@ -1407,6 +1410,10 @@ ata_raid_read_metadata(device_t subdisk) if (ata_raid_lsiv2_read_meta(subdisk, ata_raid_arrays)) return 0; + /* DDF (used by Adaptec, maybe others) */ + if (ata_raid_ddf_read_meta(subdisk, ata_raid_arrays)) + return 0; + /* if none of the above matched, try FreeBSD native format */ return ata_raid_promise_read_meta(subdisk, ata_raid_arrays, 1); } @@ -1679,6 +1686,338 @@ adaptec_out: return retval; } +static uint64_t +ddfbe64toh(uint64_t val) +{ + return (be64toh(val)); +} + +static uint32_t +ddfbe32toh(uint32_t val) +{ + return (be32toh(val)); +} + +static uint16_t +ddfbe16toh(uint16_t val) +{ + return (be16toh(val)); +} + +static uint64_t +ddfle64toh(uint64_t val) +{ + return (le64toh(val)); +} + +static uint32_t +ddfle32toh(uint32_t val) +{ + return (le32toh(val)); +} + +static uint16_t +ddfle16toh(uint16_t val) +{ + return (le16toh(val)); +} + +static int +ata_raid_ddf_read_meta(device_t dev, struct ar_softc **raidp) +{ + struct ata_raid_subdisk *ars; + device_t parent = device_get_parent(dev); + struct ddf_header *hdr; + struct ddf_pd_record *pdr; + struct ddf_pd_entry *pde = NULL; + struct ddf_vd_record *vdr; + struct ddf_pdd_record *pdd; + struct ddf_sa_record *sa = NULL; + struct ddf_vdc_record *vdcr = NULL; + struct ddf_vd_entry *vde = NULL; + struct ar_softc *raid; + uint64_t pri_lba; + uint32_t pd_ref, pd_pos; + uint8_t *meta, *cr; + int hdr_len, vd_state = 0, pd_state = 0; + int i, disk, array, retval = 0; + uintptr_t max_cr_addr; + uint64_t (*ddf64toh)(uint64_t) = NULL; + uint32_t (*ddf32toh)(uint32_t) = NULL; + uint16_t (*ddf16toh)(uint16_t) = NULL; + + ars = device_get_softc(dev); + raid = NULL; + + /* Read in the anchor header */ + if (!(meta = malloc(DDF_HEADER_LENGTH, M_AR, M_NOWAIT | M_ZERO))) + return ENOMEM; + + if (ata_raid_rw(parent, DDF_LBA(parent), + meta, DDF_HEADER_LENGTH, ATA_R_READ)) { + if (testing || bootverbose) + device_printf(parent, "DDF read metadata failed\n"); + goto ddf_out; + } + + /* + * Check if this is a DDF RAID struct. Note the apparent "flexibility" + * regarding endianness. + */ + hdr = (struct ddf_header *)meta; + if (be32toh(hdr->Signature) == DDF_HEADER_SIGNATURE) { + ddf64toh = ddfbe64toh; + ddf32toh = ddfbe32toh; + ddf16toh = ddfbe16toh; + } else if (le32toh(hdr->Signature) == DDF_HEADER_SIGNATURE) { + ddf64toh = ddfle64toh; + ddf32toh = ddfle32toh; + ddf16toh = ddfle16toh; + } else + goto ddf_out; + + if (hdr->Header_Type != DDF_HEADER_ANCHOR) { + if (testing || bootverbose) + device_printf(parent, "DDF check1 failed\n"); + goto ddf_out; + } + + pri_lba = ddf64toh(hdr->Primary_Header_LBA); + hdr_len = ddf32toh(hdr->cd_section) + ddf32toh(hdr->cd_length); + hdr_len = max(hdr_len,ddf32toh(hdr->pdr_section)+ddf32toh(hdr->pdr_length)); + hdr_len = max(hdr_len,ddf32toh(hdr->vdr_section)+ddf32toh(hdr->vdr_length)); + hdr_len = max(hdr_len,ddf32toh(hdr->cr_section) +ddf32toh(hdr->cr_length)); + hdr_len = max(hdr_len,ddf32toh(hdr->pdd_section)+ddf32toh(hdr->pdd_length)); + if (testing || bootverbose) + device_printf(parent, "DDF pri_lba= %llu length= %d blocks\n", + (unsigned long long)pri_lba, hdr_len); + if ((pri_lba + hdr_len) > DDF_LBA(parent)) { + device_printf(parent, "DDF exceeds length of disk\n"); + goto ddf_out; + } + + /* Don't need the anchor anymore, read the rest of the metadata */ + free(meta, M_AR); + if (!(meta = malloc(hdr_len * DEV_BSIZE, M_AR, M_NOWAIT | M_ZERO))) + return ENOMEM; + + if (ata_raid_rw(parent, pri_lba, meta, hdr_len * DEV_BSIZE, ATA_R_READ)) { + if (testing || bootverbose) + device_printf(parent, "DDF read full metadata failed\n"); + goto ddf_out; + } + + /* Check that we got a Primary Header */ + hdr = (struct ddf_header *)meta; + if ((ddf32toh(hdr->Signature) != DDF_HEADER_SIGNATURE) || + (hdr->Header_Type != DDF_HEADER_PRIMARY)) { + if (testing || bootverbose) + device_printf(parent, "DDF check2 failed\n"); + goto ddf_out; + } + + if (testing || bootverbose) + ata_raid_ddf_print_meta(meta); + + if ((hdr->Open_Flag >= 0x01) && (hdr->Open_Flag <= 0x0f)) { + device_printf(parent, "DDF Header open, possibly corrupt metadata\n"); + goto ddf_out; + } + + pdr = (struct ddf_pd_record*)(meta + ddf32toh(hdr->pdr_section)*DEV_BSIZE); + vdr = (struct ddf_vd_record*)(meta + ddf32toh(hdr->vdr_section)*DEV_BSIZE); + cr = (uint8_t *)(meta + ddf32toh(hdr->cr_section)*DEV_BSIZE); + pdd = (struct ddf_pdd_record*)(meta + ddf32toh(hdr->pdd_section)*DEV_BSIZE); + + /* Verify the Physical Disk Device Record */ + if (ddf32toh(pdd->Signature) != DDF_PDD_SIGNATURE) { + device_printf(parent, "Invalid PD Signature\n"); + goto ddf_out; + } + pd_ref = ddf32toh(pdd->PD_Reference); + pd_pos = -1; + + /* Verify the Physical Disk Record and make sure the disk is usable */ + if (ddf32toh(pdr->Signature) != DDF_PDR_SIGNATURE) { + device_printf(parent, "Invalid PDR Signature\n"); + goto ddf_out; + } + for (i = 0; i < ddf16toh(pdr->Populated_PDEs); i++) { + if (ddf32toh(pdr->entry[i].PD_Reference) != pd_ref) + continue; + pde = &pdr->entry[i]; + pd_state = ddf16toh(pde->PD_State); + } + if ((pde == NULL) || + ((pd_state & DDF_PDE_ONLINE) == 0) || + (pd_state & (DDF_PDE_FAILED|DDF_PDE_MISSING|DDF_PDE_UNRECOVERED))) { + device_printf(parent, "Physical disk not usable\n"); + goto ddf_out; + } + + /* Parse out the configuration record, look for spare and VD records. + * While DDF supports a disk being part of more than one array, and + * thus having more than one VDCR record, that feature is not supported + * by ATA-RAID. Therefore, the first record found takes precedence. + */ + max_cr_addr = (uintptr_t)cr + ddf32toh(hdr->cr_length) * DEV_BSIZE - 1; + for ( ; (uintptr_t)cr < max_cr_addr; + cr += ddf16toh(hdr->Configuration_Record_Length) * DEV_BSIZE) { + switch (ddf32toh(((uint32_t *)cr)[0])) { + case DDF_VDCR_SIGNATURE: + vdcr = (struct ddf_vdc_record *)cr; + goto cr_found; + break; + case DDF_VUCR_SIGNATURE: + /* Don't care about this record */ + break; + case DDF_SA_SIGNATURE: + sa = (struct ddf_sa_record *)cr; + goto cr_found; + break; + case DDF_CR_INVALID: + /* A record was deliberately invalidated */ + break; + default: + device_printf(parent, "Invalid CR signature found\n"); + } + } +cr_found: + if ((vdcr == NULL) /* && (sa == NULL) * Spares not supported yet */) { + device_printf(parent, "No usable configuration record found\n"); + goto ddf_out; + } + + if (vdcr != NULL) { + if (vdcr->Secondary_Element_Count != 1) { + device_printf(parent, "Unsupported multi-level Virtual Disk\n"); + goto ddf_out; + } + + /* Find the Virtual Disk Entry for this array */ + if (ddf32toh(vdr->Signature) != DDF_VD_RECORD_SIGNATURE) { + device_printf(parent, "Invalid VDR Signature\n"); + goto ddf_out; + } + for (i = 0; i < ddf16toh(vdr->Populated_VDEs); i++) { + if (bcmp(vdr->entry[i].VD_GUID, vdcr->VD_GUID, 24)) + continue; + vde = &vdr->entry[i]; + vd_state = vde->VD_State & DDF_VDE_STATE_MASK; + } + if ((vde == NULL) || + ((vd_state != DDF_VDE_OPTIMAL) && (vd_state != DDF_VDE_DEGRADED))) { + device_printf(parent, "Unusable Virtual Disk\n"); + goto ddf_out; + } + for (i = 0; i < ddf16toh(hdr->Max_Primary_Element_Entries); i++) { + uint32_t pd_tmp; + + pd_tmp = ddf32toh(vdcr->Physical_Disk_Sequence[i]); + if ((pd_tmp == 0x00000000) || (pd_tmp == 0xffffffff)) + continue; + if (pd_tmp == pd_ref) { + pd_pos = i; + break; + } + } + if (pd_pos == -1) { + device_printf(parent, "Physical device not part of array\n"); + goto ddf_out; + } + } + + /* now convert DDF metadata into our generic form */ + for (array = 0; array < MAX_ARRAYS; array++) { + if (!raidp[array]) { + raid = (struct ar_softc *)malloc(sizeof(struct ar_softc), M_AR, + M_NOWAIT | M_ZERO); + if (!raid) { + device_printf(parent, "failed to allocate metadata storage\n"); + goto ddf_out; + } + } else + raid = raidp[array]; + + if (raid->format && (raid->format != AR_F_DDF_RAID)) + continue; + + if (raid->magic_0 && (raid->magic_0 != crc32(vde->VD_GUID, 24))) + continue; + + if (!raidp[array]) { + raidp[array] = raid; + + switch (vdcr->Primary_RAID_Level) { + case DDF_VDCR_RAID0: + raid->magic_0 = crc32(vde->VD_GUID, 24); + raid->magic_1 = ddf16toh(vde->VD_Number); + raid->type = AR_T_RAID0; + raid->interleave = 1 << vdcr->Stripe_Size; + raid->width = ddf16toh(vdcr->Primary_Element_Count); + break; + + case DDF_VDCR_RAID1: + raid->magic_0 = crc32(vde->VD_GUID, 24); + raid->magic_1 = ddf16toh(vde->VD_Number); + raid->type = AR_T_RAID1; + raid->width = 1; + break; + + default: + device_printf(parent, "DDF unsupported RAID type 0x%02x\n", + vdcr->Primary_RAID_Level); + free(raidp[array], M_AR); + raidp[array] = NULL; + goto ddf_out; + } + + raid->format = AR_F_DDF_RAID; + raid->generation = ddf32toh(vdcr->Sequence_Number); + raid->total_disks = ddf16toh(vdcr->Primary_Element_Count); + raid->total_sectors = ddf64toh(vdcr->VD_Size); + raid->heads = 255; + raid->sectors = 63; + raid->cylinders = raid->total_sectors / (63 * 255); + raid->offset_sectors = 0; + raid->rebuild_lba = 0; + raid->lun = array; + strncpy(raid->name, vde->VD_Name, + min(sizeof(raid->name), sizeof(vde->VD_Name))); + + /* clear out any old info */ + if (raid->generation) { + for (disk = 0; disk < raid->total_disks; disk++) { + raid->disks[disk].dev = NULL; + raid->disks[disk].flags = 0; + } + } + } + if (ddf32toh(vdcr->Sequence_Number) >= raid->generation) { + int disk_number = pd_pos; + + raid->disks[disk_number].dev = parent; + + /* Adaptec appears to not set vdcr->Block_Count, yet again in + * gross violation of the spec. + */ + raid->disks[disk_number].sectors = ddf64toh(vdcr->Block_Count); + if (raid->disks[disk_number].sectors == 0) + raid->disks[disk_number].sectors=ddf64toh(pde->Configured_Size); + raid->disks[disk_number].flags = + (AR_DF_ONLINE | AR_DF_PRESENT | AR_DF_ASSIGNED); + ars->raid[raid->volume] = raid; + ars->disk_number[raid->volume] = disk_number; + retval = 1; + } + break; + } + +ddf_out: + free(meta, M_AR); + return retval; +} + /* Highpoint V2 RocketRAID Metadata */ static int ata_raid_hptv2_read_meta(device_t dev, struct ar_softc **raidp) @@ -4258,6 +4597,7 @@ ata_raid_format(struct ar_softc *rdp) switch (rdp->format) { case AR_F_FREEBSD_RAID: return "FreeBSD PseudoRAID"; case AR_F_ADAPTEC_RAID: return "Adaptec HostRAID"; + case AR_F_DDF_RAID: return "DDF"; case AR_F_HPTV2_RAID: return "HighPoint v2 RocketRAID"; case AR_F_HPTV3_RAID: return "HighPoint v3 RocketRAID"; case AR_F_INTEL_RAID: return "Intel MatrixRAID"; @@ -4414,6 +4754,71 @@ ata_raid_adaptec_print_meta(struct adapt printf("=================================================\n"); } +static void +ata_raid_ddf_print_meta(uint8_t *meta) +{ + struct ddf_header *hdr; + struct ddf_cd_record *cd; + struct ddf_pd_record *pdr; + struct ddf_pd_entry *pde; + struct ddf_vd_record *vdr; + struct ddf_vd_entry *vde; + struct ddf_pdd_record *pdd; + uint64_t (*ddf64toh)(uint64_t) = NULL; + uint32_t (*ddf32toh)(uint32_t) = NULL; + uint16_t (*ddf16toh)(uint16_t) = NULL; + uint8_t *cr; + char *r; + + /* Check if this is a DDF RAID struct */ + hdr = (struct ddf_header *)meta; + if (be32toh(hdr->Signature) == DDF_HEADER_SIGNATURE) { + ddf64toh = ddfbe64toh; + ddf32toh = ddfbe32toh; + ddf16toh = ddfbe16toh; + } else { + ddf64toh = ddfle64toh; + ddf32toh = ddfle32toh; + ddf16toh = ddfle16toh; + } + + hdr = (struct ddf_header*)meta; + cd = (struct ddf_cd_record*)(meta + ddf32toh(hdr->cd_section) *DEV_BSIZE); + pdr = (struct ddf_pd_record*)(meta + ddf32toh(hdr->pdr_section)*DEV_BSIZE); + vdr = (struct ddf_vd_record*)(meta + ddf32toh(hdr->vdr_section)*DEV_BSIZE); + cr = (uint8_t *)(meta + ddf32toh(hdr->cr_section) * DEV_BSIZE); + pdd = (struct ddf_pdd_record*)(meta + ddf32toh(hdr->pdd_section)*DEV_BSIZE); + pde = NULL; + vde = NULL; + + printf("********* ATA DDF Metadata *********\n"); + printf("**** Header ****\n"); + r = (char *)&hdr->DDF_rev[0]; + printf("DDF_rev= %8.8s Sequence_Number= 0x%x Open_Flag= 0x%x\n", r, + ddf32toh(hdr->Sequence_Number), hdr->Open_Flag); + printf("Primary Header LBA= %llu Header_Type = 0x%x\n", + (unsigned long long)ddf64toh(hdr->Primary_Header_LBA), + hdr->Header_Type); + printf("Max_PD_Entries= %d Max_VD_Entries= %d Max_Partitions= %d " + "CR_Length= %d\n", ddf16toh(hdr->Max_PD_Entries), + ddf16toh(hdr->Max_VD_Entries), ddf16toh(hdr->Max_Partitions), + ddf16toh(hdr->Configuration_Record_Length)); + printf("CD= %d:%d PDR= %d:%d VDR= %d:%d CR= %d:%d PDD= %d%d\n", + ddf32toh(hdr->cd_section), ddf32toh(hdr->cd_length), + ddf32toh(hdr->pdr_section), ddf32toh(hdr->pdr_length), + ddf32toh(hdr->vdr_section), ddf32toh(hdr->vdr_length), + ddf32toh(hdr->cr_section), ddf32toh(hdr->cr_length), + ddf32toh(hdr->pdd_section), ddf32toh(hdr->pdd_length)); + printf("**** Controler Data ****\n"); + r = (char *)&cd->Product_ID[0]; + printf("Product_ID: %16.16s\n", r); + printf("Vendor 0x%x, Device 0x%x, SubVendor 0x%x, Sub_Device 0x%x\n", + ddf16toh(cd->Controller_Type.Vendor_ID), + ddf16toh(cd->Controller_Type.Device_ID), + ddf16toh(cd->Controller_Type.SubVendor_ID), + ddf16toh(cd->Controller_Type.SubDevice_ID)); +} + static char * ata_raid_hptv2_type(int type) { Modified: stable/7/sys/dev/ata/ata-raid.h ============================================================================== --- stable/7/sys/dev/ata/ata-raid.h Sun Mar 1 16:47:49 2009 (r189245) +++ stable/7/sys/dev/ata/ata-raid.h Sun Mar 1 16:50:46 2009 (r189246) @@ -76,7 +76,8 @@ struct ar_softc { #define AR_F_SII_RAID 0x0800 #define AR_F_SIS_RAID 0x1000 #define AR_F_VIA_RAID 0x2000 -#define AR_F_FORMAT_MASK 0x3fff +#define AR_F_DDF_RAID 0x4000 +#define AR_F_FORMAT_MASK 0x7fff u_int generation; u_int64_t total_sectors; @@ -164,6 +165,9 @@ struct adaptec_raid_conf { u_int32_t dummy_9[62]; } __packed; +/* DDF Information. Metadata definitions are in another file */ +#define DDF_LBA(dev) \ + (((struct ad_softc *)device_get_ivars(dev))->total_secs - 1) /* Highpoint V2 RocketRAID Metadata */ #define HPTV2_LBA(dev) 9 From ed at FreeBSD.org Sun Mar 1 09:44:31 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Mar 1 09:44:37 2009 Subject: svn commit: r189247 - head/sys/sys Message-ID: <200903011744.n21HiV7a050254@svn.freebsd.org> Author: ed Date: Sun Mar 1 17:44:31 2009 New Revision: 189247 URL: http://svn.freebsd.org/changeset/base/189247 Log: Hide __restrict from lint, just like we do with other keywords. Unlike GCC, LLVM defines __STDC_VERSION__ to 199901L by default. This means `restrict' keywords in files end up being given to lint, which results in errors during compilation of usr.bin/xlint. Other keywords are also expanded to nothing when using lint, so do the same with restrict. Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Sun Mar 1 16:50:46 2009 (r189246) +++ head/sys/sys/cdefs.h Sun Mar 1 17:44:31 2009 (r189247) @@ -268,7 +268,7 @@ * software that is unaware of C99 keywords. */ #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95) -#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 +#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint) #define __restrict #else #define __restrict restrict From imp at FreeBSD.org Sun Mar 1 10:58:00 2009 From: imp at FreeBSD.org (Warner Losh) Date: Sun Mar 1 10:58:06 2009 Subject: svn commit: r189248 - head Message-ID: <200903011857.n21IvxIA051643@svn.freebsd.org> Author: imp Date: Sun Mar 1 18:57:59 2009 New Revision: 189248 URL: http://svn.freebsd.org/changeset/base/189248 Log: Add verbage about needing to remap libusb-0.1 to libusb20 to get old programs to work with the new usb stack. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Mar 1 17:44:31 2009 (r189247) +++ head/UPDATING Sun Mar 1 18:57:59 2009 (r189248) @@ -35,7 +35,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. module names reverted to their previous values (eg, usb, ehci, ohci, ums, ...). The old usb stack can be compiled in by prefixing the name with the letter 'o', the old usb modules have been removed. - Updating entry 20090216 for xorg may still apply. + Updating entry 20090216 for xorg and 20090215 for libmap may still + apply. 20090217: The rc.conf(5) option if_up_delay has been renamed to @@ -59,6 +60,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. that includes GENERIC then ensure that usb names are also changed over, eg uftdi -> usb2_serial_ftdi. + Older programs linked against the ports libusb 0.1 need to be + redirected to the new stack's libusb20. /etc/libmap.conf can + be used for this: + # Map old usb library to new one for usb2 stack + libusb-0.1.so.8 libusb20.so.1 + 20090203: The ichsmb(4) driver has been changed to require SMBus slave addresses be left-justified (xxxxxxx0b) rather than right-justified. From thompsa at FreeBSD.org Sun Mar 1 11:04:05 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Mar 1 11:04:16 2009 Subject: svn commit: r189248 - head In-Reply-To: <200903011857.n21IvxIA051643@svn.freebsd.org> References: <200903011857.n21IvxIA051643@svn.freebsd.org> Message-ID: <20090301190359.GA56939@citylink.fud.org.nz> On Sun, Mar 01, 2009 at 06:57:59PM +0000, Warner Losh wrote: > Author: imp > Date: Sun Mar 1 18:57:59 2009 > New Revision: 189248 > URL: http://svn.freebsd.org/changeset/base/189248 > > Log: > Add verbage about needing to remap libusb-0.1 to libusb20 to get old > programs to work with the new usb stack. FWIW stass is working on getting libusb foo put in the ports build at which stage there will be a proper symlink from libusb-0.1 to libusb20. Andrew From das at FreeBSD.org Sun Mar 1 11:25:41 2009 From: das at FreeBSD.org (David Schultz) Date: Sun Mar 1 11:25:54 2009 Subject: svn commit: r189249 - head/lib/libc/stdio Message-ID: <200903011925.n21JPeLP052223@svn.freebsd.org> Author: das Date: Sun Mar 1 19:25:40 2009 New Revision: 189249 URL: http://svn.freebsd.org/changeset/base/189249 Log: Use C99-style initializers. No functional change. Reviewed by: md5(1) Modified: head/lib/libc/stdio/findfp.c Modified: head/lib/libc/stdio/findfp.c ============================================================================== --- head/lib/libc/stdio/findfp.c Sun Mar 1 18:57:59 2009 (r189248) +++ head/lib/libc/stdio/findfp.c Sun Mar 1 19:25:40 2009 (r189249) @@ -53,10 +53,15 @@ int __sdidinit; #define NDYNAMIC 10 /* add ten more whenever necessary */ -#define std(flags, file) \ - {0,0,0,flags,file,{0},0,__sF+file,__sclose,__sread,__sseek,__swrite} - /* p r w flags file _bf z cookie close read seek write */ - +#define std(flags, file) { \ + ._flags = (flags), \ + ._file = (file), \ + ._cookie = __sF + (file), \ + ._close = __sclose, \ + ._read = __sread, \ + ._seek = __sseek, \ + ._write = __swrite, \ +} /* the usual - (stdin + stdout + stderr) */ static FILE usual[FOPEN_MAX - 3]; static struct glue uglue = { NULL, FOPEN_MAX - 3, usual }; From imp at bsdimp.com Sun Mar 1 12:22:31 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Sun Mar 1 12:22:42 2009 Subject: svn commit: r189248 - head In-Reply-To: <20090301190359.GA56939@citylink.fud.org.nz> References: <200903011857.n21IvxIA051643@svn.freebsd.org> <20090301190359.GA56939@citylink.fud.org.nz> Message-ID: <20090301.131937.1408561035.imp@bsdimp.com> In message: <20090301190359.GA56939@citylink.fud.org.nz> Andrew Thompson writes: : On Sun, Mar 01, 2009 at 06:57:59PM +0000, Warner Losh wrote: : > Author: imp : > Date: Sun Mar 1 18:57:59 2009 : > New Revision: 189248 : > URL: http://svn.freebsd.org/changeset/base/189248 : > : > Log: : > Add verbage about needing to remap libusb-0.1 to libusb20 to get old : > programs to work with the new usb stack. : : FWIW stass is working on getting libusb foo put in the ports build at : which stage there will be a proper symlink from libusb-0.1 to libusb20. Excellent! In the mean time, users will be able to use this hint... Warner From sam at FreeBSD.org Sun Mar 1 14:08:51 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 14:09:04 2009 Subject: svn commit: r189250 - svnadmin/conf Message-ID: <200903012208.n21M8p43055276@svn.freebsd.org> Author: sam Date: Sun Mar 1 22:08:50 2009 New Revision: 189250 URL: http://svn.freebsd.org/changeset/base/189250 Log: remove wpa_supplicant; it's about to be replaced by "wpa" which has wpa_supplicant+hostapd combined Modified: svnadmin/conf/paths Modified: svnadmin/conf/paths ============================================================================== --- svnadmin/conf/paths Sun Mar 1 19:25:40 2009 (r189249) +++ svnadmin/conf/paths Sun Mar 1 22:08:50 2009 (r189250) @@ -64,7 +64,7 @@ ^vendor/top ^vendor/tzcode ^vendor/tzdata -^vendor/wpa_supplicant +^vendor/wpa ^vendor-crypto/openssh ^vendor-crypto/openssl ^vendor-sys/pf From sam at FreeBSD.org Sun Mar 1 14:10:09 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 14:10:18 2009 Subject: svn commit: r189251 - in vendor/wpa: . dist dist/hostapd dist/hostapd/doc dist/hostapd/logwatch dist/patches dist/src dist/src/common dist/src/crypto dist/src/drivers dist/src/eap_common dist/src/e... Message-ID: <200903012210.n21MA89M055345@svn.freebsd.org> Author: sam Date: Sun Mar 1 22:10:07 2009 New Revision: 189251 URL: http://svn.freebsd.org/changeset/base/189251 Log: import wpa_supplicant+hostapd 0.6.8 Added: vendor/wpa/ vendor/wpa/dist/ vendor/wpa/dist/COPYING (contents, props changed) vendor/wpa/dist/README (contents, props changed) vendor/wpa/dist/hostapd/ vendor/wpa/dist/hostapd/.gitignore (contents, props changed) vendor/wpa/dist/hostapd/ChangeLog (contents, props changed) vendor/wpa/dist/hostapd/Makefile (contents, props changed) vendor/wpa/dist/hostapd/README (contents, props changed) vendor/wpa/dist/hostapd/README-WPS (contents, props changed) vendor/wpa/dist/hostapd/accounting.c (contents, props changed) vendor/wpa/dist/hostapd/accounting.h (contents, props changed) vendor/wpa/dist/hostapd/ap.h (contents, props changed) vendor/wpa/dist/hostapd/ap_list.c (contents, props changed) vendor/wpa/dist/hostapd/ap_list.h (contents, props changed) vendor/wpa/dist/hostapd/beacon.c (contents, props changed) vendor/wpa/dist/hostapd/beacon.h (contents, props changed) vendor/wpa/dist/hostapd/config.c (contents, props changed) vendor/wpa/dist/hostapd/config.h (contents, props changed) vendor/wpa/dist/hostapd/ctrl_iface.c (contents, props changed) vendor/wpa/dist/hostapd/ctrl_iface.h (contents, props changed) vendor/wpa/dist/hostapd/defconfig (contents, props changed) vendor/wpa/dist/hostapd/doc/ vendor/wpa/dist/hostapd/doc/.gitignore (contents, props changed) vendor/wpa/dist/hostapd/doc/code_structure.doxygen (contents, props changed) vendor/wpa/dist/hostapd/doc/ctrl_iface.doxygen (contents, props changed) vendor/wpa/dist/hostapd/doc/doxygen.fast (contents, props changed) vendor/wpa/dist/hostapd/doc/doxygen.full (contents, props changed) vendor/wpa/dist/hostapd/doc/driver_wrapper.doxygen (contents, props changed) vendor/wpa/dist/hostapd/doc/eap.doxygen (contents, props changed) vendor/wpa/dist/hostapd/doc/hostapd.fig (contents, props changed) vendor/wpa/dist/hostapd/doc/kerneldoc2doxygen.pl (contents, props changed) vendor/wpa/dist/hostapd/doc/mainpage.doxygen (contents, props changed) vendor/wpa/dist/hostapd/doc/porting.doxygen (contents, props changed) vendor/wpa/dist/hostapd/driver.h (contents, props changed) vendor/wpa/dist/hostapd/driver_bsd.c (contents, props changed) vendor/wpa/dist/hostapd/driver_hostap.c (contents, props changed) vendor/wpa/dist/hostapd/driver_madwifi.c (contents, props changed) vendor/wpa/dist/hostapd/driver_nl80211.c (contents, props changed) vendor/wpa/dist/hostapd/driver_none.c (contents, props changed) vendor/wpa/dist/hostapd/driver_prism54.c (contents, props changed) vendor/wpa/dist/hostapd/driver_test.c (contents, props changed) vendor/wpa/dist/hostapd/driver_wired.c (contents, props changed) vendor/wpa/dist/hostapd/drivers.c (contents, props changed) vendor/wpa/dist/hostapd/eap_testing.txt (contents, props changed) vendor/wpa/dist/hostapd/eapol_sm.c (contents, props changed) vendor/wpa/dist/hostapd/eapol_sm.h (contents, props changed) vendor/wpa/dist/hostapd/hostap_common.h (contents, props changed) vendor/wpa/dist/hostapd/hostapd.8 (contents, props changed) vendor/wpa/dist/hostapd/hostapd.accept (contents, props changed) vendor/wpa/dist/hostapd/hostapd.c (contents, props changed) vendor/wpa/dist/hostapd/hostapd.conf (contents, props changed) vendor/wpa/dist/hostapd/hostapd.deny (contents, props changed) vendor/wpa/dist/hostapd/hostapd.eap_user (contents, props changed) vendor/wpa/dist/hostapd/hostapd.h (contents, props changed) vendor/wpa/dist/hostapd/hostapd.radius_clients (contents, props changed) vendor/wpa/dist/hostapd/hostapd.sim_db (contents, props changed) vendor/wpa/dist/hostapd/hostapd.vlan (contents, props changed) vendor/wpa/dist/hostapd/hostapd.wpa_psk (contents, props changed) vendor/wpa/dist/hostapd/hostapd_cli.1 (contents, props changed) vendor/wpa/dist/hostapd/hostapd_cli.c (contents, props changed) vendor/wpa/dist/hostapd/hw_features.c (contents, props changed) vendor/wpa/dist/hostapd/hw_features.h (contents, props changed) vendor/wpa/dist/hostapd/iapp.c (contents, props changed) vendor/wpa/dist/hostapd/iapp.h (contents, props changed) vendor/wpa/dist/hostapd/ieee802_11.c (contents, props changed) vendor/wpa/dist/hostapd/ieee802_11.h (contents, props changed) vendor/wpa/dist/hostapd/ieee802_11_auth.c (contents, props changed) vendor/wpa/dist/hostapd/ieee802_11_auth.h (contents, props changed) vendor/wpa/dist/hostapd/ieee802_1x.c (contents, props changed) vendor/wpa/dist/hostapd/ieee802_1x.h (contents, props changed) vendor/wpa/dist/hostapd/logwatch/ vendor/wpa/dist/hostapd/logwatch/README (contents, props changed) vendor/wpa/dist/hostapd/logwatch/hostapd (contents, props changed) vendor/wpa/dist/hostapd/logwatch/hostapd.conf (contents, props changed) vendor/wpa/dist/hostapd/mlme.c (contents, props changed) vendor/wpa/dist/hostapd/mlme.h (contents, props changed) vendor/wpa/dist/hostapd/nt_password_hash.c (contents, props changed) vendor/wpa/dist/hostapd/peerkey.c (contents, props changed) vendor/wpa/dist/hostapd/pmksa_cache.c (contents, props changed) vendor/wpa/dist/hostapd/pmksa_cache.h (contents, props changed) vendor/wpa/dist/hostapd/preauth.c (contents, props changed) vendor/wpa/dist/hostapd/preauth.h (contents, props changed) vendor/wpa/dist/hostapd/prism54.h (contents, props changed) vendor/wpa/dist/hostapd/priv_netlink.h (contents, props changed) vendor/wpa/dist/hostapd/radiotap.c (contents, props changed) vendor/wpa/dist/hostapd/radiotap.h (contents, props changed) vendor/wpa/dist/hostapd/radiotap_iter.h (contents, props changed) vendor/wpa/dist/hostapd/sta_info.c (contents, props changed) vendor/wpa/dist/hostapd/sta_info.h (contents, props changed) vendor/wpa/dist/hostapd/vlan_init.c (contents, props changed) vendor/wpa/dist/hostapd/vlan_init.h (contents, props changed) vendor/wpa/dist/hostapd/wired.conf (contents, props changed) vendor/wpa/dist/hostapd/wme.c (contents, props changed) vendor/wpa/dist/hostapd/wme.h (contents, props changed) vendor/wpa/dist/hostapd/wpa.c (contents, props changed) vendor/wpa/dist/hostapd/wpa.h (contents, props changed) vendor/wpa/dist/hostapd/wpa_auth_i.h (contents, props changed) vendor/wpa/dist/hostapd/wpa_auth_ie.c (contents, props changed) vendor/wpa/dist/hostapd/wpa_auth_ie.h (contents, props changed) vendor/wpa/dist/hostapd/wpa_ft.c (contents, props changed) vendor/wpa/dist/hostapd/wps_hostapd.c (contents, props changed) vendor/wpa/dist/hostapd/wps_hostapd.h (contents, props changed) vendor/wpa/dist/patches/ vendor/wpa/dist/patches/openssl-0.9.8-tls-extensions.patch (contents, props changed) vendor/wpa/dist/patches/openssl-0.9.8d-tls-extensions.patch (contents, props changed) vendor/wpa/dist/patches/openssl-0.9.8e-tls-extensions.patch (contents, props changed) vendor/wpa/dist/patches/openssl-0.9.8g-tls-extensions.patch (contents, props changed) vendor/wpa/dist/patches/openssl-0.9.8h-tls-extensions.patch (contents, props changed) vendor/wpa/dist/patches/openssl-0.9.8i-tls-extensions.patch (contents, props changed) vendor/wpa/dist/patches/openssl-0.9.9-session-ticket.patch (contents, props changed) vendor/wpa/dist/src/ vendor/wpa/dist/src/Makefile (contents, props changed) vendor/wpa/dist/src/common/ vendor/wpa/dist/src/common/.gitignore (contents, props changed) vendor/wpa/dist/src/common/Makefile (contents, props changed) vendor/wpa/dist/src/common/defs.h (contents, props changed) vendor/wpa/dist/src/common/eapol_common.h (contents, props changed) vendor/wpa/dist/src/common/ieee802_11_common.c (contents, props changed) vendor/wpa/dist/src/common/ieee802_11_common.h (contents, props changed) vendor/wpa/dist/src/common/ieee802_11_defs.h (contents, props changed) vendor/wpa/dist/src/common/nl80211_copy.h (contents, props changed) vendor/wpa/dist/src/common/privsep_commands.h (contents, props changed) vendor/wpa/dist/src/common/version.h (contents, props changed) vendor/wpa/dist/src/common/wireless_copy.h (contents, props changed) vendor/wpa/dist/src/common/wpa_common.c (contents, props changed) vendor/wpa/dist/src/common/wpa_common.h (contents, props changed) vendor/wpa/dist/src/common/wpa_ctrl.c (contents, props changed) vendor/wpa/dist/src/common/wpa_ctrl.h (contents, props changed) vendor/wpa/dist/src/crypto/ vendor/wpa/dist/src/crypto/.gitignore (contents, props changed) vendor/wpa/dist/src/crypto/Makefile (contents, props changed) vendor/wpa/dist/src/crypto/aes.c (contents, props changed) vendor/wpa/dist/src/crypto/aes.h (contents, props changed) vendor/wpa/dist/src/crypto/aes_wrap.c (contents, props changed) vendor/wpa/dist/src/crypto/aes_wrap.h (contents, props changed) vendor/wpa/dist/src/crypto/crypto.h (contents, props changed) vendor/wpa/dist/src/crypto/crypto_cryptoapi.c (contents, props changed) vendor/wpa/dist/src/crypto/crypto_gnutls.c (contents, props changed) vendor/wpa/dist/src/crypto/crypto_internal.c (contents, props changed) vendor/wpa/dist/src/crypto/crypto_libtomcrypt.c (contents, props changed) vendor/wpa/dist/src/crypto/crypto_none.c (contents, props changed) vendor/wpa/dist/src/crypto/crypto_openssl.c (contents, props changed) vendor/wpa/dist/src/crypto/des.c (contents, props changed) vendor/wpa/dist/src/crypto/dh_groups.c (contents, props changed) vendor/wpa/dist/src/crypto/dh_groups.h (contents, props changed) vendor/wpa/dist/src/crypto/md4.c (contents, props changed) vendor/wpa/dist/src/crypto/md5.c (contents, props changed) vendor/wpa/dist/src/crypto/md5.h (contents, props changed) vendor/wpa/dist/src/crypto/ms_funcs.c (contents, props changed) vendor/wpa/dist/src/crypto/ms_funcs.h (contents, props changed) vendor/wpa/dist/src/crypto/rc4.c (contents, props changed) vendor/wpa/dist/src/crypto/rc4.h (contents, props changed) vendor/wpa/dist/src/crypto/sha1.c (contents, props changed) vendor/wpa/dist/src/crypto/sha1.h (contents, props changed) vendor/wpa/dist/src/crypto/sha256.c (contents, props changed) vendor/wpa/dist/src/crypto/sha256.h (contents, props changed) vendor/wpa/dist/src/crypto/tls.h (contents, props changed) vendor/wpa/dist/src/crypto/tls_gnutls.c (contents, props changed) vendor/wpa/dist/src/crypto/tls_internal.c (contents, props changed) vendor/wpa/dist/src/crypto/tls_none.c (contents, props changed) vendor/wpa/dist/src/crypto/tls_openssl.c (contents, props changed) vendor/wpa/dist/src/crypto/tls_schannel.c (contents, props changed) vendor/wpa/dist/src/drivers/ vendor/wpa/dist/src/drivers/.gitignore (contents, props changed) vendor/wpa/dist/src/drivers/Apple80211.h (contents, props changed) vendor/wpa/dist/src/drivers/Makefile (contents, props changed) vendor/wpa/dist/src/drivers/MobileApple80211.c (contents, props changed) vendor/wpa/dist/src/drivers/MobileApple80211.h (contents, props changed) vendor/wpa/dist/src/drivers/driver.h (contents, props changed) vendor/wpa/dist/src/drivers/driver_atmel.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_broadcom.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_bsd.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_hostap.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_hostap.h (contents, props changed) vendor/wpa/dist/src/drivers/driver_iphone.m (contents, props changed) vendor/wpa/dist/src/drivers/driver_ipw.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_madwifi.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_ndis.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_ndis.h (contents, props changed) vendor/wpa/dist/src/drivers/driver_ndis_.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_ndiswrapper.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_nl80211.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_osx.m (contents, props changed) vendor/wpa/dist/src/drivers/driver_prism54.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_privsep.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_ps3.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_ralink.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_ralink.h (contents, props changed) vendor/wpa/dist/src/drivers/driver_roboswitch.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_test.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_wext.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_wext.h (contents, props changed) vendor/wpa/dist/src/drivers/driver_wired.c (contents, props changed) vendor/wpa/dist/src/drivers/drivers.c (contents, props changed) vendor/wpa/dist/src/drivers/ndis_events.c (contents, props changed) vendor/wpa/dist/src/drivers/priv_netlink.h (contents, props changed) vendor/wpa/dist/src/drivers/radiotap.c (contents, props changed) vendor/wpa/dist/src/drivers/radiotap.h (contents, props changed) vendor/wpa/dist/src/drivers/radiotap_iter.h (contents, props changed) vendor/wpa/dist/src/drivers/scan_helpers.c (contents, props changed) vendor/wpa/dist/src/eap_common/ vendor/wpa/dist/src/eap_common/.gitignore (contents, props changed) vendor/wpa/dist/src/eap_common/Makefile (contents, props changed) vendor/wpa/dist/src/eap_common/chap.c (contents, props changed) vendor/wpa/dist/src/eap_common/chap.h (contents, props changed) vendor/wpa/dist/src/eap_common/eap_common.c (contents, props changed) vendor/wpa/dist/src/eap_common/eap_common.h (contents, props changed) vendor/wpa/dist/src/eap_common/eap_defs.h (contents, props changed) vendor/wpa/dist/src/eap_common/eap_fast_common.c (contents, props changed) vendor/wpa/dist/src/eap_common/eap_fast_common.h (contents, props changed) vendor/wpa/dist/src/eap_common/eap_gpsk_common.c (contents, props changed) vendor/wpa/dist/src/eap_common/eap_gpsk_common.h (contents, props changed) vendor/wpa/dist/src/eap_common/eap_ikev2_common.c (contents, props changed) vendor/wpa/dist/src/eap_common/eap_ikev2_common.h (contents, props changed) vendor/wpa/dist/src/eap_common/eap_pax_common.c (contents, props changed) vendor/wpa/dist/src/eap_common/eap_pax_common.h (contents, props changed) vendor/wpa/dist/src/eap_common/eap_peap_common.c (contents, props changed) vendor/wpa/dist/src/eap_common/eap_peap_common.h (contents, props changed) vendor/wpa/dist/src/eap_common/eap_psk_common.c (contents, props changed) vendor/wpa/dist/src/eap_common/eap_psk_common.h (contents, props changed) vendor/wpa/dist/src/eap_common/eap_sake_common.c (contents, props changed) vendor/wpa/dist/src/eap_common/eap_sake_common.h (contents, props changed) vendor/wpa/dist/src/eap_common/eap_sim_common.c (contents, props changed) vendor/wpa/dist/src/eap_common/eap_sim_common.h (contents, props changed) vendor/wpa/dist/src/eap_common/eap_tlv_common.h (contents, props changed) vendor/wpa/dist/src/eap_common/eap_ttls.h (contents, props changed) vendor/wpa/dist/src/eap_common/eap_wsc_common.c (contents, props changed) vendor/wpa/dist/src/eap_common/eap_wsc_common.h (contents, props changed) vendor/wpa/dist/src/eap_common/ikev2_common.c (contents, props changed) vendor/wpa/dist/src/eap_common/ikev2_common.h (contents, props changed) vendor/wpa/dist/src/eap_peer/ vendor/wpa/dist/src/eap_peer/.gitignore (contents, props changed) vendor/wpa/dist/src/eap_peer/Makefile (contents, props changed) vendor/wpa/dist/src/eap_peer/eap.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap.h (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_aka.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_config.h (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_fast.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_fast_pac.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_fast_pac.h (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_gpsk.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_gtc.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_i.h (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_ikev2.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_leap.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_md5.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_methods.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_methods.h (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_mschapv2.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_otp.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_pax.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_peap.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_psk.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_sake.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_sim.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_tls.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_tls_common.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_tls_common.h (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_tnc.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_ttls.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_vendor_test.c (contents, props changed) vendor/wpa/dist/src/eap_peer/eap_wsc.c (contents, props changed) vendor/wpa/dist/src/eap_peer/ikev2.c (contents, props changed) vendor/wpa/dist/src/eap_peer/ikev2.h (contents, props changed) vendor/wpa/dist/src/eap_peer/mschapv2.c (contents, props changed) vendor/wpa/dist/src/eap_peer/mschapv2.h (contents, props changed) vendor/wpa/dist/src/eap_peer/tncc.c (contents, props changed) vendor/wpa/dist/src/eap_peer/tncc.h (contents, props changed) vendor/wpa/dist/src/eap_server/ vendor/wpa/dist/src/eap_server/.gitignore (contents, props changed) vendor/wpa/dist/src/eap_server/Makefile (contents, props changed) vendor/wpa/dist/src/eap_server/eap.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap.h (contents, props changed) vendor/wpa/dist/src/eap_server/eap_aka.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_fast.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_gpsk.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_gtc.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_i.h (contents, props changed) vendor/wpa/dist/src/eap_server/eap_identity.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_ikev2.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_md5.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_methods.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_methods.h (contents, props changed) vendor/wpa/dist/src/eap_server/eap_mschapv2.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_pax.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_peap.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_psk.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_sake.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_sim.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_sim_db.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_sim_db.h (contents, props changed) vendor/wpa/dist/src/eap_server/eap_tls.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_tls_common.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_tls_common.h (contents, props changed) vendor/wpa/dist/src/eap_server/eap_tnc.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_ttls.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_vendor_test.c (contents, props changed) vendor/wpa/dist/src/eap_server/eap_wsc.c (contents, props changed) vendor/wpa/dist/src/eap_server/ikev2.c (contents, props changed) vendor/wpa/dist/src/eap_server/ikev2.h (contents, props changed) vendor/wpa/dist/src/eap_server/tncs.c (contents, props changed) vendor/wpa/dist/src/eap_server/tncs.h (contents, props changed) vendor/wpa/dist/src/eapol_supp/ vendor/wpa/dist/src/eapol_supp/.gitignore (contents, props changed) vendor/wpa/dist/src/eapol_supp/Makefile (contents, props changed) vendor/wpa/dist/src/eapol_supp/eapol_supp_sm.c (contents, props changed) vendor/wpa/dist/src/eapol_supp/eapol_supp_sm.h (contents, props changed) vendor/wpa/dist/src/hlr_auc_gw/ vendor/wpa/dist/src/hlr_auc_gw/.gitignore (contents, props changed) vendor/wpa/dist/src/hlr_auc_gw/Makefile (contents, props changed) vendor/wpa/dist/src/hlr_auc_gw/hlr_auc_gw.c (contents, props changed) vendor/wpa/dist/src/hlr_auc_gw/hlr_auc_gw.milenage_db (contents, props changed) vendor/wpa/dist/src/hlr_auc_gw/milenage.c (contents, props changed) vendor/wpa/dist/src/hlr_auc_gw/milenage.h (contents, props changed) vendor/wpa/dist/src/l2_packet/ vendor/wpa/dist/src/l2_packet/.gitignore (contents, props changed) vendor/wpa/dist/src/l2_packet/Makefile (contents, props changed) vendor/wpa/dist/src/l2_packet/l2_packet.h (contents, props changed) vendor/wpa/dist/src/l2_packet/l2_packet_freebsd.c (contents, props changed) vendor/wpa/dist/src/l2_packet/l2_packet_linux.c (contents, props changed) vendor/wpa/dist/src/l2_packet/l2_packet_ndis.c (contents, props changed) vendor/wpa/dist/src/l2_packet/l2_packet_none.c (contents, props changed) vendor/wpa/dist/src/l2_packet/l2_packet_pcap.c (contents, props changed) vendor/wpa/dist/src/l2_packet/l2_packet_privsep.c (contents, props changed) vendor/wpa/dist/src/l2_packet/l2_packet_winpcap.c (contents, props changed) vendor/wpa/dist/src/radius/ vendor/wpa/dist/src/radius/.gitignore (contents, props changed) vendor/wpa/dist/src/radius/Makefile (contents, props changed) vendor/wpa/dist/src/radius/radius.c (contents, props changed) vendor/wpa/dist/src/radius/radius.h (contents, props changed) vendor/wpa/dist/src/radius/radius_client.c (contents, props changed) vendor/wpa/dist/src/radius/radius_client.h (contents, props changed) vendor/wpa/dist/src/radius/radius_server.c (contents, props changed) vendor/wpa/dist/src/radius/radius_server.h (contents, props changed) vendor/wpa/dist/src/rsn_supp/ vendor/wpa/dist/src/rsn_supp/.gitignore (contents, props changed) vendor/wpa/dist/src/rsn_supp/Makefile (contents, props changed) vendor/wpa/dist/src/rsn_supp/peerkey.c (contents, props changed) vendor/wpa/dist/src/rsn_supp/peerkey.h (contents, props changed) vendor/wpa/dist/src/rsn_supp/pmksa_cache.c (contents, props changed) vendor/wpa/dist/src/rsn_supp/pmksa_cache.h (contents, props changed) vendor/wpa/dist/src/rsn_supp/preauth.c (contents, props changed) vendor/wpa/dist/src/rsn_supp/preauth.h (contents, props changed) vendor/wpa/dist/src/rsn_supp/wpa.c (contents, props changed) vendor/wpa/dist/src/rsn_supp/wpa.h (contents, props changed) vendor/wpa/dist/src/rsn_supp/wpa_ft.c (contents, props changed) vendor/wpa/dist/src/rsn_supp/wpa_i.h (contents, props changed) vendor/wpa/dist/src/rsn_supp/wpa_ie.c (contents, props changed) vendor/wpa/dist/src/rsn_supp/wpa_ie.h (contents, props changed) vendor/wpa/dist/src/tls/ vendor/wpa/dist/src/tls/.gitignore (contents, props changed) vendor/wpa/dist/src/tls/Makefile (contents, props changed) vendor/wpa/dist/src/tls/asn1.c (contents, props changed) vendor/wpa/dist/src/tls/asn1.h (contents, props changed) vendor/wpa/dist/src/tls/asn1_test.c (contents, props changed) vendor/wpa/dist/src/tls/bignum.c (contents, props changed) vendor/wpa/dist/src/tls/bignum.h (contents, props changed) vendor/wpa/dist/src/tls/libtommath.c (contents, props changed) vendor/wpa/dist/src/tls/rsa.c (contents, props changed) vendor/wpa/dist/src/tls/rsa.h (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_client.c (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_client.h (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_client_i.h (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_client_read.c (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_client_write.c (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_common.c (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_common.h (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_cred.c (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_cred.h (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_record.c (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_record.h (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_server.c (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_server.h (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_server_i.h (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_server_read.c (contents, props changed) vendor/wpa/dist/src/tls/tlsv1_server_write.c (contents, props changed) vendor/wpa/dist/src/tls/x509v3.c (contents, props changed) vendor/wpa/dist/src/tls/x509v3.h (contents, props changed) vendor/wpa/dist/src/utils/ vendor/wpa/dist/src/utils/.gitignore (contents, props changed) vendor/wpa/dist/src/utils/Makefile (contents, props changed) vendor/wpa/dist/src/utils/base64.c (contents, props changed) vendor/wpa/dist/src/utils/base64.h (contents, props changed) vendor/wpa/dist/src/utils/build_config.h (contents, props changed) vendor/wpa/dist/src/utils/common.c (contents, props changed) vendor/wpa/dist/src/utils/common.h (contents, props changed) vendor/wpa/dist/src/utils/eloop.c (contents, props changed) vendor/wpa/dist/src/utils/eloop.h (contents, props changed) vendor/wpa/dist/src/utils/eloop_none.c (contents, props changed) vendor/wpa/dist/src/utils/eloop_win.c (contents, props changed) vendor/wpa/dist/src/utils/includes.h (contents, props changed) vendor/wpa/dist/src/utils/ip_addr.c (contents, props changed) vendor/wpa/dist/src/utils/ip_addr.h (contents, props changed) vendor/wpa/dist/src/utils/os.h (contents, props changed) vendor/wpa/dist/src/utils/os_internal.c (contents, props changed) vendor/wpa/dist/src/utils/os_none.c (contents, props changed) vendor/wpa/dist/src/utils/os_unix.c (contents, props changed) vendor/wpa/dist/src/utils/os_win32.c (contents, props changed) vendor/wpa/dist/src/utils/pcsc_funcs.c (contents, props changed) vendor/wpa/dist/src/utils/pcsc_funcs.h (contents, props changed) vendor/wpa/dist/src/utils/state_machine.h (contents, props changed) vendor/wpa/dist/src/utils/uuid.c (contents, props changed) vendor/wpa/dist/src/utils/uuid.h (contents, props changed) vendor/wpa/dist/src/utils/wpa_debug.c (contents, props changed) vendor/wpa/dist/src/utils/wpa_debug.h (contents, props changed) vendor/wpa/dist/src/utils/wpabuf.c (contents, props changed) vendor/wpa/dist/src/utils/wpabuf.h (contents, props changed) vendor/wpa/dist/src/wps/ vendor/wpa/dist/src/wps/.gitignore (contents, props changed) vendor/wpa/dist/src/wps/Makefile (contents, props changed) vendor/wpa/dist/src/wps/httpread.c (contents, props changed) vendor/wpa/dist/src/wps/httpread.h (contents, props changed) vendor/wpa/dist/src/wps/wps.c (contents, props changed) vendor/wpa/dist/src/wps/wps.h (contents, props changed) vendor/wpa/dist/src/wps/wps_attr_build.c (contents, props changed) vendor/wpa/dist/src/wps/wps_attr_parse.c (contents, props changed) vendor/wpa/dist/src/wps/wps_attr_process.c (contents, props changed) vendor/wpa/dist/src/wps/wps_common.c (contents, props changed) vendor/wpa/dist/src/wps/wps_defs.h (contents, props changed) vendor/wpa/dist/src/wps/wps_dev_attr.c (contents, props changed) vendor/wpa/dist/src/wps/wps_dev_attr.h (contents, props changed) vendor/wpa/dist/src/wps/wps_enrollee.c (contents, props changed) vendor/wpa/dist/src/wps/wps_i.h (contents, props changed) vendor/wpa/dist/src/wps/wps_registrar.c (contents, props changed) vendor/wpa/dist/src/wps/wps_upnp.c (contents, props changed) vendor/wpa/dist/src/wps/wps_upnp.h (contents, props changed) vendor/wpa/dist/src/wps/wps_upnp_event.c (contents, props changed) vendor/wpa/dist/src/wps/wps_upnp_i.h (contents, props changed) vendor/wpa/dist/src/wps/wps_upnp_ssdp.c (contents, props changed) vendor/wpa/dist/src/wps/wps_upnp_web.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/ vendor/wpa/dist/wpa_supplicant/.gitignore (contents, props changed) vendor/wpa/dist/wpa_supplicant/ChangeLog (contents, props changed) vendor/wpa/dist/wpa_supplicant/Makefile (contents, props changed) vendor/wpa/dist/wpa_supplicant/README (contents, props changed) vendor/wpa/dist/wpa_supplicant/README-WPS (contents, props changed) vendor/wpa/dist/wpa_supplicant/README-Windows.txt (contents, props changed) vendor/wpa/dist/wpa_supplicant/blacklist.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/blacklist.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/config.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/config.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/config_file.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/config_none.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/config_ssid.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/config_winreg.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/ctrl_iface.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/ctrl_iface.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/ctrl_iface_dbus.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/ctrl_iface_dbus.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/ctrl_iface_dbus_handlers.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/ctrl_iface_dbus_handlers.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/ctrl_iface_named_pipe.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/ctrl_iface_udp.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/ctrl_iface_unix.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/dbus-wpa_supplicant.conf (contents, props changed) vendor/wpa/dist/wpa_supplicant/dbus-wpa_supplicant.service (contents, props changed) vendor/wpa/dist/wpa_supplicant/dbus_dict_helpers.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/dbus_dict_helpers.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/defconfig (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/ vendor/wpa/dist/wpa_supplicant/doc/.gitignore (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/code_structure.doxygen (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/ctrl_iface.doxygen (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/ vendor/wpa/dist/wpa_supplicant/doc/docbook/.gitignore (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/Makefile (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/manpage.links (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/manpage.refs (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_background.8 (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_background.sgml (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_cli.8 (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_cli.sgml (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_gui.8 (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_gui.sgml (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_passphrase.8 (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_passphrase.sgml (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_priv.8 (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_priv.sgml (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_supplicant.8 (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5 (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_supplicant.conf.sgml (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_supplicant.sgml (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/doxygen.fast (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/doxygen.full (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/driver_wrapper.doxygen (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/eap.doxygen (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/kerneldoc2doxygen.pl (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/mainpage.doxygen (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/porting.doxygen (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/testing_tools.doxygen (contents, props changed) vendor/wpa/dist/wpa_supplicant/doc/wpa_supplicant.fig (contents, props changed) vendor/wpa/dist/wpa_supplicant/eap_testing.txt (contents, props changed) vendor/wpa/dist/wpa_supplicant/eapol_test.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/events.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/examples/ vendor/wpa/dist/wpa_supplicant/examples/ieee8021x.conf (contents, props changed) vendor/wpa/dist/wpa_supplicant/examples/openCryptoki.conf (contents, props changed) vendor/wpa/dist/wpa_supplicant/examples/plaintext.conf (contents, props changed) vendor/wpa/dist/wpa_supplicant/examples/wep.conf (contents, props changed) vendor/wpa/dist/wpa_supplicant/examples/wpa-psk-tkip.conf (contents, props changed) vendor/wpa/dist/wpa_supplicant/examples/wpa2-eap-ccmp.conf (contents, props changed) vendor/wpa/dist/wpa_supplicant/examples/wpas-test.py (contents, props changed) vendor/wpa/dist/wpa_supplicant/main.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/main_none.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/main_symbian.cpp (contents, props changed) vendor/wpa/dist/wpa_supplicant/main_winmain.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/main_winsvc.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/mlme.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/mlme.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/nmake.mak (contents, props changed) vendor/wpa/dist/wpa_supplicant/preauth_test.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/scan.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/symbian/ vendor/wpa/dist/wpa_supplicant/symbian/README.symbian (contents, props changed) vendor/wpa/dist/wpa_supplicant/symbian/bld.inf (contents, props changed) vendor/wpa/dist/wpa_supplicant/symbian/wpa_supplicant.mmp (contents, props changed) vendor/wpa/dist/wpa_supplicant/tests/ vendor/wpa/dist/wpa_supplicant/tests/link_test.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/tests/test_aes.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/tests/test_eap_sim_common.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/tests/test_md4.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/tests/test_md5.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/tests/test_ms_funcs.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/tests/test_sha1.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/tests/test_sha256.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/tests/test_wpa.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/tests/test_x509v3.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/tests/test_x509v3_nist.sh (contents, props changed) vendor/wpa/dist/wpa_supplicant/tests/test_x509v3_nist2.sh (contents, props changed) vendor/wpa/dist/wpa_supplicant/todo.txt (contents, props changed) vendor/wpa/dist/wpa_supplicant/vs2005/ vendor/wpa/dist/wpa_supplicant/vs2005/eapol_test/ vendor/wpa/dist/wpa_supplicant/vs2005/eapol_test/eapol_test.vcproj (contents, props changed) vendor/wpa/dist/wpa_supplicant/vs2005/win_if_list/ vendor/wpa/dist/wpa_supplicant/vs2005/win_if_list/win_if_list.vcproj (contents, props changed) vendor/wpa/dist/wpa_supplicant/vs2005/wpa_cli/ vendor/wpa/dist/wpa_supplicant/vs2005/wpa_cli/wpa_cli.vcproj (contents, props changed) vendor/wpa/dist/wpa_supplicant/vs2005/wpa_passphrase/ vendor/wpa/dist/wpa_supplicant/vs2005/wpa_passphrase/wpa_passphrase.vcproj (contents, props changed) vendor/wpa/dist/wpa_supplicant/vs2005/wpa_supplicant/ vendor/wpa/dist/wpa_supplicant/vs2005/wpa_supplicant.sln (contents, props changed) vendor/wpa/dist/wpa_supplicant/vs2005/wpa_supplicant/wpa_supplicant.vcproj (contents, props changed) vendor/wpa/dist/wpa_supplicant/vs2005/wpasvc/ vendor/wpa/dist/wpa_supplicant/vs2005/wpasvc/wpasvc.vcproj (contents, props changed) vendor/wpa/dist/wpa_supplicant/win_example.reg (contents, props changed) vendor/wpa/dist/wpa_supplicant/win_if_list.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_cli.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/ vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/ vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/.gitignore (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/addinterface.cpp (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/addinterface.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/eventhistory.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/eventhistory.ui (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/icons/ vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/icons.qrc (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/icons/Makefile (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/icons/README (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/icons/wpa_gui.svg (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/icons_png.qrc (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/main.cpp (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/networkconfig.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/networkconfig.ui (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/scanresults.cpp (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/scanresults.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/scanresults.ui (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/userdatarequest.cpp (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/userdatarequest.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/userdatarequest.ui (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/wpa_gui.desktop (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/wpagui.cpp (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/wpagui.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/wpagui.ui (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/wpamsg.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/.gitignore (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/eventhistory.ui (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/eventhistory.ui.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/main.cpp (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/networkconfig.ui (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/networkconfig.ui.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/scanresults.ui (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/scanresults.ui.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/setup-mingw-cross-compiling (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/userdatarequest.ui (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/userdatarequest.ui.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/wpa_gui.pro (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/wpagui.ui (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/wpagui.ui.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_gui/wpamsg.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_passphrase.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_priv.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_supplicant.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_supplicant.conf (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_supplicant.nsi (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpa_supplicant_i.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpas_glue.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/wpas_glue.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/wps_supplicant.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/wps_supplicant.h (contents, props changed) Added: vendor/wpa/dist/COPYING ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/wpa/dist/COPYING Sun Mar 1 22:10:07 2009 (r189251) @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. Added: vendor/wpa/dist/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/wpa/dist/README Sun Mar 1 22:10:07 2009 (r189251) @@ -0,0 +1,19 @@ +wpa_supplicant and hostapd v0.6.x +--------------------------------- + +Copyright (c) 2002-2007, Jouni Malinen and contributors +All Rights Reserved. + +These program is dual-licensed under both the GPL version 2 and BSD +license. Either license may be used at your option. + + +This package may include either wpa_supplicant, hostapd, or both. See +README file respective subdirectories (wpa_supplicant/README or +hostapd/README) for more details. + +Source code files have been moved around in v0.6.x releases and +compared to earlier releases, the programs are now build by first +going to a subdirectory (wpa_supplicant or hostapd) and creating +build configuration (.config) and running 'make' there (for +Linux/BSD/cygwin builds). Added: vendor/wpa/dist/hostapd/.gitignore ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/wpa/dist/hostapd/.gitignore Sun Mar 1 22:10:07 2009 (r189251) @@ -0,0 +1,7 @@ +*.d +.config +driver_conf.c +hostapd +hostapd_cli +hlr_auc_gw +nt_password_hash Added: vendor/wpa/dist/hostapd/ChangeLog ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/wpa/dist/hostapd/ChangeLog Sun Mar 1 22:10:07 2009 (r189251) @@ -0,0 +1,565 @@ +ChangeLog for hostapd + +2009-02-15 - v0.6.8 + * increased hostapd_cli ping interval to 5 seconds and made this + configurable with a new command line options (-G) + * driver_nl80211: use Linux socket filter to improve performance + * added support for external Registrars with WPS (UPnP transport) + +2009-01-06 - v0.6.7 + * added support for Wi-Fi Protected Setup (WPS) + (hostapd can now be configured to act as an integrated WPS Registrar + and provision credentials for WPS Enrollees using PIN and PBC + methods; external wireless Registrar can configure the AP, but + external WLAN Manager Registrars are not supported); WPS support can + be enabled by adding CONFIG_WPS=y into .config and setting the + runtime configuration variables in hostapd.conf (see WPS section in + the example configuration file); new hostapd_cli commands wps_pin and + wps_pbc are used to configure WPS negotiation; see README-WPS for + more details + * added IEEE 802.11n HT capability configuration (ht_capab) + * added support for generating Country IE based on nl80211 regulatory + information (added if ieee80211d=1 in configuration) + * fixed WEP authentication (both Open System and Shared Key) with + mac80211 + * added support for EAP-AKA' (draft-arkko-eap-aka-kdf) + * added support for using driver_test over UDP socket + * changed EAP-GPSK to use the IANA assigned EAP method type 51 + * updated management frame protection to use IEEE 802.11w/D7.0 + * fixed retransmission of EAP requests if no response is received + +2008-11-23 - v0.6.6 + * added a new configuration option, wpa_ptk_rekey, that can be used to + enforce frequent PTK rekeying, e.g., to mitigate some attacks against + TKIP deficiencies + * updated OpenSSL code for EAP-FAST to use an updated version of the + session ticket overriding API that was included into the upstream + OpenSSL 0.9.9 tree on 2008-11-15 (no additional OpenSSL patch is + needed with that version anymore) + * changed channel flags configuration to read the information from + the driver (e.g., via driver_nl80211 when using mac80211) instead of + using hostapd as the source of the regulatory information (i.e., + information from CRDA is now used with mac80211); this allows 5 GHz + channels to be used with hostapd (if allowed in the current + regulatory domain) + * fixed EAP-TLS message processing for the last TLS message if it is + large enough to require fragmentation (e.g., if a large Session + Ticket data is included) + * fixed listen interval configuration for nl80211 drivers + +2008-11-01 - v0.6.5 + * added support for SHA-256 as X.509 certificate digest when using the + internal X.509/TLSv1 implementation + * fixed EAP-FAST PAC-Opaque padding (0.6.4 broke this for some peer + identity lengths) + * fixed internal TLSv1 implementation for abbreviated handshake (used + by EAP-FAST server) + * added support for setting VLAN ID for STAs based on local MAC ACL + (accept_mac_file) as an alternative for RADIUS server-based + configuration + * updated management frame protection to use IEEE 802.11w/D6.0 + (adds a new association ping to protect against unauthenticated + authenticate or (re)associate request frames dropping association) + * added support for using SHA256-based stronger key derivation for WPA2 + (IEEE 802.11w) + * added new "driver wrapper" for RADIUS-only configuration + (driver=none in hostapd.conf; CONFIG_DRIVER_NONE=y in .config) + * fixed WPA/RSN IE validation to verify that the proto (WPA vs. WPA2) + is enabled in configuration + * changed EAP-FAST configuration to use separate fields for A-ID and + A-ID-Info (eap_fast_a_id_info) to allow A-ID to be set to a fixed + 16-octet len binary value for better interoperability with some peer + implementations; eap_fast_a_id is now configured as a hex string + * driver_nl80211: Updated to match the current Linux mac80211 AP mode + configuration (wireless-testing.git and Linux kernel releases + starting from 2.6.29) + +2008-08-10 - v0.6.4 + * added peer identity into EAP-FAST PAC-Opaque and skip Phase 2 + Identity Request if identity is already known + * added support for EAP Sequences in EAP-FAST Phase 2 + * added support for EAP-TNC (Trusted Network Connect) + (this version implements the EAP-TNC method and EAP-TTLS/EAP-FAST + changes needed to run two methods in sequence (IF-T) and the IF-IMV + and IF-TNCCS interfaces from TNCS) + * added support for optional cryptobinding with PEAPv0 + * added fragmentation support for EAP-TNC + * added support for fragmenting EAP-TTLS/PEAP/FAST Phase 2 (tunneled) + data + * added support for opportunistic key caching (OKC) + +2008-02-22 - v0.6.3 + * fixed Reassociation Response callback processing when using internal + MLME (driver_{hostap,nl80211,test}.c) + * updated FT support to use the latest draft, IEEE 802.11r/D9.0 + * copy optional Proxy-State attributes into RADIUS response when acting + as a RADIUS authentication server + * fixed EAPOL state machine to handle a case in which no response is + received from the RADIUS authentication server; previous version + could have triggered a crash in some cases after a timeout + * fixed EAP-SIM/AKA realm processing to allow decorated usernames to + be used + * added a workaround for EAP-SIM/AKA peers that include incorrect null + termination in the username + * fixed EAP-SIM/AKA protected result indication to include AT_COUNTER + attribute in notification messages only when using fast + reauthentication + * fixed EAP-SIM Start response processing for fast reauthentication + case + * added support for pending EAP processing in EAP-{PEAP,TTLS,FAST} + phase 2 to allow EAP-SIM and EAP-AKA to be used as the Phase 2 method + +2008-01-01 - v0.6.2 + * fixed EAP-SIM and EAP-AKA message parser to validate attribute + lengths properly to avoid potential crash caused by invalid messages + * added data structure for storing allocated buffers (struct wpabuf); + this does not affect hostapd usage, but many of the APIs changed + and various interfaces (e.g., EAP) is not compatible with old + versions + * added support for protecting EAP-AKA/Identity messages with + AT_CHECKCODE (optional feature in RFC 4187) + * added support for protected result indication with AT_RESULT_IND for + EAP-SIM and EAP-AKA (eap_sim_aka_result_ind=1) + * added support for configuring EAP-TTLS phase 2 non-EAP methods in + EAP server configuration; previously all four were enabled for every + phase 2 user, now all four are disabled by default and need to be + enabled with new method names TTLS-PAP, TTLS-CHAP, TTLS-MSCHAP, + TTLS-MSCHAPV2 + * removed old debug printing mechanism and the related 'debug' + parameter in the configuration file; debug verbosity is now set with + -d (or -dd) command line arguments + * added support for EAP-IKEv2 (draft-tschofenig-eap-ikev2-15.txt); + only shared key/password authentication is supported in this version + +2007-11-24 - v0.6.1 + * added experimental, integrated TLSv1 server implementation with the + needed X.509/ASN.1/RSA/bignum processing (this can be enabled by + setting CONFIG_TLS=internal and CONFIG_INTERNAL_LIBTOMMATH=y in + .config); this can be useful, e.g., if the target system does not + have a suitable TLS library and a minimal code size is required + * added support for EAP-FAST server method to the integrated EAP + server + * updated EAP Generalized Pre-Shared Key (EAP-GPSK) to use the latest + draft (draft-ietf-emu-eap-gpsk-07.txt) + * added a new configuration parameter, rsn_pairwise, to allow different + pairwise cipher suites to be enabled for WPA and RSN/WPA2 + (note: if wpa_pairwise differs from rsn_pairwise, the driver will + either need to support this or will have to use the WPA/RSN IEs from + hostapd; currently, the included madwifi and bsd driver interfaces do + not have support for this) + * updated FT support to use the latest draft, IEEE 802.11r/D8.0 + +2007-05-28 - v0.6.0 + * added experimental IEEE 802.11r/D6.0 support + * updated EAP-SAKE to RFC 4763 and the IANA-allocated EAP type 48 + * updated EAP-PSK to use the IANA-allocated EAP type 47 + * fixed EAP-PSK bit ordering of the Flags field + * fixed configuration reloading (SIGHUP) to re-initialize WPA PSKs + by reading wpa_psk_file [Bug 181] + * fixed EAP-TTLS AVP parser processing for too short AVP lengths + * fixed IPv6 connection to RADIUS accounting server + * updated EAP Generalized Pre-Shared Key (EAP-GPSK) to use the latest + draft (draft-ietf-emu-eap-gpsk-04.txt) + * hlr_auc_gw: read GSM triplet file into memory and rotate through the + entries instead of only using the same three triplets every time + (this does not work properly with tests using multiple clients, but + provides bit better triplet data for testing a single client; anyway, + if a better quality triplets are needed, GSM-Milenage should be used + instead of hardcoded triplet file) + * fixed EAP-MSCHAPv2 server to use a space between S and M parameters + in Success Request [Bug 203] + * added support for sending EAP-AKA Notifications in error cases + * updated to use IEEE 802.11w/D2.0 for management frame protection + (still experimental) + * RADIUS server: added support for processing duplicate messages + (retransmissions from RADIUS client) by replying with the previous + reply + +2006-11-24 - v0.5.6 + * added support for configuring and controlling multiple BSSes per + radio interface (bss= in hostapd.conf); this is only + available with Devicescape and test driver interfaces + * fixed PMKSA cache update in the end of successful RSN + pre-authentication + * added support for dynamic VLAN configuration (i.e., selecting VLAN-ID + for each STA based on RADIUS Access-Accept attributes); this requires + VLAN support from the kernel driver/802.11 stack and this is + currently only available with Devicescape and test driver interfaces + * driver_madwifi: fixed configuration of unencrypted modes (plaintext + and IEEE 802.1X without WEP) + * removed STAKey handshake since PeerKey handshake has replaced it in + IEEE 802.11ma and there are no known deployments of STAKey + * updated EAP Generalized Pre-Shared Key (EAP-GPSK) to use the latest + draft (draft-ietf-emu-eap-gpsk-01.txt) + * added preliminary implementation of IEEE 802.11w/D1.0 (management + frame protection) + (Note: this requires driver support to work properly.) + (Note2: IEEE 802.11w is an unapproved draft and subject to change.) + * hlr_auc_gw: added support for GSM-Milenage (for EAP-SIM) + * hlr_auc_gw: added support for reading per-IMSI Milenage keys and + parameters from a text file to make it possible to implement proper + GSM/UMTS authentication server for multiple SIM/USIM cards using + EAP-SIM/EAP-AKA + * fixed session timeout processing with drivers that do not use + ieee802_11.c (e.g., madwifi) + +2006-08-27 - v0.5.5 + * added 'hostapd_cli new_sta ' command for adding a new STA into + hostapd (e.g., to initialize wired network authentication based on an + external signal) + * fixed hostapd to add PMKID KDE into 4-Way Handshake Message 1 when + using WPA2 even if PMKSA caching is not used + * added -P argument for hostapd to write the current process + id into a file + * added support for RADIUS Authentication Server MIB (RFC 2619) + +2006-06-20 - v0.5.4 + * fixed nt_password_hash build [Bug 144] + * added PeerKey handshake implementation for IEEE 802.11e + direct link setup (DLS) to replace STAKey handshake + * added support for EAP Generalized Pre-Shared Key (EAP-GPSK, + draft-clancy-emu-eap-shared-secret-00.txt) + * fixed a segmentation fault when RSN pre-authentication was completed + successfully [Bug 152] + +2006-04-27 - v0.5.3 + * do not build nt_password_hash and hlr_auc_gw by default to avoid + requiring a TLS library for a successful build; these programs can be + build with 'make nt_password_hash' and 'make hlr_auc_gw' + * added a new configuration option, eapol_version, that can be used to + set EAPOL version to 1 (default is 2) to work around broken client + implementations that drop EAPOL frames which use version number 2 + [Bug 89] + * added support for EAP-SAKE (no EAP method number allocated yet, so + this is using the same experimental type 255 as EAP-PSK) + * fixed EAP-MSCHAPv2 message length validation + +2006-03-19 - v0.5.2 + * fixed stdarg use in hostapd_logger(): if both stdout and syslog + logging was enabled, hostapd could trigger a segmentation fault in + vsyslog on some CPU -- C library combinations + * moved HLR/AuC gateway implementation for EAP-SIM/AKA into an external + program to make it easier to use for implementing real SS7 gateway; + eap_sim_db is not anymore used as a file name for GSM authentication + triplets; instead, it is path to UNIX domain socket that will be used + to communicate with the external gateway program (e.g., hlr_auc_gw) + * added example HLR/AuC gateway implementation, hlr_auc_gw, that uses + local information (GSM authentication triplets from a text file and + hardcoded AKA authentication data); this can be used to test EAP-SIM + and EAP-AKA + * added Milenage algorithm (example 3GPP AKA algorithm) to hlr_auc_gw + to make it possible to test EAP-AKA with real USIM cards (this is + disabled by default; define AKA_USE_MILENAGE when building hlr_auc_gw + to enable this) + * driver_madwifi: added support for getting station RSN IE from + madwifi-ng svn r1453 and newer; this fixes RSN that was apparently + broken with earlier change (r1357) in the driver + * changed EAP method registration to use a dynamic list of methods + instead of a static list generated at build time + * fixed WPA message 3/4 not to encrypt Key Data field (WPA IE) + [Bug 125] + * added ap_max_inactivity configuration parameter + +2006-01-29 - v0.5.1 + * driver_test: added better support for multiple APs and STAs by using + a directory with sockets that include MAC address for each device in + the name (test_socket=DIR:/tmp/test) + * added support for EAP expanded type (vendor specific EAP methods) + +2005-12-18 - v0.5.0 (beginning of 0.5.x development releases) + * added experimental STAKey handshake implementation for IEEE 802.11e + direct link setup (DLS); note: this is disabled by default in both + build and runtime configuration (can be enabled with CONFIG_STAKEY=y + and stakey=1) + * added support for EAP methods to use callbacks to external programs + by buffering a pending request and processing it after the EAP method + is ready to continue + * improved EAP-SIM database interface to allow external request to GSM + HLR/AuC without blocking hostapd process + * added support for using EAP-SIM pseudonyms and fast re-authentication + * added support for EAP-AKA in the integrated EAP authenticator + * added support for matching EAP identity prefixes (e.g., "1"*) in EAP + user database to allow EAP-SIM/AKA selection without extra roundtrip + for EAP-Nak negotiation + * added support for storing EAP user password as NtPasswordHash instead + of plaintext password when using MSCHAP or MSCHAPv2 for + authentication (hash:<16-octet hex value>); added nt_password_hash + tool for hashing password to generate NtPasswordHash + +2005-11-20 - v0.4.7 (beginning of 0.4.x stable releases) + * driver_wired: fixed EAPOL sending to optionally use PAE group address + as the destination instead of supplicant MAC address; this is + disabled by default, but should be enabled with use_pae_group_addr=1 + in configuration file if the wired interface is used by only one + device at the time (common switch configuration) + * driver_madwifi: configure driver to use TKIP countermeasures in order + to get correct behavior (IEEE 802.11 association failing; previously, + association succeeded, but hostpad forced disassociation immediately) + * driver_madwifi: added support for madwifi-ng + +2005-10-27 - v0.4.6 + * added support for replacing user identity from EAP with RADIUS + User-Name attribute from Access-Accept message, if that is included, + for the RADIUS accounting messages (e.g., for EAP-PEAP/TTLS to get + tunneled identity into accounting messages when the RADIUS server + does not support better way of doing this with Class attribute) + * driver_madwifi: fixed EAPOL packet receive for configuration where + ath# is part of a bridge interface + * added a configuration file and log analyzer script for logwatch + * fixed EAPOL state machine step function to process all state + transitions before processing new events; this resolves a race + condition in which EAPOL-Start message could trigger hostapd to send + two EAP-Response/Identity frames to the authentication server + +2005-09-25 - v0.4.5 + * added client CA list to the TLS certificate request in order to make + it easier for the client to select which certificate to use + * added experimental support for EAP-PSK + * added support for WE-19 (hostap, madwifi) + +2005-08-21 - v0.4.4 + * fixed build without CONFIG_RSN_PREAUTH + * fixed FreeBSD build + +2005-06-26 - v0.4.3 + * fixed PMKSA caching to copy User-Name and Class attributes so that + RADIUS accounting gets correct information + * start RADIUS accounting only after successful completion of WPA + 4-Way Handshake if WPA-PSK is used + * fixed PMKSA caching for the case where STA (re)associates without + first disassociating + +2005-06-12 - v0.4.2 + * EAP-PAX is now registered as EAP type 46 + * fixed EAP-PAX MAC calculation + * fixed EAP-PAX CK and ICK key derivation + * renamed eap_authenticator configuration variable to eap_server to + better match with RFC 3748 (EAP) terminology + * driver_test: added support for testing hostapd with wpa_supplicant + by using test driver interface without any kernel drivers or network + cards + +2005-05-22 - v0.4.1 + * fixed RADIUS server initialization when only auth or acct server + is configured and the other one is left empty + * driver_madwifi: added support for RADIUS accounting + * driver_madwifi: added preliminary support for compiling against 'BSD' + branch of madwifi CVS tree + * driver_madwifi: fixed pairwise key removal to allow WPA reauth + without disassociation + * added support for reading additional certificates from PKCS#12 files + and adding them to the certificate chain + * fixed RADIUS Class attribute processing to only use Access-Accept + packets to update Class; previously, other RADIUS authentication + packets could have cleared Class attribute + * added support for more than one Class attribute in RADIUS packets + * added support for verifying certificate revocation list (CRL) when + using integrated EAP authenticator for EAP-TLS; new hostapd.conf + options 'check_crl'; CRL must be included in the ca_cert file for now + +2005-04-25 - v0.4.0 (beginning of 0.4.x development releases) + * added support for including network information into + EAP-Request/Identity message (ASCII-0 (nul) in eap_message) + (e.g., to implement draft-adrange-eap-network-discovery-07.txt) + * fixed a bug which caused some RSN pre-authentication cases to use + freed memory and potentially crash hostapd + * fixed private key loading for cases where passphrase is not set + * added support for sending TLS alerts and aborting authentication + when receiving a TLS alert + * fixed WPA2 to add PMKSA cache entry when using integrated EAP + authenticator + * fixed PMKSA caching (EAP authentication was not skipped correctly + with the new state machine changes from IEEE 802.1X draft) + * added support for RADIUS over IPv6; own_ip_addr, auth_server_addr, + and acct_server_addr can now be IPv6 addresses (CONFIG_IPV6=y needs + to be added to .config to include IPv6 support); for RADIUS server, + radius_server_ipv6=1 needs to be set in hostapd.conf and addresses + in RADIUS clients file can then use IPv6 format + * added experimental support for EAP-PAX + * replaced hostapd control interface library (hostapd_ctrl.[ch]) with + the same implementation that wpa_supplicant is using (wpa_ctrl.[ch]) + +2005-02-12 - v0.3.7 (beginning of 0.3.x stable releases) + +2005-01-23 - v0.3.5 + * added support for configuring a forced PEAP version based on the + Phase 1 identity + * fixed PEAPv1 to use tunneled EAP-Success/Failure instead of EAP-TLV + to terminate authentication + * fixed EAP identifier duplicate processing with the new IEEE 802.1X + draft + * clear accounting data in the driver when starting a new accounting + session + * driver_madwifi: filter wireless events based on ifindex to allow more + than one network interface to be used + * fixed WPA message 2/4 processing not to cancel timeout for TimeoutEvt + setting if the packet does not pass MIC verification (e.g., due to + incorrect PSK); previously, message 1/4 was not tried again if an + invalid message 2/4 was received + * fixed reconfiguration of RADIUS client retransmission timer when + adding a new message to the pending list; previously, timer was not + updated at this point and if there was a pending message with long + time for the next retry, the new message needed to wait that long for + its first retry, too + +2005-01-09 - v0.3.4 + * added support for configuring multiple allowed EAP types for Phase 2 + authentication (EAP-PEAP, EAP-TTLS) + * fixed EAPOL-Start processing to trigger WPA reauthentication + (previously, only EAPOL authentication was done) + +2005-01-02 - v0.3.3 + * added support for EAP-PEAP in the integrated EAP authenticator + * added support for EAP-GTC in the integrated EAP authenticator + * added support for configuring list of EAP methods for Phase 1 so that + the integrated EAP authenticator can, e.g., use the wildcard entry + for EAP-TLS and EAP-PEAP + * added support for EAP-TTLS in the integrated EAP authenticator + * added support for EAP-SIM in the integrated EAP authenticator + * added support for using hostapd as a RADIUS authentication server + with the integrated EAP authenticator taking care of EAP + authentication (new hostapd.conf options: radius_server_clients and + radius_server_auth_port); this is not included in default build; use + CONFIG_RADIUS_SERVER=y in .config to include + +2004-12-19 - v0.3.2 + * removed 'daemonize' configuration file option since it has not really + been used at all for more than year + * driver_madwifi: fixed group key setup and added get_ssid method + * added support for EAP-MSCHAPv2 in the integrated EAP authenticator + +2004-12-12 - v0.3.1 + * added support for integrated EAP-TLS authentication (new hostapd.conf + variables: ca_cert, server_cert, private_key, private_key_passwd); + this enabled dynamic keying (WPA2/WPA/IEEE 802.1X/WEP) without + external RADIUS server + * added support for reading PKCS#12 (PFX) files (as a replacement for + PEM/DER) to get certificate and private key (CONFIG_PKCS12) + +2004-12-05 - v0.3.0 (beginning of 0.3.x development releases) + * added support for Acct-{Input,Output}-Gigawords + * added support for Event-Timestamp (in RADIUS Accounting-Requests) + * added support for RADIUS Authentication Client MIB (RFC2618) + * added support for RADIUS Accounting Client MIB (RFC2620) + * made EAP re-authentication period configurable (eap_reauth_period) + * fixed EAPOL reauthentication to trigger WPA/WPA2 reauthentication + * fixed EAPOL state machine to stop if STA is removed during + eapol_sm_step(); this fixes at least one segfault triggering bug with + IEEE 802.11i pre-authentication + * added support for multiple WPA pre-shared keys (e.g., one for each + client MAC address or keys shared by a group of clients); + new hostapd.conf field wpa_psk_file for setting path to a text file + containing PSKs, see hostapd.wpa_psk for an example + * added support for multiple driver interfaces to allow hostapd to be + used with other drivers + * added wired authenticator driver interface (driver=wired in + hostapd.conf, see wired.conf for example configuration) + * added madwifi driver interface (driver=madwifi in hostapd.conf, see + madwifi.conf for example configuration; Note: include files from + madwifi project is needed for building and a configuration file, + .config, needs to be created in hostapd directory with + CONFIG_DRIVER_MADWIFI=y to include this driver interface in hostapd + build) + * fixed an alignment issue that could cause SHA-1 to fail on some + platforms (e.g., Intel ixp425 with a compiler that does not 32-bit + align variables) + * fixed RADIUS reconnection after an error in sending interim + accounting packets + * added hostapd control interface for external programs and an example + CLI, hostapd_cli (like wpa_cli for wpa_supplicant) + * started adding dot11, dot1x, radius MIBs ('hostapd_cli mib', + 'hostapd_cli sta ') + * finished update from IEEE 802.1X-2001 to IEEE 802.1X-REV (now d11) + * added support for strict GTK rekeying (wpa_strict_rekey in + hostapd.conf) + * updated IAPP to use UDP port 3517 and multicast address 224.0.1.178 + (instead of broadcast) for IAPP ADD-notify (moved from draft 3 to + IEEE 802.11F-2003) + * added Prism54 driver interface (driver=prism54 in hostapd.conf; + note: .config needs to be created in hostapd directory with + CONFIG_DRIVER_PRISM54=y to include this driver interface in hostapd + build) + * dual-licensed hostapd (GPLv2 and BSD licenses) + * fixed RADIUS accounting to generate a new session id for cases where + a station reassociates without first being complete deauthenticated + * fixed STA disassociation handler to mark next timeout state to + deauthenticate the station, i.e., skip long wait for inactivity poll + and extra disassociation, if the STA disassociates without + deauthenticating + * added integrated EAP authenticator that can be used instead of + external RADIUS authentication server; currently, only EAP-MD5 is + supported, so this cannot yet be used for key distribution; the EAP + method interface is generic, though, so adding new EAP methods should + be straightforward; new hostapd.conf variables: 'eap_authenticator' + and 'eap_user_file'; this obsoletes "minimal authentication server" + ('minimal_eap' in hostapd.conf) which is now removed + * added support for FreeBSD and driver interface for the BSD net80211 + layer (driver=bsd in hostapd.conf and CONFIG_DRIVER_BSD=y in + .config); please note that some of the required kernel mods have not + yet been committed + +2004-07-17 - v0.2.4 (beginning of 0.2.x stable releases) + * fixed some accounting cases where Accounting-Start was sent when + IEEE 802.1X port was being deauthorized + +2004-06-20 - v0.2.3 + * modified RADIUS client to re-connect the socket in case of certain + error codes that are generated when a network interface state is + changes (e.g., when IP address changes or the interface is set UP) + * fixed couple of cases where EAPOL state for a station was freed + twice causing a segfault for hostapd + * fixed couple of bugs in processing WPA deauthentication (freed data + was used) + +2004-05-31 - v0.2.2 + * fixed WPA/WPA2 group rekeying to use key index correctly (GN/GM) + * fixed group rekeying to send zero TSC in EAPOL-Key messages to fix + cases where STAs dropped multicast frames as replay attacks + * added support for copying RADIUS Attribute 'Class' from + authentication messages into accounting messages + * send canned EAP failure if RADIUS server sends Access-Reject without + EAP message (previously, Supplicant was not notified in this case) + * fixed mixed WPA-PSK and WPA-EAP mode to work with WPA-PSK (i.e., do + not start EAPOL state machines if the STA selected to use WPA-PSK) + +2004-05-06 - v0.2.1 + * added WPA and IEEE 802.11i/RSN (WPA2) Authenticator functionality + - based on IEEE 802.11i/D10.0 but modified to interoperate with WPA + (i.e., IEEE 802.11i/D3.0) + - supports WPA-only, RSN-only, and mixed WPA/RSN mode + - both WPA-PSK and WPA-RADIUS/EAP are supported + - PMKSA caching and pre-authentication + - new hostapd.conf variables: wpa, wpa_psk, wpa_passphrase, + wpa_key_mgmt, wpa_pairwise, wpa_group_rekey, wpa_gmk_rekey, + rsn_preauth, rsn_preauth_interfaces + * fixed interim accounting to remove any pending accounting messages + to the STA before sending a new one + +2004-02-15 - v0.2.0 + * added support for Acct-Interim-Interval: + - draft-ietf-radius-acct-interim-01.txt + - use Acct-Interim-Interval attribute from Access-Accept if local + 'radius_acct_interim_interval' is not set + - allow different update intervals for each STA + * fixed event loop to call signal handlers only after returning from + the real signal handler + * reset sta->timeout_next after successful association to make sure + that the previously registered inactivity timer will not remove the + STA immediately (e.g., if STA deauthenticates and re-associates + before the timer is triggered). + * added new hostapd.conf variable, nas_identifier, that can be used to + add an optional RADIUS Attribute, NAS-Identifier, into authentication + and accounting messages + * added support for Accounting-On and Accounting-Off messages + * fixed accounting session handling to send Accounting-Start only once + per session and not to send Accounting-Stop if the session was not + initialized properly + * fixed Accounting-Stop statistics in cases where the message was + previously sent after the kernel entry for the STA (and/or IEEE + 802.1X data) was removed + + +Note: + +Older changes up to and including v0.1.0 are included in the ChangeLog +of the Host AP driver. Added: vendor/wpa/dist/hostapd/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/wpa/dist/hostapd/Makefile Sun Mar 1 22:10:07 2009 (r189251) @@ -0,0 +1,602 @@ +ifndef CC +CC=gcc +endif + +ifndef CFLAGS +CFLAGS = -MMD -O2 -Wall -g +endif + +# define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to +# a file (undefine it, if you want to save in binary size) +CFLAGS += -DHOSTAPD_DUMP_STATE + +CFLAGS += -I../src +CFLAGS += -I../src/crypto +CFLAGS += -I../src/utils +CFLAGS += -I../src/common + +# Uncomment following line and set the path to your kernel tree include +# directory if your C library does not include all header files. +# CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include + +-include .config + +ifndef CONFIG_OS +ifdef CONFIG_NATIVE_WINDOWS +CONFIG_OS=win32 +else +CONFIG_OS=unix +endif +endif + +ifeq ($(CONFIG_OS), internal) +CFLAGS += -DOS_NO_C_LIB_DEFINES +endif + +ifdef CONFIG_NATIVE_WINDOWS +CFLAGS += -DCONFIG_NATIVE_WINDOWS +LIBS += -lws2_32 +endif + +OBJS = hostapd.o ieee802_1x.o eapol_sm.o \ + ieee802_11.o config.o ieee802_11_auth.o accounting.o \ + sta_info.o wpa.o ctrl_iface.o \ + drivers.o preauth.o pmksa_cache.o beacon.o \ + hw_features.o wme.o ap_list.o \ + mlme.o vlan_init.o wpa_auth_ie.o + +OBJS += ../src/utils/eloop.o +OBJS += ../src/utils/common.o +OBJS += ../src/utils/wpa_debug.o +OBJS += ../src/utils/wpabuf.o +OBJS += ../src/utils/os_$(CONFIG_OS).o +OBJS += ../src/utils/ip_addr.o + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From sam at FreeBSD.org Sun Mar 1 14:10:53 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 14:11:06 2009 Subject: svn commit: r189252 - vendor/wpa/0.6.8 Message-ID: <200903012210.n21MApH7055400@svn.freebsd.org> Author: sam Date: Sun Mar 1 22:10:51 2009 New Revision: 189252 URL: http://svn.freebsd.org/changeset/base/189252 Log: tag 0.6.8 release Added: vendor/wpa/0.6.8/ - copied from r189251, vendor/wpa/dist/ From scottl at FreeBSD.org Sun Mar 1 14:37:35 2009 From: scottl at FreeBSD.org (Scott Long) Date: Sun Mar 1 14:37:54 2009 Subject: svn commit: r189253 - in stable/7/sys: . cam/scsi contrib/pf dev/cxgb Message-ID: <200903012237.n21MbYkf056028@svn.freebsd.org> Author: scottl Date: Sun Mar 1 22:37:34 2009 New Revision: 189253 URL: http://svn.freebsd.org/changeset/base/189253 Log: Merge 186882: Implement kern.cam.cd.retry_count to aid with disk- recovery tools. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/scsi/scsi_cd.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/7/sys/cam/scsi/scsi_cd.c Sun Mar 1 22:10:51 2009 (r189252) +++ stable/7/sys/cam/scsi/scsi_cd.c Sun Mar 1 22:37:34 2009 (r189253) @@ -292,6 +292,9 @@ static struct periph_driver cddriver = PERIPHDRIVER_DECLARE(cd, cddriver); +#ifndef CD_DEFAULT_RETRY +#define CD_DEFAULT_RETRY 4 +#endif #ifndef CHANGER_MIN_BUSY_SECONDS #define CHANGER_MIN_BUSY_SECONDS 5 #endif @@ -299,11 +302,15 @@ PERIPHDRIVER_DECLARE(cd, cddriver); #define CHANGER_MAX_BUSY_SECONDS 15 #endif +static int cd_retry_count = CD_DEFAULT_RETRY; static int changer_min_busy_seconds = CHANGER_MIN_BUSY_SECONDS; static int changer_max_busy_seconds = CHANGER_MAX_BUSY_SECONDS; SYSCTL_NODE(_kern_cam, OID_AUTO, cd, CTLFLAG_RD, 0, "CAM CDROM driver"); SYSCTL_NODE(_kern_cam_cd, OID_AUTO, changer, CTLFLAG_RD, 0, "CD Changer"); +SYSCTL_INT(_kern_cam_cd, OID_AUTO, retry_count, CTLFLAG_RW, + &cd_retry_count, 0, "Normal I/O retry count"); +TUNABLE_INT("kern.cam.cd.retry_count", &cd_retry_count); SYSCTL_INT(_kern_cam_cd_changer, OID_AUTO, min_busy_seconds, CTLFLAG_RW, &changer_min_busy_seconds, 0, "Minimum changer scheduling quantum"); TUNABLE_INT("kern.cam.cd.changer.min_busy_seconds", &changer_min_busy_seconds); @@ -1454,7 +1461,7 @@ cdstart(struct cam_periph *periph, union devstat_start_transaction_bio(softc->disk->d_devstat, bp); scsi_read_write(&start_ccb->csio, - /*retries*/4, + /*retries*/cd_retry_count, /* cbfcnp */ cddone, MSG_SIMPLE_Q_TAG, /* read */bp->bio_cmd == BIO_READ, From sam at FreeBSD.org Sun Mar 1 14:40:16 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 14:40:27 2009 Subject: svn commit: r189254 - in vendor/wpa/dist: hostapd patches src/common src/drivers src/l2_packet src/utils wpa_supplicant wpa_supplicant/symbian wpa_supplicant/vs2005 wpa_supplicant/wpa_gui wpa_suppl... Message-ID: <200903012240.n21MeFUu056152@svn.freebsd.org> Author: sam Date: Sun Mar 1 22:40:15 2009 New Revision: 189254 URL: http://svn.freebsd.org/changeset/base/189254 Log: remove unused bits Deleted: vendor/wpa/dist/hostapd/Makefile vendor/wpa/dist/hostapd/driver_bsd.c vendor/wpa/dist/hostapd/driver_hostap.c vendor/wpa/dist/hostapd/driver_madwifi.c vendor/wpa/dist/hostapd/driver_nl80211.c vendor/wpa/dist/hostapd/driver_none.c vendor/wpa/dist/hostapd/driver_prism54.c vendor/wpa/dist/hostapd/driver_test.c vendor/wpa/dist/hostapd/driver_wired.c vendor/wpa/dist/hostapd/prism54.h vendor/wpa/dist/hostapd/priv_netlink.h vendor/wpa/dist/hostapd/radiotap.c vendor/wpa/dist/hostapd/radiotap.h vendor/wpa/dist/hostapd/radiotap_iter.h vendor/wpa/dist/patches/ vendor/wpa/dist/src/common/nl80211_copy.h vendor/wpa/dist/src/common/wireless_copy.h vendor/wpa/dist/src/drivers/.gitignore vendor/wpa/dist/src/drivers/Apple80211.h vendor/wpa/dist/src/drivers/Makefile vendor/wpa/dist/src/drivers/MobileApple80211.c vendor/wpa/dist/src/drivers/MobileApple80211.h vendor/wpa/dist/src/drivers/driver_atmel.c vendor/wpa/dist/src/drivers/driver_broadcom.c vendor/wpa/dist/src/drivers/driver_bsd.c vendor/wpa/dist/src/drivers/driver_hostap.c vendor/wpa/dist/src/drivers/driver_hostap.h vendor/wpa/dist/src/drivers/driver_iphone.m vendor/wpa/dist/src/drivers/driver_ipw.c vendor/wpa/dist/src/drivers/driver_madwifi.c vendor/wpa/dist/src/drivers/driver_ndis_.c vendor/wpa/dist/src/drivers/driver_ndiswrapper.c vendor/wpa/dist/src/drivers/driver_nl80211.c vendor/wpa/dist/src/drivers/driver_osx.m vendor/wpa/dist/src/drivers/driver_prism54.c vendor/wpa/dist/src/drivers/driver_privsep.c vendor/wpa/dist/src/drivers/driver_ps3.c vendor/wpa/dist/src/drivers/driver_ralink.c vendor/wpa/dist/src/drivers/driver_ralink.h vendor/wpa/dist/src/drivers/driver_roboswitch.c vendor/wpa/dist/src/drivers/driver_test.c vendor/wpa/dist/src/drivers/driver_wext.c vendor/wpa/dist/src/drivers/driver_wext.h vendor/wpa/dist/src/drivers/driver_wired.c vendor/wpa/dist/src/drivers/ndis_events.c vendor/wpa/dist/src/drivers/priv_netlink.h vendor/wpa/dist/src/drivers/radiotap.c vendor/wpa/dist/src/drivers/radiotap.h vendor/wpa/dist/src/drivers/radiotap_iter.h vendor/wpa/dist/src/l2_packet/.gitignore vendor/wpa/dist/src/l2_packet/Makefile vendor/wpa/dist/src/l2_packet/l2_packet_freebsd.c vendor/wpa/dist/src/l2_packet/l2_packet_linux.c vendor/wpa/dist/src/l2_packet/l2_packet_ndis.c vendor/wpa/dist/src/l2_packet/l2_packet_none.c vendor/wpa/dist/src/l2_packet/l2_packet_pcap.c vendor/wpa/dist/src/l2_packet/l2_packet_privsep.c vendor/wpa/dist/src/l2_packet/l2_packet_winpcap.c vendor/wpa/dist/src/utils/eloop_none.c vendor/wpa/dist/src/utils/eloop_win.c vendor/wpa/dist/src/utils/os_none.c vendor/wpa/dist/src/utils/os_win32.c vendor/wpa/dist/wpa_supplicant/Makefile vendor/wpa/dist/wpa_supplicant/README-Windows.txt vendor/wpa/dist/wpa_supplicant/config_winreg.c vendor/wpa/dist/wpa_supplicant/ctrl_iface_named_pipe.c vendor/wpa/dist/wpa_supplicant/main_none.c vendor/wpa/dist/wpa_supplicant/main_symbian.cpp vendor/wpa/dist/wpa_supplicant/main_winmain.c vendor/wpa/dist/wpa_supplicant/main_winsvc.c vendor/wpa/dist/wpa_supplicant/nmake.mak vendor/wpa/dist/wpa_supplicant/symbian/ vendor/wpa/dist/wpa_supplicant/vs2005/ vendor/wpa/dist/wpa_supplicant/win_example.reg vendor/wpa/dist/wpa_supplicant/win_if_list.c vendor/wpa/dist/wpa_supplicant/wpa_gui/ vendor/wpa/dist/wpa_supplicant/wpa_gui-qt4/ From rwatson at FreeBSD.org Sun Mar 1 14:48:19 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Mar 1 14:48:26 2009 Subject: svn commit: r189255 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern Message-ID: <200903012248.n21MmIgg056435@svn.freebsd.org> Author: rwatson Date: Sun Mar 1 22:48:18 2009 New Revision: 189255 URL: http://svn.freebsd.org/changeset/base/189255 Log: Merge r187686 from head to stable/7: When a statically linked binary is executed (or at least, one without an interpreter definition in its program header), set the auxiliary ELF argument AT_BASE to 0 rather than to the address that we would have mapped the interpreter at if there had been one. The ELF ABI specifications appear to be ambiguous as to the desired behavior in this situation, as they define AT_BASE as the base address of the interpreter, but do not mention what to do if there is none. On Solaris, AT_BASE will be set to the base address of the static binary if there is no interpreter, and on Linux, AT_BASE is set to 0. We go with the Linux semantics as they are of more immediate utility and allow the early runtime environment to know that the kernel has not mapped an interpreter, but because AT_PHDR points at the ELF header for the running binary, it is still possible to retrieve all required mapping information when the process starts should it be required. Either approach would be preferable to our current behavior of passing a pointer to an unmapped region of user memory as AT_BASE. Sponsored by: Google Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/imgact_elf.c Modified: stable/7/sys/kern/imgact_elf.c ============================================================================== --- stable/7/sys/kern/imgact_elf.c Sun Mar 1 22:40:15 2009 (r189254) +++ stable/7/sys/kern/imgact_elf.c Sun Mar 1 22:48:18 2009 (r189255) @@ -830,7 +830,8 @@ __CONCAT(exec_, __elfN(imgact))(struct i uprintf("ELF interpreter %s not found\n", interp); return (error); } - } + } else + addr = 0; /* * Construct auxargs table (used by the fixup routine) From mav at FreeBSD.org Sun Mar 1 14:50:15 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sun Mar 1 14:50:21 2009 Subject: svn commit: r189256 - head/sys/dev/ata/chipsets Message-ID: <200903012250.n21MoEuK056707@svn.freebsd.org> Author: mav Date: Sun Mar 1 22:50:14 2009 New Revision: 189256 URL: http://svn.freebsd.org/changeset/base/189256 Log: Give controller a chance to issue Soft Reset clear command before checking ready status. Most of controllers managed to issue coommand and set BUSY bit almost simultaneously, before we will read it, but at least JMicron JMB363 don't. Ignore timeout errors to keep old behavior when error there was impossible. For me this fixes timeout errors on the first command after channel attach or reinit. Boot in my case is not affected, as there is much time passing between reset and next command giving reset time to complete. Modified: head/sys/dev/ata/chipsets/ata-ahci.c Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Sun Mar 1 22:48:18 2009 (r189255) +++ head/sys/dev/ata/chipsets/ata-ahci.c Sun Mar 1 22:50:14 2009 (r189256) @@ -683,8 +683,7 @@ ata_ahci_softreset(device_t dev, int por ctp->cfis[1] = port & 0x0f; //ctp->cfis[7] = ATA_D_LBA | ATA_D_IBM; ctp->cfis[15] = ATA_A_4BIT; - if (ata_ahci_issue_cmd(dev, 0, 0)) - return -1; + ata_ahci_issue_cmd(dev, 0, 1000); if (ata_ahci_wait_ready(dev, 1000)) { device_printf(dev, "software reset clear timeout\n"); From sam at FreeBSD.org Sun Mar 1 14:52:42 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 14:52:54 2009 Subject: svn commit: r189257 - head/contrib/wpa Message-ID: <200903012252.n21Mqfr5057028@svn.freebsd.org> Author: sam Date: Sun Mar 1 22:52:41 2009 New Revision: 189257 URL: http://svn.freebsd.org/changeset/base/189257 Log: add new combined wpa_supplicant+hostapd tree Added: head/contrib/wpa/ (props changed) From rwatson at FreeBSD.org Sun Mar 1 15:17:52 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Mar 1 15:18:00 2009 Subject: svn commit: r189258 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb security/audit Message-ID: <200903012317.n21NHpuB058160@svn.freebsd.org> Author: rwatson Date: Sun Mar 1 23:17:51 2009 New Revision: 189258 URL: http://svn.freebsd.org/changeset/base/189258 Log: Merge r188313 from head to stable/7: Change various routines that are responsible for transforming audit event IDs based on arguments to return au_event_t rather than int. Obtained from: TrustedBSD Project Sponsored by: Apple, Inc. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/security/audit/audit_bsm_klib.c stable/7/sys/security/audit/audit_private.h Modified: stable/7/sys/security/audit/audit_bsm_klib.c ============================================================================== --- stable/7/sys/security/audit/audit_bsm_klib.c Sun Mar 1 22:52:41 2009 (r189257) +++ stable/7/sys/security/audit/audit_bsm_klib.c Sun Mar 1 23:17:51 2009 (r189258) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2008 Apple Inc. + * Copyright (c) 1999-2009 Apple Inc. * Copyright (c) 2005 Robert N. M. Watson * All rights reserved. * @@ -345,7 +345,7 @@ audit_flags_and_error_to_openevent(int o /* * Convert a MSGCTL command to a specific event. */ -int +au_event_t audit_msgctl_to_event(int cmd) { @@ -368,7 +368,7 @@ audit_msgctl_to_event(int cmd) /* * Convert a SEMCTL command to a specific event. */ -int +au_event_t audit_semctl_to_event(int cmd) { @@ -412,7 +412,7 @@ audit_semctl_to_event(int cmd) /* * Convert a command for the auditon() system call to a audit event. */ -int +au_event_t auditon_command_event(int cmd) { Modified: stable/7/sys/security/audit/audit_private.h ============================================================================== --- stable/7/sys/security/audit/audit_private.h Sun Mar 1 22:52:41 2009 (r189257) +++ stable/7/sys/security/audit/audit_private.h Sun Mar 1 23:17:51 2009 (r189258) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1999-2005 Apple Inc. + * Copyright (c) 1999-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -305,10 +305,10 @@ void au_evclassmap_insert(au_event_t e au_class_t au_event_class(au_event_t event); au_event_t audit_ctlname_to_sysctlevent(int name[], uint64_t valid_arg); au_event_t audit_flags_and_error_to_openevent(int oflags, int error); -int audit_msgctl_to_event(int cmd); -int audit_semctl_to_event(int cmr); +au_event_t audit_msgctl_to_event(int cmd); +au_event_t audit_semctl_to_event(int cmr); void audit_canon_path(struct thread *td, char *path, char *cpath); -int auditon_command_event(int cmd); +au_event_t auditon_command_event(int cmd); /* * Audit trigger events notify user space of kernel audit conditions From rwatson at FreeBSD.org Sun Mar 1 15:32:28 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Mar 1 15:32:41 2009 Subject: svn commit: r189259 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb security/audit Message-ID: <200903012332.n21NWRL8058474@svn.freebsd.org> Author: rwatson Date: Sun Mar 1 23:32:27 2009 New Revision: 189259 URL: http://svn.freebsd.org/changeset/base/189259 Log: Merge r188315 from head to stable/7: Set the lower bound on queue size for an audit pipe to 1 instead of 0, as an audit pipe with a queue length of 0 is less useful. Obtained from: TrustedBSD Project Sponsored by: Apple, Inc. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/security/audit/audit_pipe.c Modified: stable/7/sys/security/audit/audit_pipe.c ============================================================================== --- stable/7/sys/security/audit/audit_pipe.c Sun Mar 1 23:17:51 2009 (r189258) +++ stable/7/sys/security/audit/audit_pipe.c Sun Mar 1 23:32:27 2009 (r189259) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Robert N. M. Watson - * Copyright (c) 2008 Apple, Inc. + * Copyright (c) 2008-2009 Apple, Inc. * All rights reserved. * * This software was developed by Robert Watson for the TrustedBSD Project. @@ -76,7 +76,7 @@ static MALLOC_DEFINE(M_AUDIT_PIPE_PRESEL * Audit pipe buffer parameters. */ #define AUDIT_PIPE_QLIMIT_DEFAULT (128) -#define AUDIT_PIPE_QLIMIT_MIN (0) +#define AUDIT_PIPE_QLIMIT_MIN (1) #define AUDIT_PIPE_QLIMIT_MAX (1024) /* From sam at FreeBSD.org Sun Mar 1 18:22:50 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 18:23:02 2009 Subject: svn commit: r189260 - head/contrib/wpa Message-ID: <200903020222.n222MnTD061693@svn.freebsd.org> Author: sam Date: Mon Mar 2 02:22:49 2009 New Revision: 189260 URL: http://svn.freebsd.org/changeset/base/189260 Log: remove Deleted: head/contrib/wpa/ From sam at FreeBSD.org Sun Mar 1 18:23:48 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 18:23:53 2009 Subject: svn commit: r189261 - head/contrib/wpa Message-ID: <200903020223.n222Nl8n061747@svn.freebsd.org> Author: sam Date: Mon Mar 2 02:23:47 2009 New Revision: 189261 URL: http://svn.freebsd.org/changeset/base/189261 Log: connect vendor wpa area to contrib Added: head/contrib/wpa/ - copied from r189260, vendor/wpa/dist/ From sam at FreeBSD.org Sun Mar 1 18:26:54 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 18:27:01 2009 Subject: svn commit: r189262 - in head/contrib/wpa: hostapd src/utils wpa_supplicant Message-ID: <200903020226.n222QrYe061851@svn.freebsd.org> Author: sam Date: Mon Mar 2 02:26:53 2009 New Revision: 189262 URL: http://svn.freebsd.org/changeset/base/189262 Log: bring in local changes for: CONFIG_DEBUG_SYSLOG CONFIG_TERMINATE_ONLASTIF EAP_SERVER Modified: head/contrib/wpa/hostapd/hostapd.c head/contrib/wpa/src/utils/wpa_debug.c head/contrib/wpa/wpa_supplicant/events.c head/contrib/wpa/wpa_supplicant/main.c head/contrib/wpa/wpa_supplicant/wpa_supplicant.c head/contrib/wpa/wpa_supplicant/wpa_supplicant_i.h Modified: head/contrib/wpa/hostapd/hostapd.c ============================================================================== --- head/contrib/wpa/hostapd/hostapd.c Mon Mar 2 02:23:47 2009 (r189261) +++ head/contrib/wpa/hostapd/hostapd.c Mon Mar 2 02:26:53 2009 (r189262) @@ -1910,10 +1910,12 @@ int main(int argc, char *argv[]) if (optind == argc) usage(); +#ifdef EAP_SERVER if (eap_server_register_methods()) { wpa_printf(MSG_ERROR, "Failed to register EAP methods"); return -1; } +#endif /* EAP_SERVER */ interfaces.count = argc - optind; @@ -2019,7 +2021,9 @@ int main(int argc, char *argv[]) closelog(); #endif /* CONFIG_NATIVE_WINDOWS */ +#ifdef EAP_SERVER eap_server_unregister_methods(); +#endif /* EAP_SERVER */ os_daemonize_terminate(pid_file); Modified: head/contrib/wpa/src/utils/wpa_debug.c ============================================================================== --- head/contrib/wpa/src/utils/wpa_debug.c Mon Mar 2 02:23:47 2009 (r189261) +++ head/contrib/wpa/src/utils/wpa_debug.c Mon Mar 2 02:26:53 2009 (r189262) @@ -16,6 +16,10 @@ #include "common.h" +#ifdef CONFIG_DEBUG_SYSLOG +#include +#endif /* CONFIG_DEBUG_SYSLOG */ + #ifdef CONFIG_DEBUG_FILE static FILE *out_file = NULL; @@ -23,6 +27,7 @@ static FILE *out_file = NULL; int wpa_debug_level = MSG_INFO; int wpa_debug_show_keys = 0; int wpa_debug_timestamp = 0; +int wpa_debug_syslog = 0; #ifndef CONFIG_NO_STDOUT_DEBUG @@ -44,6 +49,40 @@ void wpa_debug_print_timestamp(void) printf("%ld.%06u: ", (long) tv.sec, (unsigned int) tv.usec); } +void wpa_debug_open_syslog(void) +{ +#ifdef CONFIG_DEBUG_SYSLOG + openlog("wpa_supplicant", LOG_PID | LOG_NDELAY, LOG_DAEMON); + wpa_debug_syslog++; +#endif +} + +void wpa_debug_close_syslog(void) +{ +#ifdef CONFIG_DEBUG_SYSLOG + if (wpa_debug_syslog) + closelog(); +#endif +} + +#ifdef CONFIG_DEBUG_SYSLOG +static int syslog_priority(int level) +{ + switch (level) { + case MSG_MSGDUMP: + case MSG_DEBUG: + return LOG_DEBUG; + case MSG_INFO: + return LOG_NOTICE; + case MSG_WARNING: + return LOG_WARNING; + case MSG_ERROR: + return LOG_ERR; + } + return LOG_INFO; +} +#endif /* CONFIG_DEBUG_SYSLOG */ + /** * wpa_printf - conditional printf @@ -62,6 +101,11 @@ void wpa_printf(int level, char *fmt, .. va_start(ap, fmt); if (level >= wpa_debug_level) { +#ifdef CONFIG_DEBUG_SYSLOG + if (wpa_debug_syslog) { + vsyslog(syslog_priority(level), fmt, ap); + } else { +#endif /* CONFIG_DEBUG_SYSLOG */ wpa_debug_print_timestamp(); #ifdef CONFIG_DEBUG_FILE if (out_file) { @@ -74,6 +118,9 @@ void wpa_printf(int level, char *fmt, .. #ifdef CONFIG_DEBUG_FILE } #endif /* CONFIG_DEBUG_FILE */ +#ifdef CONFIG_DEBUG_SYSLOG + } +#endif /* CONFIG_DEBUG_SYSLOG */ } va_end(ap); } Modified: head/contrib/wpa/wpa_supplicant/events.c ============================================================================== --- head/contrib/wpa/wpa_supplicant/events.c Mon Mar 2 02:23:47 2009 (r189261) +++ head/contrib/wpa/wpa_supplicant/events.c Mon Mar 2 02:26:53 2009 (r189262) @@ -1011,6 +1011,18 @@ wpa_supplicant_event_michael_mic_failure } +#ifdef CONFIG_TERMINATE_ONLASTIF +static int any_interfaces(struct wpa_supplicant *head) +{ + struct wpa_supplicant *wpa_s; + + for (wpa_s = head; wpa_s != NULL; wpa_s = wpa_s->next) + if (!wpa_s->interface_removed) + return 1; + return 0; +} +#endif /* CONFIG_TERMINATE_ONLASTIF */ + static void wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s, union wpa_event_data *data) @@ -1035,6 +1047,11 @@ wpa_supplicant_event_interface_status(st wpa_supplicant_mark_disassoc(wpa_s); l2_packet_deinit(wpa_s->l2); wpa_s->l2 = NULL; +#ifdef CONFIG_TERMINATE_ONLASTIF + /* check if last interface */ + if (!any_interfaces(wpa_s->global->ifaces)) + eloop_terminate(); +#endif /* CONFIG_TERMINATE_ONLASTIF */ break; } } Modified: head/contrib/wpa/wpa_supplicant/main.c ============================================================================== --- head/contrib/wpa/wpa_supplicant/main.c Mon Mar 2 02:23:47 2009 (r189261) +++ head/contrib/wpa/wpa_supplicant/main.c Mon Mar 2 02:26:53 2009 (r189262) @@ -26,11 +26,23 @@ static void usage(void) int i; printf("%s\n\n%s\n" "usage:\n" - " wpa_supplicant [-BddhKLqqtuvW] [-P] " + " wpa_supplicant [-BddhKLqq" +#ifdef CONFIG_DEBUG_SYSLOG + "s" +#endif /* CONFIG_DEBUG_SYSLOG */ + "t" +#ifdef CONFIG_CTRL_IFACE_DBUS + "u" +#endif /* CONFIG_CTRL_IFACE_DBUS */ + "vW] [-P] " "[-g] \\\n" " -i -c [-C] [-D] " "[-p] \\\n" - " [-b] [-f] \\\n" + " [-b]" +#ifdef CONFIG_DEBUG_FILE + " [-f]" +#endif /* CONFIG_DEBUG_FILE */ + " \\\n" " [-N -i -c [-C] " "[-D] \\\n" " [-p] [-b] ...]\n" @@ -58,6 +70,9 @@ static void usage(void) #endif /* CONFIG_DEBUG_FILE */ " -g = global ctrl_interface\n" " -K = include keys (passwords, etc.) in debug output\n" +#ifdef CONFIG_DEBUG_SYSLOG + " -s = log output to syslog instead of stdout\n" +#endif /* CONFIG_DEBUG_SYSLOG */ " -t = include timestamp in debug messages\n" " -h = show this help text\n" " -L = show license (GPL and BSD)\n"); @@ -72,7 +87,9 @@ static void usage(void) " -N = start describing new interface\n"); printf("example:\n" - " wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf\n"); + " wpa_supplicant -D%s -iwlan0 -c/etc/wpa_supplicant.conf\n", + wpa_supplicant_drivers[i] ? + wpa_supplicant_drivers[i]->name : "wext"); #endif /* CONFIG_NO_STDOUT_DEBUG */ } @@ -133,7 +150,7 @@ int main(int argc, char *argv[]) wpa_supplicant_fd_workaround(); for (;;) { - c = getopt(argc, argv, "b:Bc:C:D:df:g:hi:KLNp:P:qtuvW"); + c = getopt(argc, argv, "b:Bc:C:D:df:g:hi:KLNp:P:qstuvW"); if (c < 0) break; switch (c) { @@ -194,6 +211,11 @@ int main(int argc, char *argv[]) case 'q': params.wpa_debug_level++; break; +#ifdef CONFIG_DEBUG_SYSLOG + case 's': + params.wpa_debug_syslog++; + break; +#endif /* CONFIG_DEBUG_SYSLOG */ case 't': params.wpa_debug_timestamp++; break; Modified: head/contrib/wpa/wpa_supplicant/wpa_supplicant.c ============================================================================== --- head/contrib/wpa/wpa_supplicant/wpa_supplicant.c Mon Mar 2 02:23:47 2009 (r189261) +++ head/contrib/wpa/wpa_supplicant/wpa_supplicant.c Mon Mar 2 02:26:53 2009 (r189262) @@ -2016,6 +2016,8 @@ struct wpa_global * wpa_supplicant_init( return NULL; wpa_debug_open_file(params->wpa_debug_file_path); + if (params->wpa_debug_syslog) + wpa_debug_open_syslog(); ret = eap_peer_register_methods(); if (ret) { @@ -2166,5 +2168,6 @@ void wpa_supplicant_deinit(struct wpa_gl os_free(global->params.ctrl_interface); os_free(global); + wpa_debug_close_syslog(); wpa_debug_close_file(); } Modified: head/contrib/wpa/wpa_supplicant/wpa_supplicant_i.h ============================================================================== --- head/contrib/wpa/wpa_supplicant/wpa_supplicant_i.h Mon Mar 2 02:23:47 2009 (r189261) +++ head/contrib/wpa/wpa_supplicant/wpa_supplicant_i.h Mon Mar 2 02:26:53 2009 (r189262) @@ -156,6 +156,11 @@ struct wpa_params { * wpa_debug_file_path - Path of debug file or %NULL to use stdout */ const char *wpa_debug_file_path; + + /** + * wpa_debug_syslog - Enable log output through syslog + */ + const char *wpa_debug_syslog; }; /** From sam at FreeBSD.org Sun Mar 1 18:28:23 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 18:28:36 2009 Subject: svn commit: r189263 - in head/usr.sbin/wpa: . hostapd hostapd_cli wpa_cli wpa_supplicant Message-ID: <200903020228.n222SMD1061919@svn.freebsd.org> Author: sam Date: Mon Mar 2 02:28:22 2009 New Revision: 189263 URL: http://svn.freebsd.org/changeset/base/189263 Log: update to 0.6.8 Reviewed by: thompsa Modified: head/usr.sbin/wpa/Makefile.inc head/usr.sbin/wpa/hostapd/Makefile head/usr.sbin/wpa/hostapd/driver_freebsd.c head/usr.sbin/wpa/hostapd_cli/Makefile head/usr.sbin/wpa/wpa_cli/Makefile head/usr.sbin/wpa/wpa_supplicant/Makefile head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c head/usr.sbin/wpa/wpa_supplicant/driver_wired.c Modified: head/usr.sbin/wpa/Makefile.inc ============================================================================== --- head/usr.sbin/wpa/Makefile.inc Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/Makefile.inc Mon Mar 2 02:28:22 2009 (r189263) @@ -1,3 +1,27 @@ # $FreeBSD$ BINDIR?= /usr/sbin + +WPA_DISTDIR?= ${.CURDIR}/../../../contrib/wpa/ +WPA_SUPPLICANT_DISTDIR?=${WPA_DISTDIR}/wpa_supplicant +HOSTAPD_DISTDIR?= ${WPA_DISTDIR}/hostapd + +.PATH.c:${.CURDIR}/.. \ + ${WPA_DISTDIR}/src/common \ + ${WPA_DISTDIR}/src/crypto \ + ${WPA_DISTDIR}/src/eap_common \ + ${WPA_DISTDIR}/src/eapol_supp \ + ${WPA_DISTDIR}/src/l2_packet \ + ${WPA_DISTDIR}/src/utils + +CFLAGS+=-I${.CURDIR} +CFLAGS+=-I${WPA_DISTDIR}/src +CFLAGS+=-I${WPA_DISTDIR}/src/common +CFLAGS+=-I${WPA_DISTDIR}/src/crypto +CFLAGS+=-I${WPA_DISTDIR}/src/l2_packet +CFLAGS+=-I${WPA_DISTDIR}/src/utils + +CFLAGS+= -DCONFIG_CTRL_IFACE +CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX + +.include Modified: head/usr.sbin/wpa/hostapd/Makefile ============================================================================== --- head/usr.sbin/wpa/hostapd/Makefile Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/hostapd/Makefile Mon Mar 2 02:28:22 2009 (r189263) @@ -1,30 +1,32 @@ # $FreeBSD$ -.include +.include "${.CURDIR}/../Makefile.inc" -HOSTAPD_DISTDIR?= ${.CURDIR}/../../../contrib/hostapd -.PATH: ${.CURDIR}/.. ${HOSTAPD_DISTDIR} +.PATH.c:${HOSTAPD_DISTDIR} \ + ${WPA_DISTDIR}/src/eap_server \ + ${WPA_DISTDIR}/src/radius \ PROG= hostapd -SRCS= hostapd.c eloop.c ieee802_1x.c eapol_sm.c radius.c md5.c rc4.c \ - common.c ieee802_11.c config.c ieee802_11_auth.c accounting.c \ - sta_info.c radius_client.c sha1.c wpa.c aes_wrap.c ctrl_iface.c \ - driver_conf.c os_unix.c preauth.c pmksa_cache.c beacon.c \ - hw_features.c wme.c ap_list.c reconfig.c mlme.c \ - vlan_init.c ieee802_11h.c l2_packet.c driver_freebsd.c -CLEANFILES=driver_conf.c +SRCS= accounting.c aes.c aes_wrap.c ap_list.c beacon.c common.c \ + config.c ctrl_iface.c drivers.c eapol_sm.c eap.c eap_common.c \ + eap_identity.c eap_methods.c eloop.c hostapd.c \ + hw_features.c ieee802_11.c ieee802_11_common.c ieee802_11_auth.c \ + ieee802_1x.c ip_addr.c md5.c mlme.c pmksa_cache.c radius.c \ + radius_client.c rc4.c sha1.c sta_info.c vlan_init.c wme.c \ + wpa.c wpa_auth_ie.c wpa_common.c wpa_debug.c wpabuf.c +SRCS+= l2_packet.c driver_freebsd.c os_unix.c MAN= hostapd.8 hostapd.conf.5 .if ${MK_EXAMPLES} != "no" FILESDIR= ${SHAREDIR}/examples/hostapd +.PATH: ${HOSTAPD_DISTDIR} FILES= hostapd.conf hostapd.eap_user hostapd.wpa_psk .endif -CFLAGS+= -I${.CURDIR} -I${HOSTAPD_DISTDIR} +CFLAGS+= -I${HOSTAPD_DISTDIR} + CFLAGS+= -DCONFIG_DRIVER_BSD -CFLAGS+= -DCONFIG_CTRL_IFACE -CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX CFLAGS+= -DCONFIG_DRIVER_RADIUS_ACL .if ${MK_INET6} != "no" CFLAGS+= -DCONFIG_IPV6 @@ -34,21 +36,22 @@ DPADD+= ${LIBPCAP} LDADD+= -lpcap # User customizations for wpa_supplicant/hostapd build environment -CFLAGS+=${WPA_SUPPLICANT_CFLAGS} -#DPADD+=${WPA_SUPPLICANT_DPADD} -LDADD+=${WPA_SUPPLICANT_LDADD} -#LDFLAGS+=${WPA_SUPPLICANT_LDFLAGS} +CFLAGS+=${HOSTAPD_CFLAGS} +#DPADD+=${HOSTAPD_DPADD} +LDADD+=${HOSTAPD_LDADD} +#LDFLAGS+=${HOSTAPD_LDFLAGS} .if !empty(CFLAGS:M*-DEAP_SERVER) -SRCS+= eap.c eap_methods.c eap_identity.c +#SRCS+= eap.c eap_methods.c eap_identity.c .if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH) CFLAGS+=-DEAP_TLS -DEAP_PEAP -DEAP_MSCHAPv2 -DEAP_PSK \ - -DEAP_TLV -DEAP_TLS_FUNCS -DEAP_TLS_OPENSSL -SRCS+= eap_tls.c eap_peap.c eap_mschapv2.c \ + -DEAP_TLS_FUNCS -DEAP_TLS_OPENSSL +SRCS+= crypto_openssl.c +SRCS+= eap_tls.c eap_peap.c eap_peap_common.c eap_mschapv2.c \ eap_psk.c eap_psk_common.c \ - eap_tlv.c eap_tls_common.c tls_openssl.c ms_funcs.c crypto.c + eap_tls_common.c tls_openssl.c ms_funcs.c chap.c CFLAGS+=-DEAP_TTLS -DEAP_MD5 SRCS+= eap_ttls.c eap_md5.c @@ -108,19 +111,4 @@ CFLAGS+= -DINTERNAL_MD5 SRCS+= tls_none.c .endif -driver_conf.c: Makefile - rm -f driver_conf.c - echo '/* THIS FILE AUTOMATICALLY GENERATED, DO NOT EDIT! */' \ - > driver_conf.c - echo '#include ' >> driver_conf.c - echo '#include ' >> driver_conf.c - echo '#include ' >> driver_conf.c - echo '#include ' >> driver_conf.c - echo '#include "hostapd.h"' >> driver_conf.c - echo '#include "driver.h"' >> driver_conf.c - echo "void bsd_driver_register(void);" >> driver_conf.c - echo 'void register_drivers(void) {' >> driver_conf.c - echo "bsd_driver_register();" >> driver_conf.c - echo '}' >> driver_conf.c - .include Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c ============================================================================== --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Mon Mar 2 02:28:22 2009 (r189263) @@ -27,23 +27,27 @@ #include +#undef RSN_VERSION +#undef WPA_VERSION +#undef WPA_OUI_TYPE +#undef WME_OUI_TYPE + #include "hostapd.h" #include "driver.h" #include "ieee802_1x.h" #include "ieee802_11_auth.h" #include "eloop.h" #include "sta_info.h" -#include "l2_packet.h" +#include "l2_packet/l2_packet.h" #include "eapol_sm.h" #include "wpa.h" -#include "radius.h" +#include "radius/radius.h" #include "ieee802_11.h" #include "common.h" #include "hostap_common.h" struct bsd_driver_data { - struct driver_ops ops; /* base class */ struct hostapd_data *hapd; /* back pointer */ char iface[IFNAMSIZ + 1]; @@ -53,7 +57,7 @@ struct bsd_driver_data { int wext_sock; /* socket for wireless events */ }; -static const struct driver_ops bsd_driver_ops; +static const struct wpa_driver_ops bsd_driver_ops; static int bsd_sta_deauth(void *priv, const u8 *addr, int reason_code); @@ -129,7 +133,7 @@ bsd_set_iface_flags(void *priv, int flag struct hostapd_data *hapd = drv->hapd; struct ifreq ifr; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_VERBOSE, "%s: flags=0x%x\n", __func__, flags); + wpa_printf(MSG_DEBUG, "%s: flags=0x%x\n", __func__, flags); if (drv->ioctl_sock < 0) return -1; @@ -185,8 +189,7 @@ bsd_set_ieee8021x(const char *ifname, vo struct hostapd_data *hapd = drv->hapd; struct hostapd_bss_config *conf = hapd->conf; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_VERBOSE, - "%s: enabled=%d\n", __func__, enabled); + wpa_printf(MSG_DEBUG, "%s: enabled=%d\n", __func__, enabled); if (!enabled) { /* XXX restore state */ @@ -218,8 +221,7 @@ bsd_set_privacy(const char *ifname, void struct bsd_driver_data *drv = priv; struct hostapd_data *hapd = drv->hapd; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, - "%s: enabled=%d\n", __func__, enabled); + wpa_printf(MSG_DEBUG, "%s: enabled=%d\n", __func__, enabled); return set80211param(priv, IEEE80211_IOC_PRIVACY, enabled); } @@ -231,8 +233,7 @@ bsd_set_sta_authorized(void *priv, const struct hostapd_data *hapd = drv->hapd; struct ieee80211req_mlme mlme; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_VERBOSE, - "%s: addr=%s authorized=%d\n", + wpa_printf(MSG_DEBUG, "%s: addr=%s authorized=%d\n", __func__, ether_sprintf(addr), authorized); if (authorized) @@ -245,7 +246,8 @@ bsd_set_sta_authorized(void *priv, const } static int -bsd_sta_set_flags(void *priv, const u8 *addr, int flags_or, int flags_and) +bsd_sta_set_flags(void *priv, const u8 *addr, int total_flags, + int flags_or, int flags_and) { /* For now, only support setting Authorized flag */ if (flags_or & WLAN_STA_AUTHORIZED) @@ -262,8 +264,7 @@ bsd_del_key(void *priv, const unsigned c struct hostapd_data *hapd = drv->hapd; struct ieee80211req_del_key wk; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, - "%s: addr=%s key_idx=%d\n", + wpa_printf(MSG_DEBUG, "%s: addr=%s key_idx=%d\n", __func__, ether_sprintf(addr), key_idx); memset(&wk, 0, sizeof(wk)); @@ -290,8 +291,7 @@ bsd_set_key(const char *ifname, void *pr if (strcmp(alg, "none") == 0) return bsd_del_key(priv, addr, key_idx); - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, - "%s: alg=%s addr=%s key_idx=%d\n", + wpa_printf(MSG_DEBUG, "%s: alg=%s addr=%s key_idx=%d\n", __func__, alg, ether_sprintf(addr), key_idx); if (strcmp(alg, "WEP") == 0) @@ -339,8 +339,8 @@ bsd_get_seqnum(const char *ifname, void struct hostapd_data *hapd = drv->hapd; struct ieee80211req_key wk; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, - "%s: addr=%s idx=%d\n", __func__, ether_sprintf(addr), idx); + wpa_printf(MSG_DEBUG, "%s: addr=%s idx=%d\n", + __func__, ether_sprintf(addr), idx); memset(&wk, 0, sizeof(wk)); if (addr == NULL) @@ -396,8 +396,7 @@ bsd_sta_clear_stats(void *priv, const u8 struct hostapd_data *hapd = drv->hapd; struct ieee80211req_sta_stats stats; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, "%s: addr=%s\n", - __func__, ether_sprintf(addr)); + wpa_printf(MSG_DEBUG, "%s: addr=%s\n", __func__, ether_sprintf(addr)); /* zero station statistics */ memset(&stats, 0, sizeof(stats)); @@ -419,7 +418,7 @@ bsd_set_opt_ie(const char *ifname, void ireq.i_data = (void *) ie; ireq.i_len = ie_len; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, "%s: set WPA+RSN ie (len %d)\n", + wpa_printf(MSG_DEBUG, "%s: set WPA+RSN ie (len %d)\n", __func__, ie_len); if (ioctl(drv->ioctl_sock, SIOCS80211, &ireq) < 0) { printf("Unable to set WPA+RSN ie\n"); @@ -435,8 +434,7 @@ bsd_sta_deauth(void *priv, const u8 *add struct hostapd_data *hapd = drv->hapd; struct ieee80211req_mlme mlme; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, - "%s: addr=%s reason_code=%d\n", + wpa_printf(MSG_DEBUG, "%s: addr=%s reason_code=%d\n", __func__, ether_sprintf(addr), reason_code); mlme.im_op = IEEE80211_MLME_DEAUTH; @@ -452,8 +450,7 @@ bsd_sta_disassoc(void *priv, const u8 *a struct hostapd_data *hapd = drv->hapd; struct ieee80211req_mlme mlme; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, - "%s: addr=%s reason_code=%d\n", + wpa_printf(MSG_DEBUG, "%s: addr=%s reason_code=%d\n", __func__, ether_sprintf(addr), reason_code); mlme.im_reason = reason_code; @@ -521,7 +518,7 @@ bsd_new_sta(struct bsd_driver_data *drv, } ielen = 2 + ie.wpa_ie[1]; res = wpa_validate_wpa_ie(hapd->wpa_auth, sta->wpa_sm, - ie.wpa_ie, ielen); + ie.wpa_ie, ielen, NULL, 0); if (res != WPA_IE_OK) { printf("WPA/RSN information element rejected? " "(res %u)\n", res); @@ -742,8 +739,7 @@ bsd_get_ssid(const char *ifname, void *p struct hostapd_data *hapd = drv->hapd; int ssid_len = get80211var(priv, IEEE80211_IOC_SSID, buf, len); - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, "%s: ssid=\"%.*s\"\n", - __func__, ssid_len, buf); + wpa_printf(MSG_DEBUG, "%s: ssid=\"%.*s\"\n", __func__, ssid_len, buf); return ssid_len; } @@ -754,8 +750,7 @@ bsd_set_ssid(const char *ifname, void *p struct bsd_driver_data *drv = priv; struct hostapd_data *hapd = drv->hapd; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, "%s: ssid=\"%.*s\"\n", - __func__, len, buf); + wpa_printf(MSG_DEBUG, "%s: ssid=\"%.*s\"\n", __func__, len, buf); return set80211var(priv, IEEE80211_IOC_SSID, buf, len); } @@ -830,7 +825,7 @@ bsd_set_radius_acl_expire(void *priv, co } #endif /* CONFIG_DRIVER_RADIUS_ACL */ -static int +static void * bsd_init(struct hostapd_data *hapd) { struct bsd_driver_data *drv; @@ -842,7 +837,6 @@ bsd_init(struct hostapd_data *hapd) } memset(drv, 0, sizeof(*drv)); - drv->ops = bsd_driver_ops; drv->hapd = hapd; drv->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0); if (drv->ioctl_sock < 0) { @@ -872,8 +866,7 @@ bsd_init(struct hostapd_data *hapd) bsd_set_iface_flags(drv, -IFF_UP); /* mark down during setup */ - hapd->driver = &drv->ops; - return 0; + return drv; bad: if (drv != NULL) { if (drv->sock_xmit != NULL) @@ -882,7 +875,7 @@ bad: close(drv->ioctl_sock); free(drv); } - return -1; + return NULL; } @@ -891,8 +884,6 @@ bsd_deinit(void *priv) { struct bsd_driver_data *drv = priv; - drv->hapd->driver = NULL; - (void) bsd_set_iface_flags(drv, -IFF_UP); if (drv->ioctl_sock >= 0) close(drv->ioctl_sock); @@ -901,7 +892,7 @@ bsd_deinit(void *priv) free(drv); } -static const struct driver_ops bsd_driver_ops = { +const struct wpa_driver_ops wpa_driver_bsd_ops = { .name = "bsd", .init = bsd_init, .deinit = bsd_deinit, @@ -928,8 +919,3 @@ static const struct driver_ops bsd_drive .set_radius_acl_expire = bsd_set_radius_acl_expire, #endif }; - -void bsd_driver_register(void) -{ - driver_register(bsd_driver_ops.name, &bsd_driver_ops); -} Modified: head/usr.sbin/wpa/hostapd_cli/Makefile ============================================================================== --- head/usr.sbin/wpa/hostapd_cli/Makefile Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/hostapd_cli/Makefile Mon Mar 2 02:28:22 2009 (r189263) @@ -7,7 +7,7 @@ WPA_SUPPLICANT_DISTDIR?= ${CONTRIB}/wpa_ .PATH: ${HOSTAPD_DISTDIR} ${WPA_SUPPLICANT_DISTDIR} PROG= hostapd_cli -SRCS= hostapd_cli.c wpa_ctrl.c +SRCS= hostapd_cli.c wpa_ctrl.c os_unix.c CFLAGS+= -DCONFIG_CTRL_IFACE CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX Modified: head/usr.sbin/wpa/wpa_cli/Makefile ============================================================================== --- head/usr.sbin/wpa/wpa_cli/Makefile Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/wpa_cli/Makefile Mon Mar 2 02:28:22 2009 (r189263) @@ -11,4 +11,8 @@ MAN= wpa_cli.8 CFLAGS+= -DCONFIG_CTRL_IFACE CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX +#CFLAGS+= -DCONFIG_READLINE +#LDADD+= -ledit -ltermcap +#DPADD+= ${LIBEDIT} ${LIBTERMCAP} + .include Modified: head/usr.sbin/wpa/wpa_supplicant/Makefile ============================================================================== --- head/usr.sbin/wpa/wpa_supplicant/Makefile Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/wpa_supplicant/Makefile Mon Mar 2 02:28:22 2009 (r189263) @@ -1,14 +1,18 @@ # $FreeBSD$ -.include +.include "${.CURDIR}/../Makefile.inc" -WPA_SUPPLICANT_DISTDIR?= ${.CURDIR}/../../../contrib/wpa_supplicant -.PATH: ${.CURDIR}/.. ${WPA_SUPPLICANT_DISTDIR} +.PATH.c:${WPA_SUPPLICANT_DISTDIR} \ + ${WPA_DISTDIR}/src/drivers \ + ${WPA_DISTDIR}/src/eap_peer \ + ${WPA_DISTDIR}/src/rsn_supp PROG= wpa_supplicant -SRCS= config.c eloop.c common.c md5.c rc4.c sha1.c aes_wrap.c \ - wpa_supplicant.c events.c wpa.c preauth.c pmksa_cache.c \ - ctrl_iface.c ctrl_iface_unix.c l2_packet.c main.c drivers.c \ +SRCS= aes.c aes_wrap.c blacklist.c common.c config.c ctrl_iface.c \ + ctrl_iface_unix.c drivers.c eloop.c events.c l2_packet.c main.c \ + md5.c preauth.c pmksa_cache.c rc4.c scan.c scan_helpers.c sha1.c \ + wpa.c wpa_common.c wpa_debug.c wpa_ie.c wpa_supplicant.c \ + wpabuf.c wpas_glue.c \ driver_ndis.c Packet32.c \ driver_wired.c \ driver_freebsd.c os_unix.c @@ -17,15 +21,17 @@ MAN= wpa_supplicant.8 wpa_supplicant.con .if ${MK_EXAMPLES} != "no" FILESDIR= ${SHAREDIR}/examples/etc +.PATH: ${WPA_SUPPLICANT_DISTDIR} FILES= wpa_supplicant.conf .endif -CFLAGS+= -I${.CURDIR} -I${WPA_SUPPLICANT_DISTDIR} +CFLAGS+=-I${WPA_SUPPLICANT_DISTDIR} +CFLAGS+=-I${WPA_DISTDIR}/src/drivers +CFLAGS+=-I${WPA_DISTDIR}/src/rsn_supp + CFLAGS+= -DCONFIG_DRIVER_BSD CFLAGS+= -DCONFIG_DRIVER_NDIS CFLAGS+= -DCONFIG_DRIVER_WIRED -CFLAGS+= -DCONFIG_CTRL_IFACE -CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX CFLAGS+= -DCONFIG_TERMINATE_ONLASTIF CFLAGS+= -DCONFIG_DEBUG_SYSLOG CFLAGS+= -g @@ -43,15 +49,19 @@ LDADD+=${WPA_SUPPLICANT_LDADD} #LDFLAGS+=${WPA_SUPPLICANT_LDFLAGS} .if ${MK_WPA_SUPPLICANT_EAPOL} != "no" -SRCS+= eapol_sm.c eap.c eap_methods.c +SRCS+= eapol_supp_sm.c eap.c eap_common.c eap_methods.c CFLAGS+= -DIEEE8021X_EAPOL .if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH) CFLAGS+=-DEAP_TLS -DEAP_PEAP -DEAP_MSCHAPv2 -DEAP_LEAP -DEAP_PSK \ -DEAP_TLV -DEAP_TLS_FUNCS -DEAP_TLS_OPENSSL -SRCS+= eap_tls.c eap_peap.c eap_mschapv2.c eap_leap.c \ +SRCS+= chap.c crypto_openssl.c \ + eap_leap.c \ + eap_mschapv2.c \ + eap_peap.c eap_peap_common.c \ eap_psk.c eap_psk_common.c \ - eap_tlv.c eap_tls_common.c tls_openssl.c ms_funcs.c crypto.c + eap_tls.c eap_tls_common.c \ + mschapv2.c ms_funcs.c tls_openssl.c CFLAGS+=-DEAP_TTLS -DEAP_MD5 SRCS+= eap_ttls.c eap_md5.c Modified: head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c ============================================================================== --- head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c Mon Mar 2 02:28:22 2009 (r189263) @@ -24,9 +24,8 @@ #include "common.h" #include "driver.h" #include "eloop.h" -#include "wpa_supplicant.h" #include "l2_packet.h" -#include "wpa.h" /* XXX for RSN_INFO_ELEM */ +#include "ieee802_11_defs.h" #include #include @@ -424,7 +423,7 @@ wpa_driver_bsd_associate(void *priv, str if (params->wpa_ie_len && set80211param(drv, IEEE80211_IOC_WPA, - params->wpa_ie[0] == RSN_INFO_ELEM ? 2 : 1) < 0) + params->wpa_ie[0] == WLAN_EID_RSN ? 2 : 1) < 0) return -1; memset(&mlme, 0, sizeof(mlme)); Modified: head/usr.sbin/wpa/wpa_supplicant/driver_wired.c ============================================================================== --- head/usr.sbin/wpa/wpa_supplicant/driver_wired.c Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/wpa_supplicant/driver_wired.c Mon Mar 2 02:28:22 2009 (r189263) @@ -21,7 +21,7 @@ #include "common.h" #include "driver.h" -#include "wpa_supplicant.h" +#include "wpa.h" static const u8 pae_group_addr[ETH_ALEN] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x03 }; From sam at FreeBSD.org Sun Mar 1 18:29:18 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 18:29:24 2009 Subject: svn commit: r189264 - in head/contrib: hostapd wpa_supplicant Message-ID: <200903020229.n222TIAc061977@svn.freebsd.org> Author: sam Date: Mon Mar 2 02:29:17 2009 New Revision: 189264 URL: http://svn.freebsd.org/changeset/base/189264 Log: don't need these any more; we are now using a combined tree Deleted: head/contrib/hostapd/ head/contrib/wpa_supplicant/ From thompsa at FreeBSD.org Sun Mar 1 18:44:12 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Mar 1 18:44:19 2009 Subject: svn commit: r189265 - head/sys/dev/usb/serial Message-ID: <200903020244.n222iBk3062302@svn.freebsd.org> Author: thompsa Date: Mon Mar 2 02:44:10 2009 New Revision: 189265 URL: http://svn.freebsd.org/changeset/base/189265 Log: Move the serial drivers from Giant to using their own mutexs. Tested with: u3g, ubser, uplcom Modified: head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/serial/uark.c head/sys/dev/usb/serial/ubsa.c head/sys/dev/usb/serial/ubser.c head/sys/dev/usb/serial/uchcom.c head/sys/dev/usb/serial/ucycom.c head/sys/dev/usb/serial/ufoma.c head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/serial/ugensa.c head/sys/dev/usb/serial/uipaq.c head/sys/dev/usb/serial/ulpt.c head/sys/dev/usb/serial/umct.c head/sys/dev/usb/serial/umodem.c head/sys/dev/usb/serial/umoscom.c head/sys/dev/usb/serial/uplcom.c head/sys/dev/usb/serial/uslcom.c head/sys/dev/usb/serial/uvisor.c head/sys/dev/usb/serial/uvscom.c Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/u3g.c Mon Mar 2 02:44:10 2009 (r189265) @@ -90,6 +90,7 @@ struct u3g_softc { struct usb2_xfer *sc_xfer[U3G_MAXPORTS][U3G_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint8_t sc_lsr; /* local status register */ uint8_t sc_msr; /* U3G status register */ @@ -455,6 +456,7 @@ u3g_attach(device_t dev) u3g_config_tmp[n] = u3g_config[n]; device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "u3g", NULL, MTX_DEF); sc->sc_udev = uaa->device; @@ -488,7 +490,7 @@ u3g_attach(device_t dev) /* try to allocate a set of BULK endpoints */ error = usb2_transfer_setup(uaa->device, &x, sc->sc_xfer[m], u3g_config_tmp, U3G_N_TRANSFER, - &sc->sc_ucom[m], &Giant); + &sc->sc_ucom[m], &sc->sc_mtx); if (error) { /* next interface */ x++; @@ -502,8 +504,10 @@ u3g_attach(device_t dev) uaa->info.bIfaceIndex); /* set stall by default */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[m][U3G_BULK_WR]); usb2_transfer_set_stall(sc->sc_xfer[m][U3G_BULK_RD]); + mtx_unlock(&sc->sc_mtx); m++; /* found one port */ i++; /* next endpoint index */ @@ -512,7 +516,7 @@ u3g_attach(device_t dev) sc->sc_numports = m; error = usb2_com_attach(&sc->sc_super_ucom, sc->sc_ucom, - sc->sc_numports, sc, &u3g_callback, &Giant); + sc->sc_numports, sc, &u3g_callback, &sc->sc_mtx); if (error) { DPRINTF("usb2_com_attach failed\n"); goto detach; @@ -542,6 +546,7 @@ u3g_detach(device_t dev) for (m = 0; m != U3G_MAXPORTS; m++) usb2_transfer_unsetup(sc->sc_xfer[m], U3G_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/uark.c ============================================================================== --- head/sys/dev/usb/serial/uark.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uark.c Mon Mar 2 02:44:10 2009 (r189265) @@ -73,6 +73,7 @@ struct uark_softc { struct usb2_xfer *sc_xfer[UARK_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint8_t sc_msr; uint8_t sc_lsr; @@ -181,13 +182,14 @@ uark_attach(device_t dev) uint8_t iface_index; device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uark", NULL, MTX_DEF); sc->sc_udev = uaa->device; iface_index = UARK_IFACE_INDEX; error = usb2_transfer_setup (uaa->device, &iface_index, sc->sc_xfer, - uark_xfer_config, UARK_N_TRANSFER, sc, &Giant); + uark_xfer_config, UARK_N_TRANSFER, sc, &sc->sc_mtx); if (error) { device_printf(dev, "allocating control USB " @@ -195,11 +197,13 @@ uark_attach(device_t dev) goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UARK_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UARK_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uark_callback, &Giant); + &uark_callback, &sc->sc_mtx); if (error) { DPRINTF("usb2_com_attach failed\n"); goto detach; @@ -217,8 +221,8 @@ uark_detach(device_t dev) struct uark_softc *sc = device_get_softc(dev); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UARK_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/ubsa.c ============================================================================== --- head/sys/dev/usb/serial/ubsa.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/ubsa.c Mon Mar 2 02:44:10 2009 (r189265) @@ -153,6 +153,7 @@ struct ubsa_softc { struct usb2_xfer *sc_xfer[UBSA_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint8_t sc_iface_no; /* interface number */ uint8_t sc_iface_index; /* interface index */ @@ -289,24 +290,27 @@ ubsa_attach(device_t dev) DPRINTF("sc=%p\n", sc); device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "ubsa", NULL, MTX_DEF); sc->sc_udev = uaa->device; sc->sc_iface_no = uaa->info.bIfaceNum; sc->sc_iface_index = UBSA_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index, - sc->sc_xfer, ubsa_config, UBSA_N_TRANSFER, sc, &Giant); + sc->sc_xfer, ubsa_config, UBSA_N_TRANSFER, sc, &sc->sc_mtx); if (error) { DPRINTF("could not allocate all pipes\n"); goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UBSA_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UBSA_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &ubsa_callback, &Giant); + &ubsa_callback, &sc->sc_mtx); if (error) { DPRINTF("usb2_com_attach failed\n"); goto detach; @@ -326,8 +330,8 @@ ubsa_detach(device_t dev) DPRINTF("sc=%p\n", sc); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UBSA_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/ubser.c ============================================================================== --- head/sys/dev/usb/serial/ubser.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/ubser.c Mon Mar 2 02:44:10 2009 (r189265) @@ -122,6 +122,7 @@ struct ubser_softc { struct usb2_xfer *sc_xfer[UBSER_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint16_t sc_tx_size; @@ -227,6 +228,7 @@ ubser_attach(device_t dev) int error; device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "ubser", NULL, MTX_DEF); snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); @@ -258,7 +260,7 @@ ubser_attach(device_t dev) device_printf(dev, "found %i serials\n", sc->sc_numser); error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index, - sc->sc_xfer, ubser_config, UBSER_N_TRANSFER, sc, &Giant); + sc->sc_xfer, ubser_config, UBSER_N_TRANSFER, sc, &sc->sc_mtx); if (error) { goto detach; } @@ -275,18 +277,16 @@ ubser_attach(device_t dev) } error = usb2_com_attach(&sc->sc_super_ucom, sc->sc_ucom, - sc->sc_numser, sc, &ubser_callback, &Giant); + sc->sc_numser, sc, &ubser_callback, &sc->sc_mtx); if (error) { goto detach; } - mtx_lock(&Giant); + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_RD]); - usb2_transfer_start(sc->sc_xfer[UBSER_BULK_DT_RD]); - - mtx_unlock(&Giant); + mtx_unlock(&sc->sc_mtx); return (0); /* success */ @@ -303,8 +303,8 @@ ubser_detach(device_t dev) DPRINTF("\n"); usb2_com_detach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_numser); - usb2_transfer_unsetup(sc->sc_xfer, UBSER_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/uchcom.c ============================================================================== --- head/sys/dev/usb/serial/uchcom.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uchcom.c Mon Mar 2 02:44:10 2009 (r189265) @@ -158,6 +158,7 @@ struct uchcom_softc { struct usb2_xfer *sc_xfer[UCHCOM_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint8_t sc_dtr; /* local copy */ uint8_t sc_rts; /* local copy */ @@ -303,6 +304,7 @@ uchcom_attach(device_t dev) DPRINTFN(11, "\n"); device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uchcom", NULL, MTX_DEF); sc->sc_udev = uaa->device; @@ -318,7 +320,7 @@ uchcom_attach(device_t dev) iface_index = UCHCOM_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, uchcom_config_data, - UCHCOM_N_TRANSFER, sc, &Giant); + UCHCOM_N_TRANSFER, sc, &sc->sc_mtx); if (error) { DPRINTF("one or more missing USB endpoints, " @@ -338,11 +340,13 @@ uchcom_attach(device_t dev) sc->sc_rts = 1; /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uchcom_callback, &Giant); + &uchcom_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -361,8 +365,8 @@ uchcom_detach(device_t dev) DPRINTFN(11, "\n"); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UCHCOM_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/ucycom.c ============================================================================== --- head/sys/dev/usb/serial/ucycom.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/ucycom.c Mon Mar 2 02:44:10 2009 (r189265) @@ -71,6 +71,7 @@ struct ucycom_softc { struct usb2_device *sc_udev; struct usb2_xfer *sc_xfer[UCYCOM_N_TRANSFER]; + struct mtx sc_mtx; uint32_t sc_model; #define MODEL_CY7C63743 0x63743 @@ -204,6 +205,7 @@ ucycom_attach(device_t dev) sc->sc_udev = uaa->device; device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "ucycom", NULL, MTX_DEF); snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); @@ -250,14 +252,14 @@ ucycom_attach(device_t dev) iface_index = UCYCOM_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, ucycom_config, UCYCOM_N_TRANSFER, - sc, &Giant); + sc, &sc->sc_mtx); if (error) { device_printf(dev, "allocating USB " "transfers failed!\n"); goto detach; } error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &ucycom_callback, &Giant); + &ucycom_callback, &sc->sc_mtx); if (error) { goto detach; @@ -281,8 +283,8 @@ ucycom_detach(device_t dev) struct ucycom_softc *sc = device_get_softc(dev); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UCYCOM_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/ufoma.c ============================================================================== --- head/sys/dev/usb/serial/ufoma.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/ufoma.c Mon Mar 2 02:44:10 2009 (r189265) @@ -160,6 +160,7 @@ struct ufoma_softc { struct usb2_com_super_softc sc_super_ucom; struct usb2_com_softc sc_ucom; struct cv sc_cv; + struct mtx sc_mtx; struct usb2_xfer *sc_ctrl_xfer[UFOMA_CTRL_ENDPT_MAX]; struct usb2_xfer *sc_bulk_xfer[UFOMA_BULK_ENDPT_MAX]; @@ -365,6 +366,7 @@ ufoma_attach(device_t dev) sc->sc_dev = dev; sc->sc_unit = device_get_unit(dev); + mtx_init(&sc->sc_mtx, "ufoma", NULL, MTX_DEF); usb2_cv_init(&sc->sc_cv, "CWAIT"); device_set_usb2_desc(dev); @@ -383,7 +385,7 @@ ufoma_attach(device_t dev) error = usb2_transfer_setup(uaa->device, &sc->sc_ctrl_iface_index, sc->sc_ctrl_xfer, - ufoma_ctrl_config, UFOMA_CTRL_ENDPT_MAX, sc, &Giant); + ufoma_ctrl_config, UFOMA_CTRL_ENDPT_MAX, sc, &sc->sc_mtx); if (error) { device_printf(dev, "allocating control USB " @@ -424,11 +426,13 @@ ufoma_attach(device_t dev) sc->sc_modetoactivate = mad->bMode[0]; /* clear stall at first run, if any */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]); usb2_transfer_set_stall(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &ufoma_callback, &Giant); + &ufoma_callback, &sc->sc_mtx); if (error) { DPRINTF("usb2_com_attach failed\n"); goto detach; @@ -465,14 +469,13 @@ ufoma_detach(device_t dev) struct ufoma_softc *sc = device_get_softc(dev); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_ctrl_xfer, UFOMA_CTRL_ENDPT_MAX); - usb2_transfer_unsetup(sc->sc_bulk_xfer, UFOMA_BULK_ENDPT_MAX); if (sc->sc_modetable) { free(sc->sc_modetable, M_USBDEV); } + mtx_destroy(&sc->sc_mtx); usb2_cv_destroy(&sc->sc_cv); return (0); @@ -512,7 +515,7 @@ ufoma_cfg_link_state(struct ufoma_softc usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom, &req, sc->sc_modetable, 0, 1000); - error = usb2_cv_timedwait(&sc->sc_cv, &Giant, hz); + error = usb2_cv_timedwait(&sc->sc_cv, &sc->sc_mtx, hz); if (error) { DPRINTF("NO response\n"); @@ -534,7 +537,7 @@ ufoma_cfg_activate_state(struct ufoma_so usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom, &req, NULL, 0, 1000); - error = usb2_cv_timedwait(&sc->sc_cv, &Giant, + error = usb2_cv_timedwait(&sc->sc_cv, &sc->sc_mtx, (UFOMA_MAX_TIMEOUT * hz)); if (error) { DPRINTF("No response\n"); @@ -1035,7 +1038,7 @@ ufoma_modem_setup(device_t dev, struct u error = usb2_transfer_setup(uaa->device, &sc->sc_data_iface_index, sc->sc_bulk_xfer, - ufoma_bulk_config, UFOMA_BULK_ENDPT_MAX, sc, &Giant); + ufoma_bulk_config, UFOMA_BULK_ENDPT_MAX, sc, &sc->sc_mtx); if (error) { device_printf(dev, "allocating BULK USB " Modified: head/sys/dev/usb/serial/uftdi.c ============================================================================== --- head/sys/dev/usb/serial/uftdi.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uftdi.c Mon Mar 2 02:44:10 2009 (r189265) @@ -96,6 +96,7 @@ struct uftdi_softc { struct usb2_device *sc_udev; struct usb2_xfer *sc_xfer[UFTDI_N_TRANSFER]; device_t sc_dev; + struct mtx sc_mtx; uint32_t sc_unit; enum uftdi_type sc_type; @@ -259,6 +260,7 @@ uftdi_attach(device_t dev) sc->sc_unit = device_get_unit(dev); device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uftdi", NULL, MTX_DEF); snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); @@ -280,7 +282,7 @@ uftdi_attach(device_t dev) error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index, sc->sc_xfer, uftdi_config, - UFTDI_N_TRANSFER, sc, &Giant); + UFTDI_N_TRANSFER, sc, &sc->sc_mtx); if (error) { device_printf(dev, "allocating USB " @@ -290,8 +292,10 @@ uftdi_attach(device_t dev) sc->sc_ucom.sc_portno = FTDI_PIT_SIOA + uaa->info.bIfaceNum; /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); /* set a valid "lcr" value */ @@ -301,7 +305,7 @@ uftdi_attach(device_t dev) FTDI_SIO_SET_DATA_BITS(8)); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uftdi_callback, &Giant); + &uftdi_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -318,8 +322,8 @@ uftdi_detach(device_t dev) struct uftdi_softc *sc = device_get_softc(dev); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UFTDI_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/ugensa.c ============================================================================== --- head/sys/dev/usb/serial/ugensa.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/ugensa.c Mon Mar 2 02:44:10 2009 (r189265) @@ -221,8 +221,10 @@ ugensa_attach(device_t dev) goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_WR]); usb2_transfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); /* initialize port number */ ssc->sc_usb2_com_ptr->sc_portno = sc->sc_niface; Modified: head/sys/dev/usb/serial/uipaq.c ============================================================================== --- head/sys/dev/usb/serial/uipaq.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uipaq.c Mon Mar 2 02:44:10 2009 (r189265) @@ -86,6 +86,7 @@ struct uipaq_softc { struct usb2_xfer *sc_xfer[UIPAQ_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint16_t sc_line; @@ -1102,6 +1103,7 @@ uipaq_attach(device_t dev) sc->sc_udev = uaa->device; device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uipaq", NULL, MTX_DEF); /* * Send magic bytes, cribbed from Linux ipaq driver that @@ -1125,17 +1127,19 @@ uipaq_attach(device_t dev) iface_index = UIPAQ_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, uipaq_config_data, - UIPAQ_N_TRANSFER, sc, &Giant); + UIPAQ_N_TRANSFER, sc, &sc->sc_mtx); if (error) { goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uipaq_callback, &Giant); + &uipaq_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -1152,8 +1156,8 @@ uipaq_detach(device_t dev) struct uipaq_softc *sc = device_get_softc(dev); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UIPAQ_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/ulpt.c ============================================================================== --- head/sys/dev/usb/serial/ulpt.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/ulpt.c Mon Mar 2 02:44:10 2009 (r189265) @@ -636,9 +636,7 @@ ulpt_detach(device_t dev) mtx_unlock(&sc->sc_mtx); usb2_transfer_unsetup(sc->sc_xfer, ULPT_N_TRANSFER); - usb2_callout_drain(&sc->sc_watchdog); - mtx_destroy(&sc->sc_mtx); return (0); Modified: head/sys/dev/usb/serial/umct.c ============================================================================== --- head/sys/dev/usb/serial/umct.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/umct.c Mon Mar 2 02:44:10 2009 (r189265) @@ -93,6 +93,7 @@ struct umct_softc { struct usb2_device *sc_udev; struct usb2_xfer *sc_xfer[UMCT_N_TRANSFER]; + struct mtx sc_mtx; uint32_t sc_unit; @@ -233,6 +234,7 @@ umct_attach(device_t dev) sc->sc_unit = device_get_unit(dev); device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "umct", NULL, MTX_DEF); snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); @@ -241,7 +243,7 @@ umct_attach(device_t dev) iface_index = UMCT_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &iface_index, - sc->sc_xfer, umct_config, UMCT_N_TRANSFER, sc, &Giant); + sc->sc_xfer, umct_config, UMCT_N_TRANSFER, sc, &sc->sc_mtx); if (error) { device_printf(dev, "allocating USB " @@ -274,7 +276,7 @@ umct_attach(device_t dev) } } error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &umct_callback, &Giant); + &umct_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -291,8 +293,8 @@ umct_detach(device_t dev) struct umct_softc *sc = device_get_softc(dev); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UMCT_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/umodem.c ============================================================================== --- head/sys/dev/usb/serial/umodem.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/umodem.c Mon Mar 2 02:44:10 2009 (r189265) @@ -142,6 +142,7 @@ struct umodem_softc { struct usb2_xfer *sc_xfer[UMODEM_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint16_t sc_line; @@ -288,6 +289,7 @@ umodem_attach(device_t dev) int error; device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "umodem", NULL, MTX_DEF); sc->sc_ctrl_iface_no = uaa->info.bIfaceNum; sc->sc_iface_index[1] = uaa->info.bIfaceIndex; @@ -348,17 +350,19 @@ umodem_attach(device_t dev) error = usb2_transfer_setup(uaa->device, sc->sc_iface_index, sc->sc_xfer, umodem_config, UMODEM_N_TRANSFER, - sc, &Giant); + sc, &sc->sc_mtx); if (error) { goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UMODEM_BULK_WR]); usb2_transfer_set_stall(sc->sc_xfer[UMODEM_BULK_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &umodem_callback, &Giant); + &umodem_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -781,8 +785,8 @@ umodem_detach(device_t dev) DPRINTF("sc=%p\n", sc); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UMODEM_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/umoscom.c ============================================================================== --- head/sys/dev/usb/serial/umoscom.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/umoscom.c Mon Mar 2 02:44:10 2009 (r189265) @@ -166,6 +166,7 @@ struct umoscom_softc { struct usb2_xfer *sc_xfer[UMOSCOM_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint8_t sc_mcr; uint8_t sc_lcr; @@ -300,20 +301,24 @@ umoscom_attach(device_t dev) device_set_desc(dev, "MOSCHIP USB Serial Port Adapter"); device_printf(dev, "\n"); + mtx_init(&sc->sc_mtx, "umoscom", NULL, MTX_DEF); + iface_index = UMOSCOM_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, umoscom_config_data, - UMOSCOM_N_TRANSFER, sc, &Giant); + UMOSCOM_N_TRANSFER, sc, &sc->sc_mtx); if (error) { goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UMOSCOM_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UMOSCOM_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &umoscom_callback, &Giant); + &umoscom_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -330,13 +335,9 @@ umoscom_detach(device_t dev) { struct umoscom_softc *sc = device_get_softc(dev); - mtx_lock(&Giant); - - mtx_unlock(&Giant); - usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UMOSCOM_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/uplcom.c ============================================================================== --- head/sys/dev/usb/serial/uplcom.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uplcom.c Mon Mar 2 02:44:10 2009 (r189265) @@ -145,6 +145,7 @@ struct uplcom_softc { struct usb2_xfer *sc_xfer[UPLCOM_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint16_t sc_line; @@ -326,6 +327,7 @@ uplcom_attach(device_t dev) DPRINTFN(11, "\n"); device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uplcom", NULL, MTX_DEF); DPRINTF("sc = %p\n", sc); @@ -370,7 +372,7 @@ uplcom_attach(device_t dev) error = usb2_transfer_setup(uaa->device, sc->sc_iface_index, sc->sc_xfer, uplcom_config_data, - UPLCOM_N_TRANSFER, sc, &Giant); + UPLCOM_N_TRANSFER, sc, &sc->sc_mtx); if (error) { DPRINTF("one or more missing USB endpoints, " "error=%s\n", usb2_errstr(error)); @@ -383,11 +385,13 @@ uplcom_attach(device_t dev) goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uplcom_callback, &Giant); + &uplcom_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -416,8 +420,8 @@ uplcom_detach(device_t dev) DPRINTF("sc=%p\n", sc); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UPLCOM_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/uslcom.c ============================================================================== --- head/sys/dev/usb/serial/uslcom.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uslcom.c Mon Mar 2 02:44:10 2009 (r189265) @@ -96,6 +96,7 @@ struct uslcom_softc { struct usb2_xfer *sc_xfer[USLCOM_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint8_t sc_msr; uint8_t sc_lsr; @@ -227,23 +228,26 @@ uslcom_attach(device_t dev) DPRINTFN(11, "\n"); device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uslcom", NULL, MTX_DEF); sc->sc_udev = uaa->device; error = usb2_transfer_setup(uaa->device, &uaa->info.bIfaceIndex, sc->sc_xfer, uslcom_config, - USLCOM_N_TRANSFER, sc, &Giant); + USLCOM_N_TRANSFER, sc, &sc->sc_mtx); if (error) { DPRINTF("one or more missing USB endpoints, " "error=%s\n", usb2_errstr(error)); goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uslcom_callback, &Giant); + &uslcom_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -262,8 +266,8 @@ uslcom_detach(device_t dev) DPRINTF("sc=%p\n", sc); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, USLCOM_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/uvisor.c ============================================================================== --- head/sys/dev/usb/serial/uvisor.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uvisor.c Mon Mar 2 02:44:10 2009 (r189265) @@ -160,6 +160,7 @@ struct uvisor_softc { struct usb2_xfer *sc_xfer[UVISOR_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint16_t sc_flag; #define UVISOR_FLAG_PALM4 0x0001 @@ -297,6 +298,8 @@ uvisor_attach(device_t dev) sizeof(uvisor_config_copy)); device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uvisor", NULL, MTX_DEF); + sc->sc_udev = uaa->device; /* configure the device */ @@ -314,17 +317,19 @@ uvisor_attach(device_t dev) } error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index, sc->sc_xfer, uvisor_config_copy, UVISOR_N_TRANSFER, - sc, &Giant); + sc, &sc->sc_mtx); if (error) { DPRINTF("could not allocate all pipes\n"); goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UVISOR_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UVISOR_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uvisor_callback, &Giant); + &uvisor_callback, &sc->sc_mtx); if (error) { DPRINTF("usb2_com_attach failed\n"); goto detach; @@ -344,8 +349,8 @@ uvisor_detach(device_t dev) DPRINTF("sc=%p\n", sc); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UVISOR_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/uvscom.c ============================================================================== --- head/sys/dev/usb/serial/uvscom.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uvscom.c Mon Mar 2 02:44:10 2009 (r189265) @@ -135,6 +135,7 @@ struct uvscom_softc { struct usb2_xfer *sc_xfer[UVSCOM_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint16_t sc_line; /* line control register */ @@ -276,6 +277,7 @@ uvscom_attach(device_t dev) int error; device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uvscom", NULL, MTX_DEF); sc->sc_udev = uaa->device; @@ -285,7 +287,7 @@ uvscom_attach(device_t dev) sc->sc_iface_index = UVSCOM_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index, - sc->sc_xfer, uvscom_config, UVSCOM_N_TRANSFER, sc, &Giant); + sc->sc_xfer, uvscom_config, UVSCOM_N_TRANSFER, sc, &sc->sc_mtx); if (error) { DPRINTF("could not allocate all USB transfers!\n"); @@ -294,18 +296,20 @@ uvscom_attach(device_t dev) sc->sc_line = UVSCOM_LINE_INIT; /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UVSCOM_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UVSCOM_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uvscom_callback, &Giant); + &uvscom_callback, &sc->sc_mtx); if (error) { goto detach; } /* start interrupt pipe */ - mtx_lock(&Giant); + mtx_lock(&sc->sc_mtx); usb2_transfer_start(sc->sc_xfer[UVSCOM_INTR_DT_RD]); - mtx_unlock(&Giant); + mtx_unlock(&sc->sc_mtx); return (0); @@ -323,12 +327,12 @@ uvscom_detach(device_t dev) /* stop interrupt pipe */ - if (sc->sc_xfer[UVSCOM_INTR_DT_RD]) { + if (sc->sc_xfer[UVSCOM_INTR_DT_RD]) usb2_transfer_stop(sc->sc_xfer[UVSCOM_INTR_DT_RD]); - } - usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); + usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); usb2_transfer_unsetup(sc->sc_xfer, UVSCOM_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } From sam at FreeBSD.org Sun Mar 1 18:51:53 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 18:52:05 2009 Subject: svn commit: r189266 - head/contrib/wpa Message-ID: <200903020251.n222prIM062575@svn.freebsd.org> Author: sam Date: Mon Mar 2 02:51:52 2009 New Revision: 189266 URL: http://svn.freebsd.org/changeset/base/189266 Log: bring along mergeinfo Submitted by: mlaier Modified: head/contrib/wpa/ (props changed) From cy at FreeBSD.org Sun Mar 1 19:08:47 2009 From: cy at FreeBSD.org (Cy Schubert) Date: Sun Mar 1 19:08:59 2009 Subject: svn commit: r189267 - head/sbin/dump Message-ID: <200903020308.n2238kpb063385@svn.freebsd.org> Author: cy (ports committer) Date: Mon Mar 2 03:08:46 2009 New Revision: 189267 URL: http://svn.freebsd.org/changeset/base/189267 Log: Verify that the filesystem being referenced in fstab is indeed a UFS filesystem. This avoids confusion with nullfs and unionfs filesystems which reference the root of a UFS filesystem as a target. PR: 116849 Approved by: kib Modified: head/sbin/dump/optr.c Modified: head/sbin/dump/optr.c ============================================================================== --- head/sbin/dump/optr.c Mon Mar 2 02:51:52 2009 (r189266) +++ head/sbin/dump/optr.c Mon Mar 2 03:08:46 2009 (r189267) @@ -318,9 +318,10 @@ dump_getfstab(void) return; } while ((fs = getfsent()) != NULL) { - if (strcmp(fs->fs_type, FSTAB_RW) && + if ((strcmp(fs->fs_type, FSTAB_RW) && strcmp(fs->fs_type, FSTAB_RO) && - strcmp(fs->fs_type, FSTAB_RQ)) + strcmp(fs->fs_type, FSTAB_RQ)) || + strcmp(fs->fs_vfstype, "ufs")) continue; fs = allocfsent(fs); if ((pf = (struct pfstab *)malloc(sizeof (*pf))) == NULL) From das at FreeBSD.org Sun Mar 1 20:07:59 2009 From: das at FreeBSD.org (David Schultz) Date: Sun Mar 1 20:08:05 2009 Subject: svn commit: r189268 - head/lib/libc/stdio Message-ID: <200903020407.n2247wwk064644@svn.freebsd.org> Author: das Date: Mon Mar 2 04:07:58 2009 New Revision: 189268 URL: http://svn.freebsd.org/changeset/base/189268 Log: The argument corresponding to %zn is supposed to be an ssize_t *, not a size_t *, although the distinction is moot in practice. Modified: head/lib/libc/stdio/printf-pos.c head/lib/libc/stdio/printflocal.h Modified: head/lib/libc/stdio/printf-pos.c ============================================================================== --- head/lib/libc/stdio/printf-pos.c Mon Mar 2 03:08:46 2009 (r189267) +++ head/lib/libc/stdio/printf-pos.c Mon Mar 2 04:07:58 2009 (r189268) @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); enum typeid { T_UNUSED, TP_SHORT, T_INT, T_U_INT, TP_INT, T_LONG, T_U_LONG, TP_LONG, T_LLONG, T_U_LLONG, TP_LLONG, - T_PTRDIFFT, TP_PTRDIFFT, T_SSIZET, T_SIZET, TP_SIZET, + T_PTRDIFFT, TP_PTRDIFFT, T_SSIZET, T_SIZET, TP_SSIZET, T_INTMAXT, T_UINTMAXT, TP_INTMAXT, TP_VOID, TP_CHAR, TP_SCHAR, T_DOUBLE, T_LONG_DOUBLE, T_WINT, TP_WCHAR }; @@ -374,7 +374,7 @@ reswitch: switch (ch) { else if (flags & PTRDIFFT) error = addtype(&types, TP_PTRDIFFT); else if (flags & SIZET) - error = addtype(&types, TP_SIZET); + error = addtype(&types, TP_SSIZET); else if (flags & LLONGINT) error = addtype(&types, TP_LLONG); else if (flags & LONGINT) @@ -565,7 +565,7 @@ reswitch: switch (ch) { else if (flags & PTRDIFFT) error = addtype(&types, TP_PTRDIFFT); else if (flags & SIZET) - error = addtype(&types, TP_SIZET); + error = addtype(&types, TP_SSIZET); else if (flags & LLONGINT) error = addtype(&types, TP_LLONG); else if (flags & LONGINT) @@ -719,8 +719,8 @@ build_arg_table(struct typetable *types, case T_SSIZET: (*argtable) [n].sizearg = va_arg (ap, ssize_t); break; - case TP_SIZET: - (*argtable) [n].psizearg = va_arg (ap, size_t *); + case TP_SSIZET: + (*argtable) [n].pssizearg = va_arg (ap, ssize_t *); break; case T_INTMAXT: (*argtable) [n].intmaxarg = va_arg (ap, intmax_t); Modified: head/lib/libc/stdio/printflocal.h ============================================================================== --- head/lib/libc/stdio/printflocal.h Mon Mar 2 03:08:46 2009 (r189267) +++ head/lib/libc/stdio/printflocal.h Mon Mar 2 04:07:58 2009 (r189268) @@ -79,7 +79,7 @@ union arg { long *plongarg; long long *plonglongarg; ptrdiff_t *pptrdiffarg; - size_t *psizearg; + ssize_t *pssizearg; intmax_t *pintmaxarg; #ifndef NO_FLOATING_POINT double doublearg; From sam at FreeBSD.org Sun Mar 1 20:10:41 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 20:10:47 2009 Subject: svn commit: r189269 - head/usr.sbin/wpa/wpa_cli Message-ID: <200903020410.n224AfHf064730@svn.freebsd.org> Author: sam Date: Mon Mar 2 04:10:40 2009 New Revision: 189269 URL: http://svn.freebsd.org/changeset/base/189269 Log: update for 0.6.8 Modified: head/usr.sbin/wpa/wpa_cli/Makefile Modified: head/usr.sbin/wpa/wpa_cli/Makefile ============================================================================== --- head/usr.sbin/wpa/wpa_cli/Makefile Mon Mar 2 04:07:58 2009 (r189268) +++ head/usr.sbin/wpa/wpa_cli/Makefile Mon Mar 2 04:10:40 2009 (r189269) @@ -1,7 +1,8 @@ # $FreeBSD$ -WPA_SUPPLICANT_DISTDIR?= ${.CURDIR}/../../../contrib/wpa_supplicant -.PATH: ${WPA_SUPPLICANT_DISTDIR} +.include "${.CURDIR}/../Makefile.inc" + +.PATH.c:${WPA_SUPPLICANT_DISTDIR} PROG= wpa_cli SRCS= wpa_cli.c wpa_ctrl.c os_unix.c From sam at FreeBSD.org Sun Mar 1 20:11:36 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 20:11:53 2009 Subject: svn commit: r189270 - head/usr.sbin/wpa/hostapd_cli Message-ID: <200903020411.n224BYo7064795@svn.freebsd.org> Author: sam Date: Mon Mar 2 04:11:34 2009 New Revision: 189270 URL: http://svn.freebsd.org/changeset/base/189270 Log: update for 0.6.8 Modified: head/usr.sbin/wpa/hostapd_cli/Makefile Modified: head/usr.sbin/wpa/hostapd_cli/Makefile ============================================================================== --- head/usr.sbin/wpa/hostapd_cli/Makefile Mon Mar 2 04:10:40 2009 (r189269) +++ head/usr.sbin/wpa/hostapd_cli/Makefile Mon Mar 2 04:11:34 2009 (r189270) @@ -1,10 +1,8 @@ # $FreeBSD$ -CONTRIB= ${.CURDIR}/../../../contrib -HOSTAPD_DISTDIR?= ${CONTRIB}/hostapd -WPA_SUPPLICANT_DISTDIR?= ${CONTRIB}/wpa_supplicant +.include "${.CURDIR}/../Makefile.inc" -.PATH: ${HOSTAPD_DISTDIR} ${WPA_SUPPLICANT_DISTDIR} +.PATH.c:${HOSTAPD_DISTDIR} PROG= hostapd_cli SRCS= hostapd_cli.c wpa_ctrl.c os_unix.c From das at FreeBSD.org Sun Mar 1 20:11:43 2009 From: das at FreeBSD.org (David Schultz) Date: Sun Mar 1 20:11:53 2009 Subject: svn commit: r189271 - head/lib/libc/stdio Message-ID: <200903020411.n224BgXF064833@svn.freebsd.org> Author: das Date: Mon Mar 2 04:11:42 2009 New Revision: 189271 URL: http://svn.freebsd.org/changeset/base/189271 Log: Rewrite asprintf() as a wrapper around vasprintf(), thus reducing the number of functions that have an incestuous relationship with the arcane innards of stdio. Replaced: head/lib/libc/stdio/asprintf.c (contents, props changed) - copied, changed from r189249, head/lib/libc/stdio/printf.c Copied and modified: head/lib/libc/stdio/asprintf.c (from r189249, head/lib/libc/stdio/printf.c) ============================================================================== --- head/lib/libc/stdio/printf.c Sun Mar 1 19:25:40 2009 (r189249, copy source) +++ head/lib/libc/stdio/asprintf.c Mon Mar 2 04:11:42 2009 (r189271) @@ -30,9 +30,6 @@ * SUCH DAMAGE. */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)printf.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ #include __FBSDID("$FreeBSD$"); @@ -40,13 +37,13 @@ __FBSDID("$FreeBSD$"); #include int -printf(char const * __restrict fmt, ...) +asprintf(char ** __restrict s, char const * __restrict fmt, ...) { int ret; va_list ap; va_start(ap, fmt); - ret = vfprintf(stdout, fmt, ap); + ret = vasprintf(s, fmt, ap); va_end(ap); return (ret); } From sam at FreeBSD.org Sun Mar 1 20:12:42 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 20:12:48 2009 Subject: svn commit: r189272 - head/usr.sbin/wpa/wpa_passphrase Message-ID: <200903020412.n224Cfug064886@svn.freebsd.org> Author: sam Date: Mon Mar 2 04:12:41 2009 New Revision: 189272 URL: http://svn.freebsd.org/changeset/base/189272 Log: uupdate for 0.6.8 Modified: head/usr.sbin/wpa/wpa_passphrase/Makefile Modified: head/usr.sbin/wpa/wpa_passphrase/Makefile ============================================================================== --- head/usr.sbin/wpa/wpa_passphrase/Makefile Mon Mar 2 04:11:42 2009 (r189271) +++ head/usr.sbin/wpa/wpa_passphrase/Makefile Mon Mar 2 04:12:41 2009 (r189272) @@ -1,7 +1,8 @@ # $FreeBSD$ -WPA_SUPPLICANT_DISTDIR?= ${.CURDIR}/../../../contrib/wpa_supplicant -.PATH: ${WPA_SUPPLICANT_DISTDIR} +.include "${.CURDIR}/../Makefile.inc" + +.PATH.c:${WPA_SUPPLICANT_DISTDIR} PROG= wpa_passphrase SRCS= wpa_passphrase.c sha1.c md5.c From marcel at FreeBSD.org Sun Mar 1 20:35:55 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Sun Mar 1 20:36:06 2009 Subject: svn commit: r189273 - head/usr.sbin/boot0cfg Message-ID: <200903020435.n224Zq5w065321@svn.freebsd.org> Author: marcel Date: Mon Mar 2 04:35:52 2009 New Revision: 189273 URL: http://svn.freebsd.org/changeset/base/189273 Log: Write the MBR by using the bootcode verb of the gpart class. The "write MBR" verb is kept for backward compatibility, but the DIOCSMBR ioctl has been removed. Modified: head/usr.sbin/boot0cfg/boot0cfg.c Modified: head/usr.sbin/boot0cfg/boot0cfg.c ============================================================================== --- head/usr.sbin/boot0cfg/boot0cfg.c Mon Mar 2 04:12:41 2009 (r189272) +++ head/usr.sbin/boot0cfg/boot0cfg.c Mon Mar 2 04:35:52 2009 (r189273) @@ -343,9 +343,8 @@ read_mbr(const char *disk, u_int8_t **mb static void write_mbr(const char *fname, int flags, u_int8_t *mbr, int mbr_size) { - int fd, p; + int fd; ssize_t n; - char *s; const char *errmsg; char *pname; struct gctl_req *grq; @@ -359,6 +358,13 @@ write_mbr(const char *fname, int flags, return; } + /* + * If we're called to write to a backup file, don't try to + * write through GEOM. It only generates additional errors. + */ + if (flags != 0) + return; + /* Try open it read only. */ fd = open(fname, O_RDONLY); if (fd == -1) { @@ -370,39 +376,28 @@ write_mbr(const char *fname, int flags, warn("error getting providername for %s", fname); return; } - if (flags != 0) - err(1, "%s", fname); + grq = gctl_get_handle(); + gctl_ro_param(grq, "class", -1, "PART"); + gctl_ro_param(grq, "geom", -1, pname); + gctl_ro_param(grq, "verb", -1, "bootcode"); + gctl_ro_param(grq, "bootcode", mbr_size, mbr); + gctl_ro_param(grq, "flags", -1, "C"); + errmsg = gctl_issue(grq); + if (errmsg == NULL) + goto out; + grq = gctl_get_handle(); gctl_ro_param(grq, "verb", -1, "write MBR"); gctl_ro_param(grq, "class", -1, "MBR"); gctl_ro_param(grq, "geom", -1, pname); gctl_ro_param(grq, "data", mbr_size, mbr); errmsg = gctl_issue(grq); - if (errmsg == NULL) { - free(pname); - return; - } - warnx("%s: %s", fname, pname); + if (errmsg != NULL) + err(1, "write_mbr: %s", fname); + +out: free(pname); gctl_free(grq); - -#ifdef DIOCSMBR - for (p = 1; p < 5; p++) { - asprintf(&s, "%ss%d", fname, p); - fd = open(s, O_RDONLY); - if (fd < 0) { - free(s); - continue; - } - n = ioctl(fd, DIOCSMBR, (mbr)); - if (n != 0) - err(1, "%s: ioctl DIOCSMBR", fname); - close(fd); - free(s); - return; - } -#endif - err(1, "write_mbr: %s", fname); } /* From sam at FreeBSD.org Sun Mar 1 21:07:07 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Mar 1 21:07:13 2009 Subject: svn commit: r189274 - head/tools/tools/ath/athstats Message-ID: <200903020507.n22575fI065886@svn.freebsd.org> Author: sam Date: Mon Mar 2 05:07:05 2009 New Revision: 189274 URL: http://svn.freebsd.org/changeset/base/189274 Log: add -b option to suppress the banner Modified: head/tools/tools/ath/athstats/main.c Modified: head/tools/tools/ath/athstats/main.c ============================================================================== --- head/tools/tools/ath/athstats/main.c Mon Mar 2 04:35:52 2009 (r189273) +++ head/tools/tools/ath/athstats/main.c Mon Mar 2 05:07:05 2009 (r189274) @@ -33,7 +33,7 @@ * Simple Atheros-specific tool to inspect and monitor network traffic * statistics. * - * athstats [-i interface] [-z] [-l] [-o fmtstring] [interval] + * athstats [-i interface] [-bz] [-l] [-o fmtstring] [interval] * * (default interface is ath0). If interval is specified a rolling output * a la netstat -i is displayed every interval seconds. The format of @@ -89,14 +89,17 @@ main(int argc, char *argv[]) { struct athstatfoo *wf; const char *ifname; - int c; + int c, banner = 1; ifname = getenv("ATH"); if (ifname == NULL) ifname = "ath0"; wf = athstats_new(ifname, getfmt("default")); - while ((c = getopt(argc, argv, "i:lo:z")) != -1) { + while ((c = getopt(argc, argv, "bi:lo:z")) != -1) { switch (c) { + case 'b': + banner = 0; + break; case 'i': wf->setifname(wf, optarg); break; @@ -127,7 +130,8 @@ main(int argc, char *argv[]) signalled = 0; alarm(interval); banner: - wf->print_header(wf, stdout); + if (banner) + wf->print_header(wf, stdout); line = 0; loop: if (line != 0) { From thompsa at FreeBSD.org Sun Mar 1 21:37:08 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Mar 1 21:37:15 2009 Subject: svn commit: r189275 - in head/sys/dev: ata sound/usb usb usb/bluetooth usb/image usb/input usb/misc usb/net usb/serial usb/storage usb/wlan Message-ID: <200903020537.n225b6QS066433@svn.freebsd.org> Author: thompsa Date: Mon Mar 2 05:37:05 2009 New Revision: 189275 URL: http://svn.freebsd.org/changeset/base/189275 Log: Rename the ushub device class back to uhub as it was in the old usb stack, moused(8) looks for "uhub/ums" to decide if needs to load the module. Reported by: Garrett Cooper Modified: head/sys/dev/ata/ata-usb.c head/sys/dev/sound/usb/uaudio.c head/sys/dev/usb/bluetooth/ng_ubt.c head/sys/dev/usb/bluetooth/ubtbcmfw.c head/sys/dev/usb/image/uscanner.c head/sys/dev/usb/input/uhid.c head/sys/dev/usb/input/ukbd.c head/sys/dev/usb/input/ums.c head/sys/dev/usb/misc/udbp.c head/sys/dev/usb/misc/ufm.c head/sys/dev/usb/net/if_aue.c head/sys/dev/usb/net/if_axe.c head/sys/dev/usb/net/if_cdce.c head/sys/dev/usb/net/if_cue.c head/sys/dev/usb/net/if_kue.c head/sys/dev/usb/net/if_rue.c head/sys/dev/usb/net/if_udav.c head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/serial/uark.c head/sys/dev/usb/serial/ubsa.c head/sys/dev/usb/serial/ubser.c head/sys/dev/usb/serial/uchcom.c head/sys/dev/usb/serial/ucycom.c head/sys/dev/usb/serial/ufoma.c head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/serial/ugensa.c head/sys/dev/usb/serial/uipaq.c head/sys/dev/usb/serial/ulpt.c head/sys/dev/usb/serial/umct.c head/sys/dev/usb/serial/umodem.c head/sys/dev/usb/serial/umoscom.c head/sys/dev/usb/serial/uplcom.c head/sys/dev/usb/serial/uslcom.c head/sys/dev/usb/serial/uvisor.c head/sys/dev/usb/serial/uvscom.c head/sys/dev/usb/storage/umass.c head/sys/dev/usb/storage/urio.c head/sys/dev/usb/storage/ustorage_fs.c head/sys/dev/usb/usb_compat_linux.c head/sys/dev/usb/usb_hub.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_zyd.c Modified: head/sys/dev/ata/ata-usb.c ============================================================================== --- head/sys/dev/ata/ata-usb.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/ata/ata-usb.c Mon Mar 2 05:37:05 2009 (r189275) @@ -271,7 +271,7 @@ static driver_t atausb2_driver = { .size = sizeof(struct atausb2_softc), }; -DRIVER_MODULE(atausb, ushub, atausb2_driver, atausb2_devclass, 0, 0); +DRIVER_MODULE(atausb, uhub, atausb2_driver, atausb2_devclass, 0, 0); MODULE_DEPEND(atausb, usb, 1, 1, 1); MODULE_VERSION(atausb, 1); Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/sound/usb/uaudio.c Mon Mar 2 05:37:05 2009 (r189275) @@ -3742,7 +3742,7 @@ umidi_detach(device_t dev) return (0); } -DRIVER_MODULE(uaudio, ushub, uaudio_driver, uaudio_devclass, NULL, 0); +DRIVER_MODULE(uaudio, uhub, uaudio_driver, uaudio_devclass, NULL, 0); MODULE_DEPEND(uaudio, usb, 1, 1, 1); MODULE_DEPEND(uaudio, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); MODULE_VERSION(uaudio, 1); Modified: head/sys/dev/usb/bluetooth/ng_ubt.c ============================================================================== --- head/sys/dev/usb/bluetooth/ng_ubt.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/bluetooth/ng_ubt.c Mon Mar 2 05:37:05 2009 (r189275) @@ -1710,7 +1710,7 @@ static driver_t ubt_driver = .size = sizeof(struct ubt_softc), }; -DRIVER_MODULE(ng_ubt, ushub, ubt_driver, ubt_devclass, ubt_modevent, 0); +DRIVER_MODULE(ng_ubt, uhub, ubt_driver, ubt_devclass, ubt_modevent, 0); MODULE_VERSION(ng_ubt, NG_BLUETOOTH_VERSION); MODULE_DEPEND(ng_ubt, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION); MODULE_DEPEND(ng_ubt, ng_hci, NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION); Modified: head/sys/dev/usb/bluetooth/ubtbcmfw.c ============================================================================== --- head/sys/dev/usb/bluetooth/ubtbcmfw.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/bluetooth/ubtbcmfw.c Mon Mar 2 05:37:05 2009 (r189275) @@ -157,7 +157,7 @@ static driver_t ubtbcmfw_driver = .size = sizeof(struct ubtbcmfw_softc), }; -DRIVER_MODULE(ubtbcmfw, ushub, ubtbcmfw_driver, ubtbcmfw_devclass, NULL, 0); +DRIVER_MODULE(ubtbcmfw, uhub, ubtbcmfw_driver, ubtbcmfw_devclass, NULL, 0); MODULE_DEPEND(ubtbcmfw, usb, 1, 1, 1); /* Modified: head/sys/dev/usb/image/uscanner.c ============================================================================== --- head/sys/dev/usb/image/uscanner.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/image/uscanner.c Mon Mar 2 05:37:05 2009 (r189275) @@ -200,7 +200,7 @@ static driver_t uscanner_driver = { .size = sizeof(struct uscanner_softc), }; -DRIVER_MODULE(uscanner, ushub, uscanner_driver, uscanner_devclass, NULL, 0); +DRIVER_MODULE(uscanner, uhub, uscanner_driver, uscanner_devclass, NULL, 0); MODULE_DEPEND(uscanner, usb, 1, 1, 1); /* Modified: head/sys/dev/usb/input/uhid.c ============================================================================== --- head/sys/dev/usb/input/uhid.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/input/uhid.c Mon Mar 2 05:37:05 2009 (r189275) @@ -783,5 +783,5 @@ static driver_t uhid_driver = { .size = sizeof(struct uhid_softc), }; -DRIVER_MODULE(uhid, ushub, uhid_driver, uhid_devclass, NULL, 0); +DRIVER_MODULE(uhid, uhub, uhid_driver, uhid_devclass, NULL, 0); MODULE_DEPEND(uhid, usb, 1, 1, 1); Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/input/ukbd.c Mon Mar 2 05:37:05 2009 (r189275) @@ -1485,5 +1485,5 @@ static driver_t ukbd_driver = { .size = sizeof(struct ukbd_softc), }; -DRIVER_MODULE(ukbd, ushub, ukbd_driver, ukbd_devclass, ukbd_driver_load, 0); +DRIVER_MODULE(ukbd, uhub, ukbd_driver, ukbd_devclass, ukbd_driver_load, 0); MODULE_DEPEND(ukbd, usb, 1, 1, 1); Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/input/ums.c Mon Mar 2 05:37:05 2009 (r189275) @@ -858,5 +858,5 @@ static driver_t ums_driver = { .size = sizeof(struct ums_softc), }; -DRIVER_MODULE(ums, ushub, ums_driver, ums_devclass, NULL, 0); +DRIVER_MODULE(ums, uhub, ums_driver, ums_devclass, NULL, 0); MODULE_DEPEND(ums, usb, 1, 1, 1); Modified: head/sys/dev/usb/misc/udbp.c ============================================================================== --- head/sys/dev/usb/misc/udbp.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/misc/udbp.c Mon Mar 2 05:37:05 2009 (r189275) @@ -246,7 +246,7 @@ static driver_t udbp_driver = { .size = sizeof(struct udbp_softc), }; -DRIVER_MODULE(udbp, ushub, udbp_driver, udbp_devclass, udbp_modload, 0); +DRIVER_MODULE(udbp, uhub, udbp_driver, udbp_devclass, udbp_modload, 0); MODULE_DEPEND(udbp, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION); MODULE_DEPEND(udbp, usb, 1, 1, 1); Modified: head/sys/dev/usb/misc/ufm.c ============================================================================== --- head/sys/dev/usb/misc/ufm.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/misc/ufm.c Mon Mar 2 05:37:05 2009 (r189275) @@ -104,7 +104,7 @@ static driver_t ufm_driver = { .size = sizeof(struct ufm_softc), }; -DRIVER_MODULE(ufm, ushub, ufm_driver, ufm_devclass, NULL, 0); +DRIVER_MODULE(ufm, uhub, ufm_driver, ufm_devclass, NULL, 0); MODULE_DEPEND(ufm, usb, 1, 1, 1); static int Modified: head/sys/dev/usb/net/if_aue.c ============================================================================== --- head/sys/dev/usb/net/if_aue.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/net/if_aue.c Mon Mar 2 05:37:05 2009 (r189275) @@ -261,7 +261,7 @@ static driver_t aue_driver = { static devclass_t aue_devclass; -DRIVER_MODULE(aue, ushub, aue_driver, aue_devclass, NULL, 0); +DRIVER_MODULE(aue, uhub, aue_driver, aue_devclass, NULL, 0); DRIVER_MODULE(miibus, aue, miibus_driver, miibus_devclass, 0, 0); MODULE_DEPEND(aue, uether, 1, 1, 1); MODULE_DEPEND(aue, usb, 1, 1, 1); Modified: head/sys/dev/usb/net/if_axe.c ============================================================================== --- head/sys/dev/usb/net/if_axe.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/net/if_axe.c Mon Mar 2 05:37:05 2009 (r189275) @@ -238,7 +238,7 @@ static driver_t axe_driver = { static devclass_t axe_devclass; -DRIVER_MODULE(axe, ushub, axe_driver, axe_devclass, NULL, 0); +DRIVER_MODULE(axe, uhub, axe_driver, axe_devclass, NULL, 0); DRIVER_MODULE(miibus, axe, miibus_driver, miibus_devclass, 0, 0); MODULE_DEPEND(axe, uether, 1, 1, 1); MODULE_DEPEND(axe, usb, 1, 1, 1); Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/net/if_cdce.c Mon Mar 2 05:37:05 2009 (r189275) @@ -176,7 +176,7 @@ static driver_t cdce_driver = { static devclass_t cdce_devclass; -DRIVER_MODULE(cdce, ushub, cdce_driver, cdce_devclass, NULL, 0); +DRIVER_MODULE(cdce, uhub, cdce_driver, cdce_devclass, NULL, 0); MODULE_VERSION(cdce, 1); MODULE_DEPEND(cdce, uether, 1, 1, 1); MODULE_DEPEND(cdce, usb, 1, 1, 1); Modified: head/sys/dev/usb/net/if_cue.c ============================================================================== --- head/sys/dev/usb/net/if_cue.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/net/if_cue.c Mon Mar 2 05:37:05 2009 (r189275) @@ -155,7 +155,7 @@ static driver_t cue_driver = { static devclass_t cue_devclass; -DRIVER_MODULE(cue, ushub, cue_driver, cue_devclass, NULL, 0); +DRIVER_MODULE(cue, uhub, cue_driver, cue_devclass, NULL, 0); MODULE_DEPEND(cue, uether, 1, 1, 1); MODULE_DEPEND(cue, usb, 1, 1, 1); MODULE_DEPEND(cue, ether, 1, 1, 1); Modified: head/sys/dev/usb/net/if_kue.c ============================================================================== --- head/sys/dev/usb/net/if_kue.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/net/if_kue.c Mon Mar 2 05:37:05 2009 (r189275) @@ -198,7 +198,7 @@ static driver_t kue_driver = { static devclass_t kue_devclass; -DRIVER_MODULE(kue, ushub, kue_driver, kue_devclass, NULL, 0); +DRIVER_MODULE(kue, uhub, kue_driver, kue_devclass, NULL, 0); MODULE_DEPEND(kue, uether, 1, 1, 1); MODULE_DEPEND(kue, usb, 1, 1, 1); MODULE_DEPEND(kue, ether, 1, 1, 1); Modified: head/sys/dev/usb/net/if_rue.c ============================================================================== --- head/sys/dev/usb/net/if_rue.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/net/if_rue.c Mon Mar 2 05:37:05 2009 (r189275) @@ -194,7 +194,7 @@ static driver_t rue_driver = { static devclass_t rue_devclass; -DRIVER_MODULE(rue, ushub, rue_driver, rue_devclass, NULL, 0); +DRIVER_MODULE(rue, uhub, rue_driver, rue_devclass, NULL, 0); DRIVER_MODULE(miibus, rue, miibus_driver, miibus_devclass, 0, 0); MODULE_DEPEND(rue, uether, 1, 1, 1); MODULE_DEPEND(rue, usb, 1, 1, 1); Modified: head/sys/dev/usb/net/if_udav.c ============================================================================== --- head/sys/dev/usb/net/if_udav.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/net/if_udav.c Mon Mar 2 05:37:05 2009 (r189275) @@ -154,7 +154,7 @@ static driver_t udav_driver = { static devclass_t udav_devclass; -DRIVER_MODULE(udav, ushub, udav_driver, udav_devclass, NULL, 0); +DRIVER_MODULE(udav, uhub, udav_driver, udav_devclass, NULL, 0); DRIVER_MODULE(miibus, udav, miibus_driver, miibus_devclass, 0, 0); MODULE_DEPEND(udav, uether, 1, 1, 1); MODULE_DEPEND(udav, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/u3g.c Mon Mar 2 05:37:05 2009 (r189275) @@ -154,7 +154,7 @@ static driver_t u3g_driver = { .size = sizeof(struct u3g_softc), }; -DRIVER_MODULE(u3g, ushub, u3g_driver, u3g_devclass, u3g_driver_loaded, 0); +DRIVER_MODULE(u3g, uhub, u3g_driver, u3g_devclass, u3g_driver_loaded, 0); MODULE_DEPEND(u3g, ucom, 1, 1, 1); MODULE_DEPEND(u3g, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/uark.c ============================================================================== --- head/sys/dev/usb/serial/uark.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uark.c Mon Mar 2 05:37:05 2009 (r189275) @@ -148,7 +148,7 @@ static driver_t uark_driver = { .size = sizeof(struct uark_softc), }; -DRIVER_MODULE(uark, ushub, uark_driver, uark_devclass, NULL, 0); +DRIVER_MODULE(uark, uhub, uark_driver, uark_devclass, NULL, 0); MODULE_DEPEND(uark, ucom, 1, 1, 1); MODULE_DEPEND(uark, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/ubsa.c ============================================================================== --- head/sys/dev/usb/serial/ubsa.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/ubsa.c Mon Mar 2 05:37:05 2009 (r189275) @@ -259,7 +259,7 @@ static driver_t ubsa_driver = { .size = sizeof(struct ubsa_softc), }; -DRIVER_MODULE(ubsa, ushub, ubsa_driver, ubsa_devclass, NULL, 0); +DRIVER_MODULE(ubsa, uhub, ubsa_driver, ubsa_devclass, NULL, 0); MODULE_DEPEND(ubsa, ucom, 1, 1, 1); MODULE_DEPEND(ubsa, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/ubser.c ============================================================================== --- head/sys/dev/usb/serial/ubser.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/ubser.c Mon Mar 2 05:37:05 2009 (r189275) @@ -197,7 +197,7 @@ static driver_t ubser_driver = { .size = sizeof(struct ubser_softc), }; -DRIVER_MODULE(ubser, ushub, ubser_driver, ubser_devclass, NULL, 0); +DRIVER_MODULE(ubser, uhub, ubser_driver, ubser_devclass, NULL, 0); MODULE_DEPEND(ubser, ucom, 1, 1, 1); MODULE_DEPEND(ubser, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/uchcom.c ============================================================================== --- head/sys/dev/usb/serial/uchcom.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uchcom.c Mon Mar 2 05:37:05 2009 (r189275) @@ -882,6 +882,6 @@ static driver_t uchcom_driver = { static devclass_t uchcom_devclass; -DRIVER_MODULE(uchcom, ushub, uchcom_driver, uchcom_devclass, NULL, 0); +DRIVER_MODULE(uchcom, uhub, uchcom_driver, uchcom_devclass, NULL, 0); MODULE_DEPEND(uchcom, ucom, 1, 1, 1); MODULE_DEPEND(uchcom, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/ucycom.c ============================================================================== --- head/sys/dev/usb/serial/ucycom.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/ucycom.c Mon Mar 2 05:37:05 2009 (r189275) @@ -161,7 +161,7 @@ static driver_t ucycom_driver = { .size = sizeof(struct ucycom_softc), }; -DRIVER_MODULE(ucycom, ushub, ucycom_driver, ucycom_devclass, NULL, 0); +DRIVER_MODULE(ucycom, uhub, ucycom_driver, ucycom_devclass, NULL, 0); MODULE_DEPEND(ucycom, ucom, 1, 1, 1); MODULE_DEPEND(ucycom, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/ufoma.c ============================================================================== --- head/sys/dev/usb/serial/ufoma.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/ufoma.c Mon Mar 2 05:37:05 2009 (r189275) @@ -311,7 +311,7 @@ static driver_t ufoma_driver = { .size = sizeof(struct ufoma_softc), }; -DRIVER_MODULE(ufoma, ushub, ufoma_driver, ufoma_devclass, NULL, 0); +DRIVER_MODULE(ufoma, uhub, ufoma_driver, ufoma_devclass, NULL, 0); MODULE_DEPEND(ufoma, ucom, 1, 1, 1); MODULE_DEPEND(ufoma, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/uftdi.c ============================================================================== --- head/sys/dev/usb/serial/uftdi.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uftdi.c Mon Mar 2 05:37:05 2009 (r189275) @@ -196,7 +196,7 @@ static driver_t uftdi_driver = { .size = sizeof(struct uftdi_softc), }; -DRIVER_MODULE(uftdi, ushub, uftdi_driver, uftdi_devclass, NULL, 0); +DRIVER_MODULE(uftdi, uhub, uftdi_driver, uftdi_devclass, NULL, 0); MODULE_DEPEND(uftdi, ucom, 1, 1, 1); MODULE_DEPEND(uftdi, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/ugensa.c ============================================================================== --- head/sys/dev/usb/serial/ugensa.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/ugensa.c Mon Mar 2 05:37:05 2009 (r189275) @@ -145,7 +145,7 @@ static driver_t ugensa_driver = { .size = sizeof(struct ugensa_softc), }; -DRIVER_MODULE(ugensa, ushub, ugensa_driver, ugensa_devclass, NULL, 0); +DRIVER_MODULE(ugensa, uhub, ugensa_driver, ugensa_devclass, NULL, 0); MODULE_DEPEND(ugensa, ucom, 1, 1, 1); MODULE_DEPEND(ugensa, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/uipaq.c ============================================================================== --- head/sys/dev/usb/serial/uipaq.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uipaq.c Mon Mar 2 05:37:05 2009 (r189275) @@ -1069,7 +1069,7 @@ static driver_t uipaq_driver = { .size = sizeof(struct uipaq_softc), }; -DRIVER_MODULE(uipaq, ushub, uipaq_driver, uipaq_devclass, NULL, 0); +DRIVER_MODULE(uipaq, uhub, uipaq_driver, uipaq_devclass, NULL, 0); MODULE_DEPEND(uipaq, ucom, 1, 1, 1); MODULE_DEPEND(uipaq, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/ulpt.c ============================================================================== --- head/sys/dev/usb/serial/ulpt.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/ulpt.c Mon Mar 2 05:37:05 2009 (r189275) @@ -717,6 +717,6 @@ static driver_t ulpt_driver = { .size = sizeof(struct ulpt_softc), }; -DRIVER_MODULE(ulpt, ushub, ulpt_driver, ulpt_devclass, NULL, 0); +DRIVER_MODULE(ulpt, uhub, ulpt_driver, ulpt_devclass, NULL, 0); MODULE_DEPEND(ulpt, usb, 1, 1, 1); MODULE_DEPEND(ulpt, ucom, 1, 1, 1); Modified: head/sys/dev/usb/serial/umct.c ============================================================================== --- head/sys/dev/usb/serial/umct.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/umct.c Mon Mar 2 05:37:05 2009 (r189275) @@ -200,7 +200,7 @@ static driver_t umct_driver = { .size = sizeof(struct umct_softc), }; -DRIVER_MODULE(umct, ushub, umct_driver, umct_devclass, NULL, 0); +DRIVER_MODULE(umct, uhub, umct_driver, umct_devclass, NULL, 0); MODULE_DEPEND(umct, ucom, 1, 1, 1); MODULE_DEPEND(umct, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/umodem.c ============================================================================== --- head/sys/dev/usb/serial/umodem.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/umodem.c Mon Mar 2 05:37:05 2009 (r189275) @@ -244,7 +244,7 @@ static driver_t umodem_driver = { .size = sizeof(struct umodem_softc), }; -DRIVER_MODULE(umodem, ushub, umodem_driver, umodem_devclass, NULL, 0); +DRIVER_MODULE(umodem, uhub, umodem_driver, umodem_devclass, NULL, 0); MODULE_DEPEND(umodem, ucom, 1, 1, 1); MODULE_DEPEND(umodem, usb, 1, 1, 1); MODULE_VERSION(umodem, UMODEM_MODVER); Modified: head/sys/dev/usb/serial/umoscom.c ============================================================================== --- head/sys/dev/usb/serial/umoscom.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/umoscom.c Mon Mar 2 05:37:05 2009 (r189275) @@ -261,7 +261,7 @@ static driver_t umoscom_driver = { .size = sizeof(struct umoscom_softc), }; -DRIVER_MODULE(umoscom, ushub, umoscom_driver, umoscom_devclass, NULL, 0); +DRIVER_MODULE(umoscom, uhub, umoscom_driver, umoscom_devclass, NULL, 0); MODULE_DEPEND(umoscom, ucom, 1, 1, 1); MODULE_DEPEND(umoscom, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/uplcom.c ============================================================================== --- head/sys/dev/usb/serial/uplcom.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uplcom.c Mon Mar 2 05:37:05 2009 (r189275) @@ -291,7 +291,7 @@ static driver_t uplcom_driver = { .size = sizeof(struct uplcom_softc), }; -DRIVER_MODULE(uplcom, ushub, uplcom_driver, uplcom_devclass, NULL, 0); +DRIVER_MODULE(uplcom, uhub, uplcom_driver, uplcom_devclass, NULL, 0); MODULE_DEPEND(uplcom, ucom, 1, 1, 1); MODULE_DEPEND(uplcom, usb, 1, 1, 1); MODULE_VERSION(uplcom, UPLCOM_MODVER); Modified: head/sys/dev/usb/serial/uslcom.c ============================================================================== --- head/sys/dev/usb/serial/uslcom.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uslcom.c Mon Mar 2 05:37:05 2009 (r189275) @@ -194,7 +194,7 @@ static driver_t uslcom_driver = { .size = sizeof(struct uslcom_softc), }; -DRIVER_MODULE(uslcom, ushub, uslcom_driver, uslcom_devclass, NULL, 0); +DRIVER_MODULE(uslcom, uhub, uslcom_driver, uslcom_devclass, NULL, 0); MODULE_DEPEND(uslcom, ucom, 1, 1, 1); MODULE_DEPEND(uslcom, usb, 1, 1, 1); MODULE_VERSION(uslcom, 1); Modified: head/sys/dev/usb/serial/uvisor.c ============================================================================== --- head/sys/dev/usb/serial/uvisor.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uvisor.c Mon Mar 2 05:37:05 2009 (r189275) @@ -235,7 +235,7 @@ static driver_t uvisor_driver = { .size = sizeof(struct uvisor_softc), }; -DRIVER_MODULE(uvisor, ushub, uvisor_driver, uvisor_devclass, NULL, 0); +DRIVER_MODULE(uvisor, uhub, uvisor_driver, uvisor_devclass, NULL, 0); MODULE_DEPEND(uvisor, ucom, 1, 1, 1); MODULE_DEPEND(uvisor, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/uvscom.c ============================================================================== --- head/sys/dev/usb/serial/uvscom.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uvscom.c Mon Mar 2 05:37:05 2009 (r189275) @@ -247,7 +247,7 @@ static driver_t uvscom_driver = { .size = sizeof(struct uvscom_softc), }; -DRIVER_MODULE(uvscom, ushub, uvscom_driver, uvscom_devclass, NULL, 0); +DRIVER_MODULE(uvscom, uhub, uvscom_driver, uvscom_devclass, NULL, 0); MODULE_DEPEND(uvscom, ucom, 1, 1, 1); MODULE_DEPEND(uvscom, usb, 1, 1, 1); MODULE_VERSION(uvscom, UVSCOM_MODVER); Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/storage/umass.c Mon Mar 2 05:37:05 2009 (r189275) @@ -1281,7 +1281,7 @@ static driver_t umass_driver = { .size = sizeof(struct umass_softc), }; -DRIVER_MODULE(umass, ushub, umass_driver, umass_devclass, NULL, 0); +DRIVER_MODULE(umass, uhub, umass_driver, umass_devclass, NULL, 0); MODULE_DEPEND(umass, usb, 1, 1, 1); MODULE_DEPEND(umass, cam, 1, 1, 1); Modified: head/sys/dev/usb/storage/urio.c ============================================================================== --- head/sys/dev/usb/storage/urio.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/storage/urio.c Mon Mar 2 05:37:05 2009 (r189275) @@ -183,7 +183,7 @@ static driver_t urio_driver = { .size = sizeof(struct urio_softc), }; -DRIVER_MODULE(urio, ushub, urio_driver, urio_devclass, NULL, 0); +DRIVER_MODULE(urio, uhub, urio_driver, urio_devclass, NULL, 0); MODULE_DEPEND(urio, usb, 1, 1, 1); static int Modified: head/sys/dev/usb/storage/ustorage_fs.c ============================================================================== --- head/sys/dev/usb/storage/ustorage_fs.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/storage/ustorage_fs.c Mon Mar 2 05:37:05 2009 (r189275) @@ -229,7 +229,7 @@ static driver_t ustorage_fs_driver = { static devclass_t ustorage_fs_devclass; -DRIVER_MODULE(ustorage_fs, ushub, ustorage_fs_driver, ustorage_fs_devclass, NULL, 0); +DRIVER_MODULE(ustorage_fs, uhub, ustorage_fs_driver, ustorage_fs_devclass, NULL, 0); MODULE_VERSION(ustorage_fs, 0); MODULE_DEPEND(ustorage_fs, usb, 1, 1, 1); Modified: head/sys/dev/usb/usb_compat_linux.c ============================================================================== --- head/sys/dev/usb/usb_compat_linux.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/usb_compat_linux.c Mon Mar 2 05:37:05 2009 (r189275) @@ -106,7 +106,7 @@ static driver_t usb_linux_driver = { static devclass_t usb_linux_devclass; -DRIVER_MODULE(usb_linux, ushub, usb_linux_driver, usb_linux_devclass, NULL, 0); +DRIVER_MODULE(usb_linux, uhub, usb_linux_driver, usb_linux_devclass, NULL, 0); /*------------------------------------------------------------------------* * usb_linux_lookup_id Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/usb_hub.c Mon Mar 2 05:37:05 2009 (r189275) @@ -126,7 +126,7 @@ static devclass_t uhub_devclass; static driver_t uhub_driver = { - .name = "ushub", + .name = "uhub", .methods = (device_method_t[]){ DEVMETHOD(device_probe, uhub_probe), DEVMETHOD(device_attach, uhub_attach), @@ -144,8 +144,8 @@ static driver_t uhub_driver = .size = sizeof(struct uhub_softc) }; -DRIVER_MODULE(ushub, usbus, uhub_driver, uhub_devclass, 0, 0); -DRIVER_MODULE(ushub, ushub, uhub_driver, uhub_devclass, NULL, 0); +DRIVER_MODULE(uhub, usbus, uhub_driver, uhub_devclass, 0, 0); +DRIVER_MODULE(uhub, uhub, uhub_driver, uhub_devclass, NULL, 0); static void uhub_intr_callback(struct usb2_xfer *xfer) Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/wlan/if_rum.c Mon Mar 2 05:37:05 2009 (r189275) @@ -2538,4 +2538,4 @@ static driver_t rum_driver = { static devclass_t rum_devclass; -DRIVER_MODULE(rum, ushub, rum_driver, rum_devclass, NULL, 0); +DRIVER_MODULE(rum, uhub, rum_driver, rum_devclass, NULL, 0); Modified: head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- head/sys/dev/usb/wlan/if_ural.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/wlan/if_ural.c Mon Mar 2 05:37:05 2009 (r189275) @@ -375,7 +375,7 @@ static driver_t ural_driver = { static devclass_t ural_devclass; -DRIVER_MODULE(ural, ushub, ural_driver, ural_devclass, NULL, 0); +DRIVER_MODULE(ural, uhub, ural_driver, ural_devclass, NULL, 0); MODULE_DEPEND(ural, usb, 1, 1, 1); MODULE_DEPEND(ural, wlan, 1, 1, 1); MODULE_DEPEND(ural, wlan_amrr, 1, 1, 1); Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/wlan/if_zyd.c Mon Mar 2 05:37:05 2009 (r189275) @@ -3172,7 +3172,7 @@ static driver_t zyd_driver = { static devclass_t zyd_devclass; -DRIVER_MODULE(zyd, ushub, zyd_driver, zyd_devclass, NULL, 0); +DRIVER_MODULE(zyd, uhub, zyd_driver, zyd_devclass, NULL, 0); MODULE_DEPEND(zyd, usb, 1, 1, 1); MODULE_DEPEND(zyd, wlan, 1, 1, 1); MODULE_DEPEND(zyd, wlan_amrr, 1, 1, 1); From marcus at marcuscom.com Sun Mar 1 21:41:41 2009 From: marcus at marcuscom.com (Joe Marcus Clarke) Date: Sun Mar 1 21:41:54 2009 Subject: svn commit: r189275 - in head/sys/dev: ata sound/usb usb usb/bluetooth usb/image usb/input usb/misc usb/net usb/serial usb/storage usb/wlan In-Reply-To: <200903020537.n225b6QS066433@svn.freebsd.org> References: <200903020537.n225b6QS066433@svn.freebsd.org> Message-ID: <1235972496.31933.29.camel@shumai.marcuscom.com> On Mon, 2009-03-02 at 05:37 +0000, Andrew Thompson wrote: > Author: thompsa > Date: Mon Mar 2 05:37:05 2009 > New Revision: 189275 > URL: http://svn.freebsd.org/changeset/base/189275 > > Log: > Rename the ushub device class back to uhub as it was in the old usb stack, > moused(8) looks for "uhub/ums" to decide if needs to load the module. This breaks hal. Can you bump __FreeBSD_version? Joe > > Reported by: Garrett Cooper > > Modified: > head/sys/dev/ata/ata-usb.c > head/sys/dev/sound/usb/uaudio.c > head/sys/dev/usb/bluetooth/ng_ubt.c > head/sys/dev/usb/bluetooth/ubtbcmfw.c > head/sys/dev/usb/image/uscanner.c > head/sys/dev/usb/input/uhid.c > head/sys/dev/usb/input/ukbd.c > head/sys/dev/usb/input/ums.c > head/sys/dev/usb/misc/udbp.c > head/sys/dev/usb/misc/ufm.c > head/sys/dev/usb/net/if_aue.c > head/sys/dev/usb/net/if_axe.c > head/sys/dev/usb/net/if_cdce.c > head/sys/dev/usb/net/if_cue.c > head/sys/dev/usb/net/if_kue.c > head/sys/dev/usb/net/if_rue.c > head/sys/dev/usb/net/if_udav.c > head/sys/dev/usb/serial/u3g.c > head/sys/dev/usb/serial/uark.c > head/sys/dev/usb/serial/ubsa.c > head/sys/dev/usb/serial/ubser.c > head/sys/dev/usb/serial/uchcom.c > head/sys/dev/usb/serial/ucycom.c > head/sys/dev/usb/serial/ufoma.c > head/sys/dev/usb/serial/uftdi.c > head/sys/dev/usb/serial/ugensa.c > head/sys/dev/usb/serial/uipaq.c > head/sys/dev/usb/serial/ulpt.c > head/sys/dev/usb/serial/umct.c > head/sys/dev/usb/serial/umodem.c > head/sys/dev/usb/serial/umoscom.c > head/sys/dev/usb/serial/uplcom.c > head/sys/dev/usb/serial/uslcom.c > head/sys/dev/usb/serial/uvisor.c > head/sys/dev/usb/serial/uvscom.c > head/sys/dev/usb/storage/umass.c > head/sys/dev/usb/storage/urio.c > head/sys/dev/usb/storage/ustorage_fs.c > head/sys/dev/usb/usb_compat_linux.c > head/sys/dev/usb/usb_hub.c > head/sys/dev/usb/wlan/if_rum.c > head/sys/dev/usb/wlan/if_ural.c > head/sys/dev/usb/wlan/if_zyd.c > > Modified: head/sys/dev/ata/ata-usb.c > ============================================================================== > --- head/sys/dev/ata/ata-usb.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/ata/ata-usb.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -271,7 +271,7 @@ static driver_t atausb2_driver = { > .size = sizeof(struct atausb2_softc), > }; > > -DRIVER_MODULE(atausb, ushub, atausb2_driver, atausb2_devclass, 0, 0); > +DRIVER_MODULE(atausb, uhub, atausb2_driver, atausb2_devclass, 0, 0); > MODULE_DEPEND(atausb, usb, 1, 1, 1); > MODULE_VERSION(atausb, 1); > > > Modified: head/sys/dev/sound/usb/uaudio.c > ============================================================================== > --- head/sys/dev/sound/usb/uaudio.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/sound/usb/uaudio.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -3742,7 +3742,7 @@ umidi_detach(device_t dev) > return (0); > } > > -DRIVER_MODULE(uaudio, ushub, uaudio_driver, uaudio_devclass, NULL, 0); > +DRIVER_MODULE(uaudio, uhub, uaudio_driver, uaudio_devclass, NULL, 0); > MODULE_DEPEND(uaudio, usb, 1, 1, 1); > MODULE_DEPEND(uaudio, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); > MODULE_VERSION(uaudio, 1); > > Modified: head/sys/dev/usb/bluetooth/ng_ubt.c > ============================================================================== > --- head/sys/dev/usb/bluetooth/ng_ubt.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/bluetooth/ng_ubt.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -1710,7 +1710,7 @@ static driver_t ubt_driver = > .size = sizeof(struct ubt_softc), > }; > > -DRIVER_MODULE(ng_ubt, ushub, ubt_driver, ubt_devclass, ubt_modevent, 0); > +DRIVER_MODULE(ng_ubt, uhub, ubt_driver, ubt_devclass, ubt_modevent, 0); > MODULE_VERSION(ng_ubt, NG_BLUETOOTH_VERSION); > MODULE_DEPEND(ng_ubt, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION); > MODULE_DEPEND(ng_ubt, ng_hci, NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION); > > Modified: head/sys/dev/usb/bluetooth/ubtbcmfw.c > ============================================================================== > --- head/sys/dev/usb/bluetooth/ubtbcmfw.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/bluetooth/ubtbcmfw.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -157,7 +157,7 @@ static driver_t ubtbcmfw_driver = > .size = sizeof(struct ubtbcmfw_softc), > }; > > -DRIVER_MODULE(ubtbcmfw, ushub, ubtbcmfw_driver, ubtbcmfw_devclass, NULL, 0); > +DRIVER_MODULE(ubtbcmfw, uhub, ubtbcmfw_driver, ubtbcmfw_devclass, NULL, 0); > MODULE_DEPEND(ubtbcmfw, usb, 1, 1, 1); > > /* > > Modified: head/sys/dev/usb/image/uscanner.c > ============================================================================== > --- head/sys/dev/usb/image/uscanner.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/image/uscanner.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -200,7 +200,7 @@ static driver_t uscanner_driver = { > .size = sizeof(struct uscanner_softc), > }; > > -DRIVER_MODULE(uscanner, ushub, uscanner_driver, uscanner_devclass, NULL, 0); > +DRIVER_MODULE(uscanner, uhub, uscanner_driver, uscanner_devclass, NULL, 0); > MODULE_DEPEND(uscanner, usb, 1, 1, 1); > > /* > > Modified: head/sys/dev/usb/input/uhid.c > ============================================================================== > --- head/sys/dev/usb/input/uhid.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/input/uhid.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -783,5 +783,5 @@ static driver_t uhid_driver = { > .size = sizeof(struct uhid_softc), > }; > > -DRIVER_MODULE(uhid, ushub, uhid_driver, uhid_devclass, NULL, 0); > +DRIVER_MODULE(uhid, uhub, uhid_driver, uhid_devclass, NULL, 0); > MODULE_DEPEND(uhid, usb, 1, 1, 1); > > Modified: head/sys/dev/usb/input/ukbd.c > ============================================================================== > --- head/sys/dev/usb/input/ukbd.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/input/ukbd.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -1485,5 +1485,5 @@ static driver_t ukbd_driver = { > .size = sizeof(struct ukbd_softc), > }; > > -DRIVER_MODULE(ukbd, ushub, ukbd_driver, ukbd_devclass, ukbd_driver_load, 0); > +DRIVER_MODULE(ukbd, uhub, ukbd_driver, ukbd_devclass, ukbd_driver_load, 0); > MODULE_DEPEND(ukbd, usb, 1, 1, 1); > > Modified: head/sys/dev/usb/input/ums.c > ============================================================================== > --- head/sys/dev/usb/input/ums.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/input/ums.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -858,5 +858,5 @@ static driver_t ums_driver = { > .size = sizeof(struct ums_softc), > }; > > -DRIVER_MODULE(ums, ushub, ums_driver, ums_devclass, NULL, 0); > +DRIVER_MODULE(ums, uhub, ums_driver, ums_devclass, NULL, 0); > MODULE_DEPEND(ums, usb, 1, 1, 1); > > Modified: head/sys/dev/usb/misc/udbp.c > ============================================================================== > --- head/sys/dev/usb/misc/udbp.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/misc/udbp.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -246,7 +246,7 @@ static driver_t udbp_driver = { > .size = sizeof(struct udbp_softc), > }; > > -DRIVER_MODULE(udbp, ushub, udbp_driver, udbp_devclass, udbp_modload, 0); > +DRIVER_MODULE(udbp, uhub, udbp_driver, udbp_devclass, udbp_modload, 0); > MODULE_DEPEND(udbp, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION); > MODULE_DEPEND(udbp, usb, 1, 1, 1); > > > Modified: head/sys/dev/usb/misc/ufm.c > ============================================================================== > --- head/sys/dev/usb/misc/ufm.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/misc/ufm.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -104,7 +104,7 @@ static driver_t ufm_driver = { > .size = sizeof(struct ufm_softc), > }; > > -DRIVER_MODULE(ufm, ushub, ufm_driver, ufm_devclass, NULL, 0); > +DRIVER_MODULE(ufm, uhub, ufm_driver, ufm_devclass, NULL, 0); > MODULE_DEPEND(ufm, usb, 1, 1, 1); > > static int > > Modified: head/sys/dev/usb/net/if_aue.c > ============================================================================== > --- head/sys/dev/usb/net/if_aue.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/net/if_aue.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -261,7 +261,7 @@ static driver_t aue_driver = { > > static devclass_t aue_devclass; > > -DRIVER_MODULE(aue, ushub, aue_driver, aue_devclass, NULL, 0); > +DRIVER_MODULE(aue, uhub, aue_driver, aue_devclass, NULL, 0); > DRIVER_MODULE(miibus, aue, miibus_driver, miibus_devclass, 0, 0); > MODULE_DEPEND(aue, uether, 1, 1, 1); > MODULE_DEPEND(aue, usb, 1, 1, 1); > > Modified: head/sys/dev/usb/net/if_axe.c > ============================================================================== > --- head/sys/dev/usb/net/if_axe.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/net/if_axe.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -238,7 +238,7 @@ static driver_t axe_driver = { > > static devclass_t axe_devclass; > > -DRIVER_MODULE(axe, ushub, axe_driver, axe_devclass, NULL, 0); > +DRIVER_MODULE(axe, uhub, axe_driver, axe_devclass, NULL, 0); > DRIVER_MODULE(miibus, axe, miibus_driver, miibus_devclass, 0, 0); > MODULE_DEPEND(axe, uether, 1, 1, 1); > MODULE_DEPEND(axe, usb, 1, 1, 1); > > Modified: head/sys/dev/usb/net/if_cdce.c > ============================================================================== > --- head/sys/dev/usb/net/if_cdce.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/net/if_cdce.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -176,7 +176,7 @@ static driver_t cdce_driver = { > > static devclass_t cdce_devclass; > > -DRIVER_MODULE(cdce, ushub, cdce_driver, cdce_devclass, NULL, 0); > +DRIVER_MODULE(cdce, uhub, cdce_driver, cdce_devclass, NULL, 0); > MODULE_VERSION(cdce, 1); > MODULE_DEPEND(cdce, uether, 1, 1, 1); > MODULE_DEPEND(cdce, usb, 1, 1, 1); > > Modified: head/sys/dev/usb/net/if_cue.c > ============================================================================== > --- head/sys/dev/usb/net/if_cue.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/net/if_cue.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -155,7 +155,7 @@ static driver_t cue_driver = { > > static devclass_t cue_devclass; > > -DRIVER_MODULE(cue, ushub, cue_driver, cue_devclass, NULL, 0); > +DRIVER_MODULE(cue, uhub, cue_driver, cue_devclass, NULL, 0); > MODULE_DEPEND(cue, uether, 1, 1, 1); > MODULE_DEPEND(cue, usb, 1, 1, 1); > MODULE_DEPEND(cue, ether, 1, 1, 1); > > Modified: head/sys/dev/usb/net/if_kue.c > ============================================================================== > --- head/sys/dev/usb/net/if_kue.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/net/if_kue.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -198,7 +198,7 @@ static driver_t kue_driver = { > > static devclass_t kue_devclass; > > -DRIVER_MODULE(kue, ushub, kue_driver, kue_devclass, NULL, 0); > +DRIVER_MODULE(kue, uhub, kue_driver, kue_devclass, NULL, 0); > MODULE_DEPEND(kue, uether, 1, 1, 1); > MODULE_DEPEND(kue, usb, 1, 1, 1); > MODULE_DEPEND(kue, ether, 1, 1, 1); > > Modified: head/sys/dev/usb/net/if_rue.c > ============================================================================== > --- head/sys/dev/usb/net/if_rue.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/net/if_rue.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -194,7 +194,7 @@ static driver_t rue_driver = { > > static devclass_t rue_devclass; > > -DRIVER_MODULE(rue, ushub, rue_driver, rue_devclass, NULL, 0); > +DRIVER_MODULE(rue, uhub, rue_driver, rue_devclass, NULL, 0); > DRIVER_MODULE(miibus, rue, miibus_driver, miibus_devclass, 0, 0); > MODULE_DEPEND(rue, uether, 1, 1, 1); > MODULE_DEPEND(rue, usb, 1, 1, 1); > > Modified: head/sys/dev/usb/net/if_udav.c > ============================================================================== > --- head/sys/dev/usb/net/if_udav.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/net/if_udav.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -154,7 +154,7 @@ static driver_t udav_driver = { > > static devclass_t udav_devclass; > > -DRIVER_MODULE(udav, ushub, udav_driver, udav_devclass, NULL, 0); > +DRIVER_MODULE(udav, uhub, udav_driver, udav_devclass, NULL, 0); > DRIVER_MODULE(miibus, udav, miibus_driver, miibus_devclass, 0, 0); > MODULE_DEPEND(udav, uether, 1, 1, 1); > MODULE_DEPEND(udav, usb, 1, 1, 1); > > Modified: head/sys/dev/usb/serial/u3g.c > ============================================================================== > --- head/sys/dev/usb/serial/u3g.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/u3g.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -154,7 +154,7 @@ static driver_t u3g_driver = { > .size = sizeof(struct u3g_softc), > }; > > -DRIVER_MODULE(u3g, ushub, u3g_driver, u3g_devclass, u3g_driver_loaded, 0); > +DRIVER_MODULE(u3g, uhub, u3g_driver, u3g_devclass, u3g_driver_loaded, 0); > MODULE_DEPEND(u3g, ucom, 1, 1, 1); > MODULE_DEPEND(u3g, usb, 1, 1, 1); > > > Modified: head/sys/dev/usb/serial/uark.c > ============================================================================== > --- head/sys/dev/usb/serial/uark.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uark.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -148,7 +148,7 @@ static driver_t uark_driver = { > .size = sizeof(struct uark_softc), > }; > > -DRIVER_MODULE(uark, ushub, uark_driver, uark_devclass, NULL, 0); > +DRIVER_MODULE(uark, uhub, uark_driver, uark_devclass, NULL, 0); > MODULE_DEPEND(uark, ucom, 1, 1, 1); > MODULE_DEPEND(uark, usb, 1, 1, 1); > > > Modified: head/sys/dev/usb/serial/ubsa.c > ============================================================================== > --- head/sys/dev/usb/serial/ubsa.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/ubsa.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -259,7 +259,7 @@ static driver_t ubsa_driver = { > .size = sizeof(struct ubsa_softc), > }; > > -DRIVER_MODULE(ubsa, ushub, ubsa_driver, ubsa_devclass, NULL, 0); > +DRIVER_MODULE(ubsa, uhub, ubsa_driver, ubsa_devclass, NULL, 0); > MODULE_DEPEND(ubsa, ucom, 1, 1, 1); > MODULE_DEPEND(ubsa, usb, 1, 1, 1); > > > Modified: head/sys/dev/usb/serial/ubser.c > ============================================================================== > --- head/sys/dev/usb/serial/ubser.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/ubser.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -197,7 +197,7 @@ static driver_t ubser_driver = { > .size = sizeof(struct ubser_softc), > }; > > -DRIVER_MODULE(ubser, ushub, ubser_driver, ubser_devclass, NULL, 0); > +DRIVER_MODULE(ubser, uhub, ubser_driver, ubser_devclass, NULL, 0); > MODULE_DEPEND(ubser, ucom, 1, 1, 1); > MODULE_DEPEND(ubser, usb, 1, 1, 1); > > > Modified: head/sys/dev/usb/serial/uchcom.c > ============================================================================== > --- head/sys/dev/usb/serial/uchcom.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uchcom.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -882,6 +882,6 @@ static driver_t uchcom_driver = { > > static devclass_t uchcom_devclass; > > -DRIVER_MODULE(uchcom, ushub, uchcom_driver, uchcom_devclass, NULL, 0); > +DRIVER_MODULE(uchcom, uhub, uchcom_driver, uchcom_devclass, NULL, 0); > MODULE_DEPEND(uchcom, ucom, 1, 1, 1); > MODULE_DEPEND(uchcom, usb, 1, 1, 1); > > Modified: head/sys/dev/usb/serial/ucycom.c > ============================================================================== > --- head/sys/dev/usb/serial/ucycom.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/ucycom.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -161,7 +161,7 @@ static driver_t ucycom_driver = { > .size = sizeof(struct ucycom_softc), > }; > > -DRIVER_MODULE(ucycom, ushub, ucycom_driver, ucycom_devclass, NULL, 0); > +DRIVER_MODULE(ucycom, uhub, ucycom_driver, ucycom_devclass, NULL, 0); > MODULE_DEPEND(ucycom, ucom, 1, 1, 1); > MODULE_DEPEND(ucycom, usb, 1, 1, 1); > > > Modified: head/sys/dev/usb/serial/ufoma.c > ============================================================================== > --- head/sys/dev/usb/serial/ufoma.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/ufoma.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -311,7 +311,7 @@ static driver_t ufoma_driver = { > .size = sizeof(struct ufoma_softc), > }; > > -DRIVER_MODULE(ufoma, ushub, ufoma_driver, ufoma_devclass, NULL, 0); > +DRIVER_MODULE(ufoma, uhub, ufoma_driver, ufoma_devclass, NULL, 0); > MODULE_DEPEND(ufoma, ucom, 1, 1, 1); > MODULE_DEPEND(ufoma, usb, 1, 1, 1); > > > Modified: head/sys/dev/usb/serial/uftdi.c > ============================================================================== > --- head/sys/dev/usb/serial/uftdi.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uftdi.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -196,7 +196,7 @@ static driver_t uftdi_driver = { > .size = sizeof(struct uftdi_softc), > }; > > -DRIVER_MODULE(uftdi, ushub, uftdi_driver, uftdi_devclass, NULL, 0); > +DRIVER_MODULE(uftdi, uhub, uftdi_driver, uftdi_devclass, NULL, 0); > MODULE_DEPEND(uftdi, ucom, 1, 1, 1); > MODULE_DEPEND(uftdi, usb, 1, 1, 1); > > > Modified: head/sys/dev/usb/serial/ugensa.c > ============================================================================== > --- head/sys/dev/usb/serial/ugensa.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/ugensa.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -145,7 +145,7 @@ static driver_t ugensa_driver = { > .size = sizeof(struct ugensa_softc), > }; > > -DRIVER_MODULE(ugensa, ushub, ugensa_driver, ugensa_devclass, NULL, 0); > +DRIVER_MODULE(ugensa, uhub, ugensa_driver, ugensa_devclass, NULL, 0); > MODULE_DEPEND(ugensa, ucom, 1, 1, 1); > MODULE_DEPEND(ugensa, usb, 1, 1, 1); > > > Modified: head/sys/dev/usb/serial/uipaq.c > ============================================================================== > --- head/sys/dev/usb/serial/uipaq.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uipaq.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -1069,7 +1069,7 @@ static driver_t uipaq_driver = { > .size = sizeof(struct uipaq_softc), > }; > > -DRIVER_MODULE(uipaq, ushub, uipaq_driver, uipaq_devclass, NULL, 0); > +DRIVER_MODULE(uipaq, uhub, uipaq_driver, uipaq_devclass, NULL, 0); > MODULE_DEPEND(uipaq, ucom, 1, 1, 1); > MODULE_DEPEND(uipaq, usb, 1, 1, 1); > > > Modified: head/sys/dev/usb/serial/ulpt.c > ============================================================================== > --- head/sys/dev/usb/serial/ulpt.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/ulpt.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -717,6 +717,6 @@ static driver_t ulpt_driver = { > .size = sizeof(struct ulpt_softc), > }; > > -DRIVER_MODULE(ulpt, ushub, ulpt_driver, ulpt_devclass, NULL, 0); > +DRIVER_MODULE(ulpt, uhub, ulpt_driver, ulpt_devclass, NULL, 0); > MODULE_DEPEND(ulpt, usb, 1, 1, 1); > MODULE_DEPEND(ulpt, ucom, 1, 1, 1); > > Modified: head/sys/dev/usb/serial/umct.c > ============================================================================== > --- head/sys/dev/usb/serial/umct.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/umct.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -200,7 +200,7 @@ static driver_t umct_driver = { > .size = sizeof(struct umct_softc), > }; > > -DRIVER_MODULE(umct, ushub, umct_driver, umct_devclass, NULL, 0); > +DRIVER_MODULE(umct, uhub, umct_driver, umct_devclass, NULL, 0); > MODULE_DEPEND(umct, ucom, 1, 1, 1); > MODULE_DEPEND(umct, usb, 1, 1, 1); > > > Modified: head/sys/dev/usb/serial/umodem.c > ============================================================================== > --- head/sys/dev/usb/serial/umodem.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/umodem.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -244,7 +244,7 @@ static driver_t umodem_driver = { > .size = sizeof(struct umodem_softc), > }; > > -DRIVER_MODULE(umodem, ushub, umodem_driver, umodem_devclass, NULL, 0); > +DRIVER_MODULE(umodem, uhub, umodem_driver, umodem_devclass, NULL, 0); > MODULE_DEPEND(umodem, ucom, 1, 1, 1); > MODULE_DEPEND(umodem, usb, 1, 1, 1); > MODULE_VERSION(umodem, UMODEM_MODVER); > > Modified: head/sys/dev/usb/serial/umoscom.c > ============================================================================== > --- head/sys/dev/usb/serial/umoscom.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/umoscom.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -261,7 +261,7 @@ static driver_t umoscom_driver = { > .size = sizeof(struct umoscom_softc), > }; > > -DRIVER_MODULE(umoscom, ushub, umoscom_driver, umoscom_devclass, NULL, 0); > +DRIVER_MODULE(umoscom, uhub, umoscom_driver, umoscom_devclass, NULL, 0); > MODULE_DEPEND(umoscom, ucom, 1, 1, 1); > MODULE_DEPEND(umoscom, usb, 1, 1, 1); > > > Modified: head/sys/dev/usb/serial/uplcom.c > ============================================================================== > --- head/sys/dev/usb/serial/uplcom.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uplcom.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -291,7 +291,7 @@ static driver_t uplcom_driver = { > .size = sizeof(struct uplcom_softc), > }; > > -DRIVER_MODULE(uplcom, ushub, uplcom_driver, uplcom_devclass, NULL, 0); > +DRIVER_MODULE(uplcom, uhub, uplcom_driver, uplcom_devclass, NULL, 0); > MODULE_DEPEND(uplcom, ucom, 1, 1, 1); > MODULE_DEPEND(uplcom, usb, 1, 1, 1); > MODULE_VERSION(uplcom, UPLCOM_MODVER); > > Modified: head/sys/dev/usb/serial/uslcom.c > ============================================================================== > --- head/sys/dev/usb/serial/uslcom.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uslcom.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -194,7 +194,7 @@ static driver_t uslcom_driver = { > .size = sizeof(struct uslcom_softc), > }; > > -DRIVER_MODULE(uslcom, ushub, uslcom_driver, uslcom_devclass, NULL, 0); > +DRIVER_MODULE(uslcom, uhub, uslcom_driver, uslcom_devclass, NULL, 0); > MODULE_DEPEND(uslcom, ucom, 1, 1, 1); > MODULE_DEPEND(uslcom, usb, 1, 1, 1); > MODULE_VERSION(uslcom, 1); > > Modified: head/sys/dev/usb/serial/uvisor.c > ============================================================================== > --- head/sys/dev/usb/serial/uvisor.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uvisor.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -235,7 +235,7 @@ static driver_t uvisor_driver = { > .size = sizeof(struct uvisor_softc), > }; > > -DRIVER_MODULE(uvisor, ushub, uvisor_driver, uvisor_devclass, NULL, 0); > +DRIVER_MODULE(uvisor, uhub, uvisor_driver, uvisor_devclass, NULL, 0); > MODULE_DEPEND(uvisor, ucom, 1, 1, 1); > MODULE_DEPEND(uvisor, usb, 1, 1, 1); > > > Modified: head/sys/dev/usb/serial/uvscom.c > ============================================================================== > --- head/sys/dev/usb/serial/uvscom.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uvscom.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -247,7 +247,7 @@ static driver_t uvscom_driver = { > .size = sizeof(struct uvscom_softc), > }; > > -DRIVER_MODULE(uvscom, ushub, uvscom_driver, uvscom_devclass, NULL, 0); > +DRIVER_MODULE(uvscom, uhub, uvscom_driver, uvscom_devclass, NULL, 0); > MODULE_DEPEND(uvscom, ucom, 1, 1, 1); > MODULE_DEPEND(uvscom, usb, 1, 1, 1); > MODULE_VERSION(uvscom, UVSCOM_MODVER); > > Modified: head/sys/dev/usb/storage/umass.c > ============================================================================== > --- head/sys/dev/usb/storage/umass.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/storage/umass.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -1281,7 +1281,7 @@ static driver_t umass_driver = { > .size = sizeof(struct umass_softc), > }; > > -DRIVER_MODULE(umass, ushub, umass_driver, umass_devclass, NULL, 0); > +DRIVER_MODULE(umass, uhub, umass_driver, umass_devclass, NULL, 0); > MODULE_DEPEND(umass, usb, 1, 1, 1); > MODULE_DEPEND(umass, cam, 1, 1, 1); > > > Modified: head/sys/dev/usb/storage/urio.c > ============================================================================== > --- head/sys/dev/usb/storage/urio.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/storage/urio.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -183,7 +183,7 @@ static driver_t urio_driver = { > .size = sizeof(struct urio_softc), > }; > > -DRIVER_MODULE(urio, ushub, urio_driver, urio_devclass, NULL, 0); > +DRIVER_MODULE(urio, uhub, urio_driver, urio_devclass, NULL, 0); > MODULE_DEPEND(urio, usb, 1, 1, 1); > > static int > > Modified: head/sys/dev/usb/storage/ustorage_fs.c > ============================================================================== > --- head/sys/dev/usb/storage/ustorage_fs.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/storage/ustorage_fs.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -229,7 +229,7 @@ static driver_t ustorage_fs_driver = { > > static devclass_t ustorage_fs_devclass; > > -DRIVER_MODULE(ustorage_fs, ushub, ustorage_fs_driver, ustorage_fs_devclass, NULL, 0); > +DRIVER_MODULE(ustorage_fs, uhub, ustorage_fs_driver, ustorage_fs_devclass, NULL, 0); > MODULE_VERSION(ustorage_fs, 0); > MODULE_DEPEND(ustorage_fs, usb, 1, 1, 1); > > > Modified: head/sys/dev/usb/usb_compat_linux.c > ============================================================================== > --- head/sys/dev/usb/usb_compat_linux.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/usb_compat_linux.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -106,7 +106,7 @@ static driver_t usb_linux_driver = { > > static devclass_t usb_linux_devclass; > > -DRIVER_MODULE(usb_linux, ushub, usb_linux_driver, usb_linux_devclass, NULL, 0); > +DRIVER_MODULE(usb_linux, uhub, usb_linux_driver, usb_linux_devclass, NULL, 0); > > /*------------------------------------------------------------------------* > * usb_linux_lookup_id > > Modified: head/sys/dev/usb/usb_hub.c > ============================================================================== > --- head/sys/dev/usb/usb_hub.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/usb_hub.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -126,7 +126,7 @@ static devclass_t uhub_devclass; > > static driver_t uhub_driver = > { > - .name = "ushub", > + .name = "uhub", > .methods = (device_method_t[]){ > DEVMETHOD(device_probe, uhub_probe), > DEVMETHOD(device_attach, uhub_attach), > @@ -144,8 +144,8 @@ static driver_t uhub_driver = > .size = sizeof(struct uhub_softc) > }; > > -DRIVER_MODULE(ushub, usbus, uhub_driver, uhub_devclass, 0, 0); > -DRIVER_MODULE(ushub, ushub, uhub_driver, uhub_devclass, NULL, 0); > +DRIVER_MODULE(uhub, usbus, uhub_driver, uhub_devclass, 0, 0); > +DRIVER_MODULE(uhub, uhub, uhub_driver, uhub_devclass, NULL, 0); > > static void > uhub_intr_callback(struct usb2_xfer *xfer) > > Modified: head/sys/dev/usb/wlan/if_rum.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_rum.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/wlan/if_rum.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -2538,4 +2538,4 @@ static driver_t rum_driver = { > > static devclass_t rum_devclass; > > -DRIVER_MODULE(rum, ushub, rum_driver, rum_devclass, NULL, 0); > +DRIVER_MODULE(rum, uhub, rum_driver, rum_devclass, NULL, 0); > > Modified: head/sys/dev/usb/wlan/if_ural.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_ural.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/wlan/if_ural.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -375,7 +375,7 @@ static driver_t ural_driver = { > > static devclass_t ural_devclass; > > -DRIVER_MODULE(ural, ushub, ural_driver, ural_devclass, NULL, 0); > +DRIVER_MODULE(ural, uhub, ural_driver, ural_devclass, NULL, 0); > MODULE_DEPEND(ural, usb, 1, 1, 1); > MODULE_DEPEND(ural, wlan, 1, 1, 1); > MODULE_DEPEND(ural, wlan_amrr, 1, 1, 1); > > Modified: head/sys/dev/usb/wlan/if_zyd.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_zyd.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/wlan/if_zyd.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -3172,7 +3172,7 @@ static driver_t zyd_driver = { > > static devclass_t zyd_devclass; > > -DRIVER_MODULE(zyd, ushub, zyd_driver, zyd_devclass, NULL, 0); > +DRIVER_MODULE(zyd, uhub, zyd_driver, zyd_devclass, NULL, 0); > MODULE_DEPEND(zyd, usb, 1, 1, 1); > MODULE_DEPEND(zyd, wlan, 1, 1, 1); > MODULE_DEPEND(zyd, wlan_amrr, 1, 1, 1); > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > -- PGP Key : http://www.marcuscom.com/pgp.asc -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090302/1b9b02d4/attachment.pgp From thompsa at FreeBSD.org Sun Mar 1 21:46:26 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Mar 1 21:46:33 2009 Subject: svn commit: r189276 - head/sys/sys Message-ID: <200903020546.n225kP4O066687@svn.freebsd.org> Author: thompsa Date: Mon Mar 2 05:46:25 2009 New Revision: 189276 URL: http://svn.freebsd.org/changeset/base/189276 Log: Bump __FreeBSD_version for the ushub to uhub rename. Requested by: marcus Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Mar 2 05:37:05 2009 (r189275) +++ head/sys/sys/param.h Mon Mar 2 05:46:25 2009 (r189276) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800067 /* Master, propagated to newvers */ +#define __FreeBSD_version 800068 /* Master, propagated to newvers */ #ifndef LOCORE #include From yanefbsd at gmail.com Sun Mar 1 21:46:53 2009 From: yanefbsd at gmail.com (Garrett Cooper) Date: Sun Mar 1 21:47:05 2009 Subject: svn commit: r189275 - in head/sys/dev: ata sound/usb usb usb/bluetooth usb/image usb/input usb/misc usb/net usb/serial usb/storage usb/wlan In-Reply-To: <1235972496.31933.29.camel@shumai.marcuscom.com> References: <200903020537.n225b6QS066433@svn.freebsd.org> <1235972496.31933.29.camel@shumai.marcuscom.com> Message-ID: <7d6fde3d0903012146r7696d91ev599dd11d08ef982f@mail.gmail.com> On Sun, Mar 1, 2009 at 9:41 PM, Joe Marcus Clarke wrote: > On Mon, 2009-03-02 at 05:37 +0000, Andrew Thompson wrote: >> Author: thompsa >> Date: Mon Mar ?2 05:37:05 2009 >> New Revision: 189275 >> URL: http://svn.freebsd.org/changeset/base/189275 >> >> Log: >> ? Rename the ushub device class back to uhub as it was in the old usb stack, >> ? moused(8) looks for "uhub/ums" to decide if needs to load the module. > > This breaks hal. ?Can you bump __FreeBSD_version? > > Joe How does this break hal? -Garrett From marcus at marcuscom.com Sun Mar 1 21:50:09 2009 From: marcus at marcuscom.com (Joe Marcus Clarke) Date: Sun Mar 1 21:50:16 2009 Subject: svn commit: r189275 - in head/sys/dev: ata sound/usb usb usb/bluetooth usb/image usb/input usb/misc usb/net usb/serial usb/storage usb/wlan In-Reply-To: <7d6fde3d0903012146r7696d91ev599dd11d08ef982f@mail.gmail.com> References: <200903020537.n225b6QS066433@svn.freebsd.org> <1235972496.31933.29.camel@shumai.marcuscom.com> <7d6fde3d0903012146r7696d91ev599dd11d08ef982f@mail.gmail.com> Message-ID: <1235973008.31933.32.camel@shumai.marcuscom.com> On Sun, 2009-03-01 at 21:46 -0800, Garrett Cooper wrote: > On Sun, Mar 1, 2009 at 9:41 PM, Joe Marcus Clarke wrote: > > On Mon, 2009-03-02 at 05:37 +0000, Andrew Thompson wrote: > >> Author: thompsa > >> Date: Mon Mar 2 05:37:05 2009 > >> New Revision: 189275 > >> URL: http://svn.freebsd.org/changeset/base/189275 > >> > >> Log: > >> Rename the ushub device class back to uhub as it was in the old usb stack, > >> moused(8) looks for "uhub/ums" to decide if needs to load the module. > > > > This breaks hal. Can you bump __FreeBSD_version? > > > > Joe > > How does this break hal? I was using ushub as a usb2 identifier to plug usb devices into the hal device tree. Simply adding uhub would cause problems with oldusb. Since Andrew just bumped __FreeBSD_version, I can adjust as needed. Joe -- PGP Key : http://www.marcuscom.com/pgp.asc -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090302/f1f3b467/attachment.pgp From yanefbsd at gmail.com Sun Mar 1 21:51:15 2009 From: yanefbsd at gmail.com (Garrett Cooper) Date: Sun Mar 1 21:51:21 2009 Subject: svn commit: r189275 - in head/sys/dev: ata sound/usb usb usb/bluetooth usb/image usb/input usb/misc usb/net usb/serial usb/storage usb/wlan In-Reply-To: <1235973008.31933.32.camel@shumai.marcuscom.com> References: <200903020537.n225b6QS066433@svn.freebsd.org> <1235972496.31933.29.camel@shumai.marcuscom.com> <7d6fde3d0903012146r7696d91ev599dd11d08ef982f@mail.gmail.com> <1235973008.31933.32.camel@shumai.marcuscom.com> Message-ID: <7d6fde3d0903012151hfe698d8he39c9c3596c723c2@mail.gmail.com> On Sun, Mar 1, 2009 at 9:50 PM, Joe Marcus Clarke wrote: > On Sun, 2009-03-01 at 21:46 -0800, Garrett Cooper wrote: >> On Sun, Mar 1, 2009 at 9:41 PM, Joe Marcus Clarke wrote: >> > On Mon, 2009-03-02 at 05:37 +0000, Andrew Thompson wrote: >> >> Author: thompsa >> >> Date: Mon Mar ?2 05:37:05 2009 >> >> New Revision: 189275 >> >> URL: http://svn.freebsd.org/changeset/base/189275 >> >> >> >> Log: >> >> ? Rename the ushub device class back to uhub as it was in the old usb stack, >> >> ? moused(8) looks for "uhub/ums" to decide if needs to load the module. >> > >> > This breaks hal. ?Can you bump __FreeBSD_version? >> > >> > Joe >> >> How does this break hal? > > I was using ushub as a usb2 identifier to plug usb devices into the hal > device tree. ?Simply adding uhub would cause problems with oldusb. > Since Andrew just bumped __FreeBSD_version, I can adjust as needed. > > Joe Ok, fair enough -- thanks for the info :). -Garrett From marcus at marcuscom.com Sun Mar 1 21:52:40 2009 From: marcus at marcuscom.com (Joe Marcus Clarke) Date: Sun Mar 1 21:52:51 2009 Subject: svn commit: r189276 - head/sys/sys In-Reply-To: <200903020546.n225kP4O066687@svn.freebsd.org> References: <200903020546.n225kP4O066687@svn.freebsd.org> Message-ID: <1235973158.31933.33.camel@shumai.marcuscom.com> On Mon, 2009-03-02 at 05:46 +0000, Andrew Thompson wrote: > Author: thompsa > Date: Mon Mar 2 05:46:25 2009 > New Revision: 189276 > URL: http://svn.freebsd.org/changeset/base/189276 > > Log: > Bump __FreeBSD_version for the ushub to uhub rename. Ughhh! Actually, I lied. I should have looked first. I used "usbus" to tie usb2 devices into the hal device tree. Sorry about that. In any event, this might help someone else. Joe -- PGP Key : http://www.marcuscom.com/pgp.asc -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090302/91f3ec10/attachment.pgp From rnoland at FreeBSD.org Sun Mar 1 22:05:16 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Sun Mar 1 22:05:22 2009 Subject: svn commit: r189276 - head/sys/sys In-Reply-To: <1235973158.31933.33.camel@shumai.marcuscom.com> References: <200903020546.n225kP4O066687@svn.freebsd.org> <1235973158.31933.33.camel@shumai.marcuscom.com> Message-ID: <1235973908.1236.41.camel@widget.2hip.net> On Mon, 2009-03-02 at 00:52 -0500, Joe Marcus Clarke wrote: > On Mon, 2009-03-02 at 05:46 +0000, Andrew Thompson wrote: > > Author: thompsa > > Date: Mon Mar 2 05:46:25 2009 > > New Revision: 189276 > > URL: http://svn.freebsd.org/changeset/base/189276 > > > > Log: > > Bump __FreeBSD_version for the ushub to uhub rename. > > Ughhh! Actually, I lied. I should have looked first. I used "usbus" > to tie usb2 devices into the hal device tree. Sorry about that. In any > event, this might help someone else. Numbers are cheap. ;) robert. > Joe -- Robert Noland FreeBSD -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090302/4396d669/attachment.pgp From rwatson at FreeBSD.org Mon Mar 2 02:46:25 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Mar 2 02:46:33 2009 Subject: svn commit: r189277 - in vendor/openbsm/dist: . bin/audit bin/auditd bsm etc libauditd libbsm man sys/bsm tools Message-ID: <200903021046.n22AkNQA072425@svn.freebsd.org> Author: rwatson Date: Mon Mar 2 10:46:23 2009 New Revision: 189277 URL: http://svn.freebsd.org/changeset/base/189277 Log: Vendor import of OpenBSM 1.1 beta1, which incorporates the following changes since the last imported OpenBSM release: OpenBSM 1.1 beta 1 - The filesz parameter in audit_control(5) now accepts suffixes: 'B' for Bytes, 'K' for Kilobytes, 'M' for Megabytes, and 'G' for Gigabytes. For legacy support no suffix defaults to bytes. - Audit trail log expiration support added. It is configured in audit_control(5) with the expire-after parameter. If there is no expire-after parameter in audit_control(5), the default, then the audit trail files are not expired and removed. See audit_control(5) for more information. - Change defaults in audit_control: warn at 5% rather than 20% free for audit partitions, rotate automatically at 2mb, and set the default policy to cnt,argv rather than cnt so that execve(2) arguments are captured if AUE_EXECVE events are audited. These may provide more usable defaults for many users. - Use au_domain_to_bsm(3) and au_socket_type_to_bsm(3) to convert au_to_socket_ex(3) arguments to BSM format. - Fix error encoding AUT_IPC_PERM tokens. Obtained from: TrustedBSD Project Sponsored by: Apple Inc. Modified: vendor/openbsm/dist/CREDITS vendor/openbsm/dist/NEWS vendor/openbsm/dist/README vendor/openbsm/dist/VERSION vendor/openbsm/dist/bin/audit/audit.8 vendor/openbsm/dist/bin/audit/audit.c vendor/openbsm/dist/bin/auditd/audit_warn.c vendor/openbsm/dist/bin/auditd/auditd.c vendor/openbsm/dist/bin/auditd/auditd.h vendor/openbsm/dist/bsm/auditd_lib.h vendor/openbsm/dist/bsm/libbsm.h vendor/openbsm/dist/configure vendor/openbsm/dist/configure.ac vendor/openbsm/dist/etc/audit_control vendor/openbsm/dist/etc/audit_event vendor/openbsm/dist/libauditd/auditd_lib.c vendor/openbsm/dist/libbsm/au_control.3 vendor/openbsm/dist/libbsm/au_domain.3 vendor/openbsm/dist/libbsm/au_errno.3 vendor/openbsm/dist/libbsm/bsm_control.c vendor/openbsm/dist/libbsm/bsm_errno.c vendor/openbsm/dist/libbsm/bsm_io.c vendor/openbsm/dist/libbsm/bsm_token.c vendor/openbsm/dist/man/audit_control.5 vendor/openbsm/dist/man/auditon.2 vendor/openbsm/dist/sys/bsm/audit.h vendor/openbsm/dist/sys/bsm/audit_kevents.h vendor/openbsm/dist/tools/audump.c Modified: vendor/openbsm/dist/CREDITS ============================================================================== --- vendor/openbsm/dist/CREDITS Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/CREDITS Mon Mar 2 10:46:23 2009 (r189277) @@ -27,6 +27,7 @@ the development of OpenBSM: Eric Hall Xin LI Stacey Son + Todd Heberlein In addition, Coverity, Inc.'s Prevent(tm) static analysis tool and Gimpel Software's FlexeLint tool were used to identify a number of bugs in the Modified: vendor/openbsm/dist/NEWS ============================================================================== --- vendor/openbsm/dist/NEWS Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/NEWS Mon Mar 2 10:46:23 2009 (r189277) @@ -1,5 +1,24 @@ OpenBSM Version History +OpenBSM 1.1 beta 1 + +- The filesz parameter in audit_control(5) now accepts suffixes: 'B' for + Bytes, 'K' for Kilobytes, 'M' for Megabytes, and 'G' for Gigabytes. + For legacy support no suffix defaults to bytes. +- Audit trail log expiration support added. It is configured in + audit_control(5) with the expire-after parameter. If there is no + expire-after parameter in audit_control(5), the default, then the audit + trail files are not expired and removed. See audit_control(5) for + more information. +- Change defaults in audit_control: warn at 5% rather than 20% free for audit + partitions, rotate automatically at 2mb, and set the default policy to + cnt,argv rather than cnt so that execve(2) arguments are captured if + AUE_EXECVE events are audited. These may provide more usable defaults for + many users. +- Use au_domain_to_bsm(3) and au_socket_type_to_bsm(3) to convert + au_to_socket_ex(3) arguments to BSM format. +- Fix error encoding AUT_IPC_PERM tokens. + OpenBSM 1.1 alpha 5 - Stub libauditd(3) man page added. @@ -412,4 +431,4 @@ OpenBSM 1.0 alpha 1 to support reloading of kernel event table. - Allow comments in /etc/security configuration files. -$P4: //depot/projects/trustedbsd/openbsm/NEWS#27 $ +$P4: //depot/projects/trustedbsd/openbsm/NEWS#32 $ Modified: vendor/openbsm/dist/README ============================================================================== --- vendor/openbsm/dist/README Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/README Mon Mar 2 10:46:23 2009 (r189277) @@ -1,4 +1,4 @@ -OpenBSM 1.1 alpha 4 +OpenBSM 1.1 beta 1 Introduction @@ -56,4 +56,4 @@ Information on TrustedBSD may be found o http://www.TrustedBSD.org/ -$P4: //depot/projects/trustedbsd/openbsm/README#34 $ +$P4: //depot/projects/trustedbsd/openbsm/README#35 $ Modified: vendor/openbsm/dist/VERSION ============================================================================== --- vendor/openbsm/dist/VERSION Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/VERSION Mon Mar 2 10:46:23 2009 (r189277) @@ -1 +1 @@ -OPENBSM_1_1_ALPHA_5 +OPENBSM_1_1_BETA_1 Modified: vendor/openbsm/dist/bin/audit/audit.8 ============================================================================== --- vendor/openbsm/dist/bin/audit/audit.8 Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/bin/audit/audit.8 Mon Mar 2 10:46:23 2009 (r189277) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2004 Apple Inc. +.\" Copyright (c) 2004-2009 Apple Inc. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,9 +25,9 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.8#13 $ +.\" $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.8#15 $ .\" -.Dd December 11, 2008 +.Dd January 29, 2009 .Dt AUDIT 8 .Os .Sh NAME @@ -35,7 +35,7 @@ .Nd audit management utility .Sh SYNOPSIS .Nm -.Fl i | n | s | t +.Fl e | i | n | s | t .Sh DESCRIPTION The .Nm @@ -43,6 +43,10 @@ utility controls the state of the audit One of the following flags is required as an argument to .Nm : .Bl -tag -width indent +.It Fl e +Forces the audit system to immediately remove audit log files that +meet the expiration criteria specified in the audit control file without +doing a log rotation. .It Fl i Initializes and starts auditing. This option is currently for Mac OS X only @@ -53,6 +57,8 @@ to be configured to run under .It Fl n Forces the audit system to close the existing audit log file and rotate to a new log file in a location specified in the audit control file. +Also, audit log files that meet the expiration criteria specified in the +audit control file will be removed. .It Fl s Specifies that the audit system should [re]synchronize its configuration from the audit control file. Modified: vendor/openbsm/dist/bin/audit/audit.c ============================================================================== --- vendor/openbsm/dist/bin/audit/audit.c Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/bin/audit/audit.c Mon Mar 2 10:46:23 2009 (r189277) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2008 Apple Inc. + * Copyright (c) 2005-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.c#13 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.c#14 $ */ /* * Program to trigger the audit daemon with a message that is either: @@ -68,12 +68,15 @@ static int send_trigger(unsigned int); #include "auditd_control.h" /* - * XXX the following is temporary until this can be added to the kernel + * XXX The following are temporary until these can be added to the kernel * audit.h header. */ #ifndef AUDIT_TRIGGER_INITIALIZE #define AUDIT_TRIGGER_INITIALIZE 7 #endif +#ifndef AUDIT_TRIGGER_EXPIRE_TRAILS +#define AUDIT_TRIGGER_EXPIRE_TRAILS 8 +#endif static int send_trigger(unsigned int trigger) @@ -125,7 +128,7 @@ static void usage(void) { - (void)fprintf(stderr, "Usage: audit -i | -n | -s | -t \n"); + (void)fprintf(stderr, "Usage: audit -e | -i | -n | -s | -t \n"); exit(-1); } @@ -141,9 +144,13 @@ main(int argc, char **argv) if (argc != 2) usage(); - while ((ch = getopt(argc, argv, "inst")) != -1) { + while ((ch = getopt(argc, argv, "einst")) != -1) { switch(ch) { + case 'e': + trigger = AUDIT_TRIGGER_EXPIRE_TRAILS; + break; + case 'i': trigger = AUDIT_TRIGGER_INITIALIZE; break; Modified: vendor/openbsm/dist/bin/auditd/audit_warn.c ============================================================================== --- vendor/openbsm/dist/bin/auditd/audit_warn.c Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/bin/auditd/audit_warn.c Mon Mar 2 10:46:23 2009 (r189277) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Apple Inc. + * Copyright (c) 2005-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/audit_warn.c#10 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/audit_warn.c#11 $ */ #include @@ -236,3 +236,18 @@ audit_warn_tmpfile(void) return (auditwarnlog(args)); } + +/* + * Indicates that this trail file has expired and was removed. + */ +int +audit_warn_expired(char *filename) +{ + char *args[3]; + + args[0] = EXPIRED_WARN; + args[1] = filename; + args[2] = NULL; + + return (auditwarnlog(args)); +} Modified: vendor/openbsm/dist/bin/auditd/auditd.c ============================================================================== --- vendor/openbsm/dist/bin/auditd/auditd.c Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/bin/auditd/auditd.c Mon Mar 2 10:46:23 2009 (r189277) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2008 Apple Inc. + * Copyright (c) 2004-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.c#41 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.c#43 $ */ #include @@ -67,12 +67,16 @@ #endif /* - * XXX the following is temporary until this can be added to the kernel + * XXX The following are temporary until these can be added to the kernel * audit.h header. */ #ifndef AUDIT_TRIGGER_INITIALIZE #define AUDIT_TRIGGER_INITIALIZE 7 #endif +#ifndef AUDIT_TRIGGER_EXPIRE_TRAILS +#define AUDIT_TRIGGER_EXPIRE_TRAILS 8 +#endif + /* * LaunchD flag (Mac OS X and, maybe, FreeBSD only.) See launchd(8) and @@ -166,7 +170,7 @@ close_lastfile(char *TS) /* Rename the last file -- append timestamp. */ if ((ptr = strstr(lastfile, NOT_TERMINATED)) != NULL) { - strlcpy(ptr, TS, TIMESTAMP_LEN); + memcpy(ptr, TS, POSTFIX_LEN); if (rename(oldname, lastfile) != 0) auditd_log_err( "Could not rename %s to %s: %m", oldname, @@ -275,6 +279,14 @@ do_trail_file(void) return (-1); } + /* + * Finally, see if there are any trail files to expire. + */ + err = auditd_expire_trails(audit_warn_expired); + if (err) + auditd_log_err("auditd_expire_trails(): %s", + auditd_strerror(err)); + return (0); } @@ -550,6 +562,14 @@ auditd_handle_trigger(int trigger) audit_setup(); break; + case AUDIT_TRIGGER_EXPIRE_TRAILS: + auditd_log_info("Got audit expire trails trigger"); + err = auditd_expire_trails(audit_warn_expired); + if (err) + auditd_log_err("auditd_expire_trails(): %s", + auditd_strerror(err)); + break; + default: auditd_log_err("Got unknown trigger %d", trigger); break; @@ -669,13 +689,18 @@ auditd_config_controls(void) */ err = auditd_set_host(); if (err) { - auditd_log_err("auditd_set_host() %s: %m", - auditd_strerror(err)); - ret = -1; + if (err == ADE_PARSE) { + auditd_log_notice( + "audit_control(5) may be missing 'host:' field"); + } else { + auditd_log_err("auditd_set_host() %s: %m", + auditd_strerror(err)); + ret = -1; + } } else auditd_log_debug( "Set audit host address information in kernel."); - + return (ret); } Modified: vendor/openbsm/dist/bin/auditd/auditd.h ============================================================================== --- vendor/openbsm/dist/bin/auditd/auditd.h Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/bin/auditd/auditd.h Mon Mar 2 10:46:23 2009 (r189277) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Apple Inc. + * Copyright (c) 2005-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.h#12 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.h#13 $ */ #ifndef _AUDITD_H_ @@ -57,6 +57,7 @@ #define POSTSIGTERM_WARN "postsigterm" #define SOFTLIM_WARN "soft" #define TMPFILE_WARN "tmpfile" +#define EXPIRED_WARN "expired" #define AUDITWARN_SCRIPT "/etc/security/audit_warn" #define AUDITD_PIDFILE "/var/run/auditd.pid" @@ -76,6 +77,7 @@ int audit_warn_nostart(void); int audit_warn_postsigterm(void); int audit_warn_soft(char *filename); int audit_warn_tmpfile(void); +int audit_warn_expired(char *filename); void auditd_openlog(int debug, gid_t gid); void auditd_log_err(const char *fmt, ...); Modified: vendor/openbsm/dist/bsm/auditd_lib.h ============================================================================== --- vendor/openbsm/dist/bsm/auditd_lib.h Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/bsm/auditd_lib.h Mon Mar 2 10:46:23 2009 (r189277) @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bsm/auditd_lib.h#3 $ + * $P4: //depot/projects/trustedbsd/openbsm/bsm/auditd_lib.h#4 $ */ #ifndef _BSM_AUDITD_LIB_H_ @@ -81,12 +81,14 @@ #define ADE_INVAL -16 /* Invalid argument. */ #define ADE_GETADDR -17 /* Error resolving address from hostname. */ #define ADE_ADDRFAM -18 /* Address family not supported. */ +#define ADE_EXPIRE -19 /* Error expiring audit trail files. */ /* * auditd_lib functions. */ const char *auditd_strerror(int errcode); int auditd_set_minfree(void); +int auditd_expire_trails(int (*warn_expired)(char *)); int auditd_read_dirs(int (*warn_soft)(char *), int (*warn_hard)(char *)); void auditd_close_dirs(void); int auditd_set_evcmap(void); Modified: vendor/openbsm/dist/bsm/libbsm.h ============================================================================== --- vendor/openbsm/dist/bsm/libbsm.h Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/bsm/libbsm.h Mon Mar 2 10:46:23 2009 (r189277) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2008 Apple Inc. + * Copyright (c) 2004-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#41 $ + * $P4: //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#42 $ */ #ifndef _LIBBSM_H_ @@ -76,13 +76,14 @@ #define AUDIT_CONTROL_FILE "/etc/security/audit_control" #define AUDIT_USER_FILE "/etc/security/audit_user" -#define DIR_CONTROL_ENTRY "dir" -#define MINFREE_CONTROL_ENTRY "minfree" -#define FILESZ_CONTROL_ENTRY "filesz" -#define FLAGS_CONTROL_ENTRY "flags" -#define NA_CONTROL_ENTRY "naflags" -#define POLICY_CONTROL_ENTRY "policy" +#define DIR_CONTROL_ENTRY "dir" +#define MINFREE_CONTROL_ENTRY "minfree" +#define FILESZ_CONTROL_ENTRY "filesz" +#define FLAGS_CONTROL_ENTRY "flags" +#define NA_CONTROL_ENTRY "naflags" +#define POLICY_CONTROL_ENTRY "policy" #define AUDIT_HOST_CONTROL_ENTRY "host" +#define EXPIRE_AFTER_CONTROL_ENTRY "expire-after" #define AU_CLASS_NAME_MAX 8 #define AU_CLASS_DESC_MAX 72 @@ -766,6 +767,7 @@ int getacflg(char *auditstr, int len) int getacna(char *auditstr, int len); int getacpol(char *auditstr, size_t len); int getachost(char *auditstr, size_t len); +int getacexpire(int *andflg, time_t *age, size_t *size); int getauditflagsbin(char *auditstr, au_mask_t *masks); int getauditflagschar(char *auditstr, au_mask_t *masks, int verbose); Modified: vendor/openbsm/dist/configure ============================================================================== --- vendor/openbsm/dist/configure Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/configure Mon Mar 2 10:46:23 2009 (r189277) @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac P4: //depot/projects/trustedbsd/openbsm/configure.ac#49 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for OpenBSM 1.1alpha5. +# Generated by GNU Autoconf 2.61 for OpenBSM 1.1beta1. # # Report bugs to . # @@ -729,8 +729,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='OpenBSM' PACKAGE_TARNAME='openbsm' -PACKAGE_VERSION='1.1alpha5' -PACKAGE_STRING='OpenBSM 1.1alpha5' +PACKAGE_VERSION='1.1beta1' +PACKAGE_STRING='OpenBSM 1.1beta1' PACKAGE_BUGREPORT='trustedbsd-audit@TrustesdBSD.org' ac_unique_file="bin/auditreduce/auditreduce.c" @@ -1404,7 +1404,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures OpenBSM 1.1alpha5 to adapt to many kinds of systems. +\`configure' configures OpenBSM 1.1beta1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1474,7 +1474,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of OpenBSM 1.1alpha5:";; + short | recursive ) echo "Configuration of OpenBSM 1.1beta1:";; esac cat <<\_ACEOF @@ -1580,7 +1580,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -OpenBSM configure 1.1alpha5 +OpenBSM configure 1.1beta1 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1594,7 +1594,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by OpenBSM $as_me 1.1alpha5, which was +It was created by OpenBSM $as_me 1.1beta1, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -19076,7 +19076,7 @@ fi # Define the identity of the package. PACKAGE=OpenBSM - VERSION=1.1alpha5 + VERSION=1.1beta1 cat >>confdefs.h <<_ACEOF @@ -23584,7 +23584,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by OpenBSM $as_me 1.1alpha5, which was +This file was extended by OpenBSM $as_me 1.1beta1, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23637,7 +23637,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -OpenBSM config.status 1.1alpha5 +OpenBSM config.status 1.1beta1 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Modified: vendor/openbsm/dist/configure.ac ============================================================================== --- vendor/openbsm/dist/configure.ac Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/configure.ac Mon Mar 2 10:46:23 2009 (r189277) @@ -2,8 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([OpenBSM], [1.1alpha5], [trustedbsd-audit@TrustesdBSD.org],[openbsm]) -AC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#49 $]) +AC_INIT([OpenBSM], [1.1beta1], [trustedbsd-audit@TrustesdBSD.org],[openbsm]) +AC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#50 $]) AC_CONFIG_SRCDIR([bin/auditreduce/auditreduce.c]) AC_CONFIG_AUX_DIR(config) AC_CONFIG_HEADER([config/config.h]) Modified: vendor/openbsm/dist/etc/audit_control ============================================================================== --- vendor/openbsm/dist/etc/audit_control Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/etc/audit_control Mon Mar 2 10:46:23 2009 (r189277) @@ -1,9 +1,9 @@ # -# $P4: //depot/projects/trustedbsd/openbsm/etc/audit_control#5 $ +# $P4: //depot/projects/trustedbsd/openbsm/etc/audit_control#6 $ # dir:/var/audit flags:lo -minfree:20 +minfree:5 naflags:lo -policy:cnt -filesz:0 +policy:cnt,argv +filesz:2097152 Modified: vendor/openbsm/dist/etc/audit_event ============================================================================== --- vendor/openbsm/dist/etc/audit_event Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/etc/audit_event Mon Mar 2 10:46:23 2009 (r189277) @@ -1,5 +1,5 @@ # -# $P4: //depot/projects/trustedbsd/openbsm/etc/audit_event#34 $ +# $P4: //depot/projects/trustedbsd/openbsm/etc/audit_event#36 $ # # The mapping between event identifiers and values is also hard-coded in # audit_kevents.h and audit_uevents.h, so changes must occur in both places, @@ -490,7 +490,7 @@ 43128:AUE_MAC_GET_PID:mac_get_pid(2):pc 43129:AUE_MAC_GET_LINK:mac_get_link(2):fa 43130:AUE_MAC_SET_LINK:mac_set_link(2):fm -43131:AUE_MAC_EXECVE:mac_exeve(2):ex,pc +43131:AUE_MAC_EXECVE:mac_execve(2):ex,pc 43132:AUE_GETPATH_FROMFD:getpath_fromfd(2):fa 43133:AUE_GETPATH_FROMADDR:getpath_fromaddr(2):fa 43134:AUE_MQ_OPEN:mq_open(2):ip @@ -551,6 +551,8 @@ 43189:AUE_CAP_GETMODE:cap_getmode(2):pc 43190:AUE_POSIX_SPAWN:posix_spawn(2):pc 43191:AUE_FSGETPATH:fsgetpath(2):ot +43192:AUE_PREAD:pread(2):no +43193:AUE_PWRITE:pwrite(2):no # # Solaris userspace events. # Modified: vendor/openbsm/dist/libauditd/auditd_lib.c ============================================================================== --- vendor/openbsm/dist/libauditd/auditd_lib.c Mon Mar 2 05:46:25 2009 (r189276) +++ vendor/openbsm/dist/libauditd/auditd_lib.c Mon Mar 2 10:46:23 2009 (r189277) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008 Apple Inc. + * Copyright (c) 2008-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#2 $ + * $P4: //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#7 $ */ #include @@ -52,6 +52,7 @@ #include #include +#include #include #include #include @@ -77,6 +78,11 @@ #define AUDIT_HARD_LIMIT_FREE_BLOCKS 4 #endif +/* + * Number of seconds to January 1, 2000 + */ +#define JAN_01_2000 946598400 + struct dir_ent { char *dirname; uint8_t softlim; @@ -85,7 +91,19 @@ struct dir_ent { }; static TAILQ_HEAD(, dir_ent) dir_q; -static int minval = -1; + +struct audit_trail { + time_t at_time; + char *at_path; + off_t at_size; + + TAILQ_ENTRY(audit_trail) at_trls; +}; + +static int auditd_minval = -1; + +static char auditd_host[MAXHOSTNAMELEN]; +static int auditd_hostlen = -1; static char *auditd_errmsg[] = { "no error", /* ADE_NOERR ( 0) */ @@ -107,6 +125,7 @@ static char *auditd_errmsg[] = { "invalid argument", /* ADE_INVAL (16) */ "could not resolve hostname to address", /* ADE_GETADDR (17) */ "address family not supported", /* ADE_ADDRFAM (18) */ + "error expiring audit trail files", /* ADE_EXPIRE (19) */ }; #define MAXERRCODE (sizeof(auditd_errmsg) / sizeof(auditd_errmsg[0])) @@ -165,7 +184,13 @@ affixdir(char *name, struct dir_ent *dir return (NULL); } - asprintf(&fn, "%s/%s", dirent->dirname, name); + /* + * If the host is set then also add the hostname to the filename. + */ + if (auditd_hostlen != -1) + asprintf(&fn, "%s/%s.%s", dirent->dirname, name, auditd_host); + else + asprintf(&fn, "%s/%s", dirent->dirname, name); return (fn); } @@ -204,16 +229,14 @@ insert_orderly(struct dir_ent *denew) int auditd_set_host(void) { - char hoststr[MAXHOSTNAMELEN]; struct sockaddr_in6 *sin6; struct sockaddr_in *sin; struct addrinfo *res; struct auditinfo_addr aia; int error, ret = ADE_NOERR; - if (getachost(hoststr, MAXHOSTNAMELEN) != 0) { - - ret = ADE_PARSE; + if (getachost(auditd_host, sizeof(auditd_host)) != 0) { + ret = ADE_PARSE; /* * To maintain reverse compatability with older audit_control @@ -229,7 +252,8 @@ auditd_set_host(void) ret = ADE_AUDITON; return (ret); } - error = getaddrinfo(hoststr, NULL, NULL, &res); + auditd_hostlen = strlen(auditd_host); + error = getaddrinfo(auditd_host, NULL, NULL, &res); if (error) return (ADE_GETADDR); switch (res->ai_family) { @@ -271,14 +295,14 @@ auditd_set_minfree(void) { au_qctrl_t qctrl; - if (getacmin(&minval) != 0) + if (getacmin(&auditd_minval) != 0) return (ADE_PARSE); if (auditon(A_GETQCTRL, &qctrl, sizeof(qctrl)) != 0) return (ADE_AUDITON); - if (qctrl.aq_minfree != minval) { - qctrl.aq_minfree = minval; + if (qctrl.aq_minfree != auditd_minval) { + qctrl.aq_minfree = auditd_minval; if (auditon(A_SETQCTRL, &qctrl, sizeof(qctrl)) != 0) return (ADE_AUDITON); } @@ -287,9 +311,259 @@ auditd_set_minfree(void) } /* + * Convert a trailname into a timestamp (seconds). Return 0 if the conversion + * was successful. + */ +static int +trailname_to_tstamp(char *fn, time_t *tstamp) +{ + struct tm tm; + char ts[TIMESTAMP_LEN]; + char *p; + + *tstamp = 0; + + /* + * Get the ending time stamp. + */ + if ((p = strchr(fn, '.')) == NULL) + return (1); + strlcpy(ts, ++p, TIMESTAMP_LEN); + if (strlen(ts) != POSTFIX_LEN) + return (1); + + bzero(&tm, sizeof(tm)); + + /* seconds (0-60) */ + p = ts + POSTFIX_LEN - 2; + tm.tm_sec = atol(p); + if (tm.tm_sec < 0 || tm.tm_sec > 60) + return (1); + + /* minutes (0-59) */ + *p = '\0'; p -= 2; + tm.tm_min = atol(p); + if (tm.tm_min < 0 || tm.tm_min > 59) + return (1); + + /* hours (0 - 23) */ + *p = '\0'; p -= 2; + tm.tm_hour = atol(p); + if (tm.tm_hour < 0 || tm.tm_hour > 23) + return (1); + + /* day of month (1-31) */ + *p = '\0'; p -= 2; + tm.tm_mday = atol(p); + if (tm.tm_mday < 1 || tm.tm_mday > 31) + return (1); + + /* month (0 - 11) */ + *p = '\0'; p -= 2; + tm.tm_mon = atol(p) - 1; + if (tm.tm_mon < 0 || tm.tm_mon > 11) + return (1); + + /* year (year - 1900) */ + *p = '\0'; p -= 4; + tm.tm_year = atol(p) - 1900; + if (tm.tm_year < 0) + return (1); + + *tstamp = timegm(&tm); + + return (0); +} + +/* + * Remove audit trails files according to the expiration conditions. Returns: + * ADE_NOERR on success or there is nothing to do. + * ADE_PARSE if error parsing audit_control(5). + * ADE_NOMEM if could not allocate memory. + * ADE_EXPIRE if there was an unespected error. + */ +int +auditd_expire_trails(int (*warn_expired)(char *)) +{ + int andflg, ret = ADE_NOERR; + size_t expire_size, total_size = 0L; + time_t expire_age, oldest_time, current_time = time(NULL); + struct dir_ent *traildir; + struct audit_trail *at; + char *afnp, *pn; + TAILQ_HEAD(au_trls_head, audit_trail) head = + TAILQ_HEAD_INITIALIZER(head); + struct stat stbuf; + char activefn[MAXPATHLEN]; + + /* + * Read the expiration conditions. If no conditions then return no + * error. + */ + if (getacexpire(&andflg, &expire_age, &expire_size) < 0) + return (ADE_PARSE); + if (!expire_age && !expire_size) + return (ADE_NOERR); + + /* + * Read the 'current' trail file name. Trim off directory path. + */ + activefn[0] = '\0'; + readlink(AUDIT_CURRENT_LINK, activefn, MAXPATHLEN - 1); + if ((afnp = strrchr(activefn, '/')) != NULL) + afnp++; + + + /* + * Build tail queue of the trail files. + */ + TAILQ_FOREACH(traildir, &dir_q, dirs) { + DIR *dirp; + struct dirent *dp; + + dirp = opendir(traildir->dirname); + while ((dp = readdir(dirp)) != NULL) { + time_t tstamp = 0; + struct audit_trail *new; + + /* + * Quickly filter non-trail files. + */ + if (dp->d_namlen != (FILENAME_LEN - 1) || +#ifdef DT_REG + dp->d_type != DT_REG || +#endif + dp->d_name[POSTFIX_LEN] != '.') + continue; + + if (asprintf(&pn, "%s/%s", traildir->dirname, + dp->d_name) < 0) { + ret = ADE_NOMEM; + break; + } + + if (stat(pn, &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) { + free(pn); + continue; + } + + total_size += stbuf.st_size; + + /* + * If this is the 'current' audit trail then + * don't add it to the tail queue. + */ + if (NULL != afnp && + strncmp(dp->d_name, afnp, FILENAME_LEN) == 0) { + free(pn); + continue; + } + + /* + * Get the ending time stamp encoded in the trail + * name. If we can't read it or if it is older + * than Jan 1, 2000 then use the mtime. + */ + if (trailname_to_tstamp(dp->d_name, &tstamp) != 0 || + tstamp < JAN_01_2000) + tstamp = stbuf.st_mtime; + + /* + * If the time stamp is older than Jan 1, 2000 then + * update the mtime of the trail file to the current + * time. This is so we don't prematurely remove a trail + * file that was created while the system clock reset + * to the * "beginning of time" but later the system + * clock is set to the correct current time. + */ + if (current_time >= JAN_01_2000 && + tstamp < JAN_01_2000) { + struct timeval tv[2]; + + tstamp = stbuf.st_mtime = current_time; + TIMESPEC_TO_TIMEVAL(&tv[0], + &stbuf.st_atimespec); + TIMESPEC_TO_TIMEVAL(&tv[1], + &stbuf.st_mtimespec); + utimes(pn, tv); + } + + /* + * Allocate and populate the new entry. + */ + new = malloc(sizeof(*new)); + if (NULL == new) { + free(pn); + ret = ADE_NOMEM; + break; + } + new->at_time = tstamp; + new->at_size = stbuf.st_size; + new->at_path = pn; + + /* + * Check to see if we have a new head. Otherwise, + * walk the tailq from the tail first and do a simple + * insertion sort. + */ + if (TAILQ_EMPTY(&head) || + (new->at_time <= TAILQ_FIRST(&head)->at_time)) { + TAILQ_INSERT_HEAD(&head, new, at_trls); + continue; + } + + TAILQ_FOREACH_REVERSE(at, &head, au_trls_head, at_trls) + if (new->at_time >= at->at_time) { + TAILQ_INSERT_AFTER(&head, at, new, + at_trls); + break; + } + + } + } + + oldest_time = current_time - expire_age; + + /* + * Expire trail files, oldest (mtime) first, if the given + * conditions are met. + */ + at = TAILQ_FIRST(&head); + while (NULL != at) { + struct audit_trail *at_next = TAILQ_NEXT(at, at_trls); + + if (andflg) { + if ((expire_size && total_size > expire_size) && + (expire_age && at->at_time < oldest_time)) { + if (warn_expired) + (*warn_expired)(at->at_path); + if (unlink(at->at_path) < 0) + ret = ADE_EXPIRE; + total_size -= at->at_size; + } + } else { + if ((expire_size && total_size > expire_size) || + (expire_age && at->at_time < oldest_time)) { + if (warn_expired) + (*warn_expired)(at->at_path); + if (unlink(at->at_path) < 0) + ret = ADE_EXPIRE; + total_size -= at->at_size; + } + } + + free(at->at_path); + free(at); + at = at_next; + } + + return (ret); +} + +/* * Parses the "dir" entry in audit_control(5) into an ordered list. Also, will - * set the minfree value if not already set. Arguments include function - * pointers to audit_warn functions for soft and hard limits. Returns: + * set the minfree and host values if not already set. Arguments include + * function pointers to audit_warn functions for soft and hard limits. Returns: * ADE_NOERR on success, * ADE_PARSE error parsing audit_control(5), * ADE_AUDITON error getting/setting auditon(2) value, @@ -309,9 +583,12 @@ auditd_read_dirs(int (*warn_soft)(char * int scnt = 0; int hcnt = 0; - if (minval == -1 && (err = auditd_set_minfree()) != 0) + if (auditd_minval == -1 && (err = auditd_set_minfree()) != 0) return (err); + if (auditd_hostlen == -1) + auditd_set_host(); + /* * Init directory q. Force a re-read of the file the next time. */ @@ -329,7 +606,8 @@ auditd_read_dirs(int (*warn_soft)(char * while (getacdir(cur_dir, MAXNAMLEN) >= 0) { if (statfs(cur_dir, &sfs) < 0) continue; /* XXX should warn */ - soft = (sfs.f_bfree < (sfs.f_blocks / (100 / minval))) ? 1 : 0; + soft = (sfs.f_bfree < (sfs.f_blocks / (100 / auditd_minval))) ? + 1 : 0; hard = (sfs.f_bfree < AUDIT_HARD_LIMIT_FREE_BLOCKS) ? 1 : 0; if (soft) { if (warn_soft) @@ -367,7 +645,8 @@ void auditd_close_dirs(void) { free_dir_q(); - minval = -1; + auditd_minval = -1; + auditd_hostlen = -1; } @@ -549,7 +828,7 @@ auditd_swap_trail(char *TS, char **newfi } /* Try until we succeed. */ - while ((dirent = TAILQ_FIRST(&dir_q))) { + TAILQ_FOREACH(dirent, &dir_q, dirs) { if (dirent->hardlim) continue; if ((fn = affixdir(timestr, dirent)) == NULL) @@ -606,6 +885,28 @@ auditd_swap_trail(char *TS, char **newfi * ADE_NOERR on success, * ADE_SETAUDIT if setaudit(2) fails. */ +#ifdef __APPLE__ +int +auditd_prevent_audit(void) +{ + auditinfo_addr_t aia; + + /* + * To prevent event feedback cycles and avoid audit becoming stalled if + * auditing is suspended we mask this processes events from being *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From rwatson at FreeBSD.org Mon Mar 2 02:48:17 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Mar 2 02:48:35 2009 Subject: svn commit: r189278 - vendor/openbsm/1.1-BETA-1 Message-ID: <200903021048.n22AmFGD072514@svn.freebsd.org> Author: rwatson Date: Mon Mar 2 10:48:15 2009 New Revision: 189278 URL: http://svn.freebsd.org/changeset/base/189278 Log: Tag OpenBSM 1.1-beta1 vendor import. Added: vendor/openbsm/1.1-BETA-1/ - copied from r189277, vendor/openbsm/dist/ From ed at 80386.nl Mon Mar 2 03:08:25 2009 From: ed at 80386.nl (Ed Schouten) Date: Mon Mar 2 03:13:17 2009 Subject: svn commit: r189276 - head/sys/sys In-Reply-To: <1235973908.1236.41.camel@widget.2hip.net> References: <200903020546.n225kP4O066687@svn.freebsd.org> <1235973158.31933.33.camel@shumai.marcuscom.com> <1235973908.1236.41.camel@widget.2hip.net> Message-ID: <20090302110737.GG19161@hoeg.nl> * Robert Noland wrote: > On Mon, 2009-03-02 at 00:52 -0500, Joe Marcus Clarke wrote: > > On Mon, 2009-03-02 at 05:46 +0000, Andrew Thompson wrote: > > > Author: thompsa > > > Date: Mon Mar 2 05:46:25 2009 > > > New Revision: 189276 > > > URL: http://svn.freebsd.org/changeset/base/189276 > > > > > > Log: > > > Bump __FreeBSD_version for the ushub to uhub rename. > > > > Ughhh! Actually, I lied. I should have looked first. I used "usbus" > > to tie usb2 devices into the hal device tree. Sorry about that. In any > > event, this might help someone else. > > Numbers are cheap. ;) Even though we only have 32 left before we reach 800100. 7.0-RELEASE carried the number 700100, but I guess nothing stops us from picking a different number. ;-) -- Ed Schouten WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090302/3cf674bb/attachment.pgp From rwatson at FreeBSD.org Mon Mar 2 05:29:19 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Mar 2 05:29:33 2009 Subject: svn commit: r189279 - in head: contrib/openbsm contrib/openbsm/bin/audit contrib/openbsm/bin/auditd contrib/openbsm/bsm contrib/openbsm/etc contrib/openbsm/libauditd contrib/openbsm/libbsm contrib/... Message-ID: <200903021329.n22DTIe3077152@svn.freebsd.org> Author: rwatson Date: Mon Mar 2 13:29:18 2009 New Revision: 189279 URL: http://svn.freebsd.org/changeset/base/189279 Log: Merge OpenBSM 1.1 beta 1 from OpenBSM vendor branch to head, both contrib/openbsm (svn merge) and src/sys/{bsm,security/audit} (manual merge). OpenBSM history for imported revision below for reference. MFC after: 1 month Sponsored by: Apple, Inc. Obtained from: TrustedBSD Project OpenBSM 1.1 beta 1 - The filesz parameter in audit_control(5) now accepts suffixes: 'B' for Bytes, 'K' for Kilobytes, 'M' for Megabytes, and 'G' for Gigabytes. For legacy support no suffix defaults to bytes. - Audit trail log expiration support added. It is configured in audit_control(5) with the expire-after parameter. If there is no expire-after parameter in audit_control(5), the default, then the audit trail files are not expired and removed. See audit_control(5) for more information. - Change defaults in audit_control: warn at 5% rather than 20% free for audit partitions, rotate automatically at 2mb, and set the default policy to cnt,argv rather than cnt so that execve(2) arguments are captured if AUE_EXECVE events are audited. These may provide more usable defaults for many users. - Use au_domain_to_bsm(3) and au_socket_type_to_bsm(3) to convert au_to_socket_ex(3) arguments to BSM format. - Fix error encoding AUT_IPC_PERM tokens. Modified: head/contrib/openbsm/ (props changed) head/contrib/openbsm/CREDITS head/contrib/openbsm/NEWS head/contrib/openbsm/README head/contrib/openbsm/VERSION head/contrib/openbsm/bin/audit/audit.8 head/contrib/openbsm/bin/audit/audit.c head/contrib/openbsm/bin/auditd/audit_warn.c head/contrib/openbsm/bin/auditd/auditd.c head/contrib/openbsm/bin/auditd/auditd.h head/contrib/openbsm/bsm/auditd_lib.h head/contrib/openbsm/bsm/libbsm.h head/contrib/openbsm/configure head/contrib/openbsm/configure.ac head/contrib/openbsm/etc/audit_control head/contrib/openbsm/etc/audit_event head/contrib/openbsm/libauditd/auditd_lib.c head/contrib/openbsm/libbsm/au_control.3 head/contrib/openbsm/libbsm/au_domain.3 head/contrib/openbsm/libbsm/au_errno.3 head/contrib/openbsm/libbsm/bsm_control.c head/contrib/openbsm/libbsm/bsm_errno.c head/contrib/openbsm/libbsm/bsm_io.c head/contrib/openbsm/libbsm/bsm_token.c head/contrib/openbsm/man/audit_control.5 head/contrib/openbsm/man/auditon.2 head/contrib/openbsm/sys/bsm/audit.h head/contrib/openbsm/sys/bsm/audit_kevents.h head/contrib/openbsm/tools/audump.c head/sys/bsm/audit.h head/sys/bsm/audit_kevents.h head/sys/security/audit/audit_bsm_errno.c head/sys/security/audit/audit_bsm_token.c Modified: head/contrib/openbsm/CREDITS ============================================================================== --- head/contrib/openbsm/CREDITS Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/CREDITS Mon Mar 2 13:29:18 2009 (r189279) @@ -27,6 +27,7 @@ the development of OpenBSM: Eric Hall Xin LI Stacey Son + Todd Heberlein In addition, Coverity, Inc.'s Prevent(tm) static analysis tool and Gimpel Software's FlexeLint tool were used to identify a number of bugs in the Modified: head/contrib/openbsm/NEWS ============================================================================== --- head/contrib/openbsm/NEWS Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/NEWS Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,24 @@ OpenBSM Version History +OpenBSM 1.1 beta 1 + +- The filesz parameter in audit_control(5) now accepts suffixes: 'B' for + Bytes, 'K' for Kilobytes, 'M' for Megabytes, and 'G' for Gigabytes. + For legacy support no suffix defaults to bytes. +- Audit trail log expiration support added. It is configured in + audit_control(5) with the expire-after parameter. If there is no + expire-after parameter in audit_control(5), the default, then the audit + trail files are not expired and removed. See audit_control(5) for + more information. +- Change defaults in audit_control: warn at 5% rather than 20% free for audit + partitions, rotate automatically at 2mb, and set the default policy to + cnt,argv rather than cnt so that execve(2) arguments are captured if + AUE_EXECVE events are audited. These may provide more usable defaults for + many users. +- Use au_domain_to_bsm(3) and au_socket_type_to_bsm(3) to convert + au_to_socket_ex(3) arguments to BSM format. +- Fix error encoding AUT_IPC_PERM tokens. + OpenBSM 1.1 alpha 5 - Stub libauditd(3) man page added. @@ -412,4 +431,4 @@ OpenBSM 1.0 alpha 1 to support reloading of kernel event table. - Allow comments in /etc/security configuration files. -$P4: //depot/projects/trustedbsd/openbsm/NEWS#27 $ +$P4: //depot/projects/trustedbsd/openbsm/NEWS#32 $ Modified: head/contrib/openbsm/README ============================================================================== --- head/contrib/openbsm/README Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/README Mon Mar 2 13:29:18 2009 (r189279) @@ -1,4 +1,4 @@ -OpenBSM 1.1 alpha 4 +OpenBSM 1.1 beta 1 Introduction @@ -56,4 +56,4 @@ Information on TrustedBSD may be found o http://www.TrustedBSD.org/ -$P4: //depot/projects/trustedbsd/openbsm/README#34 $ +$P4: //depot/projects/trustedbsd/openbsm/README#35 $ Modified: head/contrib/openbsm/VERSION ============================================================================== --- head/contrib/openbsm/VERSION Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/VERSION Mon Mar 2 13:29:18 2009 (r189279) @@ -1 +1 @@ -OPENBSM_1_1_ALPHA_5 +OPENBSM_1_1_BETA_1 Modified: head/contrib/openbsm/bin/audit/audit.8 ============================================================================== --- head/contrib/openbsm/bin/audit/audit.8 Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/bin/audit/audit.8 Mon Mar 2 13:29:18 2009 (r189279) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2004 Apple Inc. +.\" Copyright (c) 2004-2009 Apple Inc. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,9 +25,9 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.8#13 $ +.\" $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.8#15 $ .\" -.Dd December 11, 2008 +.Dd January 29, 2009 .Dt AUDIT 8 .Os .Sh NAME @@ -35,7 +35,7 @@ .Nd audit management utility .Sh SYNOPSIS .Nm -.Fl i | n | s | t +.Fl e | i | n | s | t .Sh DESCRIPTION The .Nm @@ -43,6 +43,10 @@ utility controls the state of the audit One of the following flags is required as an argument to .Nm : .Bl -tag -width indent +.It Fl e +Forces the audit system to immediately remove audit log files that +meet the expiration criteria specified in the audit control file without +doing a log rotation. .It Fl i Initializes and starts auditing. This option is currently for Mac OS X only @@ -53,6 +57,8 @@ to be configured to run under .It Fl n Forces the audit system to close the existing audit log file and rotate to a new log file in a location specified in the audit control file. +Also, audit log files that meet the expiration criteria specified in the +audit control file will be removed. .It Fl s Specifies that the audit system should [re]synchronize its configuration from the audit control file. Modified: head/contrib/openbsm/bin/audit/audit.c ============================================================================== --- head/contrib/openbsm/bin/audit/audit.c Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/bin/audit/audit.c Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2008 Apple Inc. + * Copyright (c) 2005-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.c#13 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.c#14 $ */ /* * Program to trigger the audit daemon with a message that is either: @@ -68,12 +68,15 @@ static int send_trigger(unsigned int); #include "auditd_control.h" /* - * XXX the following is temporary until this can be added to the kernel + * XXX The following are temporary until these can be added to the kernel * audit.h header. */ #ifndef AUDIT_TRIGGER_INITIALIZE #define AUDIT_TRIGGER_INITIALIZE 7 #endif +#ifndef AUDIT_TRIGGER_EXPIRE_TRAILS +#define AUDIT_TRIGGER_EXPIRE_TRAILS 8 +#endif static int send_trigger(unsigned int trigger) @@ -125,7 +128,7 @@ static void usage(void) { - (void)fprintf(stderr, "Usage: audit -i | -n | -s | -t \n"); + (void)fprintf(stderr, "Usage: audit -e | -i | -n | -s | -t \n"); exit(-1); } @@ -141,9 +144,13 @@ main(int argc, char **argv) if (argc != 2) usage(); - while ((ch = getopt(argc, argv, "inst")) != -1) { + while ((ch = getopt(argc, argv, "einst")) != -1) { switch(ch) { + case 'e': + trigger = AUDIT_TRIGGER_EXPIRE_TRAILS; + break; + case 'i': trigger = AUDIT_TRIGGER_INITIALIZE; break; Modified: head/contrib/openbsm/bin/auditd/audit_warn.c ============================================================================== --- head/contrib/openbsm/bin/auditd/audit_warn.c Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/bin/auditd/audit_warn.c Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Apple Inc. + * Copyright (c) 2005-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/audit_warn.c#10 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/audit_warn.c#11 $ */ #include @@ -236,3 +236,18 @@ audit_warn_tmpfile(void) return (auditwarnlog(args)); } + +/* + * Indicates that this trail file has expired and was removed. + */ +int +audit_warn_expired(char *filename) +{ + char *args[3]; + + args[0] = EXPIRED_WARN; + args[1] = filename; + args[2] = NULL; + + return (auditwarnlog(args)); +} Modified: head/contrib/openbsm/bin/auditd/auditd.c ============================================================================== --- head/contrib/openbsm/bin/auditd/auditd.c Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/bin/auditd/auditd.c Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2008 Apple Inc. + * Copyright (c) 2004-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.c#41 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.c#43 $ */ #include @@ -67,12 +67,16 @@ #endif /* - * XXX the following is temporary until this can be added to the kernel + * XXX The following are temporary until these can be added to the kernel * audit.h header. */ #ifndef AUDIT_TRIGGER_INITIALIZE #define AUDIT_TRIGGER_INITIALIZE 7 #endif +#ifndef AUDIT_TRIGGER_EXPIRE_TRAILS +#define AUDIT_TRIGGER_EXPIRE_TRAILS 8 +#endif + /* * LaunchD flag (Mac OS X and, maybe, FreeBSD only.) See launchd(8) and @@ -166,7 +170,7 @@ close_lastfile(char *TS) /* Rename the last file -- append timestamp. */ if ((ptr = strstr(lastfile, NOT_TERMINATED)) != NULL) { - strlcpy(ptr, TS, TIMESTAMP_LEN); + memcpy(ptr, TS, POSTFIX_LEN); if (rename(oldname, lastfile) != 0) auditd_log_err( "Could not rename %s to %s: %m", oldname, @@ -275,6 +279,14 @@ do_trail_file(void) return (-1); } + /* + * Finally, see if there are any trail files to expire. + */ + err = auditd_expire_trails(audit_warn_expired); + if (err) + auditd_log_err("auditd_expire_trails(): %s", + auditd_strerror(err)); + return (0); } @@ -550,6 +562,14 @@ auditd_handle_trigger(int trigger) audit_setup(); break; + case AUDIT_TRIGGER_EXPIRE_TRAILS: + auditd_log_info("Got audit expire trails trigger"); + err = auditd_expire_trails(audit_warn_expired); + if (err) + auditd_log_err("auditd_expire_trails(): %s", + auditd_strerror(err)); + break; + default: auditd_log_err("Got unknown trigger %d", trigger); break; @@ -669,13 +689,18 @@ auditd_config_controls(void) */ err = auditd_set_host(); if (err) { - auditd_log_err("auditd_set_host() %s: %m", - auditd_strerror(err)); - ret = -1; + if (err == ADE_PARSE) { + auditd_log_notice( + "audit_control(5) may be missing 'host:' field"); + } else { + auditd_log_err("auditd_set_host() %s: %m", + auditd_strerror(err)); + ret = -1; + } } else auditd_log_debug( "Set audit host address information in kernel."); - + return (ret); } Modified: head/contrib/openbsm/bin/auditd/auditd.h ============================================================================== --- head/contrib/openbsm/bin/auditd/auditd.h Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/bin/auditd/auditd.h Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Apple Inc. + * Copyright (c) 2005-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.h#12 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.h#13 $ */ #ifndef _AUDITD_H_ @@ -57,6 +57,7 @@ #define POSTSIGTERM_WARN "postsigterm" #define SOFTLIM_WARN "soft" #define TMPFILE_WARN "tmpfile" +#define EXPIRED_WARN "expired" #define AUDITWARN_SCRIPT "/etc/security/audit_warn" #define AUDITD_PIDFILE "/var/run/auditd.pid" @@ -76,6 +77,7 @@ int audit_warn_nostart(void); int audit_warn_postsigterm(void); int audit_warn_soft(char *filename); int audit_warn_tmpfile(void); +int audit_warn_expired(char *filename); void auditd_openlog(int debug, gid_t gid); void auditd_log_err(const char *fmt, ...); Modified: head/contrib/openbsm/bsm/auditd_lib.h ============================================================================== --- head/contrib/openbsm/bsm/auditd_lib.h Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/bsm/auditd_lib.h Mon Mar 2 13:29:18 2009 (r189279) @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bsm/auditd_lib.h#3 $ + * $P4: //depot/projects/trustedbsd/openbsm/bsm/auditd_lib.h#4 $ */ #ifndef _BSM_AUDITD_LIB_H_ @@ -81,12 +81,14 @@ #define ADE_INVAL -16 /* Invalid argument. */ #define ADE_GETADDR -17 /* Error resolving address from hostname. */ #define ADE_ADDRFAM -18 /* Address family not supported. */ +#define ADE_EXPIRE -19 /* Error expiring audit trail files. */ /* * auditd_lib functions. */ const char *auditd_strerror(int errcode); int auditd_set_minfree(void); +int auditd_expire_trails(int (*warn_expired)(char *)); int auditd_read_dirs(int (*warn_soft)(char *), int (*warn_hard)(char *)); void auditd_close_dirs(void); int auditd_set_evcmap(void); Modified: head/contrib/openbsm/bsm/libbsm.h ============================================================================== --- head/contrib/openbsm/bsm/libbsm.h Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/bsm/libbsm.h Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2008 Apple Inc. + * Copyright (c) 2004-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#41 $ + * $P4: //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#42 $ */ #ifndef _LIBBSM_H_ @@ -76,13 +76,14 @@ #define AUDIT_CONTROL_FILE "/etc/security/audit_control" #define AUDIT_USER_FILE "/etc/security/audit_user" -#define DIR_CONTROL_ENTRY "dir" -#define MINFREE_CONTROL_ENTRY "minfree" -#define FILESZ_CONTROL_ENTRY "filesz" -#define FLAGS_CONTROL_ENTRY "flags" -#define NA_CONTROL_ENTRY "naflags" -#define POLICY_CONTROL_ENTRY "policy" +#define DIR_CONTROL_ENTRY "dir" +#define MINFREE_CONTROL_ENTRY "minfree" +#define FILESZ_CONTROL_ENTRY "filesz" +#define FLAGS_CONTROL_ENTRY "flags" +#define NA_CONTROL_ENTRY "naflags" +#define POLICY_CONTROL_ENTRY "policy" #define AUDIT_HOST_CONTROL_ENTRY "host" +#define EXPIRE_AFTER_CONTROL_ENTRY "expire-after" #define AU_CLASS_NAME_MAX 8 #define AU_CLASS_DESC_MAX 72 @@ -766,6 +767,7 @@ int getacflg(char *auditstr, int len) int getacna(char *auditstr, int len); int getacpol(char *auditstr, size_t len); int getachost(char *auditstr, size_t len); +int getacexpire(int *andflg, time_t *age, size_t *size); int getauditflagsbin(char *auditstr, au_mask_t *masks); int getauditflagschar(char *auditstr, au_mask_t *masks, int verbose); Modified: head/contrib/openbsm/configure ============================================================================== --- head/contrib/openbsm/configure Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/configure Mon Mar 2 13:29:18 2009 (r189279) @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac P4: //depot/projects/trustedbsd/openbsm/configure.ac#49 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for OpenBSM 1.1alpha5. +# Generated by GNU Autoconf 2.61 for OpenBSM 1.1beta1. # # Report bugs to . # @@ -729,8 +729,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='OpenBSM' PACKAGE_TARNAME='openbsm' -PACKAGE_VERSION='1.1alpha5' -PACKAGE_STRING='OpenBSM 1.1alpha5' +PACKAGE_VERSION='1.1beta1' +PACKAGE_STRING='OpenBSM 1.1beta1' PACKAGE_BUGREPORT='trustedbsd-audit@TrustesdBSD.org' ac_unique_file="bin/auditreduce/auditreduce.c" @@ -1404,7 +1404,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures OpenBSM 1.1alpha5 to adapt to many kinds of systems. +\`configure' configures OpenBSM 1.1beta1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1474,7 +1474,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of OpenBSM 1.1alpha5:";; + short | recursive ) echo "Configuration of OpenBSM 1.1beta1:";; esac cat <<\_ACEOF @@ -1580,7 +1580,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -OpenBSM configure 1.1alpha5 +OpenBSM configure 1.1beta1 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1594,7 +1594,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by OpenBSM $as_me 1.1alpha5, which was +It was created by OpenBSM $as_me 1.1beta1, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -19076,7 +19076,7 @@ fi # Define the identity of the package. PACKAGE=OpenBSM - VERSION=1.1alpha5 + VERSION=1.1beta1 cat >>confdefs.h <<_ACEOF @@ -23584,7 +23584,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by OpenBSM $as_me 1.1alpha5, which was +This file was extended by OpenBSM $as_me 1.1beta1, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23637,7 +23637,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -OpenBSM config.status 1.1alpha5 +OpenBSM config.status 1.1beta1 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Modified: head/contrib/openbsm/configure.ac ============================================================================== --- head/contrib/openbsm/configure.ac Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/configure.ac Mon Mar 2 13:29:18 2009 (r189279) @@ -2,8 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([OpenBSM], [1.1alpha5], [trustedbsd-audit@TrustesdBSD.org],[openbsm]) -AC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#49 $]) +AC_INIT([OpenBSM], [1.1beta1], [trustedbsd-audit@TrustesdBSD.org],[openbsm]) +AC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#50 $]) AC_CONFIG_SRCDIR([bin/auditreduce/auditreduce.c]) AC_CONFIG_AUX_DIR(config) AC_CONFIG_HEADER([config/config.h]) Modified: head/contrib/openbsm/etc/audit_control ============================================================================== --- head/contrib/openbsm/etc/audit_control Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/etc/audit_control Mon Mar 2 13:29:18 2009 (r189279) @@ -1,10 +1,10 @@ # -# $P4: //depot/projects/trustedbsd/openbsm/etc/audit_control#5 $ +# $P4: //depot/projects/trustedbsd/openbsm/etc/audit_control#6 $ # $FreeBSD$ # dir:/var/audit flags:lo -minfree:20 +minfree:5 naflags:lo -policy:cnt -filesz:0 +policy:cnt,argv +filesz:2097152 Modified: head/contrib/openbsm/etc/audit_event ============================================================================== --- head/contrib/openbsm/etc/audit_event Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/etc/audit_event Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,5 @@ # -# $P4: //depot/projects/trustedbsd/openbsm/etc/audit_event#34 $ +# $P4: //depot/projects/trustedbsd/openbsm/etc/audit_event#36 $ # $FreeBSD$ # # The mapping between event identifiers and values is also hard-coded in @@ -491,7 +491,7 @@ 43128:AUE_MAC_GET_PID:mac_get_pid(2):pc 43129:AUE_MAC_GET_LINK:mac_get_link(2):fa 43130:AUE_MAC_SET_LINK:mac_set_link(2):fm -43131:AUE_MAC_EXECVE:mac_exeve(2):ex,pc +43131:AUE_MAC_EXECVE:mac_execve(2):ex,pc 43132:AUE_GETPATH_FROMFD:getpath_fromfd(2):fa 43133:AUE_GETPATH_FROMADDR:getpath_fromaddr(2):fa 43134:AUE_MQ_OPEN:mq_open(2):ip @@ -552,6 +552,8 @@ 43189:AUE_CAP_GETMODE:cap_getmode(2):pc 43190:AUE_POSIX_SPAWN:posix_spawn(2):pc 43191:AUE_FSGETPATH:fsgetpath(2):ot +43192:AUE_PREAD:pread(2):no +43193:AUE_PWRITE:pwrite(2):no # # Solaris userspace events. # Modified: head/contrib/openbsm/libauditd/auditd_lib.c ============================================================================== --- head/contrib/openbsm/libauditd/auditd_lib.c Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/libauditd/auditd_lib.c Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008 Apple Inc. + * Copyright (c) 2008-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#2 $ + * $P4: //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#7 $ */ #include @@ -52,6 +52,7 @@ #include #include +#include #include #include #include @@ -77,6 +78,11 @@ #define AUDIT_HARD_LIMIT_FREE_BLOCKS 4 #endif +/* + * Number of seconds to January 1, 2000 + */ +#define JAN_01_2000 946598400 + struct dir_ent { char *dirname; uint8_t softlim; @@ -85,7 +91,19 @@ struct dir_ent { }; static TAILQ_HEAD(, dir_ent) dir_q; -static int minval = -1; + +struct audit_trail { + time_t at_time; + char *at_path; + off_t at_size; + + TAILQ_ENTRY(audit_trail) at_trls; +}; + +static int auditd_minval = -1; + +static char auditd_host[MAXHOSTNAMELEN]; +static int auditd_hostlen = -1; static char *auditd_errmsg[] = { "no error", /* ADE_NOERR ( 0) */ @@ -107,6 +125,7 @@ static char *auditd_errmsg[] = { "invalid argument", /* ADE_INVAL (16) */ "could not resolve hostname to address", /* ADE_GETADDR (17) */ "address family not supported", /* ADE_ADDRFAM (18) */ + "error expiring audit trail files", /* ADE_EXPIRE (19) */ }; #define MAXERRCODE (sizeof(auditd_errmsg) / sizeof(auditd_errmsg[0])) @@ -165,7 +184,13 @@ affixdir(char *name, struct dir_ent *dir return (NULL); } - asprintf(&fn, "%s/%s", dirent->dirname, name); + /* + * If the host is set then also add the hostname to the filename. + */ + if (auditd_hostlen != -1) + asprintf(&fn, "%s/%s.%s", dirent->dirname, name, auditd_host); + else + asprintf(&fn, "%s/%s", dirent->dirname, name); return (fn); } @@ -204,16 +229,14 @@ insert_orderly(struct dir_ent *denew) int auditd_set_host(void) { - char hoststr[MAXHOSTNAMELEN]; struct sockaddr_in6 *sin6; struct sockaddr_in *sin; struct addrinfo *res; struct auditinfo_addr aia; int error, ret = ADE_NOERR; - if (getachost(hoststr, MAXHOSTNAMELEN) != 0) { - - ret = ADE_PARSE; + if (getachost(auditd_host, sizeof(auditd_host)) != 0) { + ret = ADE_PARSE; /* * To maintain reverse compatability with older audit_control @@ -229,7 +252,8 @@ auditd_set_host(void) ret = ADE_AUDITON; return (ret); } - error = getaddrinfo(hoststr, NULL, NULL, &res); + auditd_hostlen = strlen(auditd_host); + error = getaddrinfo(auditd_host, NULL, NULL, &res); if (error) return (ADE_GETADDR); switch (res->ai_family) { @@ -271,14 +295,14 @@ auditd_set_minfree(void) { au_qctrl_t qctrl; - if (getacmin(&minval) != 0) + if (getacmin(&auditd_minval) != 0) return (ADE_PARSE); if (auditon(A_GETQCTRL, &qctrl, sizeof(qctrl)) != 0) return (ADE_AUDITON); - if (qctrl.aq_minfree != minval) { - qctrl.aq_minfree = minval; + if (qctrl.aq_minfree != auditd_minval) { + qctrl.aq_minfree = auditd_minval; if (auditon(A_SETQCTRL, &qctrl, sizeof(qctrl)) != 0) return (ADE_AUDITON); } @@ -287,9 +311,259 @@ auditd_set_minfree(void) } /* + * Convert a trailname into a timestamp (seconds). Return 0 if the conversion + * was successful. + */ +static int +trailname_to_tstamp(char *fn, time_t *tstamp) +{ + struct tm tm; + char ts[TIMESTAMP_LEN]; + char *p; + + *tstamp = 0; + + /* + * Get the ending time stamp. + */ + if ((p = strchr(fn, '.')) == NULL) + return (1); + strlcpy(ts, ++p, TIMESTAMP_LEN); + if (strlen(ts) != POSTFIX_LEN) + return (1); + + bzero(&tm, sizeof(tm)); + + /* seconds (0-60) */ + p = ts + POSTFIX_LEN - 2; + tm.tm_sec = atol(p); + if (tm.tm_sec < 0 || tm.tm_sec > 60) + return (1); + + /* minutes (0-59) */ + *p = '\0'; p -= 2; + tm.tm_min = atol(p); + if (tm.tm_min < 0 || tm.tm_min > 59) + return (1); + + /* hours (0 - 23) */ + *p = '\0'; p -= 2; + tm.tm_hour = atol(p); + if (tm.tm_hour < 0 || tm.tm_hour > 23) + return (1); + + /* day of month (1-31) */ + *p = '\0'; p -= 2; + tm.tm_mday = atol(p); + if (tm.tm_mday < 1 || tm.tm_mday > 31) + return (1); + + /* month (0 - 11) */ + *p = '\0'; p -= 2; + tm.tm_mon = atol(p) - 1; + if (tm.tm_mon < 0 || tm.tm_mon > 11) + return (1); + + /* year (year - 1900) */ + *p = '\0'; p -= 4; + tm.tm_year = atol(p) - 1900; + if (tm.tm_year < 0) + return (1); + + *tstamp = timegm(&tm); + + return (0); +} + +/* + * Remove audit trails files according to the expiration conditions. Returns: + * ADE_NOERR on success or there is nothing to do. + * ADE_PARSE if error parsing audit_control(5). + * ADE_NOMEM if could not allocate memory. + * ADE_EXPIRE if there was an unespected error. + */ +int +auditd_expire_trails(int (*warn_expired)(char *)) +{ + int andflg, ret = ADE_NOERR; + size_t expire_size, total_size = 0L; + time_t expire_age, oldest_time, current_time = time(NULL); + struct dir_ent *traildir; + struct audit_trail *at; + char *afnp, *pn; + TAILQ_HEAD(au_trls_head, audit_trail) head = + TAILQ_HEAD_INITIALIZER(head); + struct stat stbuf; + char activefn[MAXPATHLEN]; + + /* + * Read the expiration conditions. If no conditions then return no + * error. + */ + if (getacexpire(&andflg, &expire_age, &expire_size) < 0) + return (ADE_PARSE); + if (!expire_age && !expire_size) + return (ADE_NOERR); + + /* + * Read the 'current' trail file name. Trim off directory path. + */ + activefn[0] = '\0'; + readlink(AUDIT_CURRENT_LINK, activefn, MAXPATHLEN - 1); + if ((afnp = strrchr(activefn, '/')) != NULL) + afnp++; + + + /* + * Build tail queue of the trail files. + */ + TAILQ_FOREACH(traildir, &dir_q, dirs) { + DIR *dirp; + struct dirent *dp; + + dirp = opendir(traildir->dirname); + while ((dp = readdir(dirp)) != NULL) { + time_t tstamp = 0; + struct audit_trail *new; + + /* + * Quickly filter non-trail files. + */ + if (dp->d_namlen != (FILENAME_LEN - 1) || +#ifdef DT_REG + dp->d_type != DT_REG || +#endif + dp->d_name[POSTFIX_LEN] != '.') + continue; + + if (asprintf(&pn, "%s/%s", traildir->dirname, + dp->d_name) < 0) { + ret = ADE_NOMEM; + break; + } + + if (stat(pn, &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) { + free(pn); + continue; + } + + total_size += stbuf.st_size; + + /* + * If this is the 'current' audit trail then + * don't add it to the tail queue. + */ + if (NULL != afnp && + strncmp(dp->d_name, afnp, FILENAME_LEN) == 0) { + free(pn); + continue; + } + + /* + * Get the ending time stamp encoded in the trail + * name. If we can't read it or if it is older + * than Jan 1, 2000 then use the mtime. + */ + if (trailname_to_tstamp(dp->d_name, &tstamp) != 0 || + tstamp < JAN_01_2000) + tstamp = stbuf.st_mtime; + + /* + * If the time stamp is older than Jan 1, 2000 then + * update the mtime of the trail file to the current + * time. This is so we don't prematurely remove a trail + * file that was created while the system clock reset + * to the * "beginning of time" but later the system + * clock is set to the correct current time. + */ + if (current_time >= JAN_01_2000 && + tstamp < JAN_01_2000) { + struct timeval tv[2]; + + tstamp = stbuf.st_mtime = current_time; + TIMESPEC_TO_TIMEVAL(&tv[0], + &stbuf.st_atimespec); + TIMESPEC_TO_TIMEVAL(&tv[1], + &stbuf.st_mtimespec); + utimes(pn, tv); + } + + /* + * Allocate and populate the new entry. + */ + new = malloc(sizeof(*new)); + if (NULL == new) { + free(pn); + ret = ADE_NOMEM; + break; + } + new->at_time = tstamp; + new->at_size = stbuf.st_size; + new->at_path = pn; + + /* + * Check to see if we have a new head. Otherwise, + * walk the tailq from the tail first and do a simple + * insertion sort. + */ + if (TAILQ_EMPTY(&head) || + (new->at_time <= TAILQ_FIRST(&head)->at_time)) { + TAILQ_INSERT_HEAD(&head, new, at_trls); + continue; + } + + TAILQ_FOREACH_REVERSE(at, &head, au_trls_head, at_trls) + if (new->at_time >= at->at_time) { + TAILQ_INSERT_AFTER(&head, at, new, + at_trls); + break; + } + + } + } + + oldest_time = current_time - expire_age; + + /* + * Expire trail files, oldest (mtime) first, if the given + * conditions are met. + */ + at = TAILQ_FIRST(&head); + while (NULL != at) { + struct audit_trail *at_next = TAILQ_NEXT(at, at_trls); + + if (andflg) { + if ((expire_size && total_size > expire_size) && + (expire_age && at->at_time < oldest_time)) { + if (warn_expired) + (*warn_expired)(at->at_path); + if (unlink(at->at_path) < 0) + ret = ADE_EXPIRE; + total_size -= at->at_size; + } + } else { + if ((expire_size && total_size > expire_size) || + (expire_age && at->at_time < oldest_time)) { + if (warn_expired) + (*warn_expired)(at->at_path); + if (unlink(at->at_path) < 0) + ret = ADE_EXPIRE; + total_size -= at->at_size; + } + } + + free(at->at_path); + free(at); + at = at_next; + } + + return (ret); +} + +/* * Parses the "dir" entry in audit_control(5) into an ordered list. Also, will - * set the minfree value if not already set. Arguments include function - * pointers to audit_warn functions for soft and hard limits. Returns: + * set the minfree and host values if not already set. Arguments include + * function pointers to audit_warn functions for soft and hard limits. Returns: * ADE_NOERR on success, * ADE_PARSE error parsing audit_control(5), * ADE_AUDITON error getting/setting auditon(2) value, @@ -309,9 +583,12 @@ auditd_read_dirs(int (*warn_soft)(char * int scnt = 0; int hcnt = 0; - if (minval == -1 && (err = auditd_set_minfree()) != 0) + if (auditd_minval == -1 && (err = auditd_set_minfree()) != 0) return (err); + if (auditd_hostlen == -1) + auditd_set_host(); + /* * Init directory q. Force a re-read of the file the next time. */ @@ -329,7 +606,8 @@ auditd_read_dirs(int (*warn_soft)(char * while (getacdir(cur_dir, MAXNAMLEN) >= 0) { if (statfs(cur_dir, &sfs) < 0) continue; /* XXX should warn */ - soft = (sfs.f_bfree < (sfs.f_blocks / (100 / minval))) ? 1 : 0; + soft = (sfs.f_bfree < (sfs.f_blocks / (100 / auditd_minval))) ? + 1 : 0; hard = (sfs.f_bfree < AUDIT_HARD_LIMIT_FREE_BLOCKS) ? 1 : 0; if (soft) { if (warn_soft) @@ -367,7 +645,8 @@ void auditd_close_dirs(void) { free_dir_q(); - minval = -1; + auditd_minval = -1; + auditd_hostlen = -1; } @@ -549,7 +828,7 @@ auditd_swap_trail(char *TS, char **newfi } /* Try until we succeed. */ - while ((dirent = TAILQ_FIRST(&dir_q))) { + TAILQ_FOREACH(dirent, &dir_q, dirs) { if (dirent->hardlim) continue; if ((fn = affixdir(timestr, dirent)) == NULL) @@ -606,6 +885,28 @@ auditd_swap_trail(char *TS, char **newfi * ADE_NOERR on success, * ADE_SETAUDIT if setaudit(2) fails. */ +#ifdef __APPLE__ +int +auditd_prevent_audit(void) +{ + auditinfo_addr_t aia; + + /* + * To prevent event feedback cycles and avoid audit becoming stalled if *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From nwhitehorn at FreeBSD.org Mon Mar 2 07:22:02 2009 From: nwhitehorn at FreeBSD.org (Nathan Whitehorn) Date: Mon Mar 2 07:22:08 2009 Subject: svn commit: r189280 - head/sys/dev/ofw Message-ID: <200903021522.n22FM1mI079403@svn.freebsd.org> Author: nwhitehorn Date: Mon Mar 2 15:22:01 2009 New Revision: 189280 URL: http://svn.freebsd.org/changeset/base/189280 Log: Some Apple I2C buses give the device's I2C address in a property with the name i2c-address instead of reg. Change the OFW I2C probe to check both locations for the address. Submitted by: Marco Trillo Reported by: Justin Hibbits Modified: head/sys/dev/ofw/ofw_iicbus.c Modified: head/sys/dev/ofw/ofw_iicbus.c ============================================================================== --- head/sys/dev/ofw/ofw_iicbus.c Mon Mar 2 13:29:18 2009 (r189279) +++ head/sys/dev/ofw/ofw_iicbus.c Mon Mar 2 15:22:01 2009 (r189280) @@ -118,8 +118,15 @@ ofw_iicbus_attach(device_t dev) node = ofw_bus_get_node(dev); for (child = OF_child(node); child != 0; child = OF_peer(child)) { - if (OF_getprop(child, "reg", &addr, sizeof(addr)) == -1) - continue; + /* + * Try to get the I2C address first from the i2c-address + * property, then try the reg property. It moves around + * on different systems. + */ + + if (OF_getprop(child, "i2c-address", &addr, sizeof(addr)) == -1) + if (OF_getprop(child, "reg", &addr, sizeof(addr)) == -1) + continue; /* * Now set up the I2C and OFW bus layer devinfo and add it From jhb at freebsd.org Mon Mar 2 08:11:43 2009 From: jhb at freebsd.org (John Baldwin) Date: Mon Mar 2 08:11:51 2009 Subject: svn commit: r189232 - head/sys/kern In-Reply-To: <200903011426.n21EQOdp045591@svn.freebsd.org> References: <200903011426.n21EQOdp045591@svn.freebsd.org> Message-ID: <200903021015.51292.jhb@freebsd.org> On Sunday 01 March 2009 9:26:24 am Dmitry Chagin wrote: > Author: dchagin > Date: Sun Mar 1 14:26:24 2009 > New Revision: 189232 > URL: http://svn.freebsd.org/changeset/base/189232 > > Log: > Fix range-check error introduced in r182292. Also do not do anything > if all processors in the map are not available, simply return. I think the ncpus == 0 case is arguably a panic offense FWIW. It would be a bug in the calling code for that to ever happen. -- John Baldwin From jhb at freebsd.org Mon Mar 2 08:11:52 2009 From: jhb at freebsd.org (John Baldwin) Date: Mon Mar 2 08:12:06 2009 Subject: svn commit: r189150 - head/usr.bin/fstat In-Reply-To: <200902281040.n1SAebV7006099@svn.freebsd.org> References: <200902281040.n1SAebV7006099@svn.freebsd.org> Message-ID: <200903021021.09097.jhb@freebsd.org> On Saturday 28 February 2009 5:40:37 am Ed Schouten wrote: > Author: ed > Date: Sat Feb 28 10:40:37 2009 > New Revision: 189150 > URL: http://svn.freebsd.org/changeset/base/189150 > > Log: > Fix compilation of fstat. > > The udev should now be obtained from the dosmount instead of the denode. Sorry. :( The fact that fstat does this is really gross. -- John Baldwin From vanhu at FreeBSD.org Mon Mar 2 08:55:21 2009 From: vanhu at FreeBSD.org (VANHULLEBUS Yvan) Date: Mon Mar 2 08:55:37 2009 Subject: svn commit: r189281 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb netipsec Message-ID: <200903021655.n22GtKL5081077@svn.freebsd.org> Author: vanhu Date: Mon Mar 2 16:55:19 2009 New Revision: 189281 URL: http://svn.freebsd.org/changeset/base/189281 Log: MFC: Remove remain <= MHLEN restriction in m_makespace(), which caused assert with big packets PR: kern/124609 Submitted by: fabien.thomas@netasq.com Approved by: gnn(mentor) Obtained from: NetBSD Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netipsec/ipsec_mbuf.c Modified: stable/7/sys/netipsec/ipsec_mbuf.c ============================================================================== --- stable/7/sys/netipsec/ipsec_mbuf.c Mon Mar 2 15:22:01 2009 (r189280) +++ stable/7/sys/netipsec/ipsec_mbuf.c Mon Mar 2 16:55:19 2009 (r189281) @@ -73,66 +73,67 @@ m_makespace(struct mbuf *m0, int skip, i */ remain = m->m_len - skip; /* data to move */ if (hlen > M_TRAILINGSPACE(m)) { - struct mbuf *n; + struct mbuf *n0, *n, **np; + int todo, len, done, alloc; + + n0 = NULL; + np = &n0; + alloc = 0; + done = 0; + todo = remain; + while (todo > 0) { + if (todo > MHLEN) { + n = m_getcl(M_DONTWAIT, m->m_type, 0); + len = MCLBYTES; + } + else { + n = m_get(M_DONTWAIT, m->m_type); + len = MHLEN; + } + if (n == NULL) { + m_freem(n0); + return NULL; + } + *np = n; + np = &n->m_next; + alloc++; + len = min(todo, len); + memcpy(n->m_data, mtod(m, char *) + skip + done, len); + n->m_len = len; + done += len; + todo -= len; + } - /* XXX code doesn't handle clusters XXX */ - IPSEC_ASSERT(remain < MLEN, ("remainder too big: %u", remain)); - /* - * Not enough space in m, split the contents - * of m, inserting new mbufs as required. - * - * NB: this ignores mbuf types. - */ - MGET(n, M_DONTWAIT, MT_DATA); - if (n == NULL) - return (NULL); - n->m_next = m->m_next; /* splice new mbuf */ - m->m_next = n; - ipsec4stat.ips_mbinserted++; if (hlen <= M_TRAILINGSPACE(m) + remain) { - /* - * New header fits in the old mbuf if we copy - * the remainder; just do the copy to the new - * mbuf and we're good to go. - */ - memcpy(mtod(n, caddr_t), - mtod(m, caddr_t) + skip, remain); - n->m_len = remain; m->m_len = skip + hlen; *off = skip; - } else { - /* - * No space in the old mbuf for the new header. - * Make space in the new mbuf and check the - * remainder'd data fits too. If not then we - * must allocate an additional mbuf (yech). - */ - n->m_len = 0; - if (remain + hlen > M_TRAILINGSPACE(n)) { - struct mbuf *n2; - - MGET(n2, M_DONTWAIT, MT_DATA); - /* NB: new mbuf is on chain, let caller free */ - if (n2 == NULL) - return (NULL); - n2->m_len = 0; - memcpy(mtod(n2, caddr_t), - mtod(m, caddr_t) + skip, remain); - n2->m_len = remain; - /* splice in second mbuf */ - n2->m_next = n->m_next; - n->m_next = n2; - ipsec4stat.ips_mbinserted++; - } else { - memcpy(mtod(n, caddr_t) + hlen, - mtod(m, caddr_t) + skip, remain); - n->m_len += remain; + if (n0 != NULL) { + *np = m->m_next; + m->m_next = n0; } - m->m_len -= remain; - n->m_len += hlen; + } + else { + n = m_get(M_DONTWAIT, m->m_type); + if (n == NULL) { + m_freem(n0); + return NULL; + } + alloc++; + + if ((n->m_next = n0) == NULL) + np = &n->m_next; + n0 = n; + + *np = m->m_next; + m->m_next = n0; + + n->m_len = hlen; + m->m_len = skip; + m = n; /* header is at front ... */ *off = 0; /* ... of new mbuf */ } + ipsec4stat.ips_mbinserted++; } else { /* * Copy the remainder to the back of the mbuf From dchagin at freebsd.org Mon Mar 2 10:34:10 2009 From: dchagin at freebsd.org (Chagin Dmitry) Date: Mon Mar 2 10:34:17 2009 Subject: svn commit: r189232 - head/sys/kern In-Reply-To: <200903021015.51292.jhb@freebsd.org> References: <200903011426.n21EQOdp045591@svn.freebsd.org> <200903021015.51292.jhb@freebsd.org> Message-ID: <20090302181028.GA10447@dchagin.static.corbina.ru> On Mon, Mar 02, 2009 at 10:15:50AM -0500, John Baldwin wrote: > On Sunday 01 March 2009 9:26:24 am Dmitry Chagin wrote: > > Author: dchagin > > Date: Sun Mar 1 14:26:24 2009 > > New Revision: 189232 > > URL: http://svn.freebsd.org/changeset/base/189232 > > > > Log: > > Fix range-check error introduced in r182292. Also do not do anything > > if all processors in the map are not available, simply return. > > I think the ncpus == 0 case is arguably a panic offense FWIW. It would be a > bug in the calling code for that to ever happen. > I think you are right, I will make changes and test it. -- Have fun! chd -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090302/95ec8e59/attachment.pgp From kib at FreeBSD.org Mon Mar 2 10:44:03 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Mon Mar 2 10:44:20 2009 Subject: svn commit: r189282 - in head/sys: amd64/amd64 fs/procfs kern Message-ID: <200903021843.n22Iho8d083201@svn.freebsd.org> Author: kib Date: Mon Mar 2 18:43:50 2009 New Revision: 189282 URL: http://svn.freebsd.org/changeset/base/189282 Log: Use the p_sysent->sv_flags flag SV_ILP32 to detect 32bit process executing on 64bit kernel. This eliminates the direct comparisions of p_sysent with &ia32_freebsd_sysvec, that were left intact after r185169. Modified: head/sys/amd64/amd64/vm_machdep.c head/sys/fs/procfs/procfs_dbregs.c head/sys/fs/procfs/procfs_fpregs.c head/sys/fs/procfs/procfs_regs.c head/sys/kern/sys_process.c Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Mon Mar 2 16:55:19 2009 (r189281) +++ head/sys/amd64/amd64/vm_machdep.c Mon Mar 2 18:43:50 2009 (r189282) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -80,12 +81,6 @@ __FBSDID("$FreeBSD$"); #include -#ifdef COMPAT_IA32 - -extern struct sysentvec ia32_freebsd_sysvec; - -#endif - static void cpu_reset_real(void); #ifdef SMP static void cpu_reset_proxy(void); @@ -331,7 +326,7 @@ cpu_set_upcall_kse(struct thread *td, vo cpu_thread_clean(td); #ifdef COMPAT_IA32 - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { + if (td->td_proc->p_sysent->sv_flags & SV_ILP32) { /* * Set the trap frame to point at the beginning of the uts * function. @@ -377,7 +372,7 @@ cpu_set_user_tls(struct thread *td, void return (EINVAL); #ifdef COMPAT_IA32 - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { + if (td->td_proc->p_sysent->sv_flags & SV_ILP32) { if (td == curthread) { critical_enter(); td->td_pcb->pcb_gsbase = (register_t)tls_base; Modified: head/sys/fs/procfs/procfs_dbregs.c ============================================================================== --- head/sys/fs/procfs/procfs_dbregs.c Mon Mar 2 16:55:19 2009 (r189281) +++ head/sys/fs/procfs/procfs_dbregs.c Mon Mar 2 18:43:50 2009 (r189282) @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -63,7 +64,6 @@ #include #include -extern struct sysentvec ia32_freebsd_sysvec; /* * PROC(write, dbregs, td2, &r) becomes * proc_write_dbregs(td2, &r) or @@ -107,8 +107,8 @@ procfs_doprocdbregs(PFS_FILL_ARGS) td2 = FIRST_THREAD_IN_PROC(p); #ifdef COMPAT_IA32 - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { - if (td2->td_proc->p_sysent != &ia32_freebsd_sysvec) { + if (SV_CURPROC_FLAG(SV_ILP32)) { + if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) { PROC_UNLOCK(p); return (EINVAL); } Modified: head/sys/fs/procfs/procfs_fpregs.c ============================================================================== --- head/sys/fs/procfs/procfs_fpregs.c Mon Mar 2 16:55:19 2009 (r189281) +++ head/sys/fs/procfs/procfs_fpregs.c Mon Mar 2 18:43:50 2009 (r189282) @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -57,7 +58,6 @@ #include #include -extern struct sysentvec ia32_freebsd_sysvec; /* * PROC(write, fpregs, td2, &r) becomes * proc_write_fpregs(td2, &r) or @@ -102,8 +102,8 @@ procfs_doprocfpregs(PFS_FILL_ARGS) /* XXXKSE: */ td2 = FIRST_THREAD_IN_PROC(p); #ifdef COMPAT_IA32 - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { - if (td2->td_proc->p_sysent != &ia32_freebsd_sysvec) { + if (SV_CURPROC_FLAG(SV_ILP32)) { + if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) { PROC_UNLOCK(p); return (EINVAL); } Modified: head/sys/fs/procfs/procfs_regs.c ============================================================================== --- head/sys/fs/procfs/procfs_regs.c Mon Mar 2 16:55:19 2009 (r189281) +++ head/sys/fs/procfs/procfs_regs.c Mon Mar 2 18:43:50 2009 (r189282) @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -57,7 +58,6 @@ #include #include -extern struct sysentvec ia32_freebsd_sysvec; /* * PROC(write, regs, td2, &r) becomes * proc_write_regs(td2, &r) or @@ -102,8 +102,8 @@ procfs_doprocregs(PFS_FILL_ARGS) /* XXXKSE: */ td2 = FIRST_THREAD_IN_PROC(p); #ifdef COMPAT_IA32 - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { - if (td2->td_proc->p_sysent != &ia32_freebsd_sysvec) { + if (SV_CURPROC_FLAG(SV_ILP32)) { + if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) { PROC_UNLOCK(p); return (EINVAL); } Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Mon Mar 2 16:55:19 2009 (r189281) +++ head/sys/kern/sys_process.c Mon Mar 2 18:43:50 2009 (r189282) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -64,8 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include -extern struct sysentvec ia32_freebsd_sysvec; - struct ptrace_io_desc32 { int piod_op; u_int32_t piod_offs; @@ -394,7 +393,7 @@ ptrace(struct thread *td, struct ptrace_ #ifdef COMPAT_IA32 int wrap32 = 0; - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) + if (SV_CURPROC_FLAG(SV_ILP32)) wrap32 = 1; #endif AUDIT_ARG(pid, uap->pid); @@ -581,8 +580,8 @@ kern_ptrace(struct thread *td, int req, * Test if we're a 32 bit client and what the target is. * Set the wrap controls accordingly. */ - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { - if (td2->td_proc->p_sysent == &ia32_freebsd_sysvec) + if (SV_CURPROC_FLAG(SV_ILP32)) { + if (td2->td_proc->p_sysent->sv_flags & SV_ILP32) safe = 1; wrap32 = 1; } From kib at FreeBSD.org Mon Mar 2 10:53:33 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Mon Mar 2 10:53:46 2009 Subject: svn commit: r189283 - in head: . lib/libc/sys sys/kern sys/sys usr.bin/ipcs Message-ID: <200903021853.n22IrUdx083424@svn.freebsd.org> Author: kib Date: Mon Mar 2 18:53:30 2009 New Revision: 189283 URL: http://svn.freebsd.org/changeset/base/189283 Log: Correct types of variables used to track amount of allocated SysV shared memory from int to size_t. Implement a workaround for current ABI not allowing to properly save size for and report more then 2Gb sized segment of shared memory. This makes it possible to use > 2 Gb shared memory segments on 64bit architectures. Please note the new BUGS section in shmctl(2) and UPDATING note for limitations of this temporal solution. Reviewed by: csjp Tested by: Nikolay Dzham MFC after: 2 weeks Modified: head/UPDATING head/lib/libc/sys/shmctl.2 head/sys/kern/sysv_shm.c head/sys/sys/shm.h head/usr.bin/ipcs/ipcs.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Mar 2 18:43:50 2009 (r189282) +++ head/UPDATING Mon Mar 2 18:53:30 2009 (r189283) @@ -22,6 +22,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20090302: + The workaround is committed to allow to create System V shared + memory segment of size > 2 Gb on the 64-bit architectures. + Due to limitation of the existing ABI, the shm_segsz member + of the struct shmid_ds, returned by shmctl(IPC_STAT) call is + wrong for large segments. Note that limits shall be explicitely + raised to allow such segments to be created. + 20090301: The layout of struct ifnet has changed, requiring a rebuild of all network device driver modules. Modified: head/lib/libc/sys/shmctl.2 ============================================================================== --- head/lib/libc/sys/shmctl.2 Mon Mar 2 18:43:50 2009 (r189282) +++ head/lib/libc/sys/shmctl.2 Mon Mar 2 18:53:30 2009 (r189283) @@ -133,6 +133,15 @@ the shared memory segment's owner or cre Permission denied due to mismatch between operation and mode of shared memory segment. .El +.Sh "BUGS" +The shm_segsz member of the +.Vt shmid_ds +structure has int type, that is too short to represent full range +of the values for segment size, which is allowed to be size_t. +If shared memory limits are raised to allow segments with size > 2 Gb +to be created, be aware that IPC_STAT call may return truncated value +for shm_segsz. +.El .Sh "SEE ALSO" .Xr shmat 2 , .Xr shmdt 2 , Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Mon Mar 2 18:43:50 2009 (r189282) +++ head/sys/kern/sysv_shm.c Mon Mar 2 18:53:30 2009 (r189283) @@ -121,7 +121,8 @@ static sy_call_t *shmcalls[] = { #define SHMSEG_ALLOCATED 0x0800 #define SHMSEG_WANTED 0x1000 -static int shm_last_free, shm_nused, shm_committed, shmalloced; +static int shm_last_free, shm_nused, shmalloced; +size_t shm_committed; static struct shmid_kernel *shmsegs; struct shmmap_state { @@ -250,7 +251,7 @@ shm_deallocate_segment(shmseg) vm_object_deallocate(shmseg->u.shm_internal); shmseg->u.shm_internal = NULL; - size = round_page(shmseg->u.shm_segsz); + size = round_page(shmseg->shm_bsegsz); shm_committed -= btoc(size); shm_nused--; shmseg->u.shm_perm.mode = SHMSEG_FREE; @@ -270,7 +271,7 @@ shm_delete_mapping(struct vmspace *vm, s segnum = IPCID_TO_IX(shmmap_s->shmid); shmseg = &shmsegs[segnum]; - size = round_page(shmseg->u.shm_segsz); + size = round_page(shmseg->shm_bsegsz); result = vm_map_remove(&vm->vm_map, shmmap_s->va, shmmap_s->va + size); if (result != KERN_SUCCESS) return (EINVAL); @@ -390,7 +391,7 @@ kern_shmat(td, shmid, shmaddr, shmflg) error = EMFILE; goto done2; } - size = round_page(shmseg->u.shm_segsz); + size = round_page(shmseg->shm_bsegsz); #ifdef VM_PROT_READ_IS_EXEC prot = VM_PROT_READ | VM_PROT_EXECUTE; #else @@ -422,7 +423,8 @@ kern_shmat(td, shmid, shmaddr, shmflg) vm_object_reference(shmseg->u.shm_internal); rv = vm_map_find(&p->p_vmspace->vm_map, shmseg->u.shm_internal, - 0, &attach_va, size, (flags & MAP_FIXED)?0:1, prot, prot, 0); + 0, &attach_va, size, (flags & MAP_FIXED) ? VMFS_NO_SPACE : + VMFS_ANY_SPACE, prot, prot, 0); if (rv != KERN_SUCCESS) { vm_object_deallocate(shmseg->u.shm_internal); error = ENOMEM; @@ -720,7 +722,7 @@ shmget_existing(td, uap, mode, segnum) if (error != 0) return (error); #endif - if (uap->size && uap->size > shmseg->u.shm_segsz) + if (uap->size && uap->size > shmseg->shm_bsegsz) return (EINVAL); td->td_retval[0] = IXSEQ_TO_IPCID(segnum, shmseg->u.shm_perm); return (0); @@ -732,7 +734,8 @@ shmget_allocate_segment(td, uap, mode) struct shmget_args *uap; int mode; { - int i, segnum, shmid, size; + int i, segnum, shmid; + size_t size; struct ucred *cred = td->td_ucred; struct shmid_kernel *shmseg; vm_object_t shm_object; @@ -790,6 +793,7 @@ shmget_allocate_segment(td, uap, mode) shmseg->u.shm_perm.mode = (shmseg->u.shm_perm.mode & SHMSEG_WANTED) | (mode & ACCESSPERMS) | SHMSEG_ALLOCATED; shmseg->u.shm_segsz = uap->size; + shmseg->shm_bsegsz = uap->size; shmseg->u.shm_cpid = td->td_proc->p_pid; shmseg->u.shm_lpid = shmseg->u.shm_nattch = 0; shmseg->u.shm_atime = shmseg->u.shm_dtime = 0; Modified: head/sys/sys/shm.h ============================================================================== --- head/sys/sys/shm.h Mon Mar 2 18:43:50 2009 (r189282) +++ head/sys/sys/shm.h Mon Mar 2 18:53:30 2009 (r189283) @@ -108,6 +108,7 @@ struct shminfo { struct shmid_kernel { struct shmid_ds u; struct label *label; /* MAC label */ + size_t shm_bsegsz; }; extern struct shminfo shminfo; Modified: head/usr.bin/ipcs/ipcs.c ============================================================================== --- head/usr.bin/ipcs/ipcs.c Mon Mar 2 18:43:50 2009 (r189282) +++ head/usr.bin/ipcs/ipcs.c Mon Mar 2 18:53:30 2009 (r189283) @@ -452,8 +452,8 @@ print_kshmptr(int i, int option, struct kshmptr->u.shm_nattch); if (option & BIGGEST) - printf(" %12d", - kshmptr->u.shm_segsz); + printf(" %12zu", + kshmptr->shm_bsegsz); if (option & PID) printf(" %12d %12d", From kib at FreeBSD.org Mon Mar 2 11:00:38 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Mon Mar 2 11:00:49 2009 Subject: svn commit: r189284 - svnadmin/conf Message-ID: <200903021900.n22J0Wv3083649@svn.freebsd.org> Author: kib Date: Mon Mar 2 19:00:31 2009 New Revision: 189284 URL: http://svn.freebsd.org/changeset/base/189284 Log: Free Peter Holm from my mentorship. Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Mon Mar 2 18:53:30 2009 (r189283) +++ svnadmin/conf/mentors Mon Mar 2 19:00:31 2009 (r189284) @@ -15,7 +15,6 @@ cbzimmer sam dchagin kib eri mlaier Co-mentor: thompsa jamie bz Co-mentor: brooks -pho kib rdivacky ed remko imp sbruno scottl From rnoland at FreeBSD.org Mon Mar 2 11:00:53 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Mon Mar 2 11:01:06 2009 Subject: svn commit: r189285 - head/sys/dev/pci Message-ID: <200903021900.n22J0fYQ083689@svn.freebsd.org> Author: rnoland Date: Mon Mar 2 19:00:41 2009 New Revision: 189285 URL: http://svn.freebsd.org/changeset/base/189285 Log: Disable INTx when enabling MSI/MSIX This addresses interrupt storms that were noticed after enabling MSI in drm. I think this is due to a loose interpretation of the PCI 2.3 spec, which states that a function using MSI is prohibitted from using INTx. It appears that some vendors interpretted that to mean that they should handle it in hardware, while others felt it was the drivers responsibility. This fix will also likely resolve interrupt storm related issues with devices other than drm. Reviewed by: jhb@ MFC after: 3 days Modified: head/sys/dev/pci/pci.c head/sys/dev/pci/pcireg.h Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Mon Mar 2 19:00:31 2009 (r189284) +++ head/sys/dev/pci/pci.c Mon Mar 2 19:00:41 2009 (r189285) @@ -2864,6 +2864,8 @@ pci_setup_intr(device_t dev, device_t ch } mte->mte_handlers++; } + /* Disable INTx if we are using MSI/MSIX */ + pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); bad: if (error) { (void)bus_generic_teardown_intr(dev, child, irq, @@ -2918,6 +2920,8 @@ pci_teardown_intr(device_t dev, device_t if (mte->mte_handlers == 0) pci_mask_msix(child, rid - 1); } + /* Restore INTx capability for MSI/MSIX */ + pci_clear_command_bit(dev, child, PCIM_CMD_INTxDIS); } error = bus_generic_teardown_intr(dev, child, irq, cookie); if (device_get_parent(child) == dev && rid > 0) Modified: head/sys/dev/pci/pcireg.h ============================================================================== --- head/sys/dev/pci/pcireg.h Mon Mar 2 19:00:31 2009 (r189284) +++ head/sys/dev/pci/pcireg.h Mon Mar 2 19:00:41 2009 (r189285) @@ -60,6 +60,7 @@ #define PCIM_CMD_PERRESPEN 0x0040 #define PCIM_CMD_SERRESPEN 0x0100 #define PCIM_CMD_BACKTOBACK 0x0200 +#define PCIM_CMD_INTxDIS 0x0400 #define PCIR_STATUS 0x06 #define PCIM_STATUS_CAPPRESENT 0x0010 #define PCIM_STATUS_66CAPABLE 0x0020 From csjp at FreeBSD.org Mon Mar 2 11:42:03 2009 From: csjp at FreeBSD.org (Christian S.J. Peron) Date: Mon Mar 2 11:42:16 2009 Subject: svn commit: r189286 - head/sys/net Message-ID: <200903021942.n22Jg1BG084536@svn.freebsd.org> Author: csjp Date: Mon Mar 2 19:42:01 2009 New Revision: 189286 URL: http://svn.freebsd.org/changeset/base/189286 Log: Switch the default buffer mode in bpf(4) to zero-copy buffers. Discussed with: rwatson Modified: head/sys/net/bpf.c Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Mon Mar 2 19:00:41 2009 (r189285) +++ head/sys/net/bpf.c Mon Mar 2 19:42:01 2009 (r189286) @@ -124,7 +124,7 @@ SYSCTL_NODE(_net, OID_AUTO, bpf, CTLFLAG int bpf_maxinsns = BPF_MAXINSNS; SYSCTL_INT(_net_bpf, OID_AUTO, maxinsns, CTLFLAG_RW, &bpf_maxinsns, 0, "Maximum bpf program instructions"); -static int bpf_zerocopy_enable = 0; +static int bpf_zerocopy_enable = 1; SYSCTL_INT(_net_bpf, OID_AUTO, zerocopy_enable, CTLFLAG_RW, &bpf_zerocopy_enable, 0, "Enable new zero-copy BPF buffer sessions"); SYSCTL_NODE(_net_bpf, OID_AUTO, stats, CTLFLAG_RW, From kan at FreeBSD.org Mon Mar 2 12:51:40 2009 From: kan at FreeBSD.org (Alexander Kabaev) Date: Mon Mar 2 12:51:52 2009 Subject: svn commit: r189287 - head/sys/kern Message-ID: <200903022051.n22KpdfS085950@svn.freebsd.org> Author: kan Date: Mon Mar 2 20:51:39 2009 New Revision: 189287 URL: http://svn.freebsd.org/changeset/base/189287 Log: Change vfs_busy to wait until an outcome of pending unmount operation is known and to retry or fail accordingly to that outcome. This fixes the problem with namespace traversing programs failing with random ENOENT errors if someone just happened to try to unmount that same filesystem at the same time. Reported by: dhw Reviewed by: kib, attilio Sponsored by: Juniper Networks, Inc. Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Mar 2 19:42:01 2009 (r189286) +++ head/sys/kern/vfs_subr.c Mon Mar 2 20:51:39 2009 (r189287) @@ -345,7 +345,19 @@ vfs_busy(struct mount *mp, int flags) MNT_ILOCK(mp); MNT_REF(mp); - if (mp->mnt_kern_flag & MNTK_UNMOUNT) { + /* + * If mount point is currenly being unmounted, sleep until the + * mount point fate is decided. If thread doing the unmounting fails, + * it will clear MNTK_UNMOUNT flag before waking us up, indicating + * that this mount point has survived the unmount attempt and vfs_busy + * should retry. Otherwise the unmounter thread will set MNTK_REFEXPIRE + * flag in addition to MNTK_UNMOUNT, indicating that mount point is + * about to be really destroyed. vfs_busy needs to release its + * reference on the mount point in this case and return with ENOENT, + * telling the caller that mount mount it tried to busy is no longer + * valid. + */ + while (mp->mnt_kern_flag & MNTK_UNMOUNT) { if (flags & MBF_NOWAIT || mp->mnt_kern_flag & MNTK_REFEXPIRE) { MNT_REL(mp); MNT_IUNLOCK(mp); @@ -357,12 +369,8 @@ vfs_busy(struct mount *mp, int flags) mtx_unlock(&mountlist_mtx); mp->mnt_kern_flag |= MNTK_MWAIT; msleep(mp, MNT_MTX(mp), PVFS, "vfs_busy", 0); - MNT_REL(mp); - MNT_IUNLOCK(mp); if (flags & MBF_MNTLSTLOCK) mtx_lock(&mountlist_mtx); - CTR1(KTR_VFS, "%s: failed busying after sleep", __func__); - return (ENOENT); } if (flags & MBF_MNTLSTLOCK) mtx_unlock(&mountlist_mtx); From luigi at FreeBSD.org Mon Mar 2 14:11:53 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Mon Mar 2 14:13:38 2009 Subject: svn commit: r189288 - head/sys/netinet Message-ID: <200903022211.n22MBndb087518@svn.freebsd.org> Author: luigi Date: Mon Mar 2 22:11:48 2009 New Revision: 189288 URL: http://svn.freebsd.org/changeset/base/189288 Log: fw_debug has been unused for ages, so remove it from the list of sysctl_variables. I would also remove it from the VNET record but I am unsure if there is any ABI issue -- so for the time being just mark it as unused in ip_fw.h, and then we will collect the garbage at some appropriate time in the future. MFC after: 3 days Modified: head/sys/netinet/ip_fw.h head/sys/netinet/ip_fw2.c Modified: head/sys/netinet/ip_fw.h ============================================================================== --- head/sys/netinet/ip_fw.h Mon Mar 2 20:51:39 2009 (r189287) +++ head/sys/netinet/ip_fw.h Mon Mar 2 22:11:48 2009 (r189288) @@ -693,7 +693,7 @@ struct vnet_ipfw { int _fw_deny_unknown_exthdrs; int _fw_verbose; int _verbose_limit; - int _fw_debug; + int _fw_debug; /* actually unused */ int _autoinc_step; ipfw_dyn_rule **_ipfw_dyn_v; struct ip_fw_chain _layer3_chain; Modified: head/sys/netinet/ip_fw2.c ============================================================================== --- head/sys/netinet/ip_fw2.c Mon Mar 2 20:51:39 2009 (r189287) +++ head/sys/netinet/ip_fw2.c Mon Mar 2 22:11:48 2009 (r189288) @@ -165,7 +165,6 @@ struct table_entry { }; #ifdef VIMAGE_GLOBALS -static int fw_debug; static int autoinc_step; #endif @@ -181,8 +180,6 @@ SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip_fw, OID_AUTO, one_pass, CTLFLAG_RW | CTLFLAG_SECURE3, fw_one_pass, 0, "Only do a single pass through ipfw when using dummynet(4)"); -SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, debug, CTLFLAG_RW, - fw_debug, 0, "Enable printing of debug ip_fw statements"); SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, verbose, CTLFLAG_RW | CTLFLAG_SECURE3, fw_verbose, 0, "Log matches to ipfw rules"); @@ -4535,7 +4532,6 @@ ipfw_init(void) struct ip_fw default_rule; int error; - V_fw_debug = 1; V_autoinc_step = 100; /* bounded to 1..1000 in add_rule() */ V_ipfw_dyn_v = NULL; From luigi at FreeBSD.org Mon Mar 2 14:17:03 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Mon Mar 2 14:17:10 2009 Subject: svn commit: r189289 - head/sys/netinet Message-ID: <200903022216.n22MGocC087672@svn.freebsd.org> Author: luigi Date: Mon Mar 2 22:16:50 2009 New Revision: 189289 URL: http://svn.freebsd.org/changeset/base/189289 Log: curr_time is a 64 bit variable so SYSCTL_LONG is not appropriate as a handler. The variable was exported only for debugging, but there is little reason to do it now that the timekeeping is supported by various other variables. For the time being just comment out the sysctl, but I think this should go away. Modified: head/sys/netinet/ip_dummynet.c Modified: head/sys/netinet/ip_dummynet.c ============================================================================== --- head/sys/netinet/ip_dummynet.c Mon Mar 2 22:11:48 2009 (r189288) +++ head/sys/netinet/ip_dummynet.c Mon Mar 2 22:16:50 2009 (r189289) @@ -160,8 +160,10 @@ SYSCTL_DECL(_net_inet_ip); SYSCTL_NODE(_net_inet_ip, OID_AUTO, dummynet, CTLFLAG_RW, 0, "Dummynet"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, hash_size, CTLFLAG_RW, &dn_hash_size, 0, "Default hash table size"); +#if 0 /* curr_time is 64 bit */ SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, curr_time, CTLFLAG_RD, &curr_time, 0, "Current tick"); +#endif SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, ready_heap, CTLFLAG_RD, &ready_heap.size, 0, "Size of ready heap"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, extract_heap, From jamie at FreeBSD.org Mon Mar 2 15:26:32 2009 From: jamie at FreeBSD.org (Jamie Gritton) Date: Mon Mar 2 15:26:44 2009 Subject: svn commit: r189290 - in head: share/man/man9 sys/cddl/compat/opensolaris/kern sys/compat/freebsd32 sys/kern sys/sys Message-ID: <200903022326.n22NQVeb089153@svn.freebsd.org> Author: jamie Date: Mon Mar 2 23:26:30 2009 New Revision: 189290 URL: http://svn.freebsd.org/changeset/base/189290 Log: Extend the "vfsopt" mount options for more general use. Make struct vfsopt and the vfs_buildopts function public, and add some new fields to struct vfsopt (pos and seen), and new functions vfs_getopt_pos and vfs_opterror. Further extend the interface to allow reading options from the kernel in addition to sending them to the kernel, with vfs_setopt and related functions. While this allows the "name=value" option interface to be used for more than just FS mounts (planned use is for jails), it retains the current "vfsopt" name and requirement. Approved by: bz (mentor) Modified: head/share/man/man9/Makefile head/share/man/man9/vfs_getopt.9 head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c head/sys/compat/freebsd32/freebsd32_misc.c head/sys/kern/vfs_mount.c head/sys/sys/mount.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Mon Mar 2 22:16:50 2009 (r189289) +++ head/share/man/man9/Makefile Mon Mar 2 23:26:30 2009 (r189290) @@ -1243,7 +1243,10 @@ MLINKS+=vfs_getopt.9 vfs_copyopt.9 \ vfs_getopt.9 vfs_filteropt.9 \ vfs_getopt.9 vfs_flagopt.9 \ vfs_getopt.9 vfs_getopts.9 \ - vfs_getopt.9 vfs_scanopt.9 + vfs_getopt.9 vfs_scanopt.9 \ + vfs_getopt.9 vfs_setopt.9 \ + vfs_getopt.9 vfs_setopt_part.9 \ + vfs_getopt.9 vfs_setopts.9 MLINKS+=VFS_LOCK_GIANT.9 VFS_UNLOCK_GIANT.9 MLINKS+=vgone.9 vgonel.9 MLINKS+=vhold.9 vdrop.9 \ Modified: head/share/man/man9/vfs_getopt.9 ============================================================================== --- head/share/man/man9/vfs_getopt.9 Mon Mar 2 22:16:50 2009 (r189289) +++ head/share/man/man9/vfs_getopt.9 Mon Mar 2 23:26:30 2009 (r189290) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 28, 2007 +.Dd March 2, 2009 .Dt VFS_GETOPT 9 .Os .Sh NAME @@ -35,7 +35,10 @@ .Nm vfs_flagopt , .Nm vfs_scanopt , .Nm vfs_copyopt , -.Nm vfs_filteropt +.Nm vfs_filteropt , +.Nm vfs_setopt , +.Nm vfs_setopt_part , +.Nm vfs_setopts .Nd "manipulate mount options and their values" .Sh SYNOPSIS .In sys/param.h @@ -62,6 +65,18 @@ .Fo vfs_filteropt .Fa "struct vfsoptlist *opts" "const char **legal" .Fc +.Ft int +.Fo vfs_setopt +.Fa "struct vfsoptlist *opts" "const char *name" "void *value" "int len" +.Fc +.Ft int +.Fo vfs_setopt_part +.Fa "struct vfsoptlist *opts" "const char *name" "void *value" "int len" +.Fc +.Ft int +.Fo vfs_setopts +.Fa "struct vfsoptlist *opts" "const char *name" "const char *value" +.Fc .Sh DESCRIPTION The .Fn vfs_getopt @@ -111,7 +126,7 @@ The .Fn vfs_scanopt function performs a .Xr vsscanf 3 -with the options value, using the given format, +with the option's value, using the given format, into the specified variable arguments. The value must be a string (i.e., .Dv NUL @@ -119,10 +134,10 @@ terminated). .Pp The .Fn vfs_copyopt -function creates a copy of the options value. +function creates a copy of the option's value. The .Fa len -argument must match the length of the options value exactly +argument must match the length of the option's value exactly (i.e., a larger buffer will still cause .Fn vfs_copyout to fail with @@ -134,6 +149,28 @@ function ensures that no unknown options A option is valid if its name matches one of the names in the list of legal names. An option may be prefixed with 'no', and still be considered valid. +.Pp +The +.Fn vfs_setopt +and +.Fn vfs_setopt_part +functions copy new data into the option's value. +In +.Fn vfs_setopt , +the +.Fa len +argument must match the length of the option's value exactly +(i.e., a larger buffer will still cause +.Fn vfs_copyout +to fail with +.Er EINVAL ) . +.Pp +The +.Fn vfs_setopts +function copies a new string into the option's value. +The string, including +.Dv NUL +byte, must be no longer than the option's length. .Sh RETURN VALUES The .Fn vfs_getopt @@ -179,7 +216,9 @@ not always mean the option does not exis .Pp The .Fn vfs_copyopt -function returns 0 if the copy was successful, +and +.Fn vfs_setopt +functions return 0 if the copy was successful, .Er EINVAL if the option was found but the lengths did not match, and .Er ENOENT @@ -190,6 +229,14 @@ The function returns 0 if all of the options are legal; otherwise, .Er EINVAL is returned. +.Pp +The +.Fn vfs_setopts +function returns 0 if the copy was successful, +.Er EINVAL +if the option was found but the string was too long, and +.Er ENOENT +if the option was not found. .Sh AUTHORS .An -nosplit This manual page was written by Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon Mar 2 22:16:50 2009 (r189289) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon Mar 2 23:26:30 2009 (r189290) @@ -39,14 +39,6 @@ __FBSDID("$FreeBSD$"); MALLOC_DECLARE(M_MOUNT); -TAILQ_HEAD(vfsoptlist, vfsopt); -struct vfsopt { - TAILQ_ENTRY(vfsopt) link; - char *name; - void *value; - int len; -}; - void vfs_setmntopt(vfs_t *vfsp, const char *name, const char *arg, int flags __unused) @@ -64,6 +56,8 @@ vfs_setmntopt(vfs_t *vfsp, const char *n namesize = strlen(name) + 1; opt->name = malloc(namesize, M_MOUNT, M_WAITOK); strlcpy(opt->name, name, namesize); + opt->pos = -1; + opt->seen = 1; if (arg == NULL) { opt->value = NULL; @@ -80,22 +74,9 @@ vfs_setmntopt(vfs_t *vfsp, const char *n void vfs_clearmntopt(vfs_t *vfsp, const char *name) { - struct vfsopt *opt; - if (vfsp->mnt_opt == NULL) - return; /* TODO: Locking. */ - TAILQ_FOREACH(opt, vfsp->mnt_opt, link) { - if (strcmp(opt->name, name) == 0) - break; - } - if (opt != NULL) { - TAILQ_REMOVE(vfsp->mnt_opt, opt, link); - free(opt->name, M_MOUNT); - if (opt->value != NULL) - free(opt->value, M_MOUNT); - free(opt, M_MOUNT); - } + vfs_deleteopt(vfsp->mnt_opt, name); } int Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Mon Mar 2 22:16:50 2009 (r189289) +++ head/sys/compat/freebsd32/freebsd32_misc.c Mon Mar 2 23:26:30 2009 (r189290) @@ -2639,8 +2639,7 @@ freebsd32_nmount(struct thread *td, } */ *uap) { struct uio *auio; - struct iovec *iov; - int error, k; + int error; AUDIT_ARG(fflags, uap->flags); @@ -2662,14 +2661,8 @@ freebsd32_nmount(struct thread *td, error = freebsd32_copyinuio(uap->iovp, uap->iovcnt, &auio); if (error) return (error); - for (iov = auio->uio_iov, k = 0; k < uap->iovcnt; ++k, ++iov) { - if (iov->iov_len > MMAXOPTIONLEN) { - free(auio, M_IOV); - return (EINVAL); - } - } - error = vfs_donmount(td, uap->flags, auio); + free(auio, M_IOV); return error; } Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Mon Mar 2 22:16:50 2009 (r189289) +++ head/sys/kern/vfs_mount.c Mon Mar 2 23:26:30 2009 (r189290) @@ -78,7 +78,6 @@ static int vfs_domount(struct thread *td static int vfs_mountroot_ask(void); static int vfs_mountroot_try(const char *mountfrom); static void free_mntarg(struct mntarg *ma); -static int vfs_getopt_pos(struct vfsoptlist *opts, const char *name); static int usermount = 0; SYSCTL_INT(_vfs, OID_AUTO, usermount, CTLFLAG_RW, &usermount, 0, @@ -95,14 +94,6 @@ struct mntlist mountlist = TAILQ_HEAD_IN struct mtx mountlist_mtx; MTX_SYSINIT(mountlist, &mountlist_mtx, "mountlist", MTX_DEF); -TAILQ_HEAD(vfsoptlist, vfsopt); -struct vfsopt { - TAILQ_ENTRY(vfsopt) link; - char *name; - void *value; - int len; -}; - /* * The vnode of the system's root (/ in the filesystem, without chroot * active.) @@ -164,11 +155,6 @@ vfs_freeopt(struct vfsoptlist *opts, str free(opt->name, M_MOUNT); if (opt->value != NULL) free(opt->value, M_MOUNT); -#ifdef INVARIANTS - else if (opt->len != 0) - panic("%s: mount option with NULL value but length != 0", - __func__); -#endif free(opt, M_MOUNT); } @@ -204,6 +190,7 @@ vfs_deleteopt(struct vfsoptlist *opts, c static int vfs_equalopts(const char *opt1, const char *opt2) { + char *p; /* "opt" vs. "opt" or "noopt" vs. "noopt" */ if (strcmp(opt1, opt2) == 0) @@ -214,6 +201,17 @@ vfs_equalopts(const char *opt1, const ch /* "opt" vs. "noopt" */ if (strncmp(opt2, "no", 2) == 0 && strcmp(opt1, opt2 + 2) == 0) return (1); + while ((p = strchr(opt1, '.')) != NULL && + !strncmp(opt1, opt2, ++p - opt1)) { + opt2 += p - opt1; + opt1 = p; + /* "foo.noopt" vs. "foo.opt" */ + if (strncmp(opt1, "no", 2) == 0 && strcmp(opt1 + 2, opt2) == 0) + return (1); + /* "foo.opt" vs. "foo.noopt" */ + if (strncmp(opt2, "no", 2) == 0 && strcmp(opt1, opt2 + 2) == 0) + return (1); + } return (0); } @@ -244,34 +242,23 @@ vfs_sanitizeopts(struct vfsoptlist *opts /* * Build a linked list of mount options from a struct uio. */ -static int +int vfs_buildopts(struct uio *auio, struct vfsoptlist **options) { struct vfsoptlist *opts; struct vfsopt *opt; - size_t memused; + size_t memused, namelen, optlen; unsigned int i, iovcnt; - int error, namelen, optlen; + int error; opts = malloc(sizeof(struct vfsoptlist), M_MOUNT, M_WAITOK); TAILQ_INIT(opts); memused = 0; iovcnt = auio->uio_iovcnt; for (i = 0; i < iovcnt; i += 2) { - opt = malloc(sizeof(struct vfsopt), M_MOUNT, M_WAITOK); namelen = auio->uio_iov[i].iov_len; optlen = auio->uio_iov[i + 1].iov_len; - opt->name = malloc(namelen, M_MOUNT, M_WAITOK); - opt->value = NULL; - opt->len = 0; - - /* - * Do this early, so jumps to "bad" will free the current - * option. - */ - TAILQ_INSERT_TAIL(opts, opt, link); memused += sizeof(struct vfsopt) + optlen + namelen; - /* * Avoid consuming too much memory, and attempts to overflow * memused. @@ -283,6 +270,19 @@ vfs_buildopts(struct uio *auio, struct v goto bad; } + opt = malloc(sizeof(struct vfsopt), M_MOUNT, M_WAITOK); + opt->name = malloc(namelen, M_MOUNT, M_WAITOK); + opt->value = NULL; + opt->len = 0; + opt->pos = i / 2; + opt->seen = 0; + + /* + * Do this early, so jumps to "bad" will free the current + * option. + */ + TAILQ_INSERT_TAIL(opts, opt, link); + if (auio->uio_segflg == UIO_SYSSPACE) { bcopy(auio->uio_iov[i].iov_base, opt->name, namelen); } else { @@ -292,7 +292,7 @@ vfs_buildopts(struct uio *auio, struct v goto bad; } /* Ensure names are null-terminated strings. */ - if (opt->name[namelen - 1] != '\0') { + if (namelen == 0 || opt->name[namelen - 1] != '\0') { error = EINVAL; goto bad; } @@ -361,6 +361,7 @@ vfs_mergeopts(struct vfsoptlist *toopts, new->value = NULL; } new->len = opt->len; + new->seen = opt->seen; TAILQ_INSERT_TAIL(toopts, new, link); next: continue; @@ -380,8 +381,6 @@ nmount(td, uap) } */ *uap; { struct uio *auio; - struct iovec *iov; - unsigned int i; int error; u_int iovcnt; @@ -414,16 +413,6 @@ nmount(td, uap) __func__, error); return (error); } - iov = auio->uio_iov; - for (i = 0; i < iovcnt; i++) { - if (iov->iov_len > MMAXOPTIONLEN) { - free(auio, M_IOV); - CTR1(KTR_VFS, "%s: failed for invalid new auio", - __func__); - return (EINVAL); - } - iov++; - } error = vfs_donmount(td, uap->flags, auio); free(auio, M_IOV); @@ -692,6 +681,8 @@ vfs_donmount(struct thread *td, int fsfl noro_opt->name = strdup("noro", M_MOUNT); noro_opt->value = NULL; noro_opt->len = 0; + noro_opt->pos = -1; + noro_opt->seen = 1; TAILQ_INSERT_TAIL(optlist, noro_opt, link); } @@ -1611,6 +1602,22 @@ vfs_mount_error(struct mount *mp, const va_end(ap); } +void +vfs_opterror(struct vfsoptlist *opts, const char *fmt, ...) +{ + va_list ap; + int error, len; + char *errmsg; + + error = vfs_getopt(opts, "errmsg", (void **)&errmsg, &len); + if (error || errmsg == NULL || len <= 0) + return; + + va_start(ap, fmt); + vsnprintf(errmsg, (size_t)len, fmt, ap); + va_end(ap); +} + /* * Find and mount the root filesystem */ @@ -1880,6 +1887,7 @@ vfs_getopt(opts, name, buf, len) TAILQ_FOREACH(opt, opts, link) { if (strcmp(name, opt->name) == 0) { + opt->seen = 1; if (len != NULL) *len = opt->len; if (buf != NULL) @@ -1890,20 +1898,19 @@ vfs_getopt(opts, name, buf, len) return (ENOENT); } -static int +int vfs_getopt_pos(struct vfsoptlist *opts, const char *name) { struct vfsopt *opt; - int i; if (opts == NULL) return (-1); - i = 0; TAILQ_FOREACH(opt, opts, link) { - if (strcmp(name, opt->name) == 0) - return (i); - ++i; + if (strcmp(name, opt->name) == 0) { + opt->seen = 1; + return (opt->pos); + } } return (-1); } @@ -1917,7 +1924,9 @@ vfs_getopts(struct vfsoptlist *opts, con TAILQ_FOREACH(opt, opts, link) { if (strcmp(name, opt->name) != 0) continue; - if (((char *)opt->value)[opt->len - 1] != '\0') { + opt->seen = 1; + if (opt->len == 0 || + ((char *)opt->value)[opt->len - 1] != '\0') { *error = EINVAL; return (NULL); } @@ -1934,6 +1943,7 @@ vfs_flagopt(struct vfsoptlist *opts, con TAILQ_FOREACH(opt, opts, link) { if (strcmp(name, opt->name) == 0) { + opt->seen = 1; if (w != NULL) *w |= val; return (1); @@ -1956,6 +1966,7 @@ vfs_scanopt(struct vfsoptlist *opts, con TAILQ_FOREACH(opt, opts, link) { if (strcmp(name, opt->name) != 0) continue; + opt->seen = 1; if (opt->len == 0 || opt->value == NULL) return (0); if (((char *)opt->value)[opt->len - 1] != '\0') @@ -1968,6 +1979,67 @@ vfs_scanopt(struct vfsoptlist *opts, con return (0); } +int +vfs_setopt(struct vfsoptlist *opts, const char *name, void *value, int len) +{ + struct vfsopt *opt; + + TAILQ_FOREACH(opt, opts, link) { + if (strcmp(name, opt->name) != 0) + continue; + opt->seen = 1; + if (opt->value == NULL) + opt->len = len; + else { + if (opt->len != len) + return (EINVAL); + bcopy(value, opt->value, len); + } + return (0); + } + return (ENOENT); +} + +int +vfs_setopt_part(struct vfsoptlist *opts, const char *name, void *value, int len) +{ + struct vfsopt *opt; + + TAILQ_FOREACH(opt, opts, link) { + if (strcmp(name, opt->name) != 0) + continue; + opt->seen = 1; + if (opt->value == NULL) + opt->len = len; + else { + if (opt->len < len) + return (EINVAL); + opt->len = len; + bcopy(value, opt->value, len); + } + return (0); + } + return (ENOENT); +} + +int +vfs_setopts(struct vfsoptlist *opts, const char *name, const char *value) +{ + struct vfsopt *opt; + + TAILQ_FOREACH(opt, opts, link) { + if (strcmp(name, opt->name) != 0) + continue; + opt->seen = 1; + if (opt->value == NULL) + opt->len = strlen(value) + 1; + else if (strlcpy(opt->value, value, opt->len) >= opt->len) + return (EINVAL); + return (0); + } + return (ENOENT); +} + /* * Find and copy a mount option. * @@ -1989,6 +2061,7 @@ vfs_copyopt(opts, name, dest, len) TAILQ_FOREACH(opt, opts, link) { if (strcmp(name, opt->name) == 0) { + opt->seen = 1; if (len != opt->len) return (EINVAL); bcopy(opt->value, dest, opt->len); Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Mon Mar 2 22:16:50 2009 (r189289) +++ head/sys/sys/mount.h Mon Mar 2 23:26:30 2009 (r189290) @@ -127,12 +127,18 @@ struct ostatfs { long f_spare[2]; /* unused spare */ }; -#define MMAXOPTIONLEN 65536 /* maximum length of a mount option */ - TAILQ_HEAD(vnodelst, vnode); -struct vfsoptlist; -struct vfsopt; +/* Mount options list */ +TAILQ_HEAD(vfsoptlist, vfsopt); +struct vfsopt { + TAILQ_ENTRY(vfsopt) link; + char *name; + void *value; + int len; + int pos; + int seen; +}; /* * Structure per mounted filesystem. Each mounted filesystem has an @@ -702,12 +708,21 @@ void vfs_mount_destroy(struct mount *); void vfs_event_signal(fsid_t *, u_int32_t, intptr_t); void vfs_freeopts(struct vfsoptlist *opts); void vfs_deleteopt(struct vfsoptlist *opts, const char *name); +int vfs_buildopts(struct uio *auio, struct vfsoptlist **options); int vfs_flagopt(struct vfsoptlist *opts, const char *name, u_int *w, u_int val); int vfs_getopt(struct vfsoptlist *, const char *, void **, int *); +int vfs_getopt_pos(struct vfsoptlist *opts, const char *name); char *vfs_getopts(struct vfsoptlist *, const char *, int *error); int vfs_copyopt(struct vfsoptlist *, const char *, void *, int); int vfs_filteropt(struct vfsoptlist *, const char **legal); +void vfs_opterror(struct vfsoptlist *opts, const char *fmt, ...); int vfs_scanopt(struct vfsoptlist *opts, const char *name, const char *fmt, ...); +int vfs_setopt(struct vfsoptlist *opts, const char *name, void *value, + int len); +int vfs_setopt_part(struct vfsoptlist *opts, const char *name, void *value, + int len); +int vfs_setopts(struct vfsoptlist *opts, const char *name, + const char *value); int vfs_setpublicfs /* set publicly exported fs */ (struct mount *, struct netexport *, struct export_args *); void vfs_msync(struct mount *, int); From imp at bsdimp.com Mon Mar 2 15:31:16 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Mon Mar 2 15:31:32 2009 Subject: svn commit: r189276 - head/sys/sys In-Reply-To: <20090302110737.GG19161@hoeg.nl> References: <1235973158.31933.33.camel@shumai.marcuscom.com> <1235973908.1236.41.camel@widget.2hip.net> <20090302110737.GG19161@hoeg.nl> Message-ID: <20090302.162958.-8653806.imp@bsdimp.com> In message: <20090302110737.GG19161@hoeg.nl> Ed Schouten writes: : * Robert Noland wrote: : > On Mon, 2009-03-02 at 00:52 -0500, Joe Marcus Clarke wrote: : > > On Mon, 2009-03-02 at 05:46 +0000, Andrew Thompson wrote: : > > > Author: thompsa : > > > Date: Mon Mar 2 05:46:25 2009 : > > > New Revision: 189276 : > > > URL: http://svn.freebsd.org/changeset/base/189276 : > > > : > > > Log: : > > > Bump __FreeBSD_version for the ushub to uhub rename. : > > : > > Ughhh! Actually, I lied. I should have looked first. I used "usbus" : > > to tie usb2 devices into the hal device tree. Sorry about that. In any : > > event, this might help someone else. : > : > Numbers are cheap. ;) : : Even though we only have 32 left before we reach 800100. 7.0-RELEASE : carried the number 700100, but I guess nothing stops us from picking a : different number. ;-) Guess that means we gotta get busy on the 8.0 release :) Warner From delphij at FreeBSD.org Mon Mar 2 15:47:19 2009 From: delphij at FreeBSD.org (Xin LI) Date: Mon Mar 2 15:47:26 2009 Subject: svn commit: r189291 - in head/lib/libc/db: btree db hash mpool recno Message-ID: <200903022347.n22NlIRF089556@svn.freebsd.org> Author: delphij Date: Mon Mar 2 23:47:18 2009 New Revision: 189291 URL: http://svn.freebsd.org/changeset/base/189291 Log: Diff reduction against OpenBSD: ANSI'fy prototypes. (This is part of a larger changeset which is intended to reduce diff only, thus some prototypes were left intact since they will be changed in the future). Verified with: md5(1) Modified: head/lib/libc/db/btree/bt_close.c head/lib/libc/db/btree/bt_conv.c head/lib/libc/db/btree/bt_debug.c head/lib/libc/db/btree/bt_delete.c head/lib/libc/db/btree/bt_get.c head/lib/libc/db/btree/bt_open.c head/lib/libc/db/btree/bt_overflow.c head/lib/libc/db/btree/bt_page.c head/lib/libc/db/btree/bt_put.c head/lib/libc/db/btree/bt_search.c head/lib/libc/db/btree/bt_seq.c head/lib/libc/db/btree/bt_split.c head/lib/libc/db/btree/bt_utils.c head/lib/libc/db/db/db.c head/lib/libc/db/hash/hash.c head/lib/libc/db/hash/hash_bigkey.c head/lib/libc/db/hash/hash_buf.c head/lib/libc/db/hash/hash_log2.c head/lib/libc/db/hash/hash_page.c head/lib/libc/db/mpool/mpool.c head/lib/libc/db/recno/rec_close.c head/lib/libc/db/recno/rec_delete.c head/lib/libc/db/recno/rec_get.c head/lib/libc/db/recno/rec_open.c head/lib/libc/db/recno/rec_put.c head/lib/libc/db/recno/rec_search.c head/lib/libc/db/recno/rec_seq.c head/lib/libc/db/recno/rec_utils.c Modified: head/lib/libc/db/btree/bt_close.c ============================================================================== --- head/lib/libc/db/btree/bt_close.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_close.c Mon Mar 2 23:47:18 2009 (r189291) @@ -61,8 +61,7 @@ static int bt_meta(BTREE *); * RET_ERROR, RET_SUCCESS */ int -__bt_close(dbp) - DB *dbp; +__bt_close(DB *dbp) { BTREE *t; int fd; @@ -116,9 +115,7 @@ __bt_close(dbp) * RET_SUCCESS, RET_ERROR. */ int -__bt_sync(dbp, flags) - const DB *dbp; - u_int flags; +__bt_sync(const DB *dbp, u_int flags) { BTREE *t; int status; @@ -159,8 +156,7 @@ __bt_sync(dbp, flags) * RET_ERROR, RET_SUCCESS */ static int -bt_meta(t) - BTREE *t; +bt_meta(BTREE *t) { BTMETA m; void *p; Modified: head/lib/libc/db/btree/bt_conv.c ============================================================================== --- head/lib/libc/db/btree/bt_conv.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_conv.c Mon Mar 2 23:47:18 2009 (r189291) @@ -56,10 +56,7 @@ static void mswap(PAGE *); * h: page to convert */ void -__bt_pgin(t, pg, pp) - void *t; - pgno_t pg; - void *pp; +__bt_pgin(void *t, pgno_t pg, void *pp) { PAGE *h; indx_t i, top; @@ -124,10 +121,7 @@ __bt_pgin(t, pg, pp) } void -__bt_pgout(t, pg, pp) - void *t; - pgno_t pg; - void *pp; +__bt_pgout(void *t, pgno_t pg, void *pp) { PAGE *h; indx_t i, top; @@ -198,8 +192,7 @@ __bt_pgout(t, pg, pp) * p: page to convert */ static void -mswap(pg) - PAGE *pg; +mswap(PAGE *pg) { char *p; Modified: head/lib/libc/db/btree/bt_debug.c ============================================================================== --- head/lib/libc/db/btree/bt_debug.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_debug.c Mon Mar 2 23:47:18 2009 (r189291) @@ -53,8 +53,7 @@ __FBSDID("$FreeBSD$"); * dbp: pointer to the DB */ void -__bt_dump(dbp) - DB *dbp; +__bt_dump(DB *dbp) { BTREE *t; PAGE *h; @@ -97,8 +96,7 @@ __bt_dump(dbp) * h: pointer to the PAGE */ void -__bt_dmpage(h) - PAGE *h; +__bt_dmpage(PAGE *h) { BTMETA *m; char *sep; @@ -131,9 +129,7 @@ __bt_dmpage(h) * n: page number to dump. */ void -__bt_dnpage(dbp, pgno) - DB *dbp; - pgno_t pgno; +__bt_dnpage(DB *dbp, pgno_t pgno) { BTREE *t; PAGE *h; @@ -152,8 +148,7 @@ __bt_dnpage(dbp, pgno) * h: pointer to the PAGE */ void -__bt_dpage(h) - PAGE *h; +__bt_dpage(PAGE *h) { BINTERNAL *bi; BLEAF *bl; @@ -249,8 +244,7 @@ __bt_dpage(h) * dbp: pointer to the DB */ void -__bt_stat(dbp) - DB *dbp; +__bt_stat(DB *dbp) { extern u_long bt_cache_hit, bt_cache_miss, bt_pfxsaved, bt_rootsplit; extern u_long bt_sortsplit, bt_split; Modified: head/lib/libc/db/btree/bt_delete.c ============================================================================== --- head/lib/libc/db/btree/bt_delete.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_delete.c Mon Mar 2 23:47:18 2009 (r189291) @@ -58,10 +58,7 @@ static int __bt_stkacq(BTREE *, PAGE **, * Return RET_SPECIAL if the key is not found. */ int -__bt_delete(dbp, key, flags) - const DB *dbp; - const DBT *key; - u_int flags; +__bt_delete(const DB *dbp, const DBT *key, u_int flags) { BTREE *t; CURSOR *c; @@ -139,10 +136,7 @@ __bt_delete(dbp, key, flags) * 0 on success, 1 on failure */ static int -__bt_stkacq(t, hp, c) - BTREE *t; - PAGE **hp; - CURSOR *c; +__bt_stkacq(BTREE *t, PAGE **hp, CURSOR *c) { BINTERNAL *bi; EPG *e; @@ -286,9 +280,7 @@ ret: mpool_put(t->bt_mp, h, 0); * RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found. */ static int -__bt_bdelete(t, key) - BTREE *t; - const DBT *key; +__bt_bdelete(BTREE *t, const DBT *key) { EPG *e; PAGE *h; @@ -373,9 +365,7 @@ loop: if ((e = __bt_search(t, key, &exac * mpool_put's the page */ static int -__bt_pdelete(t, h) - BTREE *t; - PAGE *h; +__bt_pdelete(BTREE *t, PAGE *h) { BINTERNAL *bi; PAGE *pg; @@ -633,9 +623,7 @@ dup2: c->pg.pgno = e.page->pgno; * h: page to be deleted */ static int -__bt_relink(t, h) - BTREE *t; - PAGE *h; +__bt_relink(BTREE *t, PAGE *h) { PAGE *pg; Modified: head/lib/libc/db/btree/bt_get.c ============================================================================== --- head/lib/libc/db/btree/bt_get.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_get.c Mon Mar 2 23:47:18 2009 (r189291) @@ -58,11 +58,7 @@ __FBSDID("$FreeBSD$"); * RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found. */ int -__bt_get(dbp, key, data, flags) - const DB *dbp; - const DBT *key; - DBT *data; - u_int flags; +__bt_get(const DB *dbp, const DBT *key, DBT *data, u_int flags) { BTREE *t; EPG *e; Modified: head/lib/libc/db/btree/bt_open.c ============================================================================== --- head/lib/libc/db/btree/bt_open.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_open.c Mon Mar 2 23:47:18 2009 (r189291) @@ -87,10 +87,7 @@ static int tmp(void); * */ DB * -__bt_open(fname, flags, mode, openinfo, dflags) - const char *fname; - int flags, mode, dflags; - const BTREEINFO *openinfo; +__bt_open(const char *fname, int flags, int mode, const BTREEINFO *openinfo, int dflags) { struct stat sb; BTMETA m; @@ -350,8 +347,7 @@ err: if (t) { * RET_ERROR, RET_SUCCESS */ static int -nroot(t) - BTREE *t; +nroot(BTREE *t) { PAGE *meta, *root; pgno_t npg; @@ -384,7 +380,7 @@ nroot(t) } static int -tmp() +tmp(void) { sigset_t set, oset; int fd; @@ -405,7 +401,7 @@ tmp() } static int -byteorder() +byteorder(void) { u_int32_t x; u_char *p; @@ -423,8 +419,7 @@ byteorder() } int -__bt_fd(dbp) - const DB *dbp; +__bt_fd(const DB *dbp) { BTREE *t; Modified: head/lib/libc/db/btree/bt_overflow.c ============================================================================== --- head/lib/libc/db/btree/bt_overflow.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_overflow.c Mon Mar 2 23:47:18 2009 (r189291) @@ -75,12 +75,7 @@ __FBSDID("$FreeBSD$"); * RET_ERROR, RET_SUCCESS */ int -__ovfl_get(t, p, ssz, buf, bufsz) - BTREE *t; - void *p; - size_t *ssz; - void **buf; - size_t *bufsz; +__ovfl_get(BTREE *t, void *p, size_t *ssz, void **buf, size_t *bufsz) { PAGE *h; pgno_t pg; @@ -134,10 +129,7 @@ __ovfl_get(t, p, ssz, buf, bufsz) * RET_ERROR, RET_SUCCESS */ int -__ovfl_put(t, dbt, pg) - BTREE *t; - const DBT *dbt; - pgno_t *pg; +__ovfl_put(BTREE *t, const DBT *dbt, pgno_t *pg) { PAGE *h, *last; void *p; @@ -188,9 +180,7 @@ __ovfl_put(t, dbt, pg) * RET_ERROR, RET_SUCCESS */ int -__ovfl_delete(t, p) - BTREE *t; - void *p; +__ovfl_delete(BTREE *t, void *p) { PAGE *h; pgno_t pg; Modified: head/lib/libc/db/btree/bt_page.c ============================================================================== --- head/lib/libc/db/btree/bt_page.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_page.c Mon Mar 2 23:47:18 2009 (r189291) @@ -55,9 +55,7 @@ __FBSDID("$FreeBSD$"); * mpool_put's the page. */ int -__bt_free(t, h) - BTREE *t; - PAGE *h; +__bt_free(BTREE *t, PAGE *h) { /* Insert the page at the head of the free list. */ h->prevpg = P_INVALID; @@ -81,9 +79,7 @@ __bt_free(t, h) * Pointer to a page, NULL on error. */ PAGE * -__bt_new(t, npg) - BTREE *t; - pgno_t *npg; +__bt_new(BTREE *t, pgno_t *npg) { PAGE *h; Modified: head/lib/libc/db/btree/bt_put.c ============================================================================== --- head/lib/libc/db/btree/bt_put.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_put.c Mon Mar 2 23:47:18 2009 (r189291) @@ -62,11 +62,7 @@ static EPG *bt_fast(BTREE *, const DBT * * tree and R_NOOVERWRITE specified. */ int -__bt_put(dbp, key, data, flags) - const DB *dbp; - DBT *key; - const DBT *data; - u_int flags; +__bt_put(const DB *dbp, DBT *key, const DBT *data, u_int flags) { BTREE *t; DBT tkey, tdata; @@ -264,10 +260,7 @@ u_long bt_cache_hit, bt_cache_miss; * EPG for new record or NULL if not found. */ static EPG * -bt_fast(t, key, data, exactp) - BTREE *t; - const DBT *key, *data; - int *exactp; +bt_fast(BTREE *t, const DBT *key, const DBT *data, int *exactp) { PAGE *h; u_int32_t nbytes; Modified: head/lib/libc/db/btree/bt_search.c ============================================================================== --- head/lib/libc/db/btree/bt_search.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_search.c Mon Mar 2 23:47:18 2009 (r189291) @@ -61,10 +61,7 @@ static int __bt_sprev(BTREE *, PAGE *, c * the bt_cur field of the tree. A pointer to the field is returned. */ EPG * -__bt_search(t, key, exactp) - BTREE *t; - const DBT *key; - int *exactp; +__bt_search(BTREE *t, const DBT *key, int *exactp) { PAGE *h; indx_t base, index, lim; @@ -146,11 +143,7 @@ next: BT_PUSH(t, h->pgno, index); * If an exact match found. */ static int -__bt_snext(t, h, key, exactp) - BTREE *t; - PAGE *h; - const DBT *key; - int *exactp; +__bt_snext(BTREE *t, PAGE *h, const DBT *key, int *exactp) { EPG e; @@ -185,11 +178,7 @@ __bt_snext(t, h, key, exactp) * If an exact match found. */ static int -__bt_sprev(t, h, key, exactp) - BTREE *t; - PAGE *h; - const DBT *key; - int *exactp; +__bt_sprev(BTREE *t, PAGE *h, const DBT *key, int *exactp) { EPG e; Modified: head/lib/libc/db/btree/bt_seq.c ============================================================================== --- head/lib/libc/db/btree/bt_seq.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_seq.c Mon Mar 2 23:47:18 2009 (r189291) @@ -72,10 +72,7 @@ static int __bt_seqset(BTREE *, EPG *, D * RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key. */ int -__bt_seq(dbp, key, data, flags) - const DB *dbp; - DBT *key, *data; - u_int flags; +__bt_seq(const DB *dbp, DBT *key, DBT *data, u_int flags) { BTREE *t; EPG e; @@ -147,11 +144,7 @@ __bt_seq(dbp, key, data, flags) * RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key. */ static int -__bt_seqset(t, ep, key, flags) - BTREE *t; - EPG *ep; - DBT *key; - int flags; +__bt_seqset(BTREE *t, EPG *ep, DBT *key, int flags) { PAGE *h; pgno_t pg; @@ -235,10 +228,7 @@ __bt_seqset(t, ep, key, flags) * RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key. */ static int -__bt_seqadv(t, ep, flags) - BTREE *t; - EPG *ep; - int flags; +__bt_seqadv(BTREE *t, EPG *ep, int flags) { CURSOR *c; PAGE *h; @@ -337,11 +327,7 @@ usecurrent: F_CLR(c, CURS_AFTER | CURS_ * or RET_SPECIAL if no such key exists. */ static int -__bt_first(t, key, erval, exactp) - BTREE *t; - const DBT *key; - EPG *erval; - int *exactp; +__bt_first(BTREE *t, const DBT *key, EPG *erval, int *exactp) { PAGE *h; EPG *ep, save; Modified: head/lib/libc/db/btree/bt_split.c ============================================================================== --- head/lib/libc/db/btree/bt_split.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_split.c Mon Mar 2 23:47:18 2009 (r189291) @@ -47,10 +47,10 @@ __FBSDID("$FreeBSD$"); #include "btree.h" static int bt_broot(BTREE *, PAGE *, PAGE *, PAGE *); -static PAGE *bt_page (BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t); +static PAGE *bt_page(BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t); static int bt_preserve(BTREE *, pgno_t); -static PAGE *bt_psplit (BTREE *, PAGE *, PAGE *, PAGE *, indx_t *, size_t); -static PAGE *bt_root (BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t); +static PAGE *bt_psplit(BTREE *, PAGE *, PAGE *, PAGE *, indx_t *, size_t); +static PAGE *bt_root(BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t); static int bt_rroot(BTREE *, PAGE *, PAGE *, PAGE *); static recno_t rec_total(PAGE *); @@ -74,13 +74,8 @@ u_long bt_rootsplit, bt_split, bt_sortsp * RET_ERROR, RET_SUCCESS */ int -__bt_split(t, sp, key, data, flags, ilen, argskip) - BTREE *t; - PAGE *sp; - const DBT *key, *data; - int flags; - size_t ilen; - u_int32_t argskip; +__bt_split(BTREE *t, PAGE *sp, const DBT *key, const DBT *data, int flags, + size_t ilen, u_int32_t argskip) { BINTERNAL *bi; BLEAF *bl, *tbl; @@ -336,11 +331,7 @@ err2: mpool_put(t->bt_mp, l, 0); * Pointer to page in which to insert or NULL on error. */ static PAGE * -bt_page(t, h, lp, rp, skip, ilen) - BTREE *t; - PAGE *h, **lp, **rp; - indx_t *skip; - size_t ilen; +bt_page(BTREE *t, PAGE *h, PAGE **lp, PAGE **rp, indx_t *skip, size_t ilen) { PAGE *l, *r, *tp; pgno_t npg; @@ -441,11 +432,7 @@ bt_page(t, h, lp, rp, skip, ilen) * Pointer to page in which to insert or NULL on error. */ static PAGE * -bt_root(t, h, lp, rp, skip, ilen) - BTREE *t; - PAGE *h, **lp, **rp; - indx_t *skip; - size_t ilen; +bt_root(BTREE *t, PAGE *h, PAGE **lp, PAGE **rp, indx_t *skip, size_t ilen) { PAGE *l, *r, *tp; pgno_t lnpg, rnpg; @@ -488,9 +475,7 @@ bt_root(t, h, lp, rp, skip, ilen) * RET_ERROR, RET_SUCCESS */ static int -bt_rroot(t, h, l, r) - BTREE *t; - PAGE *h, *l, *r; +bt_rroot(BTREE *t, PAGE *h, PAGE *l, PAGE *r) { char *dest; @@ -528,9 +513,7 @@ bt_rroot(t, h, l, r) * RET_ERROR, RET_SUCCESS */ static int -bt_broot(t, h, l, r) - BTREE *t; - PAGE *h, *l, *r; +bt_broot(BTREE *t, PAGE *h, PAGE *l, PAGE *r) { BINTERNAL *bi; BLEAF *bl; @@ -605,11 +588,7 @@ bt_broot(t, h, l, r) * Pointer to page in which to insert. */ static PAGE * -bt_psplit(t, h, l, r, pskip, ilen) - BTREE *t; - PAGE *h, *l, *r; - indx_t *pskip; - size_t ilen; +bt_psplit(BTREE *t, PAGE *h, PAGE *l, PAGE *r, indx_t *pskip, size_t ilen) { BINTERNAL *bi; BLEAF *bl; @@ -783,9 +762,7 @@ bt_psplit(t, h, l, r, pskip, ilen) * RET_SUCCESS, RET_ERROR. */ static int -bt_preserve(t, pg) - BTREE *t; - pgno_t pg; +bt_preserve(BTREE *t, pgno_t pg) { PAGE *h; @@ -811,8 +788,7 @@ bt_preserve(t, pg) * all the way back to bt_split/bt_rroot and it's not very clean. */ static recno_t -rec_total(h) - PAGE *h; +rec_total(PAGE *h) { recno_t recs; indx_t nxt, top; Modified: head/lib/libc/db/btree/bt_utils.c ============================================================================== --- head/lib/libc/db/btree/bt_utils.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_utils.c Mon Mar 2 23:47:18 2009 (r189291) @@ -62,11 +62,7 @@ __FBSDID("$FreeBSD$"); * RET_SUCCESS, RET_ERROR. */ int -__bt_ret(t, e, key, rkey, data, rdata, copy) - BTREE *t; - EPG *e; - DBT *key, *rkey, *data, *rdata; - int copy; +__bt_ret(BTREE *t, EPG *e, DBT *key, DBT *rkey, DBT *data, DBT *rdata, int copy) { BLEAF *bl; void *p; @@ -148,10 +144,7 @@ dataonly: * > 0 if k1 is > record */ int -__bt_cmp(t, k1, e) - BTREE *t; - const DBT *k1; - EPG *e; +__bt_cmp(BTREE *t, const DBT *k1, EPG *e) { BINTERNAL *bi; BLEAF *bl; @@ -211,8 +204,7 @@ __bt_cmp(t, k1, e) * > 0 if a is > b */ int -__bt_defcmp(a, b) - const DBT *a, *b; +__bt_defcmp(const DBT *a, const DBT *b) { size_t len; u_char *p1, *p2; @@ -241,8 +233,7 @@ __bt_defcmp(a, b) * Number of bytes needed to distinguish b from a. */ size_t -__bt_defpfx(a, b) - const DBT *a, *b; +__bt_defpfx(const DBT *a, const DBT *b) { u_char *p1, *p2; size_t cnt, len; Modified: head/lib/libc/db/db/db.c ============================================================================== --- head/lib/libc/db/db/db.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/db/db.c Mon Mar 2 23:47:18 2009 (r189291) @@ -42,12 +42,10 @@ __FBSDID("$FreeBSD$"); #include +static int __dberr(void); + DB * -dbopen(fname, flags, mode, type, openinfo) - const char *fname; - int flags, mode; - DBTYPE type; - const void *openinfo; +dbopen(const char *fname, int flags, int mode, DBTYPE type, const void *openinfo) { #define DB_FLAGS (DB_LOCK | DB_SHMEM | DB_TXN) @@ -72,7 +70,7 @@ dbopen(fname, flags, mode, type, openinf } static int -__dberr() +__dberr(void) { return (RET_ERROR); } @@ -84,14 +82,13 @@ __dberr() * dbp: pointer to the DB structure. */ void -__dbpanic(dbp) - DB *dbp; +__dbpanic(DB *dbp) { /* The only thing that can succeed is a close. */ - dbp->del = (int (*)())__dberr; - dbp->fd = (int (*)())__dberr; - dbp->get = (int (*)())__dberr; - dbp->put = (int (*)())__dberr; - dbp->seq = (int (*)())__dberr; - dbp->sync = (int (*)())__dberr; + dbp->del = (int (*)(const struct __db *, const DBT*, u_int))__dberr; + dbp->fd = (int (*)(const struct __db *))__dberr; + dbp->get = (int (*)(const struct __db *, const DBT*, DBT *, u_int))__dberr; + dbp->put = (int (*)(const struct __db *, DBT *, const DBT *, u_int))__dberr; + dbp->seq = (int (*)(const struct __db *, DBT *, DBT *, u_int))__dberr; + dbp->sync = (int (*)(const struct __db *, u_int))__dberr; } Modified: head/lib/libc/db/hash/hash.c ============================================================================== --- head/lib/libc/db/hash/hash.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/hash/hash.c Mon Mar 2 23:47:18 2009 (r189291) @@ -92,11 +92,11 @@ int hash_accesses, hash_collisions, hash /************************** INTERFACE ROUTINES ***************************/ /* OPEN/CLOSE */ -extern DB * -__hash_open(file, flags, mode, info, dflags) - const char *file; - int flags, mode, dflags; - const HASHINFO *info; /* Special directives for create */ +/* ARGSUSED */ +DB * +__hash_open(const char *file, int flags, int mode, + const HASHINFO *info, /* Special directives for create */ + int dflags) { HTAB *hashp; struct stat statbuf; @@ -249,8 +249,7 @@ error0: } static int -hash_close(dbp) - DB *dbp; +hash_close(DB *dbp) { HTAB *hashp; int retval; @@ -265,8 +264,7 @@ hash_close(dbp) } static int -hash_fd(dbp) - const DB *dbp; +hash_fd(const DB *dbp) { HTAB *hashp; @@ -283,10 +281,7 @@ hash_fd(dbp) /************************** LOCAL CREATION ROUTINES **********************/ static HTAB * -init_hash(hashp, file, info) - HTAB *hashp; - const char *file; - const HASHINFO *info; +init_hash(HTAB *hashp, const char *file, const HASHINFO *info) { struct stat statbuf; int nelem; @@ -350,9 +345,7 @@ init_hash(hashp, file, info) * Returns 0 on No Error */ static int -init_htab(hashp, nelem) - HTAB *hashp; - int nelem; +init_htab(HTAB *hashp, int nelem) { int nbuckets, nsegs; int l2; @@ -396,8 +389,7 @@ init_htab(hashp, nelem) * structure, freeing all allocated space. */ static int -hdestroy(hashp) - HTAB *hashp; +hdestroy(HTAB *hashp) { int i, save_errno; @@ -456,9 +448,7 @@ hdestroy(hashp) * -1 ERROR */ static int -hash_sync(dbp, flags) - const DB *dbp; - u_int32_t flags; +hash_sync(const DB *dbp, u_int32_t flags) { HTAB *hashp; @@ -485,8 +475,7 @@ hash_sync(dbp, flags) * -1 indicates that errno should be set */ static int -flush_meta(hashp) - HTAB *hashp; +flush_meta(HTAB *hashp) { HASHHDR *whdrp; #if BYTE_ORDER == LITTLE_ENDIAN @@ -533,11 +522,7 @@ flush_meta(hashp) * -1 to indicate an internal ERROR (i.e. out of memory, etc) */ static int -hash_get(dbp, key, data, flag) - const DB *dbp; - const DBT *key; - DBT *data; - u_int32_t flag; +hash_get(const DB *dbp, const DBT *key, DBT *data, u_int32_t flag) { HTAB *hashp; @@ -550,11 +535,7 @@ hash_get(dbp, key, data, flag) } static int -hash_put(dbp, key, data, flag) - const DB *dbp; - DBT *key; - const DBT *data; - u_int32_t flag; +hash_put(const DB *dbp, DBT *key, const DBT *data, u_int32_t flag) { HTAB *hashp; @@ -573,10 +554,8 @@ hash_put(dbp, key, data, flag) } static int -hash_delete(dbp, key, flag) - const DB *dbp; - const DBT *key; - u_int32_t flag; /* Ignored */ +hash_delete(const DB *dbp, const DBT *key, + u_int32_t flag) /* Ignored */ { HTAB *hashp; @@ -596,10 +575,7 @@ hash_delete(dbp, key, flag) * Assume that hashp has been set in wrapper routine. */ static int -hash_access(hashp, action, key, val) - HTAB *hashp; - ACTION action; - DBT *key, *val; +hash_access(HTAB *hashp, ACTION action, DBT *key, DBT *val) { BUFHEAD *rbufp; BUFHEAD *bufp, *save_bufp; @@ -725,10 +701,7 @@ found: } static int -hash_seq(dbp, key, data, flag) - const DB *dbp; - DBT *key, *data; - u_int32_t flag; +hash_seq(const DB *dbp, DBT *key, DBT *data, u_int32_t flag) { u_int32_t bucket; BUFHEAD *bufp; @@ -814,9 +787,8 @@ hash_seq(dbp, key, data, flag) * 0 ==> OK * -1 ==> Error */ -extern int -__expand_table(hashp) - HTAB *hashp; +int +__expand_table(HTAB *hashp) { u_int32_t old_bucket, new_bucket; int dirsize, new_segnum, spare_ndx; @@ -870,9 +842,7 @@ __expand_table(hashp) * fails, then this routine can go away. */ static void * -hash_realloc(p_ptr, oldsize, newsize) - SEGMENT **p_ptr; - int oldsize, newsize; +hash_realloc(SEGMENT **p_ptr, int oldsize, int newsize) { void *p; @@ -885,11 +855,8 @@ hash_realloc(p_ptr, oldsize, newsize) return (p); } -extern u_int32_t -__call_hash(hashp, k, len) - HTAB *hashp; - char *k; - int len; +u_int32_t +__call_hash(HTAB *hashp, char *k, int len) { int n, bucket; @@ -906,9 +873,7 @@ __call_hash(hashp, k, len) * Returns 0 on success */ static int -alloc_segs(hashp, nsegs) - HTAB *hashp; - int nsegs; +alloc_segs(HTAB *hashp, int nsegs) { int i; SEGMENT store; @@ -940,8 +905,7 @@ alloc_segs(hashp, nsegs) * Hashp->hdr needs to be byteswapped. */ static void -swap_header_copy(srcp, destp) - HASHHDR *srcp, *destp; +swap_header_copy(HASHHDR *srcp, HASHHDR *destp) { int i; @@ -969,8 +933,7 @@ swap_header_copy(srcp, destp) } static void -swap_header(hashp) - HTAB *hashp; +swap_header(HTAB *hashp) { HASHHDR *hdrp; int i; Modified: head/lib/libc/db/hash/hash_bigkey.c ============================================================================== --- head/lib/libc/db/hash/hash_bigkey.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/hash/hash_bigkey.c Mon Mar 2 23:47:18 2009 (r189291) @@ -82,11 +82,8 @@ static int collect_data(HTAB *, BUFHEAD * 0 ==> OK *-1 ==> ERROR */ -extern int -__big_insert(hashp, bufp, key, val) - HTAB *hashp; - BUFHEAD *bufp; - const DBT *key, *val; +int +__big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) { u_int16_t *p; int key_size, n, val_size; @@ -182,10 +179,8 @@ __big_insert(hashp, bufp, key, val) * 0 => OK *-1 => ERROR */ -extern int -__big_delete(hashp, bufp) - HTAB *hashp; - BUFHEAD *bufp; +int +__big_delete(HTAB *hashp, BUFHEAD *bufp) { BUFHEAD *last_bfp, *rbufp; u_int16_t *bp, pageno; @@ -261,13 +256,8 @@ __big_delete(hashp, bufp) * -2 means key not found and this is big key/data * -3 error */ -extern int -__find_bigpair(hashp, bufp, ndx, key, size) - HTAB *hashp; - BUFHEAD *bufp; - int ndx; - char *key; - int size; +int +__find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size) { u_int16_t *bp; char *p; @@ -313,10 +303,8 @@ __find_bigpair(hashp, bufp, ndx, key, si * of the pair; 0 if there isn't any (i.e. big pair is the last key in the * bucket) */ -extern u_int16_t -__find_last_page(hashp, bpp) - HTAB *hashp; - BUFHEAD **bpp; +u_int16_t +__find_last_page(HTAB *hashp, BUFHEAD **bpp) { BUFHEAD *bufp; u_int16_t *bp, pageno; @@ -354,13 +342,8 @@ __find_last_page(hashp, bpp) * Return the data for the key/data pair that begins on this page at this * index (index should always be 1). */ -extern int -__big_return(hashp, bufp, ndx, val, set_current) - HTAB *hashp; - BUFHEAD *bufp; - int ndx; - DBT *val; - int set_current; +int +__big_return(HTAB *hashp, BUFHEAD *bufp, int ndx, DBT *val, int set_current) { BUFHEAD *save_p; u_int16_t *bp, len, off, save_addr; @@ -446,10 +429,7 @@ __big_return(hashp, bufp, ndx, val, set_ * allocate a buffer and copy the data as you recurse up. */ static int -collect_data(hashp, bufp, len, set) - HTAB *hashp; - BUFHEAD *bufp; - int len, set; +collect_data(HTAB *hashp, BUFHEAD *bufp, int len, int set) { u_int16_t *bp; char *p; @@ -501,12 +481,8 @@ collect_data(hashp, bufp, len, set) /* * Fill in the key and data for this big pair. */ -extern int -__big_keydata(hashp, bufp, key, val, set) - HTAB *hashp; - BUFHEAD *bufp; - DBT *key, *val; - int set; +int +__big_keydata(HTAB *hashp, BUFHEAD *bufp, DBT *key, DBT *val, int set) { key->size = collect_key(hashp, bufp, 0, val, set); if (key->size == -1) @@ -520,12 +496,7 @@ __big_keydata(hashp, bufp, key, val, set * collect the data, allocate a buffer and copy the key as you recurse up. */ static int -collect_key(hashp, bufp, len, val, set) - HTAB *hashp; - BUFHEAD *bufp; - int len; - DBT *val; - int set; +collect_key(HTAB *hashp, BUFHEAD *bufp, int len, DBT *val, int set) { BUFHEAD *xbp; char *p; @@ -564,16 +535,14 @@ collect_key(hashp, bufp, len, val, set) * 0 => OK * -1 => error */ -extern int -__big_split(hashp, op, np, big_keyp, addr, obucket, ret) - HTAB *hashp; - BUFHEAD *op; /* Pointer to where to put keys that go in old bucket */ - BUFHEAD *np; /* Pointer to new bucket page */ - /* Pointer to first page containing the big key/data */ - BUFHEAD *big_keyp; - int addr; /* Address of big_keyp */ - u_int32_t obucket;/* Old Bucket */ - SPLIT_RETURN *ret; +int +__big_split(HTAB *hashp, + BUFHEAD *op, /* Pointer to where to put keys that go in old bucket */ + BUFHEAD *np, /* Pointer to new bucket page */ + BUFHEAD *big_keyp, /* Pointer to first page containing the big key/data */ + int addr, /* Address of big_keyp */ + u_int32_t obucket, /* Old Bucket */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From delphij at FreeBSD.org Mon Mar 2 18:16:13 2009 From: delphij at FreeBSD.org (Xin LI) Date: Mon Mar 2 18:16:26 2009 Subject: svn commit: r189292 - in head/lib/libc/db: btree recno Message-ID: <200903030216.n232GCbC092350@svn.freebsd.org> Author: delphij Date: Tue Mar 3 02:16:12 2009 New Revision: 189292 URL: http://svn.freebsd.org/changeset/base/189292 Log: Rename variable 'index' to 'idx' to avoid name collision with index(3), this commit does not affect any object code. Obtained from: OpenBSD Verified with: md5(1) Modified: head/lib/libc/db/btree/bt_delete.c head/lib/libc/db/btree/bt_put.c head/lib/libc/db/btree/bt_search.c head/lib/libc/db/btree/bt_seq.c head/lib/libc/db/recno/rec_delete.c head/lib/libc/db/recno/rec_put.c head/lib/libc/db/recno/rec_search.c Modified: head/lib/libc/db/btree/bt_delete.c ============================================================================== --- head/lib/libc/db/btree/bt_delete.c Mon Mar 2 23:47:18 2009 (r189291) +++ head/lib/libc/db/btree/bt_delete.c Tue Mar 3 02:16:12 2009 (r189292) @@ -142,7 +142,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR EPG *e; EPGNO *parent; PAGE *h; - indx_t index; + indx_t idx; pgno_t pgno; recno_t nextpg, prevpg; int exact, level; @@ -180,8 +180,8 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR /* Move to the next index. */ if (parent->index != NEXTINDEX(h) - 1) { - index = parent->index + 1; - BT_PUSH(t, h->pgno, index); + idx = parent->index + 1; + BT_PUSH(t, h->pgno, idx); break; } mpool_put(t->bt_mp, h, 0); @@ -190,7 +190,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR /* Restore the stack. */ while (level--) { /* Push the next level down onto the stack. */ - bi = GETBINTERNAL(h, index); + bi = GETBINTERNAL(h, idx); pgno = bi->pgno; BT_PUSH(t, pgno, 0); @@ -200,7 +200,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR /* Get the next level down. */ if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL) return (1); - index = 0; + idx = 0; } mpool_put(t->bt_mp, h, 0); if ((h = mpool_get(t->bt_mp, nextpg, 0)) == NULL) @@ -235,8 +235,8 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR /* Move to the next index. */ if (parent->index != 0) { - index = parent->index - 1; - BT_PUSH(t, h->pgno, index); + idx = parent->index - 1; + BT_PUSH(t, h->pgno, idx); break; } mpool_put(t->bt_mp, h, 0); @@ -245,7 +245,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR /* Restore the stack. */ while (level--) { /* Push the next level down onto the stack. */ - bi = GETBINTERNAL(h, index); + bi = GETBINTERNAL(h, idx); pgno = bi->pgno; /* Lose the currently pinned page. */ @@ -255,8 +255,8 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL) return (1); - index = NEXTINDEX(h) - 1; - BT_PUSH(t, pgno, index); + idx = NEXTINDEX(h) - 1; + BT_PUSH(t, pgno, idx); } mpool_put(t->bt_mp, h, 0); if ((h = mpool_get(t->bt_mp, prevpg, 0)) == NULL) @@ -370,7 +370,7 @@ __bt_pdelete(BTREE *t, PAGE *h) BINTERNAL *bi; PAGE *pg; EPGNO *parent; - indx_t cnt, index, *ip, offset; + indx_t cnt, idx, *ip, offset; u_int32_t nksize; char *from; @@ -391,8 +391,8 @@ __bt_pdelete(BTREE *t, PAGE *h) if ((pg = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL) return (RET_ERROR); - index = parent->index; - bi = GETBINTERNAL(pg, index); + idx = parent->index; + bi = GETBINTERNAL(pg, idx); /* Free any overflow pages. */ if (bi->flags & P_BIGKEY && @@ -424,11 +424,11 @@ __bt_pdelete(BTREE *t, PAGE *h) pg->upper += nksize; /* Adjust indices' offsets, shift the indices down. */ - offset = pg->linp[index]; - for (cnt = index, ip = &pg->linp[0]; cnt--; ++ip) + offset = pg->linp[idx]; + for (cnt = idx, ip = &pg->linp[0]; cnt--; ++ip) if (ip[0] < offset) ip[0] += nksize; - for (cnt = NEXTINDEX(pg) - index; --cnt; ++ip) + for (cnt = NEXTINDEX(pg) - idx; --cnt; ++ip) ip[0] = ip[1] < offset ? ip[1] + nksize : ip[1]; pg->lower -= sizeof(indx_t); } @@ -453,17 +453,13 @@ __bt_pdelete(BTREE *t, PAGE *h) * t: tree * key: referenced key * h: page - * index: index on page to delete + * idx: index on page to delete * * Returns: * RET_SUCCESS, RET_ERROR. */ int -__bt_dleaf(t, key, h, index) - BTREE *t; - const DBT *key; - PAGE *h; - u_int index; +__bt_dleaf(BTREE *t, const DBT *key, PAGE *h, u_int idx) { BLEAF *bl; indx_t cnt, *ip, offset; @@ -474,12 +470,12 @@ __bt_dleaf(t, key, h, index) /* If this record is referenced by the cursor, delete the cursor. */ if (F_ISSET(&t->bt_cursor, CURS_INIT) && !F_ISSET(&t->bt_cursor, CURS_ACQUIRE) && - t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index == index && - __bt_curdel(t, key, h, index)) + t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index == idx && + __bt_curdel(t, key, h, idx)) return (RET_ERROR); /* If the entry uses overflow pages, make them available for reuse. */ - to = bl = GETBLEAF(h, index); + to = bl = GETBLEAF(h, idx); if (bl->flags & P_BIGKEY && __ovfl_delete(t, bl->bytes) == RET_ERROR) return (RET_ERROR); if (bl->flags & P_BIGDATA && @@ -493,18 +489,18 @@ __bt_dleaf(t, key, h, index) h->upper += nbytes; /* Adjust the indices' offsets, shift the indices down. */ - offset = h->linp[index]; - for (cnt = index, ip = &h->linp[0]; cnt--; ++ip) + offset = h->linp[idx]; + for (cnt = idx, ip = &h->linp[0]; cnt--; ++ip) if (ip[0] < offset) ip[0] += nbytes; - for (cnt = NEXTINDEX(h) - index; --cnt; ++ip) + for (cnt = NEXTINDEX(h) - idx; --cnt; ++ip) ip[0] = ip[1] < offset ? ip[1] + nbytes : ip[1]; h->lower -= sizeof(indx_t); /* If the cursor is on this page, adjust it as necessary. */ if (F_ISSET(&t->bt_cursor, CURS_INIT) && !F_ISSET(&t->bt_cursor, CURS_ACQUIRE) && - t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index > index) + t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index > idx) --t->bt_cursor.pg.index; return (RET_SUCCESS); @@ -518,17 +514,13 @@ __bt_dleaf(t, key, h, index) * t: tree * key: referenced key (or NULL) * h: page - * index: index on page to delete + * idx: index on page to delete * * Returns: * RET_SUCCESS, RET_ERROR. */ static int -__bt_curdel(t, key, h, index) - BTREE *t; - const DBT *key; - PAGE *h; - u_int index; +__bt_curdel(BTREE *t, const DBT *key, PAGE *h, u_int idx) { CURSOR *c; EPG e; @@ -551,7 +543,7 @@ __bt_curdel(t, key, h, index) */ if (key == NULL) { e.page = h; - e.index = index; + e.index = idx; if ((status = __bt_ret(t, &e, &c->key, &c->key, NULL, NULL, 1)) != RET_SUCCESS) return (status); @@ -559,25 +551,25 @@ __bt_curdel(t, key, h, index) key = &c->key; } /* Check previous key, if not at the beginning of the page. */ - if (index > 0) { + if (idx > 0) { e.page = h; - e.index = index - 1; + e.index = idx - 1; if (__bt_cmp(t, key, &e) == 0) { F_SET(c, CURS_BEFORE); goto dup2; } } /* Check next key, if not at the end of the page. */ - if (index < NEXTINDEX(h) - 1) { + if (idx < NEXTINDEX(h) - 1) { e.page = h; - e.index = index + 1; + e.index = idx + 1; if (__bt_cmp(t, key, &e) == 0) { F_SET(c, CURS_AFTER); goto dup2; } } /* Check previous key if at the beginning of the page. */ - if (index == 0 && h->prevpg != P_INVALID) { + if (idx == 0 && h->prevpg != P_INVALID) { if ((pg = mpool_get(t->bt_mp, h->prevpg, 0)) == NULL) return (RET_ERROR); e.page = pg; @@ -589,7 +581,7 @@ __bt_curdel(t, key, h, index) mpool_put(t->bt_mp, pg, 0); } /* Check next key if at the end of the page. */ - if (index == NEXTINDEX(h) - 1 && h->nextpg != P_INVALID) { + if (idx == NEXTINDEX(h) - 1 && h->nextpg != P_INVALID) { if ((pg = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL) return (RET_ERROR); e.page = pg; @@ -605,7 +597,7 @@ dup2: c->pg.pgno = e.page->pgno; } } e.page = h; - e.index = index; + e.index = idx; if (curcopy || (status = __bt_ret(t, &e, &c->key, &c->key, NULL, NULL, 1)) == RET_SUCCESS) { F_SET(c, CURS_ACQUIRE); Modified: head/lib/libc/db/btree/bt_put.c ============================================================================== --- head/lib/libc/db/btree/bt_put.c Mon Mar 2 23:47:18 2009 (r189291) +++ head/lib/libc/db/btree/bt_put.c Tue Mar 3 02:16:12 2009 (r189292) @@ -68,7 +68,7 @@ __bt_put(const DB *dbp, DBT *key, const DBT tkey, tdata; EPG *e; PAGE *h; - indx_t index, nxtindex; + indx_t idx, nxtindex; pgno_t pg; u_int32_t nbytes, tmp; int dflags, exact, status; @@ -149,7 +149,7 @@ storekey: if (__ovfl_put(t, key, &pg) = if (flags == R_CURSOR) { if ((h = mpool_get(t->bt_mp, t->bt_cursor.pg.pgno, 0)) == NULL) return (RET_ERROR); - index = t->bt_cursor.pg.index; + idx = t->bt_cursor.pg.index; goto delete; } @@ -161,7 +161,7 @@ storekey: if (__ovfl_put(t, key, &pg) = if ((e = __bt_search(t, key, &exact)) == NULL) return (RET_ERROR); h = e->page; - index = e->index; + idx = e->index; /* * Add the key/data pair to the tree. If an identical key is already @@ -183,7 +183,7 @@ storekey: if (__ovfl_put(t, key, &pg) = * Note, the delete may empty the page, so we need to put a * new entry into the page immediately. */ -delete: if (__bt_dleaf(t, key, h, index) == RET_ERROR) { +delete: if (__bt_dleaf(t, key, h, idx) == RET_ERROR) { mpool_put(t->bt_mp, h, 0); return (RET_ERROR); } @@ -199,35 +199,35 @@ delete: if (__bt_dleaf(t, key, h, index nbytes = NBLEAFDBT(key->size, data->size); if (h->upper - h->lower < nbytes + sizeof(indx_t)) { if ((status = __bt_split(t, h, key, - data, dflags, nbytes, index)) != RET_SUCCESS) + data, dflags, nbytes, idx)) != RET_SUCCESS) return (status); goto success; } - if (index < (nxtindex = NEXTINDEX(h))) - memmove(h->linp + index + 1, h->linp + index, - (nxtindex - index) * sizeof(indx_t)); + if (idx < (nxtindex = NEXTINDEX(h))) + memmove(h->linp + idx + 1, h->linp + idx, + (nxtindex - idx) * sizeof(indx_t)); h->lower += sizeof(indx_t); - h->linp[index] = h->upper -= nbytes; + h->linp[idx] = h->upper -= nbytes; dest = (char *)h + h->upper; WR_BLEAF(dest, key, data, dflags); /* If the cursor is on this page, adjust it as necessary. */ if (F_ISSET(&t->bt_cursor, CURS_INIT) && !F_ISSET(&t->bt_cursor, CURS_ACQUIRE) && - t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= index) + t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= idx) ++t->bt_cursor.pg.index; if (t->bt_order == NOT) { if (h->nextpg == P_INVALID) { - if (index == NEXTINDEX(h) - 1) { + if (idx == NEXTINDEX(h) - 1) { t->bt_order = FORWARD; - t->bt_last.index = index; + t->bt_last.index = idx; t->bt_last.pgno = h->pgno; } } else if (h->prevpg == P_INVALID) { - if (index == 0) { + if (idx == 0) { t->bt_order = BACK; t->bt_last.index = 0; t->bt_last.pgno = h->pgno; Modified: head/lib/libc/db/btree/bt_search.c ============================================================================== --- head/lib/libc/db/btree/bt_search.c Mon Mar 2 23:47:18 2009 (r189291) +++ head/lib/libc/db/btree/bt_search.c Tue Mar 3 02:16:12 2009 (r189292) @@ -64,7 +64,7 @@ EPG * __bt_search(BTREE *t, const DBT *key, int *exactp) { PAGE *h; - indx_t base, index, lim; + indx_t base, idx, lim; pgno_t pg; int cmp; @@ -76,7 +76,7 @@ __bt_search(BTREE *t, const DBT *key, in /* Do a binary search on the current page. */ t->bt_cur.page = h; for (base = 0, lim = NEXTINDEX(h); lim; lim >>= 1) { - t->bt_cur.index = index = base + (lim >> 1); + t->bt_cur.index = idx = base + (lim >> 1); if ((cmp = __bt_cmp(t, key, &t->bt_cur)) == 0) { if (h->flags & P_BLEAF) { *exactp = 1; @@ -85,7 +85,7 @@ __bt_search(BTREE *t, const DBT *key, in goto next; } if (cmp > 0) { - base = index + 1; + base = idx + 1; --lim; } } @@ -121,10 +121,10 @@ __bt_search(BTREE *t, const DBT *key, in * be a parent page for the key. If a split later occurs, the * inserted page will be to the right of the saved page. */ - index = base ? base - 1 : base; + idx = base ? base - 1 : base; -next: BT_PUSH(t, h->pgno, index); - pg = GETBINTERNAL(h, index)->pgno; +next: BT_PUSH(t, h->pgno, idx); + pg = GETBINTERNAL(h, idx)->pgno; mpool_put(t->bt_mp, h, 0); } } Modified: head/lib/libc/db/btree/bt_seq.c ============================================================================== --- head/lib/libc/db/btree/bt_seq.c Mon Mar 2 23:47:18 2009 (r189291) +++ head/lib/libc/db/btree/bt_seq.c Tue Mar 3 02:16:12 2009 (r189292) @@ -232,7 +232,7 @@ __bt_seqadv(BTREE *t, EPG *ep, int flags { CURSOR *c; PAGE *h; - indx_t index; + indx_t idx; pgno_t pg; int exact; @@ -270,15 +270,15 @@ __bt_seqadv(BTREE *t, EPG *ep, int flags */ if (F_ISSET(c, CURS_AFTER)) goto usecurrent; - index = c->pg.index; - if (++index == NEXTINDEX(h)) { + idx = c->pg.index; + if (++idx == NEXTINDEX(h)) { pg = h->nextpg; mpool_put(t->bt_mp, h, 0); if (pg == P_INVALID) return (RET_SPECIAL); if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL) return (RET_ERROR); - index = 0; + idx = 0; } break; case R_PREV: /* Previous record. */ @@ -293,22 +293,22 @@ usecurrent: F_CLR(c, CURS_AFTER | CURS_ ep->index = c->pg.index; return (RET_SUCCESS); } - index = c->pg.index; - if (index == 0) { + idx = c->pg.index; + if (idx == 0) { pg = h->prevpg; mpool_put(t->bt_mp, h, 0); if (pg == P_INVALID) return (RET_SPECIAL); if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL) return (RET_ERROR); - index = NEXTINDEX(h) - 1; + idx = NEXTINDEX(h) - 1; } else - --index; + --idx; break; } ep->page = h; - ep->index = index; + ep->index = idx; return (RET_SUCCESS); } @@ -421,13 +421,10 @@ __bt_first(BTREE *t, const DBT *key, EPG * Parameters: * t: the tree * pgno: page number - * index: page index + * idx: page index */ void -__bt_setcur(t, pgno, index) - BTREE *t; - pgno_t pgno; - u_int index; +__bt_setcur(BTREE *t, pgno_t pgno, u_int idx) { /* Lose any already deleted key. */ if (t->bt_cursor.key.data != NULL) { @@ -439,6 +436,6 @@ __bt_setcur(t, pgno, index) /* Update the cursor. */ t->bt_cursor.pg.pgno = pgno; - t->bt_cursor.pg.index = index; + t->bt_cursor.pg.index = idx; F_SET(&t->bt_cursor, CURS_INIT); } Modified: head/lib/libc/db/recno/rec_delete.c ============================================================================== --- head/lib/libc/db/recno/rec_delete.c Mon Mar 2 23:47:18 2009 (r189291) +++ head/lib/libc/db/recno/rec_delete.c Tue Mar 3 02:16:12 2009 (r189292) @@ -138,16 +138,13 @@ rec_rdelete(BTREE *t, recno_t nrec) * * Parameters: * t: tree - * index: index on current page to delete + * idx: index on current page to delete * * Returns: * RET_SUCCESS, RET_ERROR. */ int -__rec_dleaf(t, h, index) - BTREE *t; - PAGE *h; - u_int32_t index; +__rec_dleaf(BTREE *t, PAGE *h, u_int32_t idx) { RLEAF *rl; indx_t *ip, cnt, offset; @@ -165,7 +162,7 @@ __rec_dleaf(t, h, index) * down, overwriting the deleted record and its index. If the record * uses overflow pages, make them available for reuse. */ - to = rl = GETRLEAF(h, index); + to = rl = GETRLEAF(h, idx); if (rl->flags & P_BIGDATA && __ovfl_delete(t, rl->bytes) == RET_ERROR) return (RET_ERROR); nbytes = NRLEAF(rl); @@ -178,8 +175,8 @@ __rec_dleaf(t, h, index) memmove(from + nbytes, from, (char *)to - from); h->upper += nbytes; - offset = h->linp[index]; - for (cnt = &h->linp[index] - (ip = &h->linp[0]); cnt--; ++ip) + offset = h->linp[idx]; + for (cnt = &h->linp[idx] - (ip = &h->linp[0]); cnt--; ++ip) if (ip[0] < offset) ip[0] += nbytes; for (cnt = &h->linp[NEXTINDEX(h)] - ip; --cnt; ++ip) Modified: head/lib/libc/db/recno/rec_put.c ============================================================================== --- head/lib/libc/db/recno/rec_put.c Mon Mar 2 23:47:18 2009 (r189291) +++ head/lib/libc/db/recno/rec_put.c Tue Mar 3 02:16:12 2009 (r189292) @@ -191,7 +191,7 @@ __rec_iput(BTREE *t, recno_t nrec, const DBT tdata; EPG *e; PAGE *h; - indx_t index, nxtindex; + indx_t idx, nxtindex; pgno_t pg; u_int32_t nbytes; int dflags, status; @@ -222,7 +222,7 @@ __rec_iput(BTREE *t, recno_t nrec, const return (RET_ERROR); h = e->page; - index = e->index; + idx = e->index; /* * Add the specified key/data pair to the tree. The R_IAFTER and @@ -232,13 +232,13 @@ __rec_iput(BTREE *t, recno_t nrec, const */ switch (flags) { case R_IAFTER: - ++index; + ++idx; break; case R_IBEFORE: break; default: if (nrec < t->bt_nrecs && - __rec_dleaf(t, h, index) == RET_ERROR) { + __rec_dleaf(t, h, idx) == RET_ERROR) { mpool_put(t->bt_mp, h, 0); return (RET_ERROR); } @@ -252,18 +252,18 @@ __rec_iput(BTREE *t, recno_t nrec, const */ nbytes = NRLEAFDBT(data->size); if (h->upper - h->lower < nbytes + sizeof(indx_t)) { - status = __bt_split(t, h, NULL, data, dflags, nbytes, index); + status = __bt_split(t, h, NULL, data, dflags, nbytes, idx); if (status == RET_SUCCESS) ++t->bt_nrecs; return (status); } - if (index < (nxtindex = NEXTINDEX(h))) - memmove(h->linp + index + 1, h->linp + index, - (nxtindex - index) * sizeof(indx_t)); + if (idx < (nxtindex = NEXTINDEX(h))) + memmove(h->linp + idx + 1, h->linp + idx, + (nxtindex - idx) * sizeof(indx_t)); h->lower += sizeof(indx_t); - h->linp[index] = h->upper -= nbytes; + h->linp[idx] = h->upper -= nbytes; dest = (char *)h + h->upper; WR_RLEAF(dest, data, dflags); Modified: head/lib/libc/db/recno/rec_search.c ============================================================================== --- head/lib/libc/db/recno/rec_search.c Mon Mar 2 23:47:18 2009 (r189291) +++ head/lib/libc/db/recno/rec_search.c Tue Mar 3 02:16:12 2009 (r189292) @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); EPG * __rec_search(BTREE *t, recno_t recno, enum SRCHOP op) { - indx_t index; + indx_t idx; PAGE *h; EPGNO *parent; RINTERNAL *r; @@ -79,23 +79,23 @@ __rec_search(BTREE *t, recno_t recno, en t->bt_cur.index = recno - total; return (&t->bt_cur); } - for (index = 0, top = NEXTINDEX(h);;) { - r = GETRINTERNAL(h, index); - if (++index == top || total + r->nrecs > recno) + for (idx = 0, top = NEXTINDEX(h);;) { + r = GETRINTERNAL(h, idx); + if (++idx == top || total + r->nrecs > recno) break; total += r->nrecs; } - BT_PUSH(t, pg, index - 1); + BT_PUSH(t, pg, idx - 1); pg = r->pgno; switch (op) { case SDELETE: - --GETRINTERNAL(h, (index - 1))->nrecs; + --GETRINTERNAL(h, (idx - 1))->nrecs; mpool_put(t->bt_mp, h, MPOOL_DIRTY); break; case SINSERT: - ++GETRINTERNAL(h, (index - 1))->nrecs; + ++GETRINTERNAL(h, (idx - 1))->nrecs; mpool_put(t->bt_mp, h, MPOOL_DIRTY); break; case SEARCH: From kientzle at FreeBSD.org Mon Mar 2 19:28:10 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Mon Mar 2 19:28:17 2009 Subject: svn commit: r189293 - head/lib/libarchive Message-ID: <200903030328.n233S9c2093935@svn.freebsd.org> Author: kientzle Date: Tue Mar 3 03:28:09 2009 New Revision: 189293 URL: http://svn.freebsd.org/changeset/base/189293 Log: Merge r272 from libarchive.googlecode.com: Fix building on MSVC6. Modified: head/lib/libarchive/archive_endian.h Modified: head/lib/libarchive/archive_endian.h ============================================================================== --- head/lib/libarchive/archive_endian.h Tue Mar 3 02:16:12 2009 (r189292) +++ head/lib/libarchive/archive_endian.h Tue Mar 3 03:28:09 2009 (r189293) @@ -41,8 +41,10 @@ * - SGI MIPSpro * - Microsoft Visual C++ 6.0 (supposedly newer versions too) */ -#if defined(__WATCOMC__) || defined(__sgi) || defined(_MSC_VER) +#if defined(__WATCOMC__) || defined(__sgi) #define inline +#elif defined(_MSC_VER) +#define inline __inline #endif /* Alignment-agnostic encode/decode bytestream to/from little/big endian. */ From kientzle at FreeBSD.org Mon Mar 2 19:33:26 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Mon Mar 2 19:33:38 2009 Subject: svn commit: r189294 - head/lib/libarchive Message-ID: <200903030333.n233XPBi094109@svn.freebsd.org> Author: kientzle Date: Tue Mar 3 03:33:25 2009 New Revision: 189294 URL: http://svn.freebsd.org/changeset/base/189294 Log: Merge r282 from libarchive.googlecode.com: Close multiple filters by walking the filter list in archive_read_close(). Modified: head/lib/libarchive/archive_read.c head/lib/libarchive/archive_read_support_compression_compress.c Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Tue Mar 3 03:28:09 2009 (r189293) +++ head/lib/libarchive/archive_read.c Tue Mar 3 03:33:25 2009 (r189294) @@ -595,11 +595,12 @@ archive_read_close(struct archive *_a) /* TODO: Clean up the formatters. */ /* Clean up the stream pipeline. */ - if (a->source != NULL) { + while (a->source != NULL) { + struct archive_read_source *t = a->source->upstream; r1 = (a->source->close)(a->source); if (r1 < r) r = r1; - a->source = NULL; + a->source = t; } /* Release the reader objects. */ Modified: head/lib/libarchive/archive_read_support_compression_compress.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_compress.c Tue Mar 3 03:28:09 2009 (r189293) +++ head/lib/libarchive/archive_read_support_compression_compress.c Tue Mar 3 03:33:25 2009 (r189294) @@ -339,7 +339,6 @@ compress_source_close(struct archive_rea { struct private_data *state = (struct private_data *)self->data; - self->upstream->close(self->upstream); free(state->out_block); free(state); free(self); From mav at FreeBSD.org Mon Mar 2 22:39:39 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Mon Mar 2 22:39:44 2009 Subject: svn commit: r189295 - head/sys/dev/ata/chipsets Message-ID: <200903030639.n236dcYs000461@svn.freebsd.org> Author: mav Date: Tue Mar 3 06:39:38 2009 New Revision: 189295 URL: http://svn.freebsd.org/changeset/base/189295 Log: Set PortMultiplier port only for SATA2 channels, where it is applicable. Doing it on old SATA controllers like Promise PDC20375 SATA150 breaks their operation. Tested by: marcus on PDC20375 Modified: head/sys/dev/ata/chipsets/ata-promise.c Modified: head/sys/dev/ata/chipsets/ata-promise.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-promise.c Tue Mar 3 03:33:25 2009 (r189294) +++ head/sys/dev/ata/chipsets/ata-promise.c Tue Mar 3 06:39:38 2009 (r189295) @@ -690,8 +690,11 @@ ata_promise_mio_command(struct ata_reque ATA_OUTL(ctlr->r_res2, (ch->unit + 1) << 2, 0x00000001); - /* set portmultiplier port */ - ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), atadev->unit & 0x0f); + if ((ctlr->chip->cfg2 == PR_SATA2) || + ((ctlr->chip->cfg2 == PR_CMBO2) && (ch->unit < 2))) { + /* set portmultiplier port */ + ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), atadev->unit & 0x0f); + } /* XXX SOS add ATAPI commands support later */ switch (request->u.ata.command) { From kientzle at FreeBSD.org Mon Mar 2 23:01:58 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Mon Mar 2 23:02:05 2009 Subject: svn commit: r189296 - head/lib/libarchive/test Message-ID: <200903030701.n2371vcS000997@svn.freebsd.org> Author: kientzle Date: Tue Mar 3 07:01:57 2009 New Revision: 189296 URL: http://svn.freebsd.org/changeset/base/189296 Log: Merge r294 from libarchive.googlecode.com: Skip testing for locale-based failures on systems where the "C" locale is so permissive that it cannot possibly fail. In particular, this fixes a test problem on Cygwin. Modified: head/lib/libarchive/test/test_pax_filename_encoding.c Modified: head/lib/libarchive/test/test_pax_filename_encoding.c ============================================================================== --- head/lib/libarchive/test/test_pax_filename_encoding.c Tue Mar 3 06:39:38 2009 (r189295) +++ head/lib/libarchive/test/test_pax_filename_encoding.c Tue Mar 3 07:01:57 2009 (r189296) @@ -210,6 +210,13 @@ DEFINE_TEST(test_pax_filename_encoding_3 return; } + /* If wctomb is broken, warn and return. */ + if (wctomb(buff, 0x1234) > 0) { + skipping("Cannot test conversion failures because \"C\" " + "locale on this system has no invalid characters."); + return; + } + assert((a = archive_write_new()) != NULL); assertEqualIntA(a, 0, archive_write_set_format_pax(a)); assertEqualIntA(a, 0, archive_write_set_compression_none(a)); From marcus at marcuscom.com Mon Mar 2 23:16:57 2009 From: marcus at marcuscom.com (Joe Marcus Clarke) Date: Mon Mar 2 23:17:08 2009 Subject: svn commit: r189295 - head/sys/dev/ata/chipsets In-Reply-To: <200903030639.n236dcYs000461@svn.freebsd.org> References: <200903030639.n236dcYs000461@svn.freebsd.org> Message-ID: <1236064618.37252.169.camel@shumai.marcuscom.com> On Tue, 2009-03-03 at 06:39 +0000, Alexander Motin wrote: > Author: mav > Date: Tue Mar 3 06:39:38 2009 > New Revision: 189295 > URL: http://svn.freebsd.org/changeset/base/189295 > > Log: > Set PortMultiplier port only for SATA2 channels, where it is applicable. > Doing it on old SATA controllers like Promise PDC20375 SATA150 breaks > their operation. Thanks! My Tinderbox machine thanks you as well. Joe > > Tested by: marcus on PDC20375 > > Modified: > head/sys/dev/ata/chipsets/ata-promise.c > > Modified: head/sys/dev/ata/chipsets/ata-promise.c > ============================================================================== > --- head/sys/dev/ata/chipsets/ata-promise.c Tue Mar 3 03:33:25 2009 (r189294) > +++ head/sys/dev/ata/chipsets/ata-promise.c Tue Mar 3 06:39:38 2009 (r189295) > @@ -690,8 +690,11 @@ ata_promise_mio_command(struct ata_reque > > ATA_OUTL(ctlr->r_res2, (ch->unit + 1) << 2, 0x00000001); > > - /* set portmultiplier port */ > - ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), atadev->unit & 0x0f); > + if ((ctlr->chip->cfg2 == PR_SATA2) || > + ((ctlr->chip->cfg2 == PR_CMBO2) && (ch->unit < 2))) { > + /* set portmultiplier port */ > + ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), atadev->unit & 0x0f); > + } > > /* XXX SOS add ATAPI commands support later */ > switch (request->u.ata.command) { > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > -- PGP Key : http://www.marcuscom.com/pgp.asc -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090303/945cc22c/attachment.pgp From mav at FreeBSD.org Mon Mar 2 23:56:43 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Mon Mar 2 23:56:55 2009 Subject: svn commit: r189297 - stable/7/sbin/atacontrol Message-ID: <200903030756.n237uh0Z002124@svn.freebsd.org> Author: mav Date: Tue Mar 3 07:56:42 2009 New Revision: 189297 URL: http://svn.freebsd.org/changeset/base/189297 Log: MFC rev. 186079, 188829, 188922, 188959. Sync with HEAD. Modified: stable/7/sbin/atacontrol/ (props changed) stable/7/sbin/atacontrol/atacontrol.8 stable/7/sbin/atacontrol/atacontrol.c Modified: stable/7/sbin/atacontrol/atacontrol.8 ============================================================================== --- stable/7/sbin/atacontrol/atacontrol.8 Tue Mar 3 07:01:57 2009 (r189296) +++ stable/7/sbin/atacontrol/atacontrol.8 Tue Mar 3 07:56:42 2009 (r189297) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2008 +.Dd February 21, 2009 .Dt ATACONTROL 8 .Os .Sh NAME @@ -63,6 +63,7 @@ .Nm .Ic mode .Ar device +.Op Ar mode .Nm .Ic info .Ar channel @@ -94,7 +95,7 @@ The .Ar channel argument is the ATA channel device (e.g., ata0) on which to operate. The following commands are supported: -.Bl -tag -width "rebuild" +.Bl -tag -width ".Ic addspare" .It Ic attach Attach an ATA .Ar channel . @@ -162,9 +163,13 @@ Rebuild a RAID1 array on a RAID capable .It Ic status Get the status of an ATA RAID. .It Ic mode -Without the mode argument, the current transfer modes of the +Without the +.Ar mode +argument, the current transfer mode of the device are printed. -If the mode argument is given, the ATA driver +If the +.Ar mode +argument is given, the ATA driver is asked to change the transfer mode to the one given. The ATA driver will reject modes that are not supported by the hardware. @@ -175,9 +180,7 @@ Modes are given like case does not matter. .Pp Currently supported modes are: -.Cm PIO0 , PIO1 , PIO2 , PIO3 , PIO4 , -.Cm WDMA2 , -.Cm UDMA2 +.Cm BIOSPIO , PIO0 , PIO1 , PIO2 , PIO3 , PIO4 , WDMA2 , UDMA2 (alias .Cm UDMA33 ) , .Cm UDMA4 @@ -185,18 +188,19 @@ Currently supported modes are: .Cm UDMA66 ) , .Cm UDMA5 (alias -.Cm UDMA100 ) -and +.Cm UDMA100 ) , .Cm UDMA6 (alias -.Cm UDMA133 ) . -The device name and manufacture/version strings are shown. +.Cm UDMA133 ) , +.Cm SATA150 , SATA300 , USB , USB1 , USB2 +and +.Cm BIOSDMA . .It Ic cap Show detailed info about the device on .Ar device . .It Ic spindown Set or report timeout after which the -.Ar device +.Ar device will be spun down. To arm the timeout the device needs at least one more request after setting the timeout. @@ -205,6 +209,7 @@ No further actions are needed in this ca .It Ic info Show info about the attached devices on the .Ar channel . +The device name and manufacture/version strings are shown. .It Ic list Show info about all attached devices on all active controllers. .El @@ -312,7 +317,7 @@ If the system has a pure software array RAID controller, then shut the system down, make sure that the disk that was still working is moved to the bootable position (channel 0 or whatever the BIOS allows the system to boot from) and the blank disk -is placed in the secondary position, then boot the system into +is placed in the secondary position, then boot the system into single-user mode and issue the command: .Pp .Dl "atacontrol addspare ar0 ad6" Modified: stable/7/sbin/atacontrol/atacontrol.c ============================================================================== --- stable/7/sbin/atacontrol/atacontrol.c Tue Mar 3 07:01:57 2009 (r189296) +++ stable/7/sbin/atacontrol/atacontrol.c Tue Mar 3 07:56:42 2009 (r189297) @@ -82,6 +82,11 @@ str2mode(char *str) if (!strcasecmp(str, "UDMA100")) return ATA_UDMA5; if (!strcasecmp(str, "UDMA6")) return ATA_UDMA6; if (!strcasecmp(str, "UDMA133")) return ATA_UDMA6; + if (!strcasecmp(str, "SATA150")) return ATA_SA150; + if (!strcasecmp(str, "SATA300")) return ATA_SA300; + if (!strcasecmp(str, "USB")) return ATA_USB; + if (!strcasecmp(str, "USB1")) return ATA_USB1; + if (!strcasecmp(str, "USB2")) return ATA_USB2; if (!strcasecmp(str, "BIOSDMA")) return ATA_DMA; return -1; } @@ -127,11 +132,11 @@ param_print(struct ata_params *parm) printf("<%.40s/%.8s> ", parm->model, parm->revision); if (parm->satacapabilities && parm->satacapabilities != 0xffff) { if (parm->satacapabilities & ATA_SATA_GEN2) - printf("Serial ATA II\n"); + printf("SATA revision 2.x\n"); else if (parm->satacapabilities & ATA_SATA_GEN1) - printf("Serial ATA v1.0\n"); + printf("SATA revision 1.x\n"); else - printf("Unknown serial ATA version\n"); + printf("Unknown SATA revision\n"); } else printf("ATA/ATAPI revision %d\n", version(parm->version_major)); @@ -152,11 +157,11 @@ cap_print(struct ata_params *parm) printf("Protocol "); if (parm->satacapabilities && parm->satacapabilities != 0xffff) { if (parm->satacapabilities & ATA_SATA_GEN2) - printf("Serial ATA II\n"); + printf("SATA revision 2.x\n"); else if (parm->satacapabilities & ATA_SATA_GEN1) - printf("Serial ATA v1.0\n"); + printf("SATA revision 1.x\n"); else - printf("Unknown serial ATA version\n"); + printf("Unknown SATA revision\n"); } else printf("ATA/ATAPI revision %d\n", version(parm->version_major)); @@ -364,6 +369,8 @@ main(int argc, char **argv) fd = open_dev(argv[2], O_RDONLY); if (argc == 4) { mode = str2mode(argv[3]); + if (mode == -1) + errx(1, "unknown mode"); if (ioctl(fd, IOCATASMODE, &mode) < 0) warn("ioctl(IOCATASMODE)"); } From brueffer at FreeBSD.org Mon Mar 2 23:58:03 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Mon Mar 2 23:58:09 2009 Subject: svn commit: r189298 - head/share/man/man4 Message-ID: <200903030758.n237w1Dc002182@svn.freebsd.org> Author: brueffer Date: Tue Mar 3 07:58:01 2009 New Revision: 189298 URL: http://svn.freebsd.org/changeset/base/189298 Log: Xref glxsb(4). MFC after: 3 days Modified: head/share/man/man4/crypto.4 Modified: head/share/man/man4/crypto.4 ============================================================================== --- head/share/man/man4/crypto.4 Tue Mar 3 07:56:42 2009 (r189297) +++ head/share/man/man4/crypto.4 Tue Mar 3 07:58:01 2009 (r189298) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 1, 2007 +.Dd March 3, 2009 .Dt CRYPTO 4 .Os .Sh NAME @@ -106,6 +106,7 @@ asymmetric cryptographic features are po crypto access device .El .Sh SEE ALSO +.Xr glxsb 4 , .Xr hifn 4 , .Xr ipsec 4 , .Xr padlock 4 , From mav at FreeBSD.org Tue Mar 3 00:14:44 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Tue Mar 3 00:15:02 2009 Subject: svn commit: r189299 - in stable/7/sys: . contrib/pf dev/ata dev/ath/ath_hal dev/cxgb Message-ID: <200903030814.n238Ehxk002622@svn.freebsd.org> Author: mav Date: Tue Mar 3 08:14:43 2009 New Revision: 189299 URL: http://svn.freebsd.org/changeset/base/189299 Log: MFC rev. 188700, 188731, 188733. Make core dumping to ad not to freeze even if interrupts, not disabled for some reason (noticed on SMP), stealing our events. ata_interrupt() does not need to return anything. It is not it's business to report request completion, expecially when it is not reliable. PR: kern/114370, kern/115801 Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ata/ata-all.c stable/7/sys/dev/ata/ata-all.h stable/7/sys/dev/ata/ata-queue.c stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/dev/ata/ata-all.c ============================================================================== --- stable/7/sys/dev/ata/ata-all.c Tue Mar 3 07:58:01 2009 (r189298) +++ stable/7/sys/dev/ata/ata-all.c Tue Mar 3 08:14:43 2009 (r189299) @@ -140,7 +140,7 @@ ata_attach(device_t dev) return ENXIO; } if ((error = bus_setup_intr(dev, ch->r_irq, ATA_INTR_FLAGS, NULL, - (driver_intr_t *)ata_interrupt, ch, &ch->ih))) { + ata_interrupt, ch, &ch->ih))) { device_printf(dev, "unable to setup interrupt\n"); return error; } @@ -312,7 +312,7 @@ ata_resume(device_t dev) return error; } -int +void ata_interrupt(void *data) { struct ata_channel *ch = (struct ata_channel *)data; @@ -347,11 +347,10 @@ ata_interrupt(void *data) mtx_unlock(&ch->state_mtx); ATA_LOCKING(ch->dev, ATA_LF_UNLOCK); ata_finish(request); - return 1; + return; } } while (0); mtx_unlock(&ch->state_mtx); - return 0; } /* Modified: stable/7/sys/dev/ata/ata-all.h ============================================================================== --- stable/7/sys/dev/ata/ata-all.h Tue Mar 3 07:58:01 2009 (r189298) +++ stable/7/sys/dev/ata/ata-all.h Tue Mar 3 08:14:43 2009 (r189299) @@ -534,7 +534,7 @@ int ata_detach(device_t dev); int ata_reinit(device_t dev); int ata_suspend(device_t dev); int ata_resume(device_t dev); -int ata_interrupt(void *data); +void ata_interrupt(void *data); int ata_device_ioctl(device_t dev, u_long cmd, caddr_t data); int ata_identify(device_t dev); void ata_default_registers(device_t dev); Modified: stable/7/sys/dev/ata/ata-queue.c ============================================================================== --- stable/7/sys/dev/ata/ata-queue.c Tue Mar 3 07:58:01 2009 (r189298) +++ stable/7/sys/dev/ata/ata-queue.c Tue Mar 3 08:14:43 2009 (r189299) @@ -214,8 +214,10 @@ ata_start(device_t dev) if (dumping) { mtx_unlock(&ch->state_mtx); mtx_unlock(&ch->queue_mtx); - while (!ata_interrupt(ch)) + while (ch->running) { + ata_interrupt(ch); DELAY(10); + } return; } } From nyan at FreeBSD.org Tue Mar 3 01:04:20 2009 From: nyan at FreeBSD.org (Takahashi Yoshihiro) Date: Tue Mar 3 01:04:31 2009 Subject: svn commit: r189300 - in head/release: amd64 i386 ia64 powerpc sparc64 sun4v Message-ID: <200903030904.n2394JNJ003670@svn.freebsd.org> Author: nyan Date: Tue Mar 3 09:04:18 2009 New Revision: 189300 URL: http://svn.freebsd.org/changeset/base/189300 Log: Catch up with USB2 change. Remove the usbdevs and add the usbconfig. Spotted by: hrs Tested on: i386 Modified: head/release/amd64/boot_crunch.conf head/release/i386/boot_crunch.conf head/release/ia64/boot_crunch.conf head/release/powerpc/boot_crunch.conf head/release/sparc64/boot_crunch.conf head/release/sun4v/boot_crunch.conf Modified: head/release/amd64/boot_crunch.conf ============================================================================== --- head/release/amd64/boot_crunch.conf Tue Mar 3 08:14:43 2009 (r189299) +++ head/release/amd64/boot_crunch.conf Tue Mar 3 09:04:18 2009 (r189300) @@ -38,8 +38,8 @@ srcdirs /usr/src/usr.sbin progs arp progs ppp progs sysinstall -progs usbdevs +progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -ldevinfo -libs -lbsdxml -larchive -lbz2 +libs -lbsdxml -larchive -lbz2 -lusb20 Modified: head/release/i386/boot_crunch.conf ============================================================================== --- head/release/i386/boot_crunch.conf Tue Mar 3 08:14:43 2009 (r189299) +++ head/release/i386/boot_crunch.conf Tue Mar 3 09:04:18 2009 (r189300) @@ -38,8 +38,8 @@ srcdirs /usr/src/usr.sbin progs arp progs ppp progs sysinstall -progs usbdevs +progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -ldevinfo -libs -lbsdxml -larchive -lbz2 +libs -lbsdxml -larchive -lbz2 -lusb20 Modified: head/release/ia64/boot_crunch.conf ============================================================================== --- head/release/ia64/boot_crunch.conf Tue Mar 3 08:14:43 2009 (r189299) +++ head/release/ia64/boot_crunch.conf Tue Mar 3 09:04:18 2009 (r189300) @@ -42,8 +42,8 @@ srcdirs /usr/src/usr.sbin progs arp progs ppp progs sysinstall -progs usbdevs +progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lkiconv -lsbuf -lufs -ldevinfo -libs -lgeom -lbsdxml -larchive -lbz2 +libs -lgeom -lbsdxml -larchive -lbz2 -lusb20 Modified: head/release/powerpc/boot_crunch.conf ============================================================================== --- head/release/powerpc/boot_crunch.conf Tue Mar 3 08:14:43 2009 (r189299) +++ head/release/powerpc/boot_crunch.conf Tue Mar 3 09:04:18 2009 (r189300) @@ -40,8 +40,8 @@ srcdirs /usr/src/usr.sbin progs arp progs ppp progs sysinstall -progs usbdevs +progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lkiconv -lsbuf -lufs -libs -lbsdxml -larchive -lbz2 +libs -lbsdxml -larchive -lbz2 -lusb20 Modified: head/release/sparc64/boot_crunch.conf ============================================================================== --- head/release/sparc64/boot_crunch.conf Tue Mar 3 08:14:43 2009 (r189299) +++ head/release/sparc64/boot_crunch.conf Tue Mar 3 09:04:18 2009 (r189300) @@ -38,8 +38,8 @@ srcdirs /usr/src/usr.sbin progs arp progs ppp progs sysinstall -progs usbdevs +progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -lbsdxml -libs -larchive -lbz2 +libs -larchive -lbz2 -lusb20 Modified: head/release/sun4v/boot_crunch.conf ============================================================================== --- head/release/sun4v/boot_crunch.conf Tue Mar 3 08:14:43 2009 (r189299) +++ head/release/sun4v/boot_crunch.conf Tue Mar 3 09:04:18 2009 (r189300) @@ -38,8 +38,8 @@ srcdirs /usr/src/usr.sbin progs arp progs ppp progs sysinstall -progs usbdevs +progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -lbsdxml -libs -larchive -lbz2 +libs -larchive -lbz2 -lusb20 From simon at FreeBSD.org Tue Mar 3 01:19:02 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Tue Mar 3 01:19:16 2009 Subject: svn commit: r189271 - head/lib/libc/stdio In-Reply-To: <200903020411.n224BgXF064833@svn.freebsd.org> References: <200903020411.n224BgXF064833@svn.freebsd.org> Message-ID: <20090303091856.GB1190@zaphod.nitro.dk> On 2009.03.02 04:11:42 +0000, David Schultz wrote: > Author: das > Date: Mon Mar 2 04:11:42 2009 > New Revision: 189271 > URL: http://svn.freebsd.org/changeset/base/189271 > > Log: > Rewrite asprintf() as a wrapper around vasprintf(), thus reducing the > number of functions that have an incestuous relationship with the > arcane innards of stdio. > > Replaced: > head/lib/libc/stdio/asprintf.c (contents, props changed) > - copied, changed from r189249, head/lib/libc/stdio/printf.c Just FYI, this commit "broke" (exposed a bug) in the svn2cvs exporter, so it's not running right now. -- Simon L. Nielsen From rwatson at FreeBSD.org Tue Mar 3 03:57:30 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Tue Mar 3 03:58:06 2009 Subject: svn commit: r189301 - head/contrib/openbsm/config Message-ID: <200903031157.n23BvTmL010171@svn.freebsd.org> Author: rwatson Date: Tue Mar 3 11:57:29 2009 New Revision: 189301 URL: http://svn.freebsd.org/changeset/base/189301 Log: Update config.h for OpenBSM 1.1 beta1. MFC after: 1 month Modified: head/contrib/openbsm/config/config.h Modified: head/contrib/openbsm/config/config.h ============================================================================== --- head/contrib/openbsm/config/config.h Tue Mar 3 09:04:18 2009 (r189300) +++ head/contrib/openbsm/config/config.h Tue Mar 3 11:57:29 2009 (r189301) @@ -165,13 +165,13 @@ #define PACKAGE_NAME "OpenBSM" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "OpenBSM 1.1alpha4" +#define PACKAGE_STRING "OpenBSM 1.1beta1" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "openbsm" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.1alpha4" +#define PACKAGE_VERSION "1.1beta1" /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void @@ -192,7 +192,7 @@ #define USE_NATIVE_INCLUDES /* Version number of package */ -#define VERSION "1.1alpha4" +#define VERSION "1.1beta1" /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ From das at FreeBSD.ORG Tue Mar 3 05:05:29 2009 From: das at FreeBSD.ORG (David Schultz) Date: Tue Mar 3 05:05:40 2009 Subject: svn commit: r189271 - head/lib/libc/stdio In-Reply-To: <20090303091856.GB1190@zaphod.nitro.dk> References: <200903020411.n224BgXF064833@svn.freebsd.org> <20090303091856.GB1190@zaphod.nitro.dk> Message-ID: <20090303130848.GA4636@zim.MIT.EDU> On Tue, Mar 03, 2009, Simon L. Nielsen wrote: > On 2009.03.02 04:11:42 +0000, David Schultz wrote: > > Author: das > > Date: Mon Mar 2 04:11:42 2009 > > New Revision: 189271 > > URL: http://svn.freebsd.org/changeset/base/189271 > > > > Log: > > Rewrite asprintf() as a wrapper around vasprintf(), thus reducing the > > number of functions that have an incestuous relationship with the > > arcane innards of stdio. > > > > Replaced: > > head/lib/libc/stdio/asprintf.c (contents, props changed) > > - copied, changed from r189249, head/lib/libc/stdio/printf.c > > Just FYI, this commit "broke" (exposed a bug) in the svn2cvs exporter, > so it's not running right now. Oops. I wrote this by removing the unnecessarily long OpenBSD implementation, then using `svn cp' to make the new version a 2-line diff against printf.c (which more accurately reflects the provenance of the new implementation.) I guess the exporter didn't like that. How do we fix it? From avg at FreeBSD.org Tue Mar 3 05:10:26 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Tue Mar 3 05:10:34 2009 Subject: svn commit: r189302 - head/sys/fs/udf Message-ID: <200903031310.n23DAPMn011598@svn.freebsd.org> Author: avg Date: Tue Mar 3 13:10:25 2009 New Revision: 189302 URL: http://svn.freebsd.org/changeset/base/189302 Log: udf_readdir: do not advance offset if entry can not be uio-ed Previosly readdir missed some directory entries because there was no space for them in current uio but directory stream offset was advanced nevertheless. jhb has discoved the issue and provided a test-case. Reviewed by: bde Approved by: jhb (mentor) Modified: head/sys/fs/udf/udf_vnops.c Modified: head/sys/fs/udf/udf_vnops.c ============================================================================== --- head/sys/fs/udf/udf_vnops.c Tue Mar 3 11:57:29 2009 (r189301) +++ head/sys/fs/udf/udf_vnops.c Tue Mar 3 13:10:25 2009 (r189302) @@ -859,11 +859,11 @@ udf_readdir(struct vop_readdir_args *a) } if (error) break; + uio->uio_offset = ds->offset + ds->off; } /* tell the calling layer whether we need to be called again */ *a->a_eofflag = uiodir.eofflag; - uio->uio_offset = ds->offset + ds->off; if (error < 0) error = 0; From bz at FreeBSD.org Tue Mar 3 05:12:15 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Tue Mar 3 05:12:21 2009 Subject: svn commit: r189303 - in head/sys: netinet netinet6 Message-ID: <200903031312.n23DCDAl011675@svn.freebsd.org> Author: bz Date: Tue Mar 3 13:12:12 2009 New Revision: 189303 URL: http://svn.freebsd.org/changeset/base/189303 Log: Start removing IPv6 Type 0 Routing header code. RH0 was deprecated by RFC 5095. While most of the code had been disabled by #if 0 already, leave a bit of infrastructure for possible RH2 code and a log message under BURN_BRIDGES in case a user still tries to send RH0 packets. Reviewed by: gnn (a bit back, earlier version) Modified: head/sys/netinet/ip6.h head/sys/netinet6/ip6_output.c head/sys/netinet6/route6.c Modified: head/sys/netinet/ip6.h ============================================================================== --- head/sys/netinet/ip6.h Tue Mar 3 13:10:25 2009 (r189302) +++ head/sys/netinet/ip6.h Tue Mar 3 13:12:12 2009 (r189303) @@ -219,7 +219,7 @@ struct ip6_rthdr { /* followed by routing type specific data */ } __packed; -/* Type 0 Routing header */ +/* Type 0 Routing header, deprecated by RFC 5095. */ struct ip6_rthdr0 { u_int8_t ip6r0_nxt; /* next header */ u_int8_t ip6r0_len; /* length in units of 8 octets */ Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Tue Mar 3 13:10:25 2009 (r189302) +++ head/sys/netinet6/ip6_output.c Tue Mar 3 13:12:12 2009 (r189303) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -443,40 +444,23 @@ skip_ipsec2:; struct ip6_rthdr *rh = (struct ip6_rthdr *)(mtod(exthdrs.ip6e_rthdr, struct ip6_rthdr *)); - struct ip6_rthdr0 *rh0; - struct in6_addr *addr; - struct sockaddr_in6 sa; + /* + * While this switch may look gratuitous, leave it in + * in favour of RH2 implementations, etc. + */ switch (rh->ip6r_type) { +#ifndef BURN_BRIDGES case IPV6_RTHDR_TYPE_0: - rh0 = (struct ip6_rthdr0 *)rh; - addr = (struct in6_addr *)(rh0 + 1); - - /* - * construct a sockaddr_in6 form of - * the first hop. - * - * XXX: we may not have enough - * information about its scope zone; - * there is no standard API to pass - * the information from the - * application. - */ - bzero(&sa, sizeof(sa)); - sa.sin6_family = AF_INET6; - sa.sin6_len = sizeof(sa); - sa.sin6_addr = addr[0]; - if ((error = sa6_embedscope(&sa, - V_ip6_use_defzone)) != 0) { - goto bad; - } - ip6->ip6_dst = sa.sin6_addr; - bcopy(&addr[1], &addr[0], sizeof(struct in6_addr) - * (rh0->ip6r0_segleft - 1)); - addr[rh0->ip6r0_segleft - 1] = finaldst; - /* XXX */ - in6_clearscope(addr + rh0->ip6r0_segleft - 1); - break; + /* + * According to RFC 5095 we should not implement + * it in any way but we may want to give the user + * a hint for now. + */ + log(LOG_INFO, "[%s:%d] IPv6 Type 0 Routing Headers are " + "deprecated.\n", __func__, __LINE__); + /* FALLTHROUGH */ +#endif default: /* is it possible? */ error = EINVAL; goto bad; Modified: head/sys/netinet6/route6.c ============================================================================== --- head/sys/netinet6/route6.c Tue Mar 3 13:10:25 2009 (r189302) +++ head/sys/netinet6/route6.c Tue Mar 3 13:12:12 2009 (r189303) @@ -53,12 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if 0 -static int ip6_rthdr0 __P((struct mbuf *, struct ip6_hdr *, - struct ip6_rthdr0 *)); - -#endif /* Disable route header processing. */ - /* * proto - is unused */ @@ -96,38 +90,22 @@ route6_input(struct mbuf **mp, int *offp } #endif + /* + * While this switch may look gratuitous, leave it in + * in favour of RH2 implementations, etc. + */ switch (rh->ip6r_type) { -#if 0 +#ifndef BURN_BRIDGES case IPV6_RTHDR_TYPE_0: - rhlen = (rh->ip6r_len + 1) << 3; -#ifndef PULLDOWN_TEST - /* - * note on option length: - * due to IP6_EXTHDR_CHECK assumption, we cannot handle - * very big routing header (max rhlen == 2048). - */ - IP6_EXTHDR_CHECK(m, off, rhlen, IPPROTO_DONE); -#else /* - * note on option length: - * maximum rhlen: 2048 - * max mbuf m_pulldown can handle: MCLBYTES == usually 2048 - * so, here we are assuming that m_pulldown can handle - * rhlen == 2048 case. this may not be a good thing to - * assume - we may want to avoid pulling it up altogether. + * According to RFC 5095, 3. Deprecation of RH0, + * we must handle RH0 like the default (unknown + * routing header type) case. */ - IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, rhlen); - if (rh == NULL) { - V_ip6stat.ip6s_tooshort++; - return IPPROTO_DONE; - } + /* FALLTHROUGH */ #endif - if (ip6_rthdr0(m, ip6, (struct ip6_rthdr0 *)rh)) - return (IPPROTO_DONE); - break; -#endif /* Disable route header 0 */ default: - /* unknown routing type */ + /* Unknown routing header type. */ if (rh->ip6r_segleft == 0) { rhlen = (rh->ip6r_len + 1) << 3; break; /* Final dst. Just ignore the header. */ @@ -141,107 +119,3 @@ route6_input(struct mbuf **mp, int *offp *offp += rhlen; return (rh->ip6r_nxt); } - -/* - * Type0 routing header processing - * - * RFC2292 backward compatibility warning: no support for strict/loose bitmap, - * as it was dropped between RFC1883 and RFC2460. - */ -#if 0 -static int -ip6_rthdr0(struct mbuf *m, struct ip6_hdr *ip6, struct ip6_rthdr0 *rh0) -{ - INIT_VNET_INET6(curvnet); - int addrs, index; - struct in6_addr *nextaddr, tmpaddr; - struct in6_ifaddr *ifa; - - if (rh0->ip6r0_segleft == 0) - return (0); - - if (rh0->ip6r0_len % 2 -#ifdef COMPAT_RFC1883 - || rh0->ip6r0_len > 46 -#endif - ) { - /* - * Type 0 routing header can't contain more than 23 addresses. - * RFC 2462: this limitation was removed since strict/loose - * bitmap field was deleted. - */ - V_ip6stat.ip6s_badoptions++; - icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, - (caddr_t)&rh0->ip6r0_len - (caddr_t)ip6); - return (-1); - } - - if ((addrs = rh0->ip6r0_len / 2) < rh0->ip6r0_segleft) { - V_ip6stat.ip6s_badoptions++; - icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, - (caddr_t)&rh0->ip6r0_segleft - (caddr_t)ip6); - return (-1); - } - - index = addrs - rh0->ip6r0_segleft; - rh0->ip6r0_segleft--; - nextaddr = ((struct in6_addr *)(rh0 + 1)) + index; - - /* - * reject invalid addresses. be proactive about malicious use of - * IPv4 mapped/compat address. - * XXX need more checks? - */ - if (IN6_IS_ADDR_MULTICAST(nextaddr) || - IN6_IS_ADDR_UNSPECIFIED(nextaddr) || - IN6_IS_ADDR_V4MAPPED(nextaddr) || - IN6_IS_ADDR_V4COMPAT(nextaddr)) { - V_ip6stat.ip6s_badoptions++; - m_freem(m); - return (-1); - } - if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || - IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_dst) || - IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst) || - IN6_IS_ADDR_V4COMPAT(&ip6->ip6_dst)) { - V_ip6stat.ip6s_badoptions++; - m_freem(m); - return (-1); - } - - /* - * Determine the scope zone of the next hop, based on the interface - * of the current hop. [RFC4007, Section 9] - * Then disambiguate the scope zone for the next hop (if necessary). - */ - if ((ifa = ip6_getdstifaddr(m)) == NULL) - goto bad; - if (in6_setscope(nextaddr, ifa->ia_ifp, NULL) != 0) { - V_ip6stat.ip6s_badscope++; - goto bad; - } - - /* - * Swap the IPv6 destination address and nextaddr. Forward the packet. - */ - tmpaddr = *nextaddr; - *nextaddr = ip6->ip6_dst; - in6_clearscope(nextaddr); /* XXX */ - ip6->ip6_dst = tmpaddr; - -#ifdef COMPAT_RFC1883 - if (rh0->ip6r0_slmap[index / 8] & (1 << (7 - (index % 8)))) - ip6_forward(m, IPV6_SRCRT_NEIGHBOR); - else - ip6_forward(m, IPV6_SRCRT_NOTNEIGHBOR); -#else - ip6_forward(m, 1); -#endif - - return (-1); /* m would be freed in ip6_forward() */ - - bad: - m_freem(m); - return (-1); -} -#endif From simon at FreeBSD.org Tue Mar 3 06:09:11 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Tue Mar 3 06:09:17 2009 Subject: svn commit: r189271 - head/lib/libc/stdio In-Reply-To: <20090303130848.GA4636@zim.MIT.EDU> References: <200903020411.n224BgXF064833@svn.freebsd.org> <20090303091856.GB1190@zaphod.nitro.dk> <20090303130848.GA4636@zim.MIT.EDU> Message-ID: <20090303140906.GC1190@zaphod.nitro.dk> On 2009.03.03 08:08:48 -0500, David Schultz wrote: > On Tue, Mar 03, 2009, Simon L. Nielsen wrote: > > On 2009.03.02 04:11:42 +0000, David Schultz wrote: > > > Author: das > > > Date: Mon Mar 2 04:11:42 2009 > > > New Revision: 189271 > > > URL: http://svn.freebsd.org/changeset/base/189271 > > > > > > Log: > > > Rewrite asprintf() as a wrapper around vasprintf(), thus reducing the > > > number of functions that have an incestuous relationship with the > > > arcane innards of stdio. > > > > > > Replaced: > > > head/lib/libc/stdio/asprintf.c (contents, props changed) > > > - copied, changed from r189249, head/lib/libc/stdio/printf.c > > > > Just FYI, this commit "broke" (exposed a bug) in the svn2cvs exporter, > > so it's not running right now. > > Oops. I wrote this by removing the unnecessarily long OpenBSD > implementation, then using `svn cp' to make the new version a > 2-line diff against printf.c (which more accurately reflects the > provenance of the new implementation.) I guess the exporter didn't > like that. How do we fix it? I don't think you did anything wrong, the svn2cvs exporter just gets rather unhappy if subversion says the same file is deleted and added in the same changeset which seems to happen for cases like this. Anyway, I first want to see if peter@ is around - if not I will have a look at it... -- Simon L. Nielsen From avg at FreeBSD.org Tue Mar 3 07:50:25 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Tue Mar 3 07:50:36 2009 Subject: svn commit: r189305 - head/sys/dev/ichwd Message-ID: <200903031550.n23FoOUG014623@svn.freebsd.org> Author: avg Date: Tue Mar 3 15:50:24 2009 New Revision: 189305 URL: http://svn.freebsd.org/changeset/base/189305 Log: ichwd: correct range check for timeout value Approved by: jhb (mentor) Modified: head/sys/dev/ichwd/ichwd.c Modified: head/sys/dev/ichwd/ichwd.c ============================================================================== --- head/sys/dev/ichwd/ichwd.c Tue Mar 3 15:43:34 2009 (r189304) +++ head/sys/dev/ichwd/ichwd.c Tue Mar 3 15:50:24 2009 (r189305) @@ -220,8 +220,8 @@ ichwd_tmr_set(struct ichwd_softc *sc, un uint16_t tmr_val16 = ichwd_read_tco_2(sc, TCO_TMR2); tmr_val16 &= 0xfc00; - if (timeout > 0x0bff) - timeout = 0x0bff; + if (timeout > 0x03ff) + timeout = 0x03ff; tmr_val16 |= timeout; ichwd_write_tco_2(sc, TCO_TMR2, tmr_val16); } From jhb at FreeBSD.org Tue Mar 3 08:39:00 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Mar 3 08:39:13 2009 Subject: svn commit: r189306 - head/sys/dev/pci Message-ID: <200903031638.n23GcxZJ015525@svn.freebsd.org> Author: jhb Date: Tue Mar 3 16:38:59 2009 New Revision: 189306 URL: http://svn.freebsd.org/changeset/base/189306 Log: Further refine the handling of resources for BARs in the PCI bus driver. A while back, Warner changed the PCI bus code to reserve resources when enumerating devices and simply give devices the previously allocated resources when they call bus_alloc_resource(). This ensures that address ranges being decoded by a BAR are always allocated in the nexus0 device (or whatever device the PCI bus gets its address space from) even if a device driver is not attached to the device. This patch extends this behavior further: - To let the PCI bus distinguish between a resource being allocated by a device driver vs. merely being allocated by the bus, use rman_set_device() to assign the device to the bus when it is owned by the bus and to the child device when it is allocated by the child device's driver. We can now prevent a device driver from allocating the same device twice. Doing so could result in odd things like allocating duplicate virtual memory to map the resource on some archs and leaking the original mapping. - When a PCI device driver releases a resource, don't pass the request all the way up the tree and release it in the nexus (or similar device) since the BAR is still active and decoding. Otherwise, another device could later allocate the same range even though it is still in use. Instead, deactivate the resource and assign it back to the PCI bus using rman_set_device(). - pci_delete_resource() will actually completely free a BAR including attemping to disable it. - Disable BAR decoding via the command register when sizing a BAR in pci_alloc_map() which is used to allocate resources for a BAR when the BIOS/firmware did not assign a usable resource range during boot. This mirrors an earlier fix to pci_add_map() which is used when to size BARs during boot. - Move the activation of I/O decoding in the PCI command register into pci_activate_resource() instead of doing it in pci_alloc_resource(). Previously we could actually enable decoding before a BAR was initialized via pci_alloc_map(). Glanced at by: bsdimp Modified: head/sys/dev/pci/pci.c head/sys/dev/pci/pci_private.h Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Tue Mar 3 15:50:24 2009 (r189305) +++ head/sys/dev/pci/pci.c Tue Mar 3 16:38:59 2009 (r189306) @@ -136,7 +136,7 @@ static device_method_t pci_methods[] = { DEVMETHOD(bus_delete_resource, pci_delete_resource), DEVMETHOD(bus_alloc_resource, pci_alloc_resource), DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_activate_resource, pci_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_child_pnpinfo_str, pci_child_pnpinfo_str_method), DEVMETHOD(bus_child_location_str, pci_child_location_str_method), @@ -2294,8 +2294,8 @@ pci_add_map(device_t pcib, device_t bus, /* * Disable decoding via the command register before - * determining the BARs length since we will be placing them - * in a weird state. + * determining the BAR's length since we will be placing it in + * a weird state. */ cmd = PCIB_READ_CONFIG(pcib, b, s, f, PCIR_COMMAND, 2); PCIB_WRITE_CONFIG(pcib, b, s, f, PCIR_COMMAND, @@ -2336,7 +2336,10 @@ pci_add_map(device_t pcib, device_t bus, return (barlen); if (ln2range == 64) - /* Read the other half of a 64bit map register */ + /* + * Read the other half of a 64bit map register. We + * assume that the size of the BAR is less than 2^32. + */ base |= (uint64_t) PCIB_READ_CONFIG(pcib, b, s, f, reg + 4, 4) << 32; if (bootverbose) { printf("\tmap[%02x]: type %s, range %2d, base %#jx, size %2d", @@ -2422,8 +2425,10 @@ pci_add_map(device_t pcib, device_t bus, */ resource_list_delete(rl, type, reg); start = 0; - } else + } else { start = rman_get_start(res); + rman_set_device(res, bus); + } pci_write_config(dev, reg, start, 4); if (ln2range == 64) pci_write_config(dev, reg + 4, start >> 32, 4); @@ -2441,6 +2446,7 @@ static void pci_ata_maps(device_t pcib, device_t bus, device_t dev, int b, int s, int f, struct resource_list *rl, int force, uint32_t prefetchmask) { + struct resource *r; int rid, type, progif; #if 0 /* if this device supports PCI native addressing use it */ @@ -2463,12 +2469,14 @@ pci_ata_maps(device_t pcib, device_t bus } else { rid = PCIR_BAR(0); resource_list_add(rl, type, rid, 0x1f0, 0x1f7, 8); - resource_list_alloc(rl, bus, dev, type, &rid, 0x1f0, 0x1f7, 8, - 0); + r = resource_list_alloc(rl, bus, dev, type, &rid, 0x1f0, 0x1f7, + 8, 0); + rman_set_device(r, bus); rid = PCIR_BAR(1); resource_list_add(rl, type, rid, 0x3f6, 0x3f6, 1); - resource_list_alloc(rl, bus, dev, type, &rid, 0x3f6, 0x3f6, 1, - 0); + r = resource_list_alloc(rl, bus, dev, type, &rid, 0x3f6, 0x3f6, + 1, 0); + rman_set_device(r, bus); } if (progif & PCIP_STORAGE_IDE_MODESEC) { pci_add_map(pcib, bus, dev, b, s, f, PCIR_BAR(2), rl, force, @@ -2478,12 +2486,14 @@ pci_ata_maps(device_t pcib, device_t bus } else { rid = PCIR_BAR(2); resource_list_add(rl, type, rid, 0x170, 0x177, 8); - resource_list_alloc(rl, bus, dev, type, &rid, 0x170, 0x177, 8, - 0); + r = resource_list_alloc(rl, bus, dev, type, &rid, 0x170, 0x177, + 8, 0); + rman_set_device(r, bus); rid = PCIR_BAR(3); resource_list_add(rl, type, rid, 0x376, 0x376, 1); - resource_list_alloc(rl, bus, dev, type, &rid, 0x376, 0x376, 1, - 0); + r = resource_list_alloc(rl, bus, dev, type, &rid, 0x376, 0x376, + 1, 0); + rman_set_device(r, bus); } pci_add_map(pcib, bus, dev, b, s, f, PCIR_BAR(4), rl, force, prefetchmask & (1 << 4)); @@ -3391,6 +3401,7 @@ pci_alloc_map(device_t dev, device_t chi struct resource_list_entry *rle; struct resource *res; pci_addr_t map, testval; + uint16_t cmd; int mapsize; /* @@ -3402,12 +3413,21 @@ pci_alloc_map(device_t dev, device_t chi */ res = NULL; map = pci_read_config(child, *rid, 4); + + /* + * Disable decoding via the command register before + * determining the BAR's length since we will be placing it in + * a weird state. + */ + cmd = pci_read_config(child, PCIR_COMMAND, 2); + pci_write_config(child, PCIR_COMMAND, + cmd & ~(PCI_BAR_MEM(map) ? PCIM_CMD_MEMEN : PCIM_CMD_PORTEN), 2); + + /* Determine the BAR's length. */ pci_write_config(child, *rid, 0xffffffff, 4); testval = pci_read_config(child, *rid, 4); if (pci_maprange(testval) == 64) map |= (pci_addr_t)pci_read_config(child, *rid + 4, 4) << 32; - if (pci_mapbase(testval) == 0) - goto out; /* * Restore the original value of the BAR. We may have reprogrammed @@ -3415,6 +3435,11 @@ pci_alloc_map(device_t dev, device_t chi * we need the console device addressable. */ pci_write_config(child, *rid, map, 4); + pci_write_config(child, PCIR_COMMAND, cmd, 2); + + /* Ignore a BAR with a base of 0. */ + if (pci_mapbase(testval) == 0) + goto out; if (PCI_BAR_MEM(testval)) { if (type != SYS_RES_MEMORY) { @@ -3452,13 +3477,14 @@ pci_alloc_map(device_t dev, device_t chi * appropriate bar for that resource. */ res = BUS_ALLOC_RESOURCE(device_get_parent(dev), child, type, rid, - start, end, count, flags); + start, end, count, flags & ~RF_ACTIVE); if (res == NULL) { device_printf(child, "%#lx bytes of rid %#x res %d failed (%#lx, %#lx).\n", count, *rid, type, start, end); goto out; } + rman_set_device(res, dev); resource_list_add(rl, type, *rid, start, end, count); rle = resource_list_find(rl, type, *rid); if (rle == NULL) @@ -3472,10 +3498,10 @@ pci_alloc_map(device_t dev, device_t chi "Lazy allocation of %#lx bytes rid %#x type %d at %#lx\n", count, *rid, type, rman_get_start(res)); map = rman_get_start(res); -out:; pci_write_config(child, *rid, map, 4); if (pci_maprange(testval) == 64) pci_write_config(child, *rid + 4, map >> 32, 4); +out:; return (res); } @@ -3487,68 +3513,63 @@ pci_alloc_resource(device_t dev, device_ struct pci_devinfo *dinfo = device_get_ivars(child); struct resource_list *rl = &dinfo->resources; struct resource_list_entry *rle; + struct resource *res; pcicfgregs *cfg = &dinfo->cfg; + if (device_get_parent(child) != dev) + return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child, + type, rid, start, end, count, flags)); + /* * Perform lazy resource allocation */ - if (device_get_parent(child) == dev) { - switch (type) { - case SYS_RES_IRQ: - /* - * Can't alloc legacy interrupt once MSI messages - * have been allocated. - */ - if (*rid == 0 && (cfg->msi.msi_alloc > 0 || - cfg->msix.msix_alloc > 0)) + switch (type) { + case SYS_RES_IRQ: + /* + * Can't alloc legacy interrupt once MSI messages have + * been allocated. + */ + if (*rid == 0 && (cfg->msi.msi_alloc > 0 || + cfg->msix.msix_alloc > 0)) + return (NULL); + + /* + * If the child device doesn't have an interrupt + * routed and is deserving of an interrupt, try to + * assign it one. + */ + if (*rid == 0 && !PCI_INTERRUPT_VALID(cfg->intline) && + (cfg->intpin != 0)) + pci_assign_interrupt(dev, child, 0); + break; + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + /* Allocate resources for this BAR if needed. */ + rle = resource_list_find(rl, type, *rid); + if (rle == NULL) { + res = pci_alloc_map(dev, child, type, rid, start, end, + count, flags); + if (res == NULL) return (NULL); - /* - * If the child device doesn't have an - * interrupt routed and is deserving of an - * interrupt, try to assign it one. - */ - if (*rid == 0 && !PCI_INTERRUPT_VALID(cfg->intline) && - (cfg->intpin != 0)) - pci_assign_interrupt(dev, child, 0); - break; - case SYS_RES_IOPORT: - case SYS_RES_MEMORY: - if (*rid < PCIR_BAR(cfg->nummaps)) { - /* - * Enable the I/O mode. We should - * also be assigning resources too - * when none are present. The - * resource_list_alloc kind of sorta does - * this... - */ - if (PCI_ENABLE_IO(dev, child, type)) - return (NULL); - } rle = resource_list_find(rl, type, *rid); - if (rle == NULL) - return (pci_alloc_map(dev, child, type, rid, - start, end, count, flags)); - break; } + /* - * If we've already allocated the resource, then - * return it now. But first we may need to activate - * it, since we don't allocate the resource as active - * above. Normally this would be done down in the - * nexus, but since we short-circuit that path we have - * to do its job here. Not sure if we should free the - * resource if it fails to activate. + * If the resource belongs to the bus, then give it to + * the child. We need to activate it if requested + * since the bus always allocates inactive resources. */ - rle = resource_list_find(rl, type, *rid); - if (rle != NULL && rle->res != NULL) { + if (rle != NULL && rle->res != NULL && + rman_get_device(rle->res) == dev) { if (bootverbose) device_printf(child, "Reserved %#lx bytes for rid %#x type %d at %#lx\n", rman_get_size(rle->res), *rid, type, rman_get_start(rle->res)); + rman_set_device(rle->res, child); if ((flags & RF_ACTIVE) && - bus_generic_activate_resource(dev, child, type, - *rid, rle->res) != 0) + bus_activate_resource(child, type, *rid, + rle->res) != 0) return (NULL); return (rle->res); } @@ -3557,6 +3578,59 @@ pci_alloc_resource(device_t dev, device_ start, end, count, flags)); } +int +pci_release_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + int error; + + if (device_get_parent(child) != dev) + return (BUS_RELEASE_RESOURCE(device_get_parent(dev), child, + type, rid, r)); + + /* + * For BARs we don't actually want to release the resource. + * Instead, we deactivate the resource if needed and then give + * ownership of the BAR back to the bus. + */ + switch (type) { + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + if (rman_get_device(r) != child) + return (EINVAL); + if (rman_get_flags(r) & RF_ACTIVE) { + error = bus_deactivate_resource(child, type, rid, r); + if (error) + return (error); + } + rman_set_device(r, dev); + return (0); + } + return (bus_generic_rl_release_resource(dev, child, type, rid, r)); +} + +int +pci_activate_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + int error; + + error = bus_generic_activate_resource(dev, child, type, rid, r); + if (error) + return (error); + + /* Enable decoding in the command register when activating BARs. */ + if (device_get_parent(child) == dev) { + switch (type) { + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + error = PCI_ENABLE_IO(dev, child, type); + break; + } + } + return (error); +} + void pci_delete_resource(device_t dev, device_t child, int type, int rid) { @@ -3570,27 +3644,34 @@ pci_delete_resource(device_t dev, device dinfo = device_get_ivars(child); rl = &dinfo->resources; rle = resource_list_find(rl, type, rid); - if (rle) { - if (rle->res) { - if (rman_get_device(rle->res) != dev || - rman_get_flags(rle->res) & RF_ACTIVE) { - device_printf(dev, "delete_resource: " - "Resource still owned by child, oops. " - "(type=%d, rid=%d, addr=%lx)\n", - rle->type, rle->rid, - rman_get_start(rle->res)); - return; - } - bus_release_resource(dev, type, rid, rle->res); + if (rle == NULL) + return; + + if (rle->res) { + if (rman_get_device(rle->res) != dev || + rman_get_flags(rle->res) & RF_ACTIVE) { + device_printf(dev, "delete_resource: " + "Resource still owned by child, oops. " + "(type=%d, rid=%d, addr=%lx)\n", + rle->type, rle->rid, + rman_get_start(rle->res)); + return; } - resource_list_delete(rl, type, rid); + + /* + * If this is a BAR, clear the BAR so it stops + * decoding before releasing the resource. + */ + switch (type) { + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + /* XXX: 64-bit BARs? */ + pci_write_config(child, rid, 0, 4); + break; + } + bus_release_resource(dev, type, rid, rle->res); } - /* - * Why do we turn off the PCI configuration BAR when we delete a - * resource? -- imp - */ - pci_write_config(child, rid, 0, 4); - BUS_DELETE_RESOURCE(device_get_parent(dev), child, type, rid); + resource_list_delete(rl, type, rid); } struct resource_list * Modified: head/sys/dev/pci/pci_private.h ============================================================================== --- head/sys/dev/pci/pci_private.h Tue Mar 3 15:50:24 2009 (r189305) +++ head/sys/dev/pci/pci_private.h Tue Mar 3 16:38:59 2009 (r189306) @@ -82,6 +82,10 @@ int pci_msix_count_method(device_t dev, struct resource *pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); +int pci_release_resource(device_t dev, device_t child, int type, + int rid, struct resource *r); +int pci_activate_resource(device_t dev, device_t child, int type, + int rid, struct resource *r); void pci_delete_resource(device_t dev, device_t child, int type, int rid); struct resource_list *pci_get_resource_list (device_t dev, device_t child); From jhb at FreeBSD.org Tue Mar 3 08:56:17 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Mar 3 08:56:35 2009 Subject: svn commit: r189307 - in stable/7/sys: . boot/i386/btx/btx contrib/pf dev/ath/ath_hal dev/cxgb Message-ID: <200903031656.n23GuFMW016007@svn.freebsd.org> Author: jhb Date: Tue Mar 3 16:56:15 2009 New Revision: 189307 URL: http://svn.freebsd.org/changeset/base/189307 Log: MFC: Use a clean slate of register state when executing hardware interrupt handlers to avoid leaking values into the upper 16-bits of general purpose registers when executing these routines. Modified: stable/7/sys/ (props changed) stable/7/sys/boot/i386/btx/btx/btx.S stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/boot/i386/btx/btx/btx.S ============================================================================== --- stable/7/sys/boot/i386/btx/btx/btx.S Tue Mar 3 16:38:59 2009 (r189306) +++ stable/7/sys/boot/i386/btx/btx/btx.S Tue Mar 3 16:56:15 2009 (r189307) @@ -36,6 +36,7 @@ /* * Fields in %eflags. */ + .set PSL_RESERVED_DEFAULT,0x00000002 .set PSL_T,0x00000100 # Trap flag .set PSL_I,0x00000200 # Interrupt enable flag .set PSL_VM,0x00020000 # Virtual 8086 mode flag @@ -455,6 +456,18 @@ intx31: pushl $-1 # Dummy int no for * -0x3c %fs * -0x40 %ds * -0x44 %es + * -0x48 zero %eax (hardware int only) + * -0x4c zero %ecx (hardware int only) + * -0x50 zero %edx (hardware int only) + * -0x54 zero %ebx (hardware int only) + * -0x58 zero %esp (hardware int only) + * -0x5c zero %ebp (hardware int only) + * -0x60 zero %esi (hardware int only) + * -0x64 zero %edi (hardware int only) + * -0x68 zero %gs (hardware int only) + * -0x6c zero %fs (hardware int only) + * -0x70 zero %ds (hardware int only) + * -0x74 zero %es (hardware int only) */ int_hw: cld # String ops inc pusha # Save gp regs @@ -467,12 +480,15 @@ int_hw: cld # String ops inc pushl %ds # address popl %es # data leal 0x44(%esp,1),%esi # Base of frame + movl %esp,MEM_ESPR-0x04 # Save kernel stack pointer movl -0x14(%esi),%eax # Get Int no cmpl $-1,%eax # Hardware interrupt? - jne intusr.2 # Yes + jne intusr.1 # Yes /* - * v86 calls save the btx_v86 pointer on the real mode stack and read the - * address and flags from the btx_v86 structure. + * v86 calls save the btx_v86 pointer on the real mode stack and read + * the address and flags from the btx_v86 structure. For interrupt + * handler invocations (VM86 INTx requests), disable interrupts, + * tracing, and alignment checking while the handler runs. */ movl $MEM_USR,%ebx # User base movl %ebx,%edx # address @@ -482,35 +498,36 @@ int_hw: cld # String ops inc movl %edx,MEM_ESPR-0x08 # Save btx_v86 ptr movl V86_ADDR(%edx),%eax # Get int no/address movl V86_CTL(%edx),%edx # Get control flags + movl -0x08(%esi),%ebx # Save user flags in %ebx + testl $V86F_ADDR,%edx # Segment:offset? + jnz intusr.4 # Yes + andl $~(PSL_I|PSL_T|PSL_AC),%ebx # Disable interrupts, tracing, + # and alignment checking for + # interrupt handler jmp intusr.3 # Skip hardware interrupt /* - * Hardware interrupts store a NULL btx_v86 pointer and use the address - * (interrupt number) from the stack with empty flags. Also, we clear - * the segment registers for the interrupt handler. + * Hardware interrupts store a NULL btx_v86 pointer and use the + * address (interrupt number) from the stack with empty flags. Also, + * push a dummy frame of zeros onto the stack for all the general + * purpose and segment registers and clear %eflags. This gives the + * hardware interrupt handler a clean slate. */ -intusr.2: xorl %edx,%edx # Control flags +intusr.1: xorl %edx,%edx # Control flags movl %edx,MEM_ESPR-0x08 # NULL btx_v86 ptr - movl %edx,-0x38(%esi) # Real mode %gs of 0 - movl %edx,-0x3c(%esi) # Real mode %fs of 0 - movl %edx,-0x40(%esi) # Real mode %ds of 0 - movl %edx,-0x44(%esi) # Real mode %es of 0 + movl $12,%ecx # Frame is 12 dwords +intusr.2: pushl $0x0 # Fill frame + loop intusr.2 # with zeros + movl $PSL_RESERVED_DEFAULT,%ebx # Set clean %eflags /* - * %eax now holds either the interrupt number or segment:offset of function. - * %edx now holds the V86F_* flags. - * - * For interrupt handler invocations (either hardware interrupts or VM86 - * INTx requests) we also disable interrupts, tracing, and alignment checking - * while the handler runs. + * Look up real mode IDT entry for hardware interrupts and VM86 INTx + * requests. */ -intusr.3: movl -0x08(%esi),%ebx # Save user flags in %ebx - testl $V86F_ADDR,%edx # Segment:offset? - jnz intusr.4 # Yes - shll $0x2,%eax # Scale +intusr.3: shll $0x2,%eax # Scale movl (%eax),%eax # Load int vector - andl $~(PSL_I|PSL_T|PSL_AC),%ebx # Disable interrupts, tracing, - # and alignment checking for - # interrupt handler jmp intusr.5 # Skip CALLF test +/* + * Panic if V86F_CALLF isn't set with V86F_ADDR. + */ intusr.4: testl $V86F_CALLF,%edx # Far call? jnz intusr.5 # Ok movl %edx,0x30(%esp,1) # Place VM86 flags in int no @@ -522,6 +539,11 @@ intusr.4: testl $V86F_CALLF,%edx # Far popl %gs popal # Restore gp regs jmp ex_noc # Panic +/* + * %eax now holds the segment:offset of the function. + * %ebx now holds the %eflags to pass to real mode. + * %edx now holds the V86F_* flags. + */ intusr.5: movw %bx,MEM_ESPR-0x12 # Pass user flags to real mode # target /* @@ -536,8 +558,7 @@ intusr.5: movw %bx,MEM_ESPR-0x12 # Pass rep # from btx_v86 movsl # to kernel stack popl %esi # Restore -intusr.6: movl %esp,MEM_ESPR-0x04 # Save kernel stack pointer - movl -0x08(%esi),%ebx # Copy user flags to real +intusr.6: movl -0x08(%esi),%ebx # Copy user flags to real movl %ebx,MEM_ESPR-0x0c # mode return trampoline movl $rret_tramp,%ebx # Set return trampoline movl %ebx,MEM_ESPR-0x10 # CS:IP @@ -611,9 +632,16 @@ rret_tramp.1: xorl %ecx,%ecx # Zero movb $SEL_TSS,%cl # Set task ltr %cx # register /* - * Now we are back in protected mode. Copy the registers off of the real - * mode stack onto the kernel stack. Also, initialize all the seg regs on - * the kernel stack. + * Now we are back in protected mode. The kernel stack frame set up + * before entering real mode is still intact. For hardware interrupts, + * leave the frame unchanged. + */ + cmpl $0,MEM_ESPR-0x08 # Leave saved regs unchanged + jz rret_tramp.3 # for hardware ints +/* + * For V86 calls, copy the registers off of the real mode stack onto + * the kernel stack as we want their updated values. Also, initialize + * the segment registers on the kernel stack. * * Note that the %esp in the kernel stack after this is garbage, but popa * ignores it, so we don't have to fix it up. @@ -624,20 +652,17 @@ rret_tramp.1: xorl %ecx,%ecx # Zero movl $8,%ecx # Copy GP regs from rep # real mode stack movsl # to kernel stack - popl %esi # Restore movl $SEL_UDATA,%eax # Selector for data seg regs movl $4,%ecx # Initialize %ds, rep # %es, %fs, and stosl # %gs /* - * If this was a V86 call, copy the saved seg regs on the real mode stack - * back over to the btx_v86 structure. Also, conditionally update the saved - * eflags on the kernel stack based on the flags from the user. + * For V86 calls, copy the saved seg regs on the real mode stack back + * over to the btx_v86 structure. Also, conditionally update the + * saved eflags on the kernel stack based on the flags from the user. */ movl MEM_ESPR-0x08,%ecx # Get btx_v86 ptr - jecxz rret_tramp.3 # Skip for hardware ints leal V86_GS(%ecx),%edi # %edi => btx_v86 seg regs - pushl %esi # Save leal MEM_ESPR-0x2c,%esi # %esi => real mode seg regs xchgl %ecx,%edx # Save btx_v86 ptr movl $4,%ecx # Copy seg regs From kientzle at FreeBSD.org Tue Mar 3 09:02:54 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Tue Mar 3 09:03:02 2009 Subject: svn commit: r189308 - in head/lib/libarchive: . test Message-ID: <200903031702.n23H2pK9016248@svn.freebsd.org> Author: kientzle Date: Tue Mar 3 17:02:51 2009 New Revision: 189308 URL: http://svn.freebsd.org/changeset/base/189308 Log: Merge r294:337,r348:350 from libarchive.googlecode.com: A lot of work to make libarchive work on Windows. Added: head/lib/libarchive/test/test_compat_gtar_1.tar.uu (contents, props changed) head/lib/libarchive/test/test_pax_filename_encoding.tar.uu (contents, props changed) head/lib/libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu (contents, props changed) head/lib/libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu (contents, props changed) head/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tar.uu (contents, props changed) head/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu (contents, props changed) head/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu (contents, props changed) Deleted: head/lib/libarchive/test/test_compat_gtar_1.tgz.uu head/lib/libarchive/test/test_pax_filename_encoding.tar.gz.uu head/lib/libarchive/test/test_read_format_gtar_sparse_1_13.tgz.uu head/lib/libarchive/test/test_read_format_gtar_sparse_1_17.tgz.uu head/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tgz.uu head/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tgz.uu head/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tgz.uu Modified: head/lib/libarchive/archive.h head/lib/libarchive/archive_entry.c head/lib/libarchive/archive_string.c head/lib/libarchive/archive_write_disk.c head/lib/libarchive/archive_write_set_format_pax.c head/lib/libarchive/test/ (props changed) head/lib/libarchive/test/main.c head/lib/libarchive/test/read_open_memory.c head/lib/libarchive/test/test.h head/lib/libarchive/test/test_acl_pax.c head/lib/libarchive/test/test_compat_bzip2.c head/lib/libarchive/test/test_compat_gtar.c head/lib/libarchive/test/test_compat_gzip.c head/lib/libarchive/test/test_compat_zip.c head/lib/libarchive/test/test_empty_write.c head/lib/libarchive/test/test_entry.c head/lib/libarchive/test/test_fuzz.c head/lib/libarchive/test/test_pax_filename_encoding.c head/lib/libarchive/test/test_read_compress_program.c head/lib/libarchive/test/test_read_extract.c head/lib/libarchive/test/test_read_format_cpio_bin_bz2.c head/lib/libarchive/test/test_read_format_cpio_bin_gz.c head/lib/libarchive/test/test_read_format_cpio_svr4_gzip.c head/lib/libarchive/test/test_read_format_empty.c head/lib/libarchive/test/test_read_format_gtar_gz.c head/lib/libarchive/test/test_read_format_gtar_sparse.c head/lib/libarchive/test/test_read_format_iso_gz.c head/lib/libarchive/test/test_read_format_isorr_bz2.c head/lib/libarchive/test/test_read_format_pax_bz2.c head/lib/libarchive/test/test_read_format_tbz.c head/lib/libarchive/test/test_read_format_tgz.c head/lib/libarchive/test/test_read_format_zip.c head/lib/libarchive/test/test_read_large.c head/lib/libarchive/test/test_tar_large.c head/lib/libarchive/test/test_ustar_filenames.c head/lib/libarchive/test/test_write_compress.c head/lib/libarchive/test/test_write_compress_program.c head/lib/libarchive/test/test_write_disk.c head/lib/libarchive/test/test_write_disk_hardlink.c head/lib/libarchive/test/test_write_disk_perms.c head/lib/libarchive/test/test_write_disk_secure.c head/lib/libarchive/test/test_write_format_ar.c head/lib/libarchive/test/test_write_format_cpio_newc.c head/lib/libarchive/test/test_write_format_cpio_odc.c head/lib/libarchive/test/test_write_format_tar.c head/lib/libarchive/test/test_write_format_tar_empty.c head/lib/libarchive/test/test_write_format_tar_ustar.c head/lib/libarchive/test/test_write_open_memory.c Modified: head/lib/libarchive/archive.h ============================================================================== --- head/lib/libarchive/archive.h Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/archive.h Tue Mar 3 17:02:51 2009 (r189308) @@ -47,7 +47,11 @@ /* These should match the types used in 'struct stat' */ #ifdef _WIN32 #define __LA_INT64_T __int64 -#define __LA_SSIZE_T long +# if defined(_WIN64) +# define __LA_SSIZE_T __int64 +# else +# define __LA_SSIZE_T long +# endif #define __LA_UID_T unsigned int #define __LA_GID_T unsigned int #else Modified: head/lib/libarchive/archive_entry.c ============================================================================== --- head/lib/libarchive/archive_entry.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/archive_entry.c Tue Mar 3 17:02:51 2009 (r189308) @@ -62,6 +62,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_WCHAR_H #include #endif +#ifdef _WIN32 +#include +#endif #include "archive.h" #include "archive_entry.h" @@ -227,9 +230,15 @@ aes_get_wcs(struct aes *aes) w = (wchar_t *)malloc((wcs_length + 1) * sizeof(wchar_t)); if (w == NULL) __archive_errx(1, "No memory for aes_get_wcs()"); +#ifndef _WIN32 r = mbstowcs(w, aes->aes_mbs.s, wcs_length); - w[wcs_length] = 0; +#else + r = MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, + aes->aes_mbs.s, (int)aes->aes_mbs.length, w, + (int)wcs_length); +#endif if (r > 0) { + w[r] = 0; aes->aes_set |= AES_SET_WCS; return (aes->aes_wcs = w); } Modified: head/lib/libarchive/archive_string.c ============================================================================== --- head/lib/libarchive/archive_string.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/archive_string.c Tue Mar 3 17:02:51 2009 (r189308) @@ -40,6 +40,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_WCHAR_H #include #endif +#ifdef _WIN32 +#include +#endif #include "archive_private.h" #include "archive_string.h" @@ -175,6 +178,7 @@ __archive_strappend_int(struct archive_s return (as); } +#ifndef _WIN32 /* * Home-grown wctomb for UTF-8. */ @@ -375,3 +379,83 @@ __archive_string_utf8_w(struct archive_s *dest++ = L'\0'; return (ws); } + +#else + +static struct archive_string * +my_archive_strappend_w(struct archive_string *as, + unsigned int codepage, const wchar_t *w) +{ + char *p; + int l, wl; + BOOL useDefaultChar = FALSE; + + wl = (int)wcslen(w); + l = wl * 4 + 4; + p = malloc(l); + if (p == NULL) + __archive_errx(1, "Out of memory"); + /* To check a useDefaultChar is to simulate error handling of + * the my_wcstombs() which is running on non Windows system with + * wctomb(). + * And to set NULL for last argument is necessary when a codepage + * is not CP_ACP(current locale). + */ + l = WideCharToMultiByte(codepage, 0, w, wl, p, l, NULL, + (codepage == CP_ACP) ? &useDefaultChar : NULL); + if (l == 0 || useDefaultChar) { + free(p); + return (NULL); + } + __archive_string_append(as, p, l); + free(p); + return (as); +} + +/* + * Translates a wide character string into UTF-8 and appends + * to the archive_string. Note: returns NULL if conversion fails. + */ +struct archive_string * +__archive_strappend_w_utf8(struct archive_string *as, const wchar_t *w) +{ + + return (my_archive_strappend_w(as, CP_UTF8, w)); +} + +/* + * Translates a wide character string into current locale character set + * and appends to the archive_string. Note: returns NULL if conversion + * fails. + */ +struct archive_string * +__archive_strappend_w_mbs(struct archive_string *as, const wchar_t *w) +{ + + return (my_archive_strappend_w(as, CP_ACP, w)); +} + +/* + * Return a wide-character string by converting this archive_string + * from UTF-8. + */ +wchar_t * +__archive_string_utf8_w(struct archive_string *as) +{ + wchar_t *ws; + int n; + + ws = (wchar_t *)malloc((as->length + 1) * sizeof(wchar_t)); + if (ws == NULL) + __archive_errx(1, "Out of memory"); + n = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, + as->s, (int)as->length, ws, (int)as->length); + if (n == 0) { + free(ws); + return (NULL); + } + ws[n] = L'\0'; + return (ws); +} + +#endif /* !_WIN32 */ Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/archive_write_disk.c Tue Mar 3 17:02:51 2009 (r189308) @@ -83,6 +83,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_UTIME_H #include #endif +#ifdef _WIN32 +#include +#endif #include "archive.h" #include "archive_string.h" @@ -516,6 +519,9 @@ static ssize_t write_data_block(struct archive_write_disk *a, const char *buff, size_t size) { uint64_t start_size = size; +#if _WIN32 + HANDLE handle; +#endif ssize_t bytes_written = 0; ssize_t block_size = 0, bytes_to_write; @@ -524,6 +530,9 @@ write_data_block(struct archive_write_di "Attempt to write to an empty file"); return (ARCHIVE_WARN); } +#if _WIN32 + handle = (HANDLE)_get_osfhandle(a->fd); +#endif if (a->flags & ARCHIVE_EXTRACT_SPARSE) { #if HAVE_STRUCT_STAT_ST_BLKSIZE @@ -572,7 +581,23 @@ write_data_block(struct archive_write_di if (a->offset + bytes_to_write > block_end) bytes_to_write = block_end - a->offset; } - +#ifdef _WIN32 + /* Seek if necessary to the specified offset. */ + if (offset != a->fd_offset) { + LARGE_INTEGER distance; + distance.QuadPart = offset; + if (!SetFilePointerEx(handle, distance, NULL, FILE_BEGIN)) { + archive_set_error(&a->archive, _dosmaperr(GetLastError()), + "Seek failed"); + return (ARCHIVE_FATAL); + } + } + if (!WriteFile(handle, buff, bytes_to_write, &bytes_written, NULL)) { + archive_set_error(&a->archive, _dosmaperr(GetLastError()), + "Write failed"); + return (ARCHIVE_WARN); + } +#else /* Seek if necessary to the specified offset. */ if (a->offset != a->fd_offset) { if (lseek(a->fd, a->offset, SEEK_SET) < 0) { @@ -589,6 +614,7 @@ write_data_block(struct archive_write_di archive_set_error(&a->archive, errno, "Write failed"); return (ARCHIVE_WARN); } +#endif buff += bytes_written; size -= bytes_written; a->offset += bytes_written; @@ -1186,7 +1212,11 @@ _archive_write_close(struct archive *_a) if (p->fixup & TODO_TIMES) { #ifdef HAVE_UTIMES /* {f,l,}utimes() are preferred, when available. */ +#ifdef __timeval + struct __timeval times[2]; +#else struct timeval times[2]; +#endif times[0].tv_sec = p->atime; times[0].tv_usec = p->atime_nanos / 1000; #ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME @@ -1717,7 +1747,11 @@ set_time(int fd, int mode, const char *n time_t atime, long atime_nsec, time_t mtime, long mtime_nsec) { +#ifdef __timeval + struct __timeval times[2]; +#else struct timeval times[2]; +#endif times[0].tv_sec = atime; times[0].tv_usec = atime_nsec / 1000; Modified: head/lib/libarchive/archive_write_set_format_pax.c ============================================================================== --- head/lib/libarchive/archive_write_set_format_pax.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/archive_write_set_format_pax.c Tue Mar 3 17:02:51 2009 (r189308) @@ -203,6 +203,16 @@ utf8_encode(const wchar_t *wval) utf8len = 0; for (wp = wval; *wp != L'\0'; ) { wc = *wp++; + + if (wc >= 0xd800 && wc <= 0xdbff + && *wp >= 0xdc00 && *wp <= 0xdfff) { + /* This is a surrogate pair. Combine into a + * full Unicode value before encoding into + * UTF-8. */ + wc = (wc - 0xd800) << 10; /* High 10 bits */ + wc += (*wp++ - 0xdc00); /* Low 10 bits */ + wc += 0x10000; /* Skip BMP */ + } if (wc <= 0x7f) utf8len++; else if (wc <= 0x7ff) @@ -226,6 +236,12 @@ utf8_encode(const wchar_t *wval) for (wp = wval, p = utf8_value; *wp != L'\0'; ) { wc = *wp++; + if (wc >= 0xd800 && wc <= 0xdbff + && *wp >= 0xdc00 && *wp <= 0xdfff) { + /* Combine surrogate pair. */ + wc = (wc - 0xd800) << 10; + wc += *wp++ - 0xdc00 + 0x10000; + } if (wc <= 0x7f) { *p++ = (char)wc; } else if (wc <= 0x7ff) { Modified: head/lib/libarchive/test/main.c ============================================================================== --- head/lib/libarchive/test/main.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/test/main.c Tue Mar 3 17:02:51 2009 (r189308) @@ -44,7 +44,7 @@ #define ENVBASE "LIBARCHIVE" /* Prefix for environment variables. */ #define EXTRA_DUMP(x) archive_error_string((struct archive *)(x)) #define EXTRA_VERSION archive_version() -#define KNOWNREF "test_compat_gtar_1.tgz.uu" +#define KNOWNREF "test_compat_gtar_1.tar.uu" __FBSDID("$FreeBSD$"); /* @@ -81,7 +81,20 @@ static int skips = 0; static int assertions = 0; /* Directory where uuencoded reference files can be found. */ -static char *refdir; +static const char *refdir; + + +#ifdef _WIN32 + +static void +invalid_paramter_handler(const wchar_t * expression, + const wchar_t * function, const wchar_t * file, + unsigned int line, uintptr_t pReserved) +{ + /* nop */ +} + +#endif /* * My own implementation of the standard assert() macro emits the @@ -751,7 +764,11 @@ static int test_run(int i, const char *t /* If there were no failures, we can remove the work dir. */ if (failures == failures_before) { if (!keep_temp_files && chdir(tmpdir) == 0) { +#ifndef _WIN32 systemf("rm -rf %s", tests[i].name); +#else + systemf("rmdir /S /Q %s", tests[i].name); +#endif } } /* Return appropriate status. */ @@ -844,19 +861,18 @@ extract_reference_file(const char *name) } static char * -get_refdir(const char *tmpdir) +get_refdir(void) { char tried[512] = { '\0' }; char buff[128]; char *pwd, *p; /* Get the current dir. */ - systemf("/bin/pwd > %s/refdir", tmpdir); - pwd = slurpfile(NULL, "%s/refdir", tmpdir); + /* XXX Visual C++ uses _getcwd() XXX */ + pwd = getcwd(NULL, 0); while (pwd[strlen(pwd) - 1] == '\n') pwd[strlen(pwd) - 1] = '\0'; printf("PWD: %s\n", pwd); - systemf("rm %s/refdir", tmpdir); /* Look for a known file. */ snprintf(buff, sizeof(buff), "%s", pwd); @@ -904,24 +920,24 @@ success: int main(int argc, char **argv) { static const int limit = sizeof(tests) / sizeof(tests[0]); - int i, tests_run = 0, tests_failed = 0, opt; + int i, tests_run = 0, tests_failed = 0, option; time_t now; char *refdir_alloc = NULL; - char *progname, *p; - const char *tmp; + const char *progname = LIBRARY "_test"; + const char *tmp, *option_arg, *p; char tmpdir[256]; char tmpdir_timestamp[256]; - /* - * Name of this program, used to build root of our temp directory - * tree. - */ - progname = p = argv[0]; - while (*p != '\0') { - if (*p == '/') - progname = p + 1; - ++p; - } + (void)argc; /* UNUSED */ + +#ifdef _WIN32 + /* To stop to run the default invalid parameter handler. */ + _set_invalid_parameter_handler(invalid_paramter_handler); + /* for open() to a binary mode. */ + _set_fmode(_O_BINARY); + /* Disable annoying assertion message box. */ + _CrtSetReportMode(_CRT_ASSERT, 0); +#endif #ifdef PROGRAM /* Get the target program from environment, if available. */ @@ -947,39 +963,60 @@ int main(int argc, char **argv) refdir = getenv(ENVBASE "_TEST_FILES"); /* - * Parse options. + * Parse options, without using getopt(), which isn't available + * on all platforms. */ - while ((opt = getopt(argc, argv, "dkp:qr:v")) != -1) { - switch (opt) { - case 'd': - dump_on_failure = 1; - break; - case 'k': - keep_temp_files = 1; - break; - case 'p': + ++argv; /* Skip program name */ + while (*argv != NULL) { + p = *argv++; + if (*p++ != '-') + usage(progname); + while (*p != '\0') { + option = *p++; + option_arg = NULL; + /* If 'opt' takes an argument, parse that. */ + if (option == 'p' || option == 'r') { + if (*p != '\0') + option_arg = p; + else if (*argv == NULL) { + fprintf(stderr, + "Option -%c requires argument.\n", + option); + usage(progname); + } else + option_arg = *argv++; + p = ""; /* End of this option word. */ + } + + /* Now, handle the option. */ + switch (option) { + case 'd': + dump_on_failure = 1; + break; + case 'k': + keep_temp_files = 1; + break; + case 'p': #ifdef PROGRAM - testprog = optarg; + testprog = option_arg; #else - usage(progname); + usage(progname); #endif - break; - case 'q': - quiet_flag++; - break; - case 'r': - refdir = optarg; - break; - case 'v': - verbose = 1; - break; - case '?': - default: - usage(progname); + break; + case 'q': + quiet_flag++; + break; + case 'r': + refdir = option_arg; + break; + case 'v': + verbose = 1; + break; + default: + usage(progname); + } } } - argc -= optind; - argv += optind; /* * Sanity-check that our options make sense. @@ -1016,7 +1053,7 @@ int main(int argc, char **argv) * the "usual places." */ if (refdir == NULL) - refdir = refdir_alloc = get_refdir(tmpdir); + refdir = refdir_alloc = get_refdir(); /* * Banner with basic information. @@ -1035,7 +1072,7 @@ int main(int argc, char **argv) /* * Run some or all of the individual tests. */ - if (argc == 0) { + if (*argv == NULL) { /* Default: Run all tests. */ for (i = 0; i < limit; i++) { if (test_run(i, tmpdir)) Modified: head/lib/libarchive/test/read_open_memory.c ============================================================================== --- head/lib/libarchive/test/read_open_memory.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/test/read_open_memory.c Tue Mar 3 17:02:51 2009 (r189308) @@ -107,7 +107,7 @@ memory_read(struct archive *a, void *cli *buff = mine->copy_buff; mine->buffer += size; - return (size); + return ((ssize_t)size); } /* Modified: head/lib/libarchive/test/test.h ============================================================================== --- head/lib/libarchive/test/test.h Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/test/test.h Tue Mar 3 17:02:51 2009 (r189308) @@ -45,7 +45,11 @@ #error Oops: No config.h and no pre-built configuration in test.h. #endif +#ifndef _WIN32 #include +#else +#include +#endif #include #include #include @@ -68,6 +72,16 @@ #define __FBSDID(a) /* null */ #endif +#ifdef _WIN32 +#define LOCALE_DE "deu" +#else +#define LOCALE_DE "de_DE.UTF-8" +#endif + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + /* * Redefine DEFINE_TEST for use in defining the test functions. */ Modified: head/lib/libarchive/test/test_acl_pax.c ============================================================================== --- head/lib/libarchive/test/test_acl_pax.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/test/test_acl_pax.c Tue Mar 3 17:02:51 2009 (r189308) @@ -454,7 +454,7 @@ DEFINE_TEST(test_acl_pax) /* Write out the data we generated to a file for manual inspection. */ assert(-1 < (fd = open("testout", O_WRONLY | O_CREAT | O_TRUNC, 0775))); - assert(used == (size_t)write(fd, buff, used)); + assert(used == (size_t)write(fd, buff, (unsigned int)used)); close(fd); /* Write out the reference data to a file for manual inspection. */ @@ -466,7 +466,7 @@ DEFINE_TEST(test_acl_pax) failure("Generated pax archive does not match reference; check 'testout' and 'reference' files."); assert(0 == memcmp(buff, reference, sizeof(reference))); failure("Generated pax archive does not match reference; check 'testout' and 'reference' files."); - assertEqualInt(used, sizeof(reference)); + assertEqualInt((int)used, sizeof(reference)); /* Read back each entry and check that the ACL data is right. */ assert(NULL != (a = archive_read_new())); Modified: head/lib/libarchive/test/test_compat_bzip2.c ============================================================================== --- head/lib/libarchive/test/test_compat_bzip2.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/test/test_compat_bzip2.c Tue Mar 3 17:02:51 2009 (r189308) @@ -82,8 +82,12 @@ compat_bzip2(const char *name) DEFINE_TEST(test_compat_bzip2) { +#if HAVE_BZLIB_H compat_bzip2("test_compat_bzip2_1.tbz"); compat_bzip2("test_compat_bzip2_2.tbz"); +#else + skipping("Need bzlib"); +#endif } Modified: head/lib/libarchive/test/test_compat_gtar.c ============================================================================== --- head/lib/libarchive/test/test_compat_gtar.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/test/test_compat_gtar.c Tue Mar 3 17:02:51 2009 (r189308) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); static void test_compat_gtar_1(void) { - char name[] = "test_compat_gtar_1.tgz"; + char name[] = "test_compat_gtar_1.tar"; struct archive_entry *ae; struct archive *a; int r; @@ -99,7 +99,7 @@ test_compat_gtar_1(void) assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); /* Verify that the format detection worked. */ - assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_GZIP); + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_GNUTAR); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); Added: head/lib/libarchive/test/test_compat_gtar_1.tar.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_compat_gtar_1.tar.uu Tue Mar 3 17:02:51 2009 (r189308) @@ -0,0 +1,232 @@ +$FreeBSD$ +begin 644 test_compat_gtar_1.tar +M+B\N+T!,;VYG3&EN:P`````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````"`@("`@,"``("`@("`P(``@("`@(#`@`"`@("`@("`@,S$Q +M("`@("`@("`@("`P("`Q,# Author: kientzle Date: Tue Mar 3 17:07:27 2009 New Revision: 189309 URL: http://svn.freebsd.org/changeset/base/189309 Log: Merge r340 from libarchive.googlecode.com: If zlib/bzlib aren't available, we can still detect gzip/bzip2 compressed streams, we just can't decompress them. Modified: head/lib/libarchive/archive_write_set_compression_bzip2.c head/lib/libarchive/archive_write_set_compression_gzip.c Modified: head/lib/libarchive/archive_write_set_compression_bzip2.c ============================================================================== --- head/lib/libarchive/archive_write_set_compression_bzip2.c Tue Mar 3 17:02:51 2009 (r189308) +++ head/lib/libarchive/archive_write_set_compression_bzip2.c Tue Mar 3 17:07:27 2009 (r189309) @@ -25,9 +25,6 @@ #include "archive_platform.h" -/* Don't compile this if we don't have bzlib. */ -#if HAVE_BZLIB_H - __FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H @@ -48,6 +45,16 @@ __FBSDID("$FreeBSD$"); #include "archive_private.h" #include "archive_write_private.h" +#ifndef HAVE_BZLIB_H +int +archive_write_set_compression_bzip2(struct archive *_a) +{ + /* Unsupported bzip2 compression, we don't have bzlib */ + return (ARCHIVE_FATAL); +} +#else +/* Don't compile this if we don't have bzlib. */ + struct private_data { bz_stream stream; int64_t total_in; Modified: head/lib/libarchive/archive_write_set_compression_gzip.c ============================================================================== --- head/lib/libarchive/archive_write_set_compression_gzip.c Tue Mar 3 17:02:51 2009 (r189308) +++ head/lib/libarchive/archive_write_set_compression_gzip.c Tue Mar 3 17:07:27 2009 (r189309) @@ -25,9 +25,6 @@ #include "archive_platform.h" -/* Don't compile this if we don't have zlib. */ -#if HAVE_ZLIB_H - __FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H @@ -48,6 +45,16 @@ __FBSDID("$FreeBSD$"); #include "archive_private.h" #include "archive_write_private.h" +#ifndef HAVE_ZLIB_H +int +archive_write_set_compression_gzip(struct archive *_a) +{ + /* Unsupported gzip compression, we don't have zlib */ + return (ARCHIVE_FATAL); +} +#else +/* Don't compile this if we don't have zlib. */ + struct private_data { z_stream stream; int64_t total_in; From jhb at FreeBSD.org Tue Mar 3 09:10:16 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Mar 3 09:10:55 2009 Subject: svn commit: r189310 - in stable/6/sys: . boot/i386/btx/btx contrib/pf dev/cxgb Message-ID: <200903031710.n23HAENx016548@svn.freebsd.org> Author: jhb Date: Tue Mar 3 17:10:14 2009 New Revision: 189310 URL: http://svn.freebsd.org/changeset/base/189310 Log: MFC: Use a clean slate of register state when executing hardware interrupt handlers to avoid leaking values into the upper 16-bits of general purpose registers when executing these routines. Modified: stable/6/sys/ (props changed) stable/6/sys/boot/i386/btx/btx/btx.S stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/boot/i386/btx/btx/btx.S ============================================================================== --- stable/6/sys/boot/i386/btx/btx/btx.S Tue Mar 3 17:07:27 2009 (r189309) +++ stable/6/sys/boot/i386/btx/btx/btx.S Tue Mar 3 17:10:14 2009 (r189310) @@ -36,6 +36,7 @@ /* * Fields in %eflags. */ + .set PSL_RESERVED_DEFAULT,0x00000002 .set PSL_T,0x00000100 # Trap flag .set PSL_I,0x00000200 # Interrupt enable flag .set PSL_VM,0x00020000 # Virtual 8086 mode flag @@ -455,6 +456,18 @@ intx31: pushl $-1 # Dummy int no for * -0x3c %fs * -0x40 %ds * -0x44 %es + * -0x48 zero %eax (hardware int only) + * -0x4c zero %ecx (hardware int only) + * -0x50 zero %edx (hardware int only) + * -0x54 zero %ebx (hardware int only) + * -0x58 zero %esp (hardware int only) + * -0x5c zero %ebp (hardware int only) + * -0x60 zero %esi (hardware int only) + * -0x64 zero %edi (hardware int only) + * -0x68 zero %gs (hardware int only) + * -0x6c zero %fs (hardware int only) + * -0x70 zero %ds (hardware int only) + * -0x74 zero %es (hardware int only) */ int_hw: cld # String ops inc pusha # Save gp regs @@ -467,12 +480,15 @@ int_hw: cld # String ops inc pushl %ds # address popl %es # data leal 0x44(%esp,1),%esi # Base of frame + movl %esp,MEM_ESPR-0x04 # Save kernel stack pointer movl -0x14(%esi),%eax # Get Int no cmpl $-1,%eax # Hardware interrupt? - jne intusr.2 # Yes + jne intusr.1 # Yes /* - * v86 calls save the btx_v86 pointer on the real mode stack and read the - * address and flags from the btx_v86 structure. + * v86 calls save the btx_v86 pointer on the real mode stack and read + * the address and flags from the btx_v86 structure. For interrupt + * handler invocations (VM86 INTx requests), disable interrupts, + * tracing, and alignment checking while the handler runs. */ movl $MEM_USR,%ebx # User base movl %ebx,%edx # address @@ -482,35 +498,36 @@ int_hw: cld # String ops inc movl %edx,MEM_ESPR-0x08 # Save btx_v86 ptr movl V86_ADDR(%edx),%eax # Get int no/address movl V86_CTL(%edx),%edx # Get control flags + movl -0x08(%esi),%ebx # Save user flags in %ebx + testl $V86F_ADDR,%edx # Segment:offset? + jnz intusr.4 # Yes + andl $~(PSL_I|PSL_T|PSL_AC),%ebx # Disable interrupts, tracing, + # and alignment checking for + # interrupt handler jmp intusr.3 # Skip hardware interrupt /* - * Hardware interrupts store a NULL btx_v86 pointer and use the address - * (interrupt number) from the stack with empty flags. Also, we clear - * the segment registers for the interrupt handler. + * Hardware interrupts store a NULL btx_v86 pointer and use the + * address (interrupt number) from the stack with empty flags. Also, + * push a dummy frame of zeros onto the stack for all the general + * purpose and segment registers and clear %eflags. This gives the + * hardware interrupt handler a clean slate. */ -intusr.2: xorl %edx,%edx # Control flags +intusr.1: xorl %edx,%edx # Control flags movl %edx,MEM_ESPR-0x08 # NULL btx_v86 ptr - movl %edx,-0x38(%esi) # Real mode %gs of 0 - movl %edx,-0x3c(%esi) # Real mode %fs of 0 - movl %edx,-0x40(%esi) # Real mode %ds of 0 - movl %edx,-0x44(%esi) # Real mode %es of 0 + movl $12,%ecx # Frame is 12 dwords +intusr.2: pushl $0x0 # Fill frame + loop intusr.2 # with zeros + movl $PSL_RESERVED_DEFAULT,%ebx # Set clean %eflags /* - * %eax now holds either the interrupt number or segment:offset of function. - * %edx now holds the V86F_* flags. - * - * For interrupt handler invocations (either hardware interrupts or VM86 - * INTx requests) we also disable interrupts, tracing, and alignment checking - * while the handler runs. + * Look up real mode IDT entry for hardware interrupts and VM86 INTx + * requests. */ -intusr.3: movl -0x08(%esi),%ebx # Save user flags in %ebx - testl $V86F_ADDR,%edx # Segment:offset? - jnz intusr.4 # Yes - shll $0x2,%eax # Scale +intusr.3: shll $0x2,%eax # Scale movl (%eax),%eax # Load int vector - andl $~(PSL_I|PSL_T|PSL_AC),%ebx # Disable interrupts, tracing, - # and alignment checking for - # interrupt handler jmp intusr.5 # Skip CALLF test +/* + * Panic if V86F_CALLF isn't set with V86F_ADDR. + */ intusr.4: testl $V86F_CALLF,%edx # Far call? jnz intusr.5 # Ok movl %edx,0x30(%esp,1) # Place VM86 flags in int no @@ -522,6 +539,11 @@ intusr.4: testl $V86F_CALLF,%edx # Far popl %gs popal # Restore gp regs jmp ex_noc # Panic +/* + * %eax now holds the segment:offset of the function. + * %ebx now holds the %eflags to pass to real mode. + * %edx now holds the V86F_* flags. + */ intusr.5: movw %bx,MEM_ESPR-0x12 # Pass user flags to real mode # target /* @@ -536,8 +558,7 @@ intusr.5: movw %bx,MEM_ESPR-0x12 # Pass rep # from btx_v86 movsl # to kernel stack popl %esi # Restore -intusr.6: movl %esp,MEM_ESPR-0x04 # Save kernel stack pointer - movl -0x08(%esi),%ebx # Copy user flags to real +intusr.6: movl -0x08(%esi),%ebx # Copy user flags to real movl %ebx,MEM_ESPR-0x0c # mode return trampoline movl $rret_tramp,%ebx # Set return trampoline movl %ebx,MEM_ESPR-0x10 # CS:IP @@ -611,9 +632,16 @@ rret_tramp.1: xorl %ecx,%ecx # Zero movb $SEL_TSS,%cl # Set task ltr %cx # register /* - * Now we are back in protected mode. Copy the registers off of the real - * mode stack onto the kernel stack. Also, initialize all the seg regs on - * the kernel stack. + * Now we are back in protected mode. The kernel stack frame set up + * before entering real mode is still intact. For hardware interrupts, + * leave the frame unchanged. + */ + cmpl $0,MEM_ESPR-0x08 # Leave saved regs unchanged + jz rret_tramp.3 # for hardware ints +/* + * For V86 calls, copy the registers off of the real mode stack onto + * the kernel stack as we want their updated values. Also, initialize + * the segment registers on the kernel stack. * * Note that the %esp in the kernel stack after this is garbage, but popa * ignores it, so we don't have to fix it up. @@ -624,20 +652,17 @@ rret_tramp.1: xorl %ecx,%ecx # Zero movl $8,%ecx # Copy GP regs from rep # real mode stack movsl # to kernel stack - popl %esi # Restore movl $SEL_UDATA,%eax # Selector for data seg regs movl $4,%ecx # Initialize %ds, rep # %es, %fs, and stosl # %gs /* - * If this was a V86 call, copy the saved seg regs on the real mode stack - * back over to the btx_v86 structure. Also, conditionally update the saved - * eflags on the kernel stack based on the flags from the user. + * For V86 calls, copy the saved seg regs on the real mode stack back + * over to the btx_v86 structure. Also, conditionally update the + * saved eflags on the kernel stack based on the flags from the user. */ movl MEM_ESPR-0x08,%ecx # Get btx_v86 ptr - jecxz rret_tramp.3 # Skip for hardware ints leal V86_GS(%ecx),%edi # %edi => btx_v86 seg regs - pushl %esi # Save leal MEM_ESPR-0x2c,%esi # %esi => real mode seg regs xchgl %ecx,%edx # Save btx_v86 ptr movl $4,%ecx # Copy seg regs From rwatson at FreeBSD.org Tue Mar 3 09:15:06 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Tue Mar 3 09:15:12 2009 Subject: svn commit: r189311 - in head/sys: kern security/mac sys Message-ID: <200903031715.n23HF58A016673@svn.freebsd.org> Author: rwatson Date: Tue Mar 3 17:15:05 2009 New Revision: 189311 URL: http://svn.freebsd.org/changeset/base/189311 Log: Reduce the verbosity of SDT trace points for DTrace by defining several wrapper macros that allow trace points and arguments to be declared using a single macro rather than several. This means a lot less repetition and vertical space for each trace point. Use these macros when defining privilege and MAC Framework trace points. Reviewed by: jb MFC after: 1 week Modified: head/sys/kern/kern_priv.c head/sys/security/mac/mac_framework.c head/sys/sys/sdt.h Modified: head/sys/kern/kern_priv.c ============================================================================== --- head/sys/kern/kern_priv.c Tue Mar 3 17:10:14 2009 (r189310) +++ head/sys/kern/kern_priv.c Tue Mar 3 17:15:05 2009 (r189311) @@ -61,12 +61,8 @@ SYSCTL_INT(_security_bsd, OID_AUTO, suse TUNABLE_INT("security.bsd.suser_enabled", &suser_enabled); SDT_PROVIDER_DEFINE(priv); - -SDT_PROBE_DEFINE(priv, kernel, priv_check, priv_ok); -SDT_PROBE_ARGTYPE(priv, kernel, priv_check, priv_ok, 0, "int"); - -SDT_PROBE_DEFINE(priv, kernel, priv_check, priv_err); -SDT_PROBE_ARGTYPE(priv, kernel, priv_check, priv_err, 0, "int"); +SDT_PROBE_DEFINE1(priv, kernel, priv_check, priv_ok, "int"); +SDT_PROBE_DEFINE1(priv, kernel, priv_check, priv_err, "int"); /* * Check a credential for privilege. Lots of good reasons to deny privilege; Modified: head/sys/security/mac/mac_framework.c ============================================================================== --- head/sys/security/mac/mac_framework.c Tue Mar 3 17:10:14 2009 (r189310) +++ head/sys/security/mac/mac_framework.c Tue Mar 3 17:15:05 2009 (r189311) @@ -88,19 +88,10 @@ __FBSDID("$FreeBSD$"); * DTrace SDT provider for MAC. */ SDT_PROVIDER_DEFINE(mac); - -SDT_PROBE_DEFINE(mac, kernel, policy, modevent); -SDT_PROBE_ARGTYPE(mac, kernel, policy, modevent, 0, "int"); -SDT_PROBE_ARGTYPE(mac, kernel, policy, modevent, 1, +SDT_PROBE_DEFINE2(mac, kernel, policy, modevent, "int", "struct mac_policy_conf *mpc"); - -SDT_PROBE_DEFINE(mac, kernel, policy, register); -SDT_PROBE_ARGTYPE(mac, kernel, policy, register, 0, - "struct mac_policy_conf *"); - -SDT_PROBE_DEFINE(mac, kernel, policy, unregister); -SDT_PROBE_ARGTYPE(mac, kernel, policy, unregister, 0, - "struct mac_policy_conf *"); +SDT_PROBE_DEFINE1(mac, kernel, policy, register, "struct mac_policy_conf *"); +SDT_PROBE_DEFINE1(mac, kernel, policy, unregister, "struct mac_policy_conf *"); /* * Root sysctl node for all MAC and MAC policy controls. Modified: head/sys/sys/sdt.h ============================================================================== --- head/sys/sys/sdt.h Tue Mar 3 17:10:14 2009 (r189310) +++ head/sys/sys/sdt.h Tue Mar 3 17:15:05 2009 (r189311) @@ -53,6 +53,12 @@ #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) #define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type) +#define SDT_PROBE_DEFINE1(prov, mod, func, name, arg0) +#define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1) +#define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2) +#define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3) +#define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) + #else /* @@ -156,6 +162,36 @@ struct sdt_provider { SI_SUB_KDTRACE, SI_ORDER_SECOND + 2, sdt_argtype_deregister, \ sdt_##prov##_##mod##_##func##_##name##num ) +#define SDT_PROBE_DEFINE1(prov, mod, func, name, arg0) \ + SDT_PROBE_DEFINE(prov, mod, func, name); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) + +#define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1) \ + SDT_PROBE_DEFINE(prov, mod, func, name); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) + +#define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2) \ + SDT_PROBE_DEFINE(prov, mod, func, name); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2) + +#define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3) \ + SDT_PROBE_DEFINE(prov, mod, func, name); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3) + +#define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \ + SDT_PROBE_DEFINE(prov, mod, func, name); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4) + typedef int (*sdt_argtype_listall_func_t)(struct sdt_argtype *, void *); typedef int (*sdt_probe_listall_func_t)(struct sdt_probe *, void *); typedef int (*sdt_provider_listall_func_t)(struct sdt_provider *, void *); From jhb at FreeBSD.org Tue Mar 3 09:16:28 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Mar 3 09:16:40 2009 Subject: svn commit: r189312 - stable/4/sys/boot/i386/btx/btx Message-ID: <200903031716.n23HGQfD016733@svn.freebsd.org> Author: jhb Date: Tue Mar 3 17:16:26 2009 New Revision: 189312 URL: http://svn.freebsd.org/changeset/base/189312 Log: MFC: Use a clean slate of register state when executing hardware interrupt handlers to avoid leaking values into the upper 16-bits of general purpose registers when executing these routines. Modified: stable/4/sys/boot/i386/btx/btx/btx.s Modified: stable/4/sys/boot/i386/btx/btx/btx.s ============================================================================== --- stable/4/sys/boot/i386/btx/btx/btx.s Tue Mar 3 17:15:05 2009 (r189311) +++ stable/4/sys/boot/i386/btx/btx/btx.s Tue Mar 3 17:16:26 2009 (r189312) @@ -36,6 +36,7 @@ # # Fields in %eflags. # + .set PSL_RESERVED_DEFAULT,0x00000002 .set PSL_T,0x00000100 # Trap flag .set PSL_I,0x00000200 # Interrupt enable flag .set PSL_VM,0x00020000 # Virtual 8086 mode flag @@ -452,6 +453,18 @@ intx31: pushl $-1 # Dummy int no for # -0x3c %fs # -0x40 %ds # -0x44 %es +# -0x48 zero %eax (hardware int only) +# -0x4c zero %ecx (hardware int only) +# -0x50 zero %edx (hardware int only) +# -0x54 zero %ebx (hardware int only) +# -0x58 zero %esp (hardware int only) +# -0x5c zero %ebp (hardware int only) +# -0x60 zero %esi (hardware int only) +# -0x64 zero %edi (hardware int only) +# -0x68 zero %gs (hardware int only) +# -0x6c zero %fs (hardware int only) +# -0x70 zero %ds (hardware int only) +# -0x74 zero %es (hardware int only) # int_hw: cld # String ops inc pusha # Save gp regs @@ -464,12 +477,15 @@ int_hw: cld # String ops inc pushl %ds # address popl %es # data leal 0x44(%esp,1),%esi # Base of frame + movl %esp,MEM_ESPR-0x04 # Save kernel stack pointer movl -0x14(%esi),%eax # Get Int no cmpl $-1,%eax # Hardware interrupt? - jne intusr.2 # Yes + jne intusr.1 # Yes # -# v86 calls save the btx_v86 pointer on the real mode stack and read the -# address and flags from the btx_v86 structure. +# v86 calls save the btx_v86 pointer on the real mode stack and read +# the address and flags from the btx_v86 structure. For interrupt +# handler invocations (VM86 INTx requests), disable interrupts, +# tracing, and alignment checking while the handler runs. # movl $MEM_USR,%ebx # User base movl %ebx,%edx # address @@ -479,35 +495,36 @@ int_hw: cld # String ops inc movl %edx,MEM_ESPR-0x08 # Save btx_v86 ptr movl V86_ADDR(%edx),%eax # Get int no/address movl V86_CTL(%edx),%edx # Get control flags + movl -0x08(%esi),%ebx # Save user flags in %ebx + testl $V86F_ADDR,%edx # Segment:offset? + jnz intusr.4 # Yes + andl $~(PSL_I|PSL_T|PSL_AC),%ebx # Disable interrupts, tracing, + # and alignment checking for + # interrupt handler jmp intusr.3 # Skip hardware interrupt # -# Hardware interrupts store a NULL btx_v86 pointer and use the address -# (interrupt number) from the stack with empty flags. Also, we clear -# the segment registers for the interrupt handler. +# Hardware interrupts store a NULL btx_v86 pointer and use the +# address (interrupt number) from the stack with empty flags. Also, +# push a dummy frame of zeros onto the stack for all the general +# purpose and segment registers and clear %eflags. This gives the +# hardware interrupt handler a clean slate. # -intusr.2: xorl %edx,%edx # Control flags +intusr.1: xorl %edx,%edx # Control flags movl %edx,MEM_ESPR-0x08 # NULL btx_v86 ptr - movl %edx,-0x38(%esi) # Real mode %gs of 0 - movl %edx,-0x3c(%esi) # Real mode %fs of 0 - movl %edx,-0x40(%esi) # Real mode %ds of 0 - movl %edx,-0x44(%esi) # Real mode %es of 0 + movl $12,%ecx # Frame is 12 dwords +intusr.2: pushl $0x0 # Fill frame + loop intusr.2 # with zeros + movl $PSL_RESERVED_DEFAULT,%ebx # Set clean %eflags # -# %eax now holds either the interrupt number or segment:offset of function. -# %edx now holds the V86F_* flags. -# -# For interrupt handler invocations (either hardware interrupts or VM86 -# INTx requests) we also disable interrupts, tracing, and alignment checking -# while the handler runs. +# Look up real mode IDT entry for hardware interrupts and VM86 INTx +# requests. # -intusr.3: movl -0x08(%esi),%ebx # Save user flags in %ebx - testl $V86F_ADDR,%edx # Segment:offset? - jnz intusr.4 # Yes - shll $0x2,%eax # Scale +intusr.3: shll $0x2,%eax # Scale movl (%eax),%eax # Load int vector - andl $~(PSL_I|PSL_T|PSL_AC),%ebx # Disable interrupts, tracing, - # and alignment checking for - # interrupt handler jmp intusr.5 # Skip CALLF test +# +# Panic if V86F_CALLF isn't set with V86F_ADDR. +# intusr.4: testl $V86F_CALLF,%edx # Far call? jnz intusr.5 # Ok movl %edx,0x30(%esp,1) # Place VM86 flags in int no @@ -519,6 +536,11 @@ intusr.4: testl $V86F_CALLF,%edx # Far popl %gs popal # Restore gp regs jmp ex_noc # Panic +# +# %eax now holds the segment:offset of the function. +# %ebx now holds the %eflags to pass to real mode. +# %edx now holds the V86F_* flags. +# intusr.5: movw %bx,MEM_ESPR-0x12 # Pass user flags to real mode # target # @@ -533,8 +555,7 @@ intusr.5: movw %bx,MEM_ESPR-0x12 # Pass rep # from btx_v86 movsl # to kernel stack popl %esi # Restore -intusr.6: movl %esp,MEM_ESPR-0x04 # Save kernel stack pointer - movl -0x08(%esi),%ebx # Copy user flags to real +intusr.6: movl -0x08(%esi),%ebx # Copy user flags to real movl %ebx,MEM_ESPR-0x0c # mode return trampoline movl $rret_tramp,%ebx # Set return trampoline movl %ebx,MEM_ESPR-0x10 # CS:IP @@ -608,9 +629,16 @@ rret_tramp.1: xorl %ecx,%ecx # Zero movb $SEL_TSS,%cl # Set task ltr %cx # register # -# Now we are back in protected mode. Copy the registers off of the real -# mode stack onto the kernel stack. Also, initialize all the seg regs on -# the kernel stack. +# Now we are back in protected mode. The kernel stack frame set up +# before entering real mode is still intact. For hardware interrupts, +# leave the frame unchanged. +# + cmpl $0,MEM_ESPR-0x08 # Leave saved regs unchanged + jz rret_tramp.3 # for hardware ints +# +# For V86 calls, copy the registers off of the real mode stack onto +# the kernel stack as we want their updated values. Also, initialize +# the segment registers on the kernel stack. # # Note that the %esp in the kernel stack after this is garbage, but popa # ignores it, so we don't have to fix it up. @@ -621,20 +649,17 @@ rret_tramp.1: xorl %ecx,%ecx # Zero movl $8,%ecx # Copy GP regs from rep # real mode stack movsl # to kernel stack - popl %esi # Restore movl $SEL_UDATA,%eax # Selector for data seg regs movl $4,%ecx # Initialize %ds, rep # %es, %fs, and stosl # %gs # -# If this was a V86 call, copy the saved seg regs on the real mode stack -# back over to the btx_v86 structure. Also, conditionally update the saved -# eflags on the kernel stack based on the flags from the user. +# For V86 calls, copy the saved seg regs on the real mode stack back +# over to the btx_v86 structure. Also, conditionally update the +# saved eflags on the kernel stack based on the flags from the user. # movl MEM_ESPR-0x08,%ecx # Get btx_v86 ptr - jecxz rret_tramp.3 # Skip for hardware ints leal V86_GS(%ecx),%edi # %edi => btx_v86 seg regs - pushl %esi # Save leal MEM_ESPR-0x2c,%esi # %esi => real mode seg regs xchgl %ecx,%edx # Save btx_v86 ptr movl $4,%ecx # Copy seg regs From dchagin at FreeBSD.org Tue Mar 3 09:34:11 2009 From: dchagin at FreeBSD.org (Dmitry Chagin) Date: Tue Mar 3 09:34:37 2009 Subject: svn commit: r189313 - head/sys/kern Message-ID: <200903031734.n23HYATi017058@svn.freebsd.org> Author: dchagin Date: Tue Mar 3 17:34:09 2009 New Revision: 189313 URL: http://svn.freebsd.org/changeset/base/189313 Log: as suggested by jhb@, panic in case the ncpus == 0. it helps to catch bugs in the callers. Approved by: kib (mentor) MFC after: 5 days Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Tue Mar 3 17:16:26 2009 (r189312) +++ head/sys/kern/subr_smp.c Tue Mar 3 17:34:09 2009 (r189313) @@ -366,7 +366,7 @@ smp_rendezvous_cpus(cpumask_t map, if (((1 << i) & map) != 0 && !CPU_ABSENT(i)) ncpus++; if (ncpus == 0) - return; + panic("ncpus is 0 with map=0x%x", map); /* obtain rendezvous lock */ mtx_lock_spin(&smp_ipi_mtx); From rwatson at FreeBSD.org Tue Mar 3 10:23:18 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Tue Mar 3 10:23:23 2009 Subject: svn commit: r189314 - head/sys/sys Message-ID: <200903031823.n23INGYU017985@svn.freebsd.org> Author: rwatson Date: Tue Mar 3 18:23:16 2009 New Revision: 189314 URL: http://svn.freebsd.org/changeset/base/189314 Log: Adding missing ";"'s required by some SDT_PROBE_DEFINEx() macros. MFC after: 1 week Modified: head/sys/sys/sdt.h Modified: head/sys/sys/sdt.h ============================================================================== --- head/sys/sys/sdt.h Tue Mar 3 17:34:09 2009 (r189313) +++ head/sys/sys/sdt.h Tue Mar 3 18:23:16 2009 (r189314) @@ -168,28 +168,28 @@ struct sdt_provider { #define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1) \ SDT_PROBE_DEFINE(prov, mod, func, name); \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) #define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2) \ SDT_PROBE_DEFINE(prov, mod, func, name); \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2) #define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3) \ SDT_PROBE_DEFINE(prov, mod, func, name); \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2); \ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3) #define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \ SDT_PROBE_DEFINE(prov, mod, func, name); \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2) \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3); \ SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4) typedef int (*sdt_argtype_listall_func_t)(struct sdt_argtype *, void *); From ed at FreeBSD.org Tue Mar 3 10:47:34 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Tue Mar 3 10:47:41 2009 Subject: svn commit: r189315 - in head/sys/netgraph: . atm Message-ID: <200903031847.n23IlX7N018454@svn.freebsd.org> Author: ed Date: Tue Mar 3 18:47:33 2009 New Revision: 189315 URL: http://svn.freebsd.org/changeset/base/189315 Log: Make Netgraph compile with Clang. Clang disallows structs with variable length arrays to be nested inside other structs, because this is in violation with ISO C99. Even though we can keep bugging the LLVM folks about this issue, we'd better just fix our code to not do this. This code seems to be the only code in the entire source tree that does this. I haven't tested this patch by using the kernel modules in question, but Diane Bruce and I have compared disassembled versions of these kernel modules. We would have expected them to be exactly the same, but due to randomness in the register allocator and reordering of instructions, there were some minor differences. Approved by: julian Modified: head/sys/netgraph/atm/ng_ccatm.h head/sys/netgraph/ng_pppoe.c head/sys/netgraph/ng_pppoe.h Modified: head/sys/netgraph/atm/ng_ccatm.h ============================================================================== --- head/sys/netgraph/atm/ng_ccatm.h Tue Mar 3 18:23:16 2009 (r189314) +++ head/sys/netgraph/atm/ng_ccatm.h Tue Mar 3 18:47:33 2009 (r189315) @@ -166,7 +166,6 @@ struct ngm_ccatm_portlist { struct ccatm_op { uint32_t op; /* request code */ - u_char data[]; }; #endif Modified: head/sys/netgraph/ng_pppoe.c ============================================================================== --- head/sys/netgraph/ng_pppoe.c Tue Mar 3 18:23:16 2009 (r189314) +++ head/sys/netgraph/ng_pppoe.c Tue Mar 3 18:47:33 2009 (r189315) @@ -290,7 +290,7 @@ static int pppoe_send_event(sessp sp, en static __inline const struct pppoe_tag* next_tag(const struct pppoe_hdr* ph) { - return (const struct pppoe_tag*)(((const char*)&ph->tag[0]) + return (const struct pppoe_tag*)(((const char*)(ph + 1)) + ntohs(ph->length)); } @@ -303,7 +303,7 @@ static const struct pppoe_tag* get_tag(const struct pppoe_hdr* ph, uint16_t idx) { const char *const end = (const char *)next_tag(ph); - const struct pppoe_tag *pt = &ph->tag[0]; + const struct pppoe_tag *pt = (const void *)(ph + 1); const char *ptn; /* @@ -381,7 +381,7 @@ make_packet(sessp sp) { ("%s: called from wrong state", __func__)); CTR2(KTR_NET, "%20s: called %d", __func__, sp->Session_ID); - dp = (char *)wh->ph.tag; + dp = (char *)(&wh->ph + 1); for (count = 0, tag = sp->neg->tags; ((count < sp->neg->numtags) && (count < NUMTAGS)); tag++, count++) { @@ -434,12 +434,12 @@ pppoe_match_svc(node_p node, const struc if (neg->service_len != ntohs(tag->tag_len)) continue; - if (strncmp(tag->tag_data, neg->service.data, + if (strncmp((const char *)(tag + 1), neg->service.data, ntohs(tag->tag_len)) == 0) break; } CTR3(KTR_NET, "%20s: matched %p for %s", __func__, - sp?sp->hook:NULL, tag->tag_data); + sp?sp->hook:NULL, (const char *)(tag + 1)); return (sp?sp->hook:NULL); } @@ -583,7 +583,7 @@ pppoe_finduniq(node_p node, const struct hook_p hook = NULL; union uniq uniq; - bcopy(tag->tag_data, uniq.bytes, sizeof(void *)); + bcopy(tag + 1, uniq.bytes, sizeof(void *)); /* Cycle through all known hooks. */ LIST_FOREACH(hook, &node->nd_hooks, hk_hooks) { /* Skip any nonsession hook. */ @@ -1100,7 +1100,7 @@ send_acname(sessp sp, const struct pppoe sts = (struct ngpppoe_sts *)msg->data; tlen = min(NG_HOOKSIZ - 1, ntohs(tag->tag_len)); - strncpy(sts->hook, tag->tag_data, tlen); + strncpy(sts->hook, (const char *)(tag + 1), tlen); sts->hook[tlen] = '\0'; NG_SEND_MSG_ID(error, NG_HOOK_NODE(sp->hook), msg, sp->creator, 0); @@ -1438,7 +1438,8 @@ ng_pppoe_rcvdata_ether(hook_p hook, item break; } if (neg->ac_name_len != htons(tag->tag_len) || - strncmp(neg->ac_name.data, tag->tag_data, + strncmp(neg->ac_name.data, + (const char *)(tag + 1), neg->ac_name_len) != 0) { break; } @@ -1767,10 +1768,10 @@ ng_pppoe_disconnect(hook_p hook) * Add a General error message and adjust * sizes. */ - tag = wh->ph.tag; + tag = (void *)(&wh->ph + 1); tag->tag_type = PTT_GEN_ERR; tag->tag_len = htons((u_int16_t)msglen); - strncpy(tag->tag_data, SIGNOFF, msglen); + strncpy((char *)(tag + 1), SIGNOFF, msglen); m->m_pkthdr.len = (m->m_len += sizeof(*tag) + msglen); wh->ph.length = htons(sizeof(*tag) + msglen); @@ -1859,7 +1860,7 @@ scan_tags(sessp sp, const struct pppoe_h { const char *const end = (const char *)next_tag(ph); const char *ptn; - const struct pppoe_tag *pt = &ph->tag[0]; + const struct pppoe_tag *pt = (const void *)(ph + 1); /* * Keep processing tags while a tag header will still fit. Modified: head/sys/netgraph/ng_pppoe.h ============================================================================== --- head/sys/netgraph/ng_pppoe.h Tue Mar 3 18:23:16 2009 (r189314) +++ head/sys/netgraph/ng_pppoe.h Tue Mar 3 18:47:33 2009 (r189315) @@ -201,7 +201,6 @@ struct ngpppoe_sts { struct pppoe_tag { u_int16_t tag_type; u_int16_t tag_len; - char tag_data[]; }__packed; struct pppoe_hdr{ @@ -210,7 +209,6 @@ struct pppoe_hdr{ u_int8_t code; u_int16_t sid; u_int16_t length; - struct pppoe_tag tag[]; }__packed; From imp at FreeBSD.org Tue Mar 3 10:53:49 2009 From: imp at FreeBSD.org (Warner Losh) Date: Tue Mar 3 10:53:55 2009 Subject: svn commit: r189316 - head/sys/conf Message-ID: <200903031853.n23IrmuS018618@svn.freebsd.org> Author: imp Date: Tue Mar 3 18:53:47 2009 New Revision: 189316 URL: http://svn.freebsd.org/changeset/base/189316 Log: Bump down the inline limit on MIPS. Modified: head/sys/conf/kern.mk Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Tue Mar 3 18:47:33 2009 (r189315) +++ head/sys/conf/kern.mk Tue Mar 3 18:53:47 2009 (r189316) @@ -91,7 +91,7 @@ INLINE_LIMIT?= 15000 # .if ${MACHINE_ARCH} == "mips" CFLAGS+= -msoft-float -mno-dsp -INLINE_LIMIT?= 15000 +INLINE_LIMIT?= 8000 .endif # From imp at FreeBSD.org Tue Mar 3 10:54:58 2009 From: imp at FreeBSD.org (Warner Losh) Date: Tue Mar 3 10:55:04 2009 Subject: svn commit: r189317 - head/sys/pci Message-ID: <200903031854.n23Isvlh018676@svn.freebsd.org> Author: imp Date: Tue Mar 3 18:54:57 2009 New Revision: 189317 URL: http://svn.freebsd.org/changeset/base/189317 Log: The callback takes a void *, not a caddr_t * (sic). Except for the bb callback, which takes a caddr_t and not a caddr_t *. Modified: head/sys/pci/viapm.c Modified: head/sys/pci/viapm.c ============================================================================== --- head/sys/pci/viapm.c Tue Mar 3 18:53:47 2009 (r189316) +++ head/sys/pci/viapm.c Tue Mar 3 18:54:57 2009 (r189317) @@ -484,7 +484,7 @@ viapm_pro_detach(device_t dev) } static int -viabb_callback(device_t dev, int index, caddr_t *data) +viabb_callback(device_t dev, int index, caddr_t data) { return 0; } @@ -641,7 +641,7 @@ viapm_wait(struct viapm_softc *viapm) } static int -viasmb_callback(device_t dev, int index, caddr_t *data) +viasmb_callback(device_t dev, int index, void *data) { int error = 0; From imp at FreeBSD.org Tue Mar 3 10:58:00 2009 From: imp at FreeBSD.org (Warner Losh) Date: Tue Mar 3 10:58:06 2009 Subject: svn commit: r189318 - head/sys/dev/pccard Message-ID: <200903031857.n23IvxYj018854@svn.freebsd.org> Author: imp Date: Tue Mar 3 18:57:59 2009 New Revision: 189318 URL: http://svn.freebsd.org/changeset/base/189318 Log: Add in parsing of the disk FUNCE tuples. Modified: head/sys/dev/pccard/pccard.c head/sys/dev/pccard/pccardvar.h head/sys/dev/pccard/pccardvarp.h Modified: head/sys/dev/pccard/pccard.c ============================================================================== --- head/sys/dev/pccard/pccard.c Tue Mar 3 18:54:57 2009 (r189317) +++ head/sys/dev/pccard/pccard.c Tue Mar 3 18:57:59 2009 (r189318) @@ -1066,6 +1066,10 @@ pccard_read_ivar(device_t bus, device_t switch (which) { default: return (EINVAL); + case PCCARD_IVAR_FUNCE_DISK: + *(uint16_t *)result = pf->pf_funce_disk_interface | + (pf->pf_funce_disk_power << 8); + break; case PCCARD_IVAR_ETHADDR: bcopy(pf->pf_funce_lan_nid, result, ETHER_ADDR_LEN); break; Modified: head/sys/dev/pccard/pccardvar.h ============================================================================== --- head/sys/dev/pccard/pccardvar.h Tue Mar 3 18:54:57 2009 (r189317) +++ head/sys/dev/pccard/pccardvar.h Tue Mar 3 18:57:59 2009 (r189318) @@ -194,7 +194,8 @@ enum { PCCARD_IVAR_PRODUCT_STR,/* CIS strnig for "Product" */ PCCARD_IVAR_CIS3_STR, PCCARD_IVAR_CIS4_STR, - PCCARD_IVAR_FUNCTION + PCCARD_IVAR_FUNCTION, + PCCARD_IVAR_FUNCE_DISK }; #define PCCARD_ACCESSOR(A, B, T) \ @@ -211,6 +212,7 @@ PCCARD_ACCESSOR(product, PRODUCT, uint3 PCCARD_ACCESSOR(prodext, PRODEXT, uint16_t) PCCARD_ACCESSOR(function_number,FUNCTION_NUMBER, uint32_t) PCCARD_ACCESSOR(function, FUNCTION, uint32_t) +PCCARD_ACCESSOR(funce_disk, FUNCE_DISK, uint16_t) PCCARD_ACCESSOR(vendor_str, VENDOR_STR, const char *) PCCARD_ACCESSOR(product_str, PRODUCT_STR, const char *) PCCARD_ACCESSOR(cis3_str, CIS3_STR, const char *) @@ -250,3 +252,23 @@ enum { { NULL, PCMCIA_VENDOR_ ## v1, PCCARD_P(v1, p1), \ PCMCIA_CIS_ ## p2} #endif + +/* + * Defines to decoe the get_funce_disk return value. See the PCMCIA standard + * for all the details of what these bits mean. + */ +#define PFD_I_V_MASK 0x3 +#define PFD_I_V_NONE_REQUIRED 0x0 +#define PFD_I_V_REQ_MOD_ACC 0x1 +#define PFD_I_V_REQ_ACC 0x2 +#define PFD_I_V_REQ_ALWYS 0x1 +#define PFD_I_S 0x4 /* 0 rotating, 1 silicon */ +#define PFD_I_U 0x8 /* SN Uniq? */ +#define PFD_I_D 0x10 /* 0 - 1 drive, 1 - 2 drives */ +#define PFD_P_P0 0x100 +#define PFD_P_P1 0x200 +#define PFD_P_P2 0x400 +#define PFD_P_P3 0x800 +#define PFD_P_N 0x1000 /* 3f7/377 excluded? */ +#define PFD_P_E 0x2000 /* Index bit supported? */ +#define PFD_P_I 0x4000 /* twincard */ Modified: head/sys/dev/pccard/pccardvarp.h ============================================================================== --- head/sys/dev/pccard/pccardvarp.h Tue Mar 3 18:54:57 2009 (r189317) +++ head/sys/dev/pccard/pccardvarp.h Tue Mar 3 18:57:59 2009 (r189318) @@ -76,22 +76,7 @@ struct pccard_config_entry { struct pccard_funce_disk { uint8_t pfd_interface; -#define PFD_I_V_MASK 0x3 -#define PFD_I_V_NONE_REQUIRED 0x0 -#define PFD_I_V_REQ_MOD_ACC 0x1 -#define PFD_I_V_REQ_ACC 0x2 -#define PFD_I_V_REQ_ALWYS 0x1 -#define PFD_I_S 0x4 /* 0 rotating, 1 silicon */ -#define PFD_I_U 0x8 /* SN Uniq? */ -#define PFD_I_D 0x10 /* 0 - 1 drive, 1 - 2 drives */ uint8_t pfd_power; -#define PFD_P_P0 0x1 -#define PFD_P_P1 0x2 -#define PFD_P_P2 0x4 -#define PFD_P_P3 0x8 -#define PFD_P_N 0x10 /* 3f7/377 excluded? */ -#define PFD_P_E 0x20 /* Index bit supported? */ -#define PFD_P_I 0x40 /* twincard */ }; struct pccard_funce_lan { From imp at FreeBSD.org Tue Mar 3 11:22:26 2009 From: imp at FreeBSD.org (Warner Losh) Date: Tue Mar 3 11:22:37 2009 Subject: svn commit: r189319 - head/sys/mips/mips Message-ID: <200903031922.n23JMO1P019362@svn.freebsd.org> Author: imp Date: Tue Mar 3 19:22:24 2009 New Revision: 189319 URL: http://svn.freebsd.org/changeset/base/189319 Log: make loop clearer that it isn't a mistake... Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Tue Mar 3 18:57:59 2009 (r189318) +++ head/sys/mips/mips/pmap.c Tue Mar 3 19:22:24 2009 (r189319) @@ -409,7 +409,8 @@ again: kernel_segmap[j] = (pd_entry_t)(pgtab + (i * NPTEPG)); avail_start = phys_avail[0]; - for (i = 0; phys_avail[i + 2]; i += 2); + for (i = 0; phys_avail[i + 2]; i += 2) + continue; avail_end = phys_avail[i + 1]; /* From bz at FreeBSD.org Tue Mar 3 11:38:57 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Tue Mar 3 11:39:09 2009 Subject: svn commit: r189320 - head/sys/sys Message-ID: <200903031938.n23Jcur7019694@svn.freebsd.org> Author: bz Date: Tue Mar 3 19:38:56 2009 New Revision: 189320 URL: http://svn.freebsd.org/changeset/base/189320 Log: For the moment disable the VIMAGE_CTASSERTs as people have trouble while developing and compiling with kernel options that change the size of at least one structure. The current kernel build framework does not allow us to pass -Dxxx to module builds so we would possibly need a kernel option to disable the checks and that might not work for people just building modules alone. For now they helped to identify possibly API problems and bring those back into minds of developers seeking for better solutions. Problems reported by: kib, warner Reviewed by: warner Modified: head/sys/sys/vimage.h Modified: head/sys/sys/vimage.h ============================================================================== --- head/sys/sys/vimage.h Tue Mar 3 19:22:24 2009 (r189319) +++ head/sys/sys/vimage.h Tue Mar 3 19:38:56 2009 (r189320) @@ -224,6 +224,7 @@ void vnet_mod_register(const struct vnet * But as CTASSERT_EQUAL() needs special compile time options, we * want the default case to be backed by CTASSERT(). */ +#if 0 #ifndef VIMAGE_CTASSERT #ifdef VIMAGE_CHECK_SIZES #define VIMAGE_CTASSERT(x, y) \ @@ -234,5 +235,8 @@ void vnet_mod_register(const struct vnet CTASSERT(x == 0 || x == y) #endif #endif +#else +#define VIMAGE_CTASSERT(x, y) struct __hack +#endif #endif /* !_SYS_VIMAGE_H_ */ From kabaev at gmail.com Tue Mar 3 11:49:14 2009 From: kabaev at gmail.com (Alexander Kabaev) Date: Tue Mar 3 11:49:20 2009 Subject: svn commit: r189315 - in head/sys/netgraph: . atm In-Reply-To: <200903031847.n23IlX7N018454@svn.freebsd.org> References: <200903031847.n23IlX7N018454@svn.freebsd.org> Message-ID: <20090303142106.0ee73d35@kan.dnsalias.net> On Tue, 3 Mar 2009 18:47:33 +0000 (UTC) Ed Schouten wrote: > Author: ed > Date: Tue Mar 3 18:47:33 2009 > New Revision: 189315 > URL: http://svn.freebsd.org/changeset/base/189315 > > Log: > Make Netgraph compile with Clang. > > Clang disallows structs with variable length arrays to be nested > inside other structs, because this is in violation with ISO C99. Even > though we can keep bugging the LLVM folks about this issue, we'd > better just fix our code to not do this. This code seems to be the > only code in the entire source tree that does this. > > I haven't tested this patch by using the kernel modules in > question, but Diane Bruce and I have compared disassembled versions > of these kernel modules. We would have expected them to be exactly > the same, but due to randomness in the register allocator and > reordering of instructions, there were some minor differences. > > Approved by: julian > > Modified: > head/sys/netgraph/atm/ng_ccatm.h > head/sys/netgraph/ng_pppoe.c > head/sys/netgraph/ng_pppoe.h Hi, I hope I am not the only one to see this as a code regression from the code readability viewpoint. I think obfuscation of our sources just to bow to yet another head-strong compiler should stop. If LLVM cannot parse common code constructs, LLVM is NOT suitable for our kernel no matter how many paragraphs of language-lawyer-speak they use to justify it. -- Alexander Kabaev -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090303/178d06ee/signature.pgp From kabaev at gmail.com Tue Mar 3 11:58:24 2009 From: kabaev at gmail.com (Alexander Kabaev) Date: Tue Mar 3 11:58:30 2009 Subject: svn commit: r189315 - in head/sys/netgraph: . atm In-Reply-To: <20090303142106.0ee73d35@kan.dnsalias.net> References: <200903031847.n23IlX7N018454@svn.freebsd.org> <20090303142106.0ee73d35@kan.dnsalias.net> Message-ID: <20090303145758.47cb8740@kan.dnsalias.net> On Tue, 3 Mar 2009 14:21:06 -0500 Alexander Kabaev wrote: Responding to myself: after looking at the original code, I think we traded one pre-existing ugliness for another, with latter being more standards compliant, so my objection is withdrawn. Apologies for the noise. -- Alexander Kabaev -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090303/15eeb874/signature.pgp From lulf at FreeBSD.org Tue Mar 3 12:26:43 2009 From: lulf at FreeBSD.org (Ulf Lilleengen) Date: Tue Mar 3 12:27:13 2009 Subject: svn commit: r189321 - svnadmin/conf Message-ID: <200903032026.n23KQgCm020700@svn.freebsd.org> Author: lulf Date: Tue Mar 3 20:26:41 2009 New Revision: 189321 URL: http://svn.freebsd.org/changeset/base/189321 Log: - Raise limit for MFH Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Tue Mar 3 19:38:56 2009 (r189320) +++ svnadmin/conf/sizelimit.conf Tue Mar 3 20:26:41 2009 (r189321) @@ -19,6 +19,7 @@ #kan des lstewart +lulf obrien thompsa sam From ed at 80386.nl Tue Mar 3 12:30:24 2009 From: ed at 80386.nl (Ed Schouten) Date: Tue Mar 3 12:30:35 2009 Subject: svn commit: r189315 - in head/sys/netgraph: . atm In-Reply-To: <200903031847.n23IlX7N018454@svn.freebsd.org> References: <200903031847.n23IlX7N018454@svn.freebsd.org> Message-ID: <20090303203022.GX19161@hoeg.nl> Hi all, You should now be able to compile all of LINT on amd64 using Clang! Happy hacking! -- Ed Schouten WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090303/781c6d61/attachment.pgp From lulf at FreeBSD.org Tue Mar 3 12:30:38 2009 From: lulf at FreeBSD.org (Ulf Lilleengen) Date: Tue Mar 3 12:30:45 2009 Subject: svn commit: r189323 - svnadmin/conf Message-ID: <200903032030.n23KUaiZ020857@svn.freebsd.org> Author: lulf Date: Tue Mar 3 20:30:35 2009 New Revision: 189323 URL: http://svn.freebsd.org/changeset/base/189323 Log: - Re-add limit. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Tue Mar 3 20:27:50 2009 (r189322) +++ svnadmin/conf/sizelimit.conf Tue Mar 3 20:30:35 2009 (r189323) @@ -19,7 +19,7 @@ #kan des lstewart -lulf +#lulf obrien thompsa sam From davidch at FreeBSD.org Tue Mar 3 16:05:41 2009 From: davidch at FreeBSD.org (David Christensen) Date: Tue Mar 3 16:05:54 2009 Subject: svn commit: r189325 - head/sys/dev/bce Message-ID: <200903040005.n2405eLx024962@svn.freebsd.org> Author: davidch Date: Wed Mar 4 00:05:40 2009 New Revision: 189325 URL: http://svn.freebsd.org/changeset/base/189325 Log: - Updated firmware to latest 4.6.X release. - Added missing firmware for 5709 A1 controllers. - Changed some debug statistic variable names to be more consistent. Submitted by: davidch MFC after: Two weeks Modified: head/sys/dev/bce/if_bce.c head/sys/dev/bce/if_bcefw.h head/sys/dev/bce/if_bcereg.h Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Tue Mar 3 21:45:47 2009 (r189324) +++ head/sys/dev/bce/if_bce.c Wed Mar 4 00:05:40 2009 (r189325) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); * BCM5708C B1, B2 * BCM5708S B1, B2 * BCM5709C A1, C0 - * BCM5716 C0 + * BCM5716C C0 * * The following controllers are not supported by this driver: * BCM5706C A0, A1 (pre-production) @@ -71,19 +71,19 @@ __FBSDID("$FreeBSD$"); /* 1073741824 = 1 in 2 */ /* Controls how often the l2_fhdr frame error check will fail. */ - int bce_debug_l2fhdr_status_check = 0; + int l2fhdr_error_sim_control = 0; /* Controls how often the unexpected attention check will fail. */ - int bce_debug_unexpected_attention = 0; + int unexpected_attention_sim_control = 0; /* Controls how often to simulate an mbuf allocation failure. */ - int bce_debug_mbuf_allocation_failure = 0; + int mbuf_alloc_failed_sim_control = 0; /* Controls how often to simulate a DMA mapping failure. */ - int bce_debug_dma_map_addr_failure = 0; + int dma_map_addr_failed_sim_control = 0; /* Controls how often to simulate a bootcode failure. */ - int bce_debug_bootcode_running_failure = 0; + int bootcode_running_failure_sim_control = 0; #endif /****************************************************************************/ @@ -495,7 +495,8 @@ SYSCTL_UINT(_hw_bce, OID_AUTO, msi_enabl /* ToDo: Add tunable to enable/disable strict MTU handling. */ /* Currently allows "loose" RX MTU checking (i.e. sets the */ /* H/W RX MTU to the size of the largest receive buffer, or */ -/* 2048 bytes). */ +/* 2048 bytes). This will cause a UNH failure but is more */ +/* desireable from a functional perspective. */ /****************************************************************************/ @@ -595,7 +596,7 @@ bce_print_adapter_info(struct bce_softc } /* Firmware version and device features. */ - printf("F/W (0x%08X); Flags( ", sc->bce_fw_ver); + printf("B/C (0x%08X); Flags( ", sc->bce_bc_ver); #ifdef ZERO_COPY_SOCKETS printf("SPLT "); #endif @@ -846,7 +847,7 @@ bce_attach(device_t dev) __FUNCTION__, sc->bce_shmem_base); /* Fetch the bootcode revision. */ - sc->bce_fw_ver = REG_RD_IND(sc, sc->bce_shmem_base + + sc->bce_bc_ver = REG_RD_IND(sc, sc->bce_shmem_base + BCE_DEV_INFO_BC_REV); /* Check if any management firmware is running. */ @@ -2863,20 +2864,16 @@ bce_dma_map_addr(void *arg, bus_dma_segm bus_addr_t *busaddr = arg; /* Simulate a mapping failure. */ - DBRUNIF(DB_RANDOMTRUE(bce_debug_dma_map_addr_failure), - printf("bce: %s(%d): Simulating DMA mapping error.\n", - __FILE__, __LINE__); + DBRUNIF(DB_RANDOMTRUE(dma_map_addr_failed_sim_control), error = ENOMEM); /* Check for an error and signal the caller that an error occurred. */ if (error) { - printf("bce %s(%d): DMA mapping error! error = %d, " - "nseg = %d\n", __FILE__, __LINE__, error, nseg); *busaddr = 0; - return; + } else { + *busaddr = segs->ds_addr; } - *busaddr = segs->ds_addr; return; } @@ -3272,6 +3269,11 @@ bce_dma_alloc(device_t dev) #else max_size = max_seg_size = MJUM9BYTES; #endif + max_segments = 1; + + DBPRINT(sc, BCE_INFO, "%s(): Creating rx_mbuf_tag (max size = 0x%jX " + "max segments = %d, max segment size = 0x%jX)\n", __FUNCTION__, + (uintmax_t) max_size, max_segments, (uintmax_t) max_seg_size); if (bus_dma_tag_create(sc->parent_tag, 1, @@ -3280,7 +3282,7 @@ bce_dma_alloc(device_t dev) BUS_SPACE_MAXADDR, NULL, NULL, max_size, - 1, + max_segments, max_seg_size, 0, NULL, NULL, @@ -4156,15 +4158,24 @@ bce_init_cpus(struct bce_softc *sc) if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) || (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716)) { - bce_load_rv2p_fw(sc, bce_xi_rv2p_proc1, sizeof(bce_xi_rv2p_proc1), - RV2P_PROC1); - bce_load_rv2p_fw(sc, bce_xi_rv2p_proc2, sizeof(bce_xi_rv2p_proc2), - RV2P_PROC2); + + if ((BCE_CHIP_REV(sc) == BCE_CHIP_REV_Ax)) { + bce_load_rv2p_fw(sc, bce_xi90_rv2p_proc1, + sizeof(bce_xi90_rv2p_proc1), RV2P_PROC1); + bce_load_rv2p_fw(sc, bce_xi90_rv2p_proc2, + sizeof(bce_xi90_rv2p_proc2), RV2P_PROC2); + } else { + bce_load_rv2p_fw(sc, bce_xi_rv2p_proc1, + sizeof(bce_xi_rv2p_proc1), RV2P_PROC1); + bce_load_rv2p_fw(sc, bce_xi_rv2p_proc2, + sizeof(bce_xi_rv2p_proc2), RV2P_PROC2); + } + } else { - bce_load_rv2p_fw(sc, bce_rv2p_proc1, sizeof(bce_rv2p_proc1), - RV2P_PROC1); - bce_load_rv2p_fw(sc, bce_rv2p_proc2, sizeof(bce_rv2p_proc2), - RV2P_PROC2); + bce_load_rv2p_fw(sc, bce_rv2p_proc1, + sizeof(bce_rv2p_proc1), RV2P_PROC1); + bce_load_rv2p_fw(sc, bce_rv2p_proc2, + sizeof(bce_rv2p_proc2), RV2P_PROC2); } bce_init_rxp_cpu(sc); @@ -4727,7 +4738,7 @@ bce_blockinit(struct bce_softc *sc) /* Verify that bootcode is running. */ reg = REG_RD_IND(sc, sc->bce_shmem_base + BCE_DEV_INFO_SIGNATURE); - DBRUNIF(DB_RANDOMTRUE(bce_debug_bootcode_running_failure), + DBRUNIF(DB_RANDOMTRUE(bootcode_running_failure_sim_control), BCE_PRINTF("%s(%d): Simulating bootcode failure.\n", __FILE__, __LINE__); reg = 0); @@ -4814,9 +4825,9 @@ bce_get_rx_buf(struct bce_softc *sc, str if (m == NULL) { /* Simulate an mbuf allocation failure. */ - DBRUNIF(DB_RANDOMTRUE(bce_debug_mbuf_allocation_failure), - sc->mbuf_alloc_failed++; - sc->debug_mbuf_sim_alloc_failed++; + DBRUNIF(DB_RANDOMTRUE(mbuf_alloc_failed_sim_control), + sc->mbuf_alloc_failed_count++; + sc->mbuf_alloc_failed_sim_count++; rc = ENOBUFS; goto bce_get_rx_buf_exit); @@ -4831,7 +4842,7 @@ bce_get_rx_buf(struct bce_softc *sc, str #endif if (m_new == NULL) { - sc->mbuf_alloc_failed++; + sc->mbuf_alloc_failed_count++; rc = ENOBUFS; goto bce_get_rx_buf_exit; } @@ -4861,7 +4872,9 @@ bce_get_rx_buf(struct bce_softc *sc, str BCE_PRINTF("%s(%d): Error mapping mbuf into RX chain (%d)!\n", __FILE__, __LINE__, error); + sc->dma_map_addr_rx_failed_count++; m_freem(m_new); + DBRUN(sc->debug_rx_mbuf_alloc--); rc = ENOBUFS; @@ -4939,16 +4952,16 @@ bce_get_pg_buf(struct bce_softc *sc, str if (m == NULL) { /* Simulate an mbuf allocation failure. */ - DBRUNIF(DB_RANDOMTRUE(bce_debug_mbuf_allocation_failure), - sc->mbuf_alloc_failed++; - sc->debug_mbuf_sim_alloc_failed++; + DBRUNIF(DB_RANDOMTRUE(mbuf_alloc_failed_sim_control), + sc->mbuf_alloc_failed_count++; + sc->mbuf_alloc_failed_sim_count++; rc = ENOBUFS; goto bce_get_pg_buf_exit); /* This is a new mbuf allocation. */ m_new = m_getcl(M_DONTWAIT, MT_DATA, 0); if (m_new == NULL) { - sc->mbuf_alloc_failed++; + sc->mbuf_alloc_failed_count++; rc = ENOBUFS; goto bce_get_pg_buf_exit; } @@ -5766,20 +5779,20 @@ bce_rx_intr(struct bce_softc *sc) sc->free_rx_bd++; /* - * Frames received on the NetXteme II are prepended - * with an l2_fhdr structure which provides status - * information about the received frame (including - * VLAN tags and checksum info). The frames are also - * automatically adjusted to align the IP header - * (i.e. two null bytes are inserted before the - * Ethernet header). As a result the data DMA'd by - * the controller into the mbuf is as follows: + * Frames received on the NetXteme II are prepended with an + * l2_fhdr structure which provides status information about + * the received frame (including VLAN tags and checksum info). + * The frames are also automatically adjusted to align the IP + * header (i.e. two null bytes are inserted before the Ethernet + * header). As a result the data DMA'd by the controller into + * the mbuf is as follows: + * * +---------+-----+---------------------+-----+ * | l2_fhdr | pad | packet data | FCS | * +---------+-----+---------------------+-----+ - * The l2_fhdr needs to be checked and skipped and - * the FCS needs to be stripped before sending the - * packet up the stack. + * + * The l2_fhdr needs to be checked and skipped and the FCS needs + * to be stripped before sending the packet up the stack. */ l2fhdr = mtod(m0, struct l2_fhdr *); @@ -5894,8 +5907,9 @@ bce_rx_intr(struct bce_softc *sc) BCE_PRINTF("Invalid Ethernet frame size!\n"); m_print(m0, 128)); - DBRUNIF(DB_RANDOMTRUE(bce_debug_l2fhdr_status_check), + DBRUNIF(DB_RANDOMTRUE(l2fhdr_error_sim_control), BCE_PRINTF("Simulating l2_fhdr status error.\n"); + sc->l2fhdr_error_sim_count++; status = status | L2_FHDR_ERRORS_PHY_DECODE); /* Check the received frame for errors. */ @@ -5905,7 +5919,7 @@ bce_rx_intr(struct bce_softc *sc) /* Log the error and release the mbuf. */ ifp->if_ierrors++; - DBRUN(sc->l2fhdr_status_errors++); + sc->l2fhdr_error_count++; m_freem(m0); m0 = NULL; @@ -5946,10 +5960,7 @@ bce_rx_intr(struct bce_softc *sc) } } - /* - * If we received a packet with a vlan tag, - * attach that information to the packet. - */ + /* Attach the VLAN tag. */ if (status & L2_FHDR_STATUS_L2_VLAN_TAG) { #if __FreeBSD_version < 700000 VLAN_INPUT_TAG(ifp, m0, l2fhdr->l2_fhdr_vlan_tag, continue); @@ -5959,7 +5970,7 @@ bce_rx_intr(struct bce_softc *sc) #endif } - /* Pass the mbuf off to the upper layers. */ + /* Increment received packet statistics. */ ifp->if_ipackets++; bce_rx_int_next_rx: @@ -6273,14 +6284,17 @@ bce_init_locked(struct bce_softc *sc) DBPRINT(sc, BCE_INFO_LOAD, "%s(): rx_bd_mbuf_alloc_size = %d, rx_bce_mbuf_data_len = %d, " - "rx_bd_mbuf_align_pad = %d, pg_bd_mbuf_alloc_size = %d\n", - __FUNCTION__, sc->rx_bd_mbuf_alloc_size, sc->rx_bd_mbuf_data_len, - sc->rx_bd_mbuf_align_pad, sc->pg_bd_mbuf_alloc_size); + "rx_bd_mbuf_align_pad = %d\n", __FUNCTION__, + sc->rx_bd_mbuf_alloc_size, sc->rx_bd_mbuf_data_len, + sc->rx_bd_mbuf_align_pad); /* Program appropriate promiscuous/multicast filtering. */ bce_set_rx_mode(sc); #ifdef ZERO_COPY_SOCKETS + DBPRINT(sc, BCE_INFO_LOAD, "%s(): pg_bd_mbuf_alloc_size = %d\n", + __FUNCTION__, sc->pg_bd_mbuf_alloc_size); + /* Init page buffer descriptor chain. */ bce_init_pg_chain(sc); #endif @@ -6489,10 +6503,7 @@ bce_tx_encap_skip_tso: /* Check if the DMA mapping was successful */ if (error == EFBIG) { - /* The mbuf is too fragmented for our DMA mapping. */ - DBPRINT(sc, BCE_WARN, "%s(): fragmented mbuf (%d pieces)\n", - __FUNCTION__, nsegs); - DBRUN(bce_dump_mbuf(sc, m0);); + sc->fragmented_mbuf_count++; /* Try to defrag the mbuf. */ m0 = m_defrag(*m_head, M_DONTWAIT); @@ -6500,7 +6511,7 @@ bce_tx_encap_skip_tso: /* Defrag was unsuccessful */ m_freem(*m_head); *m_head = NULL; - sc->mbuf_alloc_failed++; + sc->mbuf_alloc_failed_count++; rc = ENOBUFS; goto bce_tx_encap_exit; } @@ -6513,7 +6524,7 @@ bce_tx_encap_skip_tso: /* Still getting an error after a defrag. */ if (error == ENOMEM) { /* Insufficient DMA buffers available. */ - sc->tx_dma_map_failures++; + sc->dma_map_addr_tx_failed_count++; rc = error; goto bce_tx_encap_exit; } else if (error != 0) { @@ -6523,19 +6534,19 @@ bce_tx_encap_skip_tso: __FILE__, __LINE__); m_freem(m0); *m_head = NULL; - sc->tx_dma_map_failures++; + sc->dma_map_addr_tx_failed_count++; rc = ENOBUFS; goto bce_tx_encap_exit; } } else if (error == ENOMEM) { /* Insufficient DMA buffers available. */ - sc->tx_dma_map_failures++; + sc->dma_map_addr_tx_failed_count++; rc = error; goto bce_tx_encap_exit; } else if (error != 0) { m_freem(m0); *m_head = NULL; - sc->tx_dma_map_failures++; + sc->dma_map_addr_tx_failed_count++; rc = error; goto bce_tx_encap_exit; } @@ -7040,9 +7051,10 @@ bce_intr(void *xsc) status_attn_bits = sc->status_block->status_attn_bits; - DBRUNIF(DB_RANDOMTRUE(bce_debug_unexpected_attention), - BCE_PRINTF("Simulating unexpected status attention bit set."); - status_attn_bits = status_attn_bits | STATUS_ATTN_BITS_PARITY_ERROR); + DBRUNIF(DB_RANDOMTRUE(unexpected_attention_sim_control), + BCE_PRINTF("Simulating unexpected status attention bit set."); + sc->unexpected_attention_sim_count++; + status_attn_bits = status_attn_bits | STATUS_ATTN_BITS_PARITY_ERROR); /* Was it a link change interrupt? */ if ((status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) != @@ -7060,13 +7072,13 @@ bce_intr(void *xsc) (sc->status_block->status_attn_bits_ack & ~STATUS_ATTN_BITS_LINK_STATE))) { - DBRUN(sc->unexpected_attentions++); + sc->unexpected_attention_count++; BCE_PRINTF("%s(%d): Fatal attention detected: 0x%08X\n", __FILE__, __LINE__, sc->status_block->status_attn_bits); DBRUNMSG(BCE_FATAL, - if (bce_debug_unexpected_attention == 0) + if (unexpected_attention_sim_control == 0) bce_breakpoint(sc)); bce_init_locked(sc); @@ -7315,8 +7327,8 @@ bce_stats_update(struct bce_softc *sc) sc->stat_EtherStatsUndersizePkts = stats->stat_EtherStatsUndersizePkts; - sc->stat_EtherStatsOverrsizePkts = - stats->stat_EtherStatsOverrsizePkts; + sc->stat_EtherStatsOversizePkts = + stats->stat_EtherStatsOversizePkts; sc->stat_EtherStatsPktsRx64Octets = stats->stat_EtherStatsPktsRx64Octets; @@ -7420,7 +7432,7 @@ bce_stats_update(struct bce_softc *sc) /* ToDo: This method loses soft errors. */ ifp->if_ierrors = (u_long) sc->stat_EtherStatsUndersizePkts + - (u_long) sc->stat_EtherStatsOverrsizePkts + + (u_long) sc->stat_EtherStatsOversizePkts + (u_long) sc->stat_IfInMBUFDiscards + (u_long) sc->stat_Dot3StatsAlignmentErrors + (u_long) sc->stat_Dot3StatsFCSErrors + @@ -7871,6 +7883,91 @@ bce_add_sysctls(struct bce_softc *sc) #ifdef BCE_DEBUG SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "l2fhdr_error_sim_control", + CTLFLAG_RW, &l2fhdr_error_sim_control, + 0, "Debug control to force l2fhdr errors"); + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "l2fhdr_error_sim_count", + CTLFLAG_RD, &sc->l2fhdr_error_sim_count, + 0, "Number of simulated l2_fhdr errors"); +#endif + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "l2fhdr_error_count", + CTLFLAG_RD, &sc->l2fhdr_error_count, + 0, "Number of l2_fhdr errors"); + +#ifdef BCE_DEBUG + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "mbuf_alloc_failed_sim_control", + CTLFLAG_RW, &mbuf_alloc_failed_sim_control, + 0, "Debug control to force mbuf allocation failures"); + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "mbuf_alloc_failed_sim_count", + CTLFLAG_RD, &sc->mbuf_alloc_failed_sim_count, + 0, "Number of simulated mbuf cluster allocation failures"); +#endif + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "mbuf_alloc_failed_count", + CTLFLAG_RD, &sc->mbuf_alloc_failed_count, + 0, "Number of mbuf allocation failures"); + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "fragmented_mbuf_count", + CTLFLAG_RD, &sc->fragmented_mbuf_count, + 0, "Number of fragmented mbufs"); + +#ifdef BCE_DEBUG + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "dma_map_addr_failed_sim_control", + CTLFLAG_RW, &dma_map_addr_failed_sim_control, + 0, "Debug control to force DMA mapping failures"); + + /* ToDo: Figure out how to update this value in bce_dma_map_addr(). */ + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "dma_map_addr_failed_sim_count", + CTLFLAG_RD, &sc->dma_map_addr_failed_sim_count, + 0, "Number of simulated DMA mapping failures"); + +#endif + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "dma_map_addr_rx_failed_count", + CTLFLAG_RD, &sc->dma_map_addr_rx_failed_count, + 0, "Number of RX DMA mapping failures"); + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "dma_map_addr_tx_failed_count", + CTLFLAG_RD, &sc->dma_map_addr_tx_failed_count, + 0, "Number of TX DMA mapping failures"); + +#ifdef BCE_DEBUG + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "unexpected_attention_sim_control", + CTLFLAG_RW, &unexpected_attention_sim_control, + 0, "Debug control to simulate unexpected attentions"); + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "unexpected_attention_sim_count", + CTLFLAG_RW, &sc->unexpected_attention_sim_count, + 0, "Number of simulated unexpected attentions"); +#endif + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "unexpected_attention_count", + CTLFLAG_RW, &sc->unexpected_attention_count, + 0, "Number of unexpected attentions"); + +#ifdef BCE_DEBUG + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "debug_bootcode_running_failure", + CTLFLAG_RW, &bootcode_running_failure_sim_control, + 0, "Debug control to force bootcode running failures"); + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "rx_low_watermark", CTLFLAG_RD, &sc->rx_low_watermark, 0, "Lowest level of free rx_bd's"); @@ -7891,26 +7988,6 @@ bce_add_sysctls(struct bce_softc *sc) 0, "Number of times the TX chain was full"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "l2fhdr_status_errors", - CTLFLAG_RD, &sc->l2fhdr_status_errors, - 0, "l2_fhdr status errors"); - - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "unexpected_attentions", - CTLFLAG_RD, &sc->unexpected_attentions, - 0, "Unexpected attentions"); - - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "lost_status_block_updates", - CTLFLAG_RD, &sc->lost_status_block_updates, - 0, "Lost status block updates"); - - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "debug_mbuf_sim_alloc_failed", - CTLFLAG_RD, &sc->debug_mbuf_sim_alloc_failed, - 0, "Simulated mbuf cluster allocation failures"); - - SYSCTL_ADD_INT(ctx, children, OID_AUTO, "requested_tso_frames", CTLFLAG_RD, &sc->requested_tso_frames, 0, "Number of TSO frames received"); @@ -7936,16 +8013,6 @@ bce_add_sysctls(struct bce_softc *sc) "TX interrupt time"); #endif - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "mbuf_alloc_failed", - CTLFLAG_RD, &sc->mbuf_alloc_failed, - 0, "mbuf cluster allocation failures"); - - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "tx_dma_map_failures", - CTLFLAG_RD, &sc->tx_dma_map_failures, - 0, "tx dma mapping failures"); - SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "stat_IfHcInOctets", CTLFLAG_RD, &sc->stat_IfHCInOctets, @@ -8062,9 +8129,9 @@ bce_add_sysctls(struct bce_softc *sc) 0, "Undersize packets"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, - "stat_EtherStatsOverrsizePkts", - CTLFLAG_RD, &sc->stat_EtherStatsOverrsizePkts, - 0, "stat_EtherStatsOverrsizePkts"); + "stat_EtherStatsOversizePkts", + CTLFLAG_RD, &sc->stat_EtherStatsOversizePkts, + 0, "stat_EtherStatsOversizePkts"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "stat_EtherStatsPktsRx64Octets", @@ -9455,9 +9522,9 @@ bce_dump_stats_block(struct bce_softc *s BCE_PRINTF(" 0x%08X : EtherStatsUndersizePkts\n", sblk->stat_EtherStatsUndersizePkts); - if (sblk->stat_EtherStatsOverrsizePkts) + if (sblk->stat_EtherStatsOversizePkts) BCE_PRINTF(" 0x%08X : EtherStatsOverrsizePkts\n", - sblk->stat_EtherStatsOverrsizePkts); + sblk->stat_EtherStatsOversizePkts); if (sblk->stat_EtherStatsPktsRx64Octets) BCE_PRINTF(" 0x%08X : EtherStatsPktsRx64Octets\n", @@ -9724,13 +9791,9 @@ bce_dump_driver_state(struct bce_softc * sc->pg_low_watermark, sc->max_pg_bd); #endif - BCE_PRINTF(" 0x%08X - (sc->mbuf_alloc_failed) " + BCE_PRINTF(" 0x%08X - (sc->mbuf_alloc_failed_count) " "mbuf alloc failures\n", - sc->mbuf_alloc_failed); - - BCE_PRINTF(" 0x%08X - (sc->debug_mbuf_sim_alloc_failed) " - "simulated mbuf alloc failures\n", - sc->debug_mbuf_sim_alloc_failed); + sc->mbuf_alloc_failed_count); BCE_PRINTF(" 0x%08X - (sc->bce_flags) bce mac flags\n", sc->bce_flags); @@ -9762,7 +9825,7 @@ bce_dump_hw_state(struct bce_softc *sc) " Hardware State " "----------------------------\n"); - BCE_PRINTF("0x%08X - bootcode version\n", sc->bce_fw_ver); + BCE_PRINTF("0x%08X - bootcode version\n", sc->bce_bc_ver); val = REG_RD(sc, BCE_MISC_ENABLE_STATUS_BITS); BCE_PRINTF("0x%08X - (0x%06X) misc_enable_status_bits\n", @@ -9887,7 +9950,7 @@ bce_dump_bc_state(struct bce_softc *sc) " Bootcode State " "----------------------------\n"); - BCE_PRINTF("0x%08X - bootcode version\n", sc->bce_fw_ver); + BCE_PRINTF("0x%08X - bootcode version\n", sc->bce_bc_ver); val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_BC_RESET_TYPE); BCE_PRINTF("0x%08X - (0x%06X) reset_type\n", Modified: head/sys/dev/bce/if_bcefw.h ============================================================================== --- head/sys/dev/bce/if_bcefw.h Tue Mar 3 21:45:47 2009 (r189324) +++ head/sys/dev/bce/if_bcefw.h Wed Mar 4 00:05:40 2009 (r189325) @@ -38,124 +38,124 @@ * accompanying it. */ -/* Firmware release 4.4.17 for BCM5706 and BCM5708 (b06). */ -/* Firmware release 4.4.21 for BCM5709 and BCM5716 (b09). */ +/* Firmware release 4.6.17 for BCM5706 and BCM5708 (b06). */ +/* Firmware release 4.6.16 for BCM5709 and BCM5716 (b09). */ int bce_COM_b06FwReleaseMajor = 0x1; int bce_COM_b06FwReleaseMinor = 0x0; int bce_COM_b06FwReleaseFix = 0x0; u32 bce_COM_b06FwStartAddr = 0x080000f8; u32 bce_COM_b06FwTextAddr = 0x08000000; -int bce_COM_b06FwTextLen = 0x4e94; +int bce_COM_b06FwTextLen = 0x4df0; u32 bce_COM_b06FwDataAddr = 0x00000000; int bce_COM_b06FwDataLen = 0x0; -u32 bce_COM_b06FwRodataAddr = 0x08004e94; +u32 bce_COM_b06FwRodataAddr = 0x08004df0; int bce_COM_b06FwRodataLen = 0x14; -u32 bce_COM_b06FwBssAddr = 0x08004ef8; +u32 bce_COM_b06FwBssAddr = 0x08004e58; int bce_COM_b06FwBssLen = 0xbc; -u32 bce_COM_b06FwSbssAddr = 0x08004ec0; +u32 bce_COM_b06FwSbssAddr = 0x08004e20; int bce_COM_b06FwSbssLen = 0x38; u32 bce_COM_b06FwSDataAddr = 0x00000000; int bce_COM_b06FwSDataLen = 0x0; -u32 bce_COM_b06FwText[(0x4e94/4) + 1] = { -0xa00003e, -0x0, 0x0, 0xd, 0x636f6d34, -0x2e342e31, 0x37000000, 0x4041102, 0x0, -0x3, 0x14, 0x32, 0x3, +u32 bce_COM_b06FwText[(0x4df0/4) + 1] = { +0xa00003e, 0x0, 0x0, +0xd, 0x636f6d34, 0x2e362e31, 0x37000000, +0x4061102, 0x0, 0x3, 0x14, +0x32, 0x3, 0x0, 0x0, +0x0, 0x0, 0x0, 0x10, +0x136, 0xea60, 0x1, 0x0, +0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, -0x0, 0x10, 0x136, 0xea60, -0x1, 0x0, 0x0, 0x0, -0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, +0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, -0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, -0x0, 0x0, 0x0, 0x10, +0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, -0x0, 0x0, 0x10000003, 0x0, -0xd, 0xd, 0x3c020800, 0x24424ec0, -0x3c030800, 0x24634fb4, 0xac400000, 0x43202b, -0x1480fffd, 0x24420004, 0x3c1d0800, 0x37bd7ffc, -0x3a0f021, 0x3c100800, 0x261000f8, 0x3c1c0800, -0x279c4ec0, 0xe0002a8, 0x0, 0xd, -0x3c036010, 0x8c645000, 0x2402ff7f, 0x3c1a8000, -0x822024, 0x3484380c, 0x24020037, 0xac645000, -0xaf420008, 0x24020c80, 0xaf420024, 0x3c1b8008, -0x3c060800, 0x24c60794, 0x3c020800, 0x24424ef8, -0x2404001b, 0x2484ffff, 0xac460000, 0x481fffd, -0x24420004, 0x3c020800, 0x24420378, 0x3c010800, -0xac224f00, 0x3c020800, 0x24420678, 0x3c010800, -0xac224f04, 0x3c020800, 0x24420a08, 0x3c030800, -0x24630900, 0x3c040800, 0x2484093c, 0x3c050800, -0x24a53d98, 0x3c010800, 0xac224f48, 0x3c020800, -0x24420568, 0x3c010800, 0xac264f44, 0x3c010800, -0xac254f54, 0x3c010800, 0xac234f5c, 0x3c010800, -0xac224f60, 0x3c010800, 0xac244f64, 0x3c010800, -0xac234efc, 0x3c010800, 0xac204f08, 0x3c010800, -0xac204f0c, 0x3c010800, 0xac204f10, 0x3c010800, -0xac204f14, 0x3c010800, 0xac204f18, 0x3c010800, -0xac204f1c, 0x3c010800, 0xac204f20, 0x3c010800, -0xac244f24, 0x3c010800, 0xac204f28, 0x3c010800, -0xac204f2c, 0x3c010800, 0xac204f30, 0x3c010800, -0xac204f34, 0x3c010800, 0xac204f38, 0x3c010800, -0xac264f3c, 0x3c010800, 0xac264f40, 0x3c010800, -0xac204f4c, 0x3c010800, 0xac254f50, 0x3c010800, -0xac234f58, 0xa000751, 0x0, 0x3c030800, +0x10000003, 0x0, 0xd, 0xd, +0x3c020800, 0x24424e20, 0x3c030800, 0x24634f14, +0xac400000, 0x43202b, 0x1480fffd, 0x24420004, +0x3c1d0800, 0x37bd7ffc, 0x3a0f021, 0x3c100800, +0x261000f8, 0x3c1c0800, 0x279c4e20, 0xe0002bd, +0x0, 0xd, 0x3c036010, 0x8c645000, +0x2402ff7f, 0x3c1a8000, 0x822024, 0x3484380c, +0x24020037, 0xac645000, 0xaf420008, 0x24020c80, +0xaf420024, 0x3c1b8008, 0x3c060800, 0x24c607e8, +0x3c020800, 0x24424e58, 0x2404001b, 0x2484ffff, +0xac460000, 0x481fffd, 0x24420004, 0x3c020800, +0x24420380, 0x3c010800, 0xac224e60, 0x3c020800, +0x24420680, 0x3c010800, 0xac224e64, 0x3c020800, +0x24420dcc, 0x3c010800, 0xac224ea0, 0x3c020800, +0x24420a5c, 0x3c030800, 0x24630954, 0x3c040800, +0x24840990, 0x3c050800, 0x24a53c70, 0x3c010800, +0xac224ea8, 0x3c020800, 0x24420570, 0x3c010800, +0xac264ea4, 0x3c010800, 0xac254eb4, 0x3c010800, +0xac234ebc, 0x3c010800, 0xac224ec0, 0x3c010800, +0xac244ec4, 0x3c010800, 0xac234e5c, 0x3c010800, +0xac204e68, 0x3c010800, 0xac204e6c, 0x3c010800, +0xac204e70, 0x3c010800, 0xac204e74, 0x3c010800, +0xac204e78, 0x3c010800, 0xac204e7c, 0x3c010800, +0xac204e80, 0x3c010800, 0xac244e84, 0x3c010800, +0xac204e88, 0x3c010800, 0xac204e8c, 0x3c010800, +0xac204e90, 0x3c010800, 0xac204e94, 0x3c010800, +0xac204e98, 0x3c010800, 0xac264e9c, 0x3c010800, +0xac204eac, 0x3c010800, 0xac254eb0, 0x3c010800, +0xac234eb8, 0xa000707, 0x0, 0x3c030800, 0x8c630020, 0x8f820008, 0x10430003, 0x0, -0xa00055d, 0xaf830008, 0x3e00008, 0x0, +0xa00053f, 0xaf830008, 0x3e00008, 0x0, 0x27bdffe8, 0xafb00010, 0xafbf0014, 0x27500100, 0x92020009, 0x1040001a, 0x24030001, 0x3c020800, -0x8c420020, 0x10400016, 0x1821, 0xe00059b, -0x0, 0x96030008, 0x3c060800, 0x94c64f76, +0x8c420020, 0x10400016, 0x1821, 0xe000577, +0x0, 0x96030008, 0x3c060800, 0x94c64ed6, 0x8e040018, 0x8f820020, 0x9605000c, 0x31c00, 0x661825, 0xac440000, 0xac450004, 0x24040001, 0xac400008, 0xac40000c, 0xac400010, 0xac400014, -0xac400018, 0xe0005d3, 0xac43001c, 0x1821, +0xac400018, 0xe00059c, 0xac43001c, 0x1821, 0x8fbf0014, 0x8fb00010, 0x601021, 0x3e00008, 0x27bd0018, 0x27bdffe8, 0xafbf0010, 0x97420108, 0x30437000, 0x24022000, 0x1062000a, 0x28642001, 0x54800012, 0x8fbf0010, 0x24024000, 0x10620008, -0x24026000, 0x1062000a, 0x8fbf0010, 0xa0000f9, -0x1021, 0x8fbf0010, 0xa0000b9, 0x27bd0018, -0xe0004c3, 0x0, 0xa0000f8, 0x8fbf0010, -0xe000ff5, 0x0, 0x8fbf0010, 0x1021, +0x24026000, 0x1062000a, 0x8fbf0010, 0xa0000fb, +0x1021, 0x8fbf0010, 0xa0000bb, 0x27bd0018, +0xe000409, 0x0, 0xa0000fa, 0x8fbf0010, +0xe000fc9, 0x0, 0x8fbf0010, 0x1021, 0x3e00008, 0x27bd0018, 0x3c020800, 0x8c420020, -0x27bdffe8, 0x10400027, 0xafbf0010, 0xe00059b, +0x27bdffe8, 0x10400027, 0xafbf0010, 0xe000577, 0x0, 0x97420108, 0x9743010c, 0x8f850020, 0x3042003e, 0x3063ffff, 0x21400, 0x431025, -0xaca20000, 0x8f420100, 0x3c060800, 0x94c64f76, +0xaca20000, 0x8f420100, 0x3c060800, 0x94c64ed6, 0x8fbf0010, 0xaca20004, 0x97430116, 0x9744010e, 0x3c022000, 0x31c00, 0x3084ffff, 0x641825, 0xaca30008, 0xc23025, 0x97420110, 0x97430112, 0x24040001, 0x21400, 0x3063ffff, 0x431025, 0xaca2000c, 0x97420114, 0x27bd0018, 0x3042ffff, -0xaca20010, 0xaca00014, 0xaca00018, 0xa0005d3, +0xaca20010, 0xaca00014, 0xaca00018, 0xa00059c, 0xaca6001c, 0x8fbf0010, 0x3e00008, 0x27bd0018, 0x3c020800, 0x8c420020, 0x27bdffe8, 0x1040002a, -0xafbf0010, 0xe00059b, 0x0, 0x97420108, +0xafbf0010, 0xe000577, 0x0, 0x97420108, 0x9743010c, 0x8f850020, 0x3042003e, 0x3063ffff, 0x21400, 0x431025, 0xaca20000, 0x8f420100, -0x3c060800, 0x94c64f76, 0x8fbf0010, 0xaca20004, +0x3c060800, 0x94c64ed6, 0x8fbf0010, 0xaca20004, 0x97430116, 0x9744010e, 0x3c022000, 0x31c00, 0x3084ffff, 0x641825, 0xaca30008, 0xc23025, 0x97420110, 0x97430112, 0x24040001, 0x21400, 0x3063ffff, 0x431025, 0xaca2000c, 0x97420114, 0x27bd0018, 0x3042ffff, 0xaca20010, 0x8f420118, 0xaca20014, 0x9342010b, 0x304200ff, 0xaca20018, -0xa0005d3, 0xaca6001c, 0x8fbf0010, 0x3e00008, +0xa00059c, 0xaca6001c, 0x8fbf0010, 0x3e00008, 0x27bd0018, 0x27bdffe0, 0xafb00010, 0xafbf0018, 0xafb10014, 0x27500100, 0x9203000b, 0x2402001a, 0x96110008, 0x14620035, 0x2021, 0x32220001, 0x10400009, 0x0, 0x8e020000, 0x96030014, 0x211c2, 0x21040, 0x5a1021, 0xa4430080, -0xa000177, 0x32220002, 0xe000129, 0x0, +0xa000179, 0x32220002, 0xe00012b, 0x0, 0x3c020800, 0x8c420040, 0x24420001, 0x3c010800, 0xac220040, 0x32220002, 0x2202b, 0x3c020800, 0x8c420044, 0x32230004, 0x24420001, 0x3c010800, 0xac220044, 0x1060001a, 0x8fbf0018, 0x8f4202b8, 0x4410008, 0x24040001, 0x3c020800, 0x8c420060, -0x24420001, 0x3c010800, 0xac220060, 0xa00019a, +0x24420001, 0x3c010800, 0xac220060, 0xa00019c, 0x8fb10014, 0x8e020020, 0x96030016, 0x2021, 0xaf420280, 0x8e020004, 0xa7430284, 0xaf420288, 0x3c021000, 0xaf4202b8, 0x3c020800, 0x8c42005c, @@ -163,305 +163,286 @@ u32 bce_COM_b06FwText[(0x4e94/4) + 1] = 0x8fb10014, 0x8fb00010, 0x801021, 0x3e00008, 0x27bd0020, 0x27bdffe0, 0xafb00010, 0xafbf0018, 0xafb10014, 0x27500100, 0x9203000b, 0x24020003, -0x96110008, 0x14620035, 0x2021, 0x32220001, -0x10400009, 0x0, 0x8e020000, 0x96030014, -0x211c2, 0x21040, 0x5a1021, 0xa4430080, -0xa0001bb, 0x32220002, 0xe0000fb, 0x0, -0x3c020800, 0x8c420040, 0x24420001, 0x3c010800, -0xac220040, 0x32220002, 0x2202b, 0x3c020800, -0x8c420044, 0x32230004, 0x24420001, 0x3c010800, -0xac220044, 0x1060001a, 0x8fbf0018, 0x8f4202b8, -0x4410008, 0x24040001, 0x3c020800, 0x8c420060, -0x24420001, 0x3c010800, 0xac220060, 0xa0001de, -0x8fb10014, 0x8e020020, 0x96030016, 0x2021, +0x96110008, 0x14620048, 0x2021, 0x32220001, +0x10400008, 0x0, 0x8e020000, 0x96030014, +0x211c2, 0x21040, 0x5a1021, 0xa0001bb, +0xa4430080, 0xe0000fd, 0x0, 0x3c020800, +0x8c420040, 0x24420001, 0x3c010800, 0xac220040, +0x3c020800, 0x8c420044, 0x32230004, 0x24420001, +0x3c010800, 0xac220044, 0x1060001a, 0x32220002, +0x8f4202b8, 0x4430008, 0x8e020020, 0x3c020800, +0x8c420060, 0x24420001, 0x3c010800, 0xac220060, +0xa0001f1, 0x24040001, 0x96030016, 0x2021, 0xaf420280, 0x8e020004, 0xa7430284, 0xaf420288, 0x3c021000, 0xaf4202b8, 0x3c020800, 0x8c42005c, -0x24420001, 0x3c010800, 0xac22005c, 0x8fbf0018, -0x8fb10014, 0x8fb00010, 0x801021, 0x3e00008, -0x27bd0020, 0x93620000, 0x3e00008, 0xaf800004, -0x3e00008, 0x1021, 0x27bdffe8, 0xafbf0014, -0xafb00010, 0x8f420100, 0xaf420020, 0x8f420104, -0xaf4200a8, 0x9350010b, 0xe0001e2, 0x321000ff, -0x3c020800, 0x24424ef8, 0x101880, 0x2e10001c, -0x16000004, 0x621021, 0xe0001e5, 0xa0001fd, -0x0, 0x8c420000, 0x40f809, 0x0, +0x24420001, 0x3c010800, 0xac22005c, 0xa0001f2, +0x8fbf0018, 0x10400014, 0x2021, 0x8f430104, +0x3c026020, 0xac430014, 0x8c420004, 0x240301fe, +0x304203ff, 0x1443000c, 0x2021, 0x8f420100, +0x219c2, 0x2462fffc, 0x2c420008, 0x10400003, +0x24040002, 0x2462fffd, 0x442004, 0x3c026000, +0xac446914, 0x2021, 0x8fbf0018, 0x8fb10014, +0x8fb00010, 0x801021, 0x3e00008, 0x27bd0020, +0x93620000, 0x3e00008, 0xaf800004, 0x3e00008, +0x1021, 0x27bdffe8, 0xafbf0014, 0xafb00010, +0x8f420100, 0xaf420020, 0x8f420104, 0xaf4200a8, +0x9350010b, 0xe0001f7, 0x321000ff, 0x3c020800, +0x24424e58, 0x101880, 0x2e10001c, 0x16000004, +0x621021, 0xe0001fa, 0xa000212, 0x0, +0x8c420000, 0x40f809, 0x0, 0x10400005, +0x3c024000, 0x8f430104, 0x3c026020, 0xac430014, +0x3c024000, 0xaf420138, 0x3c020800, 0x8c420034, +0x8fbf0014, 0x8fb00010, 0x24420001, 0x3c010800, +0xac220034, 0x3e00008, 0x27bd0018, 0x27bdffe8, +0xafbf0010, 0x8f420140, 0xe0001f7, 0xaf420020, +0xe000393, 0x0, 0x3c024000, 0xaf420178, +0x3c030800, 0x24630038, 0x8c620000, 0x8fbf0010, +0x27bd0018, 0x24420001, 0x3e00008, 0xac620000, +0x27bdffe8, 0xafbf0010, 0x8f420180, 0xe0001f7, +0xaf420020, 0x8f430180, 0x24020f00, 0x14620005, +0x0, 0x8f420188, 0xa742009c, 0xa00024c, +0x3c024000, 0x93620000, 0x24030050, 0x304200ff, +0x14430008, 0x3c024000, 0xe000377, 0x0, +0x14400004, 0x3c024000, 0xe000e55, 0x0, +0x3c024000, 0xaf4201b8, 0x3c020800, 0x8c42003c, +0x8fbf0010, 0x24420001, 0x3c010800, 0xac22003c, +0x3e00008, 0x27bd0018, 0x3e00008, 0x1021, +0x8f430104, 0x8f820010, 0x10430008, 0x0, +0x3c020800, 0x8c420084, 0x24420001, 0x3c010800, +0xac220084, 0x8f420104, 0xaf820010, 0x3e00008, +0x0, 0x27bdffe8, 0xafbf0010, 0x27440100, +0x94820008, 0x30430002, 0x30420004, 0x1040001b, +0x0, 0x8f4202b8, 0x4410008, 0x24050001, +0x3c020800, 0x8c420060, 0x24420001, 0x3c010800, +0xac220060, 0xa000294, 0x8fbf0010, 0x8c820020, +0x94830016, 0x2821, 0xaf420280, 0x8c820004, +0xa7430284, 0xaf420288, 0x3c021000, 0xaf4202b8, +0x3c020800, 0x8c42005c, 0x24420001, 0x3c010800, +0xac22005c, 0xa000294, 0x8fbf0010, 0x10600008, +0x24050001, 0x3c020800, 0x8c420084, 0x24420001, +0x3c010800, 0xac220084, 0xa000294, 0x8fbf0010, +0x8f440100, 0xe000257, 0x0, 0x2821, +0x8fbf0010, 0xa01021, 0x3e00008, 0x27bd0018, +0x3c020800, 0x8c420088, 0x27430100, 0x9465000c, +0x24420001, 0x3c010800, 0xac220088, 0x8c640018, +0x3451021, 0x90454000, 0xaf440038, 0x8c62001c, +0x2403fff8, 0x52e00, 0x431024, 0x34420004, +0xaf42003c, 0x3c020005, 0xaf420030, 0x0, +0x0, 0x0, 0xaf450404, 0x0, +0x0, 0x0, 0x3c020006, 0x34420001, +0xaf420030, 0x0, 0x0, 0x0, +0x8f420000, 0x30420010, 0x1040fffd, 0x1021, +0x3e00008, 0x0, 0x27bdffe0, 0xafbf0018, +0xafb10014, 0xe000055, 0xafb00010, 0x3c028000, +0x34420070, 0x8c420000, 0xaf820014, 0xe0000b2, +0x0, 0x3c028000, 0x34460070, 0x3c030800, +0x8c6300a0, 0x3c020800, 0x8c4200a4, 0x10430004, +0x8f840014, 0x3c010800, 0xac2300a4, 0xa743009e, +0x8cca0000, 0x3c030800, 0x8c6300bc, 0x3c020800, +0x8c4200b8, 0x1442023, 0x641821, 0x4021, +0x64202b, 0x481021, 0x441021, 0x3c010800, +0xac2300bc, 0x3c010800, 0xac2200b8, 0x8f510000, +0x32220007, 0x1040ffe1, 0xaf8a0014, 0x8cc60000, +0x3c050800, 0x8ca500bc, 0x3c040800, 0x8c8400b8, +0xca3023, 0xa62821, 0x1021, 0xa6302b, +0x822021, 0x862021, 0x32270001, 0x3c010800, +0xac2500bc, 0x3c010800, 0xac2400b8, 0x10e00021, +0x32220002, 0x8f420100, 0xaf420020, 0x8f420104, +0xaf4200a8, 0x9342010b, 0xe0001f7, 0x305000ff, +0x2e02001c, 0x54400004, 0x101080, 0xe0001fa, +0xa00030b, 0x0, 0x3c030800, 0x24634e58, +0x431021, 0x8c420000, 0x40f809, 0x0, 0x10400005, 0x3c024000, 0x8f430104, 0x3c026020, 0xac430014, 0x3c024000, 0xaf420138, 0x3c020800, -0x8c420034, 0x8fbf0014, 0x8fb00010, 0x24420001, -0x3c010800, 0xac220034, 0x3e00008, 0x27bd0018, -0x27bdffe8, 0xafbf0010, 0x8f420140, 0xe0001e2, -0xaf420020, 0xe000380, 0x0, 0x3c024000, -0xaf420178, 0x3c030800, 0x24630038, 0x8c620000, -0x8fbf0010, 0x27bd0018, 0x24420001, 0x3e00008, -0xac620000, 0x27bdffe8, 0xafbf0010, 0x8f420180, -0xe0001e2, 0xaf420020, 0x8f430180, 0x24020f00, -0x14620005, 0x0, 0x8f420188, 0xa742009c, -0xa000237, 0x3c024000, 0x93620000, 0x24030050, -0x304200ff, 0x14430008, 0x3c024000, 0xe00035e, -0x0, 0x14400004, 0x3c024000, 0xe000e9f, -0x0, 0x3c024000, 0xaf4201b8, 0x3c020800, -0x8c42003c, 0x8fbf0010, 0x24420001, 0x3c010800, -0xac22003c, 0x3e00008, 0x27bd0018, 0x3e00008, -0x1021, 0x8f430104, 0x8f820010, 0x10430008, -0x0, 0x3c020800, 0x8c420084, 0x24420001, -0x3c010800, 0xac220084, 0x8f420104, 0xaf820010, -0x3e00008, 0x0, 0x27bdffe8, 0xafbf0010, -0x27440100, 0x94820008, 0x30430002, 0x30420004, -0x1040001b, 0x0, 0x8f4202b8, 0x4410008, -0x24050001, 0x3c020800, 0x8c420060, 0x24420001, -0x3c010800, 0xac220060, 0xa00027f, 0x8fbf0010, -0x8c820020, 0x94830016, 0x2821, 0xaf420280, -0x8c820004, 0xa7430284, 0xaf420288, 0x3c021000, -0xaf4202b8, 0x3c020800, 0x8c42005c, 0x24420001, -0x3c010800, 0xac22005c, 0xa00027f, 0x8fbf0010, -0x10600008, 0x24050001, 0x3c020800, 0x8c420084, -0x24420001, 0x3c010800, 0xac220084, 0xa00027f, -0x8fbf0010, 0x8f440100, 0xe000242, 0x0, -0x2821, 0x8fbf0010, 0xa01021, 0x3e00008, -0x27bd0018, 0x3c020800, 0x8c420088, 0x27430100, -0x9465000c, 0x24420001, 0x3c010800, 0xac220088, -0x8c640018, 0x3451021, 0x90454000, 0xaf440038, -0x8c62001c, 0x2403fff8, 0x52e00, 0x431024, -0x34420004, 0xaf42003c, 0x3c020005, 0xaf420030, -0x0, 0x0, 0x0, 0xaf450404, -0x0, 0x0, 0x0, 0x3c020006, -0x34420001, 0xaf420030, 0x0, 0x0, -0x0, 0x8f420000, 0x30420010, 0x1040fffd, -0x1021, 0x3e00008, 0x0, 0x27bdffe0, -0xafbf0018, 0xafb10014, 0xe000055, 0xafb00010, -0x3c028000, 0x34420070, 0x8c420000, 0xaf820014, -0xe0000b0, 0x0, 0x3c028000, 0x34460070, -0x3c030800, 0x8c6300a0, 0x3c020800, 0x8c4200a4, -0x10430004, 0x8f840014, 0x3c010800, 0xac2300a4, -0xa743009e, 0x8cca0000, 0x3c030800, 0x8c6300bc, -0x3c020800, 0x8c4200b8, 0x1442023, 0x641821, -0x4021, 0x64202b, 0x481021, 0x441021, -0x3c010800, 0xac2300bc, 0x3c010800, 0xac2200b8, -0x8f510000, 0x32220007, 0x1040ffe1, 0xaf8a0014, -0x8cc60000, 0x3c050800, 0x8ca500bc, 0x3c040800, -0x8c8400b8, 0xca3023, 0xa62821, 0x1021, -0xa6302b, 0x822021, 0x862021, 0x32270001, -0x3c010800, 0xac2500bc, 0x3c010800, 0xac2400b8, -0x10e00021, 0x32220002, 0x8f420100, 0xaf420020, -0x8f420104, 0xaf4200a8, 0x9342010b, 0xe0001e2, -0x305000ff, 0x2e02001c, 0x54400004, 0x101080, -0xe0001e5, 0xa0002f6, 0x0, 0x3c030800, -0x24634ef8, 0x431021, 0x8c420000, 0x40f809, -0x0, 0x10400005, 0x3c024000, 0x8f430104, -0x3c026020, 0xac430014, 0x3c024000, 0xaf420138, -0x3c020800, 0x8c420034, 0x24420001, 0x3c010800, -0xac220034, 0x32220002, 0x1040000e, 0x32220004, -0x8f420140, 0xe0001e2, 0xaf420020, 0xe000380, -0x0, 0x3c024000, 0xaf420178, 0x3c020800, -0x8c420038, 0x24420001, 0x3c010800, 0xac220038, -0x32220004, 0x1040ff9b, 0x3c028000, 0x8f420180, -0xe0001e2, 0xaf420020, 0x8f430180, 0x24020f00, -0x14620005, 0x0, 0x8f420188, 0xa742009c, -0xa00032b, 0x3c024000, 0x93620000, 0x24030050, -0x304200ff, 0x14430008, 0x3c024000, 0xe00035e, -0x0, 0x54400004, 0x3c024000, 0xe000e9f, -0x0, 0x3c024000, 0xaf4201b8, 0x3c020800, -0x8c42003c, 0x24420001, 0x3c010800, 0xac22003c, -0xa0002ae, 0x3c028000, 0x3c029000, 0x34420001, -0x822025, 0xaf440020, 0x8f420020, 0x440fffe, -0x0, 0x3e00008, 0x0, 0x3c028000, -0x34420001, 0x822025, 0x3e00008, 0xaf440020, -0x27bdffe0, 0xafb10014, 0xafb00010, 0x808821, -0xafbf0018, 0xe000333, 0x30b000ff, 0x9362007d, -0x2202021, 0x2028025, 0xa370007d, 0x8f700074, -0x3c028000, 0xe00033c, 0x2028024, 0x16000009, -0x8fbf0018, 0x8f4201f8, 0x440fffe, 0x24020002, -0xaf5101c0, 0xa34201c4, 0x3c021000, 0xaf4201f8, -0x8fbf0018, 0x8fb10014, 0x8fb00010, 0x3e00008, -0x27bd0020, 0x27bdffe8, 0xafbf0010, 0x8f440180, -0x97420184, 0x30420200, 0x10400005, 0x2821, -0xe0010b5, 0x0, 0xa000373, 0x24050001, -0x8f420188, 0x4400009, 0x8fbf0010, 0x8f420188, -0x3c03ff00, 0x431024, 0x3c030400, 0x14430003, -0x24050001, 0x9362003e, 0x8fbf0010, 0xa01021, -0x3e00008, 0x27bd0018, 0x8f420140, 0xaf420200, -0x3c021000, 0x3e00008, 0xaf420238, 0xa3600022, -0x8f440140, 0xa000341, 0x24050001, 0x27bdffe8, -0xafbf0014, 0xafb00010, 0x93620000, 0x24030020, -0x304200ff, 0x1043000b, 0x0, 0x93620000, -0x24030030, 0x304200ff, 0x10430006, 0x0, -0x93620000, 0x24030050, 0x304200ff, 0x1443005f, -0x8fbf0014, 0x93420148, 0x304200ff, 0x2443ffff, -0x2c620005, 0x10400059, 0x8fbf0014, 0x31080, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From delphij at FreeBSD.org Tue Mar 3 16:58:05 2009 From: delphij at FreeBSD.org (Xin LI) Date: Tue Mar 3 16:58:17 2009 Subject: svn commit: r189327 - in head/lib/libc/db: btree hash recno Message-ID: <200903040058.n240w4SI026223@svn.freebsd.org> Author: delphij Date: Wed Mar 4 00:58:04 2009 New Revision: 189327 URL: http://svn.freebsd.org/changeset/base/189327 Log: Style changes (including additional casts to shut up warnings). This commit does not affect MD5 of object file. Modified: head/lib/libc/db/btree/bt_delete.c head/lib/libc/db/btree/bt_open.c head/lib/libc/db/btree/bt_put.c head/lib/libc/db/btree/bt_seq.c head/lib/libc/db/btree/bt_split.c head/lib/libc/db/btree/bt_utils.c head/lib/libc/db/btree/btree.h head/lib/libc/db/hash/hash_bigkey.c head/lib/libc/db/hash/page.h head/lib/libc/db/recno/rec_close.c head/lib/libc/db/recno/rec_open.c head/lib/libc/db/recno/rec_put.c head/lib/libc/db/recno/rec_search.c head/lib/libc/db/recno/rec_seq.c head/lib/libc/db/recno/rec_utils.c Modified: head/lib/libc/db/btree/bt_delete.c ============================================================================== --- head/lib/libc/db/btree/bt_delete.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_delete.c Wed Mar 4 00:58:04 2009 (r189327) @@ -146,7 +146,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR pgno_t pgno; recno_t nextpg, prevpg; int exact, level; - + /* * Find the first occurrence of the key in the tree. Toss the * currently locked page so we don't hit an already-locked page. @@ -262,7 +262,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR if ((h = mpool_get(t->bt_mp, prevpg, 0)) == NULL) return (1); } - + ret: mpool_put(t->bt_mp, h, 0); return ((*hp = mpool_get(t->bt_mp, c->pg.pgno, 0)) == NULL); @@ -390,7 +390,7 @@ __bt_pdelete(BTREE *t, PAGE *h) /* Get the parent page. */ if ((pg = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL) return (RET_ERROR); - + idx = parent->index; bi = GETBINTERNAL(pg, idx); @@ -406,7 +406,7 @@ __bt_pdelete(BTREE *t, PAGE *h) * root page. If it's the rootpage, turn it back into an empty * leaf page. */ - if (NEXTINDEX(pg) == 1) + if (NEXTINDEX(pg) == 1) { if (pg->pgno == P_ROOT) { pg->lower = BTDATAOFF; pg->upper = t->bt_psize; @@ -416,7 +416,7 @@ __bt_pdelete(BTREE *t, PAGE *h) return (RET_ERROR); continue; } - else { + } else { /* Pack remaining key items at the end of the page. */ nksize = NBINTERNAL(bi->ksize); from = (char *)pg + pg->upper; @@ -551,7 +551,7 @@ __bt_curdel(BTREE *t, const DBT *key, PA key = &c->key; } /* Check previous key, if not at the beginning of the page. */ - if (idx > 0) { + if (idx > 0) { e.page = h; e.index = idx - 1; if (__bt_cmp(t, key, &e) == 0) { Modified: head/lib/libc/db/btree/bt_open.c ============================================================================== --- head/lib/libc/db/btree/bt_open.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_open.c Wed Mar 4 00:58:04 2009 (r189327) @@ -197,7 +197,7 @@ __bt_open(const char *fname, int flags, default: goto einval; } - + if ((t->bt_fd = _open(fname, flags, mode)) < 0) goto err; Modified: head/lib/libc/db/btree/bt_put.c ============================================================================== --- head/lib/libc/db/btree/bt_put.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_put.c Wed Mar 4 00:58:04 2009 (r189327) @@ -99,7 +99,7 @@ __bt_put(const DB *dbp, DBT *key, const */ if (F_ISSET(&t->bt_cursor, CURS_INIT) && !F_ISSET(&t->bt_cursor, - CURS_ACQUIRE | CURS_AFTER | CURS_BEFORE)) + CURS_ACQUIRE | CURS_AFTER | CURS_BEFORE)) break; /* FALLTHROUGH */ default: @@ -257,7 +257,7 @@ u_long bt_cache_hit, bt_cache_miss; * key: key to insert * * Returns: - * EPG for new record or NULL if not found. + * EPG for new record or NULL if not found. */ static EPG * bt_fast(BTREE *t, const DBT *key, const DBT *data, int *exactp) Modified: head/lib/libc/db/btree/bt_seq.c ============================================================================== --- head/lib/libc/db/btree/bt_seq.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_seq.c Wed Mar 4 00:58:04 2009 (r189327) @@ -258,7 +258,7 @@ __bt_seqadv(BTREE *t, EPG *ep, int flags return (RET_ERROR); /* - * Find the next/previous record in the tree and point the cursor at + * Find the next/previous record in the tree and point the cursor at * it. The cursor may not be moved until a new key has been found. */ switch (flags) { @@ -348,7 +348,7 @@ __bt_first(BTREE *t, const DBT *key, EPG *erval = *ep; return (RET_SUCCESS); } - + /* * Walk backwards, as long as the entry matches and there are * keys left in the tree. Save a copy of each match in case Modified: head/lib/libc/db/btree/bt_split.c ============================================================================== --- head/lib/libc/db/btree/bt_split.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_split.c Wed Mar 4 00:58:04 2009 (r189327) @@ -149,7 +149,7 @@ __bt_split(BTREE *t, PAGE *sp, const DBT if ((h = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL) goto err2; - /* + /* * The new key goes ONE AFTER the index, because the split * was to the right. */ Modified: head/lib/libc/db/btree/bt_utils.c ============================================================================== --- head/lib/libc/db/btree/bt_utils.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_utils.c Wed Mar 4 00:58:04 2009 (r189327) @@ -196,7 +196,7 @@ __bt_cmp(BTREE *t, const DBT *k1, EPG *e * * Parameters: * a: DBT #1 - * b: DBT #2 + * b: DBT #2 * * Returns: * < 0 if a is < b @@ -227,7 +227,7 @@ __bt_defcmp(const DBT *a, const DBT *b) * * Parameters: * a: DBT #1 - * b: DBT #2 + * b: DBT #2 * * Returns: * Number of bytes needed to distinguish b from a. Modified: head/lib/libc/db/btree/btree.h ============================================================================== --- head/lib/libc/db/btree/btree.h Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/btree.h Wed Mar 4 00:58:04 2009 (r189327) @@ -309,8 +309,8 @@ typedef struct _btree { CURSOR bt_cursor; /* cursor */ #define BT_PUSH(t, p, i) { \ - t->bt_sp->pgno = p; \ - t->bt_sp->index = i; \ + t->bt_sp->pgno = p; \ + t->bt_sp->index = i; \ ++t->bt_sp; \ } #define BT_POP(t) (t->bt_sp == t->bt_stack ? NULL : --t->bt_sp) Modified: head/lib/libc/db/hash/hash_bigkey.c ============================================================================== --- head/lib/libc/db/hash/hash_bigkey.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/hash/hash_bigkey.c Wed Mar 4 00:58:04 2009 (r189327) @@ -412,8 +412,8 @@ __big_return(HTAB *hashp, BUFHEAD *bufp, return (0); } - val->size = collect_data(hashp, bufp, (int)len, set_current); - if (val->size == -1) + val->size = (size_t)collect_data(hashp, bufp, (int)len, set_current); + if (val->size == (size_t)-1) return (-1); if (save_p->addr != save_addr) { /* We are pretty short on buffers. */ @@ -484,8 +484,8 @@ collect_data(HTAB *hashp, BUFHEAD *bufp, int __big_keydata(HTAB *hashp, BUFHEAD *bufp, DBT *key, DBT *val, int set) { - key->size = collect_key(hashp, bufp, 0, val, set); - if (key->size == -1) + key->size = (size_t)collect_key(hashp, bufp, 0, val, set); + if (key->size == (size_t)-1) return (-1); key->data = (u_char *)hashp->tmp_key; return (0); @@ -544,12 +544,10 @@ __big_split(HTAB *hashp, u_int32_t obucket, /* Old Bucket */ SPLIT_RETURN *ret) { - BUFHEAD *tmpp; - u_int16_t *tp; - BUFHEAD *bp; + BUFHEAD *bp, *tmpp; DBT key, val; u_int32_t change; - u_int16_t free_space, n, off; + u_int16_t free_space, n, off, *tp; bp = big_keyp; @@ -561,7 +559,7 @@ __big_split(HTAB *hashp, if ( (ret->next_addr = __find_last_page(hashp, &big_keyp)) ) { if (!(ret->nextp = __get_buf(hashp, ret->next_addr, big_keyp, 0))) - return (-1);; + return (-1); } else ret->nextp = NULL; Modified: head/lib/libc/db/hash/page.h ============================================================================== --- head/lib/libc/db/hash/page.h Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/hash/page.h Wed Mar 4 00:58:04 2009 (r189327) @@ -48,7 +48,7 @@ * +--------+---------------------+ * | F R E E A R E A | * +--------------+---------------+ - * | <---- - - - | data | + * | <---- - - - | data | * +--------+-----+----+----------+ * | key | data | key | * +--------+----------+----------+ Modified: head/lib/libc/db/recno/rec_close.c ============================================================================== --- head/lib/libc/db/recno/rec_close.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_close.c Wed Mar 4 00:58:04 2009 (r189327) @@ -82,9 +82,10 @@ __rec_close(DB *dbp) if (F_ISSET(t, R_CLOSEFP)) { if (fclose(t->bt_rfp)) status = RET_ERROR; - } else + } else { if (_close(t->bt_rfd)) status = RET_ERROR; + } } if (__bt_close(dbp) == RET_ERROR) @@ -154,7 +155,7 @@ __rec_sync(const DB *dbp, u_int flags) status = (dbp->seq)(dbp, &key, &data, R_NEXT); } } else { - iov[1].iov_base = (char *)&t->bt_bval; + iov[1].iov_base = &t->bt_bval; iov[1].iov_len = 1; status = (dbp->seq)(dbp, &key, &data, R_FIRST); Modified: head/lib/libc/db/recno/rec_open.c ============================================================================== --- head/lib/libc/db/recno/rec_open.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_open.c Wed Mar 4 00:58:04 2009 (r189327) @@ -203,7 +203,7 @@ slow: if ((t->bt_rfp = fdopen(rfd, "r" if (openinfo && openinfo->flags & R_SNAPSHOT && !F_ISSET(t, R_EOF | R_INMEM) && t->bt_irec(t, MAX_REC_NUMBER) == RET_ERROR) - goto err; + goto err; return (dbp); einval: errno = EINVAL; Modified: head/lib/libc/db/recno/rec_put.c ============================================================================== --- head/lib/libc/db/recno/rec_put.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_put.c Wed Mar 4 00:58:04 2009 (r189327) @@ -169,7 +169,7 @@ einval: errno = EINVAL; t->bt_cursor.rcursor = nrec; break; } - + F_SET(t, R_MODIFIED); return (__rec_ret(t, NULL, nrec, key, NULL)); } Modified: head/lib/libc/db/recno/rec_search.c ============================================================================== --- head/lib/libc/db/recno/rec_search.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_search.c Wed Mar 4 00:58:04 2009 (r189327) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); * Parameters: * t: tree to search * recno: key to find - * op: search operation + * op: search operation * * Returns: * EPG for matching record, if any, or the EPG for the location of the @@ -87,7 +87,7 @@ __rec_search(BTREE *t, recno_t recno, en } BT_PUSH(t, pg, idx - 1); - + pg = r->pgno; switch (op) { case SDELETE: @@ -114,8 +114,8 @@ err: sverrno = errno; --GETRINTERNAL(h, parent->index)->nrecs; else ++GETRINTERNAL(h, parent->index)->nrecs; - mpool_put(t->bt_mp, h, MPOOL_DIRTY); - } + mpool_put(t->bt_mp, h, MPOOL_DIRTY); + } errno = sverrno; return (NULL); } Modified: head/lib/libc/db/recno/rec_seq.c ============================================================================== --- head/lib/libc/db/recno/rec_seq.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_seq.c Wed Mar 4 00:58:04 2009 (r189327) @@ -103,7 +103,7 @@ __rec_seq(const DB *dbp, DBT *key, DBT * einval: errno = EINVAL; return (RET_ERROR); } - + if (t->bt_nrecs == 0 || nrec > t->bt_nrecs) { if (!F_ISSET(t, R_EOF | R_INMEM) && (status = t->bt_irec(t, nrec)) != RET_SUCCESS) Modified: head/lib/libc/db/recno/rec_utils.c ============================================================================== --- head/lib/libc/db/recno/rec_utils.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_utils.c Wed Mar 4 00:58:04 2009 (r189327) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); * e: key/data pair to be returned * nrec: record number * key: user's key structure - * data: user's data structure + * data: user's data structure * * Returns: * RET_SUCCESS, RET_ERROR. From delphij at FreeBSD.org Tue Mar 3 17:01:28 2009 From: delphij at FreeBSD.org (Xin LI) Date: Tue Mar 3 17:01:40 2009 Subject: svn commit: r189328 - head/lib/libc/gen Message-ID: <200903040101.n2411QNW026364@svn.freebsd.org> Author: delphij Date: Wed Mar 4 01:01:26 2009 New Revision: 189328 URL: http://svn.freebsd.org/changeset/base/189328 Log: Sync license changes. Obtained from: NetBSD Modified: head/lib/libc/gen/lockf.3 head/lib/libc/gen/lockf.c Modified: head/lib/libc/gen/lockf.3 ============================================================================== --- head/lib/libc/gen/lockf.3 Wed Mar 4 00:58:04 2009 (r189327) +++ head/lib/libc/gen/lockf.3 Wed Mar 4 01:01:26 2009 (r189328) @@ -1,4 +1,4 @@ -.\" $NetBSD: lockf.3,v 1.2 1998/02/05 18:47:28 perry Exp $ +.\" $NetBSD: lockf.3,v 1.10 2008/04/30 13:10:50 martin Exp $ .\" .\" Copyright (c) 1997 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -14,13 +14,6 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the NetBSD -.\" Foundation, Inc. and its contributors. -.\" 4. Neither the name of The NetBSD Foundation nor the names of its -.\" contributors may be used to endorse or promote products derived -.\" from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED Modified: head/lib/libc/gen/lockf.c ============================================================================== --- head/lib/libc/gen/lockf.c Wed Mar 4 00:58:04 2009 (r189327) +++ head/lib/libc/gen/lockf.c Wed Mar 4 01:01:26 2009 (r189328) @@ -1,3 +1,4 @@ +/* $NetBSD: lockf.c,v 1.3 2008/04/28 20:22:59 martin Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. * All rights reserved. @@ -13,13 +14,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -34,7 +28,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* $NetBSD: lockf.c,v 1.1 1997/12/20 20:23:18 kleink Exp $ */ #include __FBSDID("$FreeBSD$"); @@ -45,10 +38,7 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" int -lockf(filedes, function, size) - int filedes; - int function; - off_t size; +lockf(int filedes, int function, off_t size) { struct flock fl; int cmd; From delphij at FreeBSD.org Tue Mar 3 17:17:07 2009 From: delphij at FreeBSD.org (Xin LI) Date: Tue Mar 3 17:17:17 2009 Subject: svn commit: r189330 - head/lib/libc/db/hash Message-ID: <200903040117.n241H5aX026732@svn.freebsd.org> Author: delphij Date: Wed Mar 4 01:17:05 2009 New Revision: 189330 URL: http://svn.freebsd.org/changeset/base/189330 Log: Explicitly specify bit width for on-disk data structure. Obtained from: OpenBSD Modified: head/lib/libc/db/hash/hash.h Modified: head/lib/libc/db/hash/hash.h ============================================================================== --- head/lib/libc/db/hash/hash.h Wed Mar 4 01:10:38 2009 (r189329) +++ head/lib/libc/db/hash/hash.h Wed Mar 4 01:17:05 2009 (r189330) @@ -60,28 +60,28 @@ typedef BUFHEAD **SEGMENT; /* Hash Table Information */ typedef struct hashhdr { /* Disk resident portion */ - int magic; /* Magic NO for hash tables */ - int version; /* Version ID */ + int32_t magic; /* Magic NO for hash tables */ + int32_t version; /* Version ID */ u_int32_t lorder; /* Byte Order */ - int bsize; /* Bucket/Page Size */ - int bshift; /* Bucket shift */ - int dsize; /* Directory Size */ - int ssize; /* Segment Size */ - int sshift; /* Segment shift */ - int ovfl_point; /* Where overflow pages are being + int32_t bsize; /* Bucket/Page Size */ + int32_t bshift; /* Bucket shift */ + int32_t dsize; /* Directory Size */ + int32_t ssize; /* Segment Size */ + int32_t sshift; /* Segment shift */ + int32_t ovfl_point; /* Where overflow pages are being * allocated */ - int last_freed; /* Last overflow page freed */ - int max_bucket; /* ID of Maximum bucket in use */ - int high_mask; /* Mask to modulo into entire table */ - int low_mask; /* Mask to modulo into lower half of + int32_t last_freed; /* Last overflow page freed */ + int32_t max_bucket; /* ID of Maximum bucket in use */ + int32_t high_mask; /* Mask to modulo into entire table */ + int32_t low_mask; /* Mask to modulo into lower half of * table */ - int ffactor; /* Fill factor */ - int nkeys; /* Number of keys in hash table */ - int hdrpages; /* Size of table header */ - int h_charkey; /* value of hash(CHARKEY) */ + int32_t ffactor; /* Fill factor */ + int32_t nkeys; /* Number of keys in hash table */ + int32_t hdrpages; /* Size of table header */ + int32_t h_charkey; /* value of hash(CHARKEY) */ #define NCACHED 32 /* number of bit maps and spare * points */ - int spares[NCACHED];/* spare pages for overflow */ + int32_t spares[NCACHED];/* spare pages for overflow */ u_int16_t bitmaps[NCACHED]; /* address of overflow page * bitmaps */ } HASHHDR; From yongari at FreeBSD.org Tue Mar 3 17:31:11 2009 From: yongari at FreeBSD.org (Pyun YongHyeon) Date: Tue Mar 3 17:31:17 2009 Subject: svn commit: r189331 - head/tools/tools/ifinfo Message-ID: <200903040131.n241V9tM027011@svn.freebsd.org> Author: yongari Date: Wed Mar 4 01:31:09 2009 New Revision: 189331 URL: http://svn.freebsd.org/changeset/base/189331 Log: Make ifinfo build. The struct if_data members ifi_recvquota and ifi_xmitquota were renamed to ifi_spare_char1 and ifi_spare_char2 respectively. Modified: head/tools/tools/ifinfo/ifinfo.c Modified: head/tools/tools/ifinfo/ifinfo.c ============================================================================== --- head/tools/tools/ifinfo/ifinfo.c Wed Mar 4 01:17:05 2009 (r189330) +++ head/tools/tools/ifinfo/ifinfo.c Wed Mar 4 01:31:09 2009 (r189331) @@ -169,8 +169,8 @@ printit(const struct ifmibdata *ifmd, co ifmd->ifmd_data.ifi_physical)); printf("\taddress length: %d\n", ifmd->ifmd_data.ifi_addrlen); printf("\theader length: %d\n", ifmd->ifmd_data.ifi_hdrlen); - printf("\treceive quota: %d\n", ifmd->ifmd_data.ifi_recvquota); - printf("\ttransmit quota: %d\n", ifmd->ifmd_data.ifi_xmitquota); + printf("\treceive spare char1: %u\n", ifmd->ifmd_data.ifi_spare_char1); + printf("\ttransmit spare char2: %u\n", ifmd->ifmd_data.ifi_spare_char2); printf("\tmtu: %lu\n", ifmd->ifmd_data.ifi_mtu); printf("\tmetric: %lu\n", ifmd->ifmd_data.ifi_metric); printf("\tline rate: %lu bit/s\n", ifmd->ifmd_data.ifi_baudrate); From yongari at FreeBSD.org Tue Mar 3 17:50:02 2009 From: yongari at FreeBSD.org (Pyun YongHyeon) Date: Tue Mar 3 17:50:19 2009 Subject: svn commit: r189334 - in stable/7/sys: amd64/conf i386/conf Message-ID: <200903040150.n241o0KX027491@svn.freebsd.org> Author: yongari Date: Wed Mar 4 01:50:00 2009 New Revision: 189334 URL: http://svn.freebsd.org/changeset/base/189334 Log: Enable ale(4) in GENERIC. Modified: stable/7/sys/amd64/conf/GENERIC stable/7/sys/i386/conf/GENERIC Modified: stable/7/sys/amd64/conf/GENERIC ============================================================================== --- stable/7/sys/amd64/conf/GENERIC Wed Mar 4 01:47:50 2009 (r189333) +++ stable/7/sys/amd64/conf/GENERIC Wed Mar 4 01:50:00 2009 (r189334) @@ -193,7 +193,7 @@ device vx # 3Com 3c590, 3c595 (``Vorte # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support device age # Attansic/Atheros L1 Gigabit Ethernet -#device ale # Atheros AR8121/AR8113/AR8114 Ethernet +device ale # Atheros AR8121/AR8113/AR8114 Ethernet device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet device bfe # Broadcom BCM440x 10/100 Ethernet device bge # Broadcom BCM570xx Gigabit Ethernet Modified: stable/7/sys/i386/conf/GENERIC ============================================================================== --- stable/7/sys/i386/conf/GENERIC Wed Mar 4 01:47:50 2009 (r189333) +++ stable/7/sys/i386/conf/GENERIC Wed Mar 4 01:50:00 2009 (r189334) @@ -204,7 +204,7 @@ device vx # 3Com 3c590, 3c595 (``Vorte # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support device age # Attansic/Atheros L1 Gigabit Ethernet -#device ale # Atheros AR8121/AR8113/AR8114 Ethernet +device ale # Atheros AR8121/AR8113/AR8114 Ethernet device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet device bfe # Broadcom BCM440x 10/100 Ethernet device bge # Broadcom BCM570xx Gigabit Ethernet From bms at FreeBSD.org Tue Mar 3 17:58:50 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Tue Mar 3 17:59:02 2009 Subject: svn commit: r189335 - head/lib/libc/net Message-ID: <200903040158.n241wmnE027756@svn.freebsd.org> Author: bms Date: Wed Mar 4 01:58:48 2009 New Revision: 189335 URL: http://svn.freebsd.org/changeset/base/189335 Log: Update copyright. Modified: head/lib/libc/net/sourcefilter.c Modified: head/lib/libc/net/sourcefilter.c ============================================================================== --- head/lib/libc/net/sourcefilter.c Wed Mar 4 01:50:00 2009 (r189334) +++ head/lib/libc/net/sourcefilter.c Wed Mar 4 01:58:48 2009 (r189335) @@ -1,6 +1,6 @@ /*- - * Copyright (c) 2007 Bruce M. Simpson. - * All rights reserved + * Copyright (c) 2007-2009 Bruce Simpson. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,21 +10,18 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of Bruce M. Simpson nor the names of other - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY BRUCE M. SIMPSON AND AFFILIATES - * ``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 BRUCE M. SIMPSON OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include From bms at FreeBSD.org Tue Mar 3 17:59:15 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Tue Mar 3 17:59:21 2009 Subject: svn commit: r189336 - head/lib/libc/net Message-ID: <200903040159.n241xE6w027802@svn.freebsd.org> Author: bms Date: Wed Mar 4 01:59:14 2009 New Revision: 189336 URL: http://svn.freebsd.org/changeset/base/189336 Log: Considerably improve the wording of this man page. Modified: head/lib/libc/net/sourcefilter.3 Modified: head/lib/libc/net/sourcefilter.3 ============================================================================== --- head/lib/libc/net/sourcefilter.3 Wed Mar 4 01:58:48 2009 (r189335) +++ head/lib/libc/net/sourcefilter.3 Wed Mar 4 01:59:14 2009 (r189336) @@ -1,15 +1,19 @@ -.\" Copyright (c) 2007 Bruce M. Simpson. All rights reserved. +.\" Copyright (c) 2007-2009 Bruce Simpson. +.\" 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 Bruce M. Simpson ``AS IS'' AND +.\" 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 Bruce M. Simpson BE LIABLE +.\" 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) @@ -20,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 12, 2007 +.Dd February 13, 2009 .Dt SOURCEFILTER 3 .Os .Sh NAME @@ -78,25 +82,34 @@ retrieve the multicast source address fi and a multicast .Fa group . .Pp -The protocol-independent functions -.Fn getsourcefilter +The functions +.Fn getipv4sourcefilter and -.Fn setsourcefilter -allow an application to join a multicast group on an interface by -passing its index for the -.Fa interface -argument. +.Fn getsourcefilter +allow an application to discover the filter mode, and +source filter entries, +for an existing group membership. +.Pp +The kernel will always return the number of source filter +entries on the socket for that group in +.Fa *numsrc . +If the +.Fa *numsrc +argument is non-zero, the kernel will attempt to return up to +.Fa *numsrc +filter entries in the array pointed to by +.Fa slist . The -argument. -.Fa grouplen -argument specifies the size of the structure pointed to by -.Fa group . +.Fa *numsrc +argument may be set to 0, in which case the +.Fa slist +argument will be ignored. .Pp For the .Fn setipv4sourcefilter and .Fn setsourcefilter -functions. +functions, the .Fa fmode argument may be used to place the socket into inclusive or exclusive @@ -110,14 +123,57 @@ The argument specifies the number of source entries in the .Fa slist array. -A value of 0 will remove all source filters from the socket. -The changes will be communicated to IGMPv3 and/or MLDv2 routers +If the +.Fa numsrc +argument has a value of 0, +all source filters will be removed from the socket. +Removing all source filters from a membership which is in the +.Dv MCAST_INCLUDE +filter mode will cause the group to be left on that socket. +.Pp +The protocol-independent function +.Fn setsourcefilter +allows an application to join a multicast group on an interface +which may not have an assigned protocol address, +by passing its index for the +.Fa interface +argument. +.Pp +Any changes made by these functions +will be communicated to IGMPv3 and/or MLDv2 routers on the local network as appropriate. +If no IGMPv3 or MLDv2 routers are present, changes in the source filter +lists made by these functions will not cause +state changes to be transmitted, with the exception of any +change which causes a group to be joined or left. +The kernel will continue to maintain the source filter state +regardless of the IGMP or MLD version in use on the link. .Sh IMPLEMENTATION NOTES The IPv4 specific versions of these functions are implemented in terms of the protocol-independent functions. Application writers are encouraged to use the protocol-independent functions -for efficiency, and upwards compatibility with IPv6 networks. +for efficiency, and forwards compatibility with IPv6 networks. +.Pp +For the protocol-independent functions +.Fn getsourcefilter +and +.Fn setsourcefilter , +the argument +.Fa grouplen +argument specifies the size of the structure pointed to by +.Fa group . +This is required in order to differentiate between different +address families. +.Pp +Currently +.Fx +does not support source address selection for the IPv4 +protocol family, therefore the use of multicast APIs with +an unnumbered IPv4 interface is +.Em not recommended. +In all cases, the first assigned IPv4 address on the interface +will be used as the source address of IGMP control traffic. +If this address is removed or changed, the results are undefined. .Sh RETURN VALUES .Rv -std getsourcefilter getipv4sourcefilter setsourcefilter setipv4sourcefilter .Sh ERRORS @@ -164,7 +220,8 @@ operation. .Sh SEE ALSO .Xr ip 4 , .Xr ip6 4 , -.Xr multicast 4 +.Xr multicast 4, +.Xr ifmcstat 8 .Rs .%A D. Thaler .%A B. Fenner From bms at FreeBSD.org Tue Mar 3 18:00:15 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Tue Mar 3 18:00:28 2009 Subject: svn commit: r189337 - head/share/man/man4 Message-ID: <200903040200.n2420Elb027892@svn.freebsd.org> Author: bms Date: Wed Mar 4 02:00:14 2009 New Revision: 189337 URL: http://svn.freebsd.org/changeset/base/189337 Log: Add source-specific multicast (SSM) option documentation. Modified: head/share/man/man4/ip.4 Modified: head/share/man/man4/ip.4 ============================================================================== --- head/share/man/man4/ip.4 Wed Mar 4 01:59:14 2009 (r189336) +++ head/share/man/man4/ip.4 Wed Mar 4 02:00:14 2009 (r189337) @@ -32,7 +32,7 @@ .\" @(#)ip.4 8.2 (Berkeley) 11/30/93 .\" $FreeBSD$ .\" -.Dd April 9, 2007 +.Dd February 13, 2009 .Dt IP 4 .Os .Sh NAME @@ -404,8 +404,9 @@ group and if multicast loopback has not Multicast datagrams with TTL greater than 1 may be forwarded to other networks if a multicast router is attached to the local network. .Pp -For hosts with multiple interfaces, each multicast transmission is -sent from the primary network interface. +For hosts with multiple interfaces, where an interface has not +been specified for a multicast group membership, +each multicast transmission is sent from the primary network interface. The .Dv IP_MULTICAST_IF option overrides the default for @@ -423,12 +424,25 @@ to specify the default interface. .Pp To specify an interface by index, an instance of .Vt ip_mreqn -should be passed instead. +may be passed instead. The .Vt imr_ifindex member should be set to the index of the desired interface, or 0 to specify the default interface. The kernel differentiates between these two structures by their size. +.Pp +The use of +.Vt IP_MULTICAST_IF +is +.Em not recommended , +as multicast memberships are scoped to each +individual interface. +It is supported for legacy use only by applications, +such as routing daemons, which expect to +be able to transmit link-local IPv4 multicast datagrams (224.0.0.0/24) +on multiple interfaces, +without requesting an individual membership for each interface. +.Pp .\" An interface's local IP address and multicast capability can be obtained via the @@ -485,24 +499,32 @@ struct ip_mreq { .Ed .Pp .Va imr_interface -should be set to -.Dv INADDR_ANY -to choose the default multicast interface, -or the +should be set to the .Tn IP address of a particular multicast-capable interface if the host is multihomed. -.\" TODO: Remove this piece when the RFC 3678 API is implemented and -.\" the RFC 1724 hack is removed. -Since -.Fx 4.4 , +It may be set to +.Dv INADDR_ANY +to choose the default interface, although this is not recommended; +this is considered to be the first interface corresponding +to the default route. +Otherwise, the first multicast-capable interface +configured in the system will be used. +.Pp +Prior to +.Fx 7.0 , if the .Va imr_interface member is within the network range .Li 0.0.0.0/8 , it is treated as an interface index in the system interface MIB, as per the RIP Version 2 MIB Extension (RFC-1724). -.\" TODO: Update this piece when IPv4 source-address selection is implemented. +In versions of +.Fx +since 7.0, this behavior is no longer supported. +Developers should +instead use the RFC 3678 multicast source filter APIs; in particular, +.Dv MCAST_JOIN_GROUP . .Pp Up to .Dv IP_MAX_MEMBERSHIPS @@ -511,24 +533,123 @@ Membership is associated with a single i programs running on multihomed hosts may need to join the same group on more than one interface. .Pp +To drop a membership, use: +.Bd -literal +struct ip_mreq mreq; +setsockopt(s, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)); +.Ed +.Pp +where +.Fa mreq +contains the same values as used to add the membership. +Memberships are dropped when the socket is closed or the process exits. +.\" TODO: Update this piece when IPv4 source-address selection is implemented. +.Pp The IGMP protocol uses the primary IP address of the interface as its identifier for group membership. +This is the first IP address configured on the interface. +If this address is removed or changed, the results are +undefined, as the IGMP membership state will then be inconsistent. If multiple IP aliases are configured on the same interface, they will be ignored. +.Pp This shortcoming was addressed in IPv6; MLDv2 requires that the unique link-local address for an interface is used to identify an MLDv2 listener. +.Ss "Source-Specific Multicast Options" +Since +.Fx 8.0 , +the use of Source-Specific Multicast (SSM) is supported. +These extensions require an IGMPv3 multicast router in order to +make best use of them. +If a legacy multicast router is present on the link, +.Fx +will simply downgrade to the version of IGMP spoken by the router, +and the benefits of source filtering on the upstream link +will not be present, although the kernel will continue to +squelch transmissions from blocked sources. +.Pp +Each group membership on a socket now has a filter mode: +.Bl -tag -width MCAST_EXCLUDE +.It Dv MCAST_EXCLUDE +Datagrams sent to this group are accepted, +unless the source is in a list of blocked source addresses. +.It Dv MCAST_INCLUDE +Datagrams sent to this group are accepted +only if the source is in a list of accepted source addresses. +.El .Pp -To drop a membership, use: +Groups joined using the legacy +.Dv IP_ADD_MEMBERSHIP +option are placed in exclusive-mode, +and are able to request that certain sources are blocked or allowed. +This is known as the +.Em delta-based API . +.Pp +To block a multicast source on an existing group membership: .Bd -literal -struct ip_mreq mreq; -setsockopt(s, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)); +struct ip_mreq_source mreqs; +setsockopt(s, IPPROTO_IP, IP_BLOCK_SOURCE, &mreqs, sizeof(mreqs)); .Ed .Pp where -.Fa mreq -contains the same values as used to add the membership. -Memberships are dropped when the socket is closed or the process exits. +.Fa mreqs +is the following structure: +.Bd -literal +struct ip_mreq_source { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_sourceaddr; /* IP address of source */ + struct in_addr imr_interface; /* local IP address of interface */ +} +.Ed +.Va imr_sourceaddr +should be set to the address of the source to be blocked. +.Pp +To unblock a multicast source on an existing group: +.Bd -literal +struct ip_mreq_source mreqs; +setsockopt(s, IPPROTO_IP, IP_UNBLOCK_SOURCE, &mreqs, sizeof(mreqs)); +.Ed +.Pp +The +.Dv IP_BLOCK_SOURCE +and +.Dv IP_UNBLOCK_SOURCE +options are +.Em not permitted +for inclusive-mode group memberships. +.Pp +To join a multicast group in +.Dv MCAST_INCLUDE +mode with a single source, +or add another source to an existing inclusive-mode membership: +.Bd -literal +struct ip_mreq_source mreqs; +setsockopt(s, IPPROTO_IP, IP_ADD_SOURCE_MEMBERSHIP, &mreqs, sizeof(mreqs)); +.Ed +.Pp +To leave a single source from an existing group in inclusive mode: +.Bd -literal +struct ip_mreq_source mreqs; +setsockopt(s, IPPROTO_IP, IP_DROP_SOURCE_MEMBERSHIP, &mreqs, sizeof(mreqs)); +.Ed +If this is the last accepted source for the group, the membership +will be dropped. +.Pp +The +.Dv IP_ADD_SOURCE_MEMBERSHIP +and +.Dv IP_DROP_SOURCE_MEMBERSHIP +options are +.Em not accepted +for exclusive-mode group memberships. +However, both exclusive and inclusive mode memberships +support the use of the +.Em full-state API +documented in RFC 3678. +For management of source filter lists using this API, +please refer to +.Xr sourcefilter 3 . .\"----------------------- .Ss "Raw IP Sockets" .Pp @@ -676,7 +797,16 @@ field was not equal to the length of the .Xr icmp 4 , .Xr inet 4 , .Xr intro 4 , -.Xr multicast 4 +.Xr multicast 4 , +.Xr sourcefilter 3 +.Rs +.%A D. Thaler +.%A B. Fenner +.%A B. Quinn +.%T "Socket Interface Extensions for Multicast Source Filters" +.%N RFC 3678 +.%D Jan 2004 +.Re .Sh HISTORY The .Nm From bms at FreeBSD.org Tue Mar 3 18:00:35 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Tue Mar 3 18:00:47 2009 Subject: svn commit: r189338 - head/share/man/man4 Message-ID: <200903040200.n2420YqD027935@svn.freebsd.org> Author: bms Date: Wed Mar 4 02:00:34 2009 New Revision: 189338 URL: http://svn.freebsd.org/changeset/base/189338 Log: Add cross-reference to sourcefilter(3). Modified: head/share/man/man4/multicast.4 Modified: head/share/man/man4/multicast.4 ============================================================================== --- head/share/man/man4/multicast.4 Wed Mar 4 02:00:14 2009 (r189337) +++ head/share/man/man4/multicast.4 Wed Mar 4 02:00:34 2009 (r189338) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2007 +.Dd February 13, 2009 .Dt MULTICAST 4 .Os .\" @@ -954,6 +954,7 @@ after the previous upcall. .Xr recvmsg 2 , .Xr setsockopt 2 , .Xr socket 2 , +.Xr sourcefilter 3 , .Xr icmp6 4 , .Xr inet 4 , .Xr inet6 4 , From bms at FreeBSD.org Tue Mar 3 18:08:21 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Tue Mar 3 18:08:33 2009 Subject: svn commit: r189339 - head/usr.sbin/mtest Message-ID: <200903040208.n2428KQY028116@svn.freebsd.org> Author: bms Date: Wed Mar 4 02:08:20 2009 New Revision: 189339 URL: http://svn.freebsd.org/changeset/base/189339 Log: Update mtest(8) manual page. Modified: head/usr.sbin/mtest/mtest.8 Modified: head/usr.sbin/mtest/mtest.8 ============================================================================== --- head/usr.sbin/mtest/mtest.8 Wed Mar 4 02:00:34 2009 (r189338) +++ head/usr.sbin/mtest/mtest.8 Wed Mar 4 02:08:20 2009 (r189339) @@ -1,8 +1,32 @@ .\" +.\" Copyright (c) 2007-2009 Bruce Simpson. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" .\" $FreeBSD$ .\" -.\" The following requests are required for all man pages. -.Dd March 8, 2007 +.Dd March 3, 2009 .Os .Dt MTEST 8 .Sh NAME @@ -17,19 +41,33 @@ utility is a small program for testing the multicast membership socket operations and ioctls. It accepts the following commands, interactively: -.Bl -tag -width "a ifname e.e.e.e.e.e" -compact -offset indent -.It Ic j Ar g.g.g.g Ar i.i.i.i +.Bl -tag -width "a ifname e.e.e.e e.e.e.e" -compact -offset indent +.It Ic j Ar g.g.g.g Ar i.i.i.i Op Ar s.s.s.s Join the IP group address .Ar g.g.g.g on the interface with address .Ar i.i.i.i . +.Pp +If an optional source +.Ar s.s.s.s +is specified, a source-specific join will be performed; +if +.Nm +is already a member of the group, the source +will be added to its filter list. +.Pp .Ar i.i.i.i -may be specified as 0.0.0.0 to use the default interface. -.It Ic l Ar g.g.g.g Ar i.i.i.i +may be specified as 0.0.0.0 to use the default interface, +although this is legacy behaviour and is not recommended, +as group memberships are keyed to each individual link. +.It Ic l Ar g.g.g.g Ar i.i.i.i Op Ar s.s.s.s Leave the IP group address .Ar g.g.g.g on the interface with address .Ar i.i.i.i . +If a source +.Ar s.s.s.s +is specified, only that source will be left. .It Ic a Ar ifname Ar e.e.e.e.e.e Join the Ethernet group address .Ar e.e.e.e.e.e @@ -115,5 +153,6 @@ Quit the program. .Re .Sh AUTHORS .An -split +.An "Bruce Simpson" .An "Steve Deering" .An "Wilbert De Graaf" From bms at FreeBSD.org Tue Mar 3 18:09:13 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Tue Mar 3 18:09:25 2009 Subject: svn commit: r189340 - head/usr.sbin/mtest Message-ID: <200903040209.n2429Cj6028172@svn.freebsd.org> Author: bms Date: Wed Mar 4 02:09:12 2009 New Revision: 189340 URL: http://svn.freebsd.org/changeset/base/189340 Log: Add full SSM stack support to mtest(8) diagnostic tool. Modified: head/usr.sbin/mtest/mtest.c Modified: head/usr.sbin/mtest/mtest.c ============================================================================== --- head/usr.sbin/mtest/mtest.c Wed Mar 4 02:08:20 2009 (r189339) +++ head/usr.sbin/mtest/mtest.c Wed Mar 4 02:09:12 2009 (r189340) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Bruce M. Simpson. + * Copyright (c) 2007-2009 Bruce Simpson. * Copyright (c) 2000 Wilbert De Graaf. * All rights reserved. * @@ -55,26 +55,21 @@ __FBSDID("$FreeBSD$"); #include #include -/* The following two socket options are private to the kernel and libc. */ - -#ifndef IP_SETMSFILTER -#define IP_SETMSFILTER 74 /* atomically set filter list */ -#endif -#ifndef IP_GETMSFILTER -#define IP_GETMSFILTER 75 /* get filter list */ -#endif - static void process_file(char *, int); static void process_cmd(char*, int, FILE *fp); static void usage(void); -#ifdef WITH_IGMPV3 -static int inaddr_cmp(const void *a, const void *b); -#endif #define MAX_ADDRS 20 #define STR_SIZE 20 #define LINE_LENGTH 80 +static int +inaddr_cmp(const void *a, const void *b) +{ + return ((int)((const struct in_addr *)a)->s_addr - + ((const struct in_addr *)b)->s_addr); +} + int main(int argc, char **argv) { @@ -145,17 +140,13 @@ process_cmd(char *cmd, int s, FILE *fp _ char str1[STR_SIZE]; char str2[STR_SIZE]; char str3[STR_SIZE]; -#ifdef WITH_IGMPV3 - char filtbuf[IP_MSFILTER_SIZE(MAX_ADDRS)]; -#endif + struct in_addr sources[MAX_ADDRS]; struct ifreq ifr; struct ip_mreq imr; struct ip_mreq_source imrs; -#ifdef WITH_IGMPV3 - struct ip_msfilter *imsfp; -#endif char *line; - int n, opt, f, flags; + uint32_t fmode; + int i, n, opt, f, flags; line = cmd; while (isblank(*++line)) @@ -181,20 +172,51 @@ process_cmd(char *cmd, int s, FILE *fp _ case 'j': case 'l': - sscanf(line, "%s %s", str1, str2); - if (((imr.imr_multiaddr.s_addr = inet_addr(str1)) == - INADDR_NONE) || - ((imr.imr_interface.s_addr = inet_addr(str2)) == - INADDR_NONE)) { - printf("-1\n"); - break; + str3[0] = '\0'; + sscanf(line, "%s %s %s", str1, str2, str3); + if ((imrs.imr_sourceaddr.s_addr = inet_addr(str3)) != + INADDR_NONE) { + /* + * inclusive mode join with source, possibly + * on existing membership. + */ + if (((imrs.imr_multiaddr.s_addr = inet_addr(str1)) == + INADDR_NONE) || + ((imrs.imr_interface.s_addr = inet_addr(str2)) == + INADDR_NONE)) { + printf("-1\n"); + break; + } + opt = (*cmd == 'j') ? IP_ADD_SOURCE_MEMBERSHIP : + IP_DROP_SOURCE_MEMBERSHIP; + if (setsockopt( s, IPPROTO_IP, opt, &imrs, + sizeof(imrs)) != 0) { + warn("setsockopt %s", (*cmd == 'j') ? + "IP_ADD_SOURCE_MEMBERSHIP" : + "IP_DROP_SOURCE_MEMBERSHIP"); + } else { + printf("ok\n"); + } + } else { + /* exclusive mode join w/o source. */ + if (((imr.imr_multiaddr.s_addr = inet_addr(str1)) == + INADDR_NONE) || + ((imr.imr_interface.s_addr = inet_addr(str2)) == + INADDR_NONE)) { + printf("-1\n"); + break; + } + opt = (*cmd == 'j') ? IP_ADD_MEMBERSHIP : + IP_DROP_MEMBERSHIP; + if (setsockopt( s, IPPROTO_IP, opt, &imr, + sizeof(imr)) != 0) { + warn("setsockopt %s", (*cmd == 'j') ? + "IP_ADD_MEMBERSHIP" : + "IP_DROP_MEMBERSHIP"); + } else { + printf("ok\n"); + } } - opt = (*cmd == 'j') ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP; - if (setsockopt( s, IPPROTO_IP, opt, &imr, - sizeof(imr)) != 0) - warn("setsockopt IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP"); - else - printf("ok\n"); break; case 'a': @@ -233,6 +255,7 @@ process_cmd(char *cmd, int s, FILE *fp _ printf("warning: IFF_ALLMULTI cannot be set from userland " "in FreeBSD; command ignored.\n"); break; + case 'p': if (sscanf(line, "%s %u", ifr.ifr_name, &f) != 2) { printf("-1\n"); @@ -257,7 +280,6 @@ process_cmd(char *cmd, int s, FILE *fp _ printf( "changed to 0x%08x\n", flags ); break; -#ifdef WITH_IGMPV3 /* * Set the socket to include or exclude filter mode, and * add some sources to the filterlist, using the full-state, @@ -265,42 +287,38 @@ process_cmd(char *cmd, int s, FILE *fp _ */ case 'i': case 'e': - /* XXX: SIOCSIPMSFILTER will be made an internal API. */ + n = 0; + fmode = (*cmd == 'i') ? MCAST_INCLUDE : MCAST_EXCLUDE; if ((sscanf(line, "%s %s %d", str1, str2, &n)) != 3) { printf("-1\n"); break; } - imsfp = (struct ip_msfilter *)filtbuf; - if (((imsfp->imsf_multiaddr.s_addr = inet_addr(str1)) == + /* recycle imrs struct for convenience */ + if (((imrs.imr_multiaddr.s_addr = inet_addr(str1)) == INADDR_NONE) || - ((imsfp->imsf_interface.s_addr = inet_addr(str2)) == - INADDR_NONE) || (n > MAX_ADDRS)) { + ((imrs.imr_interface.s_addr = inet_addr(str2)) == + INADDR_NONE) || (n < 0 || n > MAX_ADDRS)) { printf("-1\n"); break; } - imsfp->imsf_fmode = (*cmd == 'i') ? MCAST_INCLUDE : - MCAST_EXCLUDE; - imsfp->imsf_numsrc = n; for (i = 0; i < n; i++) { fgets(str1, sizeof(str1), fp); - if ((imsfp->imsf_slist[i].s_addr = inet_addr(str1)) == + if ((sources[i].s_addr = inet_addr(str1)) == INADDR_NONE) { printf("-1\n"); return; } } - if (ioctl(s, SIOCSIPMSFILTER, imsfp) != 0) - warn("setsockopt SIOCSIPMSFILTER"); + if (setipv4sourcefilter(s, imrs.imr_interface, + imrs.imr_multiaddr, fmode, n, sources) != 0) + warn("getipv4sourcefilter"); else printf("ok\n"); break; -#endif /* WITH_IGMPV3 */ /* * Allow or block traffic from a source, using the * delta based api. - * XXX: Currently we allow this to be used with the ASM-only - * implementation of RFC3678 in FreeBSD 7. */ case 't': case 'b': @@ -314,24 +332,14 @@ process_cmd(char *cmd, int s, FILE *fp _ printf("-1\n"); break; } - -#ifdef WITH_IGMPV3 - /* XXX: SIOCSIPMSFILTER will be made an internal API. */ - /* First determine out current filter mode. */ - imsfp = (struct ip_msfilter *)filtbuf; - imsfp->imsf_multiaddr.s_addr = imrs.imr_multiaddr.s_addr; - imsfp->imsf_interface.s_addr = imrs.imr_interface.s_addr; - imsfp->imsf_numsrc = 5; - if (ioctl(s, SIOCSIPMSFILTER, imsfp) != 0) { - /* It's only okay for 't' to fail */ - if (*cmd != 't') { - warn("ioctl SIOCSIPMSFILTER"); - break; - } else { - imsfp->imsf_fmode = MCAST_INCLUDE; - } + /* First determine our current filter mode. */ + n = 0; + if (getipv4sourcefilter(s, imrs.imr_interface, + imrs.imr_multiaddr, &fmode, &n, NULL) != 0) { + warn("getipv4sourcefilter"); + break; } - if (imsfp->imsf_fmode == MCAST_EXCLUDE) { + if (fmode == MCAST_EXCLUDE) { /* Any source */ opt = (*cmd == 't') ? IP_UNBLOCK_SOURCE : IP_BLOCK_SOURCE; @@ -340,60 +348,37 @@ process_cmd(char *cmd, int s, FILE *fp _ opt = (*cmd == 't') ? IP_ADD_SOURCE_MEMBERSHIP : IP_DROP_SOURCE_MEMBERSHIP; } -#else /* !WITH_IGMPV3 */ - /* - * Don't look before we leap; we may only block or unblock - * sources on a socket in exclude mode. - */ - opt = (*cmd == 't') ? IP_UNBLOCK_SOURCE : IP_BLOCK_SOURCE; -#endif /* WITH_IGMPV3 */ if (setsockopt(s, IPPROTO_IP, opt, &imrs, sizeof(imrs)) == -1) warn("ioctl IP_ADD_SOURCE_MEMBERSHIP/IP_DROP_SOURCE_MEMBERSHIP/IP_UNBLOCK_SOURCE/IP_BLOCK_SOURCE"); else printf("ok\n"); break; -#ifdef WITH_IGMPV3 case 'g': - /* XXX: SIOCSIPMSFILTER will be made an internal API. */ if ((sscanf(line, "%s %s %d", str1, str2, &n)) != 3) { printf("-1\n"); break; } - imsfp = (struct ip_msfilter *)filtbuf; - if (((imsfp->imsf_multiaddr.s_addr = inet_addr(str1)) == + /* recycle imrs struct for convenience */ + if (((imrs.imr_multiaddr.s_addr = inet_addr(str1)) == INADDR_NONE) || - ((imsfp->imsf_interface.s_addr = inet_addr(str2)) == + ((imrs.imr_interface.s_addr = inet_addr(str2)) == INADDR_NONE) || (n < 0 || n > MAX_ADDRS)) { printf("-1\n"); break; } - imsfp->imsf_numsrc = n; - if (ioctl(s, SIOCSIPMSFILTER, imsfp) != 0) { - warn("setsockopt SIOCSIPMSFILTER"); + if (getipv4sourcefilter(s, imrs.imr_interface, + imrs.imr_multiaddr, &fmode, &n, sources) != 0) { + warn("getipv4sourcefilter"); break; } - printf("%s\n", (imsfp->imsf_fmode == MCAST_INCLUDE) ? - "include" : "exclude"); - printf("%d\n", imsfp->imsf_numsrc); - if (n >= imsfp->imsf_numsrc) { - n = imsfp->imsf_numsrc; - qsort(imsfp->imsf_slist, n, sizeof(struct in_addr), - &inaddr_cmp); - for (i = 0; i < n; i++) - printf("%s\n", inet_ntoa(imsfp->imsf_slist[i])); - } - break; -#endif /* !WITH_IGMPV3 */ - -#ifndef WITH_IGMPV3 - case 'i': - case 'e': - case 'g': - printf("warning: IGMPv3 is not supported by this version " - "of FreeBSD; command ignored.\n"); + printf("%s\n", (fmode == MCAST_INCLUDE) ? "include" : + "exclude"); + printf("%d\n", n); + qsort(sources, n, sizeof(struct in_addr), &inaddr_cmp); + for (i = 0; i < n; i++) + printf("%s\n", inet_ntoa(sources[i])); break; -#endif /* WITH_IGMPV3 */ case '\n': break; @@ -407,31 +392,18 @@ static void usage(void) { - printf("j g.g.g.g i.i.i.i - join IP multicast group\n"); - printf("l g.g.g.g i.i.i.i - leave IP multicast group\n"); + printf("j g.g.g.g i.i.i.i [s.s.s.s] - join IP multicast group\n"); + printf("l g.g.g.g i.i.i.i [s.s.s.s] - leave IP multicast group\n"); printf("a ifname e.e.e.e.e.e - add ether multicast address\n"); printf("d ifname e.e.e.e.e.e - delete ether multicast address\n"); printf("m ifname 1/0 - set/clear ether allmulti flag\n"); printf("p ifname 1/0 - set/clear ether promisc flag\n"); -#ifdef WITH_IGMPv3 printf("i g.g.g.g i.i.i.i n - set n include mode src filter\n"); printf("e g.g.g.g i.i.i.i n - set n exclude mode src filter\n"); -#endif printf("t g.g.g.g i.i.i.i s.s.s.s - allow traffic from src\n"); printf("b g.g.g.g i.i.i.i s.s.s.s - block traffic from src\n"); -#ifdef WITH_IGMPV3 printf("g g.g.g.g i.i.i.i n - get and show n src filters\n"); -#endif printf("f filename - read command(s) from file\n"); printf("s seconds - sleep for some time\n"); printf("q - quit\n"); } - -#ifdef WITH_IGMPV3 -static int -inaddr_cmp(const void *a, const void *b) -{ - return((int)((const struct in_addr *)a)->s_addr - - ((const struct in_addr *)b)->s_addr); -} -#endif From bms at FreeBSD.org Tue Mar 3 18:12:31 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Tue Mar 3 18:12:38 2009 Subject: svn commit: r189341 - head/usr.sbin/ifmcstat Message-ID: <200903040212.n242CUa0028306@svn.freebsd.org> Author: bms Date: Wed Mar 4 02:12:29 2009 New Revision: 189341 URL: http://svn.freebsd.org/changeset/base/189341 Log: Add printb.c utility file, but do not yet connect it to the build. Added: head/usr.sbin/ifmcstat/printb.c (contents, props changed) Added: head/usr.sbin/ifmcstat/printb.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/ifmcstat/printb.c Wed Mar 4 02:12:29 2009 (r189341) @@ -0,0 +1,64 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +/* + * Print a value a la the %b format of the kernel's printf + */ +void +printb(const char *s, unsigned int v, const char *bits) +{ + int i, any = 0; + char c; + + if (bits && *bits == 8) + printf("%s=%o", s, v); + else + printf("%s=%x", s, v); + bits++; + if (bits) { + putchar('<'); + while ((i = *bits++) != '\0') { + if (v & (1 << (i-1))) { + if (any) + putchar(','); + any = 1; + for (; (c = *bits) > 32; bits++) + putchar(c); + } else + for (; *bits > 32; bits++) + ; + } + putchar('>'); + } +} From bms at FreeBSD.org Tue Mar 3 18:51:23 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Tue Mar 3 18:51:29 2009 Subject: svn commit: r189343 - head/sys/netinet Message-ID: <200903040251.n242pMtM029146@svn.freebsd.org> Author: bms Date: Wed Mar 4 02:51:22 2009 New Revision: 189343 URL: http://svn.freebsd.org/changeset/base/189343 Log: Add function ip_checkrouteralert(), which will be used by IGMPv3 to check for the IPv4 Router Alert [RFC2113] option in a pulled-up IP mbuf chain. Modified: head/sys/netinet/ip_options.c head/sys/netinet/ip_options.h Modified: head/sys/netinet/ip_options.c ============================================================================== --- head/sys/netinet/ip_options.c Wed Mar 4 02:38:38 2009 (r189342) +++ head/sys/netinet/ip_options.c Wed Mar 4 02:51:22 2009 (r189343) @@ -683,3 +683,64 @@ bad: (void)m_free(m); return (EINVAL); } + +/* + * Check for the presence of the IP Router Alert option [RFC2113] + * in the header of an IPv4 datagram. + * + * This call is not intended for use from the forwarding path; it is here + * so that protocol domains may check for the presence of the option. + * Given how FreeBSD's IPv4 stack is currently structured, the Router Alert + * option does not have much relevance to the implementation, though this + * may change in future. + * Router alert options SHOULD be passed if running in IPSTEALTH mode and + * we are not the endpoint. + * Length checks on individual options should already have been peformed + * by ip_dooptions() therefore they are folded under INVARIANTS here. + * + * Return zero if not present or options are invalid, non-zero if present. + */ +int +ip_checkrouteralert(struct mbuf *m) +{ + struct ip *ip = mtod(m, struct ip *); + u_char *cp; + int opt, optlen, cnt, found_ra; + + found_ra = 0; + cp = (u_char *)(ip + 1); + cnt = (ip->ip_hl << 2) - sizeof (struct ip); + for (; cnt > 0; cnt -= optlen, cp += optlen) { + opt = cp[IPOPT_OPTVAL]; + if (opt == IPOPT_EOL) + break; + if (opt == IPOPT_NOP) + optlen = 1; + else { +#ifdef INVARIANTS + if (cnt < IPOPT_OLEN + sizeof(*cp)) + break; +#endif + optlen = cp[IPOPT_OLEN]; +#ifdef INVARIANTS + if (optlen < IPOPT_OLEN + sizeof(*cp) || optlen > cnt) + break; +#endif + } + switch (opt) { + case IPOPT_RA: +#ifdef INVARIANTS + if (optlen != IPOPT_OFFSET + sizeof(uint16_t) || + (*((uint16_t *)&cp[IPOPT_OFFSET]) != 0)) + break; + else +#endif + found_ra = 1; + break; + default: + break; + } + } + + return (found_ra); +} Modified: head/sys/netinet/ip_options.h ============================================================================== --- head/sys/netinet/ip_options.h Wed Mar 4 02:38:38 2009 (r189342) +++ head/sys/netinet/ip_options.h Wed Mar 4 02:51:22 2009 (r189343) @@ -49,6 +49,7 @@ struct ipopt_tag { extern int ip_doopts; /* process or ignore IP options */ +int ip_checkrouteralert(struct mbuf *); int ip_dooptions(struct mbuf *, int); struct mbuf *ip_insertoptions(struct mbuf *, struct mbuf *, int *); int ip_optcopy(struct ip *, struct ip *); From bms at FreeBSD.org Tue Mar 3 18:54:12 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Tue Mar 3 18:54:23 2009 Subject: svn commit: r189344 - head/sys/net Message-ID: <200903040254.n242sBQU029229@svn.freebsd.org> Author: bms Date: Wed Mar 4 02:54:11 2009 New Revision: 189344 URL: http://svn.freebsd.org/changeset/base/189344 Log: Reserve a netisr slot for the IGMPv3 output queue. Modified: head/sys/net/netisr.h Modified: head/sys/net/netisr.h ============================================================================== --- head/sys/net/netisr.h Wed Mar 4 02:51:22 2009 (r189343) +++ head/sys/net/netisr.h Wed Mar 4 02:54:11 2009 (r189344) @@ -46,6 +46,7 @@ */ #define NETISR_POLL 0 /* polling callback, must be first */ #define NETISR_IP 2 /* same as AF_INET */ +#define NETISR_IGMP 3 /* IGMPv3 output queue */ #define NETISR_ROUTE 14 /* routing socket */ #define NETISR_AARP 15 /* Appletalk ARP */ #define NETISR_ATALK2 16 /* Appletalk phase 2 */ From bms at FreeBSD.org Tue Mar 3 18:55:05 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Tue Mar 3 18:55:12 2009 Subject: svn commit: r189345 - head/sys/sys Message-ID: <200903040255.n242t5kt029308@svn.freebsd.org> Author: bms Date: Wed Mar 4 02:55:04 2009 New Revision: 189345 URL: http://svn.freebsd.org/changeset/base/189345 Log: Overlay a uint16_t field suitable for use by the IGMPv3 code. It is used to maintain the number of group records contained in a pending IGMPv3 output mbuf chain. Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Wed Mar 4 02:54:11 2009 (r189344) +++ head/sys/sys/mbuf.h Wed Mar 4 02:55:04 2009 (r189345) @@ -122,9 +122,13 @@ struct pkthdr { int csum_flags; /* flags regarding checksum */ int csum_data; /* data field used by csum routines */ u_int16_t tso_segsz; /* TSO segment size */ - u_int16_t ether_vtag; /* Ethernet 802.1p+q vlan tag */ + union { + u_int16_t vt_vtag; /* Ethernet 802.1p+q vlan tag */ + u_int16_t vt_nrecs; /* # of IGMPv3 records in this chain */ + } PH_vt; SLIST_HEAD(packet_tags, m_tag) tags; /* list of packet tags */ }; +#define ether_vtag PH_vt.vt_vtag /* * Description of external storage mapped into mbuf; valid only if M_EXT is From bms at FreeBSD.org Tue Mar 3 19:01:06 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Tue Mar 3 19:01:18 2009 Subject: svn commit: r189346 - head/sys/netinet Message-ID: <200903040301.n24315RT029581@svn.freebsd.org> Author: bms Date: Wed Mar 4 03:01:05 2009 New Revision: 189346 URL: http://svn.freebsd.org/changeset/base/189346 Log: Add various defines/macros required by IGMPv3: * MCAST_UNDEFINED state. * in_allhosts() macro (group is 224.0.0.1). This uses a const endian comparison. * IP_MAX_GROUP_SRC_FILTER, IP_MAX_SOCK_SRC_FILTER default resource limits. Modified: head/sys/netinet/in.h Modified: head/sys/netinet/in.h ============================================================================== --- head/sys/netinet/in.h Wed Mar 4 02:55:04 2009 (r189345) +++ head/sys/netinet/in.h Wed Mar 4 03:01:05 2009 (r189346) @@ -501,7 +501,14 @@ __END_DECLS */ #define IP_MIN_MEMBERSHIPS 31 #define IP_MAX_MEMBERSHIPS 4095 -#define IP_MAX_SOURCE_FILTER 1024 /* # of filters per socket, per group */ +#define IP_MAX_SOURCE_FILTER 1024 /* XXX to be unused */ + +/* + * Default resource limits for IPv4 multicast source filtering. + * These may be modified by sysctl. + */ +#define IP_MAX_GROUP_SRC_FILTER 512 /* sources per group */ +#define IP_MAX_SOCK_SRC_FILTER 128 /* sources per socket/group */ /* * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. @@ -584,6 +591,7 @@ int getsourcefilter(int, uint32_t, struc /* * Filter modes; also used to represent per-socket filter mode internally. */ +#define MCAST_UNDEFINED 0 /* fmode: not yet defined */ #define MCAST_INCLUDE 1 /* fmode: include these source(s) */ #define MCAST_EXCLUDE 2 /* fmode: exclude these source(s) */ @@ -731,6 +739,7 @@ void in_ifdetach(struct ifnet *); #define in_hosteq(s, t) ((s).s_addr == (t).s_addr) #define in_nullhost(x) ((x).s_addr == INADDR_ANY) +#define in_allhosts(x) ((x).s_addr == htonl(INADDR_ALLHOSTS_GROUP)) #define satosin(sa) ((struct sockaddr_in *)(sa)) #define sintosa(sin) ((struct sockaddr *)(sin)) From bms at FreeBSD.org Tue Mar 3 19:22:04 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Tue Mar 3 19:22:13 2009 Subject: svn commit: r189347 - head/sys/netinet Message-ID: <200903040322.n243M3mh030109@svn.freebsd.org> Author: bms Date: Wed Mar 4 03:22:03 2009 New Revision: 189347 URL: http://svn.freebsd.org/changeset/base/189347 Log: Merge header file definitions used by the new IGMPv3 implementation. This is a partial merge. Compatibility defines are retained for the existing IGMPv2 implementation. Modified: head/sys/netinet/igmp.h Modified: head/sys/netinet/igmp.h ============================================================================== --- head/sys/netinet/igmp.h Wed Mar 4 03:01:05 2009 (r189346) +++ head/sys/netinet/igmp.h Wed Mar 4 03:22:03 2009 (r189347) @@ -45,8 +45,11 @@ * MULTICAST Revision: 3.5.1.2 */ +/* Minimum length of any IGMP protocol message. */ +#define IGMP_MINLEN 8 + /* - * IGMP packet format. + * IGMPv1/v2 query and host report format. */ struct igmp { u_char igmp_type; /* version & type of IGMP message */ @@ -55,6 +58,9 @@ struct igmp { struct in_addr igmp_group; /* group address being reported */ }; /* (zero for queries) */ +/* + * IGMP v3 query format. + */ struct igmpv3 { u_char igmp_type; /* version & type of IGMP message */ u_char igmp_code; /* subtype for routing msgs */ @@ -66,6 +72,12 @@ struct igmpv3 { u_short igmp_numsrc; /* number of sources */ /*struct in_addr igmp_sources[1];*/ /* source addresses */ }; +#define IGMP_V3_QUERY_MINLEN 12 +#define IGMP_EXP(x) (((x) >> 4) & 0x07) +#define IGMP_MANT(x) ((x) & 0x0f) +#define IGMP_QRESV(x) (((x) >> 4) & 0x0f) +#define IGMP_SFLAG(x) (((x) >> 3) & 0x01) +#define IGMP_QRV(x) ((x) & 0x07) struct igmp_grouprec { u_char ig_type; /* record type */ @@ -74,58 +86,76 @@ struct igmp_grouprec { struct in_addr ig_group; /* group address being reported */ /*struct in_addr ig_sources[1];*/ /* source addresses */ }; +#define IGMP_GRPREC_HDRLEN 8 +/* + * IGMPv3 host membership report header. + */ struct igmp_report { - u_char ir_type; /* record type */ - u_char ir_rsv1; /* reserved */ + u_char ir_type; /* IGMP_v3_HOST_MEMBERSHIP_REPORT */ + u_char ir_rsv1; /* must be zero */ u_short ir_cksum; /* checksum */ - u_short ir_rsv2; /* reserved */ + u_short ir_rsv2; /* must be zero */ u_short ir_numgrps; /* number of group records */ - struct igmp_grouprec ir_groups[1]; /* group records */ + /*struct igmp_grouprec ir_groups[1];*/ /* group records */ }; - -#define IGMP_MINLEN 8 -#define IGMP_HDRLEN 8 -#define IGMP_GRPREC_HDRLEN 8 -#define IGMP_PREPEND 0 - -#if 0 -#define IGMP_QRV(pigmp) ((pigmp)->igmp_misc & (0x07)) /* XXX */ -#define IGMP_MAXSOURCES(len) (((len) - 12) >> 2) /* XXX */ -#endif +#define IGMP_V3_REPORT_MINLEN 8 +#define IGMP_V3_REPORT_MAXRECS 65535 /* * Message types, including version number. */ -#define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */ -#define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ -#define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ -#define IGMP_V2_LEAVE_GROUP 0x17 /* Leave-group message */ - +#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* membership query */ +#define IGMP_v1_HOST_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ #define IGMP_DVMRP 0x13 /* DVMRP routing message */ -#define IGMP_PIM 0x14 /* PIM routing message */ - -#define IGMP_MTRACE_RESP 0x1e /* traceroute resp.(to sender)*/ -#define IGMP_MTRACE 0x1f /* mcast traceroute messages */ +#define IGMP_PIM 0x14 /* PIM routing message */ +#define IGMP_v2_HOST_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ +#define IGMP_HOST_LEAVE_MESSAGE 0x17 /* Leave-group message */ +#define IGMP_MTRACE_REPLY 0x1e /* mtrace(8) reply */ +#define IGMP_MTRACE_QUERY 0x1f /* mtrace(8) probe */ +#define IGMP_v3_HOST_MEMBERSHIP_REPORT 0x22 /* Ver. 3 membership report */ -#define IGMP_V3_MEMBERSHIP_REPORT 0x22 /* Ver. 3 membership report */ +#ifndef BURN_BRIDGES +/* + * Legacy FreeBSD definitions for the above message types. + */ +#define IGMP_MEMBERSHIP_QUERY IGMP_HOST_MEMBERSHIP_QUERY +#define IGMP_V1_MEMBERSHIP_REPORT IGMP_v1_HOST_MEMBERSHIP_REPORT +#define IGMP_V2_MEMBERSHIP_REPORT IGMP_v2_HOST_MEMBERSHIP_REPORT +#define IGMP_MTRACE_RESP IGMP_MTRACE_REPLY +#define IGMP_MTRACE IGMP_MTRACE_QUERY +#define IGMP_V2_LEAVE_GROUP IGMP_HOST_LEAVE_MESSAGE +#define IGMP_V3_MEMBERSHIP_REPORT IGMP_v3_HOST_MEMBERSHIP_REPORT +#endif /* BURN_BRIDGES */ -#define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ - /* query (in seconds) according */ - /* to RFC1112 */ +/* + * IGMPv3 report modes. + */ +#define IGMP_DO_NOTHING 0 /* don't send a record */ +#define IGMP_MODE_IS_INCLUDE 1 /* MODE_IN */ +#define IGMP_MODE_IS_EXCLUDE 2 /* MODE_EX */ +#define IGMP_CHANGE_TO_INCLUDE_MODE 3 /* TO_IN */ +#define IGMP_CHANGE_TO_EXCLUDE_MODE 4 /* TO_EX */ +#define IGMP_ALLOW_NEW_SOURCES 5 /* ALLOW_NEW */ +#define IGMP_BLOCK_OLD_SOURCES 6 /* BLOCK_OLD */ +/* + * IGMPv3 query types. + */ +#define IGMP_V3_GENERAL_QUERY 1 +#define IGMP_V3_GROUP_QUERY 2 +#define IGMP_V3_GROUP_SOURCE_QUERY 3 -#define IGMP_TIMER_SCALE 10 /* denotes that the igmp code field */ - /* specifies time in 10th of seconds*/ +/* + * Maximum report interval for IGMP v1/v2 host membership reports [RFC 1112] + */ +#define IGMP_V1V2_MAX_RI 10 +#define IGMP_MAX_HOST_REPORT_DELAY IGMP_V1V2_MAX_RI /* - * The following four defininitions are for backwards compatibility. - * They should be removed as soon as all applications are updated to - * use the new constant names. + * IGMP_TIMER_SCALE denotes that the igmp code field specifies + * time in tenths of a second. */ -#define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY -#define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT -#define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT -#define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP +#define IGMP_TIMER_SCALE 10 #endif /* _NETINET_IGMP_H_ */ From das at FreeBSD.org Tue Mar 3 19:30:22 2009 From: das at FreeBSD.org (David Schultz) Date: Tue Mar 3 19:30:29 2009 Subject: svn commit: r189348 - head/lib/libc/gen Message-ID: <200903040330.n243ULV5030287@svn.freebsd.org> Author: das Date: Wed Mar 4 03:30:21 2009 New Revision: 189348 URL: http://svn.freebsd.org/changeset/base/189348 Log: Fix a file descriptor leak in fts_child(). Obtained from: NetBSD Modified: head/lib/libc/gen/fts.c Modified: head/lib/libc/gen/fts.c ============================================================================== --- head/lib/libc/gen/fts.c Wed Mar 4 03:22:03 2009 (r189347) +++ head/lib/libc/gen/fts.c Wed Mar 4 03:30:21 2009 (r189348) @@ -570,8 +570,10 @@ fts_children(sp, instr) if ((fd = _open(".", O_RDONLY, 0)) < 0) return (NULL); sp->fts_child = fts_build(sp, instr); - if (fchdir(fd)) + if (fchdir(fd)) { + (void)_close(fd); return (NULL); + } (void)_close(fd); return (sp->fts_child); } From das at FreeBSD.org Tue Mar 3 19:31:11 2009 From: das at FreeBSD.org (David Schultz) Date: Tue Mar 3 19:31:22 2009 Subject: svn commit: r189349 - head/include Message-ID: <200903040331.n243VAXr030342@svn.freebsd.org> Author: das Date: Wed Mar 4 03:31:10 2009 New Revision: 189349 URL: http://svn.freebsd.org/changeset/base/189349 Log: - Add getsubopt and mkdtemp to the POSIX.1-2008 namespace. - Add mkstemp to the POSIX.1-2008 and BSD namespaces. - Remove mktemp from the XSI namespace. Modified: head/include/stdlib.h Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Wed Mar 4 03:30:21 2009 (r189348) +++ head/include/stdlib.h Wed Mar 4 03:31:10 2009 (r189349) @@ -164,6 +164,18 @@ int setenv(const char *, const char *, int unsetenv(const char *); #endif +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE +int getsubopt(char **, char *const *, char **); +#ifndef _MKDTEMP_DECLARED +char *mkdtemp(char *); +#define _MKDTEMP_DECLARED +#endif +#ifndef _MKSTEMP_DECLARED +int mkstemp(char *); +#define _MKSTEMP_DECLARED +#endif +#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ + /* * The only changes to the XSI namespace in revision 6 were the deletion * of the ttyslot() and valloc() functions, which FreeBSD never declared @@ -178,18 +190,13 @@ double drand48(void); double erand48(unsigned short[3]); /* char *fcvt(double, int, int * __restrict, int * __restrict); */ /* char *gcvt(double, int, int * __restrict, int * __restrict); */ -int getsubopt(char **, char *const *, char **); int grantpt(int); char *initstate(unsigned long /* XSI requires u_int */, char *, long); long jrand48(unsigned short[3]); char *l64a(long); void lcong48(unsigned short[7]); long lrand48(void); -#ifndef _MKSTEMP_DECLARED -int mkstemp(char *); -#define _MKSTEMP_DECLARED -#endif -#ifndef _MKTEMP_DECLARED +#if !defined(_MKTEMP_DECLARED) && __XSI_VISIBLE <= 600 char *mktemp(char *); #define _MKTEMP_DECLARED #endif From das at FreeBSD.org Tue Mar 3 19:31:52 2009 From: das at FreeBSD.org (David Schultz) Date: Tue Mar 3 19:31:59 2009 Subject: svn commit: r189350 - head/include Message-ID: <200903040331.n243Vpmn030392@svn.freebsd.org> Author: das Date: Wed Mar 4 03:31:51 2009 New Revision: 189350 URL: http://svn.freebsd.org/changeset/base/189350 Log: - Remove bcmp, bcopy, bzero, index, and rindex from the POSIX.1-2008 namespace. - Add ffs to the XSI namespace. Modified: head/include/strings.h Modified: head/include/strings.h ============================================================================== --- head/include/strings.h Wed Mar 4 03:31:10 2009 (r189349) +++ head/include/strings.h Wed Mar 4 03:31:51 2009 (r189350) @@ -38,10 +38,14 @@ typedef __size_t size_t; #endif __BEGIN_DECLS +#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 int bcmp(const void *, const void *, size_t) __pure; /* LEGACY */ void bcopy(const void *, void *, size_t); /* LEGACY */ void bzero(void *, size_t); /* LEGACY */ +#endif +#if __XSI_VISIBLE int ffs(int) __pure2; +#endif #ifdef __BSD_VISIBLE int ffsl(long) __pure2; int ffsll(long long) __pure2; @@ -49,8 +53,10 @@ int fls(int) __pure2; int flsl(long) __pure2; int flsll(long long) __pure2; #endif +#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 char *index(const char *, int) __pure; /* LEGACY */ char *rindex(const char *, int) __pure; /* LEGACY */ +#endif int strcasecmp(const char *, const char *) __pure; int strncasecmp(const char *, const char *, size_t) __pure; __END_DECLS From das at FreeBSD.org Tue Mar 3 19:32:29 2009 From: das at FreeBSD.org (David Schultz) Date: Tue Mar 3 19:32:36 2009 Subject: svn commit: r189351 - head/include Message-ID: <200903040332.n243WS9D030446@svn.freebsd.org> Author: das Date: Wed Mar 4 03:32:28 2009 New Revision: 189351 URL: http://svn.freebsd.org/changeset/base/189351 Log: - Add getsid, fchdir, getpgid, lchown, pread, pwrite, truncate, *at, and fexecve to the POSIX.1-2008 namespace. - Remove getwd, ualarm, usleep, and vfork from the XSI namespace. - Remove mkdtemp from the POSIX.1-2008 namespace (should be in stdlib.h). Modified: head/include/unistd.h Modified: head/include/unistd.h ============================================================================== --- head/include/unistd.h Wed Mar 4 03:31:51 2009 (r189350) +++ head/include/unistd.h Wed Mar 4 03:32:28 2009 (r189351) @@ -413,6 +413,33 @@ int setegid(gid_t); int seteuid(uid_t); #endif +/* 1003.1-2008 */ +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE +int getsid(pid_t _pid); +int fchdir(int); +int getpgid(pid_t _pid); +int lchown(const char *, uid_t, gid_t); +ssize_t pread(int, void *, size_t, off_t); +ssize_t pwrite(int, const void *, size_t, off_t); + +/* See comment at ftruncate() above. */ +#ifndef _TRUNCATE_DECLARED +#define _TRUNCATE_DECLARED +int truncate(const char *, off_t); +#endif +#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ + +#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +int faccessat(int, const char *, int, int); +int fchmodat(int, const char *, mode_t, int); +int fchownat(int, const char *, uid_t, gid_t, int); +int fexecve(int, char *const [], char *const []); +int linkat(int, const char *, int, const char *, int); +ssize_t readlinkat(int, const char * __restrict, char * __restrict, size_t); +int symlinkat(const char *, int, const char *); +int unlinkat(int, const char *, int); +#endif /* __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE */ + /* * symlink() was originally in POSIX.1a, which was withdrawn after * being overtaken by events (1003.1-2001). It was in XPG4.2, and of @@ -427,16 +454,9 @@ int symlink(const char * __restrict, co char *crypt(const char *, const char *); /* char *ctermid(char *); */ /* XXX ??? */ int encrypt(char *, int); -int fchdir(int); long gethostid(void); -int getpgid(pid_t _pid); -int getsid(pid_t _pid); -char *getwd(char *); /* LEGACY: obsoleted by getcwd() */ -int lchown(const char *, uid_t, gid_t); int lockf(int, int, off_t); int nice(int); -ssize_t pread(int, void *, size_t, off_t); -ssize_t pwrite(int, const void *, size_t, off_t); int setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */ int setregid(gid_t, gid_t); int setreuid(uid_t, uid_t); @@ -447,15 +467,7 @@ void swab(const void * __restrict, void #endif /* _SWAB_DECLARED */ void sync(void); -useconds_t ualarm(useconds_t, useconds_t); -int usleep(useconds_t); -pid_t vfork(void); -/* See comment at ftruncate() above. */ -#ifndef _TRUNCATE_DECLARED -#define _TRUNCATE_DECLARED -int truncate(const char *, off_t); -#endif #endif /* __XSI_VISIBLE */ #if __XSI_VISIBLE <= 500 || __BSD_VISIBLE @@ -467,6 +479,14 @@ char *getpass(const char *); void *sbrk(intptr_t); #endif +#if __XSI_VISIBLE <= 600 || __BSD_VISIBLE +char *getwd(char *); /* obsoleted by getcwd() */ +useconds_t + ualarm(useconds_t, useconds_t); +int usleep(useconds_t); +pid_t vfork(void); +#endif + #if __BSD_VISIBLE struct timeval; /* select(2) */ int acct(const char *); @@ -494,7 +514,10 @@ int initgroups(const char *, gid_t); int iruserok(unsigned long, int, const char *, const char *); int iruserok_sa(const void *, int, int, const char *, const char *); int issetugid(void); +#ifndef _MKDTEMP_DECLARED char *mkdtemp(char *); +#define _MKDTEMP_DECLARED +#endif #ifndef _MKNOD_DECLARED int mknod(const char *, mode_t, dev_t); #define _MKNOD_DECLARED @@ -560,17 +583,6 @@ void *valloc(size_t); /* obsoleted by extern int optreset; /* getopt(3) external variable */ #endif #endif /* __BSD_VISIBLE */ - -#if __BSD_VISIBLE -int faccessat(int, const char *, int, int); -int fchmodat(int, const char *, mode_t, int); -int fchownat(int, const char *, uid_t, gid_t, int); -int fexecve(int, char *const [], char *const []); -int linkat(int, const char *, int, const char *, int); -ssize_t readlinkat(int, const char * __restrict, char * __restrict, size_t); -int symlinkat(const char *, int, const char *); -int unlinkat(int, const char *, int); -#endif /* __BSD_VISIBLE */ __END_DECLS #endif /* !_UNISTD_H_ */ From das at FreeBSD.org Tue Mar 3 19:32:57 2009 From: das at FreeBSD.org (David Schultz) Date: Tue Mar 3 19:33:09 2009 Subject: svn commit: r189352 - head/include Message-ID: <200903040332.n243WuGm030489@svn.freebsd.org> Author: das Date: Wed Mar 4 03:32:56 2009 New Revision: 189352 URL: http://svn.freebsd.org/changeset/base/189352 Log: Add psignal to the POSIX.1-2008 namespace. Modified: head/include/signal.h Modified: head/include/signal.h ============================================================================== --- head/include/signal.h Wed Mar 4 03:32:28 2009 (r189351) +++ head/include/signal.h Wed Mar 4 03:32:56 2009 (r189352) @@ -95,6 +95,10 @@ int sigpause(int); int siginterrupt(int, int); #endif +#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +void psignal(unsigned int, const char *); +#endif + #if __BSD_VISIBLE int sigblock(int); struct __ucontext; /* XXX spec requires a complete declaration. */ @@ -102,7 +106,6 @@ int sigreturn(const struct __ucontext *) int sigsetmask(int); int sigstack(const struct sigstack *, struct sigstack *); int sigvec(int, struct sigvec *, struct sigvec *); -void psignal(unsigned int, const char *); #endif __END_DECLS From das at FreeBSD.org Tue Mar 3 19:33:22 2009 From: das at FreeBSD.org (David Schultz) Date: Tue Mar 3 19:33:33 2009 Subject: svn commit: r189353 - head/sys/sys Message-ID: <200903040333.n243XLuv030551@svn.freebsd.org> Author: das Date: Wed Mar 4 03:33:21 2009 New Revision: 189353 URL: http://svn.freebsd.org/changeset/base/189353 Log: Add openat to the POSIX.1-2008 namespace. Modified: head/sys/sys/fcntl.h Modified: head/sys/sys/fcntl.h ============================================================================== --- head/sys/sys/fcntl.h Wed Mar 4 03:32:56 2009 (r189352) +++ head/sys/sys/fcntl.h Wed Mar 4 03:33:21 2009 (r189353) @@ -278,7 +278,9 @@ __BEGIN_DECLS int open(const char *, int, ...); int creat(const char *, mode_t); int fcntl(int, int, ...); +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 int openat(int, const char *, int, ...); +#endif #if __BSD_VISIBLE int flock(int, int); #endif From das at FreeBSD.org Tue Mar 3 19:33:39 2009 From: das at FreeBSD.org (David Schultz) Date: Tue Mar 3 19:33:50 2009 Subject: svn commit: r189354 - head/sys/sys Message-ID: <200903040333.n243Xcf3030593@svn.freebsd.org> Author: das Date: Wed Mar 4 03:33:38 2009 New Revision: 189354 URL: http://svn.freebsd.org/changeset/base/189354 Log: Add *at to the POSIX.1-2008 namespace. Modified: head/sys/sys/stat.h Modified: head/sys/sys/stat.h ============================================================================== --- head/sys/sys/stat.h Wed Mar 4 03:33:21 2009 (r189353) +++ head/sys/sys/stat.h Wed Mar 4 03:33:38 2009 (r189354) @@ -330,7 +330,7 @@ int mknod(const char *, mode_t, dev_t); #endif int stat(const char * __restrict, struct stat * __restrict); mode_t umask(mode_t); -#if __BSD_VISIBLE +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 int fstatat(int, const char *, struct stat *, int); int mkdirat(int, const char *, mode_t); int mkfifoat(int, const char *, mode_t); From das at FreeBSD.org Tue Mar 3 19:35:04 2009 From: das at FreeBSD.org (David Schultz) Date: Tue Mar 3 19:35:10 2009 Subject: svn commit: r189355 - head/include Message-ID: <200903040335.n243Z3On030671@svn.freebsd.org> Author: das Date: Wed Mar 4 03:35:03 2009 New Revision: 189355 URL: http://svn.freebsd.org/changeset/base/189355 Log: Add renameat to the POSIX.1-2008 namespace. Modified: head/include/stdio.h Modified: head/include/stdio.h ============================================================================== --- head/include/stdio.h Wed Mar 4 03:33:38 2009 (r189354) +++ head/include/stdio.h Wed Mar 4 03:35:03 2009 (r189355) @@ -344,6 +344,7 @@ char *tempnam(const char *, const char * #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 ssize_t getdelim(char ** __restrict, size_t * __restrict, int, FILE * __restrict); +int renameat(int, const char *, int, const char *); /* * Every programmer and his dog wrote functions called getline() @@ -379,7 +380,6 @@ void fcloseall(void); char *fgetln(FILE *, size_t *); __const char *fmtcheck(const char *, const char *) __format_arg(2); int fpurge(FILE *); -int renameat(int, const char *, int, const char *); void setbuffer(FILE *, char *, int); int setlinebuf(FILE *); int vasprintf(char **, const char *, __va_list) From das at FreeBSD.org Tue Mar 3 19:38:52 2009 From: das at FreeBSD.org (David Schultz) Date: Tue Mar 3 19:39:04 2009 Subject: svn commit: r189356 - in head: include lib/libc/stdio Message-ID: <200903040338.n243cp0Q030779@svn.freebsd.org> Author: das Date: Wed Mar 4 03:38:51 2009 New Revision: 189356 URL: http://svn.freebsd.org/changeset/base/189356 Log: Add dprintf() and vdprintf() from POSIX.1-2008. Like getline(), dprintf() is a simple wrapper around another function, so we may as well implement it. But also like getline(), we can't prototype it by default right now because it would break too many ports. Added: head/lib/libc/stdio/dprintf.c (contents, props changed) head/lib/libc/stdio/vdprintf.c (contents, props changed) Modified: head/include/stdio.h head/lib/libc/stdio/Makefile.inc head/lib/libc/stdio/Symbol.map head/lib/libc/stdio/printf.3 head/lib/libc/stdio/stdio.3 Modified: head/include/stdio.h ============================================================================== --- head/include/stdio.h Wed Mar 4 03:35:03 2009 (r189355) +++ head/include/stdio.h Wed Mar 4 03:38:51 2009 (r189356) @@ -345,12 +345,14 @@ char *tempnam(const char *, const char * ssize_t getdelim(char ** __restrict, size_t * __restrict, int, FILE * __restrict); int renameat(int, const char *, int, const char *); +int vdprintf(int, const char * __restrict, __va_list); /* - * Every programmer and his dog wrote functions called getline() - * before POSIX.1-2008 came along and decided to usurp the name, so we - * don't prototype getline() by default unless one of the following is true: - * a) the app has requested it specifically by defining _WITH_GETLINE + * Every programmer and his dog wrote functions called getline() and dprintf() + * before POSIX.1-2008 came along and decided to usurp the names, so we + * don't prototype them by default unless one of the following is true: + * a) the app has requested them specifically by defining _WITH_GETLINE or + * _WITH_DPRINTF, respectively * b) the app has requested a POSIX.1-2008 environment via _POSIX_C_SOURCE * c) the app defines a GNUism such as _BSD_SOURCE or _GNU_SOURCE */ @@ -368,6 +370,20 @@ int renameat(int, const char *, int, co ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict); #endif +#ifndef _WITH_DPRINTF +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#define _WITH_DPRINTF +#elif defined(_POSIX_C_SOURCE) +#if _POSIX_C_SOURCE > 200809 +#define _WITH_DPRINTF +#endif +#endif +#endif + +#ifdef _WITH_DPRINTF +int dprintf(int, const char * __restrict, ...); +#endif + #endif /* __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 */ /* Modified: head/lib/libc/stdio/Makefile.inc ============================================================================== --- head/lib/libc/stdio/Makefile.inc Wed Mar 4 03:35:03 2009 (r189355) +++ head/lib/libc/stdio/Makefile.inc Wed Mar 4 03:38:51 2009 (r189356) @@ -4,7 +4,8 @@ # stdio sources .PATH: ${.CURDIR}/stdio -SRCS+= _flock_stub.c asprintf.c clrerr.c fclose.c fcloseall.c fdopen.c \ +SRCS+= _flock_stub.c asprintf.c clrerr.c dprintf.c \ + fclose.c fcloseall.c fdopen.c \ feof.c ferror.c fflush.c fgetc.c fgetln.c fgetpos.c fgets.c fgetwc.c \ fgetwln.c fgetws.c \ fileno.c findfp.c flags.c fopen.c fprintf.c fpurge.c fputc.c fputs.c \ @@ -17,7 +18,7 @@ SRCS+= _flock_stub.c asprintf.c clrerr.c refill.c remove.c rewind.c rget.c scanf.c setbuf.c setbuffer.c \ setvbuf.c snprintf.c sprintf.c sscanf.c stdio.c swprintf.c swscanf.c \ tempnam.c tmpfile.c \ - tmpnam.c ungetc.c ungetwc.c vasprintf.c vfprintf.c \ + tmpnam.c ungetc.c ungetwc.c vasprintf.c vdprintf.c vfprintf.c \ vfscanf.c \ vfwprintf.c vfwscanf.c vprintf.c vscanf.c vsnprintf.c vsprintf.c \ vsscanf.c \ @@ -57,9 +58,9 @@ 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+=printf.3 asprintf.3 printf.3 fprintf.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 vasprintf.3 printf.3 vdprintf.3 \ printf.3 vfprintf.3 printf.3 vprintf.3 printf.3 vsnprintf.3 \ printf.3 vsprintf.3 MLINKS+=putc.3 fputc.3 putc.3 putc_unlocked.3 putc.3 putchar.3 \ Modified: head/lib/libc/stdio/Symbol.map ============================================================================== --- head/lib/libc/stdio/Symbol.map Wed Mar 4 03:35:03 2009 (r189355) +++ head/lib/libc/stdio/Symbol.map Wed Mar 4 03:38:51 2009 (r189356) @@ -111,8 +111,10 @@ FBSD_1.0 { }; FBSD_1.1 { + dprintf; getdelim; getline; + vdprintf; }; FBSDprivate_1.0 { Added: head/lib/libc/stdio/dprintf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdio/dprintf.c Wed Mar 4 03:38:51 2009 (r189356) @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2009 David Schultz + * 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$"); + +#define _WITH_DPRINTF +#include "namespace.h" +#include +#include +#include "un-namespace.h" + +int +dprintf(int fd, const char * __restrict fmt, ...) +{ + va_list ap; + int ret; + + va_start(ap, fmt); + ret = vdprintf(fd, fmt, ap); + va_end(ap); + return (ret); +} Modified: head/lib/libc/stdio/printf.3 ============================================================================== --- head/lib/libc/stdio/printf.3 Wed Mar 4 03:35:03 2009 (r189355) +++ head/lib/libc/stdio/printf.3 Wed Mar 4 03:38:51 2009 (r189356) @@ -32,16 +32,17 @@ .\" @(#)printf.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd October 16, 2004 +.Dd March 3, 2009 .Dt PRINTF 3 .Os .Sh NAME -.Nm printf , fprintf , sprintf , snprintf , asprintf , -.Nm vprintf , vfprintf, vsprintf , vsnprintf , vasprintf +.Nm printf , fprintf , sprintf , snprintf , asprintf , dprintf , +.Nm vprintf , vfprintf, vsprintf , vsnprintf , vasprintf, vdprintf .Nd formatted output conversion .Sh LIBRARY .Lb libc .Sh SYNOPSIS +.Fd "#define _WITH_DPRINTF" .In stdio.h .Ft int .Fn printf "const char * restrict format" ... @@ -53,6 +54,8 @@ .Fn snprintf "char * restrict str" "size_t size" "const char * restrict format" ... .Ft int .Fn asprintf "char **ret" "const char *format" ... +.Ft int +.Fn dprintf "int" "const char * restrict format" ... .In stdarg.h .Ft int .Fn vprintf "const char * restrict format" "va_list ap" @@ -64,6 +67,8 @@ .Fn vsnprintf "char * restrict str" "size_t size" "const char * restrict format" "va_list ap" .Ft int .Fn vasprintf "char **ret" "const char *format" "va_list ap" +.Ft int +.Fn vdprintf "int fd" "const char * restrict format" "va_list ap" .Sh DESCRIPTION The .Fn printf @@ -83,6 +88,10 @@ and .Fn vfprintf write output to the given output .Fa stream ; +.Fn dprintf +and +.Fn vdprintf +write output to the given file descriptor; .Fn sprintf , .Fn snprintf , .Fn vsprintf , @@ -771,6 +780,57 @@ for later interpolation by Always use the proper secure idiom: .Pp .Dl "snprintf(buffer, sizeof(buffer), \*q%s\*q, string);" +.Sh COMPATIBILITY +Many application writers used the name +.Va dprintf +before the +.Fn dprintf +function was introduced in +.St -p1003.1 , +so a prototype is not provided by default in order to avoid +compatibility problems. +Applications that wish to use the +.Fn dprintf +function described herein should either request a strict +.St -p1003.1-2008 +environment by defining the macro +.Dv _POSIX_C_SOURCE +to the value 200809 or greater, or by defining the macro +.Dv _WITH_DPRINTF , +prior to the inclusion of +.In stdio.h . +For compatibility with GNU libc, defining either +.Dv _BSD_SOURCE +or +.Dv _GNU_SOURCE +prior to the inclusion of +.In stdio.h +will also make +.Fn dprintf +available. +.Pp +The conversion formats +.Cm \&%D , \&%O , +and +.Cm %U +are not standard and +are provided only for backward compatibility. +The effect of padding the +.Cm %p +format with zeros (either by the +.Cm 0 +flag or by specifying a precision), and the benign effect (i.e., none) +of the +.Cm # +flag on +.Cm %n +and +.Cm %p +conversions, as well as other +nonsensical combinations such as +.Cm %Ld , +are not standard; such combinations +should be avoided. .Sh ERRORS In addition to the errors documented for the .Xr write 2 @@ -810,7 +870,13 @@ With the same reservation, the and .Fn vsnprintf functions conform to -.St -isoC-99 . +.St -isoC-99 , +while +.Fn dprintf +and +.Fn vdprintf +conform to +.St -p1003.1-2008 . .Sh HISTORY The functions .Fn asprintf @@ -828,30 +894,13 @@ from .An Todd C. Miller Aq Todd.Miller@courtesan.com for .Ox 2.3 . -.Sh BUGS -The conversion formats -.Cm \&%D , \&%O , -and -.Cm %U -are not standard and -are provided only for backward compatibility. -The effect of padding the -.Cm %p -format with zeros (either by the -.Cm 0 -flag or by specifying a precision), and the benign effect (i.e., none) -of the -.Cm # -flag on -.Cm %n +The +.Fn dprintf and -.Cm %p -conversions, as well as other -nonsensical combinations such as -.Cm %Ld , -are not standard; such combinations -should be avoided. -.Pp +.Fn vdprintf +functions were added in +.Fx 8.0 . +.Sh BUGS The .Nm family of functions do not correctly handle multibyte characters in the Modified: head/lib/libc/stdio/stdio.3 ============================================================================== --- head/lib/libc/stdio/stdio.3 Wed Mar 4 03:35:03 2009 (r189355) +++ head/lib/libc/stdio/stdio.3 Wed Mar 4 03:38:51 2009 (r189356) @@ -28,7 +28,7 @@ .\" @(#)stdio.3 8.7 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd February 28, 2009 +.Dd March 3, 2009 .Dt STDIO 3 .Os .Sh NAME @@ -243,6 +243,7 @@ library conforms to .It Sy "Function Description" .It "asprintf formatted output conversion" .It "clearerr check and reset stream status" +.It "dprintf formatted output conversion" .It "fclose close a stream" .It "fdopen stream open functions" .It "feof check and reset stream status" @@ -313,6 +314,7 @@ library conforms to .It "ungetc un-get character from input stream" .It "ungetwc un-get wide character from input stream" .It "vasprintf formatted output conversion" +.It "vdprintf formatted output conversion" .It "vfprintf formatted output conversion" .It "vfscanf input format conversion" .It "vfwprintf formatted wide character output conversion" Added: head/lib/libc/stdio/vdprintf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdio/vdprintf.c Wed Mar 4 03:38:51 2009 (r189356) @@ -0,0 +1,66 @@ +/*- + * Copyright (c) 2009 David Schultz + * 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 "un-namespace.h" + +#include "local.h" + +int +vdprintf(int fd, const char * __restrict fmt, va_list ap) +{ + FILE f; + unsigned char buf[BUFSIZ]; + int ret; + + if (fd > SHRT_MAX) { + errno = EMFILE; + return (EOF); + } + + f._p = buf; + f._w = sizeof(buf); + f._flags = __SWR; + f._file = fd; + f._cookie = &f; + f._write = __swrite; + f._bf._base = buf; + f._bf._size = sizeof(buf); + f._orientation = 0; + bzero(&f._mbstate, sizeof(f._mbstate)); + + if ((ret = __vfprintf(&f, fmt, ap)) < 0) + return (ret); + + return (__fflush(&f) ? EOF : ret); +} From bms at FreeBSD.org Tue Mar 3 19:40:03 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Tue Mar 3 19:40:10 2009 Subject: svn commit: r189357 - head/sys/netinet Message-ID: <200903040340.n243e3sm030858@svn.freebsd.org> Author: bms Date: Wed Mar 4 03:40:02 2009 New Revision: 189357 URL: http://svn.freebsd.org/changeset/base/189357 Log: Add sysctl net.inet.ip.mcast.loop. This controls whether or not IPv4 multicast sends are looped back to senders by default on a stack-wide basis, rather than relying on the socket option. Note that the sysctl only applies to newly created multicast sockets. Modified: head/sys/netinet/in_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Wed Mar 4 03:38:51 2009 (r189356) +++ head/sys/netinet/in_mcast.c Wed Mar 4 03:40:02 2009 (r189357) @@ -121,6 +121,13 @@ static int inp_leave_group(struct inpcb static int inp_set_multicast_if(struct inpcb *, struct sockopt *); static int inp_set_source_filters(struct inpcb *, struct sockopt *); +SYSCTL_NODE(_net_inet_ip, OID_AUTO, mcast, CTLFLAG_RW, 0, "IPv4 multicast"); + +int in_mcast_loop = IP_DEFAULT_MULTICAST_LOOP; +SYSCTL_INT(_net_inet_ip_mcast, OID_AUTO, loop, CTLFLAG_RW | CTLFLAG_TUN, + &in_mcast_loop, 0, "Loopback multicast datagrams by default"); +TUNABLE_INT("net.inet.ip.mcast.loop", &in_mcast_loop); + /* * Resize the ip_moptions vector to the next power-of-two minus 1. * May be called with locks held; do not sleep. @@ -695,7 +702,7 @@ inp_findmoptions(struct inpcb *inp) imo->imo_multicast_addr.s_addr = INADDR_ANY; imo->imo_multicast_vif = -1; imo->imo_multicast_ttl = IP_DEFAULT_MULTICAST_TTL; - imo->imo_multicast_loop = IP_DEFAULT_MULTICAST_LOOP; + imo->imo_multicast_loop = in_mcast_loop; imo->imo_num_memberships = 0; imo->imo_max_memberships = IP_MIN_MEMBERSHIPS; imo->imo_membership = immp; From das at FreeBSD.org Tue Mar 3 19:45:03 2009 From: das at FreeBSD.org (David Schultz) Date: Tue Mar 3 19:45:14 2009 Subject: svn commit: r189358 - in head/contrib/gdtoa: . test Message-ID: <200903040345.n243j2Y5030991@svn.freebsd.org> Author: das Date: Wed Mar 4 03:45:02 2009 New Revision: 189358 URL: http://svn.freebsd.org/changeset/base/189358 Log: Remove some unused vendor files. Deleted: head/contrib/gdtoa/test/ head/contrib/gdtoa/xsum0.out From bms at FreeBSD.org Tue Mar 3 19:45:36 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Tue Mar 3 19:45:42 2009 Subject: svn commit: r189359 - head/sys/netinet Message-ID: <200903040345.n243jZsQ031038@svn.freebsd.org> Author: bms Date: Wed Mar 4 03:45:34 2009 New Revision: 189359 URL: http://svn.freebsd.org/changeset/base/189359 Log: In ip_output(), do not acquire the IN_MULTI_LOCK(), and do not attempt to perform a group lookup. This is a socket layer lock, and the bottom half of IP really has no business taking it. Use the value of the in_mcast_loop sysctl to determine if we should loop back by default, in the absence of any multicast socket options. Because the check on group membership is now deferred to the input path, an m_copym() is now required. This should increase multicast send performance where the source has not requested loopback, although this has not been benchmarked or measured. It is also a necessary change for IN_MULTI_LOCK to become non-recursive, which is required in order to implement IGMPv3 in a thread-safe way. Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Wed Mar 4 03:45:02 2009 (r189358) +++ head/sys/netinet/ip_output.c Wed Mar 4 03:45:34 2009 (r189359) @@ -112,6 +112,7 @@ static void ip_mloopback (struct ifnet *, struct mbuf *, struct sockaddr_in *, int); +extern int in_mcast_loop; extern struct protosw inetsw[]; /* @@ -293,8 +294,6 @@ again: mtu = ifp->if_mtu; } if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { - struct in_multi *inm; - m->m_flags |= M_MCAST; /* * IP destination address is multicast. Make sure "dst" @@ -334,20 +333,17 @@ again: ip->ip_src = IA_SIN(ia)->sin_addr; } - IN_MULTI_LOCK(); - IN_LOOKUP_MULTI(ip->ip_dst, ifp, inm); - if (inm != NULL && - (imo == NULL || imo->imo_multicast_loop)) { - IN_MULTI_UNLOCK(); + if ((imo == NULL && in_mcast_loop) || + (imo && imo->imo_multicast_loop)) { /* - * If we belong to the destination multicast group - * on the outgoing interface, and the caller did not - * forbid loopback, loop back a copy. + * Loop back multicast datagram if not expressly + * forbidden to do so, even if we are not a member + * of the group; ip_input() will filter it later, + * thus deferring a hash lookup and mutex acquisition + * at the expense of a cheap copy using m_copym(). */ ip_mloopback(ifp, m, dst, hlen); - } - else { - IN_MULTI_UNLOCK(); + } else { /* * If we are acting as a multicast router, perform * multicast forwarding as if the packet had just @@ -382,8 +378,9 @@ again: * back, above, but must not be transmitted on a network. * Also, multicasts addressed to the loopback interface * are not sent -- the above call to ip_mloopback() will - * loop back a copy if this host actually belongs to the - * destination group on the loopback interface. + * loop back a copy. ip_input() will drop the copy if + * this host does not belong to the destination group on + * the loopback interface. */ if (ip->ip_ttl == 0 || ifp->if_flags & IFF_LOOPBACK) { m_freem(m); @@ -758,7 +755,7 @@ smart_frag_failure: /* * In the first mbuf, leave room for the link header, then * copy the original IP header including options. The payload - * goes into an additional mbuf chain returned by m_copy(). + * goes into an additional mbuf chain returned by m_copym(). */ m->m_data += max_linkhdr; mhip = mtod(m, struct ip *); @@ -777,7 +774,7 @@ smart_frag_failure: } else mhip->ip_off |= IP_MF; mhip->ip_len = htons((u_short)(len + mhlen)); - m->m_next = m_copy(m0, off, len); + m->m_next = m_copym(m0, off, len, M_DONTWAIT); if (m->m_next == NULL) { /* copy failed */ m_free(m); error = ENOBUFS; /* ??? */ From thompsa at FreeBSD.org Tue Mar 3 19:47:58 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Tue Mar 3 19:48:09 2009 Subject: svn commit: r189360 - in head: share/man/man4 sys/dev/usb sys/dev/usb/serial Message-ID: <200903040347.n243lvm6031111@svn.freebsd.org> Author: thompsa Date: Wed Mar 4 03:47:57 2009 New Revision: 189360 URL: http://svn.freebsd.org/changeset/base/189360 Log: Add Mobile Action MA-620 Infrared Adapter. PR: usb/125072 Submitted by: Alexander Logvinov MFC after: 1 week Modified: head/share/man/man4/uplcom.4 head/sys/dev/usb/serial/uplcom.c head/sys/dev/usb/usbdevs Modified: head/share/man/man4/uplcom.4 ============================================================================== --- head/share/man/man4/uplcom.4 Wed Mar 4 03:45:34 2009 (r189359) +++ head/share/man/man4/uplcom.4 Wed Mar 4 03:47:57 2009 (r189360) @@ -98,6 +98,8 @@ I/O DATA USB-RSAQ2 .It I/O DATA USB-RSAQ3 .It +Mobile Action MA-620 Infrared Adapter +.It PLANEX USB-RS232 URS-03 .It RATOC REX-USB60 Modified: head/sys/dev/usb/serial/uplcom.c ============================================================================== --- head/sys/dev/usb/serial/uplcom.c Wed Mar 4 03:45:34 2009 (r189359) +++ head/sys/dev/usb/serial/uplcom.c Wed Mar 4 03:47:57 2009 (r189360) @@ -274,6 +274,9 @@ static const struct usb2_device_id uplco {USB_UPL(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PHAROS, 0, 0xFFFF, TYPE_PL2303)}, /* Willcom W-SIM */ {USB_UPL(USB_VENDOR_PROLIFIC2, USB_PRODUCT_PROLIFIC2_WSIM, 0, 0xFFFF, TYPE_PL2303X)}, + /* Mobile Action MA-620 Infrared Adapter */ + {USB_UPL(USB_VENDOR_MOBILEACTION, USB_PRODUCT_MOBILEACTION_MA620, 0, 0xFFFF, TYPE_PL2303X)}, + }; static device_method_t uplcom_methods[] = { Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Wed Mar 4 03:45:34 2009 (r189359) +++ head/sys/dev/usb/usbdevs Wed Mar 4 03:47:57 2009 (r189360) @@ -1767,6 +1767,9 @@ product MITSUMI CDRRW 0x0000 CD-R/RW Dr product MITSUMI BT_DONGLE 0x641f Bluetooth USB dongle product MITSUMI FDD 0x6901 USB FDD +/* Mobile Action products */ +product MOBILEACTION MA620 0x0620 MA-620 Infrared Adapter + /* Mobility products */ product MOBILITY EA 0x0204 Ethernet product MOBILITY EASIDOCK 0x0304 EasiDock Ethernet From das at FreeBSD.org Tue Mar 3 22:01:28 2009 From: das at FreeBSD.org (David Schultz) Date: Tue Mar 3 22:01:35 2009 Subject: svn commit: r189361 - in head: include lib/libc/string Message-ID: <200903040601.n2461RCf033543@svn.freebsd.org> Author: das Date: Wed Mar 4 06:01:27 2009 New Revision: 189361 URL: http://svn.freebsd.org/changeset/base/189361 Log: Add wcpcpy(3) and wcpncpy(3). Added: head/lib/libc/string/wcpcpy.c (contents, props changed) - copied, changed from r189360, head/lib/libc/string/stpcpy.c head/lib/libc/string/wcpncpy.c (contents, props changed) - copied, changed from r189360, head/lib/libc/string/stpncpy.c Modified: head/include/wchar.h head/lib/libc/string/Makefile.inc head/lib/libc/string/Symbol.map head/lib/libc/string/wmemchr.3 Modified: head/include/wchar.h ============================================================================== --- head/include/wchar.h Wed Mar 4 03:47:57 2009 (r189360) +++ head/include/wchar.h Wed Mar 4 06:01:27 2009 (r189361) @@ -213,6 +213,8 @@ 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); +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; int wcscasecmp(const wchar_t *, const wchar_t *); int wcsncasecmp(const wchar_t *, const wchar_t *, size_t n); Modified: head/lib/libc/string/Makefile.inc ============================================================================== --- head/lib/libc/string/Makefile.inc Wed Mar 4 03:47:57 2009 (r189360) +++ head/lib/libc/string/Makefile.inc Wed Mar 4 06:01:27 2009 (r189361) @@ -14,7 +14,7 @@ MISRCS+=bcmp.c bcopy.c bzero.c ffs.c ffs strdup.c strerror.c strlcat.c strlcpy.c strlen.c strmode.c strncat.c \ strncmp.c strncpy.c strndup.c strnlen.c strnstr.c \ strpbrk.c strrchr.c strsep.c strsignal.c strspn.c strstr.c strtok.c \ - strxfrm.c swab.c wcscasecmp.c wcscat.c \ + strxfrm.c swab.c wcpcpy.c wcpncpy.c wcscasecmp.c wcscat.c \ wcschr.c wcscmp.c wcscoll.c wcscpy.c wcscspn.c wcsdup.c \ wcslcat.c wcslcpy.c wcslen.c wcsncasecmp.c wcsncat.c wcsncmp.c \ wcsncpy.c wcsnlen.c wcspbrk.c \ @@ -61,7 +61,9 @@ MLINKS+=strlen.3 strnlen.3 MLINKS+=strstr.3 strcasestr.3 \ strstr.3 strnstr.3 MLINKS+=strtok.3 strtok_r.3 -MLINKS+=wmemchr.3 wcscasecmp.3 \ +MLINKS+=wmemchr.3 wcpcpy.3 \ + wmemchr.3 wcpncpy.3 \ + wmemchr.3 wcscasecmp.3 \ wmemchr.3 wcscat.3 \ wmemchr.3 wcschr.3 \ wmemchr.3 wcscmp.3 \ Modified: head/lib/libc/string/Symbol.map ============================================================================== --- head/lib/libc/string/Symbol.map Wed Mar 4 03:47:57 2009 (r189360) +++ head/lib/libc/string/Symbol.map Wed Mar 4 06:01:27 2009 (r189361) @@ -84,6 +84,8 @@ FBSD_1.1 { stpncpy; strndup; strnlen; + wcpcpy; + wcpncpy; wcscasecmp; wcsncasecmp; wcsnlen; Copied and modified: head/lib/libc/string/wcpcpy.c (from r189360, head/lib/libc/string/stpcpy.c) ============================================================================== --- head/lib/libc/string/stpcpy.c Wed Mar 4 03:47:57 2009 (r189360, copy source) +++ head/lib/libc/string/wcpcpy.c Wed Mar 4 06:01:27 2009 (r189361) @@ -35,10 +35,10 @@ static char sccsid[] = "@(#)strcpy.c 8.1 #include __FBSDID("$FreeBSD$"); -#include +#include -char * -stpcpy(char * __restrict to, const char * __restrict from) +wchar_t * +wcpcpy(wchar_t * __restrict to, const wchar_t * __restrict from) { for (; (*to = *from); ++from, ++to); Copied and modified: head/lib/libc/string/wcpncpy.c (from r189360, head/lib/libc/string/stpncpy.c) ============================================================================== --- head/lib/libc/string/stpncpy.c Wed Mar 4 03:47:57 2009 (r189360, copy source) +++ head/lib/libc/string/wcpncpy.c Wed Mar 4 06:01:27 2009 (r189361) @@ -27,17 +27,17 @@ #include __FBSDID("$FreeBSD$"); -#include +#include -char * -stpncpy(char * __restrict dst, const char * __restrict src, size_t n) +wchar_t * +wcpncpy(wchar_t * __restrict dst, const wchar_t * __restrict src, size_t n) { for (; n--; dst++, src++) { if (!(*dst = *src)) { - char *ret = dst; + wchar_t *ret = dst; while (n--) - *++dst = '\0'; + *++dst = L'\0'; return (ret); } } Modified: head/lib/libc/string/wmemchr.3 ============================================================================== --- head/lib/libc/string/wmemchr.3 Wed Mar 4 03:47:57 2009 (r189360) +++ head/lib/libc/string/wmemchr.3 Wed Mar 4 06:01:27 2009 (r189361) @@ -35,7 +35,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 28, 2009 +.Dd March 4, 2009 .Dt WMEMCHR 3 .Os .Sh NAME @@ -44,6 +44,8 @@ .Nm wmemcpy , .Nm wmemmove , .Nm wmemset , +.Nm wcpcpy , +.Nm wcpncpy , .Nm wcscasecmp , .Nm wcscat , .Nm wcschr , @@ -78,6 +80,10 @@ .Fn wmemmove "wchar_t *s1" "const wchar_t *s2" "size_t n" .Ft wchar_t * .Fn wmemset "wchar_t *s" "wchar_t c" "size_t n" +.Ft wchar_t * +.Fn wcpcpy "wchar_t *s1" "wchar_t *s2" +.Ft wchar_t * +.Fn wcpncpy "wchar_t *s1" "wchar_t *s2" "size_t n" .Ft int .Fn wcscasecmp "const wchar_t *s1" "const wchar_t *s2" .Ft wchar_t * @@ -128,6 +134,8 @@ counterpart, such as .Xr memcpy 3 , .Xr memmove 3 , .Xr memset 3 , +.Xr stpcpy 3 , +.Xr stpncpy 3 , .Xr strcasecmp 3 , .Xr strcat 3 , .Xr strchr 3 , @@ -150,6 +158,8 @@ counterpart, such as These functions conform to .St -isoC-99 , with the exception of +.Fn wcpcpy , +.Fn wcpncpy , .Fn wcscasecmp , .Fn wcsdup , .Fn wcsncasecmp , From dchagin at FreeBSD.org Wed Mar 4 04:14:35 2009 From: dchagin at FreeBSD.org (Dmitry Chagin) Date: Wed Mar 4 04:14:46 2009 Subject: svn commit: r189362 - in head/sys: amd64/linux32 compat/linux i386/linux Message-ID: <200903041214.n24CEXmG041836@svn.freebsd.org> Author: dchagin Date: Wed Mar 4 12:14:33 2009 New Revision: 189362 URL: http://svn.freebsd.org/changeset/base/189362 Log: Add AT_PLATFORM, AT_HWCAP and AT_CLKTCK auxiliary vector entries which are used by glibc. This silents the message "2.4+ kernel w/o ELF notes?" from some programs at start, among them are top and pkill. Do the assignment of the vector entries in elf_linux_fixup() as it is done in glibc. Fix some minor style issues. Submitted by: Marcin Cieslak Approved by: kib (mentor) MFC after: 1 week Modified: head/sys/amd64/linux32/linux.h head/sys/amd64/linux32/linux32_sysvec.c head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h head/sys/i386/linux/linux.h head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux32/linux.h ============================================================================== --- head/sys/amd64/linux32/linux.h Wed Mar 4 06:01:27 2009 (r189361) +++ head/sys/amd64/linux32/linux.h Wed Mar 4 12:14:33 2009 (r189362) @@ -108,6 +108,10 @@ typedef struct { #define LINUX_CTL_MAXNAME 10 +#define LINUX_AT_COUNT 16 /* Count of used aux entry types. + * Keep this synchronized with + * elf_linux_fixup() code. + */ struct l___sysctl_args { l_uintptr_t name; Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Wed Mar 4 06:01:27 2009 (r189361) +++ head/sys/amd64/linux32/linux32_sysvec.c Wed Mar 4 12:14:33 2009 (r189362) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -106,6 +107,8 @@ MALLOC_DEFINE(M_LINUX, "linux", "Linux m #define LINUX_SYS_linux_rt_sendsig 0 #define LINUX_SYS_linux_sendsig 0 +const char *linux_platform = "i686"; +static int linux_szplatform; extern char linux_sigcode[]; extern int linux_szsigcode; @@ -246,7 +249,12 @@ elf_linux_fixup(register_t **stack_base, { Elf32_Auxargs *args; Elf32_Addr *base; - Elf32_Addr *pos; + Elf32_Addr *pos, *uplatform; + struct linux32_ps_strings *arginfo; + + arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; + uplatform = (Elf32_Addr *)((caddr_t)arginfo - linux_szsigcode - + linux_szplatform); KASSERT(curthread->td_proc == imgp->proc, ("unsafe elf_linux_fixup(), should be curproc")); @@ -254,8 +262,8 @@ elf_linux_fixup(register_t **stack_base, args = (Elf32_Auxargs *)imgp->auxargs; pos = base + (imgp->args->argc + imgp->args->envc + 2); - if (args->execfd != -1) - AUXARGS_ENTRY_32(pos, AT_EXECFD, args->execfd); + AUXARGS_ENTRY_32(pos, LINUX_AT_HWCAP, cpu_feature); + AUXARGS_ENTRY_32(pos, LINUX_AT_CLKTCK, hz); AUXARGS_ENTRY_32(pos, AT_PHDR, args->phdr); AUXARGS_ENTRY_32(pos, AT_PHENT, args->phent); AUXARGS_ENTRY_32(pos, AT_PHNUM, args->phnum); @@ -263,10 +271,14 @@ elf_linux_fixup(register_t **stack_base, AUXARGS_ENTRY_32(pos, AT_FLAGS, args->flags); AUXARGS_ENTRY_32(pos, AT_ENTRY, args->entry); AUXARGS_ENTRY_32(pos, AT_BASE, args->base); + AUXARGS_ENTRY_32(pos, LINUX_AT_SECURE, 0); AUXARGS_ENTRY_32(pos, AT_UID, imgp->proc->p_ucred->cr_ruid); AUXARGS_ENTRY_32(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid); AUXARGS_ENTRY_32(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); AUXARGS_ENTRY_32(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); + AUXARGS_ENTRY_32(pos, LINUX_AT_PLATFORM, PTROUT(uplatform)); + if (args->execfd != -1) + AUXARGS_ENTRY_32(pos, AT_EXECFD, args->execfd); AUXARGS_ENTRY_32(pos, AT_NULL, 0); free(imgp->auxargs, M_TEMP); @@ -857,23 +869,27 @@ linux_copyout_strings(struct image_param char *stringp, *destp; u_int32_t *stack_base; struct linux32_ps_strings *arginfo; - int sigcodesz; /* * Calculate string base and vector table pointers. * Also deal with signal trampoline code for this exec type. */ arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; - sigcodesz = *(imgp->proc->p_sysent->sv_szsigcode); - destp = (caddr_t)arginfo - sigcodesz - SPARE_USRSPACE - - roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); + destp = (caddr_t)arginfo - linux_szsigcode - SPARE_USRSPACE - + linux_szplatform - roundup((ARG_MAX - imgp->args->stringspace), + sizeof(char *)); /* * install sigcode */ - if (sigcodesz) - copyout(imgp->proc->p_sysent->sv_sigcode, - ((caddr_t)arginfo - sigcodesz), sigcodesz); + copyout(imgp->proc->p_sysent->sv_sigcode, + ((caddr_t)arginfo - linux_szsigcode), linux_szsigcode); + + /* + * Install LINUX_PLATFORM + */ + copyout(linux_platform, ((caddr_t)arginfo - linux_szsigcode - + linux_szplatform), linux_szplatform); /* * If we have a valid auxargs ptr, prepare some room @@ -885,7 +901,7 @@ linux_copyout_strings(struct image_param * lower compatibility. */ imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size : - (AT_COUNT * 2); + (LINUX_AT_COUNT * 2); /* * The '+ 2' is for the null pointers at the end of each of * the arg and env vector sets,and imgp->auxarg_size is room @@ -919,14 +935,14 @@ linux_copyout_strings(struct image_param /* * Fill in "ps_strings" struct for ps, w, etc. */ - suword32(&arginfo->ps_argvstr, (u_int32_t)(intptr_t)vectp); + suword32(&arginfo->ps_argvstr, (uint32_t)(intptr_t)vectp); suword32(&arginfo->ps_nargvstr, argc); /* * Fill in argument portion of vector table. */ for (; argc > 0; --argc) { - suword32(vectp++, (u_int32_t)(intptr_t)destp); + suword32(vectp++, (uint32_t)(intptr_t)destp); while (*stringp++ != 0) destp++; destp++; @@ -935,14 +951,14 @@ linux_copyout_strings(struct image_param /* a null vector table pointer separates the argp's from the envp's */ suword32(vectp++, 0); - suword32(&arginfo->ps_envstr, (u_int32_t)(intptr_t)vectp); + suword32(&arginfo->ps_envstr, (uint32_t)(intptr_t)vectp); suword32(&arginfo->ps_nenvstr, envc); /* * Fill in environment portion of vector table. */ for (; envc > 0; --envc) { - suword32(vectp++, (u_int32_t)(intptr_t)destp); + suword32(vectp++, (uint32_t)(intptr_t)destp); while (*stringp++ != 0) destp++; destp++; @@ -1089,6 +1105,8 @@ linux_elf_modevent(module_t mod, int typ linux_schedtail, NULL, 1000); linux_exec_tag = EVENTHANDLER_REGISTER(process_exec, linux_proc_exec, NULL, 1000); + linux_szplatform = roundup(strlen(linux_platform) + 1, + sizeof(char *)); if (bootverbose) printf("Linux ELF exec handler installed\n"); } else Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Wed Mar 4 06:01:27 2009 (r189361) +++ head/sys/compat/linux/linux_misc.c Wed Mar 4 12:14:33 2009 (r189362) @@ -92,10 +92,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef __i386__ -#include -#endif - #define BSD_TO_LINUX_SIGNAL(sig) \ (((sig) <= LINUX_SIGTBLSZ) ? bsd_to_linux_signal[_SIG_IDX(sig)] : sig) @@ -731,34 +727,8 @@ linux_newuname(struct thread *td, struct *p = '\0'; break; } -#ifdef __i386__ - { - const char *class; - - switch (cpu_class) { - case CPUCLASS_686: - class = "i686"; - break; - case CPUCLASS_586: - class = "i586"; - break; - case CPUCLASS_486: - class = "i486"; - break; - default: - class = "i386"; - } - strlcpy(utsname.machine, class, LINUX_MAX_UTSNAME); - } -#elif defined(__amd64__) /* XXX: Linux can change 'personality'. */ -#ifdef COMPAT_LINUX32 - strlcpy(utsname.machine, "i686", LINUX_MAX_UTSNAME); -#else - strlcpy(utsname.machine, "x86_64", LINUX_MAX_UTSNAME); -#endif /* COMPAT_LINUX32 */ -#else /* something other than i386 or amd64 - assume we and Linux agree */ - strlcpy(utsname.machine, machine, LINUX_MAX_UTSNAME); -#endif /* __i386__ */ + strlcpy(utsname.machine, linux_platform, LINUX_MAX_UTSNAME); + mtx_lock(&hostname_mtx); strlcpy(utsname.domainname, V_domainname, LINUX_MAX_UTSNAME); mtx_unlock(&hostname_mtx); Modified: head/sys/compat/linux/linux_misc.h ============================================================================== --- head/sys/compat/linux/linux_misc.h Wed Mar 4 06:01:27 2009 (r189361) +++ head/sys/compat/linux/linux_misc.h Wed Mar 4 12:14:33 2009 (r189362) @@ -45,4 +45,19 @@ #define LINUX_MREMAP_MAYMOVE 1 #define LINUX_MREMAP_FIXED 2 +extern const char *linux_platform; + +/* + * Non-standard aux entry types used in Linux ELF binaries. + */ + +#define LINUX_AT_PLATFORM 15 /* String identifying CPU */ +#define LINUX_AT_HWCAP 16 /* CPU capabilities */ +#define LINUX_AT_CLKTCK 17 /* frequency at which times() increments */ +#define LINUX_AT_SECURE 23 /* secure mode boolean */ +#define LINUX_AT_BASE_PLATFORM 24 /* string identifying real platform, may + * differ from AT_PLATFORM. + */ +#define LINUX_AT_EXECFN 31 /* filename of program */ + #endif /* _LINUX_MISC_H_ */ Modified: head/sys/i386/linux/linux.h ============================================================================== --- head/sys/i386/linux/linux.h Wed Mar 4 06:01:27 2009 (r189361) +++ head/sys/i386/linux/linux.h Wed Mar 4 12:14:33 2009 (r189362) @@ -102,6 +102,10 @@ typedef struct { #define LINUX_CTL_MAXNAME 10 +#define LINUX_AT_COUNT 16 /* Count of used aux entry types. + * Keep this synchronized with + * elf_linux_fixup() code. + */ struct l___sysctl_args { l_int *name; Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Wed Mar 4 06:01:27 2009 (r189361) +++ head/sys/i386/linux/linux_sysvec.c Wed Mar 4 12:14:33 2009 (r189362) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -65,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -107,6 +109,10 @@ static void linux_prepsyscall(struct tra static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); static void exec_linux_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings); +static register_t *linux_copyout_strings(struct image_params *imgp); + +static int linux_szplatform; +const char *linux_platform; extern LIST_HEAD(futex_list, futex) futex_list; extern struct sx futex_sx; @@ -231,22 +237,30 @@ linux_fixup(register_t **stack_base, str **stack_base = (intptr_t)(void *)argv; (*stack_base)--; **stack_base = imgp->args->argc; - return 0; + return (0); } static int elf_linux_fixup(register_t **stack_base, struct image_params *imgp) { + struct proc *p; Elf32_Auxargs *args; + Elf32_Addr *uplatform; + struct ps_strings *arginfo; register_t *pos; KASSERT(curthread->td_proc == imgp->proc, ("unsafe elf_linux_fixup(), should be curproc")); + + p = imgp->proc; + arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; + uplatform = (Elf32_Addr *)((caddr_t)arginfo - linux_szsigcode - + linux_szplatform); args = (Elf32_Auxargs *)imgp->auxargs; pos = *stack_base + (imgp->args->argc + imgp->args->envc + 2); - if (args->execfd != -1) - AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd); + AUXARGS_ENTRY(pos, LINUX_AT_HWCAP, cpu_feature); + AUXARGS_ENTRY(pos, LINUX_AT_CLKTCK, hz); AUXARGS_ENTRY(pos, AT_PHDR, args->phdr); AUXARGS_ENTRY(pos, AT_PHENT, args->phent); AUXARGS_ENTRY(pos, AT_PHNUM, args->phnum); @@ -254,10 +268,14 @@ elf_linux_fixup(register_t **stack_base, AUXARGS_ENTRY(pos, AT_FLAGS, args->flags); AUXARGS_ENTRY(pos, AT_ENTRY, args->entry); AUXARGS_ENTRY(pos, AT_BASE, args->base); + AUXARGS_ENTRY(pos, LINUX_AT_SECURE, 0); AUXARGS_ENTRY(pos, AT_UID, imgp->proc->p_ucred->cr_ruid); AUXARGS_ENTRY(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid); AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); + AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(uplatform)); + if (args->execfd != -1) + AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd); AUXARGS_ENTRY(pos, AT_NULL, 0); free(imgp->auxargs, M_TEMP); @@ -265,9 +283,125 @@ elf_linux_fixup(register_t **stack_base, (*stack_base)--; **stack_base = (register_t)imgp->args->argc; - return 0; + return (0); } +/* + * Copied from kern/kern_exec.c + */ +static register_t * +linux_copyout_strings(struct image_params *imgp) +{ + int argc, envc; + char **vectp; + char *stringp, *destp; + register_t *stack_base; + struct ps_strings *arginfo; + struct proc *p; + + /* + * Calculate string base and vector table pointers. + * Also deal with signal trampoline code for this exec type. + */ + p = imgp->proc; + arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; + destp = (caddr_t)arginfo - linux_szsigcode - SPARE_USRSPACE - + linux_szplatform - roundup((ARG_MAX - imgp->args->stringspace), + sizeof(char *)); + + /* + * install sigcode + */ + copyout(p->p_sysent->sv_sigcode, ((caddr_t)arginfo - + linux_szsigcode), linux_szsigcode); + + /* + * install LINUX_PLATFORM + */ + copyout(linux_platform, ((caddr_t)arginfo - linux_szsigcode - + linux_szplatform), linux_szplatform); + + /* + * If we have a valid auxargs ptr, prepare some room + * on the stack. + */ + if (imgp->auxargs) { + /* + * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for + * lower compatibility. + */ + imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size : + (LINUX_AT_COUNT * 2); + /* + * The '+ 2' is for the null pointers at the end of each of + * the arg and env vector sets,and imgp->auxarg_size is room + * for argument of Runtime loader. + */ + vectp = (char **)(destp - (imgp->args->argc + + imgp->args->envc + 2 + imgp->auxarg_size) * sizeof(char *)); + } else { + /* + * The '+ 2' is for the null pointers at the end of each of + * the arg and env vector sets + */ + vectp = (char **)(destp - (imgp->args->argc + imgp->args->envc + 2) * + sizeof(char *)); + } + + /* + * vectp also becomes our initial stack base + */ + stack_base = (register_t *)vectp; + + stringp = imgp->args->begin_argv; + argc = imgp->args->argc; + envc = imgp->args->envc; + + /* + * Copy out strings - arguments and environment. + */ + copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); + + /* + * Fill in "ps_strings" struct for ps, w, etc. + */ + suword(&arginfo->ps_argvstr, (long)(intptr_t)vectp); + suword(&arginfo->ps_nargvstr, argc); + + /* + * Fill in argument portion of vector table. + */ + for (; argc > 0; --argc) { + suword(vectp++, (long)(intptr_t)destp); + while (*stringp++ != 0) + destp++; + destp++; + } + + /* a null vector table pointer separates the argp's from the envp's */ + suword(vectp++, 0); + + suword(&arginfo->ps_envstr, (long)(intptr_t)vectp); + suword(&arginfo->ps_nenvstr, envc); + + /* + * Fill in environment portion of vector table. + */ + for (; envc > 0; --envc) { + suword(vectp++, (long)(intptr_t)destp); + while (*stringp++ != 0) + destp++; + destp++; + } + + /* end of vector table is a null pointer */ + suword(vectp, 0); + + return (stack_base); +} + + + extern int _ucodesel, _udatasel; extern unsigned long linux_sznonrtsigcode; @@ -808,6 +942,25 @@ exec_linux_setregs(struct thread *td, u_ fldcw(&control); } +static void +linux_get_machine(const char **dst) +{ + + switch (cpu_class) { + case CPUCLASS_686: + *dst = "i686"; + break; + case CPUCLASS_586: + *dst = "i586"; + break; + case CPUCLASS_486: + *dst = "i486"; + break; + default: + *dst = "i386"; + } +} + struct sysentvec linux_sysvec = { .sv_size = LINUX_SYS_MAXSYSCALL, .sv_table = linux_sysent, @@ -863,7 +1016,7 @@ struct sysentvec elf_linux_sysvec = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_ALL, - .sv_copyout_strings = exec_copyout_strings, + .sv_copyout_strings = linux_copyout_strings, .sv_setregs = exec_linux_setregs, .sv_fixlimit = NULL, .sv_maxssiz = NULL, @@ -929,6 +1082,9 @@ linux_elf_modevent(module_t mod, int typ NULL, 1000); linux_exec_tag = EVENTHANDLER_REGISTER(process_exec, linux_proc_exec, NULL, 1000); + linux_get_machine(&linux_platform); + linux_szplatform = roundup(strlen(linux_platform) + 1, + sizeof(char *)); if (bootverbose) printf("Linux ELF exec handler installed\n"); } else From rdivacky at FreeBSD.org Wed Mar 4 05:26:37 2009 From: rdivacky at FreeBSD.org (Roman Divacky) Date: Wed Mar 4 05:26:46 2009 Subject: svn commit: r189362 - in head/sys: amd64/linux32 compat/linux i386/linux In-Reply-To: <200903041214.n24CEXmG041836@svn.freebsd.org> References: <200903041214.n24CEXmG041836@svn.freebsd.org> Message-ID: <20090304132306.GA46344@freebsd.org> On Wed, Mar 04, 2009 at 12:14:33PM +0000, Dmitry Chagin wrote: > Author: dchagin > Date: Wed Mar 4 12:14:33 2009 > New Revision: 189362 > URL: http://svn.freebsd.org/changeset/base/189362 > > Log: > Add AT_PLATFORM, AT_HWCAP and AT_CLKTCK auxiliary vector entries which > are used by glibc. This silents the message "2.4+ kernel w/o ELF notes?" > from some programs at start, among them are top and pkill. > > Do the assignment of the vector entries in elf_linux_fixup() > as it is done in glibc. > > Fix some minor style issues. cool! have you tested this works with 2.4 emulation? I think it might break it as I am quite sure the aux tags changed between 2.4 and 2.6. we might need to scrap 2.4 emulation altogether in 8.x roman -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090304/2279c121/attachment.pgp From dchagin at FreeBSD.org Wed Mar 4 05:46:51 2009 From: dchagin at FreeBSD.org (Chagin Dmitry) Date: Wed Mar 4 05:46:57 2009 Subject: svn commit: r189362 - in head/sys: amd64/linux32 compat/linux i386/linux In-Reply-To: <20090304132306.GA46344@freebsd.org> References: <200903041214.n24CEXmG041836@svn.freebsd.org> <20090304132306.GA46344@freebsd.org> Message-ID: <20090304134639.GA5968@dchagin.static.corbina.ru> On Wed, Mar 04, 2009 at 02:23:06PM +0100, Roman Divacky wrote: > On Wed, Mar 04, 2009 at 12:14:33PM +0000, Dmitry Chagin wrote: > > Author: dchagin > > Date: Wed Mar 4 12:14:33 2009 > > New Revision: 189362 > > URL: http://svn.freebsd.org/changeset/base/189362 > > > > Log: > > Add AT_PLATFORM, AT_HWCAP and AT_CLKTCK auxiliary vector entries which > > are used by glibc. This silents the message "2.4+ kernel w/o ELF notes?" > > from some programs at start, among them are top and pkill. > > > > Do the assignment of the vector entries in elf_linux_fixup() > > as it is done in glibc. > > > > Fix some minor style issues. > > cool! have you tested this works with 2.4 emulation? I think it might > break it as I am quite sure the aux tags changed between 2.4 and 2.6. > > we might need to scrap 2.4 emulation altogether in 8.x > hi Roman! glibc do: for (av = _dl_auxv; av->a_type != AT_NULL; set_seen (av++)) switch (av->a_type) { case AT_PHDR: phdr = (void *) av->a_un.a_val; break; etc....., and how it can be broken by adding new AT entries? -- Have fun! chd -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090304/b0121168/attachment.pgp From rdivacky at FreeBSD.org Wed Mar 4 05:49:13 2009 From: rdivacky at FreeBSD.org (Roman Divacky) Date: Wed Mar 4 05:49:20 2009 Subject: svn commit: r189362 - in head/sys: amd64/linux32 compat/linux i386/linux In-Reply-To: <20090304134639.GA5968@dchagin.static.corbina.ru> References: <200903041214.n24CEXmG041836@svn.freebsd.org> <20090304132306.GA46344@freebsd.org> <20090304134639.GA5968@dchagin.static.corbina.ru> Message-ID: <20090304134538.GA49621@freebsd.org> On Wed, Mar 04, 2009 at 04:46:39PM +0300, Chagin Dmitry wrote: > On Wed, Mar 04, 2009 at 02:23:06PM +0100, Roman Divacky wrote: > > On Wed, Mar 04, 2009 at 12:14:33PM +0000, Dmitry Chagin wrote: > > > Author: dchagin > > > Date: Wed Mar 4 12:14:33 2009 > > > New Revision: 189362 > > > URL: http://svn.freebsd.org/changeset/base/189362 > > > > > > Log: > > > Add AT_PLATFORM, AT_HWCAP and AT_CLKTCK auxiliary vector entries which > > > are used by glibc. This silents the message "2.4+ kernel w/o ELF notes?" > > > from some programs at start, among them are top and pkill. > > > > > > Do the assignment of the vector entries in elf_linux_fixup() > > > as it is done in glibc. > > > > > > Fix some minor style issues. > > > > cool! have you tested this works with 2.4 emulation? I think it might > > break it as I am quite sure the aux tags changed between 2.4 and 2.6. > > > > we might need to scrap 2.4 emulation altogether in 8.x > > > > > hi Roman! > > glibc do: > > for (av = _dl_auxv; av->a_type != AT_NULL; set_seen (av++)) > switch (av->a_type) > { > case AT_PHDR: > phdr = (void *) av->a_un.a_val; > break; > > etc....., and how it can be broken by adding new AT entries? ah... it's correct then thnx! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090304/fb0d60d7/attachment.pgp From avg at FreeBSD.org Wed Mar 4 05:53:58 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Wed Mar 4 05:54:09 2009 Subject: svn commit: r189363 - head/sys/fs/udf Message-ID: <200903041353.n24DrvBt044317@svn.freebsd.org> Author: avg Date: Wed Mar 4 13:53:57 2009 New Revision: 189363 URL: http://svn.freebsd.org/changeset/base/189363 Log: udf_strategy: remove redundant comment We fail mapping for any udf_bmap_internal error and there can be different reasons for it, so no need to (over-)emphasize files with data in fentry. Submitted by: bde Approved by: jhb Modified: head/sys/fs/udf/udf_vnops.c Modified: head/sys/fs/udf/udf_vnops.c ============================================================================== --- head/sys/fs/udf/udf_vnops.c Wed Mar 4 12:14:33 2009 (r189362) +++ head/sys/fs/udf/udf_vnops.c Wed Mar 4 13:53:57 2009 (r189363) @@ -1018,10 +1018,6 @@ udf_strategy(struct vop_strategy_args *a node = VTON(vp); if (bp->b_blkno == bp->b_lblkno) { - /* - * Files that are embedded in the fentry don't translate well - * to a block number. Reject. - */ offset = lblktosize(node->udfmp, bp->b_lblkno); error = udf_bmap_internal(node, offset, §or, &maxsize); if (error) { From avg at FreeBSD.org Wed Mar 4 05:54:11 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Wed Mar 4 05:54:20 2009 Subject: svn commit: r189364 - head/sys/fs/udf Message-ID: <200903041354.n24DsAVr044364@svn.freebsd.org> Author: avg Date: Wed Mar 4 13:54:10 2009 New Revision: 189364 URL: http://svn.freebsd.org/changeset/base/189364 Log: udf: use truly unique directory cookie 'off' is an offset within current block, so there is a good chance it can be non-unique, so use complete offset. Submitted by: bde Approved by: jhb Modified: head/sys/fs/udf/udf_vnops.c Modified: head/sys/fs/udf/udf_vnops.c ============================================================================== --- head/sys/fs/udf/udf_vnops.c Wed Mar 4 13:53:57 2009 (r189363) +++ head/sys/fs/udf/udf_vnops.c Wed Mar 4 13:54:10 2009 (r189364) @@ -738,7 +738,7 @@ udf_getfid(struct udf_dirstream *ds) * Update the offset. Align on a 4 byte boundary because the * UDF spec says so. */ - ds->this_off = ds->off; + ds->this_off = ds->offset + ds->off; if (!ds->fid_fragment) { ds->off += (total_fid_size + 3) & ~0x03; } else { From das at FreeBSD.org Wed Mar 4 07:45:35 2009 From: das at FreeBSD.org (David Schultz) Date: Wed Mar 4 07:45:47 2009 Subject: svn commit: r189365 - head/include Message-ID: <200903041545.n24FjYP3046465@svn.freebsd.org> Author: das Date: Wed Mar 4 15:45:34 2009 New Revision: 189365 URL: http://svn.freebsd.org/changeset/base/189365 Log: Put the restrict qualifiers in the right place in the wcp[n]cpy prototypes. Submitted by: Pawel Worach Modified: head/include/wchar.h Modified: head/include/wchar.h ============================================================================== --- head/include/wchar.h Wed Mar 4 13:54:10 2009 (r189364) +++ head/include/wchar.h Wed Mar 4 15:45:34 2009 (r189365) @@ -213,8 +213,8 @@ 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); -wchar_t *wcpcpy(wchar_t __restrict *, const wchar_t * __restrict); -wchar_t *wcpncpy(wchar_t __restrict *, const wchar_t * __restrict, 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; int wcscasecmp(const wchar_t *, const wchar_t *); int wcsncasecmp(const wchar_t *, const wchar_t *, size_t n); From rnoland at FreeBSD.org Wed Mar 4 10:23:52 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Wed Mar 4 10:23:59 2009 Subject: svn commit: r189367 - head/sys/dev/pci Message-ID: <200903041823.n24INmcc049524@svn.freebsd.org> Author: rnoland Date: Wed Mar 4 18:23:48 2009 New Revision: 189367 URL: http://svn.freebsd.org/changeset/base/189367 Log: Extend the management of PCIM_CMD_INTxDIS. We now explicitly enable INTx during bus_setup_intr() if it is needed. Several of the ata drivers were managing this bit internally. This is better handled in pci and it should work for all drivers now. We also mask INTx during bus_teardown_intr() by setting this bit. Reviewed by: jhb MFC after: 3 days Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Wed Mar 4 16:21:00 2009 (r189366) +++ head/sys/dev/pci/pci.c Wed Mar 4 18:23:48 2009 (r189367) @@ -2825,14 +2825,24 @@ pci_setup_intr(device_t dev, device_t ch if (error) return (error); - /* - * If this is a direct child, check to see if the interrupt is - * MSI or MSI-X. If so, ask our parent to map the MSI and give - * us the address and data register values. If we fail for some - * reason, teardown the interrupt handler. - */ + /* If this is not a direct child, just bail out. */ + if (device_get_parent(child) != dev) { + *cookiep = cookie; + return(0); + } + rid = rman_get_rid(irq); - if (device_get_parent(child) == dev && rid > 0) { + if (rid == 0) { + /* Make sure that INTx is enabled */ + pci_clear_command_bit(dev, child, PCIM_CMD_INTxDIS); + } else { + /* + * Check to see if the interrupt is MSI or MSI-X. + * Ask our parent to map the MSI and give + * us the address and data register values. + * If we fail for some reason, teardown the + * interrupt handler. + */ dinfo = device_get_ivars(child); if (dinfo->cfg.msi.msi_alloc > 0) { if (dinfo->cfg.msi.msi_addr == 0) { @@ -2874,7 +2884,8 @@ pci_setup_intr(device_t dev, device_t ch } mte->mte_handlers++; } - /* Disable INTx if we are using MSI/MSIX */ + + /* Make sure that INTx is disabled if we are using MSI/MSIX */ pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); bad: if (error) { @@ -2896,16 +2907,24 @@ pci_teardown_intr(device_t dev, device_t struct pci_devinfo *dinfo; int error, rid; - /* - * If this is a direct child, check to see if the interrupt is - * MSI or MSI-X. If so, decrement the appropriate handlers - * count and mask the MSI-X message, or disable MSI messages - * if the count drops to 0. - */ if (irq == NULL || !(rman_get_flags(irq) & RF_ACTIVE)) return (EINVAL); + + /* If this isn't a direct child, just bail out */ + if (device_get_parent(child) != dev) + return(bus_generic_teardown_intr(dev, child, irq, cookie)); + rid = rman_get_rid(irq); - if (device_get_parent(child) == dev && rid > 0) { + if (rid > 0) { + /* Mask INTx */ + pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); + } else { + /* + * Check to see if the interrupt is MSI or MSI-X. If so, + * decrement the appropriate handlers count and mask the + * MSI-X message, or disable MSI messages if the count + * drops to 0. + */ dinfo = device_get_ivars(child); rle = resource_list_find(&dinfo->resources, SYS_RES_IRQ, rid); if (rle->res != irq) @@ -2930,11 +2949,9 @@ pci_teardown_intr(device_t dev, device_t if (mte->mte_handlers == 0) pci_mask_msix(child, rid - 1); } - /* Restore INTx capability for MSI/MSIX */ - pci_clear_command_bit(dev, child, PCIM_CMD_INTxDIS); } error = bus_generic_teardown_intr(dev, child, irq, cookie); - if (device_get_parent(child) == dev && rid > 0) + if (rid > 0) KASSERT(error == 0, ("%s: generic teardown failed for MSI/MSI-X", __func__)); return (error); From rnoland at FreeBSD.org Wed Mar 4 10:25:46 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Wed Mar 4 10:25:58 2009 Subject: svn commit: r189368 - head/sys/dev/ata/chipsets Message-ID: <200903041825.n24IPe2N049601@svn.freebsd.org> Author: rnoland Date: Wed Mar 4 18:25:39 2009 New Revision: 189368 URL: http://svn.freebsd.org/changeset/base/189368 Log: Remove the local management of INTx as this is now taken care of by pci. Reviewed by: jhb MFC after: 3 days Modified: head/sys/dev/ata/chipsets/ata-acerlabs.c head/sys/dev/ata/chipsets/ata-ahci.c head/sys/dev/ata/chipsets/ata-intel.c head/sys/dev/ata/chipsets/ata-marvell.c head/sys/dev/ata/chipsets/ata-nvidia.c head/sys/dev/ata/chipsets/ata-siliconimage.c head/sys/dev/ata/chipsets/ata-sis.c head/sys/dev/ata/chipsets/ata-via.c Modified: head/sys/dev/ata/chipsets/ata-acerlabs.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-acerlabs.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-acerlabs.c Wed Mar 4 18:25:39 2009 (r189368) @@ -113,10 +113,6 @@ ata_ali_chipinit(device_t dev) if ((ctlr->chip->chipid == ATA_ALI_5288) && (ata_ahci_chipinit(dev) != ENXIO)) return 0; - - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400, 2); break; case ALI_NEW: Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-ahci.c Wed Mar 4 18:25:39 2009 (r189368) @@ -135,10 +135,6 @@ ata_ahci_chipinit(device_t dev) ctlr->suspend = ata_ahci_suspend; ctlr->resume = ata_ahci_ctlr_reset; - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400, 2); - /* announce we support the HW */ version = ATA_INL(ctlr->r_res2, ATA_AHCI_VS); device_printf(dev, Modified: head/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-intel.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-intel.c Wed Mar 4 18:25:39 2009 (r189368) @@ -213,10 +213,6 @@ ata_intel_chipinit(device_t dev) ctlr->setmode = ata_intel_sata_setmode; else ctlr->setmode = ata_sata_setmode; - - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400, 2); } return 0; } Modified: head/sys/dev/ata/chipsets/ata-marvell.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-marvell.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-marvell.c Wed Mar 4 18:25:39 2009 (r189368) @@ -212,9 +212,6 @@ ata_marvell_edma_chipinit(device_t dev) ATA_OUTL(ctlr->r_res1, 0x01d64, 0x000000ff/*HC0*/ | 0x0001fe00/*HC1*/ | /*(1<<19) | (1<<20) | (1<<21) |*/(1<<22) | (1<<24) | (0x7f << 25)); - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400, 2); return 0; } Modified: head/sys/dev/ata/chipsets/ata-nvidia.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-nvidia.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-nvidia.c Wed Mar 4 18:25:39 2009 (r189368) @@ -183,11 +183,6 @@ ata_nvidia_chipinit(device_t dev) /* enable device and PHY state change interrupts */ ATA_OUTB(ctlr->r_res2, offset + 1, 0xdd); } - - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400,2); - } ctlr->setmode = ata_sata_setmode; } Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-siliconimage.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-siliconimage.c Wed Mar 4 18:25:39 2009 (r189368) @@ -150,10 +150,6 @@ ata_sii_chipinit(device_t dev) ATA_OUTL(ctlr->r_res1, 0x0040, 0x80000000); DELAY(10000); ATA_OUTL(ctlr->r_res1, 0x0040, 0x0000000f); - - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400, 2); break; case SII_MEMIO: Modified: head/sys/dev/ata/chipsets/ata-sis.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-sis.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-sis.c Wed Mar 4 18:25:39 2009 (r189368) @@ -189,10 +189,6 @@ ata_sis_chipinit(device_t dev) ctlr->ch_attach = ata_sis_ch_attach; ctlr->ch_detach = ata_pci_ch_detach; ctlr->reset = ata_sis_reset; - - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400,2); } ctlr->setmode = ata_sata_setmode; return 0; Modified: head/sys/dev/ata/chipsets/ata-via.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-via.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-via.c Wed Mar 4 18:25:39 2009 (r189368) @@ -143,10 +143,6 @@ ata_via_chipinit(device_t dev) ctlr->ch_attach = ata_via_ch_attach; ctlr->ch_detach = ata_via_ch_detach; ctlr->reset = ata_via_reset; - - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400,2); } if (ctlr->chip->cfg2 & VIABAR) { From ed at FreeBSD.org Wed Mar 4 10:36:50 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Wed Mar 4 10:37:02 2009 Subject: svn commit: r189369 - head/usr.sbin/IPXrouted Message-ID: <200903041836.n24Iamjg049854@svn.freebsd.org> Author: ed Date: Wed Mar 4 18:36:48 2009 New Revision: 189369 URL: http://svn.freebsd.org/changeset/base/189369 Log: Make IPXrouted compile using Clang by using ANSI function declarations. Because of integer promotion, Clang doesn't allow ANSI prototypes to be mixed with K&R declarations. Submitted by: Pawel Worach Modified: head/usr.sbin/IPXrouted/tables.c Modified: head/usr.sbin/IPXrouted/tables.c ============================================================================== --- head/usr.sbin/IPXrouted/tables.c Wed Mar 4 18:25:39 2009 (r189368) +++ head/usr.sbin/IPXrouted/tables.c Wed Mar 4 18:36:48 2009 (r189369) @@ -64,8 +64,7 @@ struct rthash nethash[ROUTEHASHSIZ]; * Lookup dst in the tables for an exact match. */ struct rt_entry * -rtlookup(dst) - struct sockaddr *dst; +rtlookup(struct sockaddr *dst) { register struct rt_entry *rt; register struct rthash *rh; @@ -90,8 +89,7 @@ rtlookup(dst) * Find a route to dst as the kernel would. */ struct rt_entry * -rtfind(dst) - struct sockaddr *dst; +rtfind(struct sockaddr *dst) { register struct rt_entry *rt; register struct rthash *rh; @@ -118,10 +116,8 @@ rtfind(dst) } void -rtadd(dst, gate, metric, ticks, state) - struct sockaddr *dst, *gate; - short metric, ticks; - int state; +rtadd(struct sockaddr *dst, struct sockaddr *gate, short metric, + short ticks, int state) { struct afhash h; register struct rt_entry *rt; @@ -171,11 +167,8 @@ rtadd(dst, gate, metric, ticks, state) } void -rtadd_clone(ort, dst, gate, metric, ticks, state) - struct rt_entry *ort; - struct sockaddr *dst, *gate; - short metric, ticks; - int state; +rtadd_clone(struct rt_entry *ort, struct sockaddr *dst, + struct sockaddr *gate, short metric, short ticks, int state) { struct afhash h; register struct rt_entry *rt; @@ -216,10 +209,8 @@ rtadd_clone(ort, dst, gate, metric, tick } void -rtchange(rt, gate, metric, ticks) - struct rt_entry *rt; - struct sockaddr *gate; - short metric, ticks; +rtchange(struct rt_entry *rt, struct sockaddr *gate, short metric, + short ticks) { int doioctl = 0, metricchanged = 0; struct rtuentry oldroute; @@ -337,8 +328,7 @@ rtchange(rt, gate, metric, ticks) } void -rtdelete(rt) - struct rt_entry *rt; +rtdelete(struct rt_entry *rt) { struct sockaddr *sa = &(rt->rt_router); @@ -380,9 +370,7 @@ rtinit(void) int seqno; int -rtioctl(action, ort) - int action; - struct rtuentry *ort; +rtioctl(int action, struct rtuentry *ort) { #ifndef RTM_ADD if (install == 0) From rdivacky at FreeBSD.org Wed Mar 4 10:51:40 2009 From: rdivacky at FreeBSD.org (Roman Divacky) Date: Wed Mar 4 10:51:46 2009 Subject: svn commit: r189369 - head/usr.sbin/IPXrouted In-Reply-To: <200903041836.n24Iamjg049854@svn.freebsd.org> References: <200903041836.n24Iamjg049854@svn.freebsd.org> Message-ID: <20090304184759.GA6614@freebsd.org> On Wed, Mar 04, 2009 at 06:36:48PM +0000, Ed Schouten wrote: > Author: ed > Date: Wed Mar 4 18:36:48 2009 > New Revision: 189369 > URL: http://svn.freebsd.org/changeset/base/189369 > > Log: > Make IPXrouted compile using Clang by using ANSI function declarations. > > Because of integer promotion, Clang doesn't allow ANSI prototypes to be > mixed with K&R declarations. it allows mixing that. it just does not accept the cases where the promotion to int rule is broken. ie. it does what ISO C says says it should do. unlike gcc From netchild at FreeBSD.org Wed Mar 4 12:26:40 2009 From: netchild at FreeBSD.org (Alexander Leidinger) Date: Wed Mar 4 12:26:47 2009 Subject: svn commit: r189370 - in stable/7/sys: . compat/linux contrib/pf dev/ath/ath_hal dev/cxgb Message-ID: <200903042026.n24KQdkK052139@svn.freebsd.org> Author: netchild Date: Wed Mar 4 20:26:39 2009 New Revision: 189370 URL: http://svn.freebsd.org/changeset/base/189370 Log: MFC r188572: Fix an edge-case of the linux readdir: We need the size of a linux dirent structure, not the size of a pointer to it. PR: 131099 Submitted by: Andreas Kies Modified: stable/7/sys/ (props changed) stable/7/sys/compat/linux/linux_file.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/compat/linux/linux_file.c ============================================================================== --- stable/7/sys/compat/linux/linux_file.c Wed Mar 4 18:36:48 2009 (r189369) +++ stable/7/sys/compat/linux/linux_file.c Wed Mar 4 20:26:39 2009 (r189370) @@ -438,7 +438,7 @@ getdents_common(struct thread *td, struc /* readdir(2) case. Always struct dirent. */ if (is64bit) return (EINVAL); - nbytes = sizeof(linux_dirent); + nbytes = sizeof(*linux_dirent); justone = 1; } else justone = 0; From rrs at FreeBSD.org Wed Mar 4 12:54:43 2009 From: rrs at FreeBSD.org (Randall Stewart) Date: Wed Mar 4 12:54:50 2009 Subject: svn commit: r189371 - head/sys/netinet Message-ID: <200903042054.n24KshNx052736@svn.freebsd.org> Author: rrs Date: Wed Mar 4 20:54:42 2009 New Revision: 189371 URL: http://svn.freebsd.org/changeset/base/189371 Log: - PR-SCTP bug, where the CUM-ACK was not being updated into the advance_peer_ack point so we would incorrectly send a wrong value in the FWD-TSN - PR-SCTP bug, where an PR packet is used for a window probe which could incorrectly get the packet moved back into the send_queue, which will cause major issues and should not happen. - Fix a trace to use the proper macro. Modified: head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_os_bsd.h Modified: head/sys/netinet/sctp_constants.h ============================================================================== --- head/sys/netinet/sctp_constants.h Wed Mar 4 20:26:39 2009 (r189370) +++ head/sys/netinet/sctp_constants.h Wed Mar 4 20:54:42 2009 (r189371) @@ -228,8 +228,9 @@ __FBSDID("$FreeBSD$"); #define SCTP_MAP_TSN_ENTERS 119 #define SCTP_THRESHOLD_CLEAR 120 #define SCTP_THRESHOLD_INCR 121 +#define SCTP_FLIGHT_LOG_DWN_WP_FWD 122 -#define SCTP_LOG_MAX_TYPES 122 +#define SCTP_LOG_MAX_TYPES 123 /* * To turn on various logging, you must first enable 'options KTR' and * you might want to bump the entires 'options KTR_ENTRIES=80000'. Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Wed Mar 4 20:26:39 2009 (r189370) +++ head/sys/netinet/sctp_indata.c Wed Mar 4 20:54:42 2009 (r189371) @@ -4182,6 +4182,18 @@ sctp_window_probe_recovery(struct sctp_t struct sctp_tmit_chunk *chk; /* First setup this one and get it moved back */ + sctp_flight_size_decrease(tp1); + sctp_total_flight_decrease(stcb, tp1); + tp1->window_probe = 0; + if ((tp1->sent == SCTP_FORWARD_TSN_SKIP) || (tp1->data == NULL)) { + /* TSN's skipped we do NOT move back. */ + sctp_misc_ints(SCTP_FLIGHT_LOG_DWN_WP_FWD, + tp1->whoTo->flight_size, + tp1->book_size, + (uintptr_t) tp1->whoTo, + tp1->rec.data.TSN_seq); + return; + } tp1->sent = SCTP_DATAGRAM_UNSENT; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLE) { sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_WP, @@ -4190,8 +4202,6 @@ sctp_window_probe_recovery(struct sctp_t (uintptr_t) tp1->whoTo, tp1->rec.data.TSN_seq); } - sctp_flight_size_decrease(tp1); - sctp_total_flight_decrease(stcb, tp1); TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next); TAILQ_INSERT_HEAD(&asoc->send_queue, tp1, sctp_next); asoc->sent_queue_cnt--; @@ -4480,10 +4490,6 @@ sctp_express_handle_sack(struct sctp_tcb asoc->total_flight = 0; asoc->total_flight_count = 0; } - /* Fix up the a-p-a-p for future PR-SCTP sends */ - if (compare_with_wrap(cumack, asoc->advanced_peer_ack_point, MAX_TSN)) { - asoc->advanced_peer_ack_point = cumack; - } /* ECN Nonce updates */ if (asoc->ecn_nonce_allowed) { if (asoc->nonce_sum_check) { @@ -4699,6 +4705,14 @@ again: stcb->sctp_ep, stcb, asoc->primary_destination); } } + /*********************************************/ + /* Here we perform PR-SCTP procedures */ + /* (section 4.2) */ + /*********************************************/ + /* C1. update advancedPeerAckPoint */ + if (compare_with_wrap(cumack, asoc->advanced_peer_ack_point, MAX_TSN)) { + asoc->advanced_peer_ack_point = cumack; + } /* PR-Sctp issues need to be addressed too */ if ((asoc->peer_supports_prsctp) && (asoc->pr_sctp_cnt > 0)) { struct sctp_tmit_chunk *lchk; @@ -5446,14 +5460,6 @@ done_with_it: sctp_strike_gap_ack_chunks(stcb, asoc, biggest_tsn_acked, biggest_tsn_newly_acked, this_sack_lowest_newack, accum_moved); } - /*********************************************/ - /* Here we perform PR-SCTP procedures */ - /* (section 4.2) */ - /*********************************************/ - /* C1. update advancedPeerAckPoint */ - if (compare_with_wrap(cum_ack, asoc->advanced_peer_ack_point, MAX_TSN)) { - asoc->advanced_peer_ack_point = cum_ack; - } /* JRS - Use the congestion control given in the CC module */ asoc->cc_functions.sctp_cwnd_update_after_fr(stcb, asoc); @@ -5615,6 +5621,10 @@ again: done_once = 1; goto again; } + /* Fix up the a-p-a-p for future PR-SCTP sends */ + if (compare_with_wrap(cum_ack, asoc->advanced_peer_ack_point, MAX_TSN)) { + asoc->advanced_peer_ack_point = cum_ack; + } /* C2. try to further move advancedPeerAckPoint ahead */ if ((asoc->peer_supports_prsctp) && (asoc->pr_sctp_cnt > 0)) { struct sctp_tmit_chunk *lchk; Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Wed Mar 4 20:26:39 2009 (r189370) +++ head/sys/netinet/sctp_os_bsd.h Wed Mar 4 20:54:42 2009 (r189371) @@ -196,7 +196,7 @@ MALLOC_DECLARE(SCTP_M_SOCKOPT); #define SCTP_PRINTF(params...) printf(params) #ifdef SCTP_LTRACE_CHUNKS -#define SCTP_LTRACE_CHK(a, b, c, d) if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_CHUNK_ENABLE) CTR6(KTR_SUBSYS, "SCTP:%d[%d]:%x-%x-%x-%x", SCTP_LOG_CHUNK_PROC, 0, a, b, c, d) +#define SCTP_LTRACE_CHK(a, b, c, d) if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_CHUNK_ENABLE) SCTP_CTR6(KTR_SUBSYS, "SCTP:%d[%d]:%x-%x-%x-%x", SCTP_LOG_CHUNK_PROC, 0, a, b, c, d) #else #define SCTP_LTRACE_CHK(a, b, c, d) #endif From imp at bsdimp.com Wed Mar 4 12:58:50 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Wed Mar 4 12:59:01 2009 Subject: svn commit: r189367 - head/sys/dev/pci In-Reply-To: <200903041823.n24INmcc049524@svn.freebsd.org> References: <200903041823.n24INmcc049524@svn.freebsd.org> Message-ID: <20090304.135606.1649768480.imp@bsdimp.com> In message: <200903041823.n24INmcc049524@svn.freebsd.org> Robert Noland writes: : Author: rnoland : Date: Wed Mar 4 18:23:48 2009 : New Revision: 189367 : URL: http://svn.freebsd.org/changeset/base/189367 : : Log: : Extend the management of PCIM_CMD_INTxDIS. : : We now explicitly enable INTx during bus_setup_intr() if it is needed. : Several of the ata drivers were managing this bit internally. This is : better handled in pci and it should work for all drivers now. : : We also mask INTx during bus_teardown_intr() by setting this bit. : : Reviewed by: jhb : MFC after: 3 days Note: the INTxDIS bit is new in PCI 3.0, and has no effect on earlier devices. This should be highlighted in the comments somewhere... Warner From jhb at FreeBSD.org Wed Mar 4 13:04:54 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Wed Mar 4 13:05:01 2009 Subject: svn commit: r189373 - head/sys/dev/pci Message-ID: <200903042104.n24L4qMc053293@svn.freebsd.org> Author: jhb Date: Wed Mar 4 21:04:52 2009 New Revision: 189373 URL: http://svn.freebsd.org/changeset/base/189373 Log: The recent PCI resource allocation fixes exposed a bug where the same BAR could be allocated twice by different children of a vgapci0 device. To fix this, change the vgapci0 device to track references on its associated resources so that they are only allocated once from the parent PCI bus and released when no children are using them. Previously this leaked a small amount of KVA on at least some architectures. Modified: head/sys/dev/pci/vga_pci.c Modified: head/sys/dev/pci/vga_pci.c ============================================================================== --- head/sys/dev/pci/vga_pci.c Wed Mar 4 20:58:22 2009 (r189372) +++ head/sys/dev/pci/vga_pci.c Wed Mar 4 21:04:52 2009 (r189373) @@ -42,12 +42,20 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include +struct vga_resource { + struct resource *vr_res; + int vr_refs; +}; + struct vga_pci_softc { device_t vga_msi_child; /* Child driver using MSI. */ + struct vga_resource vga_res[PCIR_MAX_BAR_0 + 1]; }; static int @@ -130,7 +138,27 @@ static struct resource * vga_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) { + struct vga_pci_softc *sc; + int bar; + switch (type) { + case SYS_RES_MEMORY: + case SYS_RES_IOPORT: + /* + * For BARs, we cache the resource so that we only allocate it + * from the PCI bus once. + */ + bar = PCI_RID2BAR(*rid); + if (bar < 0 || bar > PCIR_MAX_BAR_0) + return (NULL); + sc = device_get_softc(dev); + if (sc->vga_res[bar].vr_res == NULL) + sc->vga_res[bar].vr_res = bus_alloc_resource(dev, type, + rid, start, end, count, flags); + if (sc->vga_res[bar].vr_res != NULL) + sc->vga_res[bar].vr_refs++; + return (sc->vga_res[bar].vr_res); + } return (bus_alloc_resource(dev, type, rid, start, end, count, flags)); } @@ -138,6 +166,37 @@ static int vga_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { + struct vga_pci_softc *sc; + int bar, error; + + switch (type) { + case SYS_RES_MEMORY: + case SYS_RES_IOPORT: + /* + * For BARs, we release the resource from the PCI bus + * when the last child reference goes away. + */ + bar = PCI_RID2BAR(rid); + if (bar < 0 || bar > PCIR_MAX_BAR_0) + return (EINVAL); + sc = device_get_softc(dev); + if (sc->vga_res[bar].vr_res == NULL) + return (EINVAL); + KASSERT(sc->vga_res[bar].vr_res == r, + ("vga_pci resource mismatch")); + if (sc->vga_res[bar].vr_refs > 1) { + sc->vga_res[bar].vr_refs--; + return (0); + } + KASSERT(sc->vga_res[bar].vr_refs > 0, + ("vga_pci resource reference count underflow")); + error = bus_release_resource(dev, type, rid, r); + if (error == 0) { + sc->vga_res[bar].vr_res = NULL; + sc->vga_res[bar].vr_refs = 0; + } + return (error); + } return (bus_release_resource(dev, type, rid, r)); } From jhb at FreeBSD.org Wed Mar 4 13:38:17 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Wed Mar 4 13:38:23 2009 Subject: svn commit: r189375 - stable/7/share/mk Message-ID: <200903042138.n24LcGkS053991@svn.freebsd.org> Author: jhb Date: Wed Mar 4 21:38:16 2009 New Revision: 189375 URL: http://svn.freebsd.org/changeset/base/189375 Log: MFC: Handle an additional layer of nesting for kernel modules to make it easier to compile 8.x kernels with modules on 7. Modified: stable/7/share/mk/ (props changed) stable/7/share/mk/bsd.kmod.mk Modified: stable/7/share/mk/bsd.kmod.mk ============================================================================== --- stable/7/share/mk/bsd.kmod.mk Wed Mar 4 21:22:39 2009 (r189374) +++ stable/7/share/mk/bsd.kmod.mk Wed Mar 4 21:38:16 2009 (r189375) @@ -2,7 +2,7 @@ # Search for kernel source tree in standard places. .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. \ - /sys /usr/src/sys + ${.CURDIR}/../../../../.. /sys /usr/src/sys .if !defined(SYSDIR) && exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk) SYSDIR= ${_dir} .endif From sam at FreeBSD.org Wed Mar 4 14:05:26 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Wed Mar 4 14:05:32 2009 Subject: svn commit: r189377 - head/sys/net80211 Message-ID: <200903042205.n24M5Pav054674@svn.freebsd.org> Author: sam Date: Wed Mar 4 22:05:25 2009 New Revision: 189377 URL: http://svn.freebsd.org/changeset/base/189377 Log: add the desired channel to the scan list if not already present and compatible with other scan controls Modified: head/sys/net80211/ieee80211_scan_sta.c Modified: head/sys/net80211/ieee80211_scan_sta.c ============================================================================== --- head/sys/net80211/ieee80211_scan_sta.c Wed Mar 4 21:40:08 2009 (r189376) +++ head/sys/net80211/ieee80211_scan_sta.c Wed Mar 4 22:05:25 2009 (r189377) @@ -476,6 +476,18 @@ checktable(const struct scanlist *scan, return 0; } +static int +onscanlist(const struct ieee80211_scan_state *ss, + const struct ieee80211_channel *c) +{ + int i; + + for (i = 0; i < ss->ss_last; i++) + if (ss->ss_chans[i] == c) + return 1; + return 0; +} + static void sweepchannels(struct ieee80211_scan_state *ss, struct ieee80211vap *vap, const struct scanlist table[]) @@ -524,6 +536,21 @@ sweepchannels(struct ieee80211_scan_stat /* Add channel to scanning list. */ ss->ss_chans[ss->ss_last++] = c; } + /* + * Explicitly add any desired channel if: + * - not already on the scan list + * - allowed by any desired mode constraint + * - there is space in the scan list + * This allows the channel to be used when the filtering + * mechanisms would otherwise elide it (e.g HT, turbo). + */ + c = vap->iv_des_chan; + if (c != IEEE80211_CHAN_ANYC && + !onscanlist(ss, c) && + (vap->iv_des_mode == IEEE80211_MODE_AUTO || + vap->iv_des_mode == ieee80211_chan2mode(c)) && + ss->ss_last < IEEE80211_SCAN_MAX) + ss->ss_chans[ss->ss_last++] = c; } static void From yongari at FreeBSD.org Wed Mar 4 16:04:34 2009 From: yongari at FreeBSD.org (Pyun YongHyeon) Date: Wed Mar 4 16:04:40 2009 Subject: svn commit: r189379 - head/sys/dev/ale Message-ID: <200903050004.n2504Wsi056879@svn.freebsd.org> Author: yongari Date: Thu Mar 5 00:04:32 2009 New Revision: 189379 URL: http://svn.freebsd.org/changeset/base/189379 Log: Now pci(4) handles PCIM_CMD_INTxDIS so there is no need to poke this bit in driver. Modified: head/sys/dev/ale/if_ale.c Modified: head/sys/dev/ale/if_ale.c ============================================================================== --- head/sys/dev/ale/if_ale.c Wed Mar 4 22:22:30 2009 (r189378) +++ head/sys/dev/ale/if_ale.c Thu Mar 5 00:04:32 2009 (r189379) @@ -1543,20 +1543,11 @@ ale_resume(device_t dev) struct ale_softc *sc; struct ifnet *ifp; int pmc; - uint16_t cmd, pmstat; + uint16_t pmstat; sc = device_get_softc(dev); ALE_LOCK(sc); - /* - * Clear INTx emulation disable for hardwares that - * is set in resume event. From Linux. - */ - cmd = pci_read_config(sc->ale_dev, PCIR_COMMAND, 2); - if ((cmd & 0x0400) != 0) { - cmd &= ~0x0400; - pci_write_config(sc->ale_dev, PCIR_COMMAND, cmd, 2); - } if (pci_find_extcap(sc->ale_dev, PCIY_PMG, &pmc) == 0) { /* Disable PME and clear PME status. */ pmstat = pci_read_config(sc->ale_dev, From sam at FreeBSD.org Wed Mar 4 16:15:44 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Wed Mar 4 16:15:51 2009 Subject: svn commit: r189380 - head/sys/dev/ath Message-ID: <200903050015.n250FhZZ057112@svn.freebsd.org> Author: sam Date: Thu Mar 5 00:15:43 2009 New Revision: 189380 URL: http://svn.freebsd.org/changeset/base/189380 Log: add a sysctl to ena/dis frobbing cca Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Thu Mar 5 00:04:32 2009 (r189379) +++ head/sys/dev/ath/if_ath.c Thu Mar 5 00:15:43 2009 (r189380) @@ -6861,6 +6861,22 @@ ath_sysctl_intmit(SYSCTL_HANDLER_ARGS) return !ath_hal_setintmit(sc->sc_ah, intmit) ? EINVAL : 0; } +#ifdef ATH_SUPPORT_TDMA +static int +ath_sysctl_setcca(SYSCTL_HANDLER_ARGS) +{ + struct ath_softc *sc = arg1; + int setcca, error; + + setcca = sc->sc_setcca; + error = sysctl_handle_int(oidp, &setcca, 0, req); + if (error || !req->newptr) + return error; + sc->sc_setcca = (setcca != 0); + return 0; +} +#endif /* ATH_SUPPORT_TDMA */ + static void ath_sysctlattach(struct ath_softc *sc) { @@ -6974,6 +6990,9 @@ ath_sysctlattach(struct ath_softc *sc) SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "superframe", CTLFLAG_RD, &sc->sc_tdmabintval, 0, "TDMA calculated super frame"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "setcca", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + ath_sysctl_setcca, "I", "enable CCA control"); } #endif } @@ -7423,7 +7442,8 @@ ath_tdma_config(struct ath_softc *sc, st ath_hal_intrset(ah, 0); ath_beaconq_config(sc); /* setup h/w beacon q */ - ath_hal_setcca(ah, AH_FALSE); /* disable CCA */ + if (sc->sc_setcca) + ath_hal_setcca(ah, AH_FALSE); /* disable CCA */ ath_tdma_bintvalsetup(sc, tdma); /* calculate beacon interval */ ath_tdma_settimers(sc, sc->sc_tdmabintval, sc->sc_tdmabintval | HAL_BEACON_RESET_TSF); Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Thu Mar 5 00:04:32 2009 (r189379) +++ head/sys/dev/ath/if_athvar.h Thu Mar 5 00:15:43 2009 (r189380) @@ -255,6 +255,7 @@ struct ath_softc { sc_wmetkipmic:1,/* can do WME+TKIP MIC */ sc_resume_up: 1,/* on resume, start all vaps */ sc_tdma : 1,/* TDMA in use */ + sc_setcca : 1,/* set/clr CCA with TDMA */ sc_resetcal : 1;/* reset cal state next trip */ uint32_t sc_eerd; /* regdomain from EEPROM */ uint32_t sc_eecc; /* country code from EEPROM */ From kientzle at FreeBSD.org Wed Mar 4 16:31:50 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Wed Mar 4 16:32:03 2009 Subject: svn commit: r189381 - head/lib/libarchive/test Message-ID: <200903050031.n250Vngs057445@svn.freebsd.org> Author: kientzle Date: Thu Mar 5 00:31:48 2009 New Revision: 189381 URL: http://svn.freebsd.org/changeset/base/189381 Log: Merge r341,r345,r346,347 from libarchive.googlecode.com: Style fixes to test harness and a few extra guards to detect tests that can't succeed on certain platforms. Modified: head/lib/libarchive/test/main.c head/lib/libarchive/test/test.h head/lib/libarchive/test/test_read_compress_program.c head/lib/libarchive/test/test_read_format_cpio_bin_Z.c head/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c head/lib/libarchive/test/test_read_format_tz.c Modified: head/lib/libarchive/test/main.c ============================================================================== --- head/lib/libarchive/test/main.c Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/main.c Thu Mar 5 00:31:48 2009 (r189381) @@ -33,6 +33,9 @@ #include #include #include +#ifdef _WIN32 +#include +#endif /* * This same file is used pretty much verbatim for all test harnesses. @@ -907,6 +910,10 @@ get_refdir(void) strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); } + /* You should have to add "$(TargetDir)" to + * Properties > Configuration Properties > Debugging > Working Directory, + * if you are running libarchive_test.exe on Visual Studio. + */ printf("Unable to locate known reference file %s\n", KNOWNREF); printf(" Checked following directories:\n%s\n", tried); exit(1); @@ -966,7 +973,7 @@ int main(int argc, char **argv) * Parse options, without using getopt(), which isn't available * on all platforms. */ - ++argv; /* Skip program name */ + ++argv; --argc;/* Skip program name */ while (*argv != NULL) { p = *argv++; if (*p++ != '-') Modified: head/lib/libarchive/test/test.h ============================================================================== --- head/lib/libarchive/test/test.h Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/test.h Thu Mar 5 00:31:48 2009 (r189381) @@ -73,6 +73,7 @@ #endif #ifdef _WIN32 +#define snprintf sprintf_s #define LOCALE_DE "deu" #else #define LOCALE_DE "de_DE.UTF-8" Modified: head/lib/libarchive/test/test_read_compress_program.c ============================================================================== --- head/lib/libarchive/test/test_read_compress_program.c Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/test_read_compress_program.c Thu Mar 5 00:31:48 2009 (r189381) @@ -42,16 +42,20 @@ DEFINE_TEST(test_read_compress_program) struct archive_entry *ae; struct archive *a; assert((a = archive_read_new()) != NULL); - assertEqualIntA(a, 0, archive_read_support_compression_none(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_none(a)); r = archive_read_support_compression_program(a, "gunzip"); if (r == ARCHIVE_FATAL) { skipping("archive_read_support_compression_program() unsupported on this platform"); return; } assertEqualIntA(a, ARCHIVE_OK, r); - assert(0 == archive_read_support_format_all(a)); - assertEqualIntA(a, 0, archive_read_open_memory(a, archive, sizeof(archive))); - assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); assert(archive_compression(a) == ARCHIVE_COMPRESSION_PROGRAM); assert(archive_format(a) == ARCHIVE_FORMAT_TAR_USTAR); assert(0 == archive_read_close(a)); Modified: head/lib/libarchive/test/test_read_format_cpio_bin_Z.c ============================================================================== --- head/lib/libarchive/test/test_read_format_cpio_bin_Z.c Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/test_read_format_cpio_bin_Z.c Thu Mar 5 00:31:48 2009 (r189381) @@ -36,17 +36,24 @@ DEFINE_TEST(test_read_format_cpio_bin_Z) struct archive_entry *ae; struct archive *a; assert((a = archive_read_new()) != NULL); - assertA(0 == archive_read_support_compression_all(a)); - assertA(0 == archive_read_support_format_all(a)); - assertA(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assertA(0 == archive_read_next_header(a, &ae)); - assertA(archive_compression(a) == ARCHIVE_COMPRESSION_COMPRESS); - assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_BIN_LE); - assert(0 == archive_read_close(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + failure("archive_compression_name(a)=\"%s\"", + archive_compression_name(a)); + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + failure("archive_format_name(a)=\"%s\"", + archive_format_name(a)); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else - assert(0 == archive_read_finish(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); #endif } Modified: head/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c ============================================================================== --- head/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c Thu Mar 5 00:31:48 2009 (r189381) @@ -39,17 +39,23 @@ DEFINE_TEST(test_read_format_cpio_svr4c_ struct archive *a; /* printf("Archive address: start=%X, end=%X\n", archive, archive+sizeof(archive)); */ assert((a = archive_read_new()) != NULL); - assertA(0 == archive_read_support_compression_all(a)); - assertA(0 == archive_read_support_format_all(a)); - assertA(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assertA(0 == archive_read_next_header(a, &ae)); - assertA(archive_compression(a) == ARCHIVE_COMPRESSION_COMPRESS); - assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_SVR4_CRC); - assert(0 == archive_read_close(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + failure("archive_compression_name(a)=\"%s\"", + archive_compression_name(a)); + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + failure("archive_format_name(a)=\"%s\"", archive_format_name(a)); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_SVR4_CRC); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else - assert(0 == archive_read_finish(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); #endif } Modified: head/lib/libarchive/test/test_read_format_tz.c ============================================================================== --- head/lib/libarchive/test/test_read_format_tz.c Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/test_read_format_tz.c Thu Mar 5 00:31:48 2009 (r189381) @@ -39,17 +39,22 @@ DEFINE_TEST(test_read_format_tz) struct archive_entry *ae; struct archive *a; assert((a = archive_read_new()) != NULL); - assertA(0 == archive_read_support_compression_all(a)); - assertA(0 == archive_read_support_format_all(a)); - assertA(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assertA(0 == archive_read_next_header(a, &ae)); - assertA(archive_compression(a) == ARCHIVE_COMPRESSION_COMPRESS); - assertA(archive_format(a) == ARCHIVE_FORMAT_TAR_USTAR); - assert(0 == archive_read_close(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + failure("archive_compression_name(a)=\"%s\"", + archive_compression_name(a)); + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + failure("archive_format_name(a)=\"%s\"", archive_format_name(a)); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else - assert(0 == archive_read_finish(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); #endif } From kientzle at FreeBSD.org Wed Mar 4 16:35:23 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Wed Mar 4 16:37:08 2009 Subject: svn commit: r189382 - head/lib/libarchive Message-ID: <200903050035.n250ZMdZ057565@svn.freebsd.org> Author: kientzle Date: Thu Mar 5 00:35:21 2009 New Revision: 189382 URL: http://svn.freebsd.org/changeset/base/189382 Log: Merge r344 from libarchive.googlecode.com: __LA_INT64_T and __LA_SSIZE_T are part of the public API and therefore need to be exposed. This is ugly; I'd like to find a better solution for this. Modified: head/lib/libarchive/archive.h Modified: head/lib/libarchive/archive.h ============================================================================== --- head/lib/libarchive/archive.h Thu Mar 5 00:31:48 2009 (r189381) +++ head/lib/libarchive/archive.h Thu Mar 5 00:35:21 2009 (r189382) @@ -629,11 +629,14 @@ __LA_DECL void archive_copy_error(stru } #endif -/* This is meaningless outside of this header. */ +/* These are meaningless outside of this header. */ #undef __LA_DECL #undef __LA_GID_T -#undef __LA_INT64_T -#undef __LA_SSIZE_T #undef __LA_UID_T +/* These need to remain defined because they're used in the + * callback type definitions. XXX Fix this. This is ugly. XXX */ +/* #undef __LA_INT64_T */ +/* #undef __LA_SSIZE_T */ + #endif /* !ARCHIVE_H_INCLUDED */ From kientzle at FreeBSD.org Wed Mar 4 16:36:14 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Wed Mar 4 16:37:17 2009 Subject: svn commit: r189383 - head/lib/libarchive Message-ID: <200903050036.n250aDXc057618@svn.freebsd.org> Author: kientzle Date: Thu Mar 5 00:36:13 2009 New Revision: 189383 URL: http://svn.freebsd.org/changeset/base/189383 Log: Merge r342 from libarchive.googlecode.com: Remove some Windows special casing. Modified: head/lib/libarchive/archive_write_disk.c Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Thu Mar 5 00:35:21 2009 (r189382) +++ head/lib/libarchive/archive_write_disk.c Thu Mar 5 00:36:13 2009 (r189383) @@ -83,9 +83,6 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_UTIME_H #include #endif -#ifdef _WIN32 -#include -#endif #include "archive.h" #include "archive_string.h" @@ -519,9 +516,6 @@ static ssize_t write_data_block(struct archive_write_disk *a, const char *buff, size_t size) { uint64_t start_size = size; -#if _WIN32 - HANDLE handle; -#endif ssize_t bytes_written = 0; ssize_t block_size = 0, bytes_to_write; @@ -530,9 +524,6 @@ write_data_block(struct archive_write_di "Attempt to write to an empty file"); return (ARCHIVE_WARN); } -#if _WIN32 - handle = (HANDLE)_get_osfhandle(a->fd); -#endif if (a->flags & ARCHIVE_EXTRACT_SPARSE) { #if HAVE_STRUCT_STAT_ST_BLKSIZE @@ -581,26 +572,9 @@ write_data_block(struct archive_write_di if (a->offset + bytes_to_write > block_end) bytes_to_write = block_end - a->offset; } -#ifdef _WIN32 /* Seek if necessary to the specified offset. */ if (offset != a->fd_offset) { - LARGE_INTEGER distance; - distance.QuadPart = offset; - if (!SetFilePointerEx(handle, distance, NULL, FILE_BEGIN)) { - archive_set_error(&a->archive, _dosmaperr(GetLastError()), - "Seek failed"); - return (ARCHIVE_FATAL); - } - } - if (!WriteFile(handle, buff, bytes_to_write, &bytes_written, NULL)) { - archive_set_error(&a->archive, _dosmaperr(GetLastError()), - "Write failed"); - return (ARCHIVE_WARN); - } -#else - /* Seek if necessary to the specified offset. */ - if (a->offset != a->fd_offset) { - if (lseek(a->fd, a->offset, SEEK_SET) < 0) { + if (lseek(a->fd, offset, SEEK_SET) < 0) { archive_set_error(&a->archive, errno, "Seek failed"); return (ARCHIVE_FATAL); @@ -614,7 +588,6 @@ write_data_block(struct archive_write_di archive_set_error(&a->archive, errno, "Write failed"); return (ARCHIVE_WARN); } -#endif buff += bytes_written; size -= bytes_written; a->offset += bytes_written; From kientzle at FreeBSD.org Wed Mar 4 16:41:03 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Wed Mar 4 16:41:16 2009 Subject: svn commit: r189384 - head/lib/libarchive/test Message-ID: <200903050041.n250f2uV057754@svn.freebsd.org> Author: kientzle Date: Thu Mar 5 00:41:02 2009 New Revision: 189384 URL: http://svn.freebsd.org/changeset/base/189384 Log: Merge r362 from libarchive.googlecode.com: Minor fix to custom argument parser. Modified: head/lib/libarchive/test/main.c Modified: head/lib/libarchive/test/main.c ============================================================================== --- head/lib/libarchive/test/main.c Thu Mar 5 00:36:13 2009 (r189383) +++ head/lib/libarchive/test/main.c Thu Mar 5 00:41:02 2009 (r189384) @@ -975,9 +975,10 @@ int main(int argc, char **argv) */ ++argv; --argc;/* Skip program name */ while (*argv != NULL) { + if (**argv != '-') + break; p = *argv++; - if (*p++ != '-') - usage(progname); + ++p; /* Skip '-' */ while (*p != '\0') { option = *p++; option_arg = NULL; From kientzle at FreeBSD.org Wed Mar 4 16:42:51 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Wed Mar 4 16:43:03 2009 Subject: svn commit: r189385 - head/lib/libarchive/test Message-ID: <200903050042.n250gpKd057821@svn.freebsd.org> Author: kientzle Date: Thu Mar 5 00:42:50 2009 New Revision: 189385 URL: http://svn.freebsd.org/changeset/base/189385 Log: Merge r357 from libarchive.googlecode.com: bzip2 compression support can always be enabled even if bzlib doesn't exist on this platform; don't give up until we fail to open the file. Modified: head/lib/libarchive/test/test_read_format_isorr_bz2.c Modified: head/lib/libarchive/test/test_read_format_isorr_bz2.c ============================================================================== --- head/lib/libarchive/test/test_read_format_isorr_bz2.c Thu Mar 5 00:41:02 2009 (r189384) +++ head/lib/libarchive/test/test_read_format_isorr_bz2.c Thu Mar 5 00:42:50 2009 (r189385) @@ -55,15 +55,15 @@ DEFINE_TEST(test_read_format_isorr_bz2) extract_reference_file(refname); assert((a = archive_read_new()) != NULL); - r = archive_read_support_compression_bzip2(a); + assertEqualInt(0, archive_read_support_compression_bzip2(a)); + assertEqualInt(0, archive_read_support_format_all(a)); + r = archive_read_open_filename(a, refname, 10240); if (r == ARCHIVE_FATAL) { skipping("Bzip2 decompression unsupported on this platform"); archive_read_finish(a); return; } assertEqualInt(0, r); - assertEqualInt(0, archive_read_support_format_all(a)); - assertEqualInt(0, archive_read_open_filename(a, refname, 10240)); /* First entry is '.' root directory. */ assertEqualInt(0, archive_read_next_header(a, &ae)); From kientzle at FreeBSD.org Wed Mar 4 16:44:13 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Wed Mar 4 16:44:19 2009 Subject: svn commit: r189386 - head/lib/libarchive Message-ID: <200903050044.n250iCfk057894@svn.freebsd.org> Author: kientzle Date: Thu Mar 5 00:44:12 2009 New Revision: 189386 URL: http://svn.freebsd.org/changeset/base/189386 Log: Merge r356 and r358 from libarchive.googlecode.com: Remove a Windows special case from archive_entry.c, add one to archive_check_magic.c. Modified: head/lib/libarchive/archive_check_magic.c head/lib/libarchive/archive_entry.c Modified: head/lib/libarchive/archive_check_magic.c ============================================================================== --- head/lib/libarchive/archive_check_magic.c Thu Mar 5 00:42:50 2009 (r189385) +++ head/lib/libarchive/archive_check_magic.c Thu Mar 5 00:44:12 2009 (r189386) @@ -40,6 +40,10 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_UNISTD_H #include #endif +#ifdef _WIN32 +#include +#include +#endif #include "archive_private.h" @@ -52,6 +56,10 @@ errmsg(const char *m) static void diediedie(void) { +#if defined(_WIN32) && defined(_DEBUG) + /* Cause a breakpoint exception */ + DebugBreak(); +#endif *(char *)0 = 1; /* Deliberately segfault and force a coredump. */ _exit(1); /* If that didn't work, just exit with an error. */ } Modified: head/lib/libarchive/archive_entry.c ============================================================================== --- head/lib/libarchive/archive_entry.c Thu Mar 5 00:42:50 2009 (r189385) +++ head/lib/libarchive/archive_entry.c Thu Mar 5 00:44:12 2009 (r189386) @@ -62,9 +62,6 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_WCHAR_H #include #endif -#ifdef _WIN32 -#include -#endif #include "archive.h" #include "archive_entry.h" @@ -230,13 +227,7 @@ aes_get_wcs(struct aes *aes) w = (wchar_t *)malloc((wcs_length + 1) * sizeof(wchar_t)); if (w == NULL) __archive_errx(1, "No memory for aes_get_wcs()"); -#ifndef _WIN32 r = mbstowcs(w, aes->aes_mbs.s, wcs_length); -#else - r = MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, - aes->aes_mbs.s, (int)aes->aes_mbs.length, w, - (int)wcs_length); -#endif if (r > 0) { w[r] = 0; aes->aes_set |= AES_SET_WCS; From delphij at FreeBSD.org Wed Mar 4 16:57:02 2009 From: delphij at FreeBSD.org (Xin LI) Date: Wed Mar 4 16:57:14 2009 Subject: svn commit: r189387 - in head/lib/libc/db: btree recno Message-ID: <200903050057.n250v1dn058221@svn.freebsd.org> Author: delphij Date: Thu Mar 5 00:57:01 2009 New Revision: 189387 URL: http://svn.freebsd.org/changeset/base/189387 Log: Our realloc(3) and reallocf(3) can handle NULL, which turns it into a malloc(3) call, so don't test if a pointer is NULL. Obtained from: OpenBSD (in spirit) Modified: head/lib/libc/db/btree/bt_overflow.c head/lib/libc/db/btree/bt_utils.c head/lib/libc/db/recno/rec_get.c head/lib/libc/db/recno/rec_utils.c Modified: head/lib/libc/db/btree/bt_overflow.c ============================================================================== --- head/lib/libc/db/btree/bt_overflow.c Thu Mar 5 00:44:12 2009 (r189386) +++ head/lib/libc/db/btree/bt_overflow.c Thu Mar 5 00:57:01 2009 (r189387) @@ -92,7 +92,7 @@ __ovfl_get(BTREE *t, void *p, size_t *ss #endif /* Make the buffer bigger as necessary. */ if (*bufsz < sz) { - *buf = (char *)(*buf == NULL ? malloc(sz) : reallocf(*buf, sz)); + *buf = reallocf(*buf, sz); if (*buf == NULL) return (RET_ERROR); *bufsz = sz; Modified: head/lib/libc/db/btree/bt_utils.c ============================================================================== --- head/lib/libc/db/btree/bt_utils.c Thu Mar 5 00:44:12 2009 (r189386) +++ head/lib/libc/db/btree/bt_utils.c Thu Mar 5 00:57:01 2009 (r189387) @@ -84,8 +84,7 @@ __bt_ret(BTREE *t, EPG *e, DBT *key, DBT key->data = rkey->data; } else if (copy || F_ISSET(t, B_DB_LOCK)) { if (bl->ksize > rkey->size) { - p = (void *)(rkey->data == NULL ? - malloc(bl->ksize) : realloc(rkey->data, bl->ksize)); + p = realloc(rkey->data, bl->ksize); if (p == NULL) return (RET_ERROR); rkey->data = p; @@ -111,9 +110,7 @@ dataonly: } else if (copy || F_ISSET(t, B_DB_LOCK)) { /* Use +1 in case the first record retrieved is 0 length. */ if (bl->dsize + 1 > rdata->size) { - p = (void *)(rdata->data == NULL ? - malloc(bl->dsize + 1) : - realloc(rdata->data, bl->dsize + 1)); + p = realloc(rdata->data, bl->dsize + 1); if (p == NULL) return (RET_ERROR); rdata->data = p; Modified: head/lib/libc/db/recno/rec_get.c ============================================================================== --- head/lib/libc/db/recno/rec_get.c Thu Mar 5 00:44:12 2009 (r189386) +++ head/lib/libc/db/recno/rec_get.c Thu Mar 5 00:57:01 2009 (r189387) @@ -122,9 +122,7 @@ __rec_fpipe(BTREE *t, recno_t top) u_char *p; if (t->bt_rdata.size < t->bt_reclen) { - t->bt_rdata.data = t->bt_rdata.data == NULL ? - malloc(t->bt_reclen) : - reallocf(t->bt_rdata.data, t->bt_reclen); + t->bt_rdata.data = reallocf(t->bt_rdata.data, t->bt_reclen); if (t->bt_rdata.data == NULL) return (RET_ERROR); t->bt_rdata.size = t->bt_reclen; @@ -193,9 +191,7 @@ __rec_vpipe(BTREE *t, recno_t top) if (sz == 0) { len = p - (u_char *)t->bt_rdata.data; t->bt_rdata.size += (sz = 256); - t->bt_rdata.data = t->bt_rdata.data == NULL ? - malloc(t->bt_rdata.size) : - reallocf(t->bt_rdata.data, t->bt_rdata.size); + t->bt_rdata.data = reallocf(t->bt_rdata.data, t->bt_rdata.size); if (t->bt_rdata.data == NULL) return (RET_ERROR); p = (u_char *)t->bt_rdata.data + len; @@ -230,9 +226,7 @@ __rec_fmap(BTREE *t, recno_t top) size_t len; if (t->bt_rdata.size < t->bt_reclen) { - t->bt_rdata.data = t->bt_rdata.data == NULL ? - malloc(t->bt_reclen) : - reallocf(t->bt_rdata.data, t->bt_reclen); + t->bt_rdata.data = reallocf(t->bt_rdata.data, t->bt_reclen); if (t->bt_rdata.data == NULL) return (RET_ERROR); t->bt_rdata.size = t->bt_reclen; Modified: head/lib/libc/db/recno/rec_utils.c ============================================================================== --- head/lib/libc/db/recno/rec_utils.c Thu Mar 5 00:44:12 2009 (r189386) +++ head/lib/libc/db/recno/rec_utils.c Thu Mar 5 00:57:01 2009 (r189387) @@ -67,9 +67,7 @@ __rec_ret(BTREE *t, EPG *e, recno_t nrec /* We have to copy the key, it's not on the page. */ if (sizeof(recno_t) > t->bt_rkey.size) { - p = (void *)(t->bt_rkey.data == NULL ? - malloc(sizeof(recno_t)) : - realloc(t->bt_rkey.data, sizeof(recno_t))); + p = realloc(t->bt_rkey.data, sizeof(recno_t)); if (p == NULL) return (RET_ERROR); t->bt_rkey.data = p; @@ -97,9 +95,7 @@ dataonly: } else if (F_ISSET(t, B_DB_LOCK)) { /* Use +1 in case the first record retrieved is 0 length. */ if (rl->dsize + 1 > t->bt_rdata.size) { - p = (void *)(t->bt_rdata.data == NULL ? - malloc(rl->dsize + 1) : - realloc(t->bt_rdata.data, rl->dsize + 1)); + p = realloc(t->bt_rdata.data, rl->dsize + 1); if (p == NULL) return (RET_ERROR); t->bt_rdata.data = p; From kientzle at FreeBSD.org Wed Mar 4 17:59:50 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Wed Mar 4 17:59:56 2009 Subject: svn commit: r189388 - head/lib/libarchive Message-ID: <200903050159.n251xoFP059357@svn.freebsd.org> Author: kientzle Date: Thu Mar 5 01:59:49 2009 New Revision: 189388 URL: http://svn.freebsd.org/changeset/base/189388 Log: Correct r189383, which mis-merged a change from libarchive.googlecode.com. Modified: head/lib/libarchive/archive_write_disk.c Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Thu Mar 5 00:57:01 2009 (r189387) +++ head/lib/libarchive/archive_write_disk.c Thu Mar 5 01:59:49 2009 (r189388) @@ -573,8 +573,8 @@ write_data_block(struct archive_write_di bytes_to_write = block_end - a->offset; } /* Seek if necessary to the specified offset. */ - if (offset != a->fd_offset) { - if (lseek(a->fd, offset, SEEK_SET) < 0) { + if (a->offset != a->fd_offset) { + if (lseek(a->fd, a->offset, SEEK_SET) < 0) { archive_set_error(&a->archive, errno, "Seek failed"); return (ARCHIVE_FATAL); From rnoland at FreeBSD.org Wed Mar 4 18:03:06 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Wed Mar 4 18:03:38 2009 Subject: svn commit: r189367 - head/sys/dev/pci In-Reply-To: <20090304.135606.1649768480.imp@bsdimp.com> References: <200903041823.n24INmcc049524@svn.freebsd.org> <20090304.135606.1649768480.imp@bsdimp.com> Message-ID: <1236218572.1384.19.camel@widget.2hip.net> On Wed, 2009-03-04 at 13:56 -0700, M. Warner Losh wrote: > In message: <200903041823.n24INmcc049524@svn.freebsd.org> > Robert Noland writes: > : Author: rnoland > : Date: Wed Mar 4 18:23:48 2009 > : New Revision: 189367 > : URL: http://svn.freebsd.org/changeset/base/189367 > : > : Log: > : Extend the management of PCIM_CMD_INTxDIS. > : > : We now explicitly enable INTx during bus_setup_intr() if it is needed. > : Several of the ata drivers were managing this bit internally. This is > : better handled in pci and it should work for all drivers now. > : > : We also mask INTx during bus_teardown_intr() by setting this bit. > : > : Reviewed by: jhb > : MFC after: 3 days > > Note: the INTxDIS bit is new in PCI 3.0, and has no effect on earlier > devices. This should be highlighted in the comments somewhere... It is documented in 2.3 as well, I'm not sure about previous versions of the spec though. robert. > Warner -- Robert Noland FreeBSD -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090305/abcdd2a8/attachment.pgp From kientzle at FreeBSD.org Wed Mar 4 18:19:43 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Wed Mar 4 18:19:50 2009 Subject: svn commit: r189389 - in head/lib/libarchive: . test Message-ID: <200903050219.n252Jg2F059763@svn.freebsd.org> Author: kientzle Date: Thu Mar 5 02:19:42 2009 New Revision: 189389 URL: http://svn.freebsd.org/changeset/base/189389 Log: Merge r364, r378, r379, r393, and r539 from libarchive.googlecode.com: This is the last phase of the "big decompression refactor" that puts a lazy reblocking layer between each pair of read filters. I've also changed the terminology for this area---the two kinds of objects are now called "read filters" and "read filter bidders"---and moved ownership of these objects to the archive_read core. This greatly simplifies implementing new read filters, which can now use peek/consume I/O semantics both for bidding (arbitrary look-ahead!) and for reading streams (look-ahead simplifies handling concatenated streams, for instance). The first merge here is the overhaul proper; the remainder are small fixes to correct errors in the initial implementation. Modified: head/lib/libarchive/archive_read.c head/lib/libarchive/archive_read_private.h head/lib/libarchive/archive_read_support_compression_bzip2.c head/lib/libarchive/archive_read_support_compression_compress.c head/lib/libarchive/archive_read_support_compression_gzip.c head/lib/libarchive/archive_read_support_compression_program.c head/lib/libarchive/test/test_read_position.c Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Thu Mar 5 01:59:49 2009 (r189388) +++ head/lib/libarchive/archive_read.c Thu Mar 5 02:19:42 2009 (r189389) @@ -75,16 +75,6 @@ archive_read_new(void) a->archive.state = ARCHIVE_STATE_NEW; a->entry = archive_entry_new(); - /* Initialize reblocking logic. */ - a->buffer_size = 64 * 1024; /* 64k */ - a->buffer = (char *)malloc(a->buffer_size); - a->next = a->buffer; - if (a->buffer == NULL) { - archive_entry_free(a->entry); - free(a); - return (NULL); - } - return (&a->archive); } @@ -117,28 +107,33 @@ archive_read_open(struct archive *a, voi } static ssize_t -client_read_proxy(struct archive_read_source *self, const void **buff) +client_read_proxy(struct archive_read_filter *self, const void **buff) { - return (self->archive->client.reader)((struct archive *)self->archive, + ssize_t r; + r = (self->archive->client.reader)(&self->archive->archive, self->data, buff); + self->archive->archive.raw_position += r; + return (r); } static int64_t -client_skip_proxy(struct archive_read_source *self, int64_t request) +client_skip_proxy(struct archive_read_filter *self, int64_t request) { - return (self->archive->client.skipper)((struct archive *)self->archive, + int64_t r; + r = (self->archive->client.skipper)(&self->archive->archive, self->data, request); + self->archive->archive.raw_position += r; + return (r); } static int -client_close_proxy(struct archive_read_source *self) +client_close_proxy(struct archive_read_filter *self) { int r = ARCHIVE_OK; if (self->archive->client.closer != NULL) r = (self->archive->client.closer)((struct archive *)self->archive, self->data); - free(self); return (r); } @@ -151,6 +146,7 @@ archive_read_open2(struct archive *_a, v archive_close_callback *client_closer) { struct archive_read *a = (struct archive_read *)_a; + struct archive_read_filter *filter; int e; __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, @@ -172,27 +168,21 @@ archive_read_open2(struct archive *_a, v } /* Save the client functions and mock up the initial source. */ - a->client.opener = client_opener; /* Do we need to remember this? */ a->client.reader = client_reader; a->client.skipper = client_skipper; a->client.closer = client_closer; - a->client.data = client_data; - { - struct archive_read_source *source; - - source = calloc(1, sizeof(*source)); - if (source == NULL) - return (ARCHIVE_FATAL); - source->reader = NULL; - source->upstream = NULL; - source->archive = a; - source->data = client_data; - source->read = client_read_proxy; - source->skip = client_skip_proxy; - source->close = client_close_proxy; - a->source = source; - } + filter = calloc(1, sizeof(*filter)); + if (filter == NULL) + return (ARCHIVE_FATAL); + filter->bidder = NULL; + filter->upstream = NULL; + filter->archive = a; + filter->data = client_data; + filter->read = client_read_proxy; + filter->skip = client_skip_proxy; + filter->close = client_close_proxy; + a->filter = filter; /* In case there's no filter. */ a->archive.compression_code = ARCHIVE_COMPRESSION_NONE; @@ -214,60 +204,49 @@ archive_read_open2(struct archive *_a, v static int build_stream(struct archive_read *a) { - int number_readers, i, bid, best_bid; - struct archive_reader *reader, *best_reader; - struct archive_read_source *source; - const void *block; - ssize_t bytes_read; - - /* Read first block now for compress format detection. */ - bytes_read = (a->source->read)(a->source, &block); - if (bytes_read < 0) { - /* If the first read fails, close before returning error. */ - if (a->source->close != NULL) { - (a->source->close)(a->source); - a->source = NULL; - } - /* source->read should have already set error information. */ - return (ARCHIVE_FATAL); - } + int number_bidders, i, bid, best_bid; + struct archive_read_filter_bidder *bidder, *best_bidder; + struct archive_read_filter *filter; + int r; - number_readers = sizeof(a->readers) / sizeof(a->readers[0]); + for (;;) { + number_bidders = sizeof(a->bidders) / sizeof(a->bidders[0]); - best_bid = 0; - best_reader = NULL; + best_bid = 0; + best_bidder = NULL; - reader = a->readers; - for (i = 0, reader = a->readers; i < number_readers; i++, reader++) { - if (reader->bid != NULL) { - bid = (reader->bid)(reader, block, bytes_read); - if (bid > best_bid) { - best_bid = bid; - best_reader = reader; + bidder = a->bidders; + for (i = 0; i < number_bidders; i++, bidder++) { + if (bidder->bid != NULL) { + bid = (bidder->bid)(bidder, a->filter); + if (bid > best_bid) { + best_bid = bid; + best_bidder = bidder; + } } } - } - /* - * If we have a winner, it becomes the next stage in the pipeline. - */ - if (best_reader != NULL) { - source = (best_reader->init)(a, best_reader, a->source, - block, bytes_read); - if (source == NULL) + /* If no bidder, we're done. */ + if (best_bidder == NULL) { + a->archive.compression_name = a->filter->name; + a->archive.compression_code = a->filter->code; + return (ARCHIVE_OK); + } + + filter + = (struct archive_read_filter *)calloc(1, sizeof(*filter)); + if (filter == NULL) return (ARCHIVE_FATAL); - /* Record the best decompressor for this stream. */ - a->source = source; - /* Recurse to get next pipeline stage. */ - return (build_stream(a)); + filter->bidder = best_bidder; + filter->archive = a; + filter->upstream = a->filter; + r = (best_bidder->init)(filter); + if (r != ARCHIVE_OK) { + free(filter); + return (r); + } + a->filter = filter; } - - /* Save first block of data. */ - a->client_buff = block; - a->client_total = bytes_read; - a->client_next = a->client_buff; - a->client_avail = a->client_total; - return (ARCHIVE_OK); } /* @@ -594,20 +573,24 @@ archive_read_close(struct archive *_a) /* TODO: Clean up the formatters. */ - /* Clean up the stream pipeline. */ - while (a->source != NULL) { - struct archive_read_source *t = a->source->upstream; - r1 = (a->source->close)(a->source); - if (r1 < r) - r = r1; - a->source = t; + /* Clean up the filter pipeline. */ + while (a->filter != NULL) { + struct archive_read_filter *t = a->filter->upstream; + if (a->filter->close != NULL) { + r1 = (a->filter->close)(a->filter); + if (r1 < r) + r = r1; + } + free(a->filter->buffer); + free(a->filter); + a->filter = t; } - /* Release the reader objects. */ - n = sizeof(a->readers)/sizeof(a->readers[0]); + /* Release the bidder objects. */ + n = sizeof(a->bidders)/sizeof(a->bidders[0]); for (i = 0; i < n; i++) { - if (a->readers[i].free != NULL) { - r1 = (a->readers[i].free)(&a->readers[i]); + if (a->bidders[i].free != NULL) { + r1 = (a->bidders[i].free)(&a->bidders[i]); if (r1 < r) r = r1; } @@ -649,7 +632,6 @@ archive_read_finish(struct archive *_a) if (a->entry) archive_entry_free(a->entry); a->archive.magic = 0; - free(a->buffer); free(a); #if ARCHIVE_API_VERSION > 1 return (r); @@ -699,20 +681,20 @@ __archive_read_register_format(struct ar * Used internally by decompression routines to register their bid and * initialization functions. */ -struct archive_reader * -__archive_read_get_reader(struct archive_read *a) +struct archive_read_filter_bidder * +__archive_read_get_bidder(struct archive_read *a) { int i, number_slots; __archive_check_magic(&a->archive, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, - "__archive_read_get_reader"); + "__archive_read_get_bidder"); - number_slots = sizeof(a->readers) / sizeof(a->readers[0]); + number_slots = sizeof(a->bidders) / sizeof(a->bidders[0]); for (i = 0; i < number_slots; i++) { - if (a->readers[i].bid == NULL) - return (a->readers + i); + if (a->bidders[i].bid == NULL) + return (a->bidders + i); } __archive_errx(1, "Not enough slots for compression registration"); @@ -725,7 +707,7 @@ __archive_read_get_reader(struct archive * flexible read-ahead and allows the I/O code to operate in a * zero-copy manner most of the time. * - * In the ideal case, block providers give the I/O code blocks of data + * In the ideal case, filters generate blocks of data * and __archive_read_ahead() just returns pointers directly into * those blocks. Then __archive_read_consume() just bumps those * pointers. Only if your request would span blocks does the I/O @@ -738,7 +720,7 @@ __archive_read_get_reader(struct archive * * "I just want some data." Ask for 1 byte and pay attention to * the "number of bytes available" from __archive_read_ahead(). * You can consume more than you asked for; you just can't consume - * more than is available right now. If you consume everything that's + * more than is available. If you consume everything that's * immediately available, the next read_ahead() call will pull * the next block. * * "I want to output a large block of data." As above, ask for 1 byte, @@ -790,10 +772,17 @@ __archive_read_get_reader(struct archive const void * __archive_read_ahead(struct archive_read *a, size_t min, ssize_t *avail) { + return (__archive_read_filter_ahead(a->filter, min, avail)); +} + +const void * +__archive_read_filter_ahead(struct archive_read_filter *filter, + size_t min, ssize_t *avail) +{ ssize_t bytes_read; size_t tocopy; - if (a->fatal) { + if (filter->fatal) { if (avail) *avail = ARCHIVE_FATAL; return (NULL); @@ -807,68 +796,68 @@ __archive_read_ahead(struct archive_read /* * If we can satisfy from the copy buffer, we're done. */ - if (a->avail >= min) { + if (filter->avail >= min) { if (avail != NULL) - *avail = a->avail; - return (a->next); + *avail = filter->avail; + return (filter->next); } /* * We can satisfy directly from client buffer if everything * currently in the copy buffer is still in the client buffer. */ - if (a->client_total >= a->client_avail + a->avail - && a->client_avail + a->avail >= min) { + if (filter->client_total >= filter->client_avail + filter->avail + && filter->client_avail + filter->avail >= min) { /* "Roll back" to client buffer. */ - a->client_avail += a->avail; - a->client_next -= a->avail; + filter->client_avail += filter->avail; + filter->client_next -= filter->avail; /* Copy buffer is now empty. */ - a->avail = 0; - a->next = a->buffer; + filter->avail = 0; + filter->next = filter->buffer; /* Return data from client buffer. */ if (avail != NULL) - *avail = a->client_avail; - return (a->client_next); + *avail = filter->client_avail; + return (filter->client_next); } /* Move data forward in copy buffer if necessary. */ - if (a->next > a->buffer && - a->next + min > a->buffer + a->buffer_size) { - if (a->avail > 0) - memmove(a->buffer, a->next, a->avail); - a->next = a->buffer; + if (filter->next > filter->buffer && + filter->next + min > filter->buffer + filter->buffer_size) { + if (filter->avail > 0) + memmove(filter->buffer, filter->next, filter->avail); + filter->next = filter->buffer; } /* If we've used up the client data, get more. */ - if (a->client_avail <= 0) { - if (a->end_of_file) { + if (filter->client_avail <= 0) { + if (filter->end_of_file) { if (avail != NULL) *avail = 0; return (NULL); } - bytes_read = (a->source->read)(a->source, - &a->client_buff); + bytes_read = (filter->read)(filter, + &filter->client_buff); if (bytes_read < 0) { /* Read error. */ - a->client_total = a->client_avail = 0; - a->client_next = a->client_buff = NULL; - a->fatal = 1; + filter->client_total = filter->client_avail = 0; + filter->client_next = filter->client_buff = NULL; + filter->fatal = 1; if (avail != NULL) *avail = ARCHIVE_FATAL; return (NULL); } if (bytes_read == 0) { /* Premature end-of-file. */ - a->client_total = a->client_avail = 0; - a->client_next = a->client_buff = NULL; - a->end_of_file = 1; + filter->client_total = filter->client_avail = 0; + filter->client_next = filter->client_buff = NULL; + filter->end_of_file = 1; /* Return whatever we do have. */ if (avail != NULL) - *avail = a->avail; + *avail = filter->avail; return (NULL); } - a->archive.raw_position += bytes_read; - a->client_total = bytes_read; - a->client_avail = a->client_total; - a->client_next = a->client_buff; + filter->position += bytes_read; + filter->client_total = bytes_read; + filter->client_avail = filter->client_total; + filter->client_next = filter->client_buff; } else { @@ -880,19 +869,22 @@ __archive_read_ahead(struct archive_read */ /* Ensure the buffer is big enough. */ - if (min > a->buffer_size) { + if (min > filter->buffer_size) { size_t s, t; char *p; /* Double the buffer; watch for overflow. */ - s = t = a->buffer_size; + s = t = filter->buffer_size; + if (s == 0) + s = min; while (s < min) { t *= 2; if (t <= s) { /* Integer overflow! */ - archive_set_error(&a->archive, - ENOMEM, + archive_set_error( + &filter->archive->archive, + ENOMEM, "Unable to allocate copy buffer"); - a->fatal = 1; + filter->fatal = 1; if (avail != NULL) *avail = ARCHIVE_FATAL; return (NULL); @@ -902,39 +894,41 @@ __archive_read_ahead(struct archive_read /* Now s >= min, so allocate a new buffer. */ p = (char *)malloc(s); if (p == NULL) { - archive_set_error(&a->archive, ENOMEM, + archive_set_error( + &filter->archive->archive, + ENOMEM, "Unable to allocate copy buffer"); - a->fatal = 1; + filter->fatal = 1; if (avail != NULL) *avail = ARCHIVE_FATAL; return (NULL); } /* Move data into newly-enlarged buffer. */ - if (a->avail > 0) - memmove(p, a->next, a->avail); - free(a->buffer); - a->next = a->buffer = p; - a->buffer_size = s; + if (filter->avail > 0) + memmove(p, filter->next, filter->avail); + free(filter->buffer); + filter->next = filter->buffer = p; + filter->buffer_size = s; } /* We can add client data to copy buffer. */ /* First estimate: copy to fill rest of buffer. */ - tocopy = (a->buffer + a->buffer_size) - - (a->next + a->avail); + tocopy = (filter->buffer + filter->buffer_size) + - (filter->next + filter->avail); /* Don't waste time buffering more than we need to. */ - if (tocopy + a->avail > min) - tocopy = min - a->avail; + if (tocopy + filter->avail > min) + tocopy = min - filter->avail; /* Don't copy more than is available. */ - if (tocopy > a->client_avail) - tocopy = a->client_avail; + if (tocopy > filter->client_avail) + tocopy = filter->client_avail; - memcpy(a->next + a->avail, a->client_next, + memcpy(filter->next + filter->avail, filter->client_next, tocopy); /* Remove this data from client buffer. */ - a->client_next += tocopy; - a->client_avail -= tocopy; + filter->client_next += tocopy; + filter->client_avail -= tocopy; /* add it to copy buffer. */ - a->avail += tocopy; + filter->avail += tocopy; } } } @@ -953,16 +947,25 @@ __archive_read_ahead(struct archive_read ssize_t __archive_read_consume(struct archive_read *a, size_t request) { - if (a->avail > 0) { + ssize_t r; + r = __archive_read_filter_consume(a->filter, request); + a->archive.file_position += r; + return (r); +} + +ssize_t +__archive_read_filter_consume(struct archive_read_filter * filter, + size_t request) +{ + if (filter->avail > 0) { /* Read came from copy buffer. */ - a->next += request; - a->avail -= request; + filter->next += request; + filter->avail -= request; } else { /* Read came from client buffer. */ - a->client_next += request; - a->client_avail -= request; + filter->client_next += request; + filter->client_avail -= request; } - a->archive.file_position += request; return (request); } @@ -976,23 +979,29 @@ __archive_read_consume(struct archive_re int64_t __archive_read_skip(struct archive_read *a, int64_t request) { + return (__archive_read_filter_skip(a->filter, request)); +} + +int64_t +__archive_read_filter_skip(struct archive_read_filter *filter, int64_t request) +{ off_t bytes_skipped, total_bytes_skipped = 0; size_t min; - if (a->fatal) + if (filter->fatal) return (-1); /* * If there is data in the buffers already, use that first. */ - if (a->avail > 0) { - min = minimum(request, (off_t)a->avail); - bytes_skipped = __archive_read_consume(a, min); + if (filter->avail > 0) { + min = minimum(request, (off_t)filter->avail); + bytes_skipped = __archive_read_consume(filter->archive, min); request -= bytes_skipped; total_bytes_skipped += bytes_skipped; } - if (a->client_avail > 0) { - min = minimum(request, (off_t)a->client_avail); - bytes_skipped = __archive_read_consume(a, min); + if (filter->client_avail > 0) { + min = minimum(request, (off_t)filter->client_avail); + bytes_skipped = __archive_read_consume(filter->archive, min); request -= bytes_skipped; total_bytes_skipped += bytes_skipped; } @@ -1002,23 +1011,22 @@ __archive_read_skip(struct archive_read * If a client_skipper was provided, try that first. */ #if ARCHIVE_API_VERSION < 2 - if ((a->source->skip != NULL) && (request < SSIZE_MAX)) { + if ((filter->skip != NULL) && (request < SSIZE_MAX)) { #else - if (a->source->skip != NULL) { + if (filter->skip != NULL) { #endif - bytes_skipped = (a->source->skip)(a->source, request); + bytes_skipped = (filter->skip)(filter, request); if (bytes_skipped < 0) { /* error */ - a->client_total = a->client_avail = 0; - a->client_next = a->client_buff = NULL; - a->fatal = 1; + filter->client_total = filter->client_avail = 0; + filter->client_next = filter->client_buff = NULL; + filter->fatal = 1; return (bytes_skipped); } + filter->archive->archive.file_position += bytes_skipped; total_bytes_skipped += bytes_skipped; - a->archive.file_position += bytes_skipped; request -= bytes_skipped; - a->client_next = a->client_buff; - a->archive.raw_position += bytes_skipped; - a->client_avail = a->client_total = 0; + filter->client_next = filter->client_buff; + filter->client_avail = filter->client_total = 0; } /* * Note that client_skipper will usually not satisfy the @@ -1029,18 +1037,20 @@ __archive_read_skip(struct archive_read while (request > 0) { const void* dummy_buffer; ssize_t bytes_read; - dummy_buffer = __archive_read_ahead(a, 1, &bytes_read); + dummy_buffer = __archive_read_ahead(filter->archive, + 1, &bytes_read); if (bytes_read < 0) return (bytes_read); if (bytes_read == 0) { /* We hit EOF before we satisfied the skip request. */ - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + archive_set_error(&filter->archive->archive, + ARCHIVE_ERRNO_MISC, "Truncated input file (need to skip %jd bytes)", (intmax_t)request); return (ARCHIVE_FATAL); } min = (size_t)(minimum(bytes_read, request)); - bytes_read = __archive_read_consume(a, min); + bytes_read = __archive_read_consume(filter->archive, min); total_bytes_skipped += bytes_read; request -= bytes_read; } Modified: head/lib/libarchive/archive_read_private.h ============================================================================== --- head/lib/libarchive/archive_read_private.h Thu Mar 5 01:59:49 2009 (r189388) +++ head/lib/libarchive/archive_read_private.h Thu Mar 5 02:19:42 2009 (r189389) @@ -33,72 +33,80 @@ #include "archive_private.h" struct archive_read; -struct archive_reader; -struct archive_read_source; +struct archive_read_filter_bidder; +struct archive_read_filter; /* - * A "reader" knows how to provide blocks. That can include something - * that reads blocks from disk or socket or a transformation layer - * that reads blocks from another source and transforms them. This - * includes decompression and decryption filters. - * - * How bidding works: + * How bidding works for filters: * * The bid manager reads the first block from the current source. * * It shows that block to each registered bidder. - * * The winning bidder is initialized (with the block and information - * about the source) - * * The winning bidder becomes the new source and the process repeats - * This ends only when no reader provides a non-zero bid. + * * The bid manager creates a new filter structure for the winning + * bidder and gives the winning bidder a chance to initialize it. + * * The new filter becomes the top filter in the archive_read structure + * and we repeat the process. + * This ends only when no bidder provides a non-zero bid. */ -struct archive_reader { - /* Configuration data for the reader. */ +struct archive_read_filter_bidder { + /* Configuration data for the bidder. */ void *data; - /* Bidder is handed the initial block from its source. */ - int (*bid)(struct archive_reader *, const void *buff, size_t); - /* Init() is given the archive, upstream source, and the initial - * block above. It returns a populated source structure. */ - struct archive_read_source *(*init)(struct archive_read *, - struct archive_reader *, struct archive_read_source *source, - const void *, size_t); - /* Release the reader and any configuration data it allocated. */ - int (*free)(struct archive_reader *); + /* Taste the upstream filter to see if we handle this. */ + int (*bid)(struct archive_read_filter_bidder *, + struct archive_read_filter *); + /* Initialize a newly-created filter. */ + int (*init)(struct archive_read_filter *); + /* Release the bidder's configuration data. */ + int (*free)(struct archive_read_filter_bidder *); }; /* - * A "source" is an instance of a reader. This structure is - * allocated and initialized by the init() method of a reader - * above. + * This structure is allocated within the archive_read core + * and initialized by archive_read and the init() method of the + * corresponding bidder above. */ -struct archive_read_source { - /* Essentially all sources will need these values, so +struct archive_read_filter { + /* Essentially all filters will need these values, so * just declare them here. */ - struct archive_reader *reader; /* Reader that I'm an instance of. */ - struct archive_read_source *upstream; /* Who I get blocks from. */ - struct archive_read *archive; /* associated archive. */ + struct archive_read_filter_bidder *bidder; /* My bidder. */ + struct archive_read_filter *upstream; /* Who I read from. */ + struct archive_read *archive; /* Associated archive. */ /* Return next block. */ - ssize_t (*read)(struct archive_read_source *, const void **); + ssize_t (*read)(struct archive_read_filter *, const void **); /* Skip forward this many bytes. */ - int64_t (*skip)(struct archive_read_source *self, int64_t request); - /* Close (recursively) and free(self). */ - int (*close)(struct archive_read_source *self); + int64_t (*skip)(struct archive_read_filter *self, int64_t request); + /* Close (just this filter) and free(self). */ + int (*close)(struct archive_read_filter *self); /* My private data. */ void *data; + + const char *name; + int code; + + /* Used by reblocking logic. */ + char *buffer; + size_t buffer_size; + char *next; /* Current read location. */ + size_t avail; /* Bytes in my buffer. */ + const void *client_buff; /* Client buffer information. */ + size_t client_total; + const char *client_next; + size_t client_avail; + int64_t position; + char end_of_file; + char fatal; }; /* - * The client source is almost the same as an internal source. + * The client looks a lot like a filter, so we just wrap it here. * - * TODO: Make archive_read_source and archive_read_client identical so + * TODO: Make archive_read_filter and archive_read_client identical so * that users of the library can easily register their own * transformation filters. This will probably break the API/ABI and - * so should be deferred until libarchive 3.0. + * so should be deferred at least until libarchive 3.0. */ struct archive_read_client { - archive_open_callback *opener; archive_read_callback *reader; archive_skip_callback *skipper; archive_close_callback *closer; - void *data; }; struct archive_read { @@ -122,28 +130,15 @@ struct archive_read { /* Callbacks to open/read/write/close client archive stream. */ struct archive_read_client client; - /* Registered readers. */ - struct archive_reader readers[8]; + /* Registered filter bidders. */ + struct archive_read_filter_bidder bidders[8]; - /* Source */ - struct archive_read_source *source; + /* Last filter in chain */ + struct archive_read_filter *filter; /* File offset of beginning of most recently-read header. */ off_t header_position; - - /* Used by reblocking logic. */ - char *buffer; - size_t buffer_size; - char *next; /* Current read location. */ - size_t avail; /* Bytes in my buffer. */ - const void *client_buff; /* Client buffer information. */ - size_t client_total; - const char *client_next; - size_t client_avail; - char end_of_file; - char fatal; - /* * Format detection is mostly the same as compression * detection, with one significant difference: The bidders @@ -177,13 +172,14 @@ int __archive_read_register_format(struc int (*read_data_skip)(struct archive_read *), int (*cleanup)(struct archive_read *)); -struct archive_reader - *__archive_read_get_reader(struct archive_read *a); +struct archive_read_filter_bidder + *__archive_read_get_bidder(struct archive_read *a); -const void - *__archive_read_ahead(struct archive_read *, size_t, ssize_t *); -ssize_t - __archive_read_consume(struct archive_read *, size_t); -int64_t - __archive_read_skip(struct archive_read *, int64_t); +const void *__archive_read_ahead(struct archive_read *, size_t, ssize_t *); +const void *__archive_read_filter_ahead(struct archive_read_filter *, + size_t, ssize_t *); +ssize_t __archive_read_consume(struct archive_read *, size_t); +ssize_t __archive_read_filter_consume(struct archive_read_filter *, size_t); +int64_t __archive_read_skip(struct archive_read *, int64_t); +int64_t __archive_read_filter_skip(struct archive_read_filter *, int64_t); #endif Modified: head/lib/libarchive/archive_read_support_compression_bzip2.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_bzip2.c Thu Mar 5 01:59:49 2009 (r189388) +++ head/lib/libarchive/archive_read_support_compression_bzip2.c Thu Mar 5 02:19:42 2009 (r189389) @@ -57,9 +57,9 @@ struct private_data { char eof; /* True = found end of compressed data. */ }; -/* Bzip2 source */ -static ssize_t bzip2_source_read(struct archive_read_source *, const void **); -static int bzip2_source_close(struct archive_read_source *); +/* Bzip2 filter */ +static ssize_t bzip2_filter_read(struct archive_read_filter *, const void **); +static int bzip2_filter_close(struct archive_read_filter *); #endif /* @@ -68,17 +68,15 @@ static int bzip2_source_close(struct arc * error messages.) So the bid framework here gets compiled even * if bzlib is unavailable. */ -static int bzip2_reader_bid(struct archive_reader *, const void *, size_t); -static struct archive_read_source *bzip2_reader_init(struct archive_read *, - struct archive_reader *, struct archive_read_source *, - const void *, size_t); -static int bzip2_reader_free(struct archive_reader *); +static int bzip2_reader_bid(struct archive_read_filter_bidder *, struct archive_read_filter *); +static int bzip2_reader_init(struct archive_read_filter *); +static int bzip2_reader_free(struct archive_read_filter_bidder *); int archive_read_support_compression_bzip2(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_reader *reader = __archive_read_get_reader(a); + struct archive_read_filter_bidder *reader = __archive_read_get_bidder(a); if (reader == NULL) return (ARCHIVE_FATAL); @@ -91,7 +89,7 @@ archive_read_support_compression_bzip2(s } static int -bzip2_reader_free(struct archive_reader *self){ +bzip2_reader_free(struct archive_read_filter_bidder *self){ (void)self; /* UNUSED */ return (ARCHIVE_OK); } @@ -104,61 +102,38 @@ bzip2_reader_free(struct archive_reader * from verifying as much as we would like. */ static int -bzip2_reader_bid(struct archive_reader *self, const void *buff, size_t len) +bzip2_reader_bid(struct archive_read_filter_bidder *self, struct archive_read_filter *filter) { const unsigned char *buffer; + size_t avail; int bits_checked; (void)self; /* UNUSED */ - if (len < 1) + /* Minimal bzip2 archive is 14 bytes. */ + buffer = __archive_read_filter_ahead(filter, 14, &avail); + if (buffer == NULL) return (0); - buffer = (const unsigned char *)buff; + /* First three bytes must be "BZh" */ bits_checked = 0; - if (buffer[0] != 'B') /* Verify first ID byte. */ + if (buffer[0] != 'B' || buffer[1] != 'Z' || buffer[2] != 'h') return (0); - bits_checked += 8; - if (len < 2) - return (bits_checked); - - if (buffer[1] != 'Z') /* Verify second ID byte. */ - return (0); - bits_checked += 8; - if (len < 3) - return (bits_checked); - - if (buffer[2] != 'h') /* Verify third ID byte. */ - return (0); - bits_checked += 8; - if (len < 4) - return (bits_checked); + bits_checked += 24; + /* Next follows a compression flag which must be an ASCII digit. */ if (buffer[3] < '1' || buffer[3] > '9') return (0); bits_checked += 5; - if (len < 5) - return (bits_checked); /* After BZh[1-9], there must be either a data block * which begins with 0x314159265359 or an end-of-data * marker of 0x177245385090. */ - - if (buffer[4] == 0x31) { - /* Verify the data block signature. */ - size_t s = len; - if (s > 10) s = 10; - if (memcmp(buffer + 4, "\x31\x41\x59\x26\x53\x59", s - 4) != 0) - return (0); - bits_checked += 8 * (s - 4); - } else if (buffer[4] == 0x17) { - /* Verify the end-of-data marker. */ - size_t s = len; - if (s > 10) s = 10; - if (memcmp(buffer + 4, "\x17\x72\x45\x38\x50\x90", s - 4) != 0) - return (0); - bits_checked += 8 * (s - 4); - } else + if (memcmp(buffer + 4, "\x31\x41\x59\x26\x53\x59", 6) == 0) + bits_checked += 48; + else if (memcmp(buffer + 4, "\x17\x72\x45\x38\x50\x90", 6) == 0) + bits_checked += 48; + else return (0); return (bits_checked); @@ -171,19 +146,13 @@ bzip2_reader_bid(struct archive_reader * * decompression. We can, however, still detect compressed archives * and emit a useful message. */ -static struct archive_read_source * -bzip2_reader_init(struct archive_read *a, struct archive_reader *reader, - struct archive_read_source *upstream, const void *buff, size_t n) +static int +bzip2_reader_init(struct archive_read_filter *self) { - (void)a; /* UNUSED */ - (void)reader; /* UNUSED */ - (void)upstream; /* UNUSED */ - (void)buff; /* UNUSED */ - (void)n; /* UNUSED */ - archive_set_error(&a->archive, -1, + archive_set_error(&self->archive->archive, -1, "This version of libarchive was compiled without bzip2 support"); - return (NULL); + return (ARCHIVE_FATAL); } @@ -192,67 +161,45 @@ bzip2_reader_init(struct archive_read *a /* * Setup the callbacks. */ -static struct archive_read_source * -bzip2_reader_init(struct archive_read *a, struct archive_reader *reader, - struct archive_read_source *upstream, const void *buff, size_t n) +static int +bzip2_reader_init(struct archive_read_filter *self) { static const size_t out_block_size = 64 * 1024; void *out_block; - struct archive_read_source *self; struct private_data *state; - (void)reader; /* UNUSED */ + self->code = ARCHIVE_COMPRESSION_BZIP2; + self->name = "bzip2"; - a->archive.compression_code = ARCHIVE_COMPRESSION_BZIP2; - a->archive.compression_name = "bzip2"; - - self = calloc(sizeof(*self), 1); state = (struct private_data *)calloc(sizeof(*state), 1); out_block = (unsigned char *)malloc(out_block_size); if (self == NULL || state == NULL || out_block == NULL) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate data for %s decompression", - a->archive.compression_name); + archive_set_error(&self->archive->archive, ENOMEM, + "Can't allocate data for bzip2 decompression"); free(out_block); free(state); - free(self); - return (NULL); + return (ARCHIVE_FATAL); } - - self->archive = a; self->data = state; state->out_block_size = out_block_size; state->out_block = out_block; - self->upstream = upstream; - self->read = bzip2_source_read; + self->read = bzip2_filter_read; self->skip = NULL; /* not supported */ - self->close = bzip2_source_close; - - /* - * A bug in bzlib.h: stream.next_in should be marked 'const' - * but isn't (the library never alters data through the *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From kientzle at FreeBSD.org Wed Mar 4 18:37:07 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Wed Mar 4 18:37:13 2009 Subject: svn commit: r189390 - in head/lib/libarchive: . test Message-ID: <200903050237.n252b63N060164@svn.freebsd.org> Author: kientzle Date: Thu Mar 5 02:37:05 2009 New Revision: 189390 URL: http://svn.freebsd.org/changeset/base/189390 Log: Merge r551,r561 from libarchive.googlecode.com: Update gzip read filter to fully take advantage of the new peek/consume I/O support. In particular, this now properly handles concatenated gzip streams. Modified: head/lib/libarchive/archive_read_support_compression_gzip.c head/lib/libarchive/test/test_compat_gzip.c Modified: head/lib/libarchive/archive_read_support_compression_gzip.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_gzip.c Thu Mar 5 02:19:42 2009 (r189389) +++ head/lib/libarchive/archive_read_support_compression_gzip.c Thu Mar 5 02:37:05 2009 (r189390) @@ -51,14 +51,11 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_ZLIB_H struct private_data { z_stream stream; + char in_stream; unsigned char *out_block; size_t out_block_size; int64_t total_out; unsigned long crc; - int header_count; - char header_done; - char header_state; - char header_flags; char eof; /* True = found end of compressed data. */ }; @@ -72,10 +69,14 @@ static int gzip_filter_close(struct arch * them. (In fact, we like detecting them because we can give better * error messages.) So the bid framework here gets compiled even * if zlib is unavailable. + * + * TODO: If zlib is unavailable, gzip_bidder_init() should + * use the compress_program framework to try to fire up an external + * gunzip program. */ -static int gzip_bidder_bid(struct archive_read_filter_bidder *, struct archive_read_filter *); +static int gzip_bidder_bid(struct archive_read_filter_bidder *, + struct archive_read_filter *); static int gzip_bidder_init(struct archive_read_filter *); -static int gzip_bidder_free(struct archive_read_filter_bidder *); int archive_read_support_compression_gzip(struct archive *_a) @@ -89,62 +90,116 @@ archive_read_support_compression_gzip(st bidder->data = NULL; bidder->bid = gzip_bidder_bid; bidder->init = gzip_bidder_init; - bidder->free = gzip_bidder_free; - return (ARCHIVE_OK); -} - -static int -gzip_bidder_free(struct archive_read_filter_bidder *self){ - (void)self; /* UNUSED */ + bidder->free = NULL; /* No data, so no cleanup necessary. */ return (ARCHIVE_OK); } /* - * Test whether we can handle this data. + * Read and verify the header. * - * This logic returns zero if any part of the signature fails. It - * also tries to Do The Right Thing if a very short buffer prevents us - * from verifying as much as we would like. + * Returns zero if the header couldn't be validated, else returns + * number of bytes in header. If pbits is non-NULL, it receives a + * count of bits verified, suitable for use by bidder. */ static int -gzip_bidder_bid(struct archive_read_filter_bidder *self, - struct archive_read_filter *filter) +peek_at_header(struct archive_read_filter *filter, int *pbits) { - const unsigned char *buffer; - size_t avail; - int bits_checked; - - (void)self; /* UNUSED */ - - buffer = __archive_read_filter_ahead(filter, 8, &avail); - if (buffer == NULL) + const unsigned char *p; + ssize_t avail, len; + int bits = 0; + int header_flags; + + /* Start by looking at the first ten bytes of the header, which + * is all fixed layout. */ + len = 10; + p = __archive_read_filter_ahead(filter, len, &avail); + if (p == NULL || avail == 0) return (0); - - bits_checked = 0; - if (buffer[0] != 037) /* Verify first ID byte. */ + if (p[0] != 037) return (0); - bits_checked += 8; - - if (buffer[1] != 0213) /* Verify second ID byte. */ + bits += 8; + if (p[1] != 0213) return (0); - bits_checked += 8; - - if (buffer[2] != 8) /* Compression must be 'deflate'. */ + bits += 8; + if (p[2] != 8) /* We only support deflation. */ return (0); - bits_checked += 8; + bits += 8; + if ((p[3] & 0xE0)!= 0) /* No reserved flags set. */ + return (0); + bits += 3; + header_flags = p[3]; + /* Bytes 4-7 are mod time. */ + /* Byte 8 is deflate flags. */ + /* XXXX TODO: return deflate flags back to consume_header for use + in initializing the decompressor. */ + /* Byte 9 is OS. */ + + /* Optional extra data: 2 byte length plus variable body. */ + if (header_flags & 4) { + p = __archive_read_filter_ahead(filter, len + 2, &avail); + if (p == NULL) + return (0); + len += ((int)p[len + 1] << 8) | (int)p[len]; + } - if ((buffer[3] & 0xE0)!= 0) /* No reserved flags set. */ + /* Null-terminated optional filename. */ + if (header_flags & 8) { + do { + ++len; + if (avail < len) + p = __archive_read_filter_ahead(filter, + len, &avail); + if (p == NULL) + return (0); + } while (p[len - 1] != 0); + } + + /* Null-terminated optional comment. */ + if (header_flags & 16) { + do { + ++len; + if (avail < len) + p = __archive_read_filter_ahead(filter, + len, &avail); + if (p == NULL) + return (0); + } while (p[len - 1] != 0); + } + + /* Optional header CRC */ + if ((header_flags & 2)) { + p = __archive_read_filter_ahead(filter, len + 2, &avail); + if (p == NULL) + return (0); +#if 0 + int hcrc = ((int)p[len + 1] << 8) | (int)p[len]; + int crc = /* XXX TODO: Compute header CRC. */; + if (crc != hcrc) return (0); - bits_checked += 3; + bits += 16; +#endif + len += 2; + } + + if (pbits != NULL) + *pbits = bits; + return (len); +} + +/* + * Bidder just verifies the header and returns the number of verified bits. + */ +static int +gzip_bidder_bid(struct archive_read_filter_bidder *self, + struct archive_read_filter *filter) +{ + int bits_checked; - /* - * TODO: Verify more; in particular, gzip has an optional - * header CRC, which would give us 16 more verified bits. We - * may also be able to verify certain constraints on other - * fields. - */ + (void)self; /* UNUSED */ - return (bits_checked); + if (peek_at_header(filter, &bits_checked)) + return (bits_checked); + return (0); } @@ -185,8 +240,7 @@ gzip_bidder_init(struct archive_read_fil free(out_block); free(state); archive_set_error(&self->archive->archive, ENOMEM, - "Can't allocate data for %s decompression", - self->name); + "Can't allocate data for gzip decompression"); return (ARCHIVE_FATAL); } @@ -197,148 +251,99 @@ gzip_bidder_init(struct archive_read_fil self->skip = NULL; /* not supported */ self->close = gzip_filter_close; - state->crc = crc32(0L, NULL, 0); - state->header_done = 0; /* We've not yet begun to parse header... */ + state->in_stream = 0; /* We're not actually within a stream yet. */ return (ARCHIVE_OK); } static int -header(struct archive_read_filter *self) +consume_header(struct archive_read_filter *self) { struct private_data *state; - int ret, b; + ssize_t avail; + size_t len; + int ret; state = (struct private_data *)self->data; - /* - * If still parsing the header, interpret the - * next byte. - */ - b = *(state->stream.next_in++); - state->stream.avail_in--; - - /* - * Simple state machine to parse the GZip header one byte at - * a time. If you see a way to make this easier to understand, - * please let me know. ;-) - */ - switch (state->header_state) { - case 0: /* First byte of signature. */ - /* We only return EOF for a failure here. */ - if (b != 037) - return (ARCHIVE_EOF); - state->header_state = 1; + /* If this is a real header, consume it. */ + len = peek_at_header(self->upstream, NULL); + if (len == 0) + return (ARCHIVE_EOF); + __archive_read_filter_consume(self->upstream, len); + + /* Initialize CRC accumulator. */ + state->crc = crc32(0L, NULL, 0); + + /* Initialize compression library. */ + state->stream.next_in = (unsigned char *)(uintptr_t) + __archive_read_filter_ahead(self->upstream, 1, &avail); + state->stream.avail_in = avail; + ret = inflateInit2(&(state->stream), + -15 /* Don't check for zlib header */); + + /* Decipher the error code. */ + switch (ret) { + case Z_OK: + state->in_stream = 1; + return (ARCHIVE_OK); + case Z_STREAM_ERROR: + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, + "Internal error initializing compression library: " + "invalid setup parameter"); break; - case 1: /* Second byte of signature. */ - case 2: /* Compression type must be 8 == deflate. */ - if (b != (0xff & "\037\213\010"[(int)state->header_state])) { - archive_set_error(&self->archive->archive, - ARCHIVE_ERRNO_MISC, - "Invalid GZip header (saw %d at offset %d)", - b, state->header_state); - return (ARCHIVE_FATAL); - } - ++state->header_state; + case Z_MEM_ERROR: + archive_set_error(&self->archive->archive, ENOMEM, + "Internal error initializing compression library: " + "out of memory"); break; - case 3: /* GZip flags. */ - state->header_flags = b; - state->header_state = 4; + case Z_VERSION_ERROR: + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, + "Internal error initializing compression library: " + "invalid library version"); break; - case 4: case 5: case 6: case 7: /* Mod time. */ - case 8: /* Deflate flags. */ - case 9: /* OS. */ - ++state->header_state; + default: + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, + "Internal error initializing compression library: " + " Zlib error %d", ret); break; - case 10: /* Optional Extra: First byte of Length. */ - if ((state->header_flags & 4)) { - state->header_count = 255 & (int)b; - state->header_state = 11; - break; - } - /* Fall through if no Optional Extra field. */ - case 11: /* Optional Extra: Second byte of Length. */ - if ((state->header_flags & 4)) { - state->header_count - = (0xff00 & ((int)b << 8)) | state->header_count; - state->header_state = 12; - break; - } - /* Fall through if no Optional Extra field. */ - case 12: /* Optional Extra Field: counted length. */ - if ((state->header_flags & 4)) { - --state->header_count; - if (state->header_count == 0) state->header_state = 13; - else state->header_state = 12; - break; - } - /* Fall through if no Optional Extra field. */ - case 13: /* Optional Original Filename. */ - if ((state->header_flags & 8)) { - if (b == 0) state->header_state = 14; - else state->header_state = 13; - break; - } - /* Fall through if no Optional Original Filename. */ - case 14: /* Optional Comment. */ - if ((state->header_flags & 16)) { - if (b == 0) state->header_state = 15; - else state->header_state = 14; - break; - } - /* Fall through if no Optional Comment. */ - case 15: /* Optional Header CRC: First byte. */ - if ((state->header_flags & 2)) { - state->header_state = 16; - break; - } - /* Fall through if no Optional Header CRC. */ - case 16: /* Optional Header CRC: Second byte. */ - if ((state->header_flags & 2)) { - state->header_state = 17; - break; - } - /* Fall through if no Optional Header CRC. */ - case 17: /* First byte of compressed data. */ - state->header_done = 1; /* done with header */ - state->stream.avail_in++; /* Discard first byte. */ - state->stream.next_in--; - - /* Initialize compression library. */ - ret = inflateInit2(&(state->stream), - -15 /* Don't check for zlib header */); + } + return (ARCHIVE_FATAL); +} - /* Decipher the error code. */ - switch (ret) { - case Z_OK: - return (ARCHIVE_OK); - case Z_STREAM_ERROR: - archive_set_error(&self->archive->archive, - ARCHIVE_ERRNO_MISC, - "Internal error initializing compression library: " - "invalid setup parameter"); - break; - case Z_MEM_ERROR: - archive_set_error(&self->archive->archive, ENOMEM, - "Internal error initializing compression library: " - "out of memory"); - break; - case Z_VERSION_ERROR: - archive_set_error(&self->archive->archive, - ARCHIVE_ERRNO_MISC, - "Internal error initializing compression library: " - "invalid library version"); - break; - default: - archive_set_error(&self->archive->archive, - ARCHIVE_ERRNO_MISC, - "Internal error initializing compression library: " - " Zlib error %d", ret); - break; - } +static int +consume_trailer(struct archive_read_filter *self) +{ + struct private_data *state; + const unsigned char *p; + ssize_t avail; + + state = (struct private_data *)self->data; + + state->in_stream = 0; + switch (inflateEnd(&(state->stream))) { + case Z_OK: + break; + default: + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, + "Failed to clean up gzip decompressor"); return (ARCHIVE_FATAL); } + /* GZip trailer is a fixed 8 byte structure. */ + p = __archive_read_filter_ahead(self->upstream, 8, &avail); + if (p == NULL || avail == 0) + return (ARCHIVE_FATAL); + + /* XXX TODO: Verify the length and CRC. */ + + /* We've verified the trailer, so consume it now. */ + __archive_read_filter_consume(self->upstream, 8); + return (ARCHIVE_OK); } @@ -346,12 +351,11 @@ static ssize_t gzip_filter_read(struct archive_read_filter *self, const void **p) { struct private_data *state; - size_t read_avail, decompressed; - const void *read_buf; + size_t decompressed; + ssize_t avail_in; int ret; state = (struct private_data *)self->data; - read_avail = 0; /* Empty our output buffer. */ state->stream.next_out = state->out_block; @@ -359,62 +363,47 @@ gzip_filter_read(struct archive_read_fil /* Try to fill the output buffer. */ while (state->stream.avail_out > 0 && !state->eof) { - /* If the last upstream block is done, get another one. */ - if (state->stream.avail_in == 0) { - read_buf = __archive_read_filter_ahead(self->upstream, - 1, &ret); - if (read_buf == NULL) - return (ARCHIVE_FATAL); - /* stream.next_in is really const, but zlib - * doesn't declare it so. */ - state->stream.next_in - = (unsigned char *)(uintptr_t)read_buf; - state->stream.avail_in = ret; - /* There is no more data, return whatever we have. */ - if (ret == 0) { + /* If we're not in a stream, read a header + * and initialize the decompression library. */ + if (!state->in_stream) { + ret = consume_header(self); + if (ret == ARCHIVE_EOF) { state->eof = 1; break; } - __archive_read_filter_consume(self->upstream, ret); - } - - /* If we're still parsing header bytes, walk through those. */ - if (!state->header_done) { - ret = header(self); if (ret < ARCHIVE_OK) return (ret); - if (ret == ARCHIVE_EOF) - state->eof = 1; - } else { - /* Decompress as much as we can in one pass. */ - /* XXX Skip trailer XXX */ - ret = inflate(&(state->stream), 0); - switch (ret) { - case Z_STREAM_END: /* Found end of stream. */ - switch (inflateEnd(&(state->stream))) { - case Z_OK: - break; - default: - archive_set_error(&self->archive->archive, - ARCHIVE_ERRNO_MISC, - "Failed to clean up gzip decompressor"); - return (ARCHIVE_FATAL); - } - /* zlib has been torn down */ - state->header_done = 0; - state->eof = 1; - /* FALL THROUGH */ - case Z_OK: /* Decompressor made some progress. */ - /* If we filled our buffer, update stats and return. */ - break; - default: - /* Return an error. */ - archive_set_error(&self->archive->archive, - ARCHIVE_ERRNO_MISC, - "%s decompression failed", - self->archive->archive.compression_name); - return (ARCHIVE_FATAL); - } + } + + /* Peek at the next available data. */ + /* ZLib treats stream.next_in as const but doesn't declare + * it so, hence this ugly cast. */ + state->stream.next_in = (unsigned char *)(uintptr_t) + __archive_read_filter_ahead(self->upstream, 1, &avail_in); + if (state->stream.next_in == NULL) + return (ARCHIVE_FATAL); + state->stream.avail_in = avail_in; + + /* Decompress and consume some of that data. */ + ret = inflate(&(state->stream), 0); + switch (ret) { + case Z_OK: /* Decompressor made some progress. */ + __archive_read_filter_consume(self->upstream, + avail_in - state->stream.avail_in); + break; + case Z_STREAM_END: /* Found end of stream. */ + __archive_read_filter_consume(self->upstream, + avail_in - state->stream.avail_in); + /* Consume the stream trailer; release the + * decompression library. */ + ret = consume_trailer(self); + break; + default: + /* Return an error. */ + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, + "gzip decompression failed"); + return (ARCHIVE_FATAL); } } @@ -426,7 +415,6 @@ gzip_filter_read(struct archive_read_fil else *p = state->out_block; return (decompressed); - } /* @@ -441,15 +429,14 @@ gzip_filter_close(struct archive_read_fi state = (struct private_data *)self->data; ret = ARCHIVE_OK; - if (state->header_done) { + if (state->in_stream) { switch (inflateEnd(&(state->stream))) { case Z_OK: break; default: archive_set_error(&(self->archive->archive), - ARCHIVE_ERRNO_MISC, - "Failed to clean up %s compressor", - self->archive->archive.compression_name); + ARCHIVE_ERRNO_MISC, + "Failed to clean up gzip compressor"); ret = ARCHIVE_FATAL; } } Modified: head/lib/libarchive/test/test_compat_gzip.c ============================================================================== --- head/lib/libarchive/test/test_compat_gzip.c Thu Mar 5 02:19:42 2009 (r189389) +++ head/lib/libarchive/test/test_compat_gzip.c Thu Mar 5 02:37:05 2009 (r189390) @@ -86,7 +86,7 @@ DEFINE_TEST(test_compat_gzip) /* This sample has been 'split', each piece compressed separately, * then concatenated. Gunzip will emit the concatenated result. */ /* Not supported in libarchive 2.6 and earlier */ - /* verify("test_compat_gzip_1.tgz"); */ + verify("test_compat_gzip_1.tgz"); /* This sample has been compressed as a single stream, but then * some unrelated garbage text has been appended to the end. */ verify("test_compat_gzip_2.tgz"); From imp at bsdimp.com Wed Mar 4 18:43:49 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Wed Mar 4 18:44:07 2009 Subject: svn commit: r189367 - head/sys/dev/pci In-Reply-To: <1236218572.1384.19.camel@widget.2hip.net> References: <200903041823.n24INmcc049524@svn.freebsd.org> <20090304.135606.1649768480.imp@bsdimp.com> <1236218572.1384.19.camel@widget.2hip.net> Message-ID: <20090304.194158.1159134197.imp@bsdimp.com> In message: <1236218572.1384.19.camel@widget.2hip.net> Robert Noland writes: : On Wed, 2009-03-04 at 13:56 -0700, M. Warner Losh wrote: : > In message: <200903041823.n24INmcc049524@svn.freebsd.org> : > Robert Noland writes: : > : Author: rnoland : > : Date: Wed Mar 4 18:23:48 2009 : > : New Revision: 189367 : > : URL: http://svn.freebsd.org/changeset/base/189367 : > : : > : Log: : > : Extend the management of PCIM_CMD_INTxDIS. : > : : > : We now explicitly enable INTx during bus_setup_intr() if it is needed. : > : Several of the ata drivers were managing this bit internally. This is : > : better handled in pci and it should work for all drivers now. : > : : > : We also mask INTx during bus_teardown_intr() by setting this bit. : > : : > : Reviewed by: jhb : > : MFC after: 3 days : > : > Note: the INTxDIS bit is new in PCI 3.0, and has no effect on earlier : > devices. This should be highlighted in the comments somewhere... : : It is documented in 2.3 as well, I'm not sure about previous versions of : the spec though. It isn't in 2.2, and even after 2.3 it is "optional". Warner From rnoland at FreeBSD.org Wed Mar 4 19:44:00 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Wed Mar 4 19:44:06 2009 Subject: svn commit: r189367 - head/sys/dev/pci In-Reply-To: <20090304.194158.1159134197.imp@bsdimp.com> References: <200903041823.n24INmcc049524@svn.freebsd.org> <20090304.135606.1649768480.imp@bsdimp.com> <1236218572.1384.19.camel@widget.2hip.net> <20090304.194158.1159134197.imp@bsdimp.com> Message-ID: <1236224629.1384.22.camel@widget.2hip.net> On Wed, 2009-03-04 at 19:41 -0700, M. Warner Losh wrote: > In message: <1236218572.1384.19.camel@widget.2hip.net> > Robert Noland writes: > : On Wed, 2009-03-04 at 13:56 -0700, M. Warner Losh wrote: > : > In message: <200903041823.n24INmcc049524@svn.freebsd.org> > : > Robert Noland writes: > : > : Author: rnoland > : > : Date: Wed Mar 4 18:23:48 2009 > : > : New Revision: 189367 > : > : URL: http://svn.freebsd.org/changeset/base/189367 > : > : > : > : Log: > : > : Extend the management of PCIM_CMD_INTxDIS. > : > : > : > : We now explicitly enable INTx during bus_setup_intr() if it is needed. > : > : Several of the ata drivers were managing this bit internally. This is > : > : better handled in pci and it should work for all drivers now. > : > : > : > : We also mask INTx during bus_teardown_intr() by setting this bit. > : > : > : > : Reviewed by: jhb > : > : MFC after: 3 days > : > > : > Note: the INTxDIS bit is new in PCI 3.0, and has no effect on earlier > : > devices. This should be highlighted in the comments somewhere... > : > : It is documented in 2.3 as well, I'm not sure about previous versions of > : the spec though. > > It isn't in 2.2, and even after 2.3 it is "optional". The bit should be unused if it isn't supported by a given piece of hardware. If it doesn't do anything, we are no worse off than before. I don't think this will cause any harm, only goodness when it is supported. robert. > Warner -- Robert Noland FreeBSD -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090305/5b78128d/attachment.pgp From imp at bsdimp.com Wed Mar 4 20:04:04 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Wed Mar 4 20:04:10 2009 Subject: svn commit: r189367 - head/sys/dev/pci In-Reply-To: <1236224629.1384.22.camel@widget.2hip.net> References: <1236218572.1384.19.camel@widget.2hip.net> <20090304.194158.1159134197.imp@bsdimp.com> <1236224629.1384.22.camel@widget.2hip.net> Message-ID: <20090304.210322.1353606728.imp@bsdimp.com> In message: <1236224629.1384.22.camel@widget.2hip.net> Robert Noland writes: : On Wed, 2009-03-04 at 19:41 -0700, M. Warner Losh wrote: : > In message: <1236218572.1384.19.camel@widget.2hip.net> : > Robert Noland writes: : > : On Wed, 2009-03-04 at 13:56 -0700, M. Warner Losh wrote: : > : > In message: <200903041823.n24INmcc049524@svn.freebsd.org> : > : > Robert Noland writes: : > : > : Author: rnoland : > : > : Date: Wed Mar 4 18:23:48 2009 : > : > : New Revision: 189367 : > : > : URL: http://svn.freebsd.org/changeset/base/189367 : > : > : : > : > : Log: : > : > : Extend the management of PCIM_CMD_INTxDIS. : > : > : : > : > : We now explicitly enable INTx during bus_setup_intr() if it is needed. : > : > : Several of the ata drivers were managing this bit internally. This is : > : > : better handled in pci and it should work for all drivers now. : > : > : : > : > : We also mask INTx during bus_teardown_intr() by setting this bit. : > : > : : > : > : Reviewed by: jhb : > : > : MFC after: 3 days : > : > : > : > Note: the INTxDIS bit is new in PCI 3.0, and has no effect on earlier : > : > devices. This should be highlighted in the comments somewhere... : > : : > : It is documented in 2.3 as well, I'm not sure about previous versions of : > : the spec though. : > : > It isn't in 2.2, and even after 2.3 it is "optional". : : The bit should be unused if it isn't supported by a given piece of : hardware. If it doesn't do anything, we are no worse off than before. : I don't think this will cause any harm, only goodness when it is : supported. Yes. I agree. This is just the sort of bit, however, that people looking for an interrupt storm would latch on to as being just the ticket... Which is why I suggested a comment... Warner From scottl at samsco.org Wed Mar 4 21:31:08 2009 From: scottl at samsco.org (Scott Long) Date: Wed Mar 4 21:31:14 2009 Subject: svn commit: r189367 - head/sys/dev/pci In-Reply-To: <20090304.210322.1353606728.imp@bsdimp.com> References: <1236218572.1384.19.camel@widget.2hip.net> <20090304.194158.1159134197.imp@bsdimp.com> <1236224629.1384.22.camel@widget.2hip.net> <20090304.210322.1353606728.imp@bsdimp.com> Message-ID: <49AF6393.6060402@samsco.org> M. Warner Losh wrote: > In message: <1236224629.1384.22.camel@widget.2hip.net> > Robert Noland writes: > : On Wed, 2009-03-04 at 19:41 -0700, M. Warner Losh wrote: > : > In message: <1236218572.1384.19.camel@widget.2hip.net> > : > Robert Noland writes: > : > : On Wed, 2009-03-04 at 13:56 -0700, M. Warner Losh wrote: > : > : > In message: <200903041823.n24INmcc049524@svn.freebsd.org> > : > : > Robert Noland writes: > : > : > : Author: rnoland > : > : > : Date: Wed Mar 4 18:23:48 2009 > : > : > : New Revision: 189367 > : > : > : URL: http://svn.freebsd.org/changeset/base/189367 > : > : > : > : > : > : Log: > : > : > : Extend the management of PCIM_CMD_INTxDIS. > : > : > : > : > : > : We now explicitly enable INTx during bus_setup_intr() if it is needed. > : > : > : Several of the ata drivers were managing this bit internally. This is > : > : > : better handled in pci and it should work for all drivers now. > : > : > : > : > : > : We also mask INTx during bus_teardown_intr() by setting this bit. > : > : > : > : > : > : Reviewed by: jhb > : > : > : MFC after: 3 days > : > : > > : > : > Note: the INTxDIS bit is new in PCI 3.0, and has no effect on earlier > : > : > devices. This should be highlighted in the comments somewhere... > : > : > : > : It is documented in 2.3 as well, I'm not sure about previous versions of > : > : the spec though. > : > > : > It isn't in 2.2, and even after 2.3 it is "optional". > : > : The bit should be unused if it isn't supported by a given piece of > : hardware. If it doesn't do anything, we are no worse off than before. > : I don't think this will cause any harm, only goodness when it is > : supported. > > Yes. I agree. This is just the sort of bit, however, that people > looking for an interrupt storm would latch on to as being just the > ticket... Which is why I suggested a comment... Well, the other risk is that devices that claim strict PCI 2.0, 2.1, or 2.2 compatibility might treat this bit as "undefined" and thus eligible for a SERR condition, or even reassign it for proprietary use. I think that this risk is small, but non-zero. I think that as long as we only manipulate this bit in conjunction with MSI, we should be fine. But yes, it must be stressed that this bit is not some magical cure-all for interrupt storms, nor is it an appropriate mechanism for handling arbitrary interrupts in an interrupt handler. Scott From kientzle at FreeBSD.org Wed Mar 4 22:26:09 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Wed Mar 4 22:26:21 2009 Subject: svn commit: r189392 - head/lib/libarchive Message-ID: <200903050626.n256Q8U2065008@svn.freebsd.org> Author: kientzle Date: Thu Mar 5 06:26:08 2009 New Revision: 189392 URL: http://svn.freebsd.org/changeset/base/189392 Log: Argh. r189389 was supposed to include r539 from libarchive.googlecode.com but those compile fixes somehow got lost. This should fix the build. Modified: head/lib/libarchive/archive_read_support_compression_bzip2.c head/lib/libarchive/archive_read_support_compression_compress.c head/lib/libarchive/archive_read_support_format_cpio.c Modified: head/lib/libarchive/archive_read_support_compression_bzip2.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_bzip2.c Thu Mar 5 03:18:22 2009 (r189391) +++ head/lib/libarchive/archive_read_support_compression_bzip2.c Thu Mar 5 06:26:08 2009 (r189392) @@ -105,7 +105,7 @@ static int bzip2_reader_bid(struct archive_read_filter_bidder *self, struct archive_read_filter *filter) { const unsigned char *buffer; - size_t avail; + ssize_t avail; int bits_checked; (void)self; /* UNUSED */ @@ -200,7 +200,7 @@ bzip2_filter_read(struct archive_read_fi struct private_data *state; size_t read_avail, decompressed; unsigned char *read_buf; - int ret; + ssize_t ret; state = (struct private_data *)self->data; read_avail = 0; Modified: head/lib/libarchive/archive_read_support_compression_compress.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_compress.c Thu Mar 5 03:18:22 2009 (r189391) +++ head/lib/libarchive/archive_read_support_compression_compress.c Thu Mar 5 06:26:08 2009 (r189392) @@ -168,7 +168,7 @@ compress_bidder_bid(struct archive_read_ struct archive_read_filter *filter) { const unsigned char *buffer; - size_t avail; + ssize_t avail; int bits_checked; (void)self; /* UNUSED */ @@ -410,7 +410,8 @@ static int getbits(struct archive_read_filter *self, int n) { struct private_data *state = (struct private_data *)self->data; - int code, ret; + int code; + ssize_t ret; static const int mask[] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff, 0x1ff, 0x3ff, 0x7ff, 0xfff, 0x1fff, 0x3fff, 0x7fff, 0xffff Modified: head/lib/libarchive/archive_read_support_format_cpio.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_cpio.c Thu Mar 5 03:18:22 2009 (r189391) +++ head/lib/libarchive/archive_read_support_format_cpio.c Thu Mar 5 06:26:08 2009 (r189392) @@ -329,7 +329,8 @@ find_newc_header(struct archive_read *a) { const void *h; const char *p, *q; - size_t skip, bytes, skipped = 0; + size_t skip, skipped = 0; + ssize_t bytes; for (;;) { h = __archive_read_ahead(a, sizeof(struct cpio_newc_header), &bytes); @@ -463,7 +464,8 @@ find_odc_header(struct archive_read *a) { const void *h; const char *p, *q; - size_t skip, bytes, skipped = 0; + size_t skip, skipped = 0; + ssize_t bytes; for (;;) { h = __archive_read_ahead(a, sizeof(struct cpio_odc_header), &bytes); From rnoland at FreeBSD.org Wed Mar 4 23:26:40 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Wed Mar 4 23:26:47 2009 Subject: svn commit: r189367 - head/sys/dev/pci In-Reply-To: <49AF6393.6060402@samsco.org> References: <1236218572.1384.19.camel@widget.2hip.net> <20090304.194158.1159134197.imp@bsdimp.com> <1236224629.1384.22.camel@widget.2hip.net> <20090304.210322.1353606728.imp@bsdimp.com> <49AF6393.6060402@samsco.org> Message-ID: <1236237989.1384.34.camel@widget.2hip.net> On Wed, 2009-03-04 at 22:30 -0700, Scott Long wrote: > M. Warner Losh wrote: > > In message: <1236224629.1384.22.camel@widget.2hip.net> > > Robert Noland writes: > > : On Wed, 2009-03-04 at 19:41 -0700, M. Warner Losh wrote: > > : > In message: <1236218572.1384.19.camel@widget.2hip.net> > > : > Robert Noland writes: > > : > : On Wed, 2009-03-04 at 13:56 -0700, M. Warner Losh wrote: > > : > : > In message: <200903041823.n24INmcc049524@svn.freebsd.org> > > : > : > Robert Noland writes: > > : > : > : Author: rnoland > > : > : > : Date: Wed Mar 4 18:23:48 2009 > > : > : > : New Revision: 189367 > > : > : > : URL: http://svn.freebsd.org/changeset/base/189367 > > : > : > : > > : > : > : Log: > > : > : > : Extend the management of PCIM_CMD_INTxDIS. > > : > : > : > > : > : > : We now explicitly enable INTx during bus_setup_intr() if it is needed. > > : > : > : Several of the ata drivers were managing this bit internally. This is > > : > : > : better handled in pci and it should work for all drivers now. > > : > : > : > > : > : > : We also mask INTx during bus_teardown_intr() by setting this bit. > > : > : > : > > : > : > : Reviewed by: jhb > > : > : > : MFC after: 3 days > > : > : > > > : > : > Note: the INTxDIS bit is new in PCI 3.0, and has no effect on earlier > > : > : > devices. This should be highlighted in the comments somewhere... > > : > : > > : > : It is documented in 2.3 as well, I'm not sure about previous versions of > > : > : the spec though. > > : > > > : > It isn't in 2.2, and even after 2.3 it is "optional". > > : > > : The bit should be unused if it isn't supported by a given piece of > > : hardware. If it doesn't do anything, we are no worse off than before. > > : I don't think this will cause any harm, only goodness when it is > > : supported. > > > > Yes. I agree. This is just the sort of bit, however, that people > > looking for an interrupt storm would latch on to as being just the > > ticket... Which is why I suggested a comment... > > Well, the other risk is that devices that claim strict PCI 2.0, 2.1, or > 2.2 compatibility might treat this bit as "undefined" and thus eligible > for a SERR condition, or even reassign it for proprietary use. I think > that this risk is small, but non-zero. I think that as long as we only > manipulate this bit in conjunction with MSI, we should be fine. But > yes, it must be stressed that this bit is not some magical cure-all for > interrupt storms, nor is it an appropriate mechanism for handling > arbitrary interrupts in an interrupt handler. I'm happy to add a comment, I'm just not certain what that comment should be. I don't find where it is marked as optional in the 2.3 spec, though I do find the part about interrupt pins being optional... robert. > Scott -- Robert Noland FreeBSD -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090305/55b52a5e/attachment.pgp From luigi at FreeBSD.org Wed Mar 4 23:42:48 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Wed Mar 4 23:43:00 2009 Subject: svn commit: r189393 - stable/7/sys/netinet Message-ID: <200903050742.n257gljY066376@svn.freebsd.org> Author: luigi Date: Thu Mar 5 07:42:47 2009 New Revision: 189393 URL: http://svn.freebsd.org/changeset/base/189393 Log: Merge a couple of changes from HEAD, plus fix a potential warning. In detail: + we used SYSCTL_LONG to show a 64-bit variable. For the time being just remove the variable from the list of sysctl-exported values. Unfortunately our SYSCTL macros do not do proper type checking of the arguments so we might have some more bugs of this kind across the codebase; + fw_debug has not been used for ages, so remove it; + gcc 4.2.4 tells me that src_ip.s_addr may be not initialized, so make sure it is. I need to check what is the status of this field in head. Modified: stable/7/sys/netinet/ip_dummynet.c stable/7/sys/netinet/ip_fw2.c Modified: stable/7/sys/netinet/ip_dummynet.c ============================================================================== --- stable/7/sys/netinet/ip_dummynet.c Thu Mar 5 06:26:08 2009 (r189392) +++ stable/7/sys/netinet/ip_dummynet.c Thu Mar 5 07:42:47 2009 (r189393) @@ -160,8 +160,10 @@ SYSCTL_DECL(_net_inet_ip); SYSCTL_NODE(_net_inet_ip, OID_AUTO, dummynet, CTLFLAG_RW, 0, "Dummynet"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, hash_size, CTLFLAG_RW, &dn_hash_size, 0, "Default hash table size"); +#if 0 /* curr_time is 64 bit */ SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, curr_time, CTLFLAG_RD, &curr_time, 0, "Current tick"); +#endif SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, ready_heap, CTLFLAG_RD, &ready_heap.size, 0, "Size of ready heap"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, extract_heap, Modified: stable/7/sys/netinet/ip_fw2.c ============================================================================== --- stable/7/sys/netinet/ip_fw2.c Thu Mar 5 06:26:08 2009 (r189392) +++ stable/7/sys/netinet/ip_fw2.c Thu Mar 5 07:42:47 2009 (r189393) @@ -146,7 +146,6 @@ struct table_entry { u_int32_t value; }; -static int fw_debug = 1; static int autoinc_step = 100; /* bounded to 1..1000 in add_rule() */ extern int ipfw_chg_hook(SYSCTL_HANDLER_ARGS); @@ -162,8 +161,6 @@ SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, on CTLFLAG_RW | CTLFLAG_SECURE3, &fw_one_pass, 0, "Only do a single pass through ipfw when using dummynet(4)"); -SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, debug, CTLFLAG_RW, - &fw_debug, 0, "Enable printing of debug ip_fw statements"); SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, verbose, CTLFLAG_RW | CTLFLAG_SECURE3, &fw_verbose, 0, "Log matches to ipfw rules"); @@ -2208,6 +2205,7 @@ ipfw_chk(struct ip_fw_args *args) return (IP_FW_PASS); /* accept */ dst_ip.s_addr = 0; /* make sure it is initialized */ + src_ip.s_addr = 0; /* make sure it is initialized */ pktlen = m->m_pkthdr.len; args->f_id.fib = M_GETFIB(m); /* note mbuf not altered) */ proto = args->f_id.proto = 0; /* mark f_id invalid */ From luigi at FreeBSD.org Thu Mar 5 00:01:20 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Thu Mar 5 00:01:27 2009 Subject: svn commit: r189394 - head/sbin/ipfw Message-ID: <200903050801.n2581J9u066774@svn.freebsd.org> Author: luigi Date: Thu Mar 5 08:01:19 2009 New Revision: 189394 URL: http://svn.freebsd.org/changeset/base/189394 Log: mark a function static, as it is Modified: head/sbin/ipfw/altq.c Modified: head/sbin/ipfw/altq.c ============================================================================== --- head/sbin/ipfw/altq.c Thu Mar 5 07:42:47 2009 (r189393) +++ head/sbin/ipfw/altq.c Thu Mar 5 08:01:19 2009 (r189394) @@ -121,7 +121,7 @@ altq_name_to_qid(const char *name) return altq->qid; } -const char * +static const char * altq_qid_to_name(u_int32_t qid) { struct pf_altq *altq; From luigi at FreeBSD.org Thu Mar 5 00:02:00 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Thu Mar 5 00:02:11 2009 Subject: svn commit: r189395 - head/sbin/ipfw Message-ID: <200903050801.n2581wU6066869@svn.freebsd.org> Author: luigi Date: Thu Mar 5 08:01:58 2009 New Revision: 189395 URL: http://svn.freebsd.org/changeset/base/189395 Log: remove some signed/unsigned and one const/!const warning Modified: head/sbin/ipfw/nat.c Modified: head/sbin/ipfw/nat.c ============================================================================== --- head/sbin/ipfw/nat.c Thu Mar 5 08:01:19 2009 (r189394) +++ head/sbin/ipfw/nat.c Thu Mar 5 08:01:58 2009 (r189395) @@ -319,7 +319,7 @@ StrToAddrAndPortRange (const char* str, */ static int -setup_redir_addr(char *spool_buf, int len, +setup_redir_addr(char *spool_buf, unsigned int len, int *_ac, char ***_av) { char **av, *sep; /* Token separator. */ @@ -384,7 +384,7 @@ nospace: } static int -setup_redir_port(char *spool_buf, int len, +setup_redir_port(char *spool_buf, unsigned int len, int *_ac, char ***_av) { char **av, *sep, *protoName; @@ -575,7 +575,7 @@ nospace: } static int -setup_redir_proto(char *spool_buf, int len, +setup_redir_proto(char *spool_buf, unsigned int len, int *_ac, char ***_av) { char **av; @@ -858,8 +858,8 @@ ipfw_config_nat(int ac, char **av) if (!co.do_quiet) { /* After every modification, we show the resultant rule. */ int _ac = 3; - char *_av[] = {"show", "config", id}; - ipfw_show_nat(_ac, _av); + const char *_av[] = {"show", "config", id}; + ipfw_show_nat(_ac, (char **)(void *)_av); } } From luigi at FreeBSD.org Thu Mar 5 00:08:10 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Thu Mar 5 00:08:16 2009 Subject: svn commit: r189396 - head/sbin/ipfw Message-ID: <200903050808.n25889QH067030@svn.freebsd.org> Author: luigi Date: Thu Mar 5 08:08:09 2009 New Revision: 189396 URL: http://svn.freebsd.org/changeset/base/189396 Log: move a variable declaration to the beginning of the block (unfortunately, it is far away; we need to pack this code in a better way). Modified: head/sbin/ipfw/main.c Modified: head/sbin/ipfw/main.c ============================================================================== --- head/sbin/ipfw/main.c Thu Mar 5 08:01:58 2009 (r189395) +++ head/sbin/ipfw/main.c Thu Mar 5 08:08:09 2009 (r189396) @@ -104,6 +104,7 @@ ipfw_main(int oldac, char **oldav) const char *errstr; char **av, **save_av; int do_acct = 0; /* Show packet/byte count */ + int try_next = 0; /* set if pipe cmd not found */ #define WHITESP " \t\f\v\n\r" if (oldac < 2) @@ -332,7 +333,6 @@ ipfw_main(int oldac, char **oldav) av[1] = p; } - int try_next = 0; if (co.use_set == 0) { if (_substrcmp(*av, "add") == 0) ipfw_add(ac, av); From rodrigc at FreeBSD.org Thu Mar 5 00:57:36 2009 From: rodrigc at FreeBSD.org (Craig Rodrigues) Date: Thu Mar 5 00:57:49 2009 Subject: svn commit: r189397 - head/sbin/mount Message-ID: <200903050857.n258vajL067921@svn.freebsd.org> Author: rodrigc Date: Thu Mar 5 08:57:35 2009 New Revision: 189397 URL: http://svn.freebsd.org/changeset/base/189397 Log: Add a -o mountprog parameter to mount which explicitly allows an alternative program to be used for mounting a file system. Ideally, all file systems should be converted to pass string arguments to nmount(), so that /sbin/mount can handle them. However, certain file systems such as FUSE have not done this, and want to have their own userland mount programs. For example, to mount an NTFS file system with the FUSE NTFS driver: mount -t ntfs -o mountprog=/usr/local/bin/ntfs-3g /dev/acd0 /mnt or via an fstab entry: /dev/acd0 /mnt ntfs ro,noauto,mountprog=/usr/local/bin/ntfs-3g 0 0 PR: 120784 Requested by: Dominic Fandrey Modified: head/sbin/mount/mount.8 head/sbin/mount/mount.c Modified: head/sbin/mount/mount.8 ============================================================================== --- head/sbin/mount/mount.8 Thu Mar 5 08:08:09 2009 (r189396) +++ head/sbin/mount/mount.8 Thu Mar 5 08:57:35 2009 (r189397) @@ -163,6 +163,15 @@ is run with the flag but without the .Fl l flag. +.It Cm mountprog Ns = Ns Aq Ar program +Force +.Nm +to use the specified program to mount the file system, instead of calling +.Xr nmount 2 +directly. For example: +.Bd -literal +mount -t foofs -o mountprog=/mydir/fooprog /dev/acd0 /mnt +.Ed .It Cm multilabel Enable multi-label Mandatory Access Control, or MAC, on the specified file system. Modified: head/sbin/mount/mount.c ============================================================================== --- head/sbin/mount/mount.c Thu Mar 5 08:08:09 2009 (r189396) +++ head/sbin/mount/mount.c Thu Mar 5 08:57:35 2009 (r189397) @@ -129,6 +129,8 @@ remountable_fs_names[] = { static const char userquotaeq[] = "userquota="; static const char groupquotaeq[] = "groupquota="; +static char *mountprog = NULL; + static int use_mountprog(const char *vfstype) { @@ -143,6 +145,9 @@ use_mountprog(const char *vfstype) NULL }; + if (mountprog != NULL) + return (1); + for (i = 0; fs[i] != NULL; ++i) { if (strcmp(vfstype, fs[i]) == 0) return (1); @@ -165,8 +170,10 @@ exec_mountprog(const char *name, const c /* Go find an executable. */ execvP(execname, _PATH_SYSPATH, argv); if (errno == ENOENT) { - warn("exec %s not found in %s", execname, - _PATH_SYSPATH); + warn("exec %s not found", execname); + if (execname[0] != '/') { + warnx("in path: %s", _PATH_SYSPATH); + } } exit(1); default: /* Parent. */ @@ -558,13 +565,16 @@ mountfs(const char *vfstype, const char mnt_argv.c = -1; append_arg(&mnt_argv, execname); mangle(optbuf, &mnt_argv); + if (mountprog != NULL) + strcpy(execname, mountprog); + append_arg(&mnt_argv, strdup(spec)); append_arg(&mnt_argv, strdup(name)); append_arg(&mnt_argv, NULL); if (debug) { if (use_mountprog(vfstype)) - printf("exec: mount_%s", vfstype); + printf("exec: %s", execname); else printf("mount -t %s", vfstype); for (i = 1; i < mnt_argv.c; i++) @@ -681,7 +691,7 @@ catopt(char *s0, const char *s1) void mangle(char *options, struct cpa *a) { - char *p, *s; + char *p, *s, *val; for (s = options; (p = strsep(&s, ",")) != NULL;) if (*p != '\0') { @@ -703,6 +713,22 @@ mangle(char *options, struct cpa *a) * before mountd starts. */ continue; + } else if (strncmp(p, "mountprog", 9) == 0) { + /* + * "mountprog" is used to force the use of + * userland mount programs. + */ + val = strchr(p, '='); + if (val != NULL) { + ++val; + if (*val != '\0') + mountprog = strdup(val); + } + + if (mountprog == NULL) { + errx(1, "Need value for -o mountprog"); + } + continue; } else if (strcmp(p, "userquota") == 0) { continue; } else if (strncmp(p, userquotaeq, From kib at FreeBSD.org Thu Mar 5 03:45:44 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Thu Mar 5 03:45:51 2009 Subject: svn commit: r189398 - head/sys/kern Message-ID: <200903051145.n25BjhvE072666@svn.freebsd.org> Author: kib Date: Thu Mar 5 11:45:42 2009 New Revision: 189398 URL: http://svn.freebsd.org/changeset/base/189398 Log: Systematically use vm_size_t to specify the size of the segment for VM KPI. Do not overload the local variable size in kern_shmat() due to vm_size_t change. Fix style bug by adding explicit comparision with 0. Discussed with: bde MFC after: 1 week Modified: head/sys/kern/sysv_shm.c Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Thu Mar 5 08:57:35 2009 (r189397) +++ head/sys/kern/sysv_shm.c Thu Mar 5 11:45:42 2009 (r189398) @@ -122,7 +122,7 @@ static sy_call_t *shmcalls[] = { #define SHMSEG_WANTED 0x1000 static int shm_last_free, shm_nused, shmalloced; -size_t shm_committed; +vm_size_t shm_committed; static struct shmid_kernel *shmsegs; struct shmmap_state { @@ -245,7 +245,7 @@ static void shm_deallocate_segment(shmseg) struct shmid_kernel *shmseg; { - size_t size; + vm_size_t size; GIANT_REQUIRED; @@ -265,7 +265,7 @@ shm_delete_mapping(struct vmspace *vm, s { struct shmid_kernel *shmseg; int segnum, result; - size_t size; + vm_size_t size; GIANT_REQUIRED; @@ -362,8 +362,8 @@ kern_shmat(td, shmid, shmaddr, shmflg) mtx_lock(&Giant); shmmap_s = p->p_vmspace->vm_shm; if (shmmap_s == NULL) { - size = shminfo.shmseg * sizeof(struct shmmap_state); - shmmap_s = malloc(size, M_SHM, M_WAITOK); + shmmap_s = malloc(shminfo.shmseg * sizeof(struct shmmap_state), + M_SHM, M_WAITOK); for (i = 0; i < shminfo.shmseg; i++) shmmap_s[i].shmid = -1; p->p_vmspace->vm_shm = shmmap_s; @@ -722,7 +722,7 @@ shmget_existing(td, uap, mode, segnum) if (error != 0) return (error); #endif - if (uap->size && uap->size > shmseg->shm_bsegsz) + if (uap->size != 0 && uap->size > shmseg->shm_bsegsz) return (EINVAL); td->td_retval[0] = IXSEQ_TO_IPCID(segnum, shmseg->u.shm_perm); return (0); From kib at FreeBSD.org Thu Mar 5 04:05:03 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Thu Mar 5 04:05:11 2009 Subject: svn commit: r189399 - in head: . lib/libc/sys Message-ID: <200903051204.n25C4g6c073026@svn.freebsd.org> Author: kib Date: Thu Mar 5 12:04:42 2009 New Revision: 189399 URL: http://svn.freebsd.org/changeset/base/189399 Log: Hopefully, improve the grammar and wording in the changes to shmctl(2) manpage and UPDATING entry 20090302. UPDATING changes suggested by bf2006a yahoo com. man page corrections by bde. Modified: head/UPDATING head/lib/libc/sys/shmctl.2 Modified: head/UPDATING ============================================================================== --- head/UPDATING Thu Mar 5 11:45:42 2009 (r189398) +++ head/UPDATING Thu Mar 5 12:04:42 2009 (r189399) @@ -23,11 +23,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. ln -s aj /etc/malloc.conf.) 20090302: - The workaround is committed to allow to create System V shared - memory segment of size > 2 Gb on the 64-bit architectures. - Due to limitation of the existing ABI, the shm_segsz member + A workaround is committed to allow the creation of System V shared + memory segment of size > 2 GB on the 64-bit architectures. + Due to a limitation of the existing ABI, the shm_segsz member of the struct shmid_ds, returned by shmctl(IPC_STAT) call is - wrong for large segments. Note that limits shall be explicitely + wrong for large segments. Note that limits must be explicitely raised to allow such segments to be created. 20090301: Modified: head/lib/libc/sys/shmctl.2 ============================================================================== --- head/lib/libc/sys/shmctl.2 Thu Mar 5 11:45:42 2009 (r189398) +++ head/lib/libc/sys/shmctl.2 Thu Mar 5 12:04:42 2009 (r189399) @@ -134,12 +134,13 @@ Permission denied due to mismatch betwee shared memory segment. .El .Sh "BUGS" +The segment size has size_t type. The shm_segsz member of the .Vt shmid_ds -structure has int type, that is too short to represent full range -of the values for segment size, which is allowed to be size_t. -If shared memory limits are raised to allow segments with size > 2 Gb -to be created, be aware that IPC_STAT call may return truncated value +structure has type int, which is too short to represent the full range +of values for a segment size. +If shared memory limits are raised to allow segments with size > 2 GB +to be created, be aware that IPC_STAT call may return a truncated value for shm_segsz. .El .Sh "SEE ALSO" From jhb at FreeBSD.org Thu Mar 5 07:28:47 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Thu Mar 5 07:28:59 2009 Subject: svn commit: r189400 - head/sys/dev/pci Message-ID: <200903051528.n25FSkrJ084890@svn.freebsd.org> Author: jhb Date: Thu Mar 5 15:28:46 2009 New Revision: 189400 URL: http://svn.freebsd.org/changeset/base/189400 Log: Honor the prefetchable flag in memory BARs by setting the RF_PREFETCHABLE flag when calling bus_alloc_resource() to allocate resources from a parent PCI bridge. For PCI-PCI bridges this asks the bridge to satisfy the request using the prefetchable memory range rather than the normal memory range. Reviewed by: imp Reported by: scottl MFC after: 1 week Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Thu Mar 5 12:04:42 2009 (r189399) +++ head/sys/dev/pci/pci.c Thu Mar 5 15:28:46 2009 (r189400) @@ -2313,9 +2313,11 @@ pci_add_map(device_t pcib, device_t bus, PCIB_WRITE_CONFIG(pcib, b, s, f, reg, map, 4); PCIB_WRITE_CONFIG(pcib, b, s, f, PCIR_COMMAND, cmd, 2); - if (PCI_BAR_MEM(map)) + if (PCI_BAR_MEM(map)) { type = SYS_RES_MEMORY; - else + if (map & PCIM_BAR_MEM_PREFETCH) + prefetch = 1; + } else type = SYS_RES_IOPORT; ln2size = pci_mapsize(testval); ln2range = pci_maprange(testval); @@ -3488,6 +3490,8 @@ pci_alloc_map(device_t dev, device_t chi count = 1UL << mapsize; if (RF_ALIGNMENT(flags) < mapsize) flags = (flags & ~RF_ALIGNMENT_MASK) | RF_ALIGNMENT_LOG2(mapsize); + if (PCI_BAR_MEM(testval) && (testval & PCIM_BAR_MEM_PREFETCH)) + flags |= RF_PREFETCHABLE; /* * Allocate enough resource, and then write back the From jhb at FreeBSD.org Thu Mar 5 07:33:05 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Thu Mar 5 07:33:13 2009 Subject: svn commit: r189401 - head/sys/dev/pci Message-ID: <200903051533.n25FX4qX085396@svn.freebsd.org> Author: jhb Date: Thu Mar 5 15:33:04 2009 New Revision: 189401 URL: http://svn.freebsd.org/changeset/base/189401 Log: Always read/write the full 64-bit value of 64-bit BARs. Specifically, when determining the size of a BAR by writing all 1's to the BAR and reading back the result, always operate on the full 64-bit size. Reviewed by: imp MFC after: 1 month Modified: head/sys/dev/pci/pci.c head/sys/dev/pci/pcireg.h Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Thu Mar 5 15:28:46 2009 (r189400) +++ head/sys/dev/pci/pci.c Thu Mar 5 15:33:04 2009 (r189401) @@ -71,10 +71,10 @@ __FBSDID("$FreeBSD$"); #define ACPI_PWR_FOR_SLEEP(x, y, z) #endif -static uint32_t pci_mapbase(unsigned mapreg); -static const char *pci_maptype(unsigned mapreg); -static int pci_mapsize(unsigned testval); -static int pci_maprange(unsigned mapreg); +static pci_addr_t pci_mapbase(uint64_t mapreg); +static const char *pci_maptype(uint64_t mapreg); +static int pci_mapsize(uint64_t testval); +static int pci_maprange(uint64_t mapreg); static void pci_fixancient(pcicfgregs *cfg); static int pci_porten(device_t pcib, int b, int s, int f); @@ -316,8 +316,8 @@ pci_find_device(uint16_t vendor, uint16_ /* return base address of memory or port map */ -static uint32_t -pci_mapbase(uint32_t mapreg) +static pci_addr_t +pci_mapbase(uint64_t mapreg) { if (PCI_BAR_MEM(mapreg)) @@ -329,7 +329,7 @@ pci_mapbase(uint32_t mapreg) /* return map type of memory or port map */ static const char * -pci_maptype(unsigned mapreg) +pci_maptype(uint64_t mapreg) { if (PCI_BAR_IO(mapreg)) @@ -342,7 +342,7 @@ pci_maptype(unsigned mapreg) /* return log2 of map size decoded for memory or port map */ static int -pci_mapsize(uint32_t testval) +pci_mapsize(uint64_t testval) { int ln2size; @@ -361,7 +361,7 @@ pci_mapsize(uint32_t testval) /* return log2 of address range supported by map register */ static int -pci_maprange(unsigned mapreg) +pci_maprange(uint64_t mapreg) { int ln2range = 0; @@ -2279,8 +2279,7 @@ pci_add_map(device_t pcib, device_t bus, int b, int s, int f, int reg, struct resource_list *rl, int force, int prefetch) { - uint32_t map; - pci_addr_t base; + pci_addr_t base, map; pci_addr_t start, end, count; uint8_t ln2size; uint8_t ln2range; @@ -2291,6 +2290,10 @@ pci_add_map(device_t pcib, device_t bus, struct resource *res; map = PCIB_READ_CONFIG(pcib, b, s, f, reg, 4); + ln2range = pci_maprange(map); + if (ln2range == 64) + map |= (uint64_t)PCIB_READ_CONFIG(pcib, b, s, f, reg + 4, 4) << + 32; /* * Disable decoding via the command register before @@ -2308,9 +2311,16 @@ pci_add_map(device_t pcib, device_t bus, */ PCIB_WRITE_CONFIG(pcib, b, s, f, reg, 0xffffffff, 4); testval = PCIB_READ_CONFIG(pcib, b, s, f, reg, 4); + if (ln2range == 64) { + PCIB_WRITE_CONFIG(pcib, b, s, f, reg + 4, 0xffffffff, 4); + testval |= (uint64_t)PCIB_READ_CONFIG(pcib, b, s, f, reg + 4, + 4) << 32; + } /* Restore the BAR and command register. */ PCIB_WRITE_CONFIG(pcib, b, s, f, reg, map, 4); + if (ln2range == 64) + PCIB_WRITE_CONFIG(pcib, b, s, f, reg + 4, map >> 32, 4); PCIB_WRITE_CONFIG(pcib, b, s, f, PCIR_COMMAND, cmd, 2); if (PCI_BAR_MEM(map)) { @@ -2320,7 +2330,6 @@ pci_add_map(device_t pcib, device_t bus, } else type = SYS_RES_IOPORT; ln2size = pci_mapsize(testval); - ln2range = pci_maprange(testval); base = pci_mapbase(map); barlen = ln2range == 64 ? 2 : 1; @@ -2337,12 +2346,6 @@ pci_add_map(device_t pcib, device_t bus, (type == SYS_RES_IOPORT && ln2size < 2)) return (barlen); - if (ln2range == 64) - /* - * Read the other half of a 64bit map register. We - * assume that the size of the BAR is less than 2^32. - */ - base |= (uint64_t) PCIB_READ_CONFIG(pcib, b, s, f, reg + 4, 4) << 32; if (bootverbose) { printf("\tmap[%02x]: type %s, range %2d, base %#jx, size %2d", reg, pci_maptype(map), ln2range, (uintmax_t)base, ln2size); @@ -3421,7 +3424,7 @@ pci_alloc_map(device_t dev, device_t chi struct resource *res; pci_addr_t map, testval; uint16_t cmd; - int mapsize; + int maprange, mapsize; /* * Weed out the bogons, and figure out how large the BAR/map @@ -3432,6 +3435,9 @@ pci_alloc_map(device_t dev, device_t chi */ res = NULL; map = pci_read_config(child, *rid, 4); + maprange = pci_maprange(map); + if (maprange == 64) + map |= (pci_addr_t)pci_read_config(child, *rid + 4, 4) << 32; /* * Disable decoding via the command register before @@ -3445,8 +3451,11 @@ pci_alloc_map(device_t dev, device_t chi /* Determine the BAR's length. */ pci_write_config(child, *rid, 0xffffffff, 4); testval = pci_read_config(child, *rid, 4); - if (pci_maprange(testval) == 64) - map |= (pci_addr_t)pci_read_config(child, *rid + 4, 4) << 32; + if (maprange == 64) { + pci_write_config(child, *rid + 4, 0xffffffff, 4); + testval |= (pci_addr_t)pci_read_config(child, *rid + 4, 4) <