From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 07:24:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A845106567A; Sun, 25 Jan 2009 07:24:34 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88D0A8FC1D; Sun, 25 Jan 2009 07:24:34 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0P7OYZj009646; Sun, 25 Jan 2009 07:24:34 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0P7OYd9009645; Sun, 25 Jan 2009 07:24:34 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200901250724.n0P7OYd9009645@svn.freebsd.org> From: Jeff Roberson Date: Sun, 25 Jan 2009 07:24:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187677 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 07:24:35 -0000 Author: jeff Date: Sun Jan 25 07:24:34 2009 New Revision: 187677 URL: http://svn.freebsd.org/changeset/base/187677 Log: Fix errors introduced when I rewrote select. - Restructure selscan() and selrescan() to avoid producing extra selfps when we have a fd in multiple sets. As described below multiple selfps may still exist for other reasons. - Make selrescan() tolerate multiple selfds for a given descriptor set since sockets use two selinfos per fd. If an event on each selinfo fires selrescan() will see the descriptor twice. This could result in select() returning 2x the number of fds actually existing in fd sets. Reported by: mgleason@ncftp.com Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Sun Jan 25 07:22:34 2009 (r187676) +++ head/sys/kern/sys_generic.c Sun Jan 25 07:24:34 2009 (r187677) @@ -886,6 +886,71 @@ done: return (error); } +/* + * Convert a select bit set to poll flags. + # + * The backend always returns POLLHUP/POLLERR if appropriate and we + * return this as a set bit in any set. + */ +static int select_flags[3] = { + POLLRDNORM | POLLHUP | POLLERR, + POLLWRNORM | POLLHUP | POLLERR, + POLLRDBAND | POLLHUP | POLLERR +}; + +/* + * Compute the fo_poll flags required for a fd given by the index and + * bit position in the fd_mask array. + */ +static __inline int +selflags(fd_mask **ibits, int idx, int bit) +{ + int flags; + int msk; + + flags = 0; + for (msk = 0; msk < 3; msk++) { + if (ibits[msk] == NULL) + continue; + if ((ibits[msk][idx] & (fd_mask)bit) == 0) + continue; + flags |= select_flags[msk]; + } + return (flags); +} + +/* + * Set the appropriate output bits given a mask of fired events and the + * input bits originally requested. + */ +static __inline int +selsetbits(fd_mask **ibits, fd_mask **obits, int idx, fd_mask bit, int events) +{ + int msk; + int n; + + n = 0; + for (msk = 0; msk < 3; msk++) { + if ((events & select_flags[msk]) == 0) + continue; + if (ibits[msk] == NULL) + continue; + if ((ibits[msk][idx] & bit) == 0) + continue; + /* + * XXX Check for a duplicate set. This can occur because a + * socket calls selrecord() twice for each poll() call + * resulting in two selfds per real fd. selrescan() will + * call selsetbits twice as a result. + */ + if ((obits[msk][idx] & bit) != 0) + continue; + obits[msk][idx] |= bit; + n++; + } + + return (n); +} /* * Traverse the list of fds attached to this thread's seltd and check for @@ -894,18 +959,18 @@ done: static int selrescan(struct thread *td, fd_mask **ibits, fd_mask **obits) { + struct filedesc *fdp; + struct selinfo *si; struct seltd *stp; struct selfd *sfp; struct selfd *sfn; - struct selinfo *si; struct file *fp; - int msk, fd; - int n = 0; - /* Note: backend also returns POLLHUP/POLLERR if appropriate. */ - static int flag[3] = { POLLRDNORM, POLLWRNORM, POLLRDBAND }; - struct filedesc *fdp = td->td_proc->p_fd; + int fd, ev, n; + int idx, bit; + fdp = td->td_proc->p_fd; stp = td->td_sel; + n = 0; FILEDESC_SLOCK(fdp); STAILQ_FOREACH_SAFE(sfp, &stp->st_selq, sf_link, sfn) { fd = (int)(uintptr_t)sfp->sf_cookie; @@ -918,18 +983,11 @@ selrescan(struct thread *td, fd_mask **i FILEDESC_SUNLOCK(fdp); return (EBADF); } - for (msk = 0; msk < 3; msk++) { - if (ibits[msk] == NULL) - continue; - if ((ibits[msk][fd/NFDBITS] & - ((fd_mask) 1 << (fd % NFDBITS))) == 0) - continue; - if (fo_poll(fp, flag[msk], td->td_ucred, td)) { - obits[msk][(fd)/NFDBITS] |= - ((fd_mask)1 << ((fd) % NFDBITS)); - n++; - } - } + idx = fd / NFDBITS; + bit = 1 << (fd % NFDBITS); + ev = fo_poll(fp, selflags(ibits, idx, bit), td->td_ucred, td); + if (ev != 0) + n += selsetbits(ibits, obits, idx, bit, ev); } FILEDESC_SUNLOCK(fdp); stp->st_flags = 0; @@ -947,38 +1005,32 @@ selscan(td, ibits, obits, nfd) fd_mask **ibits, **obits; int nfd; { - int msk, i, fd; - fd_mask bits; + struct filedesc *fdp; struct file *fp; - int n = 0; - /* Note: backend also returns POLLHUP/POLLERR if appropriate. */ - static int flag[3] = { POLLRDNORM, POLLWRNORM, POLLRDBAND }; - struct filedesc *fdp = td->td_proc->p_fd; + int ev, flags, end, fd; + int n, idx, bit; + fdp = td->td_proc->p_fd; + n = 0; FILEDESC_SLOCK(fdp); - for (msk = 0; msk < 3; msk++) { - if (ibits[msk] == NULL) - continue; - for (i = 0; i < nfd; i += NFDBITS) { - bits = ibits[msk][i/NFDBITS]; - /* ffs(int mask) not portable, fd_mask is long */ - for (fd = i; bits && fd < nfd; fd++, bits >>= 1) { - if (!(bits & 1)) - continue; - if ((fp = fget_locked(fdp, fd)) == NULL) { - FILEDESC_SUNLOCK(fdp); - return (EBADF); - } - selfdalloc(td, (void *)(uintptr_t)fd); - if (fo_poll(fp, flag[msk], td->td_ucred, - td)) { - obits[msk][(fd)/NFDBITS] |= - ((fd_mask)1 << ((fd) % NFDBITS)); - n++; - } + for (idx = 0, fd = 0; idx < nfd; idx++) { + end = imin(fd + NFDBITS, nfd); + for (bit = 1; fd < end; bit <<= 1, fd++) { + /* Compute the list of events we're interested in. */ + flags = selflags(ibits, idx, bit); + if (flags == 0) + continue; + if ((fp = fget_locked(fdp, fd)) == NULL) { + FILEDESC_SUNLOCK(fdp); + return (EBADF); } + selfdalloc(td, (void *)(uintptr_t)fd); + ev = fo_poll(fp, flags, td->td_ucred, td); + if (ev != 0) + n += selsetbits(ibits, obits, idx, bit, ev); } } + FILEDESC_SUNLOCK(fdp); td->td_retval[0] = n; return (0); From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 07:31:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70246106566C; Sun, 25 Jan 2009 07:31:51 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E7FE8FC16; Sun, 25 Jan 2009 07:31:51 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0P7VpEq009818; Sun, 25 Jan 2009 07:31:51 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0P7VphH009817; Sun, 25 Jan 2009 07:31:51 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200901250731.n0P7VphH009817@svn.freebsd.org> From: Andrew Thompson Date: Sun, 25 Jan 2009 07:31:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187678 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 07:31:51 -0000 Author: thompsa Date: Sun Jan 25 07:31:51 2009 New Revision: 187678 URL: http://svn.freebsd.org/changeset/base/187678 Log: If the parent up/down task was queued then sync with it before returning from the vap ioctl. This means that the parent interface should hopefully be up before we return to userland, it does not depend on the parent init succeeding, just that it was run. This fixes wpa_supplicant with ndis and USB where the parent interfaces can be slow to init. Modified: head/sys/net80211/ieee80211_ioctl.c Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Sun Jan 25 07:24:34 2009 (r187677) +++ head/sys/net80211/ieee80211_ioctl.c Sun Jan 25 07:31:51 2009 (r187678) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -3233,6 +3234,8 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon ieee80211_stop_locked(vap); } IEEE80211_UNLOCK(ic); + /* Wait for parent ioctl handler if it was queued */ + taskqueue_drain(taskqueue_thread, &ic->ic_parent_task); break; case SIOCADDMULTI: case SIOCDELMULTI: From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 07:35:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E935C106564A; Sun, 25 Jan 2009 07:35:10 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD8818FC14; Sun, 25 Jan 2009 07:35:10 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0P7ZA1f009929; Sun, 25 Jan 2009 07:35:10 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0P7ZAgC009926; Sun, 25 Jan 2009 07:35:10 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200901250735.n0P7ZAgC009926@svn.freebsd.org> From: Jeff Roberson Date: Sun, 25 Jan 2009 07:35:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187679 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 07:35:11 -0000 Author: jeff Date: Sun Jan 25 07:35:10 2009 New Revision: 187679 URL: http://svn.freebsd.org/changeset/base/187679 Log: - Use __XSTRING where I want the define to be expanded. This resulted in sizeof("MAXCPU") being used to calculate a string length rather than something more reasonable such as sizeof("32"). This shouldn't have caused any ill effect until we run on machines with 1000000 or more cpus. Modified: head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c head/sys/sys/pcpu.h Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Sun Jan 25 07:31:51 2009 (r187678) +++ head/sys/kern/sched_4bsd.c Sun Jan 25 07:35:10 2009 (r187679) @@ -82,7 +82,7 @@ dtrace_vtime_switch_func_t dtrace_vtime_ #endif #define NICE_WEIGHT 1 /* Priorities per nice level. */ -#define TS_NAME_LEN (MAXCOMLEN + sizeof(" td ") + sizeof(__STRING(UINT_MAX))) +#define TS_NAME_LEN (MAXCOMLEN + sizeof(" td ") + sizeof(__XSTRING(UINT_MAX))) /* * The schedulable entity that runs a context. Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Sun Jan 25 07:31:51 2009 (r187678) +++ head/sys/kern/sched_ule.c Sun Jan 25 07:35:10 2009 (r187679) @@ -86,8 +86,8 @@ dtrace_vtime_switch_func_t dtrace_vtime_ #define KTR_ULE 0 -#define TS_NAME_LEN (MAXCOMLEN + sizeof(" td ") + sizeof(__STRING(UINT_MAX))) -#define TDQ_NAME_LEN (sizeof("sched lock ") + sizeof(__STRING(MAXCPU))) +#define TS_NAME_LEN (MAXCOMLEN + sizeof(" td ") + sizeof(__XSTRING(UINT_MAX))) +#define TDQ_NAME_LEN (sizeof("sched lock ") + sizeof(__XSTRING(MAXCPU))) #define TDQ_LOADNAME_LEN (PCPU_NAME_LEN + sizeof(" load")) /* Modified: head/sys/sys/pcpu.h ============================================================================== --- head/sys/sys/pcpu.h Sun Jan 25 07:31:51 2009 (r187678) +++ head/sys/sys/pcpu.h Sun Jan 25 07:35:10 2009 (r187679) @@ -54,7 +54,7 @@ struct rm_queue { struct rm_queue* volatile rmq_prev; }; -#define PCPU_NAME_LEN (sizeof("CPU ") + sizeof(__STRING(MAXCPU) + 1)) +#define PCPU_NAME_LEN (sizeof("CPU ") + sizeof(__XSTRING(MAXCPU) + 1)) /* From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 08:27:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F84D106564A; Sun, 25 Jan 2009 08:27:12 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DE248FC13; Sun, 25 Jan 2009 08:27:12 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0P8RBOE010846; Sun, 25 Jan 2009 08:27:11 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0P8RBcZ010845; Sun, 25 Jan 2009 08:27:11 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200901250827.n0P8RBcZ010845@svn.freebsd.org> From: Ed Schouten Date: Sun, 25 Jan 2009 08:27:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187680 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 08:27:12 -0000 Author: ed Date: Sun Jan 25 08:27:11 2009 New Revision: 187680 URL: http://svn.freebsd.org/changeset/base/187680 Log: Remove unneeded use of device unit numbers from pty(4). A much more simple approach to generate the slave device name, is to obtain the device name of the master and replace 'p' by 't'. Modified: head/sys/kern/tty_pty.c Modified: head/sys/kern/tty_pty.c ============================================================================== --- head/sys/kern/tty_pty.c Sun Jan 25 07:35:10 2009 (r187679) +++ head/sys/kern/tty_pty.c Sun Jan 25 08:27:11 2009 (r187680) @@ -55,16 +55,15 @@ SYSCTL_UINT(_kern, OID_AUTO, tty_pty_war static int ptydev_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file *fp) { - int u, error; - char name[] = "ttyXX"; + int error; + char name[6]; /* "ttyXX" */ if (!atomic_cmpset_ptr((uintptr_t *)&dev->si_drv1, 0, 1)) return (EBUSY); /* Generate device name and create PTY. */ - u = dev2unit(dev); - name[3] = u >> 8; - name[4] = u; + strcpy(name, devtoname(dev)); + name[0] = 't'; error = pts_alloc_external(fflags & (FREAD|FWRITE), td, fp, dev, name); if (error != 0) { @@ -93,7 +92,6 @@ static void pty_clone(void *arg, struct ucred *cr, char *name, int namelen, struct cdev **dev) { - int u; /* Cloning is already satisfied. */ if (*dev != NULL) @@ -114,8 +112,7 @@ pty_clone(void *arg, struct ucred *cr, c return; /* Create the controller device node. */ - u = (unsigned int)name[3] << 8 | name[4]; - *dev = make_dev_credf(MAKEDEV_REF, &ptydev_cdevsw, u, + *dev = make_dev_credf(MAKEDEV_REF, &ptydev_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0666, name); } From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 09:11:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDA68106564A; Sun, 25 Jan 2009 09:11:24 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA68A8FC14; Sun, 25 Jan 2009 09:11:24 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0P9BOtF011689; Sun, 25 Jan 2009 09:11:24 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0P9BOZi011685; Sun, 25 Jan 2009 09:11:24 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200901250911.n0P9BOZi011685@svn.freebsd.org> From: Jeff Roberson Date: Sun, 25 Jan 2009 09:11:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187681 - in head/sys: kern vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 09:11:25 -0000 Author: jeff Date: Sun Jan 25 09:11:24 2009 New Revision: 187681 URL: http://svn.freebsd.org/changeset/base/187681 Log: - Make the keg abstraction more complete. Permit a zone to have multiple backend kegs so it may source compatible memory from multiple backends. This is useful for cases such as NUMA or different layouts for the same memory type. - Provide a new api for adding new backend kegs to secondary zones. - Provide a new flag for adjusting the layout of zones to stagger allocations better across cache lines. Sponsored by: Nokia Modified: head/sys/kern/kern_malloc.c head/sys/vm/uma.h head/sys/vm/uma_core.c head/sys/vm/uma_dbg.c head/sys/vm/uma_int.h Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Sun Jan 25 08:27:11 2009 (r187680) +++ head/sys/kern/kern_malloc.c Sun Jan 25 09:11:24 2009 (r187681) @@ -329,7 +329,6 @@ malloc(unsigned long size, struct malloc int indx; caddr_t va; uma_zone_t zone; - uma_keg_t keg; #if defined(DIAGNOSTIC) || defined(DEBUG_REDZONE) unsigned long osize = size; #endif @@ -378,18 +377,16 @@ malloc(unsigned long size, struct malloc size = (size & ~KMEM_ZMASK) + KMEM_ZBASE; indx = kmemsize[size >> KMEM_ZSHIFT]; zone = kmemzones[indx].kz_zone; - keg = zone->uz_keg; #ifdef MALLOC_PROFILE krequests[size >> KMEM_ZSHIFT]++; #endif va = uma_zalloc(zone, flags); if (va != NULL) - size = keg->uk_size; + size = zone->uz_size; malloc_type_zone_allocated(mtp, va == NULL ? 0 : size, indx); } else { size = roundup(size, PAGE_SIZE); zone = NULL; - keg = NULL; va = uma_large_malloc(size, flags); malloc_type_allocated(mtp, va == NULL ? 0 : size); } Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Sun Jan 25 08:27:11 2009 (r187680) +++ head/sys/vm/uma.h Sun Jan 25 09:11:24 2009 (r187681) @@ -205,6 +205,17 @@ uma_zone_t uma_zsecond_create(char *name uma_init zinit, uma_fini zfini, uma_zone_t master); /* + * Add a second master to a secondary zone. This provides multiple data + * backends for objects with the same size. Both masters must have + * compatible allocation flags. Presently, UMA_ZONE_MALLOC type zones are + * the only supported. + * + * Returns: + * Error on failure, 0 on success. + */ +int uma_zsecond_add(uma_zone_t zone, uma_zone_t master); + +/* * Definitions for uma_zcreate flags * * These flags share space with UMA_ZFLAGs in uma_int.h. Be careful not to @@ -230,6 +241,22 @@ uma_zone_t uma_zsecond_create(char *name #define UMA_ZONE_SECONDARY 0x0200 /* Zone is a Secondary Zone */ #define UMA_ZONE_REFCNT 0x0400 /* Allocate refcnts in slabs */ #define UMA_ZONE_MAXBUCKET 0x0800 /* Use largest buckets */ +#define UMA_ZONE_CACHESPREAD 0x1000 /* + * Spread memory start locations across + * all possible cache lines. May + * require many virtually contiguous + * backend pages and can fail early. + */ +#define UMA_ZONE_VTOSLAB 0x2000 /* Zone uses vtoslab for lookup. */ + +/* + * These flags are shared between the keg and zone. In zones wishing to add + * new kegs these flags must be compatible. Some are determined based on + * physical parameters of the request and may not be provided by the consumer. + */ +#define UMA_ZONE_INHERIT \ + (UMA_ZONE_OFFPAGE | UMA_ZONE_MALLOC | UMA_ZONE_HASH | \ + UMA_ZONE_REFCNT | UMA_ZONE_VTOSLAB) /* Definitions for align */ #define UMA_ALIGN_PTR (sizeof(void *) - 1) /* Alignment fit for ptr */ Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sun Jan 25 08:27:11 2009 (r187680) +++ head/sys/vm/uma_core.c Sun Jan 25 09:11:24 2009 (r187681) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2002, 2003, 2004, 2005 Jeffrey Roberson + * Copyright (c) 2002-2005, 2009 Jeffrey Roberson * Copyright (c) 2004, 2005 Bosko Milekic * Copyright (c) 2004-2006 Robert N. M. Watson * All rights reserved. @@ -112,7 +112,7 @@ static uma_zone_t slabrefzone; /* With r static uma_zone_t hashzone; /* The boot-time adjusted value for cache line alignment. */ -static int uma_align_cache = 16 - 1; +static int uma_align_cache = 64 - 1; static MALLOC_DEFINE(M_UMAHASH, "UMAHash", "UMA Hash Buckets"); @@ -212,7 +212,7 @@ static void *obj_alloc(uma_zone_t, int, static void *page_alloc(uma_zone_t, int, u_int8_t *, int); static void *startup_alloc(uma_zone_t, int, u_int8_t *, int); static void page_free(void *, int, u_int8_t); -static uma_slab_t slab_zalloc(uma_zone_t, int); +static uma_slab_t keg_alloc_slab(uma_keg_t, uma_zone_t, int); static void cache_drain(uma_zone_t); static void bucket_drain(uma_zone_t, uma_bucket_t); static void bucket_cache_drain(uma_zone_t zone); @@ -221,8 +221,8 @@ static void keg_dtor(void *, int, void * static int zone_ctor(void *, int, void *, int); static void zone_dtor(void *, int, void *); static int zero_init(void *, int, int); -static void zone_small_init(uma_zone_t zone); -static void zone_large_init(uma_zone_t zone); +static void keg_small_init(uma_keg_t keg); +static void keg_large_init(uma_keg_t keg); static void zone_foreach(void (*zfunc)(uma_zone_t)); static void zone_timeout(uma_zone_t zone); static int hash_alloc(struct uma_hash *); @@ -230,19 +230,22 @@ static int hash_expand(struct uma_hash * static void hash_free(struct uma_hash *hash); static void uma_timeout(void *); static void uma_startup3(void); -static void *uma_zalloc_internal(uma_zone_t, void *, int); -static void uma_zfree_internal(uma_zone_t, void *, void *, enum zfreeskip, +static void *zone_alloc_item(uma_zone_t, void *, int); +static void zone_free_item(uma_zone_t, void *, void *, enum zfreeskip, int); static void bucket_enable(void); static void bucket_init(void); static uma_bucket_t bucket_alloc(int, int); static void bucket_free(uma_bucket_t); static void bucket_zone_drain(void); -static int uma_zalloc_bucket(uma_zone_t zone, int flags); -static uma_slab_t uma_zone_slab(uma_zone_t zone, int flags); -static void *uma_slab_alloc(uma_zone_t zone, uma_slab_t slab); -static uma_zone_t uma_kcreate(uma_zone_t zone, size_t size, uma_init uminit, +static int zone_alloc_bucket(uma_zone_t zone, int flags); +static uma_slab_t zone_fetch_slab(uma_zone_t zone, uma_keg_t last, int flags); +static uma_slab_t zone_fetch_slab_multi(uma_zone_t zone, uma_keg_t last, int flags); +static void *slab_alloc_item(uma_zone_t zone, uma_slab_t slab); +static uma_keg_t uma_kcreate(uma_zone_t zone, size_t size, uma_init uminit, uma_fini fini, int align, u_int32_t flags); +static inline void zone_relock(uma_zone_t zone, uma_keg_t keg); +static inline void keg_relock(uma_keg_t keg, uma_zone_t zone); void uma_print_zone(uma_zone_t); void uma_print_stats(void); @@ -291,7 +294,8 @@ bucket_init(void) size = roundup(sizeof(struct uma_bucket), sizeof(void *)); size += sizeof(void *) * ubz->ubz_entries; ubz->ubz_zone = uma_zcreate(ubz->ubz_name, size, - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZFLAG_INTERNAL); + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, + UMA_ZFLAG_INTERNAL | UMA_ZFLAG_BUCKET); for (; i <= ubz->ubz_entries; i += (1 << BUCKET_SHIFT)) bucket_size[i >> BUCKET_SHIFT] = j; } @@ -326,7 +330,7 @@ bucket_alloc(int entries, int bflags) return (NULL); ubz = bucket_zone_lookup(entries); - bucket = uma_zalloc_internal(ubz->ubz_zone, NULL, bflags); + bucket = zone_alloc_item(ubz->ubz_zone, NULL, bflags); if (bucket) { #ifdef INVARIANTS bzero(bucket->ub_bucket, sizeof(void *) * ubz->ubz_entries); @@ -344,7 +348,7 @@ bucket_free(uma_bucket_t bucket) struct uma_bucket_zone *ubz; ubz = bucket_zone_lookup(bucket->ub_entries); - uma_zfree_internal(ubz->ubz_zone, bucket, NULL, SKIP_NONE, + zone_free_item(ubz->ubz_zone, bucket, NULL, SKIP_NONE, ZFREE_STATFREE); } @@ -357,6 +361,21 @@ bucket_zone_drain(void) zone_drain(ubz->ubz_zone); } +static inline uma_keg_t +zone_first_keg(uma_zone_t zone) +{ + + return (LIST_FIRST(&zone->uz_kegs)->kl_keg); +} + +static void +zone_foreach_keg(uma_zone_t zone, void (*kegfn)(uma_keg_t)) +{ + uma_klink_t klink; + + LIST_FOREACH(klink, &zone->uz_kegs, kl_link) + kegfn(klink->kl_keg); +} /* * Routine called by timeout which is used to fire off some time interval @@ -382,29 +401,20 @@ uma_timeout(void *unused) * Routine to perform timeout driven calculations. This expands the * hashes and does per cpu statistics aggregation. * - * Arguments: - * zone The zone to operate on - * - * Returns: - * Nothing + * Returns nothing. */ static void -zone_timeout(uma_zone_t zone) +keg_timeout(uma_keg_t keg) { - uma_keg_t keg; - u_int64_t alloc; - - keg = zone->uz_keg; - alloc = 0; + KEG_LOCK(keg); /* - * Expand the zone hash table. + * Expand the keg hash table. * * This is done if the number of slabs is larger than the hash size. * What I'm trying to do here is completely reduce collisions. This * may be a little aggressive. Should I allow for two collisions max? */ - ZONE_LOCK(zone); if (keg->uk_flags & UMA_ZONE_HASH && keg->uk_pages / keg->uk_ppera >= keg->uk_hash.uh_hashsize) { struct uma_hash newhash; @@ -413,14 +423,14 @@ zone_timeout(uma_zone_t zone) /* * This is so involved because allocating and freeing - * while the zone lock is held will lead to deadlock. + * while the keg lock is held will lead to deadlock. * I have to do everything in stages and check for * races. */ newhash = keg->uk_hash; - ZONE_UNLOCK(zone); + KEG_UNLOCK(keg); ret = hash_alloc(&newhash); - ZONE_LOCK(zone); + KEG_LOCK(keg); if (ret) { if (hash_expand(&keg->uk_hash, &newhash)) { oldhash = keg->uk_hash; @@ -428,12 +438,19 @@ zone_timeout(uma_zone_t zone) } else oldhash = newhash; - ZONE_UNLOCK(zone); + KEG_UNLOCK(keg); hash_free(&oldhash); - ZONE_LOCK(zone); + KEG_LOCK(keg); } } - ZONE_UNLOCK(zone); + KEG_UNLOCK(keg); +} + +static void +zone_timeout(uma_zone_t zone) +{ + + zone_foreach_keg(zone, &keg_timeout); } /* @@ -462,7 +479,7 @@ hash_alloc(struct uma_hash *hash) M_UMAHASH, M_NOWAIT); } else { alloc = sizeof(hash->uh_slab_hash[0]) * UMA_HASH_SIZE_INIT; - hash->uh_slab_hash = uma_zalloc_internal(hashzone, NULL, + hash->uh_slab_hash = zone_alloc_item(hashzone, NULL, M_WAITOK); hash->uh_hashsize = UMA_HASH_SIZE_INIT; } @@ -535,7 +552,7 @@ hash_free(struct uma_hash *hash) if (hash->uh_slab_hash == NULL) return; if (hash->uh_hashsize == UMA_HASH_SIZE_INIT) - uma_zfree_internal(hashzone, + zone_free_item(hashzone, hash->uh_slab_hash, NULL, SKIP_NONE, ZFREE_STATFREE); else free(hash->uh_slab_hash, M_UMAHASH); @@ -555,20 +572,11 @@ hash_free(struct uma_hash *hash) static void bucket_drain(uma_zone_t zone, uma_bucket_t bucket) { - uma_slab_t slab; - int mzone; void *item; if (bucket == NULL) return; - slab = NULL; - mzone = 0; - - /* We have to lookup the slab again for malloc.. */ - if (zone->uz_keg->uk_flags & UMA_ZONE_MALLOC) - mzone = 1; - while (bucket->ub_cnt > 0) { bucket->ub_cnt--; item = bucket->ub_bucket[bucket->ub_cnt]; @@ -577,15 +585,7 @@ bucket_drain(uma_zone_t zone, uma_bucket KASSERT(item != NULL, ("bucket_drain: botched ptr, item is NULL")); #endif - /* - * This is extremely inefficient. The slab pointer was passed - * to uma_zfree_arg, but we lost it because the buckets don't - * hold them. This will go away when free() gets a size passed - * to it. - */ - if (mzone) - slab = vtoslab((vm_offset_t)item & (~UMA_SLAB_MASK)); - uma_zfree_internal(zone, item, slab, SKIP_DTOR, 0); + zone_free_item(zone, item, NULL, SKIP_DTOR, 0); } } @@ -665,42 +665,32 @@ bucket_cache_drain(uma_zone_t zone) } /* - * Frees pages from a zone back to the system. This is done on demand from + * Frees pages from a keg back to the system. This is done on demand from * the pageout daemon. * - * Arguments: - * zone The zone to free pages from - * all Should we drain all items? - * - * Returns: - * Nothing. + * Returns nothing. */ -void -zone_drain(uma_zone_t zone) +static void +keg_drain(uma_keg_t keg) { struct slabhead freeslabs = { 0 }; - uma_keg_t keg; uma_slab_t slab; uma_slab_t n; u_int8_t flags; u_int8_t *mem; int i; - keg = zone->uz_keg; - /* - * We don't want to take pages from statically allocated zones at this + * We don't want to take pages from statically allocated kegs at this * time */ if (keg->uk_flags & UMA_ZONE_NOFREE || keg->uk_freef == NULL) return; - ZONE_LOCK(zone); - #ifdef UMA_DEBUG - printf("%s free items: %u\n", zone->uz_name, keg->uk_free); + printf("%s free items: %u\n", keg->uk_name, keg->uk_free); #endif - bucket_cache_drain(zone); + KEG_LOCK(keg); if (keg->uk_free == 0) goto finished; @@ -726,7 +716,7 @@ zone_drain(uma_zone_t zone) slab = n; } finished: - ZONE_UNLOCK(zone); + KEG_UNLOCK(keg); while ((slab = SLIST_FIRST(&freeslabs)) != NULL) { SLIST_REMOVE(&freeslabs, slab, uma_slab, us_hlink); @@ -738,8 +728,7 @@ finished: flags = slab->us_flags; mem = slab->us_data; - if ((keg->uk_flags & UMA_ZONE_MALLOC) || - (keg->uk_flags & UMA_ZONE_REFCNT)) { + if (keg->uk_flags & UMA_ZONE_VTOSLAB) { vm_object_t obj; if (flags & UMA_SLAB_KMEM) @@ -753,21 +742,61 @@ finished: obj); } if (keg->uk_flags & UMA_ZONE_OFFPAGE) - uma_zfree_internal(keg->uk_slabzone, slab, NULL, + zone_free_item(keg->uk_slabzone, slab, NULL, SKIP_NONE, ZFREE_STATFREE); #ifdef UMA_DEBUG printf("%s: Returning %d bytes.\n", - zone->uz_name, UMA_SLAB_SIZE * keg->uk_ppera); + keg->uk_name, UMA_SLAB_SIZE * keg->uk_ppera); #endif keg->uk_freef(mem, UMA_SLAB_SIZE * keg->uk_ppera, flags); } } +static void +zone_drain_wait(uma_zone_t zone, int waitok) +{ + + /* + * Set draining to interlock with zone_dtor() so we can release our + * locks as we go. Only dtor() should do a WAITOK call since it + * is the only call that knows the structure will still be available + * when it wakes up. + */ + ZONE_LOCK(zone); + while (zone->uz_flags & UMA_ZFLAG_DRAINING) { + if (waitok == M_NOWAIT) + goto out; + mtx_unlock(&uma_mtx); + msleep(zone, zone->uz_lock, PVM, "zonedrain", 1); + mtx_lock(&uma_mtx); + } + zone->uz_flags |= UMA_ZFLAG_DRAINING; + bucket_cache_drain(zone); + ZONE_UNLOCK(zone); + /* + * The DRAINING flag protects us from being freed while + * we're running. Normally the uma_mtx would protect us but we + * must be able to release and acquire the right lock for each keg. + */ + zone_foreach_keg(zone, &keg_drain); + ZONE_LOCK(zone); + zone->uz_flags &= ~UMA_ZFLAG_DRAINING; + wakeup(zone); +out: + ZONE_UNLOCK(zone); +} + +void +zone_drain(uma_zone_t zone) +{ + + zone_drain_wait(zone, M_NOWAIT); +} + /* - * Allocate a new slab for a zone. This does not insert the slab onto a list. + * Allocate a new slab for a keg. This does not insert the slab onto a list. * * Arguments: - * zone The zone to allocate slabs for * wait Shall we wait? * * Returns: @@ -775,27 +804,28 @@ finished: * caller specified M_NOWAIT. */ static uma_slab_t -slab_zalloc(uma_zone_t zone, int wait) +keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int wait) { uma_slabrefcnt_t slabref; + uma_alloc allocf; uma_slab_t slab; - uma_keg_t keg; u_int8_t *mem; u_int8_t flags; int i; + mtx_assert(&keg->uk_lock, MA_OWNED); slab = NULL; - keg = zone->uz_keg; #ifdef UMA_DEBUG - printf("slab_zalloc: Allocating a new slab for %s\n", zone->uz_name); + printf("slab_zalloc: Allocating a new slab for %s\n", keg->uk_name); #endif - ZONE_UNLOCK(zone); + allocf = keg->uk_allocf; + KEG_UNLOCK(keg); if (keg->uk_flags & UMA_ZONE_OFFPAGE) { - slab = uma_zalloc_internal(keg->uk_slabzone, NULL, wait); + slab = zone_alloc_item(keg->uk_slabzone, NULL, wait); if (slab == NULL) { - ZONE_LOCK(zone); + KEG_LOCK(keg); return NULL; } } @@ -812,13 +842,13 @@ slab_zalloc(uma_zone_t zone, int wait) else wait &= ~M_ZERO; - mem = keg->uk_allocf(zone, keg->uk_ppera * UMA_SLAB_SIZE, - &flags, wait); + /* zone is passed for legacy reasons. */ + mem = allocf(zone, keg->uk_ppera * UMA_SLAB_SIZE, &flags, wait); if (mem == NULL) { if (keg->uk_flags & UMA_ZONE_OFFPAGE) - uma_zfree_internal(keg->uk_slabzone, slab, NULL, + zone_free_item(keg->uk_slabzone, slab, NULL, SKIP_NONE, ZFREE_STATFREE); - ZONE_LOCK(zone); + KEG_LOCK(keg); return (NULL); } @@ -826,8 +856,7 @@ slab_zalloc(uma_zone_t zone, int wait) if (!(keg->uk_flags & UMA_ZONE_OFFPAGE)) slab = (uma_slab_t )(mem + keg->uk_pgoff); - if ((keg->uk_flags & UMA_ZONE_MALLOC) || - (keg->uk_flags & UMA_ZONE_REFCNT)) + if (keg->uk_flags & UMA_ZONE_VTOSLAB) for (i = 0; i < keg->uk_ppera; i++) vsetslab((vm_offset_t)mem + (i * PAGE_SIZE), slab); @@ -860,8 +889,7 @@ slab_zalloc(uma_zone_t zone, int wait) (keg->uk_rsize * i), keg->uk_size); } - if ((keg->uk_flags & UMA_ZONE_MALLOC) || - (keg->uk_flags & UMA_ZONE_REFCNT)) { + if (keg->uk_flags & UMA_ZONE_VTOSLAB) { vm_object_t obj; if (flags & UMA_SLAB_KMEM) @@ -875,15 +903,15 @@ slab_zalloc(uma_zone_t zone, int wait) (i * PAGE_SIZE), obj); } if (keg->uk_flags & UMA_ZONE_OFFPAGE) - uma_zfree_internal(keg->uk_slabzone, slab, + zone_free_item(keg->uk_slabzone, slab, NULL, SKIP_NONE, ZFREE_STATFREE); keg->uk_freef(mem, UMA_SLAB_SIZE * keg->uk_ppera, flags); - ZONE_LOCK(zone); + KEG_LOCK(keg); return (NULL); } } - ZONE_LOCK(zone); + KEG_LOCK(keg); if (keg->uk_flags & UMA_ZONE_HASH) UMA_HASH_INSERT(&keg->uk_hash, slab, mem); @@ -905,7 +933,7 @@ startup_alloc(uma_zone_t zone, int bytes uma_keg_t keg; uma_slab_t tmps; - keg = zone->uz_keg; + keg = zone_first_keg(zone); /* * Check our small startup cache to see if it has pages remaining. @@ -935,7 +963,6 @@ startup_alloc(uma_zone_t zone, int bytes * Allocates a number of pages from the system * * Arguments: - * zone Unused * bytes The number of bytes requested * wait Shall we wait? * @@ -958,7 +985,6 @@ page_alloc(uma_zone_t zone, int bytes, u * Allocates a number of pages from within an object * * Arguments: - * zone Unused * bytes The number of bytes requested * wait Shall we wait? * @@ -973,8 +999,10 @@ obj_alloc(uma_zone_t zone, int bytes, u_ vm_offset_t retkva, zkva; vm_page_t p; int pages, startpages; + uma_keg_t keg; - object = zone->uz_keg->uk_obj; + keg = zone_first_keg(zone); + object = keg->uk_obj; retkva = 0; /* @@ -984,7 +1012,7 @@ obj_alloc(uma_zone_t zone, int bytes, u_ p = TAILQ_LAST(&object->memq, pglist); pages = p != NULL ? p->pindex + 1 : 0; startpages = pages; - zkva = zone->uz_keg->uk_kva + pages * PAGE_SIZE; + zkva = keg->uk_kva + pages * PAGE_SIZE; for (; bytes > 0; bytes -= PAGE_SIZE) { p = vm_page_alloc(object, pages, VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED); @@ -1052,25 +1080,23 @@ zero_init(void *mem, int size, int flags } /* - * Finish creating a small uma zone. This calculates ipers, and the zone size. + * Finish creating a small uma keg. This calculates ipers, and the keg size. * * Arguments - * zone The zone we should initialize + * keg The zone we should initialize * * Returns * Nothing */ static void -zone_small_init(uma_zone_t zone) +keg_small_init(uma_keg_t keg) { - uma_keg_t keg; u_int rsize; u_int memused; u_int wastedspace; u_int shsize; - keg = zone->uz_keg; - KASSERT(keg != NULL, ("Keg is null in zone_small_init")); + KASSERT(keg != NULL, ("Keg is null in keg_small_init")); rsize = keg->uk_size; if (rsize < UMA_SMALLEST_UNIT) @@ -1090,7 +1116,7 @@ zone_small_init(uma_zone_t zone) } keg->uk_ipers = (UMA_SLAB_SIZE - shsize) / rsize; - KASSERT(keg->uk_ipers != 0, ("zone_small_init: ipers is 0")); + KASSERT(keg->uk_ipers != 0, ("keg_small_init: ipers is 0")); memused = keg->uk_ipers * rsize + shsize; wastedspace = UMA_SLAB_SIZE - memused; @@ -1109,44 +1135,41 @@ zone_small_init(uma_zone_t zone) (keg->uk_ipers < (UMA_SLAB_SIZE / keg->uk_rsize))) { keg->uk_ipers = UMA_SLAB_SIZE / keg->uk_rsize; KASSERT(keg->uk_ipers <= 255, - ("zone_small_init: keg->uk_ipers too high!")); + ("keg_small_init: keg->uk_ipers too high!")); #ifdef UMA_DEBUG printf("UMA decided we need offpage slab headers for " - "zone: %s, calculated wastedspace = %d, " + "keg: %s, calculated wastedspace = %d, " "maximum wasted space allowed = %d, " "calculated ipers = %d, " - "new wasted space = %d\n", zone->uz_name, wastedspace, + "new wasted space = %d\n", keg->uk_name, wastedspace, UMA_MAX_WASTE, keg->uk_ipers, UMA_SLAB_SIZE - keg->uk_ipers * keg->uk_rsize); #endif keg->uk_flags |= UMA_ZONE_OFFPAGE; - if ((keg->uk_flags & UMA_ZONE_MALLOC) == 0) + if ((keg->uk_flags & UMA_ZONE_VTOSLAB) == 0) keg->uk_flags |= UMA_ZONE_HASH; } } /* - * Finish creating a large (> UMA_SLAB_SIZE) uma zone. Just give in and do + * Finish creating a large (> UMA_SLAB_SIZE) uma kegs. Just give in and do * OFFPAGE for now. When I can allow for more dynamic slab sizes this will be * more complicated. * * Arguments - * zone The zone we should initialize + * keg The keg we should initialize * * Returns * Nothing */ static void -zone_large_init(uma_zone_t zone) +keg_large_init(uma_keg_t keg) { - uma_keg_t keg; int pages; - keg = zone->uz_keg; - - KASSERT(keg != NULL, ("Keg is null in zone_large_init")); + KASSERT(keg != NULL, ("Keg is null in keg_large_init")); KASSERT((keg->uk_flags & UMA_ZFLAG_CACHEONLY) == 0, - ("zone_large_init: Cannot large-init a UMA_ZFLAG_CACHEONLY zone")); + ("keg_large_init: Cannot large-init a UMA_ZFLAG_CACHEONLY keg")); pages = keg->uk_size / UMA_SLAB_SIZE; @@ -1158,12 +1181,44 @@ zone_large_init(uma_zone_t zone) keg->uk_ipers = 1; keg->uk_flags |= UMA_ZONE_OFFPAGE; - if ((keg->uk_flags & UMA_ZONE_MALLOC) == 0) + if ((keg->uk_flags & UMA_ZONE_VTOSLAB) == 0) keg->uk_flags |= UMA_ZONE_HASH; keg->uk_rsize = keg->uk_size; } +static void +keg_cachespread_init(uma_keg_t keg) +{ + int alignsize; + int trailer; + int pages; + int rsize; + + alignsize = keg->uk_align + 1; + rsize = keg->uk_size; + /* + * We want one item to start on every align boundary in a page. To + * do this we will span pages. We will also extend the item by the + * size of align if it is an even multiple of align. Otherwise, it + * would fall on the same boundary every time. + */ + if (rsize & keg->uk_align) + rsize = (rsize & ~keg->uk_align) + alignsize; + if ((rsize & alignsize) == 0) + rsize += alignsize; + trailer = rsize - keg->uk_size; + pages = (rsize * (PAGE_SIZE / alignsize)) / PAGE_SIZE; + pages = MIN(pages, (128 * 1024) / PAGE_SIZE); + keg->uk_rsize = rsize; + keg->uk_ppera = pages; + keg->uk_ipers = ((pages * PAGE_SIZE) + trailer) / rsize; + keg->uk_flags |= UMA_ZONE_OFFPAGE | UMA_ZONE_VTOSLAB; + KASSERT(keg->uk_ipers <= uma_max_ipers, + ("keg_small_init: keg->uk_ipers too high(%d) increase max_ipers", + keg->uk_ipers)); +} + /* * Keg header ctor. This initializes all fields, locks, etc. And inserts * the keg onto the global keg list. @@ -1195,7 +1250,7 @@ keg_ctor(void *mem, int size, void *udat * The master zone is passed to us at keg-creation time. */ zone = arg->zone; - zone->uz_keg = keg; + keg->uk_name = zone->uz_name; if (arg->flags & UMA_ZONE_VM) keg->uk_flags |= UMA_ZFLAG_CACHEONLY; @@ -1203,24 +1258,31 @@ keg_ctor(void *mem, int size, void *udat if (arg->flags & UMA_ZONE_ZINIT) keg->uk_init = zero_init; + if (arg->flags & UMA_ZONE_REFCNT || arg->flags & UMA_ZONE_MALLOC) + keg->uk_flags |= UMA_ZONE_VTOSLAB; + /* * The +UMA_FRITM_SZ added to uk_size is to account for the - * linkage that is added to the size in zone_small_init(). If + * linkage that is added to the size in keg_small_init(). If * we don't account for this here then we may end up in - * zone_small_init() with a calculated 'ipers' of 0. + * keg_small_init() with a calculated 'ipers' of 0. */ if (keg->uk_flags & UMA_ZONE_REFCNT) { - if ((keg->uk_size+UMA_FRITMREF_SZ) > + if (keg->uk_flags & UMA_ZONE_CACHESPREAD) + keg_cachespread_init(keg); + else if ((keg->uk_size+UMA_FRITMREF_SZ) > (UMA_SLAB_SIZE - sizeof(struct uma_slab_refcnt))) - zone_large_init(zone); + keg_large_init(keg); else - zone_small_init(zone); + keg_small_init(keg); } else { - if ((keg->uk_size+UMA_FRITM_SZ) > + if (keg->uk_flags & UMA_ZONE_CACHESPREAD) + keg_cachespread_init(keg); + else if ((keg->uk_size+UMA_FRITM_SZ) > (UMA_SLAB_SIZE - sizeof(struct uma_slab))) - zone_large_init(zone); + keg_large_init(keg); else - zone_small_init(zone); + keg_small_init(keg); } if (keg->uk_flags & UMA_ZONE_OFFPAGE) { @@ -1244,14 +1306,12 @@ keg_ctor(void *mem, int size, void *udat } /* - * Initialize keg's lock (shared among zones) through - * Master zone + * Initialize keg's lock (shared among zones). */ - zone->uz_lock = &keg->uk_lock; if (arg->flags & UMA_ZONE_MTXCLASS) - ZONE_LOCK_INIT(zone, 1); + KEG_LOCK_INIT(keg, 1); else - ZONE_LOCK_INIT(zone, 0); + KEG_LOCK_INIT(keg, 0); /* * If we're putting the slab header in the actual page we need to @@ -1300,10 +1360,10 @@ keg_ctor(void *mem, int size, void *udat hash_alloc(&keg->uk_hash); #ifdef UMA_DEBUG - printf("%s(%p) size = %d ipers = %d ppera = %d pgoff = %d\n", - zone->uz_name, zone, - keg->uk_size, keg->uk_ipers, - keg->uk_ppera, keg->uk_pgoff); + printf("UMA: %s(%p) size %d(%d) flags %d ipers %d ppera %d out %d free %d\n", + zone->uz_name, zone, keg->uk_size, keg->uk_rsize, keg->uk_flags, + keg->uk_ipers, keg->uk_ppera, + (keg->uk_ipers * keg->uk_pages) - keg->uk_free, keg->uk_free); #endif LIST_INSERT_HEAD(&keg->uk_zones, zone, uz_link); @@ -1320,7 +1380,6 @@ keg_ctor(void *mem, int size, void *udat * Arguments/Returns follow uma_ctor specifications * udata Actually uma_zctor_args */ - static int zone_ctor(void *mem, int size, void *udata, int flags) { @@ -1333,23 +1392,24 @@ zone_ctor(void *mem, int size, void *uda zone->uz_name = arg->name; zone->uz_ctor = arg->ctor; zone->uz_dtor = arg->dtor; + zone->uz_slab = zone_fetch_slab; zone->uz_init = NULL; zone->uz_fini = NULL; zone->uz_allocs = 0; zone->uz_frees = 0; zone->uz_fails = 0; zone->uz_fills = zone->uz_count = 0; + zone->uz_flags = 0; + keg = arg->keg; if (arg->flags & UMA_ZONE_SECONDARY) { KASSERT(arg->keg != NULL, ("Secondary zone on zero'd keg")); - keg = arg->keg; - zone->uz_keg = keg; zone->uz_init = arg->uminit; zone->uz_fini = arg->fini; zone->uz_lock = &keg->uk_lock; + zone->uz_flags |= UMA_ZONE_SECONDARY; mtx_lock(&uma_mtx); ZONE_LOCK(zone); - keg->uk_flags |= UMA_ZONE_SECONDARY; LIST_FOREACH(z, &keg->uk_zones, uz_link) { if (LIST_NEXT(z, uz_link) == NULL) { LIST_INSERT_AFTER(z, zone, uz_link); @@ -1358,9 +1418,9 @@ zone_ctor(void *mem, int size, void *uda } ZONE_UNLOCK(zone); mtx_unlock(&uma_mtx); - } else if (arg->keg == NULL) { - if (uma_kcreate(zone, arg->size, arg->uminit, arg->fini, - arg->align, arg->flags) == NULL) + } else if (keg == NULL) { + if ((keg = uma_kcreate(zone, arg->size, arg->uminit, arg->fini, + arg->align, arg->flags)) == NULL) return (ENOMEM); } else { struct uma_kctor_args karg; @@ -1378,15 +1438,22 @@ zone_ctor(void *mem, int size, void *uda if (error) return (error); } - keg = zone->uz_keg; + /* + * Link in the first keg. + */ + zone->uz_klink.kl_keg = keg; + LIST_INSERT_HEAD(&zone->uz_kegs, &zone->uz_klink, kl_link); zone->uz_lock = &keg->uk_lock; + zone->uz_size = keg->uk_size; + zone->uz_flags |= (keg->uk_flags & + (UMA_ZONE_INHERIT | UMA_ZFLAG_INHERIT)); /* * Some internal zones don't have room allocated for the per cpu * caches. If we're internal, bail out here. */ if (keg->uk_flags & UMA_ZFLAG_INTERNAL) { - KASSERT((keg->uk_flags & UMA_ZONE_SECONDARY) == 0, + KASSERT((zone->uz_flags & UMA_ZONE_SECONDARY) == 0, ("Secondary zone requested UMA_ZFLAG_INTERNAL")); return (0); } @@ -1413,18 +1480,17 @@ keg_dtor(void *arg, int size, void *udat uma_keg_t keg; keg = (uma_keg_t)arg; - mtx_lock(&keg->uk_lock); + KEG_LOCK(keg); if (keg->uk_free != 0) { printf("Freed UMA keg was not empty (%d items). " " Lost %d pages of memory.\n", keg->uk_free, keg->uk_pages); } - mtx_unlock(&keg->uk_lock); + KEG_UNLOCK(keg); - if (keg->uk_flags & UMA_ZONE_HASH) - hash_free(&keg->uk_hash); + hash_free(&keg->uk_hash); - mtx_destroy(&keg->uk_lock); + KEG_LOCK_FINI(keg); } /* @@ -1436,38 +1502,46 @@ keg_dtor(void *arg, int size, void *udat static void zone_dtor(void *arg, int size, void *udata) { + uma_klink_t klink; uma_zone_t zone; uma_keg_t keg; zone = (uma_zone_t)arg; - keg = zone->uz_keg; + keg = zone_first_keg(zone); - if (!(keg->uk_flags & UMA_ZFLAG_INTERNAL)) + if (!(zone->uz_flags & UMA_ZFLAG_INTERNAL)) cache_drain(zone); mtx_lock(&uma_mtx); - zone_drain(zone); - if (keg->uk_flags & UMA_ZONE_SECONDARY) { - LIST_REMOVE(zone, uz_link); - /* - * XXX there are some races here where - * the zone can be drained but zone lock - * released and then refilled before we - * remove it... we dont care for now - */ - ZONE_LOCK(zone); - if (LIST_EMPTY(&keg->uk_zones)) - keg->uk_flags &= ~UMA_ZONE_SECONDARY; - ZONE_UNLOCK(zone); - mtx_unlock(&uma_mtx); - } else { + LIST_REMOVE(zone, uz_link); + mtx_unlock(&uma_mtx); + /* + * XXX there are some races here where + * the zone can be drained but zone lock + * released and then refilled before we + * remove it... we dont care for now + */ + zone_drain_wait(zone, M_WAITOK); + /* + * Unlink all of our kegs. + */ + while ((klink = LIST_FIRST(&zone->uz_kegs)) != NULL) { + klink->kl_keg = NULL; + LIST_REMOVE(klink, kl_link); + if (klink == &zone->uz_klink) + continue; + free(klink, M_TEMP); + } + /* + * We only destroy kegs from non secondary zones. + */ + if ((zone->uz_flags & UMA_ZONE_SECONDARY) == 0) { + mtx_lock(&uma_mtx); LIST_REMOVE(keg, uk_link); - LIST_REMOVE(zone, uz_link); mtx_unlock(&uma_mtx); - uma_zfree_internal(kegs, keg, NULL, SKIP_NONE, + zone_free_item(kegs, keg, NULL, SKIP_NONE, ZFREE_STATFREE); } - zone->uz_keg = NULL; } /* @@ -1517,7 +1591,7 @@ uma_startup(void *bootmem, int boot_page * (UMA_MAX_WASTE). * * We iterate until we find an object size for - * which the calculated wastage in zone_small_init() will be + * which the calculated wastage in keg_small_init() will be * enough to warrant OFFPAGE. Since wastedspace versus objsize * is an overall increasing see-saw function, we find the smallest * objsize such that the wastage is always acceptable for objects @@ -1525,7 +1599,7 @@ uma_startup(void *bootmem, int boot_page * generates a larger possible uma_max_ipers, we use this computed * objsize to calculate the largest ipers possible. Since the * ipers calculated for OFFPAGE slab headers is always larger than - * the ipers initially calculated in zone_small_init(), we use + * the ipers initially calculated in keg_small_init(), we use * the former's equation (UMA_SLAB_SIZE / keg->uk_rsize) to * obtain the maximum ipers possible for offpage slab headers. * @@ -1557,7 +1631,7 @@ uma_startup(void *bootmem, int boot_page } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 09:15:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79B601065672; Sun, 25 Jan 2009 09:15:43 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.231]) by mx1.freebsd.org (Postfix) with ESMTP id 3F40D8FC0A; Sun, 25 Jan 2009 09:15:43 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by rv-out-0506.google.com with SMTP id b25so5537027rvf.43 for ; Sun, 25 Jan 2009 01:15:43 -0800 (PST) Received: by 10.141.161.6 with SMTP id n6mr736837rvo.3.1232874942962; Sun, 25 Jan 2009 01:15:42 -0800 (PST) Received: from ?10.0.1.199? (udp005586uds.hawaiiantel.net [72.234.105.237]) by mx.google.com with ESMTPS id g14sm3943869rvb.0.2009.01.25.01.15.39 (version=SSLv3 cipher=RC4-MD5); Sun, 25 Jan 2009 01:15:41 -0800 (PST) Date: Sat, 24 Jan 2009 23:13:04 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Jeff Roberson In-Reply-To: <200901250911.n0P9BOZi011685@svn.freebsd.org> Message-ID: <20090124230952.S983@desktop> References: <200901250911.n0P9BOZi011685@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187681 - in head/sys: kern vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 09:15:43 -0000 On Sun, 25 Jan 2009, Jeff Roberson wrote: > Author: jeff > Date: Sun Jan 25 09:11:24 2009 > New Revision: 187681 > URL: http://svn.freebsd.org/changeset/base/187681 > > Log: > - Make the keg abstraction more complete. Permit a zone to have multiple > backend kegs so it may source compatible memory from multiple backends. > This is useful for cases such as NUMA or different layouts for the same > memory type. > - Provide a new api for adding new backend kegs to secondary zones. > - Provide a new flag for adjusting the layout of zones to stagger > allocations better across cache lines. There are currently no in-tree users for the new functionality provided by this diff. Our network stack has other bottlenecks in play before memory layout optimizations are helpful. However, I think anyone who has looked at UMA internals as they have evolved over the last 7 years will appreciate the refactoring. Thanks, Jeff > > Sponsored by: Nokia > > Modified: > head/sys/kern/kern_malloc.c > head/sys/vm/uma.h > head/sys/vm/uma_core.c > head/sys/vm/uma_dbg.c > head/sys/vm/uma_int.h > > Modified: head/sys/kern/kern_malloc.c > ============================================================================== > --- head/sys/kern/kern_malloc.c Sun Jan 25 08:27:11 2009 (r187680) > +++ head/sys/kern/kern_malloc.c Sun Jan 25 09:11:24 2009 (r187681) > @@ -329,7 +329,6 @@ malloc(unsigned long size, struct malloc > int indx; > caddr_t va; > uma_zone_t zone; > - uma_keg_t keg; > #if defined(DIAGNOSTIC) || defined(DEBUG_REDZONE) > unsigned long osize = size; > #endif > @@ -378,18 +377,16 @@ malloc(unsigned long size, struct malloc > size = (size & ~KMEM_ZMASK) + KMEM_ZBASE; > indx = kmemsize[size >> KMEM_ZSHIFT]; > zone = kmemzones[indx].kz_zone; > - keg = zone->uz_keg; > #ifdef MALLOC_PROFILE > krequests[size >> KMEM_ZSHIFT]++; > #endif > va = uma_zalloc(zone, flags); > if (va != NULL) > - size = keg->uk_size; > + size = zone->uz_size; > malloc_type_zone_allocated(mtp, va == NULL ? 0 : size, indx); > } else { > size = roundup(size, PAGE_SIZE); > zone = NULL; > - keg = NULL; > va = uma_large_malloc(size, flags); > malloc_type_allocated(mtp, va == NULL ? 0 : size); > } > > Modified: head/sys/vm/uma.h > ============================================================================== > --- head/sys/vm/uma.h Sun Jan 25 08:27:11 2009 (r187680) > +++ head/sys/vm/uma.h Sun Jan 25 09:11:24 2009 (r187681) > @@ -205,6 +205,17 @@ uma_zone_t uma_zsecond_create(char *name > uma_init zinit, uma_fini zfini, uma_zone_t master); > > /* > + * Add a second master to a secondary zone. This provides multiple data > + * backends for objects with the same size. Both masters must have > + * compatible allocation flags. Presently, UMA_ZONE_MALLOC type zones are > + * the only supported. > + * > + * Returns: > + * Error on failure, 0 on success. > + */ > +int uma_zsecond_add(uma_zone_t zone, uma_zone_t master); > + > +/* > * Definitions for uma_zcreate flags > * > * These flags share space with UMA_ZFLAGs in uma_int.h. Be careful not to > @@ -230,6 +241,22 @@ uma_zone_t uma_zsecond_create(char *name > #define UMA_ZONE_SECONDARY 0x0200 /* Zone is a Secondary Zone */ > #define UMA_ZONE_REFCNT 0x0400 /* Allocate refcnts in slabs */ > #define UMA_ZONE_MAXBUCKET 0x0800 /* Use largest buckets */ > +#define UMA_ZONE_CACHESPREAD 0x1000 /* > + * Spread memory start locations across > + * all possible cache lines. May > + * require many virtually contiguous > + * backend pages and can fail early. > + */ > +#define UMA_ZONE_VTOSLAB 0x2000 /* Zone uses vtoslab for lookup. */ > + > +/* > + * These flags are shared between the keg and zone. In zones wishing to add > + * new kegs these flags must be compatible. Some are determined based on > + * physical parameters of the request and may not be provided by the consumer. > + */ > +#define UMA_ZONE_INHERIT \ > + (UMA_ZONE_OFFPAGE | UMA_ZONE_MALLOC | UMA_ZONE_HASH | \ > + UMA_ZONE_REFCNT | UMA_ZONE_VTOSLAB) > > /* Definitions for align */ > #define UMA_ALIGN_PTR (sizeof(void *) - 1) /* Alignment fit for ptr */ > > Modified: head/sys/vm/uma_core.c > ============================================================================== > --- head/sys/vm/uma_core.c Sun Jan 25 08:27:11 2009 (r187680) > +++ head/sys/vm/uma_core.c Sun Jan 25 09:11:24 2009 (r187681) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2002, 2003, 2004, 2005 Jeffrey Roberson > + * Copyright (c) 2002-2005, 2009 Jeffrey Roberson > * Copyright (c) 2004, 2005 Bosko Milekic > * Copyright (c) 2004-2006 Robert N. M. Watson > * All rights reserved. > @@ -112,7 +112,7 @@ static uma_zone_t slabrefzone; /* With r > static uma_zone_t hashzone; > > /* The boot-time adjusted value for cache line alignment. */ > -static int uma_align_cache = 16 - 1; > +static int uma_align_cache = 64 - 1; > > static MALLOC_DEFINE(M_UMAHASH, "UMAHash", "UMA Hash Buckets"); > > @@ -212,7 +212,7 @@ static void *obj_alloc(uma_zone_t, int, > static void *page_alloc(uma_zone_t, int, u_int8_t *, int); > static void *startup_alloc(uma_zone_t, int, u_int8_t *, int); > static void page_free(void *, int, u_int8_t); > -static uma_slab_t slab_zalloc(uma_zone_t, int); > +static uma_slab_t keg_alloc_slab(uma_keg_t, uma_zone_t, int); > static void cache_drain(uma_zone_t); > static void bucket_drain(uma_zone_t, uma_bucket_t); > static void bucket_cache_drain(uma_zone_t zone); > @@ -221,8 +221,8 @@ static void keg_dtor(void *, int, void * > static int zone_ctor(void *, int, void *, int); > static void zone_dtor(void *, int, void *); > static int zero_init(void *, int, int); > -static void zone_small_init(uma_zone_t zone); > -static void zone_large_init(uma_zone_t zone); > +static void keg_small_init(uma_keg_t keg); > +static void keg_large_init(uma_keg_t keg); > static void zone_foreach(void (*zfunc)(uma_zone_t)); > static void zone_timeout(uma_zone_t zone); > static int hash_alloc(struct uma_hash *); > @@ -230,19 +230,22 @@ static int hash_expand(struct uma_hash * > static void hash_free(struct uma_hash *hash); > static void uma_timeout(void *); > static void uma_startup3(void); > -static void *uma_zalloc_internal(uma_zone_t, void *, int); > -static void uma_zfree_internal(uma_zone_t, void *, void *, enum zfreeskip, > +static void *zone_alloc_item(uma_zone_t, void *, int); > +static void zone_free_item(uma_zone_t, void *, void *, enum zfreeskip, > int); > static void bucket_enable(void); > static void bucket_init(void); > static uma_bucket_t bucket_alloc(int, int); > static void bucket_free(uma_bucket_t); > static void bucket_zone_drain(void); > -static int uma_zalloc_bucket(uma_zone_t zone, int flags); > -static uma_slab_t uma_zone_slab(uma_zone_t zone, int flags); > -static void *uma_slab_alloc(uma_zone_t zone, uma_slab_t slab); > -static uma_zone_t uma_kcreate(uma_zone_t zone, size_t size, uma_init uminit, > +static int zone_alloc_bucket(uma_zone_t zone, int flags); > +static uma_slab_t zone_fetch_slab(uma_zone_t zone, uma_keg_t last, int flags); > +static uma_slab_t zone_fetch_slab_multi(uma_zone_t zone, uma_keg_t last, int flags); > +static void *slab_alloc_item(uma_zone_t zone, uma_slab_t slab); > +static uma_keg_t uma_kcreate(uma_zone_t zone, size_t size, uma_init uminit, > uma_fini fini, int align, u_int32_t flags); > +static inline void zone_relock(uma_zone_t zone, uma_keg_t keg); > +static inline void keg_relock(uma_keg_t keg, uma_zone_t zone); > > void uma_print_zone(uma_zone_t); > void uma_print_stats(void); > @@ -291,7 +294,8 @@ bucket_init(void) > size = roundup(sizeof(struct uma_bucket), sizeof(void *)); > size += sizeof(void *) * ubz->ubz_entries; > ubz->ubz_zone = uma_zcreate(ubz->ubz_name, size, > - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZFLAG_INTERNAL); > + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, > + UMA_ZFLAG_INTERNAL | UMA_ZFLAG_BUCKET); > for (; i <= ubz->ubz_entries; i += (1 << BUCKET_SHIFT)) > bucket_size[i >> BUCKET_SHIFT] = j; > } > @@ -326,7 +330,7 @@ bucket_alloc(int entries, int bflags) > return (NULL); > > ubz = bucket_zone_lookup(entries); > - bucket = uma_zalloc_internal(ubz->ubz_zone, NULL, bflags); > + bucket = zone_alloc_item(ubz->ubz_zone, NULL, bflags); > if (bucket) { > #ifdef INVARIANTS > bzero(bucket->ub_bucket, sizeof(void *) * ubz->ubz_entries); > @@ -344,7 +348,7 @@ bucket_free(uma_bucket_t bucket) > struct uma_bucket_zone *ubz; > > ubz = bucket_zone_lookup(bucket->ub_entries); > - uma_zfree_internal(ubz->ubz_zone, bucket, NULL, SKIP_NONE, > + zone_free_item(ubz->ubz_zone, bucket, NULL, SKIP_NONE, > ZFREE_STATFREE); > } > > @@ -357,6 +361,21 @@ bucket_zone_drain(void) > zone_drain(ubz->ubz_zone); > } > > +static inline uma_keg_t > +zone_first_keg(uma_zone_t zone) > +{ > + > + return (LIST_FIRST(&zone->uz_kegs)->kl_keg); > +} > + > +static void > +zone_foreach_keg(uma_zone_t zone, void (*kegfn)(uma_keg_t)) > +{ > + uma_klink_t klink; > + > + LIST_FOREACH(klink, &zone->uz_kegs, kl_link) > + kegfn(klink->kl_keg); > +} > > /* > * Routine called by timeout which is used to fire off some time interval > @@ -382,29 +401,20 @@ uma_timeout(void *unused) > * Routine to perform timeout driven calculations. This expands the > * hashes and does per cpu statistics aggregation. > * > - * Arguments: > - * zone The zone to operate on > - * > - * Returns: > - * Nothing > + * Returns nothing. > */ > static void > -zone_timeout(uma_zone_t zone) > +keg_timeout(uma_keg_t keg) > { > - uma_keg_t keg; > - u_int64_t alloc; > - > - keg = zone->uz_keg; > - alloc = 0; > > + KEG_LOCK(keg); > /* > - * Expand the zone hash table. > + * Expand the keg hash table. > * > * This is done if the number of slabs is larger than the hash size. > * What I'm trying to do here is completely reduce collisions. This > * may be a little aggressive. Should I allow for two collisions max? > */ > - ZONE_LOCK(zone); > if (keg->uk_flags & UMA_ZONE_HASH && > keg->uk_pages / keg->uk_ppera >= keg->uk_hash.uh_hashsize) { > struct uma_hash newhash; > @@ -413,14 +423,14 @@ zone_timeout(uma_zone_t zone) > > /* > * This is so involved because allocating and freeing > - * while the zone lock is held will lead to deadlock. > + * while the keg lock is held will lead to deadlock. > * I have to do everything in stages and check for > * races. > */ > newhash = keg->uk_hash; > - ZONE_UNLOCK(zone); > + KEG_UNLOCK(keg); > ret = hash_alloc(&newhash); > - ZONE_LOCK(zone); > + KEG_LOCK(keg); > if (ret) { > if (hash_expand(&keg->uk_hash, &newhash)) { > oldhash = keg->uk_hash; > @@ -428,12 +438,19 @@ zone_timeout(uma_zone_t zone) > } else > oldhash = newhash; > > - ZONE_UNLOCK(zone); > + KEG_UNLOCK(keg); > hash_free(&oldhash); > - ZONE_LOCK(zone); > + KEG_LOCK(keg); > } > } > - ZONE_UNLOCK(zone); > + KEG_UNLOCK(keg); > +} > + > +static void > +zone_timeout(uma_zone_t zone) > +{ > + > + zone_foreach_keg(zone, &keg_timeout); > } > > /* > @@ -462,7 +479,7 @@ hash_alloc(struct uma_hash *hash) > M_UMAHASH, M_NOWAIT); > } else { > alloc = sizeof(hash->uh_slab_hash[0]) * UMA_HASH_SIZE_INIT; > - hash->uh_slab_hash = uma_zalloc_internal(hashzone, NULL, > + hash->uh_slab_hash = zone_alloc_item(hashzone, NULL, > M_WAITOK); > hash->uh_hashsize = UMA_HASH_SIZE_INIT; > } > @@ -535,7 +552,7 @@ hash_free(struct uma_hash *hash) > if (hash->uh_slab_hash == NULL) > return; > if (hash->uh_hashsize == UMA_HASH_SIZE_INIT) > - uma_zfree_internal(hashzone, > + zone_free_item(hashzone, > hash->uh_slab_hash, NULL, SKIP_NONE, ZFREE_STATFREE); > else > free(hash->uh_slab_hash, M_UMAHASH); > @@ -555,20 +572,11 @@ hash_free(struct uma_hash *hash) > static void > bucket_drain(uma_zone_t zone, uma_bucket_t bucket) > { > - uma_slab_t slab; > - int mzone; > void *item; > > if (bucket == NULL) > return; > > - slab = NULL; > - mzone = 0; > - > - /* We have to lookup the slab again for malloc.. */ > - if (zone->uz_keg->uk_flags & UMA_ZONE_MALLOC) > - mzone = 1; > - > while (bucket->ub_cnt > 0) { > bucket->ub_cnt--; > item = bucket->ub_bucket[bucket->ub_cnt]; > @@ -577,15 +585,7 @@ bucket_drain(uma_zone_t zone, uma_bucket > KASSERT(item != NULL, > ("bucket_drain: botched ptr, item is NULL")); > #endif > - /* > - * This is extremely inefficient. The slab pointer was passed > - * to uma_zfree_arg, but we lost it because the buckets don't > - * hold them. This will go away when free() gets a size passed > - * to it. > - */ > - if (mzone) > - slab = vtoslab((vm_offset_t)item & (~UMA_SLAB_MASK)); > - uma_zfree_internal(zone, item, slab, SKIP_DTOR, 0); > + zone_free_item(zone, item, NULL, SKIP_DTOR, 0); > } > } > > @@ -665,42 +665,32 @@ bucket_cache_drain(uma_zone_t zone) > } > > /* > - * Frees pages from a zone back to the system. This is done on demand from > + * Frees pages from a keg back to the system. This is done on demand from > * the pageout daemon. > * > - * Arguments: > - * zone The zone to free pages from > - * all Should we drain all items? > - * > - * Returns: > - * Nothing. > + * Returns nothing. > */ > -void > -zone_drain(uma_zone_t zone) > +static void > +keg_drain(uma_keg_t keg) > { > struct slabhead freeslabs = { 0 }; > - uma_keg_t keg; > uma_slab_t slab; > uma_slab_t n; > u_int8_t flags; > u_int8_t *mem; > int i; > > - keg = zone->uz_keg; > - > /* > - * We don't want to take pages from statically allocated zones at this > + * We don't want to take pages from statically allocated kegs at this > * time > */ > if (keg->uk_flags & UMA_ZONE_NOFREE || keg->uk_freef == NULL) > return; > > - ZONE_LOCK(zone); > - > #ifdef UMA_DEBUG > - printf("%s free items: %u\n", zone->uz_name, keg->uk_free); > + printf("%s free items: %u\n", keg->uk_name, keg->uk_free); > #endif > - bucket_cache_drain(zone); > + KEG_LOCK(keg); > if (keg->uk_free == 0) > goto finished; > > @@ -726,7 +716,7 @@ zone_drain(uma_zone_t zone) > slab = n; > } > finished: > - ZONE_UNLOCK(zone); > + KEG_UNLOCK(keg); > > while ((slab = SLIST_FIRST(&freeslabs)) != NULL) { > SLIST_REMOVE(&freeslabs, slab, uma_slab, us_hlink); > @@ -738,8 +728,7 @@ finished: > flags = slab->us_flags; > mem = slab->us_data; > > - if ((keg->uk_flags & UMA_ZONE_MALLOC) || > - (keg->uk_flags & UMA_ZONE_REFCNT)) { > + if (keg->uk_flags & UMA_ZONE_VTOSLAB) { > vm_object_t obj; > > if (flags & UMA_SLAB_KMEM) > @@ -753,21 +742,61 @@ finished: > obj); > } > if (keg->uk_flags & UMA_ZONE_OFFPAGE) > - uma_zfree_internal(keg->uk_slabzone, slab, NULL, > + zone_free_item(keg->uk_slabzone, slab, NULL, > SKIP_NONE, ZFREE_STATFREE); > #ifdef UMA_DEBUG > printf("%s: Returning %d bytes.\n", > - zone->uz_name, UMA_SLAB_SIZE * keg->uk_ppera); > + keg->uk_name, UMA_SLAB_SIZE * keg->uk_ppera); > #endif > keg->uk_freef(mem, UMA_SLAB_SIZE * keg->uk_ppera, flags); > } > } > > +static void > +zone_drain_wait(uma_zone_t zone, int waitok) > +{ > + > + /* > + * Set draining to interlock with zone_dtor() so we can release our > + * locks as we go. Only dtor() should do a WAITOK call since it > + * is the only call that knows the structure will still be available > + * when it wakes up. > + */ > + ZONE_LOCK(zone); > + while (zone->uz_flags & UMA_ZFLAG_DRAINING) { > + if (waitok == M_NOWAIT) > + goto out; > + mtx_unlock(&uma_mtx); > + msleep(zone, zone->uz_lock, PVM, "zonedrain", 1); > + mtx_lock(&uma_mtx); > + } > + zone->uz_flags |= UMA_ZFLAG_DRAINING; > + bucket_cache_drain(zone); > + ZONE_UNLOCK(zone); > + /* > + * The DRAINING flag protects us from being freed while > + * we're running. Normally the uma_mtx would protect us but we > + * must be able to release and acquire the right lock for each keg. > + */ > + zone_foreach_keg(zone, &keg_drain); > + ZONE_LOCK(zone); > + zone->uz_flags &= ~UMA_ZFLAG_DRAINING; > + wakeup(zone); > +out: > + ZONE_UNLOCK(zone); > +} > + > +void > +zone_drain(uma_zone_t zone) > +{ > + > + zone_drain_wait(zone, M_NOWAIT); > +} > + > /* > - * Allocate a new slab for a zone. This does not insert the slab onto a list. > + * Allocate a new slab for a keg. This does not insert the slab onto a list. > * > * Arguments: > - * zone The zone to allocate slabs for > * wait Shall we wait? > * > * Returns: > @@ -775,27 +804,28 @@ finished: > * caller specified M_NOWAIT. > */ > static uma_slab_t > -slab_zalloc(uma_zone_t zone, int wait) > +keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int wait) > { > uma_slabrefcnt_t slabref; > + uma_alloc allocf; > uma_slab_t slab; > - uma_keg_t keg; > u_int8_t *mem; > u_int8_t flags; > int i; > > + mtx_assert(&keg->uk_lock, MA_OWNED); > slab = NULL; > - keg = zone->uz_keg; > > #ifdef UMA_DEBUG > - printf("slab_zalloc: Allocating a new slab for %s\n", zone->uz_name); > + printf("slab_zalloc: Allocating a new slab for %s\n", keg->uk_name); > #endif > - ZONE_UNLOCK(zone); > + allocf = keg->uk_allocf; > + KEG_UNLOCK(keg); > > if (keg->uk_flags & UMA_ZONE_OFFPAGE) { > - slab = uma_zalloc_internal(keg->uk_slabzone, NULL, wait); > + slab = zone_alloc_item(keg->uk_slabzone, NULL, wait); > if (slab == NULL) { > - ZONE_LOCK(zone); > + KEG_LOCK(keg); > return NULL; > } > } > @@ -812,13 +842,13 @@ slab_zalloc(uma_zone_t zone, int wait) > else > wait &= ~M_ZERO; > > - mem = keg->uk_allocf(zone, keg->uk_ppera * UMA_SLAB_SIZE, > - &flags, wait); > + /* zone is passed for legacy reasons. */ > + mem = allocf(zone, keg->uk_ppera * UMA_SLAB_SIZE, &flags, wait); > if (mem == NULL) { > if (keg->uk_flags & UMA_ZONE_OFFPAGE) > - uma_zfree_internal(keg->uk_slabzone, slab, NULL, > + zone_free_item(keg->uk_slabzone, slab, NULL, > SKIP_NONE, ZFREE_STATFREE); > - ZONE_LOCK(zone); > + KEG_LOCK(keg); > return (NULL); > } > > @@ -826,8 +856,7 @@ slab_zalloc(uma_zone_t zone, int wait) > if (!(keg->uk_flags & UMA_ZONE_OFFPAGE)) > slab = (uma_slab_t )(mem + keg->uk_pgoff); > > - if ((keg->uk_flags & UMA_ZONE_MALLOC) || > - (keg->uk_flags & UMA_ZONE_REFCNT)) > + if (keg->uk_flags & UMA_ZONE_VTOSLAB) > for (i = 0; i < keg->uk_ppera; i++) > vsetslab((vm_offset_t)mem + (i * PAGE_SIZE), slab); > > @@ -860,8 +889,7 @@ slab_zalloc(uma_zone_t zone, int wait) > (keg->uk_rsize * i), > keg->uk_size); > } > - if ((keg->uk_flags & UMA_ZONE_MALLOC) || > - (keg->uk_flags & UMA_ZONE_REFCNT)) { > + if (keg->uk_flags & UMA_ZONE_VTOSLAB) { > vm_object_t obj; > > if (flags & UMA_SLAB_KMEM) > @@ -875,15 +903,15 @@ slab_zalloc(uma_zone_t zone, int wait) > (i * PAGE_SIZE), obj); > } > if (keg->uk_flags & UMA_ZONE_OFFPAGE) > - uma_zfree_internal(keg->uk_slabzone, slab, > + zone_free_item(keg->uk_slabzone, slab, > NULL, SKIP_NONE, ZFREE_STATFREE); > keg->uk_freef(mem, UMA_SLAB_SIZE * keg->uk_ppera, > flags); > - ZONE_LOCK(zone); > + KEG_LOCK(keg); > return (NULL); > } > } > - ZONE_LOCK(zone); > + KEG_LOCK(keg); > > if (keg->uk_flags & UMA_ZONE_HASH) > UMA_HASH_INSERT(&keg->uk_hash, slab, mem); > @@ -905,7 +933,7 @@ startup_alloc(uma_zone_t zone, int bytes > uma_keg_t keg; > uma_slab_t tmps; > > - keg = zone->uz_keg; > + keg = zone_first_keg(zone); > > /* > * Check our small startup cache to see if it has pages remaining. > @@ -935,7 +963,6 @@ startup_alloc(uma_zone_t zone, int bytes > * Allocates a number of pages from the system > * > * Arguments: > - * zone Unused > * bytes The number of bytes requested > * wait Shall we wait? > * > @@ -958,7 +985,6 @@ page_alloc(uma_zone_t zone, int bytes, u > * Allocates a number of pages from within an object > * > * Arguments: > - * zone Unused > * bytes The number of bytes requested > * wait Shall we wait? > * > @@ -973,8 +999,10 @@ obj_alloc(uma_zone_t zone, int bytes, u_ > vm_offset_t retkva, zkva; > vm_page_t p; > int pages, startpages; > + uma_keg_t keg; > > - object = zone->uz_keg->uk_obj; > + keg = zone_first_keg(zone); > + object = keg->uk_obj; > retkva = 0; > > /* > @@ -984,7 +1012,7 @@ obj_alloc(uma_zone_t zone, int bytes, u_ > p = TAILQ_LAST(&object->memq, pglist); > pages = p != NULL ? p->pindex + 1 : 0; > startpages = pages; > - zkva = zone->uz_keg->uk_kva + pages * PAGE_SIZE; > + zkva = keg->uk_kva + pages * PAGE_SIZE; > for (; bytes > 0; bytes -= PAGE_SIZE) { > p = vm_page_alloc(object, pages, > VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED); > @@ -1052,25 +1080,23 @@ zero_init(void *mem, int size, int flags > } > > /* > - * Finish creating a small uma zone. This calculates ipers, and the zone size. > + * Finish creating a small uma keg. This calculates ipers, and the keg size. > * > * Arguments > - * zone The zone we should initialize > + * keg The zone we should initialize > * > * Returns > * Nothing > */ > static void > -zone_small_init(uma_zone_t zone) > +keg_small_init(uma_keg_t keg) > { > - uma_keg_t keg; > u_int rsize; > u_int memused; > u_int wastedspace; > u_int shsize; > > - keg = zone->uz_keg; > - KASSERT(keg != NULL, ("Keg is null in zone_small_init")); > + KASSERT(keg != NULL, ("Keg is null in keg_small_init")); > rsize = keg->uk_size; > > if (rsize < UMA_SMALLEST_UNIT) > @@ -1090,7 +1116,7 @@ zone_small_init(uma_zone_t zone) > } > > keg->uk_ipers = (UMA_SLAB_SIZE - shsize) / rsize; > - KASSERT(keg->uk_ipers != 0, ("zone_small_init: ipers is 0")); > + KASSERT(keg->uk_ipers != 0, ("keg_small_init: ipers is 0")); > memused = keg->uk_ipers * rsize + shsize; > wastedspace = UMA_SLAB_SIZE - memused; > > @@ -1109,44 +1135,41 @@ zone_small_init(uma_zone_t zone) > (keg->uk_ipers < (UMA_SLAB_SIZE / keg->uk_rsize))) { > keg->uk_ipers = UMA_SLAB_SIZE / keg->uk_rsize; > KASSERT(keg->uk_ipers <= 255, > - ("zone_small_init: keg->uk_ipers too high!")); > + ("keg_small_init: keg->uk_ipers too high!")); > #ifdef UMA_DEBUG > printf("UMA decided we need offpage slab headers for " > - "zone: %s, calculated wastedspace = %d, " > + "keg: %s, calculated wastedspace = %d, " > "maximum wasted space allowed = %d, " > "calculated ipers = %d, " > - "new wasted space = %d\n", zone->uz_name, wastedspace, > + "new wasted space = %d\n", keg->uk_name, wastedspace, > UMA_MAX_WASTE, keg->uk_ipers, > UMA_SLAB_SIZE - keg->uk_ipers * keg->uk_rsize); > #endif > keg->uk_flags |= UMA_ZONE_OFFPAGE; > - if ((keg->uk_flags & UMA_ZONE_MALLOC) == 0) > + if ((keg->uk_flags & UMA_ZONE_VTOSLAB) == 0) > keg->uk_flags |= UMA_ZONE_HASH; > } > } > > /* > - * Finish creating a large (> UMA_SLAB_SIZE) uma zone. Just give in and do > + * Finish creating a large (> UMA_SLAB_SIZE) uma kegs. Just give in and do > * OFFPAGE for now. When I can allow for more dynamic slab sizes this will be > * more complicated. > * > * Arguments > - * zone The zone we should initialize > + * keg The keg we should initialize > * > * Returns > * Nothing > */ > static void > -zone_large_init(uma_zone_t zone) > +keg_large_init(uma_keg_t keg) > { > - uma_keg_t keg; > int pages; > > - keg = zone->uz_keg; > - > - KASSERT(keg != NULL, ("Keg is null in zone_large_init")); > + KASSERT(keg != NULL, ("Keg is null in keg_large_init")); > KASSERT((keg->uk_flags & UMA_ZFLAG_CACHEONLY) == 0, > - ("zone_large_init: Cannot large-init a UMA_ZFLAG_CACHEONLY zone")); > + ("keg_large_init: Cannot large-init a UMA_ZFLAG_CACHEONLY keg")); > > pages = keg->uk_size / UMA_SLAB_SIZE; > > @@ -1158,12 +1181,44 @@ zone_large_init(uma_zone_t zone) > keg->uk_ipers = 1; > > keg->uk_flags |= UMA_ZONE_OFFPAGE; > - if ((keg->uk_flags & UMA_ZONE_MALLOC) == 0) > + if ((keg->uk_flags & UMA_ZONE_VTOSLAB) == 0) > keg->uk_flags |= UMA_ZONE_HASH; > > keg->uk_rsize = keg->uk_size; > } > > +static void > +keg_cachespread_init(uma_keg_t keg) > +{ > + int alignsize; > + int trailer; > + int pages; > + int rsize; > + > + alignsize = keg->uk_align + 1; > + rsize = keg->uk_size; > + /* > + * We want one item to start on every align boundary in a page. To > + * do this we will span pages. We will also extend the item by the > + * size of align if it is an even multiple of align. Otherwise, it > + * would fall on the same boundary every time. > + */ > + if (rsize & keg->uk_align) > + rsize = (rsize & ~keg->uk_align) + alignsize; > + if ((rsize & alignsize) == 0) > + rsize += alignsize; > + trailer = rsize - keg->uk_size; > + pages = (rsize * (PAGE_SIZE / alignsize)) / PAGE_SIZE; > + pages = MIN(pages, (128 * 1024) / PAGE_SIZE); > + keg->uk_rsize = rsize; > + keg->uk_ppera = pages; > + keg->uk_ipers = ((pages * PAGE_SIZE) + trailer) / rsize; > + keg->uk_flags |= UMA_ZONE_OFFPAGE | UMA_ZONE_VTOSLAB; > + KASSERT(keg->uk_ipers <= uma_max_ipers, > + ("keg_small_init: keg->uk_ipers too high(%d) increase max_ipers", > + keg->uk_ipers)); > +} > + > /* > * Keg header ctor. This initializes all fields, locks, etc. And inserts > * the keg onto the global keg list. > @@ -1195,7 +1250,7 @@ keg_ctor(void *mem, int size, void *udat > * The master zone is passed to us at keg-creation time. > */ > zone = arg->zone; > - zone->uz_keg = keg; > + keg->uk_name = zone->uz_name; > > if (arg->flags & UMA_ZONE_VM) > keg->uk_flags |= UMA_ZFLAG_CACHEONLY; > @@ -1203,24 +1258,31 @@ keg_ctor(void *mem, int size, void *udat > if (arg->flags & UMA_ZONE_ZINIT) > keg->uk_init = zero_init; > > + if (arg->flags & UMA_ZONE_REFCNT || arg->flags & UMA_ZONE_MALLOC) > + keg->uk_flags |= UMA_ZONE_VTOSLAB; > + > /* > * The +UMA_FRITM_SZ added to uk_size is to account for the > - * linkage that is added to the size in zone_small_init(). If > + * linkage that is added to the size in keg_small_init(). If > * we don't account for this here then we may end up in > - * zone_small_init() with a calculated 'ipers' of 0. > + * keg_small_init() with a calculated 'ipers' of 0. > */ > if (keg->uk_flags & UMA_ZONE_REFCNT) { > - if ((keg->uk_size+UMA_FRITMREF_SZ) > > + if (keg->uk_flags & UMA_ZONE_CACHESPREAD) > + keg_cachespread_init(keg); > + else if ((keg->uk_size+UMA_FRITMREF_SZ) > > (UMA_SLAB_SIZE - sizeof(struct uma_slab_refcnt))) > - zone_large_init(zone); > + keg_large_init(keg); > else > - zone_small_init(zone); > + keg_small_init(keg); > } else { > - if ((keg->uk_size+UMA_FRITM_SZ) > > + if (keg->uk_flags & UMA_ZONE_CACHESPREAD) > + keg_cachespread_init(keg); > + else if ((keg->uk_size+UMA_FRITM_SZ) > > (UMA_SLAB_SIZE - sizeof(struct uma_slab))) > - zone_large_init(zone); > + keg_large_init(keg); > else > - zone_small_init(zone); > + keg_small_init(keg); > } > > if (keg->uk_flags & UMA_ZONE_OFFPAGE) { > @@ -1244,14 +1306,12 @@ keg_ctor(void *mem, int size, void *udat > } > > /* > - * Initialize keg's lock (shared among zones) through > - * Master zone > + * Initialize keg's lock (shared among zones). > */ > - zone->uz_lock = &keg->uk_lock; > if (arg->flags & UMA_ZONE_MTXCLASS) > - ZONE_LOCK_INIT(zone, 1); > + KEG_LOCK_INIT(keg, 1); > else > - ZONE_LOCK_INIT(zone, 0); > + KEG_LOCK_INIT(keg, 0); > > /* > * If we're putting the slab header in the actual page we need to > @@ -1300,10 +1360,10 @@ keg_ctor(void *mem, int size, void *udat > hash_alloc(&keg->uk_hash); > > #ifdef UMA_DEBUG > - printf("%s(%p) size = %d ipers = %d ppera = %d pgoff = %d\n", > - zone->uz_name, zone, > - keg->uk_size, keg->uk_ipers, > - keg->uk_ppera, keg->uk_pgoff); > + printf("UMA: %s(%p) size %d(%d) flags %d ipers %d ppera %d out %d free %d\n", > + zone->uz_name, zone, keg->uk_size, keg->uk_rsize, keg->uk_flags, > + keg->uk_ipers, keg->uk_ppera, > + (keg->uk_ipers * keg->uk_pages) - keg->uk_free, keg->uk_free); > #endif > > LIST_INSERT_HEAD(&keg->uk_zones, zone, uz_link); > @@ -1320,7 +1380,6 @@ keg_ctor(void *mem, int size, void *udat > * Arguments/Returns follow uma_ctor specifications > * udata Actually uma_zctor_args > */ > - > static int > zone_ctor(void *mem, int size, void *udata, int flags) > { > @@ -1333,23 +1392,24 @@ zone_ctor(void *mem, int size, void *uda > zone->uz_name = arg->name; > zone->uz_ctor = arg->ctor; > zone->uz_dtor = arg->dtor; > + zone->uz_slab = zone_fetch_slab; > zone->uz_init = NULL; > zone->uz_fini = NULL; > zone->uz_allocs = 0; > zone->uz_frees = 0; > zone->uz_fails = 0; > zone->uz_fills = zone->uz_count = 0; > + zone->uz_flags = 0; > + keg = arg->keg; > > if (arg->flags & UMA_ZONE_SECONDARY) { > KASSERT(arg->keg != NULL, ("Secondary zone on zero'd keg")); > - keg = arg->keg; > - zone->uz_keg = keg; > zone->uz_init = arg->uminit; > zone->uz_fini = arg->fini; > zone->uz_lock = &keg->uk_lock; > + zone->uz_flags |= UMA_ZONE_SECONDARY; > mtx_lock(&uma_mtx); > ZONE_LOCK(zone); > - keg->uk_flags |= UMA_ZONE_SECONDARY; > LIST_FOREACH(z, &keg->uk_zones, uz_link) { > if (LIST_NEXT(z, uz_link) == NULL) { > LIST_INSERT_AFTER(z, zone, uz_link); > @@ -1358,9 +1418,9 @@ zone_ctor(void *mem, int size, void *uda > } > ZONE_UNLOCK(zone); > mtx_unlock(&uma_mtx); > - } else if (arg->keg == NULL) { > - if (uma_kcreate(zone, arg->size, arg->uminit, arg->fini, > - arg->align, arg->flags) == NULL) > + } else if (keg == NULL) { > + if ((keg = uma_kcreate(zone, arg->size, arg->uminit, arg->fini, > + arg->align, arg->flags)) == NULL) > return (ENOMEM); > } else { > struct uma_kctor_args karg; > @@ -1378,15 +1438,22 @@ zone_ctor(void *mem, int size, void *uda > if (error) > return (error); > } > - keg = zone->uz_keg; > + /* > + * Link in the first keg. > + */ > + zone->uz_klink.kl_keg = keg; > + LIST_INSERT_HEAD(&zone->uz_kegs, &zone->uz_klink, kl_link); > zone->uz_lock = &keg->uk_lock; > + zone->uz_size = keg->uk_size; > + zone->uz_flags |= (keg->uk_flags & > + (UMA_ZONE_INHERIT | UMA_ZFLAG_INHERIT)); > > /* > * Some internal zones don't have room allocated for the per cpu > * caches. If we're internal, bail out here. > */ > if (keg->uk_flags & UMA_ZFLAG_INTERNAL) { > - KASSERT((keg->uk_flags & UMA_ZONE_SECONDARY) == 0, > + KASSERT((zone->uz_flags & UMA_ZONE_SECONDARY) == 0, > ("Secondary zone requested UMA_ZFLAG_INTERNAL")); > return (0); > } > @@ -1413,18 +1480,17 @@ keg_dtor(void *arg, int size, void *udat > uma_keg_t keg; > > keg = (uma_keg_t)arg; > - mtx_lock(&keg->uk_lock); > + KEG_LOCK(keg); > if (keg->uk_free != 0) { > printf("Freed UMA keg was not empty (%d items). " > " Lost %d pages of memory.\n", > keg->uk_free, keg->uk_pages); > } > - mtx_unlock(&keg->uk_lock); > + KEG_UNLOCK(keg); > > - if (keg->uk_flags & UMA_ZONE_HASH) > - hash_free(&keg->uk_hash); > + hash_free(&keg->uk_hash); > > - mtx_destroy(&keg->uk_lock); > + KEG_LOCK_FINI(keg); > } > > /* > @@ -1436,38 +1502,46 @@ keg_dtor(void *arg, int size, void *udat > static void > zone_dtor(void *arg, int size, void *udata) > { > + uma_klink_t klink; > uma_zone_t zone; > uma_keg_t keg; > > zone = (uma_zone_t)arg; > - keg = zone->uz_keg; > + keg = zone_first_keg(zone); > > - if (!(keg->uk_flags & UMA_ZFLAG_INTERNAL)) > + if (!(zone->uz_flags & UMA_ZFLAG_INTERNAL)) > cache_drain(zone); > > mtx_lock(&uma_mtx); > - zone_drain(zone); > - if (keg->uk_flags & UMA_ZONE_SECONDARY) { > - LIST_REMOVE(zone, uz_link); > - /* > - * XXX there are some races here where > - * the zone can be drained but zone lock > - * released and then refilled before we > - * remove it... we dont care for now > - */ > - ZONE_LOCK(zone); > - if (LIST_EMPTY(&keg->uk_zones)) > - keg->uk_flags &= ~UMA_ZONE_SECONDARY; > - ZONE_UNLOCK(zone); > - mtx_unlock(&uma_mtx); > - } else { > + LIST_REMOVE(zone, uz_link); > + mtx_unlock(&uma_mtx); > + /* > + * XXX there are some races here where > + * the zone can be drained but zone lock > + * released and then refilled before we > + * remove it... we dont care for now > + */ > + zone_drain_wait(zone, M_WAITOK); > + /* > + * Unlink all of our kegs. > + */ > + while ((klink = LIST_FIRST(&zone->uz_kegs)) != NULL) { > + klink->kl_keg = NULL; > + LIST_REMOVE(klink, kl_link); > + if (klink == &zone->uz_klink) > + continue; > + free(klink, M_TEMP); > + } > + /* > + * We only destroy kegs from non secondary zones. > + */ > + if ((zone->uz_flags & UMA_ZONE_SECONDARY) == 0) { > + mtx_lock(&uma_mtx); > LIST_REMOVE(keg, uk_link); > - LIST_REMOVE(zone, uz_link); > mtx_unlock(&uma_mtx); > - uma_zfree_internal(kegs, keg, NULL, SKIP_NONE, > + zone_free_item(kegs, keg, NULL, SKIP_NONE, > ZFREE_STATFREE); > } > - zone->uz_keg = NULL; > } > > /* > @@ -1517,7 +1591,7 @@ uma_startup(void *bootmem, int boot_page > * (UMA_MAX_WASTE). > * > * We iterate until we find an object size for > - * which the calculated wastage in zone_small_init() will be > + * which the calculated wastage in keg_small_init() will be > * enough to warrant OFFPAGE. Since wastedspace versus objsize > * is an overall increasing see-saw function, we find the smallest > * objsize such that the wastage is always acceptable for objects > @@ -1525,7 +1599,7 @@ uma_startup(void *bootmem, int boot_page > * generates a larger possible uma_max_ipers, we use this computed > * objsize to calculate the largest ipers possible. Since the > * ipers calculated for OFFPAGE slab headers is always larger than > - * the ipers initially calculated in zone_small_init(), we use > + * the ipers initially calculated in keg_small_init(), we use > * the former's equation (UMA_SLAB_SIZE / keg->uk_rsize) to > * obtain the maximum ipers possible for offpage slab headers. > * > @@ -1557,7 +1631,7 @@ uma_startup(void *bootmem, int boot_page > } > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 09:17:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77FEC106566C; Sun, 25 Jan 2009 09:17:16 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 66DC68FC0A; Sun, 25 Jan 2009 09:17:16 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0P9HGpO011829; Sun, 25 Jan 2009 09:17:16 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0P9HGsq011828; Sun, 25 Jan 2009 09:17:16 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200901250917.n0P9HGsq011828@svn.freebsd.org> From: Jeff Roberson Date: Sun, 25 Jan 2009 09:17:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187682 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 09:17:16 -0000 Author: jeff Date: Sun Jan 25 09:17:16 2009 New Revision: 187682 URL: http://svn.freebsd.org/changeset/base/187682 Log: - Correct a typo in a comment. Noticed by: danger Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Sun Jan 25 09:11:24 2009 (r187681) +++ head/sys/kern/sys_generic.c Sun Jan 25 09:17:16 2009 (r187682) @@ -888,7 +888,7 @@ done: } /* * Convert a select bit set to poll flags. - # + * * The backend always returns POLLHUP/POLLERR if appropriate and we * return this as a set bit in any set. */ From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 09:20:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68B891065690; Sun, 25 Jan 2009 09:20:59 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 570A08FC29; Sun, 25 Jan 2009 09:20:59 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0P9KxeO011926; Sun, 25 Jan 2009 09:20:59 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0P9Kxco011925; Sun, 25 Jan 2009 09:20:59 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200901250920.n0P9Kxco011925@svn.freebsd.org> From: Ed Schouten Date: Sun, 25 Jan 2009 09:20:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187683 - head/sys/dev/speaker X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 09:21:00 -0000 Author: ed Date: Sun Jan 25 09:20:59 2009 New Revision: 187683 URL: http://svn.freebsd.org/changeset/base/187683 Log: Remove unneeded checks of device unit number from speaker(4). Calls on the cdev can only be made on existing devices. This means we don't have to check the value of dev2unit(). Modified: head/sys/dev/speaker/spkr.c Modified: head/sys/dev/speaker/spkr.c ============================================================================== --- head/sys/dev/speaker/spkr.c Sun Jan 25 09:17:16 2009 (r187682) +++ head/sys/dev/speaker/spkr.c Sun Jan 25 09:20:59 2009 (r187683) @@ -419,9 +419,7 @@ spkropen(dev, flags, fmt, td) (void) printf("spkropen: entering with dev = %s\n", devtoname(dev)); #endif /* DEBUG */ - if (dev2unit(dev) != 0) - return(ENXIO); - else if (spkr_active) + if (spkr_active) return(EBUSY); else { #ifdef DEBUG @@ -444,9 +442,8 @@ spkrwrite(dev, uio, ioflag) printf("spkrwrite: entering with dev = %s, count = %d\n", devtoname(dev), uio->uio_resid); #endif /* DEBUG */ - if (dev2unit(dev) != 0) - return(ENXIO); - else if (uio->uio_resid > (DEV_BSIZE - 1)) /* prevent system crashes */ + + if (uio->uio_resid > (DEV_BSIZE - 1)) /* prevent system crashes */ return(E2BIG); else { unsigned n; @@ -475,15 +472,11 @@ spkrclose(dev, flags, fmt, td) (void) printf("spkrclose: entering with dev = %s\n", devtoname(dev)); #endif /* DEBUG */ - if (dev2unit(dev) != 0) - return(ENXIO); - else { - wakeup(&endtone); - wakeup(&endrest); - free(spkr_inbuf, M_SPKR); - spkr_active = FALSE; - return(0); - } + wakeup(&endtone); + wakeup(&endrest); + free(spkr_inbuf, M_SPKR); + spkr_active = FALSE; + return(0); } static int @@ -499,9 +492,7 @@ spkrioctl(dev, cmd, cmdarg, flags, td) devtoname(dev), cmd); #endif /* DEBUG */ - if (dev2unit(dev) != 0) - return(ENXIO); - else if (cmd == SPKRTONE) { + if (cmd == SPKRTONE) { tone_t *tp = (tone_t *)cmdarg; if (tp->frequency == 0) From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 10:11:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB528106564A; Sun, 25 Jan 2009 10:11:58 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C89B88FC14; Sun, 25 Jan 2009 10:11:58 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0PABw86012948; Sun, 25 Jan 2009 10:11:58 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0PABwxl012942; Sun, 25 Jan 2009 10:11:58 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200901251011.n0PABwxl012942@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 25 Jan 2009 10:11:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187684 - in head/sys: kern net netinet netinet6 sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 10:11:59 -0000 Author: bz Date: Sun Jan 25 10:11:58 2009 New Revision: 187684 URL: http://svn.freebsd.org/changeset/base/187684 Log: For consistency with prison_{local,remote,check}_ipN rename prison_getipN to prison_get_ipN. Submitted by: jamie (as part of a larger patch) MFC after: 1 week Modified: head/sys/kern/kern_jail.c head/sys/net/rtsock.c head/sys/netinet/in_pcb.c head/sys/netinet/raw_ip.c head/sys/netinet6/raw_ip6.c head/sys/sys/jail.h Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Sun Jan 25 09:20:59 2009 (r187683) +++ head/sys/kern/kern_jail.c Sun Jan 25 10:11:58 2009 (r187684) @@ -812,7 +812,7 @@ prison_proc_free(struct prison *pr) * Returns 0 on success, 1 on error. Address returned in NBO. */ int -prison_getip4(struct ucred *cred, struct in_addr *ia) +prison_get_ip4(struct ucred *cred, struct in_addr *ia) { KASSERT(cred != NULL, ("%s: cred is NULL", __func__)); @@ -958,7 +958,7 @@ prison_check_ip4(struct ucred *cred, str * Returns 0 on success, 1 on error. */ int -prison_getip6(struct ucred *cred, struct in6_addr *ia6) +prison_get_ip6(struct ucred *cred, struct in6_addr *ia6) { KASSERT(cred != NULL, ("%s: cred is NULL", __func__)); Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Sun Jan 25 09:20:59 2009 (r187683) +++ head/sys/net/rtsock.c Sun Jan 25 10:11:58 2009 (r187684) @@ -376,7 +376,7 @@ rtm_get_jailed(struct rt_addrinfo *info, * 3. As a last resort return the 'default' * jail address. */ - if (prison_getip4(cred, &ia) != 0) + if (prison_get_ip4(cred, &ia) != 0) return (ESRCH); } bzero(&saun->sin, sizeof(struct sockaddr_in)); @@ -428,7 +428,7 @@ rtm_get_jailed(struct rt_addrinfo *info, * 3. As a last resort return the 'default' * jail address. */ - if (prison_getip6(cred, &ia6) != 0) + if (prison_get_ip6(cred, &ia6) != 0) return (ESRCH); } bzero(&saun->sin6, sizeof(struct sockaddr_in6)); Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Sun Jan 25 09:20:59 2009 (r187683) +++ head/sys/netinet/in_pcb.c Sun Jan 25 10:11:58 2009 (r187684) @@ -625,7 +625,7 @@ in_pcbladdr(struct inpcb *inp, struct in } /* 3. As a last resort return the 'default' jail address. */ - if (prison_getip4(cred, laddr) != 0) + if (prison_get_ip4(cred, laddr) != 0) error = EADDRNOTAVAIL; goto done; } @@ -678,7 +678,7 @@ in_pcbladdr(struct inpcb *inp, struct in } /* 3. As a last resort return the 'default' jail address. */ - if (prison_getip4(cred, laddr) != 0) + if (prison_get_ip4(cred, laddr) != 0) error = EADDRNOTAVAIL; goto done; } @@ -741,7 +741,7 @@ in_pcbladdr(struct inpcb *inp, struct in } /* 3. As a last resort return the 'default' jail address. */ - if (prison_getip4(cred, laddr) != 0) + if (prison_get_ip4(cred, laddr) != 0) error = EADDRNOTAVAIL; goto done; } @@ -810,7 +810,7 @@ in_pcbconnect_setup(struct inpcb *inp, s */ if (faddr.s_addr == INADDR_ANY) { if (cred != NULL && jailed(cred)) { - if (prison_getip4(cred, &jailia) != 0) + if (prison_get_ip4(cred, &jailia) != 0) return (EADDRNOTAVAIL); faddr.s_addr = jailia.s_addr; } else { Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Sun Jan 25 09:20:59 2009 (r187683) +++ head/sys/netinet/raw_ip.c Sun Jan 25 10:11:58 2009 (r187684) @@ -371,7 +371,7 @@ rip_output(struct mbuf *m, struct socket ip->ip_p = inp->inp_ip_p; ip->ip_len = m->m_pkthdr.len; if (jailed(inp->inp_cred)) { - if (prison_getip4(inp->inp_cred, &ip->ip_src)) { + if (prison_get_ip4(inp->inp_cred, &ip->ip_src) != 0) { INP_RUNLOCK(inp); m_freem(m); return (EPERM); Modified: head/sys/netinet6/raw_ip6.c ============================================================================== --- head/sys/netinet6/raw_ip6.c Sun Jan 25 09:20:59 2009 (r187683) +++ head/sys/netinet6/raw_ip6.c Sun Jan 25 10:11:58 2009 (r187684) @@ -412,7 +412,7 @@ rip6_output(m, va_alist) goto bad; } if (jailed(in6p->inp_cred)) - if (prison_getip6(in6p->inp_cred, in6a) != 0) { + if (prison_get_ip6(in6p->inp_cred, in6a) != 0) { error = EPERM; goto bad; } Modified: head/sys/sys/jail.h ============================================================================== --- head/sys/sys/jail.h Sun Jan 25 09:20:59 2009 (r187683) +++ head/sys/sys/jail.h Sun Jan 25 10:11:58 2009 (r187684) @@ -181,12 +181,12 @@ void prison_hold(struct prison *pr); void prison_hold_locked(struct prison *pr); void prison_proc_hold(struct prison *); void prison_proc_free(struct prison *); -int prison_getip4(struct ucred *cred, struct in_addr *ia); +int prison_get_ip4(struct ucred *cred, struct in_addr *ia); int prison_local_ip4(struct ucred *cred, struct in_addr *ia); int prison_remote_ip4(struct ucred *cred, struct in_addr *ia); int prison_check_ip4(struct ucred *cred, struct in_addr *ia); #ifdef INET6 -int prison_getip6(struct ucred *, struct in6_addr *); +int prison_get_ip6(struct ucred *, struct in6_addr *); int prison_local_ip6(struct ucred *, struct in6_addr *, int); int prison_remote_ip6(struct ucred *, struct in6_addr *); int prison_check_ip6(struct ucred *, struct in6_addr *); From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 10:31:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 373A81065686; Sun, 25 Jan 2009 10:31:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 25D3F8FC08; Sun, 25 Jan 2009 10:31:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0PAVkvd013312; Sun, 25 Jan 2009 10:31:46 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0PAVk9I013311; Sun, 25 Jan 2009 10:31:46 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200901251031.n0PAVk9I013311@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 25 Jan 2009 10:31:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187685 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 10:31:46 -0000 Author: bz Date: Sun Jan 25 10:31:45 2009 New Revision: 187685 URL: http://svn.freebsd.org/changeset/base/187685 Log: Instead of killing the 'watchdog' subshell and leaving a sleep for rcshutdown_timeout (normally 30s) around re-parented to init, make sure both go away using pkill -P. While noone normally notices this for the system shutdown, it helps for cleanly shutting down trusted jails. Found without a killall in the base system, which in rc.d/jail normally ensures that all processes of a jail to be stopped will be killed. Reviewed by: silence on current@ MFC after: 4 weeks Modified: head/etc/rc.shutdown Modified: head/etc/rc.shutdown ============================================================================== --- head/etc/rc.shutdown Sun Jan 25 10:11:58 2009 (r187684) +++ head/etc/rc.shutdown Sun Jan 25 10:31:45 2009 (r187685) @@ -98,7 +98,7 @@ done # Terminate the background watchdog timer (if it is running) # if [ -n "$_rcshutdown_watchdog" ]; then - kill -TERM $_rcshutdown_watchdog >/dev/null 2>&1 + pkill -TERM -P $_rcshutdown_watchdog >/dev/null 2>&1 fi # Insert other shutdown procedures here From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 12:07:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DC8710656E9; Sun, 25 Jan 2009 12:07:43 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59C0B8FC31; Sun, 25 Jan 2009 12:07:43 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0PC7hVh017338; Sun, 25 Jan 2009 12:07:43 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0PC7hf1017337; Sun, 25 Jan 2009 12:07:43 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200901251207.n0PC7hf1017337@svn.freebsd.org> From: Robert Watson Date: Sun, 25 Jan 2009 12:07:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187686 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 12:07:45 -0000 Author: rwatson Date: Sun Jan 25 12:07:43 2009 New Revision: 187686 URL: http://svn.freebsd.org/changeset/base/187686 Log: 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. MFC after: 3 weeks Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Sun Jan 25 10:31:45 2009 (r187685) +++ head/sys/kern/imgact_elf.c Sun Jan 25 12:07:43 2009 (r187686) @@ -822,7 +822,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 owner-svn-src-head@FreeBSD.ORG Sun Jan 25 14:00:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00D9A106564A; Sun, 25 Jan 2009 14:00:00 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE5828FC18; Sun, 25 Jan 2009 14:00:00 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0PE00Hb019393; Sun, 25 Jan 2009 14:00:00 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0PE00SF019391; Sun, 25 Jan 2009 14:00:00 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200901251400.n0PE00SF019391@svn.freebsd.org> From: Ed Schouten Date: Sun, 25 Jan 2009 14:00:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187687 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 14:00:01 -0000 Author: ed Date: Sun Jan 25 14:00:00 2009 New Revision: 187687 URL: http://svn.freebsd.org/changeset/base/187687 Log: Remove unneeded checking for invalid minor numbers from pf(4). Because it is not possible to access the pf(4) character device through any other device node as the one in devfs, there is no need to check for unknown device minor numbers. Approved by: mlaier Modified: head/sys/contrib/pf/net/pf_ioctl.c Modified: head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- head/sys/contrib/pf/net/pf_ioctl.c Sun Jan 25 12:07:43 2009 (r187686) +++ head/sys/contrib/pf/net/pf_ioctl.c Sun Jan 25 14:00:00 2009 (r187687) @@ -481,16 +481,12 @@ pf_thread_create(void *v) int pfopen(struct cdev *dev, int flags, int fmt, struct proc *p) { - if (dev2unit(dev) >= 1) - return (ENXIO); return (0); } int pfclose(struct cdev *dev, int flags, int fmt, struct proc *p) { - if (dev2unit(dev) >= 1) - return (ENXIO); return (0); } #endif /* __FreeBSD__ */ From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 14:39:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A7DB1065672; Sun, 25 Jan 2009 14:39:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 285628FC0A; Sun, 25 Jan 2009 14:39:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0PEdG4q020153; Sun, 25 Jan 2009 14:39:16 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0PEdGjg020152; Sun, 25 Jan 2009 14:39:16 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200901251439.n0PEdGjg020152@svn.freebsd.org> From: Ed Schouten Date: Sun, 25 Jan 2009 14:39:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187688 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 14:39:17 -0000 Author: ed Date: Sun Jan 25 14:39:15 2009 New Revision: 187688 URL: http://svn.freebsd.org/changeset/base/187688 Log: Remove pfopen() and pfclose() entirely. It turns out I was patching functions that weren't used by pf(4) anyway. They still seem to use `struct proc *' instead of `struct thread *'. They weren't listed in pf_cdevsw. Modified: head/sys/contrib/pf/net/pf_ioctl.c Modified: head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- head/sys/contrib/pf/net/pf_ioctl.c Sun Jan 25 14:00:00 2009 (r187687) +++ head/sys/contrib/pf/net/pf_ioctl.c Sun Jan 25 14:39:15 2009 (r187688) @@ -477,18 +477,6 @@ pf_thread_create(void *v) if (kproc_create(pf_purge_thread, NULL, NULL, "pfpurge")) panic("pfpurge thread"); } - -int -pfopen(struct cdev *dev, int flags, int fmt, struct proc *p) -{ - return (0); -} - -int -pfclose(struct cdev *dev, int flags, int fmt, struct proc *p) -{ - return (0); -} #endif /* __FreeBSD__ */ struct pf_pool * From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 16:21:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 328D7106567A; Sun, 25 Jan 2009 16:21:25 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id AC8D58FC20; Sun, 25 Jan 2009 16:21:24 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id B1D961CE4F; Sun, 25 Jan 2009 17:21:23 +0100 (CET) Date: Sun, 25 Jan 2009 17:21:23 +0100 From: Ed Schouten To: Tom Rhodes Message-ID: <20090125162123.GB17198@hoeg.nl> References: <200901230058.n0N0wEjY026935@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8P1HSweYDcXXzwPJ" Content-Disposition: inline In-Reply-To: <200901230058.n0N0wEjY026935@svn.freebsd.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187607 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 16:21:30 -0000 --8P1HSweYDcXXzwPJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Tom, * Tom Rhodes wrote: > Author: trhodes > Date: Fri Jan 23 00:58:14 2009 > New Revision: 187607 > URL: http://svn.freebsd.org/changeset/base/187607 >=20 > Log: > Attaching to the init process returns EINVAL, > so give an example that is more likely to work. > Stolen from the ktrace(1) manual page. > =20 > PR: 128222 > Submitted by: Mateusz Guzik >=20 > Modified: > head/usr.bin/truss/truss.1 Isn't that a bug in ptrace(2), instead of a documentation bug? --=20 Ed Schouten WWW: http://80386.nl/ --8P1HSweYDcXXzwPJ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkl8kYMACgkQ52SDGA2eCwVO+QCePOqn2z55gJBxnpgT585CY3Nt 0n0Anj8Bvrl0Ww43Wbcu7b+OBV8JYdeG =dz1u -----END PGP SIGNATURE----- --8P1HSweYDcXXzwPJ-- From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 16:52:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 921691065670; Sun, 25 Jan 2009 16:52:41 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 808E18FC12; Sun, 25 Jan 2009 16:52:41 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0PGqfxm022640; Sun, 25 Jan 2009 16:52:41 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0PGqft9022639; Sun, 25 Jan 2009 16:52:41 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200901251652.n0PGqft9022639@svn.freebsd.org> From: Ed Schouten Date: Sun, 25 Jan 2009 16:52:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187689 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 16:52:42 -0000 Author: ed Date: Sun Jan 25 16:52:41 2009 New Revision: 187689 URL: http://svn.freebsd.org/changeset/base/187689 Log: Revert my previous two changes. Even though the code seems to be FreeBSD kernel code, it isn't compiled on FreeBSD. I could have known this, because I was a little amazed that I couldn't find a prototype of pfopen()/pfclose() somewhere else, because it isn't marked as static. Apart from that, removing these functions wouldn't have been harmful anyway, because there are some other strange things about them (the implementation isn't consistent with the prototype at the top). Still, it's better to leave it, because it makes merging code back to older branches a little harder. Requested by: mlaier Modified: head/sys/contrib/pf/net/pf_ioctl.c Modified: head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- head/sys/contrib/pf/net/pf_ioctl.c Sun Jan 25 14:39:15 2009 (r187688) +++ head/sys/contrib/pf/net/pf_ioctl.c Sun Jan 25 16:52:41 2009 (r187689) @@ -477,6 +477,22 @@ pf_thread_create(void *v) if (kproc_create(pf_purge_thread, NULL, NULL, "pfpurge")) panic("pfpurge thread"); } + +int +pfopen(struct cdev *dev, int flags, int fmt, struct proc *p) +{ + if (dev2unit(dev) >= 1) + return (ENXIO); + return (0); +} + +int +pfclose(struct cdev *dev, int flags, int fmt, struct proc *p) +{ + if (dev2unit(dev) >= 1) + return (ENXIO); + return (0); +} #endif /* __FreeBSD__ */ struct pf_pool * From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 17:41:35 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 083A5106566B; Sun, 25 Jan 2009 17:41:35 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id 951B58FC0C; Sun, 25 Jan 2009 17:41:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-120-227.carlnfd1.nsw.optusnet.com.au (c122-107-120-227.carlnfd1.nsw.optusnet.com.au [122.107.120.227]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n0PHf2jd028721 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 26 Jan 2009 04:41:04 +1100 Date: Mon, 26 Jan 2009 04:41:02 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Ed Schouten In-Reply-To: <20090125162123.GB17198@hoeg.nl> Message-ID: <20090126041926.J43097@delplex.bde.org> References: <200901230058.n0N0wEjY026935@svn.freebsd.org> <20090125162123.GB17198@hoeg.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, Tom Rhodes , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r187607 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 17:41:35 -0000 On Sun, 25 Jan 2009, Ed Schouten wrote: > Hello Tom, > > * Tom Rhodes wrote: >> Author: trhodes >> Date: Fri Jan 23 00:58:14 2009 >> New Revision: 187607 >> URL: http://svn.freebsd.org/changeset/base/187607 >> >> Log: >> Attaching to the init process returns EINVAL, >> so give an example that is more likely to work. >> Stolen from the ktrace(1) manual page. >> >> PR: 128222 >> Submitted by: Mateusz Guzik >> >> Modified: >> head/usr.bin/truss/truss.1 > > Isn't that a bug in ptrace(2), instead of a documentation bug? I think it is the longstanding kernel bug in permissions checking generally, that the init process and some other non-kernel processes are bogusly marked as P_SYSTEM. I use the following fix (this may be incomplete): % Index: init_main.c % =================================================================== % RCS file: /home/ncvs/src/sys/kern/init_main.c,v % retrieving revision 1.243 % diff -u -2 -r1.243 init_main.c % --- init_main.c 16 Jun 2004 00:26:29 -0000 1.243 % +++ init_main.c 16 Jun 2004 05:56:22 -0000 % @@ -697,8 +686,8 @@ % panic("cannot fork init: %d\n", error); % KASSERT(initproc->p_pid == 1, ("create_init: initproc->p_pid != 1")); % - /* divorce init's credentials from the kernel's */ % + % + /* Divorce init's credentials from the kernel's. */ % newcred = crget(); % PROC_LOCK(initproc); % - initproc->p_flag |= P_SYSTEM; % oldcred = initproc->p_ucred; % crcopy(newcred, oldcred); % @@ -710,7 +699,5 @@ % crfree(oldcred); % cred_update_thread(FIRST_THREAD_IN_PROC(initproc)); % - mtx_lock_spin(&sched_lock); % - initproc->p_sflag |= PS_INMEM; % - mtx_unlock_spin(&sched_lock); % + % cpu_set_fork_handler(FIRST_THREAD_IN_PROC(initproc), start_init, NULL); % } % Index: kern_sig.c % =================================================================== % RCS file: /home/ncvs/src/sys/kern/kern_sig.c,v % retrieving revision 1.281 % diff -u -2 -r1.281 kern_sig.c % --- kern_sig.c 11 Jun 2004 11:16:23 -0000 1.281 % +++ kern_sig.c 15 Feb 2005 08:40:46 -0000 % @@ -1312,5 +1307,5 @@ % LIST_FOREACH(p, &allproc, p_list) { % PROC_LOCK(p); % - if (p->p_pid <= 1 || p->p_flag & P_SYSTEM || % + if (p == initproc || p->p_flag & P_SYSTEM || % p == td->td_proc) { % PROC_UNLOCK(p); % @@ -1343,5 +1338,5 @@ % LIST_FOREACH(p, &pgrp->pg_members, p_pglist) { % PROC_LOCK(p); % - if (p->p_pid <= 1 || p->p_flag & P_SYSTEM) { % + if (p == initproc || p->p_flag & P_SYSTEM) { % PROC_UNLOCK(p); % continue; % @@ -2127,5 +2170,5 @@ % * Don't take default actions on system processes. % */ % - if (p->p_pid <= 1) { % + if (p == initproc || p->p_flag & P_SYSTEM) { % #ifdef DIAGNOSTIC % /* % Index: vm_pageout.c % =================================================================== % RCS file: /home/ncvs/src/sys/vm/vm_pageout.c,v % retrieving revision 1.258 % diff -u -2 -r1.258 vm_pageout.c % --- vm_pageout.c 24 Jun 2004 04:08:43 -0000 1.258 % +++ vm_pageout.c 10 Nov 2007 10:22:50 -0000 % @@ -1168,6 +1174,7 @@ % /* % * If this is a system or protected process, skip it. % + * XXX style bugs, bogus 48. % */ % - if ((p->p_flag & P_SYSTEM) || (p->p_pid == 1) || % + if ((p->p_flag & P_SYSTEM) || (p == initproc) || % (p->p_flag & P_PROTECTED) || % ((p->p_pid < 48) && (swap_pager_avail != 0))) { In kern_sig.c, this is partly just a style fix, since init was already not assumed to be P_SYSTEM, but in the last hunk in kern_sig.c it changes the code to match the comment, which might give stricter permissions checking. ktrace works with this fix: % Script started on Mon Jan 26 04:29:36 2009 % ttyv1:root@besplex:/tmp/q> ktrace -p 1 % ttyv1:root@besplex:/tmp/q> kdump % ttyv1:root@besplex:/tmp/q> kdump % ttyv1:root@besplex:/tmp/q> kdump % ttyv1:root@besplex:/tmp/q> kdump # after a logout % 1 init RET wait4 645/0x285 % 1 init CALL open(0x80a475b,0x2,0) % 1 init NAMI "/var/run/utmp" % 1 init RET open 0 % ... % 1 init CALL fork % 1 init RET fork 1987/0x7c3 % 1 init CALL gettimeofday(0xbfbfedc8,0) % 1 init RET gettimeofday 0 % 1 init CALL wait4(0xffffffff,0,0,0) % ttyv1:root@besplex:/tmp/q> exit % % Script done on Mon Jan 26 04:30:37 2009 Bruce From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 17:50:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CE07106566B; Sun, 25 Jan 2009 17:50:53 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8AC148FC22; Sun, 25 Jan 2009 17:50:53 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0PHorU3023772; Sun, 25 Jan 2009 17:50:53 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0PHorku023771; Sun, 25 Jan 2009 17:50:53 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200901251750.n0PHorku023771@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 25 Jan 2009 17:50:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187691 - head/sys/powerpc/powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 17:50:55 -0000 Author: nwhitehorn Date: Sun Jan 25 17:50:53 2009 New Revision: 187691 URL: http://svn.freebsd.org/changeset/base/187691 Log: Fix a race condition where interrupts set up after boot could be enabled in the PIC before the interrupt handler was set. If the interrupt triggered in that window, then the interrupt vector would be disabled. Reported by: Marco Trillo Modified: head/sys/powerpc/powerpc/intr_machdep.c Modified: head/sys/powerpc/powerpc/intr_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/intr_machdep.c Sun Jan 25 16:59:29 2009 (r187690) +++ head/sys/powerpc/powerpc/intr_machdep.c Sun Jan 25 17:50:53 2009 (r187691) @@ -243,7 +243,7 @@ powerpc_setup_intr(const char *name, u_i driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep) { struct powerpc_intr *i; - int error; + int error, enable = 0; i = intr_lookup(irq); if (i == NULL) @@ -258,13 +258,16 @@ powerpc_setup_intr(const char *name, u_i i->cntp = &intrcnt[i->vector]; - if (!cold) - PIC_ENABLE(pic, i->irq, i->vector); + enable = 1; } error = intr_event_add_handler(i->event, name, filter, handler, arg, intr_priority(flags), flags, cookiep); intrcnt_setname(i->event->ie_fullname, i->vector); + + if (!cold && enable) + PIC_ENABLE(pic, i->irq, i->vector); + return (error); } From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 17:57:53 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA5691065672; Sun, 25 Jan 2009 17:57:53 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 53E888FC08; Sun, 25 Jan 2009 17:57:53 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 0E9CA1CE4F; Sun, 25 Jan 2009 18:57:52 +0100 (CET) Date: Sun, 25 Jan 2009 18:57:51 +0100 From: Ed Schouten To: Bruce Evans Message-ID: <20090125175751.GC17198@hoeg.nl> References: <200901230058.n0N0wEjY026935@svn.freebsd.org> <20090125162123.GB17198@hoeg.nl> <20090126041926.J43097@delplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UPT3ojh+0CqEDtpF" Content-Disposition: inline In-Reply-To: <20090126041926.J43097@delplex.bde.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@FreeBSD.org, Tom Rhodes , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r187607 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 17:57:54 -0000 --UPT3ojh+0CqEDtpF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Bruce, * Bruce Evans wrote: > I think it is the longstanding kernel bug in permissions checking > generally, that the init process and some other non-kernel processes > are bogusly marked as P_SYSTEM. I use the following fix (this may > be incomplete): > > I just looked at the patch and it seems to do the right thing. I can't seem to find any places in the kernel where it makes sense to let init(8) use P_SYSTEM (except kern_sig.c ofcourse). I like the cleanups you made, especially the comparisons with initproc instead of using the pid. Would you mind if I commit your patch to SVN? --=20 Ed Schouten WWW: http://80386.nl/ --UPT3ojh+0CqEDtpF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkl8qB8ACgkQ52SDGA2eCwUhBACfUgola4AdF0BACbL9OUKhDYc8 b3UAn0rnR6iwO9JT66/Qhim+DbfDiLEg =Y7SU -----END PGP SIGNATURE----- --UPT3ojh+0CqEDtpF-- From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 18:20:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E5041065673; Sun, 25 Jan 2009 18:20:15 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8791E8FC21; Sun, 25 Jan 2009 18:20:15 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0PIKFmp024360; Sun, 25 Jan 2009 18:20:15 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0PIKF0G024352; Sun, 25 Jan 2009 18:20:15 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200901251820.n0PIKF0G024352@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 25 Jan 2009 18:20:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187692 - in head: share/man/man4/man4.powerpc sys/conf sys/dev/sound/macio sys/modules/sound/driver sys/modules/sound/driver/ai2s sys/modules/sound/driver/davbus sys/powerpc/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 18:20:16 -0000 Author: nwhitehorn Date: Sun Jan 25 18:20:15 2009 New Revision: 187692 URL: http://svn.freebsd.org/changeset/base/187692 Log: Add support for the I2S and davbus audio controllers found in Apple PowerPC hardware. Submitted by: Marco Trillo Added: head/share/man/man4/man4.powerpc/snd_ai2s.4 (contents, props changed) head/share/man/man4/man4.powerpc/snd_davbus.4 (contents, props changed) head/sys/dev/sound/macio/ head/sys/dev/sound/macio/aoa.c (contents, props changed) head/sys/dev/sound/macio/aoa.h (contents, props changed) head/sys/dev/sound/macio/davbus.c (contents, props changed) head/sys/dev/sound/macio/davbusreg.h (contents, props changed) head/sys/dev/sound/macio/i2s.c (contents, props changed) head/sys/dev/sound/macio/snapper.c (contents, props changed) head/sys/dev/sound/macio/tumbler.c (contents, props changed) head/sys/modules/sound/driver/ai2s/ head/sys/modules/sound/driver/ai2s/Makefile (contents, props changed) head/sys/modules/sound/driver/davbus/ head/sys/modules/sound/driver/davbus/Makefile (contents, props changed) Modified: head/share/man/man4/man4.powerpc/Makefile head/sys/conf/files.powerpc head/sys/modules/sound/driver/Makefile head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/NOTES Modified: head/share/man/man4/man4.powerpc/Makefile ============================================================================== --- head/share/man/man4/man4.powerpc/Makefile Sun Jan 25 17:50:53 2009 (r187691) +++ head/share/man/man4/man4.powerpc/Makefile Sun Jan 25 18:20:15 2009 (r187692) @@ -2,7 +2,9 @@ MAN= bm.4 \ pmu.4 \ - powermac_nvram.4 + powermac_nvram.4 \ + snd_ai2s.4 \ + snd_davbus MANSUBDIR=/powerpc Added: head/share/man/man4/man4.powerpc/snd_ai2s.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/man4.powerpc/snd_ai2s.4 Sun Jan 25 18:20:15 2009 (r187692) @@ -0,0 +1,90 @@ +.\"- +.\" Copyright (c) 2009 Nathan Whitehorn +.\" 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 ``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$ +.\" +.Dd January 20, 2009 +.Dt SND_AI2S 4 +.Os +.Sh NAME +.Nm snd_ai2s +.Nd "Apple I2S audio device driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device sound" +.Cd "device snd_ai2s" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +snd_ai2s_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the Apple I2S audio controllers found +predominantly in G4 and G5 machines, along with the snapper and tumbler +codecs. Some machines (e.g. the Mac Mini) do not have configurable +codecs and so lack hardware volume control. +.Sh HARDWARE +.Pp +Chips supported by the +.Nm +driver include: +.Pp +.Bl -bullet -compact +.It +Apple Tumbler Audio +.It +Apple Snapper Audio +.El +.Pp +.Sh BUGS +Recording and operation with non-44.1 Khz audio are not currently supported. +.Sh SEE ALSO +.Xr sound 4 , +.Xr snd_davbus 4 +.Sh HISTORY +The +.Nm +device driver appeared in +.Nx 2.0 +and then in +.Fx 8.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Tsubai Masanari +.Aq tsubai@netbsd.org , +and ported to FreeBSD by +.An Marco Trillo +.Aq marcotrillo@gmail.com . Added: head/share/man/man4/man4.powerpc/snd_davbus.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/man4.powerpc/snd_davbus.4 Sun Jan 25 18:20:15 2009 (r187692) @@ -0,0 +1,83 @@ +.\"- +.\" Copyright (c) 2009 Nathan Whitehorn +.\" 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 ``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$ +.\" +.Dd January 20, 2009 +.Dt SND_DAVBUS 4 +.Os +.Sh NAME +.Nm snd_davbus +.Nd "Apple Davbus audio device driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device sound" +.Cd "device snd_davbus" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +snd_davbus_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the Apple Davbus audio controllers found in +many G3-era Apple machines. +.Sh HARDWARE +.Pp +Chips supported by the +.Nm +driver include: +.Pp +.Bl -bullet -compact +.It +Apple Burgundy Audio +.It +Apple Screamer Audio +.El +.Pp +.Sh BUGS +Recording is not currently supported. +.Sh SEE ALSO +.Xr sound 4 , +.Xr snd_ai2s 4 +.Sh HISTORY +The +.Nm +device driver appeared in +.Fx 8.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Marco Trillo +.Aq marcotrillo@gmail.com . Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sun Jan 25 17:50:53 2009 (r187691) +++ head/sys/conf/files.powerpc Sun Jan 25 18:20:15 2009 (r187692) @@ -39,6 +39,11 @@ dev/ofw/ofw_standard.c optional aim dev/powermac_nvram/powermac_nvram.c optional powermac_nvram powermac dev/quicc/quicc_bfe_ocp.c optional quicc mpc85xx dev/scc/scc_bfe_macio.c optional scc powermac +dev/sound/macio/aoa.c optional snd_davbus | snd_ai2s powermac +dev/sound/macio/davbus.c optional snd_davbus powermac +dev/sound/macio/i2s.c optional snd_ai2s powermac +dev/sound/macio/snapper.c optional snd_ai2s iicbus powermac +dev/sound/macio/tumbler.c optional snd_ai2s iicbus powermac dev/syscons/scgfbrndr.c optional sc dev/syscons/scterm-teken.c optional sc dev/syscons/scvtb.c optional sc Added: head/sys/dev/sound/macio/aoa.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/sound/macio/aoa.c Sun Jan 25 18:20:15 2009 (r187692) @@ -0,0 +1,379 @@ +/*- + * Copyright 2008 by Marco Trillo. 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 ``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$ + */ + +/* + * Apple Onboard Audio (AOA). + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mixer_if.h" + +struct aoa_dma { + struct mtx mutex; + struct resource *reg; /* DBDMA registers */ + dbdma_channel_t *channel; /* DBDMA channel */ + bus_dma_tag_t tag; /* bus_dma tag */ + struct pcm_channel *pcm; /* PCM channel */ + struct snd_dbuf *buf; /* PCM buffer */ + u_int slots; /* # of slots */ + u_int slot; /* current slot */ + u_int bufsz; /* buffer size */ + u_int blksz; /* block size */ + int running; +}; + +static void +aoa_dma_set_program(struct aoa_dma *dma) +{ + u_int32_t addr; + int i; + + addr = (u_int32_t) sndbuf_getbufaddr(dma->buf); + KASSERT(dma->bufsz == sndbuf_getsize(dma->buf), ("bad size")); + + dma->slots = dma->bufsz / dma->blksz; + + for (i = 0; i < dma->slots; ++i) { + dbdma_insert_command(dma->channel, + i, /* slot */ + DBDMA_OUTPUT_MORE, /* command */ + 0, /* stream */ + addr, /* data */ + dma->blksz, /* count */ + DBDMA_ALWAYS, /* interrupt */ + DBDMA_COND_TRUE, /* branch */ + DBDMA_NEVER, /* wait */ + dma->slots + 1 /* branch_slot */ + ); + + addr += dma->blksz; + } + + /* Branch back to beginning. */ + dbdma_insert_branch(dma->channel, dma->slots, 0); + + /* STOP command to branch when S0 is asserted. */ + dbdma_insert_stop(dma->channel, dma->slots + 1); + + /* Set S0 as the condition to branch to STOP. */ + dbdma_set_branch_selector(dma->channel, 1 << 0, 1 << 0); + dbdma_set_device_status(dma->channel, 1 << 0, 0); + + dbdma_sync_commands(dma->channel, BUS_DMASYNC_PREWRITE); +} + +#define AOA_BUFFER_SIZE 65536 + +static struct aoa_dma * +aoa_dma_create(device_t self) +{ + struct aoa_softc *sc = device_get_softc(self); + struct aoa_dma *dma; + bus_dma_tag_t tag; + int err; + + err = bus_dma_tag_create(bus_get_dma_tag(self), + 4, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + AOA_BUFFER_SIZE, 1, AOA_BUFFER_SIZE, 0, NULL, NULL, &tag); + if (err != 0) + return (NULL); + + dma = malloc(sizeof(*dma), M_DEVBUF, M_WAITOK | M_ZERO); + dma->tag = tag; + dma->bufsz = AOA_BUFFER_SIZE; + dma->blksz = PAGE_SIZE; /* initial blocksize */ + + mtx_init(&dma->mutex, "AOA", NULL, MTX_DEF); + + sc->sc_intrp = dma; + + return (dma); +} + +static void +aoa_dma_delete(struct aoa_dma *dma) +{ + bus_dma_tag_destroy(dma->tag); + mtx_destroy(&dma->mutex); + free(dma, M_DEVBUF); +} + +static int +aoa_chan_setblocksize(kobj_t obj, void *data, u_int32_t blocksz) +{ + struct aoa_dma *dma = data; + int err, lz; + + DPRINTF(("aoa_chan_setblocksize: blocksz = %u, dma->blksz = %u\n", + blocksz, dma->blksz)); + KASSERT(!dma->running, ("dma is running")); + KASSERT(blocksz > 0, ("bad blocksz")); + + /* Round blocksz down to a power of two... */ + __asm volatile ("cntlzw %0,%1" : "=r"(lz) : "r"(blocksz)); + blocksz = 1 << (31 - lz); + DPRINTF(("blocksz = %u\n", blocksz)); + + /* ...but no more than the buffer. */ + if (blocksz > dma->bufsz) + blocksz = dma->bufsz; + + err = sndbuf_resize(dma->buf, dma->bufsz / blocksz, blocksz); + if (err != 0) { + DPRINTF(("sndbuf_resize returned %d\n", err)); + return (0); + } + + if (blocksz == dma->blksz) + return (dma->blksz); + + /* One slot per block plus branch to 0 plus STOP. */ + err = dbdma_resize_channel(dma->channel, 2 + dma->bufsz / blocksz); + if (err != 0) { + DPRINTF(("dbdma_resize_channel returned %d\n", err)); + return (0); + } + + /* Set the new blocksize. */ + dma->blksz = blocksz; + aoa_dma_set_program(dma); + + return (dma->blksz); +} + +static int +aoa_chan_setformat(kobj_t obj, void *data, u_int32_t format) +{ + DPRINTF(("aoa_chan_setformat: format = %u\n", format)); + + if (format != (AFMT_STEREO | AFMT_S16_BE)) + return (EINVAL); + + return (0); +} + +static int +aoa_chan_setspeed(kobj_t obj, void *data, u_int32_t speed) +{ + DPRINTF(("aoa_chan_setspeed: speed = %u\n", speed)); + + return (44100); +} + +static int +aoa_chan_getptr(kobj_t obj, void *data) +{ + struct aoa_dma *dma = data; + + if (!dma->running) + return (0); + + return (dma->slot * dma->blksz); +} + +static void * +aoa_chan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, + struct pcm_channel *c, int dir) +{ + device_t self = devinfo; + struct aoa_softc *sc = device_get_softc(self); + struct aoa_dma *dma; + int max_slots, err; + + KASSERT(dir == PCMDIR_PLAY, ("bad dir")); + + dma = aoa_dma_create(self); + if (!dma) + return (NULL); + dma->pcm = c; + dma->buf = b; + dma->reg = sc->sc_odma; + + /* One slot per block, plus branch to 0 plus STOP. */ + max_slots = 2 + dma->bufsz / dma->blksz; + err = dbdma_allocate_channel(dma->reg, 0, bus_get_dma_tag(self), + max_slots, &dma->channel ); + if (err != 0) { + aoa_dma_delete(dma); + return (NULL); + } + + if (sndbuf_alloc(dma->buf, dma->tag, 0, dma->bufsz) != 0) { + dbdma_free_channel(dma->channel); + aoa_dma_delete(dma); + return (NULL); + } + + aoa_dma_set_program(dma); + + return (dma); +} + +static int +aoa_chan_trigger(kobj_t obj, void *data, int go) +{ + struct aoa_dma *dma = data; + int i; + + switch (go) { + case PCMTRIG_START: + + /* Start the DMA. */ + dma->running = 1; + + dma->slot = 0; + dbdma_set_current_cmd(dma->channel, dma->slot); + + dbdma_run(dma->channel); + + return (0); + + case PCMTRIG_STOP: + case PCMTRIG_ABORT: + + mtx_lock(&dma->mutex); + + dma->running = 0; + + /* Make it branch to the STOP command. */ + dbdma_set_device_status(dma->channel, 1 << 0, 1 << 0); + + /* XXX should wait for DBDMA_ACTIVE to clear. */ + DELAY(40000); + + /* Reset the DMA. */ + dbdma_stop(dma->channel); + dbdma_set_device_status(dma->channel, 1 << 0, 0); + + for (i = 0; i < dma->slots; ++i) + dbdma_clear_cmd_status(dma->channel, i); + + mtx_unlock(&dma->mutex); + + return (0); + } + + return (0); +} + +static int +aoa_chan_free(kobj_t obj, void *data) +{ + struct aoa_dma *dma = data; + + sndbuf_free(dma->buf); + dbdma_free_channel(dma->channel); + aoa_dma_delete(dma); + + return (0); +} + +void +aoa_interrupt(void *arg) +{ + struct aoa_softc *sc = arg; + struct aoa_dma *dma; + + if (!(dma = sc->sc_intrp) || !dma->running) + return; + + mtx_lock(&dma->mutex); + + while (dbdma_get_cmd_status(dma->channel, dma->slot)) { + + dbdma_clear_cmd_status(dma->channel, dma->slot); + dma->slot = (dma->slot + 1) % dma->slots; + + mtx_unlock(&dma->mutex); + chn_intr(dma->pcm); + mtx_lock(&dma->mutex); + } + + mtx_unlock(&dma->mutex); +} + +static u_int32_t sc_fmt[] = { + AFMT_S16_BE | AFMT_STEREO, + 0 +}; +static struct pcmchan_caps aoa_caps = {44100, 44100, sc_fmt, 0}; + +static struct pcmchan_caps * +aoa_chan_getcaps(kobj_t obj, void *data) +{ + return (&aoa_caps); +} + +static kobj_method_t aoa_chan_methods[] = { + KOBJMETHOD(channel_init, aoa_chan_init), + KOBJMETHOD(channel_free, aoa_chan_free), + KOBJMETHOD(channel_setformat, aoa_chan_setformat), + KOBJMETHOD(channel_setspeed, aoa_chan_setspeed), + KOBJMETHOD(channel_setblocksize,aoa_chan_setblocksize), + KOBJMETHOD(channel_trigger, aoa_chan_trigger), + KOBJMETHOD(channel_getptr, aoa_chan_getptr), + KOBJMETHOD(channel_getcaps, aoa_chan_getcaps), + { 0, 0 } +}; +CHANNEL_DECLARE(aoa_chan); + +int +aoa_attach(device_t self) +{ + char status[SND_STATUSLEN]; + int err; + + if (pcm_register(self, self, 1, 0)) + return (ENXIO); + + err = pcm_getbuffersize(self, AOA_BUFFER_SIZE, AOA_BUFFER_SIZE, + AOA_BUFFER_SIZE); + DPRINTF(("pcm_getbuffersize returned %d\n", err)); + + pcm_addchan(self, PCMDIR_PLAY, &aoa_chan_class, self); + + snprintf(status, sizeof(status), "at %s", ofw_bus_get_name(self)); + pcm_setstatus(self, status); + + return (0); +} + Added: head/sys/dev/sound/macio/aoa.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/sound/macio/aoa.h Sun Jan 25 18:20:15 2009 (r187692) @@ -0,0 +1,44 @@ +/*- + * Copyright 2008 by Marco Trillo. 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 ``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 SOUND_AOA_H +#define SOUND_AOA_H + +#define DPRINTF(x) /* nothing */ +/* #define DPRINTF(x) printf x */ + +struct aoa_softc { + u_int8_t sc_super[PCM_SOFTC_SIZE]; + void *sc_intrp; + struct resource *sc_odma; +}; + +void aoa_interrupt(void *); +int aoa_attach(device_t); + +#endif /* SOUND_AOA_H */ + Added: head/sys/dev/sound/macio/davbus.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/sound/macio/davbus.c Sun Jan 25 18:20:15 2009 (r187692) @@ -0,0 +1,600 @@ +/*- + * Copyright 2008 by Marco Trillo. 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 ``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$ + */ + +/* + * Apple DAVbus audio controller. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include "mixer_if.h" + +struct davbus_softc { + struct aoa_softc aoa; + device_t dev; + phandle_t node; + phandle_t soundnode; + struct resource *reg; + struct mtx mutex; + int device_id; + u_int output_mask; + u_int (*read_status)(struct davbus_softc *, u_int); + void (*set_outputs)(struct davbus_softc *, u_int); +}; + +static int davbus_probe(device_t); +static int davbus_attach(device_t); +static void davbus_cint(void *); + +static device_method_t pcm_davbus_methods[] = { + /* Device interface. */ + DEVMETHOD(device_probe, davbus_probe), + DEVMETHOD(device_attach, davbus_attach), + + { 0, 0 } +}; + +static driver_t pcm_davbus_driver = { + "pcm", + pcm_davbus_methods, + sizeof(struct davbus_softc) +}; + +DRIVER_MODULE(pcm_davbus, macio, pcm_davbus_driver, pcm_devclass, 0, 0); +MODULE_DEPEND(pcm_davbus, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); + +/***************************************************************************** + Probe and attachment routines. + *****************************************************************************/ +static int +davbus_probe(device_t self) +{ + const char *name; + struct davbus_softc *sc; + + name = ofw_bus_get_name(self); + if (!name) + return (ENXIO); + + if (strcmp(name, "davbus") != 0) + return (ENXIO); + + sc = device_get_softc(self); + if (!sc) + return (ENOMEM); + bzero(sc, sizeof(*sc)); + + device_set_desc(self, "Apple DAVBus Audio Controller"); + + return (0); +} + +/* + * Burgundy codec control + */ + +static int burgundy_init(struct snd_mixer *m); +static int burgundy_uninit(struct snd_mixer *m); +static int burgundy_reinit(struct snd_mixer *m); +static void burgundy_write_locked(struct davbus_softc *, u_int, u_int); +static void burgundy_set_outputs(struct davbus_softc *d, u_int mask); +static u_int burgundy_read_status(struct davbus_softc *d, u_int status); +static int burgundy_set(struct snd_mixer *m, unsigned dev, unsigned left, + unsigned right); +static int burgundy_setrecsrc(struct snd_mixer *m, u_int32_t src); + +static kobj_method_t burgundy_mixer_methods[] = { + KOBJMETHOD(mixer_init, burgundy_init), + KOBJMETHOD(mixer_uninit, burgundy_uninit), + KOBJMETHOD(mixer_reinit, burgundy_reinit), + KOBJMETHOD(mixer_set, burgundy_set), + KOBJMETHOD(mixer_setrecsrc, burgundy_setrecsrc), + { 0, 0 } +}; + +MIXER_DECLARE(burgundy_mixer); + +static int +burgundy_init(struct snd_mixer *m) +{ + struct davbus_softc *d; + + d = mix_getdevinfo(m); + + d->read_status = burgundy_read_status; + d->set_outputs = burgundy_set_outputs; + + /* + * We configure the Burgundy codec as follows: + * + * o Input subframe 0 is connected to input digital + * stream A (ISA). + * o Stream A (ISA) is mixed in mixer 2 (MIX2). + * o Output of mixer 2 (MIX2) is routed to output sources + * OS0 and OS1 which can be converted to analog. + * + */ + mtx_lock(&d->mutex); + + burgundy_write_locked(d, 0x16700, 0x40); + + burgundy_write_locked(d, BURGUNDY_MIX0_REG, 0); + burgundy_write_locked(d, BURGUNDY_MIX1_REG, 0); + burgundy_write_locked(d, BURGUNDY_MIX2_REG, BURGUNDY_MIX_ISA); + burgundy_write_locked(d, BURGUNDY_MIX3_REG, 0); + + burgundy_write_locked(d, BURGUNDY_OS_REG, BURGUNDY_OS0_MIX2 | + BURGUNDY_OS1_MIX2); + + burgundy_write_locked(d, BURGUNDY_SDIN_REG, BURGUNDY_ISA_SF0); + + /* Set several digital scalers to unity gain. */ + burgundy_write_locked(d, BURGUNDY_MXS2L_REG, BURGUNDY_MXS_UNITY); + burgundy_write_locked(d, BURGUNDY_MXS2R_REG, BURGUNDY_MXS_UNITY); + burgundy_write_locked(d, BURGUNDY_OSS0L_REG, BURGUNDY_OSS_UNITY); + burgundy_write_locked(d, BURGUNDY_OSS0R_REG, BURGUNDY_OSS_UNITY); + burgundy_write_locked(d, BURGUNDY_OSS1L_REG, BURGUNDY_OSS_UNITY); + burgundy_write_locked(d, BURGUNDY_OSS1R_REG, BURGUNDY_OSS_UNITY); + burgundy_write_locked(d, BURGUNDY_ISSAL_REG, BURGUNDY_ISS_UNITY); + burgundy_write_locked(d, BURGUNDY_ISSAR_REG, BURGUNDY_ISS_UNITY); + + burgundy_set_outputs(d, burgundy_read_status(d, + bus_read_4(d->reg, DAVBUS_CODEC_STATUS))); + + mtx_unlock(&d->mutex); + + mix_setdevs(m, SOUND_MASK_VOLUME); + + return (0); +} + +static int +burgundy_uninit(struct snd_mixer *m) +{ + return (0); +} + +static int +burgundy_reinit(struct snd_mixer *m) +{ + return (0); +} + +static void +burgundy_write_locked(struct davbus_softc *d, u_int reg, u_int val) +{ + u_int size, addr, offset, data, i; + + size = (reg & 0x00FF0000) >> 16; + addr = (reg & 0x0000FF00) >> 8; + offset = reg & 0xFF; + + for (i = offset; i < offset + size; ++i) { + data = BURGUNDY_CTRL_WRITE | (addr << 12) | + ((size + offset - 1) << 10) | (i << 8) | (val & 0xFF); + if (i == offset) + data |= BURGUNDY_CTRL_RESET; + + bus_write_4(d->reg, DAVBUS_CODEC_CTRL, data); + + while (bus_read_4(d->reg, DAVBUS_CODEC_CTRL) & + DAVBUS_CODEC_BUSY) + DELAY(1); + + val >>= 8; /* next byte. */ + } +} + +/* Must be called with d->mutex held. */ +static void +burgundy_set_outputs(struct davbus_softc *d, u_int mask) +{ + u_int x = 0; + + if (mask == d->output_mask) + return; + + /* + * Bordeaux card wirings: + * Port 15: RCA out + * Port 16: Minijack out + * Port 17: Internal speaker + * + * B&W G3 wirings: + * Port 14: Minijack out + * Port 17: Internal speaker + */ + + DPRINTF(("Enabled outputs:")); + if (mask & (1 << 0)) { + DPRINTF((" SPEAKER")); + x |= BURGUNDY_P17M_EN; + } + if (mask & (1 << 1)) { + DPRINTF((" HEADPHONES")); + x |= BURGUNDY_P14L_EN | BURGUNDY_P14R_EN; + } + DPRINTF(("\n")); + + burgundy_write_locked(d, BURGUNDY_MUTE_REG, x); + d->output_mask = mask; +} + +static u_int +burgundy_read_status(struct davbus_softc *d, u_int status) +{ + if (status & 0x4) + return (1 << 1); + else + return (1 << 0); +} + +static int +burgundy_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right) +{ + struct davbus_softc *d; + int lval, rval; + + lval = ((100 - left) * 15 / 100) & 0xf; + rval = ((100 - right) * 15 / 100) & 0xf; + DPRINTF(("volume %d %d\n", lval, rval)); + + d = mix_getdevinfo(m); + + switch (dev) { + case SOUND_MIXER_VOLUME: + mtx_lock(&d->mutex); + + burgundy_write_locked(d, BURGUNDY_OL13_REG, lval); + burgundy_write_locked(d, BURGUNDY_OL14_REG, (rval << 4) | lval); + burgundy_write_locked(d, BURGUNDY_OL15_REG, (rval << 4) | lval); + burgundy_write_locked(d, BURGUNDY_OL16_REG, (rval << 4) | lval); + burgundy_write_locked(d, BURGUNDY_OL17_REG, lval); + + mtx_unlock(&d->mutex); + + return (left | (right << 8)); + } + + return (0); +} + +static int +burgundy_setrecsrc(struct snd_mixer *m, u_int32_t src) +{ + return (0); +} + +/* + * Screamer Codec Control + */ + +static int screamer_init(struct snd_mixer *m); +static int screamer_uninit(struct snd_mixer *m); +static int screamer_reinit(struct snd_mixer *m); +static void screamer_write_locked(struct davbus_softc *, u_int, u_int); +static void screamer_set_outputs(struct davbus_softc *d, u_int mask); +static u_int screamer_read_status(struct davbus_softc *d, u_int status); +static int screamer_set(struct snd_mixer *m, unsigned dev, unsigned left, + unsigned right); +static int screamer_setrecsrc(struct snd_mixer *m, u_int32_t src); + +static kobj_method_t screamer_mixer_methods[] = { + KOBJMETHOD(mixer_init, screamer_init), + KOBJMETHOD(mixer_uninit, screamer_uninit), + KOBJMETHOD(mixer_reinit, screamer_reinit), + KOBJMETHOD(mixer_set, screamer_set), + KOBJMETHOD(mixer_setrecsrc, screamer_setrecsrc), + { 0, 0 } +}; + +MIXER_DECLARE(screamer_mixer); + +static int +screamer_init(struct snd_mixer *m) +{ + struct davbus_softc *d; + + d = mix_getdevinfo(m); + + d->read_status = screamer_read_status; + d->set_outputs = screamer_set_outputs; + + mtx_lock(&d->mutex); + + screamer_write_locked(d, SCREAMER_CODEC_ADDR0, SCREAMER_INPUT_CD | + SCREAMER_DEFAULT_CD_GAIN); + + screamer_set_outputs(d, screamer_read_status(d, + bus_read_4(d->reg, DAVBUS_CODEC_STATUS))); + + screamer_write_locked(d, SCREAMER_CODEC_ADDR2, 0); + screamer_write_locked(d, SCREAMER_CODEC_ADDR4, 0); + screamer_write_locked(d, SCREAMER_CODEC_ADDR5, 0); + screamer_write_locked(d, SCREAMER_CODEC_ADDR6, 0); + + mtx_unlock(&d->mutex); + + mix_setdevs(m, SOUND_MASK_VOLUME); + + return (0); +} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 18:28:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22516106566B; Sun, 25 Jan 2009 18:28:55 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au [211.29.132.188]) by mx1.freebsd.org (Postfix) with ESMTP id 94B348FC26; Sun, 25 Jan 2009 18:28:54 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-107-120-227.carlnfd1.nsw.optusnet.com.au [122.107.120.227]) by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n0PIST8j032127 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 26 Jan 2009 05:28:31 +1100 Date: Mon, 26 Jan 2009 05:28:29 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Schouten In-Reply-To: <20090125175751.GC17198@hoeg.nl> Message-ID: <20090126051910.E2148@besplex.bde.org> References: <200901230058.n0N0wEjY026935@svn.freebsd.org> <20090125162123.GB17198@hoeg.nl> <20090126041926.J43097@delplex.bde.org> <20090125175751.GC17198@hoeg.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, Tom Rhodes , svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans Subject: Re: svn commit: r187607 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 18:28:56 -0000 On Sun, 25 Jan 2009, Ed Schouten wrote: > * Bruce Evans wrote: >> I think it is the longstanding kernel bug in permissions checking >> generally, that the init process and some other non-kernel processes >> are bogusly marked as P_SYSTEM. I use the following fix (this may >> be incomplete): >> >> > > I just looked at the patch and it seems to do the right thing. I can't > seem to find any places in the kernel where it makes sense to let > init(8) use P_SYSTEM (except kern_sig.c ofcourse). I like the cleanups > you made, especially the comparisons with initproc instead of using the > pid. > > Would you mind if I commit your patch to SVN? OK, but please think about the following possible problems: - permissions should be decided in the usual way for init (root should not be restricted except for impossible things), but maybe something (jail?) depends on extra restrictions. - P_SYSTEM has something to do with swapping, and I also removed the PS_INMEM setting for init. I have always used NO_SWAPPING and haven't used a swap partition since memory sizes reached 64MB, so I wouldn't have noticed problems with this. init doesn't run often so it is quite likely to be swapped (if allowed to) if real memory runs out. Bruce From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 18:38:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00BC4106564A; Sun, 25 Jan 2009 18:38:43 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E342F8FC12; Sun, 25 Jan 2009 18:38:42 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0PIcg34024859; Sun, 25 Jan 2009 18:38:42 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0PIcgXk024858; Sun, 25 Jan 2009 18:38:42 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200901251838.n0PIcgXk024858@svn.freebsd.org> From: Jeff Roberson Date: Sun, 25 Jan 2009 18:38:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187693 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 18:38:43 -0000 Author: jeff Date: Sun Jan 25 18:38:42 2009 New Revision: 187693 URL: http://svn.freebsd.org/changeset/base/187693 Log: - bit has to be fd_mask to work properly on 64bit platforms. Constants must also be cast even though the result ultimately is promoted to 64bit. - Correct a loop index upper bound in selscan(). Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Sun Jan 25 18:20:15 2009 (r187692) +++ head/sys/kern/sys_generic.c Sun Jan 25 18:38:42 2009 (r187693) @@ -965,8 +965,8 @@ selrescan(struct thread *td, fd_mask **i struct selfd *sfp; struct selfd *sfn; struct file *fp; - int fd, ev, n; - int idx, bit; + fd_mask bit; + int fd, ev, n, idx; fdp = td->td_proc->p_fd; stp = td->td_sel; @@ -984,7 +984,7 @@ selrescan(struct thread *td, fd_mask **i return (EBADF); } idx = fd / NFDBITS; - bit = 1 << (fd % NFDBITS); + bit = (fd_mask)1 << (fd % NFDBITS); ev = fo_poll(fp, selflags(ibits, idx, bit), td->td_ucred, td); if (ev != 0) n += selsetbits(ibits, obits, idx, bit, ev); @@ -1007,13 +1007,14 @@ selscan(td, ibits, obits, nfd) { struct filedesc *fdp; struct file *fp; + fd_mask bit; int ev, flags, end, fd; - int n, idx, bit; + int n, idx; fdp = td->td_proc->p_fd; n = 0; FILEDESC_SLOCK(fdp); - for (idx = 0, fd = 0; idx < nfd; idx++) { + for (idx = 0, fd = 0; fd < nfd; idx++) { end = imin(fd + NFDBITS, nfd); for (bit = 1; fd < end; bit <<= 1, fd++) { /* Compute the list of events we're interested in. */ From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 18:59:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CC491065672; Sun, 25 Jan 2009 18:59:18 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.225]) by mx1.freebsd.org (Postfix) with ESMTP id D75128FC18; Sun, 25 Jan 2009 18:59:17 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by rv-out-0506.google.com with SMTP id b25so5659887rvf.43 for ; Sun, 25 Jan 2009 10:59:17 -0800 (PST) Received: by 10.140.139.3 with SMTP id m3mr1337132rvd.270.1232909957201; Sun, 25 Jan 2009 10:59:17 -0800 (PST) Received: from ?10.0.1.199? (udp005586uds.hawaiiantel.net [72.234.105.237]) by mx.google.com with ESMTPS id k2sm28616673rvb.6.2009.01.25.10.59.14 (version=SSLv3 cipher=RC4-MD5); Sun, 25 Jan 2009 10:59:15 -0800 (PST) Date: Sun, 25 Jan 2009 08:56:40 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Jeff Roberson In-Reply-To: <200901251838.n0PIcgXk024858@svn.freebsd.org> Message-ID: <20090125085419.O983@desktop> References: <200901251838.n0PIcgXk024858@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187693 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 18:59:18 -0000 On Sun, 25 Jan 2009, Jeff Roberson wrote: > Author: jeff > Date: Sun Jan 25 18:38:42 2009 > New Revision: 187693 > URL: http://svn.freebsd.org/changeset/base/187693 > > Log: > - bit has to be fd_mask to work properly on 64bit platforms. Constants > must also be cast even though the result ultimately is promoted > to 64bit. > - Correct a loop index upper bound in selscan(). Sorry about that, should've tested my earlier patch for more than a couple of days. I seldom remember c's integer promotion rules as they relate to constants. You'd think they'd make it easy on us and just promote it to the largest type in the expression/lvalue. I'm not sure why they don't. Perhaps the more careful among you knows the answer. Thanks, Jeff > > Modified: > head/sys/kern/sys_generic.c > > Modified: head/sys/kern/sys_generic.c > ============================================================================== > --- head/sys/kern/sys_generic.c Sun Jan 25 18:20:15 2009 (r187692) > +++ head/sys/kern/sys_generic.c Sun Jan 25 18:38:42 2009 (r187693) > @@ -965,8 +965,8 @@ selrescan(struct thread *td, fd_mask **i > struct selfd *sfp; > struct selfd *sfn; > struct file *fp; > - int fd, ev, n; > - int idx, bit; > + fd_mask bit; > + int fd, ev, n, idx; > > fdp = td->td_proc->p_fd; > stp = td->td_sel; > @@ -984,7 +984,7 @@ selrescan(struct thread *td, fd_mask **i > return (EBADF); > } > idx = fd / NFDBITS; > - bit = 1 << (fd % NFDBITS); > + bit = (fd_mask)1 << (fd % NFDBITS); > ev = fo_poll(fp, selflags(ibits, idx, bit), td->td_ucred, td); > if (ev != 0) > n += selsetbits(ibits, obits, idx, bit, ev); > @@ -1007,13 +1007,14 @@ selscan(td, ibits, obits, nfd) > { > struct filedesc *fdp; > struct file *fp; > + fd_mask bit; > int ev, flags, end, fd; > - int n, idx, bit; > + int n, idx; > > fdp = td->td_proc->p_fd; > n = 0; > FILEDESC_SLOCK(fdp); > - for (idx = 0, fd = 0; idx < nfd; idx++) { > + for (idx = 0, fd = 0; fd < nfd; idx++) { > end = imin(fd + NFDBITS, nfd); > for (bit = 1; fd < end; bit <<= 1, fd++) { > /* Compute the list of events we're interested in. */ > From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 19:03:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DF4D106564A; Sun, 25 Jan 2009 19:03:30 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BDA38FC25; Sun, 25 Jan 2009 19:03:30 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0PJ3UHP025346; Sun, 25 Jan 2009 19:03:30 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0PJ3UVM025344; Sun, 25 Jan 2009 19:03:30 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <200901251903.n0PJ3UVM025344@svn.freebsd.org> From: Antoine Brodin Date: Sun, 25 Jan 2009 19:03:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187694 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 19:03:31 -0000 Author: antoine Date: Sun Jan 25 19:03:30 2009 New Revision: 187694 URL: http://svn.freebsd.org/changeset/base/187694 Log: Add obsolete files after tzdata2009a and file 4.26 imports Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Jan 25 18:38:42 2009 (r187693) +++ head/ObsoleteFiles.inc Sun Jan 25 19:03:30 2009 (r187694) @@ -14,6 +14,11 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20090122: tzdata2009a import +OLD_FILES+=usr/share/zoneinfo/Asia/Katmandu +# 20090102: file 4.26 import +OLD_FILES+=usr/share/misc/magic.mime +OLD_FILES+=usr/share/misc/magic.mime.mgc # 20081223: bind 9.4.3 import, nsupdate.8 moved to nsupdate.1 OLD_FILES+=usr/share/man/man8/nsupdate.8.gz # 20081223: ipprotosw.h removed From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 19:11:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71CF91065674 for ; Sun, 25 Jan 2009 19:11:30 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id E64C68FC2A for ; Sun, 25 Jan 2009 19:11:25 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: (qmail invoked by alias); 25 Jan 2009 19:11:24 -0000 Received: from p54A3D748.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.215.72] by mail.gmx.net (mp014) with SMTP; 25 Jan 2009 20:11:24 +0100 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX18+9t4768U+tknva/4Q0jKPzgRTYo3bC6X67PVSdn yFEimtQQ+Y8h+j Message-ID: <497CB95A.109@gmx.de> Date: Sun, 25 Jan 2009 20:11:22 +0100 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: Jeff Roberson References: <200901251838.n0PIcgXk024858@svn.freebsd.org> <20090125085419.O983@desktop> In-Reply-To: <20090125085419.O983@desktop> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.6 Cc: svn-src-head@freebsd.org, Jeff Roberson , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r187693 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 19:11:30 -0000 Jeff Roberson schrieb: > On Sun, 25 Jan 2009, Jeff Roberson wrote: > >> Author: jeff >> Date: Sun Jan 25 18:38:42 2009 >> New Revision: 187693 >> URL: http://svn.freebsd.org/changeset/base/187693 >> >> Log: >> - bit has to be fd_mask to work properly on 64bit platforms. Constants >> must also be cast even though the result ultimately is promoted >> to 64bit. >> - Correct a loop index upper bound in selscan(). > > Sorry about that, should've tested my earlier patch for more than a > couple of days. I seldom remember c's integer promotion rules as they > relate to constants. You'd think they'd make it easy on us and just > promote it to the largest type in the expression/lvalue. I'm not sure > why they don't. Perhaps the more careful among you knows the answer. The rule for operations is quite simple: An operation never cares for the type of its user. It only uses the type of the operand(s) to determine its result type. So for a = b + c the type of the result of + only depends on the types of b and c, but never on a. Integer literals have a bit ugly rules what type they are: It depends on the base (!) and on the magnitude of the literal. If in doubt and you need a specific type (and maybe making it more clear for a reader) then cast. From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 19:16:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7743B10656EE; Sun, 25 Jan 2009 19:16:39 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.229]) by mx1.freebsd.org (Postfix) with ESMTP id 3E4B18FC13; Sun, 25 Jan 2009 19:16:39 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by rv-out-0506.google.com with SMTP id b25so5664348rvf.43 for ; Sun, 25 Jan 2009 11:16:39 -0800 (PST) Received: by 10.141.106.14 with SMTP id i14mr2148331rvm.143.1232910998805; Sun, 25 Jan 2009 11:16:38 -0800 (PST) Received: from ?10.0.1.199? (udp005586uds.hawaiiantel.net [72.234.105.237]) by mx.google.com with ESMTPS id k41sm12331632rvb.3.2009.01.25.11.16.36 (version=SSLv3 cipher=RC4-MD5); Sun, 25 Jan 2009 11:16:37 -0800 (PST) Date: Sun, 25 Jan 2009 09:14:03 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Christoph Mallon In-Reply-To: <497CB95A.109@gmx.de> Message-ID: <20090125091247.Y983@desktop> References: <200901251838.n0PIcgXk024858@svn.freebsd.org> <20090125085419.O983@desktop> <497CB95A.109@gmx.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, Jeff Roberson , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r187693 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 19:16:40 -0000 On Sun, 25 Jan 2009, Christoph Mallon wrote: > Jeff Roberson schrieb: >> On Sun, 25 Jan 2009, Jeff Roberson wrote: >> >>> Author: jeff >>> Date: Sun Jan 25 18:38:42 2009 >>> New Revision: 187693 >>> URL: http://svn.freebsd.org/changeset/base/187693 >>> >>> Log: >>> - bit has to be fd_mask to work properly on 64bit platforms. Constants >>> must also be cast even though the result ultimately is promoted >>> to 64bit. >>> - Correct a loop index upper bound in selscan(). >> >> Sorry about that, should've tested my earlier patch for more than a couple >> of days. I seldom remember c's integer promotion rules as they relate to >> constants. You'd think they'd make it easy on us and just promote it to >> the largest type in the expression/lvalue. I'm not sure why they don't. >> Perhaps the more careful among you knows the answer. > > The rule for operations is quite simple: An operation never cares for the > type of its user. It only uses the type of the operand(s) to determine its > result type. So for a = b + c the type of the result of + only depends on the > types of b and c, but never on a. > Integer literals have a bit ugly rules what type they are: It depends on the > base (!) and on the magnitude of the literal. > If in doubt and you need a specific type (and maybe making it more clear for > a reader) then cast. > I'm familiar with the rule, what I don't know is the rationale. It would've been much more convenient if they did care for the user. In what case does the base matter? If you use a literal large enough the compiler conveniently complains. However, in this case the shift value was computed and applied to 1 which overflowed before being assigned to a 64bit value. Thanks, Jeff From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 19:44:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E393106566C for ; Sun, 25 Jan 2009 19:44:37 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id 684AC8FC1A for ; Sun, 25 Jan 2009 19:44:32 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: (qmail invoked by alias); 25 Jan 2009 19:44:31 -0000 Received: from p54A3D748.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.215.72] by mail.gmx.net (mp066) with SMTP; 25 Jan 2009 20:44:31 +0100 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX18uRv8eynYuBsq87M0K7nCvg83/uLx6FeAYG/Acib YX3aCAlnUeHCGO Message-ID: <497CC111.70502@gmx.de> Date: Sun, 25 Jan 2009 20:44:17 +0100 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: Jeff Roberson References: <200901251838.n0PIcgXk024858@svn.freebsd.org> <20090125085419.O983@desktop> <497CB95A.109@gmx.de> <20090125091247.Y983@desktop> In-Reply-To: <20090125091247.Y983@desktop> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.55 Cc: svn-src-head@freebsd.org, Jeff Roberson , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r187693 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 19:44:38 -0000 Jeff Roberson schrieb: > On Sun, 25 Jan 2009, Christoph Mallon wrote: > >> Jeff Roberson schrieb: >>> On Sun, 25 Jan 2009, Jeff Roberson wrote: >>> >>>> Author: jeff >>>> Date: Sun Jan 25 18:38:42 2009 >>>> New Revision: 187693 >>>> URL: http://svn.freebsd.org/changeset/base/187693 >>>> >>>> Log: >>>> - bit has to be fd_mask to work properly on 64bit platforms. >>>> Constants >>>> must also be cast even though the result ultimately is promoted >>>> to 64bit. >>>> - Correct a loop index upper bound in selscan(). >>> >>> Sorry about that, should've tested my earlier patch for more than a >>> couple of days. I seldom remember c's integer promotion rules as >>> they relate to constants. You'd think they'd make it easy on us and >>> just promote it to the largest type in the expression/lvalue. I'm >>> not sure why they don't. Perhaps the more careful among you knows the >>> answer. >> >> The rule for operations is quite simple: An operation never cares for >> the type of its user. It only uses the type of the operand(s) to >> determine its result type. So for a = b + c the type of the result of >> + only depends on the types of b and c, but never on a. >> Integer literals have a bit ugly rules what type they are: It depends >> on the base (!) and on the magnitude of the literal. >> If in doubt and you need a specific type (and maybe making it more >> clear for a reader) then cast. >> > > I'm familiar with the rule, what I don't know is the rationale. It > would've been much more convenient if they did care for the user. Well, the only rationale which really matters in the end is that it always was this way and therefore it cannot be changed anymore, because there are billions and billions of lines of code out there. The technical reason probably was that it makes type analysis easier in the compiler: You only have to propagate type information from the leaves of an expression twoards the root instead of having to do so in both directions. > In what case does the base matter? If you use a literal large enough > the compiler conveniently complains. However, in this case the shift > value was computed and applied to 1 which overflowed before being > assigned to a 64bit value. Decimal literals which do not have a "U" as part of the suffix are always of a signed integer type. In contrast octal and hexadecimal literals can be of unsigned integer types, too. Example: (assuming 32bit int and long, 64bit long long) 0xFFFFFFFF is unsigned int but 4294967295 is signed long long int The exact rules can be found in ISO/IEC 9899:1999(E) §6.4.4.1. Btw: There are no negative literals. This is always a unary minus operator followed by a (non-negative) integer literal. This leads to one interesting edge case on two complement machines: the number -2147483648 fits into a signed int. But it is parsed as unary minus operator with a integer literal as operand. The integer literal is too large for int, so its type is signed long long int. Therefore -2147483648 is of type signed long long int instead of the expected int. This artifact is mostly harmless though. From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 19:57:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96C55106566C; Sun, 25 Jan 2009 19:57:30 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.225]) by mx1.freebsd.org (Postfix) with ESMTP id 5B57D8FC1D; Sun, 25 Jan 2009 19:57:30 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by rv-out-0506.google.com with SMTP id b25so5675122rvf.43 for ; Sun, 25 Jan 2009 11:57:30 -0800 (PST) Received: by 10.140.165.21 with SMTP id n21mr6412062rve.60.1232913450006; Sun, 25 Jan 2009 11:57:30 -0800 (PST) Received: from ?10.0.1.199? (udp005586uds.hawaiiantel.net [72.234.105.237]) by mx.google.com with ESMTPS id b39sm12311204rvf.0.2009.01.25.11.57.27 (version=SSLv3 cipher=RC4-MD5); Sun, 25 Jan 2009 11:57:28 -0800 (PST) Date: Sun, 25 Jan 2009 09:54:54 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Christoph Mallon In-Reply-To: <497CC111.70502@gmx.de> Message-ID: <20090125095418.G983@desktop> References: <200901251838.n0PIcgXk024858@svn.freebsd.org> <20090125085419.O983@desktop> <497CB95A.109@gmx.de> <20090125091247.Y983@desktop> <497CC111.70502@gmx.de> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="2547152148-139696866-1232913294=:983" Cc: svn-src-head@freebsd.org, Jeff Roberson , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r187693 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 19:57:31 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --2547152148-139696866-1232913294=:983 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sun, 25 Jan 2009, Christoph Mallon wrote: > Jeff Roberson schrieb: >> On Sun, 25 Jan 2009, Christoph Mallon wrote: >>=20 >>> Jeff Roberson schrieb: >>>> On Sun, 25 Jan 2009, Jeff Roberson wrote: >>>>=20 >>>>> Author: jeff >>>>> Date: Sun Jan 25 18:38:42 2009 >>>>> New Revision: 187693 >>>>> URL: http://svn.freebsd.org/changeset/base/187693 >>>>>=20 >>>>> Log: >>>>> - bit has to be fd_mask to work properly on 64bit platforms.=20 >>>>> Constants >>>>> must also be cast even though the result ultimately is promoted >>>>> to 64bit. >>>>> - Correct a loop index upper bound in selscan(). >>>>=20 >>>> Sorry about that, should've tested my earlier patch for more than a=20 >>>> couple of days. I seldom remember c's integer promotion rules as they= =20 >>>> relate to constants. You'd think they'd make it easy on us and just= =20 >>>> promote it to the largest type in the expression/lvalue. I'm not sure= =20 >>>> why they don't. Perhaps the more careful among you knows the answer. >>>=20 >>> The rule for operations is quite simple: An operation never cares for t= he=20 >>> type of its user. It only uses the type of the operand(s) to determine = its=20 >>> result type. So for a =3D b + c the type of the result of + only depend= s on=20 >>> the types of b and c, but never on a. >>> Integer literals have a bit ugly rules what type they are: It depends o= n=20 >>> the base (!) and on the magnitude of the literal. >>> If in doubt and you need a specific type (and maybe making it more clea= r=20 >>> for a reader) then cast. >>>=20 >>=20 >> I'm familiar with the rule, what I don't know is the rationale. It=20 >> would've been much more convenient if they did care for the user. > > Well, the only rationale which really matters in the end is that it alway= s=20 > was this way and therefore it cannot be changed anymore, because there ar= e=20 > billions and billions of lines of code out there. > > The technical reason probably was that it makes type analysis easier in t= he=20 > compiler: You only have to propagate type information from the leaves of = an=20 > expression twoards the root instead of having to do so in both directions= =2E This is a good point. Since most of C seems to have been designed with=20 the convenience of the compiler writer in mind it's probably the right=20 answer. Thanks, Jeff > >> In what case does the base matter? If you use a literal large enough th= e=20 >> compiler conveniently complains. However, in this case the shift value = was=20 >> computed and applied to 1 which overflowed before being assigned to a 64= bit=20 >> value. > > Decimal literals which do not have a "U" as part of the suffix are always= of=20 > a signed integer type. In contrast octal and hexadecimal literals can be = of=20 > unsigned integer types, too. > Example: (assuming 32bit int and long, 64bit long long) > 0xFFFFFFFF is unsigned int > but > 4294967295 is signed long long int > The exact rules can be found in ISO/IEC 9899:1999(E) =A76.4.4.1. > > Btw: There are no negative literals. This is always a unary minus operato= r=20 > followed by a (non-negative) integer literal. This leads to one interesti= ng=20 > edge case on two complement machines: the number -2147483648 fits into a= =20 > signed int. But it is parsed as unary minus operator with a integer liter= al=20 > as operand. The integer literal is too large for int, so its type is sign= ed=20 > long long int. Therefore -2147483648 is of type signed long long int inst= ead=20 > of the expected int. This artifact is mostly harmless though. > --2547152148-139696866-1232913294=:983-- From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 19:57:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FC5B106567F; Sun, 25 Jan 2009 19:57:39 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id 30A3C8FC20; Sun, 25 Jan 2009 19:57:38 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from trouble.errno.com (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n0PJvcM1006454 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 25 Jan 2009 11:57:38 -0800 (PST) (envelope-from sam@freebsd.org) Message-ID: <497CC432.5010303@freebsd.org> Date: Sun, 25 Jan 2009 11:57:38 -0800 From: Sam Leffler Organization: FreeBSD Project User-Agent: Thunderbird 2.0.0.18 (X11/20081209) MIME-Version: 1.0 To: Jeff Roberson References: <200901250724.n0P7OYd9009645@svn.freebsd.org> In-Reply-To: <200901250724.n0P7OYd9009645@svn.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DCC-sonic.net-Metrics: ebb.errno.com; whitelist Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187677 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 19:57:40 -0000 Jeff Roberson wrote: > Author: jeff > Date: Sun Jan 25 07:24:34 2009 > New Revision: 187677 > URL: http://svn.freebsd.org/changeset/base/187677 > > Log: > Fix errors introduced when I rewrote select. > - Restructure selscan() and selrescan() to avoid producing extra selfps > when we have a fd in multiple sets. As described below multiple selfps > may still exist for other reasons. > - Make selrescan() tolerate multiple selfds for a given descriptor > set since sockets use two selinfos per fd. If an event on each selinfo > fires selrescan() will see the descriptor twice. This could result in > select() returning 2x the number of fds actually existing in fd sets. > > Can you clarify what the erroneous behaviour is? It appears the caller will receive nfds set to 2x the actual number of descriptors marked in the bit vectors? Was this identified because an application failed/misbehaved? If so, and the application is public please identify it. Sam From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 20:03:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EC64106566B; Sun, 25 Jan 2009 20:03:51 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.227]) by mx1.freebsd.org (Postfix) with ESMTP id 65BBA8FC13; Sun, 25 Jan 2009 20:03:51 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by rv-out-0506.google.com with SMTP id g9so388438rvb.3 for ; Sun, 25 Jan 2009 12:03:50 -0800 (PST) Received: by 10.141.153.16 with SMTP id f16mr730414rvo.283.1232913830488; Sun, 25 Jan 2009 12:03:50 -0800 (PST) Received: from ?10.0.1.199? (udp005586uds.hawaiiantel.net [72.234.105.237]) by mx.google.com with ESMTPS id b39sm3734004rvf.0.2009.01.25.12.03.47 (version=SSLv3 cipher=RC4-MD5); Sun, 25 Jan 2009 12:03:49 -0800 (PST) Date: Sun, 25 Jan 2009 10:01:15 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Sam Leffler In-Reply-To: <497CC432.5010303@freebsd.org> Message-ID: <20090125095804.F983@desktop> References: <200901250724.n0P7OYd9009645@svn.freebsd.org> <497CC432.5010303@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, Jeff Roberson , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r187677 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 20:03:52 -0000 On Sun, 25 Jan 2009, Sam Leffler wrote: > Jeff Roberson wrote: >> Author: jeff >> Date: Sun Jan 25 07:24:34 2009 >> New Revision: 187677 >> URL: http://svn.freebsd.org/changeset/base/187677 >> >> Log: >> Fix errors introduced when I rewrote select. >> - Restructure selscan() and selrescan() to avoid producing extra selfps >> when we have a fd in multiple sets. As described below multiple >> selfps >> may still exist for other reasons. >> - Make selrescan() tolerate multiple selfds for a given descriptor >> set since sockets use two selinfos per fd. If an event on each >> selinfo >> fires selrescan() will see the descriptor twice. This could result in >> select() returning 2x the number of fds actually existing in fd sets. >> > > Can you clarify what the erroneous behaviour is? It appears the caller will > receive nfds set to 2x the actual number of descriptors marked in the bit > vectors? Was this identified because an application failed/misbehaved? If > so, and the application is public please identify it. Yes it was found via the ncftp3 port. They explicitly checked the select result against 1 since they knew they were selecting on one socket pending connect(). However the socket was both in the writable and except sets. The result wasn't always 2x the number of descriptors. Each descriptor that triggered an event was counted once for each set it was in. There shouldn't be any odd behavior except in those applications that specifically rely on return values other than -1 and > 1. Thanks, Jeff > > Sam > From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 23:08:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E6081065713; Sun, 25 Jan 2009 23:08:47 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B7CF8FC2A; Sun, 25 Jan 2009 23:08:47 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0PN8l6S030021; Sun, 25 Jan 2009 23:08:47 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0PN8lvg030020; Sun, 25 Jan 2009 23:08:47 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200901252308.n0PN8lvg030020@svn.freebsd.org> From: Xin LI Date: Sun, 25 Jan 2009 23:08:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187700 - head/lib/libc/string X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 23:08:48 -0000 Author: delphij Date: Sun Jan 25 23:08:47 2009 New Revision: 187700 URL: http://svn.freebsd.org/changeset/base/187700 Log: Rewrite of MI strlen(3) in a way that can better utilize modern hardware by reducing branches and doing word-sized operation. The idea is taken from J.T. Conklin's x86_64 optimized version of strlen(3) for NetBSD, and reimplemented in C by me. Discussed on: -arch@ Modified: head/lib/libc/string/strlen.c Modified: head/lib/libc/string/strlen.c ============================================================================== --- head/lib/libc/string/strlen.c Sun Jan 25 21:27:31 2009 (r187699) +++ head/lib/libc/string/strlen.c Sun Jan 25 23:08:47 2009 (r187700) @@ -1,6 +1,6 @@ /*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. + * Copyright (c) 2009 Xin LI + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,14 +10,11 @@ * 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 + * 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 REGENTS OR CONTRIBUTORS 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) @@ -27,21 +24,87 @@ * SUCH DAMAGE. */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strlen.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ #include __FBSDID("$FreeBSD$"); +#include +#include #include +/* + * Portable strlen() for 32-bit and 64-bit systems. + * + * Rationale: it is generally much more efficient to do word length + * operations and avoid branches on modern computer systems, as + * compared to byte-length operations with a lot of branches. + * + * The expression: + * + * ((x - 0x01....01) & ~x & 0x80....80) + * + * would evaluate to a non-zero value iff any of the bytes in the + * original word is zero. However, we can further reduce ~1/3 of + * time if we consider that strlen() usually operate on 7-bit ASCII + * by employing the following expression, which allows false positive + * when high bit of 1 and use the tail case to catch these case: + * + * ((x - 0x01....01) & 0x80....80) + * + * This is more than 5.2 times as compared to the raw implementation + * on Intel T7300 under EM64T mode for strings longer than word length. + */ + +/* Magic numbers for the algorithm */ +#if LONG_BIT == 32 +static const unsigned long mask01 = 0x01010101; +static const unsigned long mask80 = 0x80808080; +#elif LONG_BIT == 64 +static const unsigned long mask01 = 0x0101010101010101; +static const unsigned long mask80 = 0x8080808080808080; +#else +#error Unsupported word size +#endif + +#define LONGPTR_MASK (sizeof(long) - 1) + +/* + * Helper macro to return string length if we caught the zero + * byte. + */ +#define testbyte(x) \ + do { \ + if (p[x] == '\0') \ + return (p - str + x); \ + } while (0) + size_t -strlen(str) - const char *str; +strlen(const char *str) { - const char *s; + const char *p; + const unsigned long *lp; + + /* Skip the first few bytes until we have an aligned p */ + for (p = str; (uintptr_t)p & LONGPTR_MASK; p++) + if (*p == '\0') + return (p - str); + + /* Scan the rest of the string using word sized operation */ + for (lp = (const unsigned long *)p; ; lp++) + if ((*lp - mask01) & mask80) { + p = (const char *)(lp); + testbyte(0); + testbyte(1); + testbyte(2); + testbyte(3); +#if (LONG_BIT >= 64) + testbyte(4); + testbyte(5); + testbyte(6); + testbyte(7); +#endif + } - for (s = str; *s; ++s); - return(s - str); + /* NOTREACHED */ + return 0; } From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 23:50:21 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA4631065672; Sun, 25 Jan 2009 23:50:21 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85]) by mx1.freebsd.org (Postfix) with ESMTP id A90508FC1B; Sun, 25 Jan 2009 23:50:21 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1]) by dragon.nuxi.org (8.14.2/8.14.2) with ESMTP id n0PNoDgn025107; Sun, 25 Jan 2009 15:50:14 -0800 (PST) (envelope-from obrien@dragon.nuxi.org) Received: (from obrien@localhost) by dragon.nuxi.org (8.14.2/8.14.2/Submit) id n0PNoDEf025106; Sun, 25 Jan 2009 15:50:13 -0800 (PST) (envelope-from obrien) Date: Sun, 25 Jan 2009 15:50:13 -0800 From: "David O'Brien" To: "M. Warner Losh" Message-ID: <20090125235013.GA25031@dragon.NUXI.org> References: <20090119165030.GA18409@dragon.NUXI.org> <20090119.181435.-298663465.imp@bsdimp.com> <20090120012256.GB29741@dragon.NUXI.org> <20090119.191238.1389906774.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090119.191238.1389906774.imp@bsdimp.com> X-Operating-System: FreeBSD 8.0-CURRENT User-Agent: Mutt/1.5.16 (2007-06-09) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r187332 - head/tools/regression/usr.bin/jot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 23:50:22 -0000 On Mon, Jan 19, 2009 at 07:12:38PM -0700, M. Warner Losh wrote: > In message: <20090120012256.GB29741@dragon.NUXI.org> "David O'Brien" writes: > : On Mon, Jan 19, 2009 at 06:14:35PM -0700, M. Warner Losh wrote: > : > In message: <20090119165030.GA18409@dragon.NUXI.org> "David O'Brien" writes: > : > : Run VMware. Seriously. Or raise a serious discussion on developers@ > : > : about this and get conciseness that cross building on MacOS X and > : > : MS-Windows is a goal. > : > > : > I've tried this on my mac. It doesn't work very well at all, and it a > : > pita for file sharing. > : > : Sorry - I don't quite follow. What is "it"? [ reply snipped ] Ok, I thought you were saying running FreeBSD under VMware doesn't work very well. I know for a fact that is not the case. I also wasn't sure what you meant by "pita for file sharing" as NFS certainly works in FreeBSD on the VM. I know MS-Windows under VMware Workstation and MacOS X can share a common folder, but I've never looked at if VMware tools for FreeBSD has that functionality also. -- David From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 23:53:29 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BD621065674; Sun, 25 Jan 2009 23:53:29 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85]) by mx1.freebsd.org (Postfix) with ESMTP id 1AD158FC12; Sun, 25 Jan 2009 23:53:29 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1]) by dragon.nuxi.org (8.14.2/8.14.2) with ESMTP id n0PNrMxf025181; Sun, 25 Jan 2009 15:53:22 -0800 (PST) (envelope-from obrien@dragon.nuxi.org) Received: (from obrien@localhost) by dragon.nuxi.org (8.14.2/8.14.2/Submit) id n0PNrMiU025180; Sun, 25 Jan 2009 15:53:22 -0800 (PST) (envelope-from obrien) Date: Sun, 25 Jan 2009 15:53:22 -0800 From: "David O'Brien" To: "M. Warner Losh" Message-ID: <20090125235322.GB25031@dragon.NUXI.org> References: <20090119165030.GA18409@dragon.NUXI.org> <20090119.181435.-298663465.imp@bsdimp.com> <20090120012256.GB29741@dragon.NUXI.org> <20090119.191238.1389906774.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090119.191238.1389906774.imp@bsdimp.com> X-Operating-System: FreeBSD 8.0-CURRENT User-Agent: Mutt/1.5.16 (2007-06-09) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r187332 - head/tools/regression/usr.bin/jot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 23:53:29 -0000 On Mon, Jan 19, 2009 at 07:12:38PM -0700, M. Warner Losh wrote: > I'm > glad JUNOS can build inside its own VM. Kudos. But given that the > world is much more than a tightly controlled development environment > at a well funded company, I think that we need to be more > accommodating. Especially for the embedded world. A minor correctly - JUNOS builds on STOCK FreeBSD running in a VM. JUNOS does not host its own build. How is building FreeBSD under stock FreeBSD affected by how well funded an entity is? -- -- David (obrien@FreeBSD.org) From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 00:36:09 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F7321065680; Mon, 26 Jan 2009 00:36:09 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 2C90C8FC24; Mon, 26 Jan 2009 00:36:09 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n0Q0ZEf9031024; Sun, 25 Jan 2009 17:35:14 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sun, 25 Jan 2009 17:35:58 -0700 (MST) Message-Id: <20090125.173558.1731231004.imp@bsdimp.com> To: obrien@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090125235322.GB25031@dragon.NUXI.org> References: <20090120012256.GB29741@dragon.NUXI.org> <20090119.191238.1389906774.imp@bsdimp.com> <20090125235322.GB25031@dragon.NUXI.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r187332 - head/tools/regression/usr.bin/jot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 00:36:10 -0000 In message: <20090125235322.GB25031@dragon.NUXI.org> "David O'Brien" writes: : On Mon, Jan 19, 2009 at 07:12:38PM -0700, M. Warner Losh wrote: : > I'm : > glad JUNOS can build inside its own VM. Kudos. But given that the : > world is much more than a tightly controlled development environment : > at a well funded company, I think that we need to be more : > accommodating. Especially for the embedded world. : : A minor correctly - JUNOS builds on STOCK FreeBSD running in a VM. : JUNOS does not host its own build. : : How is building FreeBSD under stock FreeBSD affected by how well : funded an entity is? Setting up and managing dozens of VMs for engineers without privs can be problematic. We use an emulation environment at work and the vm images are constantly getting corrupted. Warner From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 00:36:10 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F32431065686; Mon, 26 Jan 2009 00:36:09 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id ADD858FC0C; Mon, 26 Jan 2009 00:36:09 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n0Q0YLRs031019; Sun, 25 Jan 2009 17:34:21 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sun, 25 Jan 2009 17:35:05 -0700 (MST) Message-Id: <20090125.173505.1608379186.imp@bsdimp.com> To: obrien@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090125235013.GA25031@dragon.NUXI.org> References: <20090120012256.GB29741@dragon.NUXI.org> <20090119.191238.1389906774.imp@bsdimp.com> <20090125235013.GA25031@dragon.NUXI.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r187332 - head/tools/regression/usr.bin/jot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 00:36:11 -0000 In message: <20090125235013.GA25031@dragon.NUXI.org> "David O'Brien" writes: : On Mon, Jan 19, 2009 at 07:12:38PM -0700, M. Warner Losh wrote: : > In message: <20090120012256.GB29741@dragon.NUXI.org> "David O'Brien" writes: : > : On Mon, Jan 19, 2009 at 06:14:35PM -0700, M. Warner Losh wrote: : > : > In message: <20090119165030.GA18409@dragon.NUXI.org> "David O'Brien" writes: : > : > : Run VMware. Seriously. Or raise a serious discussion on developers@ : > : > : about this and get conciseness that cross building on MacOS X and : > : > : MS-Windows is a goal. : > : > : > : > I've tried this on my mac. It doesn't work very well at all, and it a : > : > pita for file sharing. : > : : > : Sorry - I don't quite follow. What is "it"? : : [ reply snipped ] : : Ok, I thought you were saying running FreeBSD under VMware doesn't work : very well. I know for a fact that is not the case. I also wasn't sure : what you meant by "pita for file sharing" as NFS certainly works in : FreeBSD on the VM. I know MS-Windows under VMware Workstation and MacOS : X can share a common folder, but I've never looked at if VMware tools for : FreeBSD has that functionality also. FreeBSD inside a VM on the mac is a bit of a pita to get all the file sharing stuff right. the pita is on the mac side, for the most part, but smbfs on FreeBSD is so slow that it isn't useful for anything but the most trivial of file sharing. Requiring a VM to build freebsd on a foreign host is a good stop-gap, but not a good long term plan. Warner From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 01:08:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FC591065670; Mon, 26 Jan 2009 01:08:24 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8CFFD8FC08; Mon, 26 Jan 2009 01:08:24 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0Q18Oqv032226; Mon, 26 Jan 2009 01:08:24 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0Q18Ohl032225; Mon, 26 Jan 2009 01:08:24 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200901260108.n0Q18Ohl032225@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 26 Jan 2009 01:08:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187702 - head/share/man/man4/man4.powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 01:08:25 -0000 Author: nwhitehorn Date: Mon Jan 26 01:08:24 2009 New Revision: 187702 URL: http://svn.freebsd.org/changeset/base/187702 Log: Somehow deleted the .4 at the end of the snd_davbus man page right before commit. Add it back. Pointy hat to: me Modified: head/share/man/man4/man4.powerpc/Makefile Modified: head/share/man/man4/man4.powerpc/Makefile ============================================================================== --- head/share/man/man4/man4.powerpc/Makefile Mon Jan 26 00:52:09 2009 (r187701) +++ head/share/man/man4/man4.powerpc/Makefile Mon Jan 26 01:08:24 2009 (r187702) @@ -4,7 +4,7 @@ MAN= bm.4 \ pmu.4 \ powermac_nvram.4 \ snd_ai2s.4 \ - snd_davbus + snd_davbus.4 MANSUBDIR=/powerpc From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 02:15:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8FD7106564A; Mon, 26 Jan 2009 02:15:22 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96EF28FC14; Mon, 26 Jan 2009 02:15:22 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0Q2FMFh033463; Mon, 26 Jan 2009 02:15:22 GMT (envelope-from trhodes@svn.freebsd.org) Received: (from trhodes@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0Q2FMr9033462; Mon, 26 Jan 2009 02:15:22 GMT (envelope-from trhodes@svn.freebsd.org) Message-Id: <200901260215.n0Q2FMr9033462@svn.freebsd.org> From: Tom Rhodes Date: Mon, 26 Jan 2009 02:15:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187703 - head/share/man/man7 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 02:15:23 -0000 Author: trhodes Date: Mon Jan 26 02:15:22 2009 New Revision: 187703 URL: http://svn.freebsd.org/changeset/base/187703 Log: Better description of kern.ipc.maxpipekva. Discussed with: kib Modified: head/share/man/man7/tuning.7 Modified: head/share/man/man7/tuning.7 ============================================================================== --- head/share/man/man7/tuning.7 Mon Jan 26 01:08:24 2009 (r187702) +++ head/share/man/man7/tuning.7 Mon Jan 26 02:15:22 2009 (r187703) @@ -403,13 +403,16 @@ on the system. .Pp The .Va kern.ipc.maxpipekva -loader tunable is used to set a hard limit on the amount of pageable -address space available. -This value is auto tuned by the system, but may require manual tuning -in a few rare cases. +loader tunable is used to set a hard limit on the +amount of kernel address space allocated to mapping of pipe buffers. +Use of the mapping allows the kernel to eliminate a copy of the +data from writer address space into the kernel, directly copying +the content of mapped buffer to the reader. Increasing this value to a higher setting, such as `25165824' might -improve performance on systems where pageable address space is -quickly exhausted. +improve performance on systems where space for mapping pipe buffers +is quickly exhausted. +This exhaustion is not fatal; however, and it will only cause pipes to +to fall back to use double-copy. .Pp The .Va kern.ipc.shm_use_phys From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 02:21:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C2A4106564A; Mon, 26 Jan 2009 02:21:26 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.187]) by mx1.freebsd.org (Postfix) with ESMTP id 16CC38FC14; Mon, 26 Jan 2009 02:21:24 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by fk-out-0910.google.com with SMTP id f40so2522349fka.11 for ; Sun, 25 Jan 2009 18:21:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=0yvfb8PHrRRTUwvqzzETDIMd1MK8Hm/MhnDaDC60jtU=; b=NJOBmnd2FGNy+OypQjIG5ZxybVRfyXN43hBfccZxXjb2TfShg9UgLFsM/K/ge3Rc/c aMdUu1179Kc2EGvlUjI7/oWMnGne8AeYPYNM6nrXqTlpP2em7GsNlWQRAizvbJqj8gNZ RDrilUJtdMdcoGm0S8eFVJBkZgexhQ/9At1bQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=C9Yazqwv43BNwRn9oW202bjNUWcAe54yw7xePDHS0GuJ8e03edl4uIcT2PXgRM5M/z 8yBarRLKZ/BczDpIauxmlRhRQVCmznWQKK8jNC2LllSMmUTnQK3b8n7OOn6WjDj8ru1X k2LloB5u/a98BFpiGoTAYi3ZUKZdisaqwo7EA= MIME-Version: 1.0 Received: by 10.181.31.16 with SMTP id i16mr1540145bkj.129.1232936483952; Sun, 25 Jan 2009 18:21:23 -0800 (PST) In-Reply-To: <20090125.173505.1608379186.imp@bsdimp.com> References: <20090120012256.GB29741@dragon.NUXI.org> <20090119.191238.1389906774.imp@bsdimp.com> <20090125235013.GA25031@dragon.NUXI.org> <20090125.173505.1608379186.imp@bsdimp.com> Date: Sun, 25 Jan 2009 18:21:23 -0800 Message-ID: <7d6fde3d0901251821u5aaec1afqc79f77c9423d2fe3@mail.gmail.com> From: Garrett Cooper To: "M. Warner Losh" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, obrien@freebsd.org Subject: Re: svn commit: r187332 - head/tools/regression/usr.bin/jot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 02:21:26 -0000 On Sun, Jan 25, 2009 at 4:35 PM, M. Warner Losh wrote: > In message: <20090125235013.GA25031@dragon.NUXI.org> > "David O'Brien" writes: > : On Mon, Jan 19, 2009 at 07:12:38PM -0700, M. Warner Losh wrote: > : > In message: <20090120012256.GB29741@dragon.NUXI.org> "David O'Brien" writes: > : > : On Mon, Jan 19, 2009 at 06:14:35PM -0700, M. Warner Losh wrote: > : > : > In message: <20090119165030.GA18409@dragon.NUXI.org> "David O'Brien" writes: > : > : > : Run VMware. Seriously. Or raise a serious discussion on developers@ > : > : > : about this and get conciseness that cross building on MacOS X and > : > : > : MS-Windows is a goal. > : > : > > : > : > I've tried this on my mac. It doesn't work very well at all, and it a > : > : > pita for file sharing. > : > : > : > : Sorry - I don't quite follow. What is "it"? > : > : [ reply snipped ] > : > : Ok, I thought you were saying running FreeBSD under VMware doesn't work > : very well. I know for a fact that is not the case. I also wasn't sure > : what you meant by "pita for file sharing" as NFS certainly works in > : FreeBSD on the VM. I know MS-Windows under VMware Workstation and MacOS > : X can share a common folder, but I've never looked at if VMware tools for > : FreeBSD has that functionality also. > > FreeBSD inside a VM on the mac is a bit of a pita to get all the file > sharing stuff right. the pita is on the mac side, for the most part, > but smbfs on FreeBSD is so slow that it isn't useful for anything but > the most trivial of file sharing. > > Requiring a VM to build freebsd on a foreign host is a good stop-gap, > but not a good long term plan. > > Warner Not just that -- the performance for buildworld, etc is horrid and when you put the clock to sleep it tends to muck up the VM quite a bit under freebsd so you have to go fudging around with a constantly skewing clock. I only use a VMware Fusion image because I don't want to run RELENG_7 on my boxes (I run 8-CURRENT instead). Cheers, -Garrett From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 02:22:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E3D3106566C; Mon, 26 Jan 2009 02:22:25 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from mail-fx0-f15.google.com (mail-fx0-f15.google.com [209.85.220.15]) by mx1.freebsd.org (Postfix) with ESMTP id 233878FC08; Mon, 26 Jan 2009 02:22:23 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by fxm8 with SMTP id 8so54212fxm.19 for ; Sun, 25 Jan 2009 18:22:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=zdMu3Jd10M46Gwzh7yjr2lDC3Ki1ezggitoT5kB4wF4=; b=BpMEqq3KcqDt3QZJssySrK87rE0Sv+uEKANxePIoxVQpyjbdSZ5njAUWXml3hf4sqc e8Zu6gA0nslUXlgHaG4A0ktJ3z88jBvIafrw8homCVN9IZvCUtzvdRC9arDQWnxCEam7 3Fbg22RUz5jlTzGRWUWwaI+hVsVB5VvY7Uqx0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=m2mrRvacYuK+cVrdDpcm7xxiaW2F6Bq2u3yyUlqQwCKMJPDVSqOJwGk20TrhSGs1AS rZO/F7b5EiVHg8UNc7xcG27LOIXO1lFtYDjJW6cHx0RqTd6E8A83M/WQ2mYhV0LtAl3Q KO+6JTlIlzG3uIWt2oTQrIaFTM7/dTg2sMkW4= MIME-Version: 1.0 Received: by 10.181.156.12 with SMTP id i12mr1798732bko.140.1232936543035; Sun, 25 Jan 2009 18:22:23 -0800 (PST) In-Reply-To: <20090125.173558.1731231004.imp@bsdimp.com> References: <20090120012256.GB29741@dragon.NUXI.org> <20090119.191238.1389906774.imp@bsdimp.com> <20090125235322.GB25031@dragon.NUXI.org> <20090125.173558.1731231004.imp@bsdimp.com> Date: Sun, 25 Jan 2009 18:22:22 -0800 Message-ID: <7d6fde3d0901251822o41b128c0h5770ecbcf407e302@mail.gmail.com> From: Garrett Cooper To: "M. Warner Losh" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, obrien@freebsd.org Subject: Re: svn commit: r187332 - head/tools/regression/usr.bin/jot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 02:22:25 -0000 On Sun, Jan 25, 2009 at 4:35 PM, M. Warner Losh wrote: > In message: <20090125235322.GB25031@dragon.NUXI.org> > "David O'Brien" writes: > : On Mon, Jan 19, 2009 at 07:12:38PM -0700, M. Warner Losh wrote: > : > I'm > : > glad JUNOS can build inside its own VM. Kudos. But given that the > : > world is much more than a tightly controlled development environment > : > at a well funded company, I think that we need to be more > : > accommodating. Especially for the embedded world. > : > : A minor correctly - JUNOS builds on STOCK FreeBSD running in a VM. > : JUNOS does not host its own build. > : > : How is building FreeBSD under stock FreeBSD affected by how well > : funded an entity is? > > Setting up and managing dozens of VMs for engineers without privs can > be problematic. We use an emulation environment at work and the vm > images are constantly getting corrupted. > > Warner But that's because it's QEMU -- QEMU is crap compared to VMware for x86 emulation still... QEMU/ppc is even worse, but it's the only ppc emulator that's freely available out there. -Garrett From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 02:27:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48E401065680; Mon, 26 Jan 2009 02:27:04 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from mail-fx0-f15.google.com (mail-fx0-f15.google.com [209.85.220.15]) by mx1.freebsd.org (Postfix) with ESMTP id 553338FC0A; Mon, 26 Jan 2009 02:27:03 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by fxm8 with SMTP id 8so54669fxm.19 for ; Sun, 25 Jan 2009 18:27:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=TDfz/Y4YsPtnlxw6hR2m1UOvlEyViEDTFr/+Ram5bPI=; b=l4HUsIvaHuJcXiyM58g6DpYyNz18VjfGzZzGBUZKg0Oh95PELaedzZ/OUlu6pshw9e b30+Ox6ipadEVbp1PdlblXSpSijpMpwdxDStlxbYGzfbeaUnE2pNmkEypTRAvBeGo+cH PetN0LrT6YnEoV5lkbuWbrULVx25HXDuYj8x0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=nRHxJnD4yBZ0+F8o4GX33M+wsKlud7gQbsRV73sxLp91EklA7mn6u/kyO+J+vDULJc a3H79KDw6qdWFlCipxe8zLUBZ/DCSg2GrNoL0YvQOkjbeetpDvRKfMul8TTgA+c9mzgq NsGBhBLVRweYQVKXCsFoFIY6Cn9DDHWjrrZ2I= MIME-Version: 1.0 Received: by 10.181.205.9 with SMTP id h9mr89661bkq.196.1232936822372; Sun, 25 Jan 2009 18:27:02 -0800 (PST) In-Reply-To: <7d6fde3d0901251822o41b128c0h5770ecbcf407e302@mail.gmail.com> References: <20090120012256.GB29741@dragon.NUXI.org> <20090119.191238.1389906774.imp@bsdimp.com> <20090125235322.GB25031@dragon.NUXI.org> <20090125.173558.1731231004.imp@bsdimp.com> <7d6fde3d0901251822o41b128c0h5770ecbcf407e302@mail.gmail.com> Date: Sun, 25 Jan 2009 18:27:02 -0800 Message-ID: <7d6fde3d0901251827i7a4717eby5600efeff9be57c4@mail.gmail.com> From: Garrett Cooper To: "M. Warner Losh" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, obrien@freebsd.org Subject: Re: svn commit: r187332 - head/tools/regression/usr.bin/jot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 02:27:04 -0000 On Sun, Jan 25, 2009 at 6:22 PM, Garrett Cooper wrote: > On Sun, Jan 25, 2009 at 4:35 PM, M. Warner Losh wrote: >> In message: <20090125235322.GB25031@dragon.NUXI.org> >> "David O'Brien" writes: >> : On Mon, Jan 19, 2009 at 07:12:38PM -0700, M. Warner Losh wrote: >> : > I'm >> : > glad JUNOS can build inside its own VM. Kudos. But given that the >> : > world is much more than a tightly controlled development environment >> : > at a well funded company, I think that we need to be more >> : > accommodating. Especially for the embedded world. >> : >> : A minor correctly - JUNOS builds on STOCK FreeBSD running in a VM. >> : JUNOS does not host its own build. >> : >> : How is building FreeBSD under stock FreeBSD affected by how well >> : funded an entity is? >> >> Setting up and managing dozens of VMs for engineers without privs can >> be problematic. We use an emulation environment at work and the vm >> images are constantly getting corrupted. >> >> Warner > > But that's because it's QEMU -- QEMU is crap compared to VMware > for x86 emulation still... QEMU/ppc is even worse, but it's the only > ppc emulator that's freely available out there. > -Garrett I take that back. There's PearPC and GXemul, but I'm pretty sure they're not as good as the prep port of QEMU. -Garrett From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 03:07:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5D661065670 for ; Mon, 26 Jan 2009 03:07:29 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.171]) by mx1.freebsd.org (Postfix) with ESMTP id B8EBE8FC22 for ; Mon, 26 Jan 2009 03:07:29 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: by wf-out-1314.google.com with SMTP id 24so6161482wfg.7 for ; Sun, 25 Jan 2009 19:07:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=PYKZFm/WIS62GQXRiyyMgqStE3+w5d9nOCbB/89lQkE=; b=pihny7kTsTyp2Ic3BNy2xLeRr7nSuPuGjppXU+boSYS+NEzwtEiGylGXg8RtQENbay NA0ChxPP2f9IL/i1p641lHUY0VnKO3zyJuX+AAJM/gQg0ayrwD96SMu55zEYRhOcsrTb F1jBODuJnMKGgUhXx1ZN2u0WWRmPgJzbu3YFA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=pxKAwawqvYDBq2fNzuEsd69gD/eSXoN43C6HuKfFjqYweEDNIdAEKwQeLLVpaug2OG P0k5O5XaCB5TJnP0SQOOkZs0qTCQ9wE3N9OdZLil0umB+gwgawY98BNhP3xzGI+fOp1V pSz29ZOI2VI4S6xNYQSn8CQjRg8WFlF3KrLpw= MIME-Version: 1.0 Received: by 10.143.42.6 with SMTP id u6mr2075015wfj.144.1232937431738; Sun, 25 Jan 2009 18:37:11 -0800 (PST) In-Reply-To: <200901252308.n0PN8lvg030020@svn.freebsd.org> References: <200901252308.n0PN8lvg030020@svn.freebsd.org> Date: Sun, 25 Jan 2009 21:37:11 -0500 Message-ID: <47d0403c0901251837k4ea0fdk4ccaa8774c791634@mail.gmail.com> From: Ben Kaduk To: Xin LI Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187700 - head/lib/libc/string X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 03:07:30 -0000 On Sun, Jan 25, 2009 at 6:08 PM, Xin LI wrote: > Author: delphij > Date: Sun Jan 25 23:08:47 2009 > New Revision: 187700 > URL: http://svn.freebsd.org/changeset/base/187700 > > Log: > Rewrite of MI strlen(3) in a way that can better utilize modern hardware by > reducing branches and doing word-sized operation. > > The idea is taken from J.T. Conklin's x86_64 optimized version of strlen(3) > for NetBSD, and reimplemented in C by me. > > Discussed on: -arch@ > > Modified: > head/lib/libc/string/strlen.c > > Modified: head/lib/libc/string/strlen.c > ============================================================================== > --- head/lib/libc/string/strlen.c Sun Jan 25 21:27:31 2009 (r187699) > +++ head/lib/libc/string/strlen.c Sun Jan 25 23:08:47 2009 (r187700) > @@ -1,6 +1,6 @@ > /*- > - * Copyright (c) 1990, 1993 > - * The Regents of the University of California. All rights reserved. > + * Copyright (c) 2009 Xin LI > + * All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > @@ -10,14 +10,11 @@ > * 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 > + * 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 REGENTS OR CONTRIBUTORS 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) > @@ -27,21 +24,87 @@ > * SUCH DAMAGE. > */ > > -#if defined(LIBC_SCCS) && !defined(lint) > -static char sccsid[] = "@(#)strlen.c 8.1 (Berkeley) 6/4/93"; > -#endif /* LIBC_SCCS and not lint */ > #include > __FBSDID("$FreeBSD$"); > > +#include > +#include > #include > > +/* > + * Portable strlen() for 32-bit and 64-bit systems. > + * > + * Rationale: it is generally much more efficient to do word length > + * operations and avoid branches on modern computer systems, as > + * compared to byte-length operations with a lot of branches. > + * > + * The expression: > + * > + * ((x - 0x01....01) & ~x & 0x80....80) > + * > + * would evaluate to a non-zero value iff any of the bytes in the > + * original word is zero. However, we can further reduce ~1/3 of > + * time if we consider that strlen() usually operate on 7-bit ASCII > + * by employing the following expression, which allows false positive > + * when high bit of 1 and use the tail case to catch these case: > + * > + * ((x - 0x01....01) & 0x80....80) > + * > + * This is more than 5.2 times as compared to the raw implementation > + * on Intel T7300 under EM64T mode for strings longer than word length. The grammar is not quite right, here. Did you mean to say "more than 5.2 times as fast as the raw implementation [...]" -Ben Kaduk From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 03:18:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB2E41065676; Mon, 26 Jan 2009 03:18:04 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 85BF28FC13; Mon, 26 Jan 2009 03:18:04 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n0Q3FQOJ032426; Sun, 25 Jan 2009 20:15:26 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sun, 25 Jan 2009 20:16:10 -0700 (MST) Message-Id: <20090125.201610.-419491155.imp@bsdimp.com> To: yanefbsd@gmail.com From: "M. Warner Losh" In-Reply-To: <7d6fde3d0901251822o41b128c0h5770ecbcf407e302@mail.gmail.com> References: <20090125235322.GB25031@dragon.NUXI.org> <20090125.173558.1731231004.imp@bsdimp.com> <7d6fde3d0901251822o41b128c0h5770ecbcf407e302@mail.gmail.com> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, obrien@freebsd.org Subject: Re: svn commit: r187332 - head/tools/regression/usr.bin/jot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 03:18:05 -0000 In message: <7d6fde3d0901251822o41b128c0h5770ecbcf407e302@mail.gmail.com> Garrett Cooper writes: : On Sun, Jan 25, 2009 at 4:35 PM, M. Warner Losh wrote: : > In message: <20090125235322.GB25031@dragon.NUXI.org> : > "David O'Brien" writes: : > : On Mon, Jan 19, 2009 at 07:12:38PM -0700, M. Warner Losh wrote: : > : > I'm : > : > glad JUNOS can build inside its own VM. Kudos. But given that the : > : > world is much more than a tightly controlled development environment : > : > at a well funded company, I think that we need to be more : > : > accommodating. Especially for the embedded world. : > : : > : A minor correctly - JUNOS builds on STOCK FreeBSD running in a VM. : > : JUNOS does not host its own build. : > : : > : How is building FreeBSD under stock FreeBSD affected by how well : > : funded an entity is? : > : > Setting up and managing dozens of VMs for engineers without privs can : > be problematic. We use an emulation environment at work and the vm : > images are constantly getting corrupted. : > : > Warner : : But that's because it's QEMU -- QEMU is crap compared to VMware : for x86 emulation still... QEMU/ppc is even worse, but it's the only : ppc emulator that's freely available out there. Well, no. that's not because the emuation is crap. It is because the image that it boots off of doesn't get shut down cleanly and there's a number of buffers that don't get flushed leading to corruption... Warner From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 05:44:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E6EB106566C; Mon, 26 Jan 2009 05:44:41 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2BF9D8FC14; Mon, 26 Jan 2009 05:44:41 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0Q5if2F037940; Mon, 26 Jan 2009 05:44:41 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0Q5ifeI037937; Mon, 26 Jan 2009 05:44:41 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200901260544.n0Q5ifeI037937@svn.freebsd.org> From: Tim Kientzle Date: Mon, 26 Jan 2009 05:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187704 - in head/lib/libarchive: . test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 05:44:41 -0000 Author: kientzle Date: Mon Jan 26 05:44:40 2009 New Revision: 187704 URL: http://svn.freebsd.org/changeset/base/187704 Log: Fix ARCHIVE_EXTRACT_SPARSE handling in libarchive. Add a test to exercise this feature. This should fix --sparse/-S support in tar. Thanks to: Daichi GOTO MFC after: 1 week Added: head/lib/libarchive/test/test_write_disk_sparse.c (contents, props changed) Modified: head/lib/libarchive/archive_write_disk.c head/lib/libarchive/test/Makefile Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Mon Jan 26 02:15:22 2009 (r187703) +++ head/lib/libarchive/archive_write_disk.c Mon Jan 26 05:44:40 2009 (r187704) @@ -178,6 +178,8 @@ struct archive_write_disk { int fd; /* Current offset for writing data to the file. */ off_t offset; + /* Last offset actually written to disk. */ + off_t fd_offset; /* Maximum size of file, -1 if unknown. */ off_t filesize; /* Dir we were in before this restore; only for deep paths. */ @@ -187,8 +189,6 @@ struct archive_write_disk { /* UID/GID to use in restoring this entry. */ uid_t uid; gid_t gid; - /* Last offset written to disk. */ - off_t last_offset; }; /* @@ -235,7 +235,7 @@ static struct fixup_entry *sort_dir_list static gid_t trivial_lookup_gid(void *, const char *, gid_t); static uid_t trivial_lookup_uid(void *, const char *, uid_t); static ssize_t write_data_block(struct archive_write_disk *, - const char *, size_t, off_t); + const char *, size_t); static struct archive_vtable *archive_write_disk_vtable(void); @@ -337,7 +337,7 @@ _archive_write_header(struct archive *_a } a->entry = archive_entry_clone(entry); a->fd = -1; - a->last_offset = 0; + a->fd_offset = 0; a->offset = 0; a->uid = a->user_uid; a->mode = archive_entry_mode(a->entry); @@ -513,9 +513,9 @@ archive_write_disk_set_skip_file(struct } static ssize_t -write_data_block(struct archive_write_disk *a, - const char *buff, size_t size, off_t offset) +write_data_block(struct archive_write_disk *a, const char *buff, size_t size) { + uint64_t start_size = size; ssize_t bytes_written = 0; ssize_t block_size = 0, bytes_to_write; @@ -538,8 +538,9 @@ write_data_block(struct archive_write_di #endif } - if (a->filesize >= 0 && (off_t)(offset + size) > a->filesize) - size = (size_t)(a->filesize - offset); + /* If this write would run beyond the file size, truncate it. */ + if (a->filesize >= 0 && (off_t)(a->offset + size) > a->filesize) + start_size = size = (size_t)(a->filesize - a->offset); /* Write the data. */ while (size > 0) { @@ -555,7 +556,7 @@ write_data_block(struct archive_write_di if (*p != '\0') break; } - offset += p - buff; + a->offset += p - buff; size -= p - buff; buff = p; if (size == 0) @@ -563,22 +564,25 @@ write_data_block(struct archive_write_di /* Calculate next block boundary after offset. */ block_end - = (offset / block_size) * block_size + block_size; + = (a->offset / block_size + 1) * block_size; /* If the adjusted write would cross block boundary, * truncate it to the block boundary. */ bytes_to_write = size; - if (offset + bytes_to_write > block_end) - bytes_to_write = block_end - offset; + if (a->offset + bytes_to_write > block_end) + bytes_to_write = block_end - a->offset; } /* Seek if necessary to the specified offset. */ - if (offset != a->last_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); } + a->fd_offset = a->offset; + a->archive.file_position = a->offset; + a->archive.raw_position = a->offset; } bytes_written = write(a->fd, buff, bytes_to_write); if (bytes_written < 0) { @@ -587,12 +591,12 @@ write_data_block(struct archive_write_di } buff += bytes_written; size -= bytes_written; - offset += bytes_written; + a->offset += bytes_written; a->archive.file_position += bytes_written; a->archive.raw_position += bytes_written; - a->last_offset = a->offset = offset; + a->fd_offset = a->offset; } - return (bytes_written); + return (start_size - size); } static ssize_t @@ -605,9 +609,9 @@ _archive_write_data_block(struct archive __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, ARCHIVE_STATE_DATA, "archive_write_disk_block"); - r = write_data_block(a, buff, size, offset); - - if (r < 0) + a->offset = offset; + r = write_data_block(a, buff, size); + if (r < ARCHIVE_OK) return (r); if ((size_t)r < size) { archive_set_error(&a->archive, 0, @@ -625,7 +629,7 @@ _archive_write_data(struct archive *_a, __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, ARCHIVE_STATE_DATA, "archive_write_data"); - return (write_data_block(a, buff, size, a->offset)); + return (write_data_block(a, buff, size)); } static int @@ -646,7 +650,7 @@ _archive_write_finish_entry(struct archi /* There's no file. */ } else if (a->filesize < 0) { /* File size is unknown, so we can't set the size. */ - } else if (a->last_offset == a->filesize) { + } else if (a->fd_offset == a->filesize) { /* Last write ended at exactly the filesize; we're done. */ /* Hopefully, this is the common case. */ } else { Modified: head/lib/libarchive/test/Makefile ============================================================================== --- head/lib/libarchive/test/Makefile Mon Jan 26 02:15:22 2009 (r187703) +++ head/lib/libarchive/test/Makefile Mon Jan 26 05:44:40 2009 (r187704) @@ -62,6 +62,7 @@ TESTS= \ test_write_disk_hardlink.c \ test_write_disk_perms.c \ test_write_disk_secure.c \ + test_write_disk_sparse.c \ test_write_disk_times.c \ test_write_format_ar.c \ test_write_format_cpio.c \ Added: head/lib/libarchive/test/test_write_disk_sparse.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_write_disk_sparse.c Mon Jan 26 05:44:40 2009 (r187704) @@ -0,0 +1,278 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * 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(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* + * Write a file using archive_write_data call, read the file + * back and verify the contents. The data written includes large + * blocks of nulls, so it should exercise the sparsification logic + * if ARCHIVE_EXTRACT_SPARSE is enabled. + */ +static void +verify_write_data(struct archive *a, int sparse) +{ + static const char data[]="abcdefghijklmnopqrstuvwxyz"; + struct stat st; + struct archive_entry *ae; + size_t buff_size = 64 * 1024; + char *buff, *p; + const char *msg = sparse ? "sparse" : "non-sparse"; + int fd; + + buff = malloc(buff_size); + assert(buff != NULL); + + ae = archive_entry_new(); + assert(ae != NULL); + archive_entry_set_size(ae, 8 * buff_size); + archive_entry_set_pathname(ae, "test_write_data"); + archive_entry_set_mode(ae, AE_IFREG | 0755); + assertEqualIntA(a, 0, archive_write_header(a, ae)); + + /* Use archive_write_data() to write three relatively sparse blocks. */ + + /* First has non-null data at beginning. */ + memset(buff, 0, buff_size); + memcpy(buff, data, sizeof(data)); + failure("%s", msg); + assertEqualInt(buff_size, archive_write_data(a, buff, buff_size)); + + /* Second has non-null data in the middle. */ + memset(buff, 0, buff_size); + memcpy(buff + buff_size / 2 - 3, data, sizeof(data)); + failure("%s", msg); + assertEqualInt(buff_size, archive_write_data(a, buff, buff_size)); + + /* Third has non-null data at the end. */ + memset(buff, 0, buff_size); + memcpy(buff + buff_size - sizeof(data), data, sizeof(data)); + failure("%s", msg); + assertEqualInt(buff_size, archive_write_data(a, buff, buff_size)); + + failure("%s", msg); + assertEqualIntA(a, 0, archive_write_finish_entry(a)); + + /* Test the entry on disk. */ + assert(0 == stat(archive_entry_pathname(ae), &st)); + assertEqualInt(st.st_size, 8 * buff_size); + fd = open(archive_entry_pathname(ae), O_RDONLY); + if (!assert(fd >= 0)) + return; + + /* Check first block. */ + assertEqualInt(buff_size, read(fd, buff, buff_size)); + failure("%s", msg); + assertEqualMem(buff, data, sizeof(data)); + for (p = buff + sizeof(data); p < buff + buff_size; ++p) { + failure("offset: %d, %s", (int)(p - buff), msg); + if (!assertEqualInt(0, *p)) + break; + } + + /* Check second block. */ + assertEqualInt(buff_size, read(fd, buff, buff_size)); + for (p = buff; p < buff + buff_size; ++p) { + failure("offset: %d, %s", (int)(p - buff), msg); + if (p == buff + buff_size / 2 - 3) { + assertEqualMem(p, data, sizeof(data)); + p += sizeof(data); + } else if (!assertEqualInt(0, *p)) + break; + } + + /* Check third block. */ + assertEqualInt(buff_size, read(fd, buff, buff_size)); + for (p = buff; p < buff + buff_size - sizeof(data); ++p) { + failure("offset: %d, %s", (int)(p - buff), msg); + if (!assertEqualInt(0, *p)) + break; + } + failure("%s", msg); + assertEqualMem(buff + buff_size - sizeof(data), data, sizeof(data)); + + /* XXX more XXX */ + + assertEqualInt(0, close(fd)); + free(buff); +} + +/* + * As above, but using the archive_write_data_block() call. + */ +static void +verify_write_data_block(struct archive *a, int sparse) +{ + static const char data[]="abcdefghijklmnopqrstuvwxyz"; + struct stat st; + struct archive_entry *ae; + size_t buff_size = 64 * 1024; + char *buff, *p; + const char *msg = sparse ? "sparse" : "non-sparse"; + int fd; + + buff = malloc(buff_size); + assert(buff != NULL); + + ae = archive_entry_new(); + assert(ae != NULL); + archive_entry_set_size(ae, 8 * buff_size); + archive_entry_set_pathname(ae, "test_write_data_block"); + archive_entry_set_mode(ae, AE_IFREG | 0755); + assertEqualIntA(a, 0, archive_write_header(a, ae)); + + /* Use archive_write_data_block() to write three + relatively sparse blocks. */ + + /* First has non-null data at beginning. */ + memset(buff, 0, buff_size); + memcpy(buff, data, sizeof(data)); + failure("%s", msg); + assertEqualInt(ARCHIVE_OK, + archive_write_data_block(a, buff, buff_size, 100)); + + /* Second has non-null data in the middle. */ + memset(buff, 0, buff_size); + memcpy(buff + buff_size / 2 - 3, data, sizeof(data)); + failure("%s", msg); + assertEqualInt(ARCHIVE_OK, + archive_write_data_block(a, buff, buff_size, buff_size + 200)); + + /* Third has non-null data at the end. */ + memset(buff, 0, buff_size); + memcpy(buff + buff_size - sizeof(data), data, sizeof(data)); + failure("%s", msg); + assertEqualInt(ARCHIVE_OK, + archive_write_data_block(a, buff, buff_size, buff_size * 2 + 300)); + + failure("%s", msg); + assertEqualIntA(a, 0, archive_write_finish_entry(a)); + + /* Test the entry on disk. */ + assert(0 == stat(archive_entry_pathname(ae), &st)); + assertEqualInt(st.st_size, 8 * buff_size); + fd = open(archive_entry_pathname(ae), O_RDONLY); + if (!assert(fd >= 0)) + return; + + /* Check 100-byte gap at beginning */ + assertEqualInt(100, read(fd, buff, 100)); + failure("%s", msg); + for (p = buff; p < buff + 100; ++p) { + failure("offset: %d, %s", (int)(p - buff), msg); + if (!assertEqualInt(0, *p)) + break; + } + + /* Check first block. */ + assertEqualInt(buff_size, read(fd, buff, buff_size)); + failure("%s", msg); + assertEqualMem(buff, data, sizeof(data)); + for (p = buff + sizeof(data); p < buff + buff_size; ++p) { + failure("offset: %d, %s", (int)(p - buff), msg); + if (!assertEqualInt(0, *p)) + break; + } + + /* Check 100-byte gap */ + assertEqualInt(100, read(fd, buff, 100)); + failure("%s", msg); + for (p = buff; p < buff + 100; ++p) { + failure("offset: %d, %s", (int)(p - buff), msg); + if (!assertEqualInt(0, *p)) + break; + } + + /* Check second block. */ + assertEqualInt(buff_size, read(fd, buff, buff_size)); + for (p = buff; p < buff + buff_size; ++p) { + failure("offset: %d, %s", (int)(p - buff), msg); + if (p == buff + buff_size / 2 - 3) { + assertEqualMem(p, data, sizeof(data)); + p += sizeof(data); + } else if (!assertEqualInt(0, *p)) + break; + } + + /* Check 100-byte gap */ + assertEqualInt(100, read(fd, buff, 100)); + failure("%s", msg); + for (p = buff; p < buff + 100; ++p) { + failure("offset: %d, %s", (int)(p - buff), msg); + if (!assertEqualInt(0, *p)) + break; + } + + /* Check third block. */ + assertEqualInt(buff_size, read(fd, buff, buff_size)); + for (p = buff; p < buff + buff_size - sizeof(data); ++p) { + failure("offset: %d, %s", (int)(p - buff), msg); + if (!assertEqualInt(0, *p)) + break; + } + failure("%s", msg); + assertEqualMem(buff + buff_size - sizeof(data), data, sizeof(data)); + + /* Check another block size beyond last we wrote. */ + assertEqualInt(buff_size, read(fd, buff, buff_size)); + failure("%s", msg); + for (p = buff; p < buff + buff_size; ++p) { + failure("offset: %d, %s", (int)(p - buff), msg); + if (!assertEqualInt(0, *p)) + break; + } + + + /* XXX more XXX */ + + assertEqualInt(0, close(fd)); + free(buff); +} + +DEFINE_TEST(test_write_disk_sparse) +{ + struct archive *ad; + + + /* + * The return values, etc, of the write data functions + * shouldn't change regardless of whether we've requested + * sparsification. (The performance and pattern of actual + * write calls to the disk should vary, of course, but the + * client program shouldn't see any difference.) + */ + assert((ad = archive_write_disk_new()) != NULL); + archive_write_disk_set_options(ad, 0); + verify_write_data(ad, 0); + verify_write_data_block(ad, 0); + assertEqualInt(0, archive_write_finish(ad)); + + assert((ad = archive_write_disk_new()) != NULL); + archive_write_disk_set_options(ad, ARCHIVE_EXTRACT_SPARSE); + verify_write_data(ad, 1); + verify_write_data_block(ad, 1); + assertEqualInt(0, archive_write_finish(ad)); + +} From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 07:31:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CF481065670; Mon, 26 Jan 2009 07:31:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B6E58FC14; Mon, 26 Jan 2009 07:31:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0Q7VSnn040805; Mon, 26 Jan 2009 07:31:28 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0Q7VS5Z040804; Mon, 26 Jan 2009 07:31:28 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200901260731.n0Q7VS5Z040804@svn.freebsd.org> From: Xin LI Date: Mon, 26 Jan 2009 07:31:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187707 - head/lib/libc/string X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 07:31:28 -0000 Author: delphij Date: Mon Jan 26 07:31:28 2009 New Revision: 187707 URL: http://svn.freebsd.org/changeset/base/187707 Log: - Fix grammar. [1] - Use the correct term 'long mode'. [2] - style(9) for return value. [3] Submitted by: Ben Kaduk [1], obrien [2], scf [3] Modified: head/lib/libc/string/strlen.c Modified: head/lib/libc/string/strlen.c ============================================================================== --- head/lib/libc/string/strlen.c Mon Jan 26 06:14:42 2009 (r187706) +++ head/lib/libc/string/strlen.c Mon Jan 26 07:31:28 2009 (r187707) @@ -50,8 +50,8 @@ __FBSDID("$FreeBSD$"); * * ((x - 0x01....01) & 0x80....80) * - * This is more than 5.2 times as compared to the raw implementation - * on Intel T7300 under EM64T mode for strings longer than word length. + * This is more than 5.2 times as fast as the raw implementation on + * Intel T7300 under long mode for strings longer than word length. */ /* Magic numbers for the algorithm */ @@ -105,6 +105,6 @@ strlen(const char *str) } /* NOTREACHED */ - return 0; + return (0); } From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 07:36:02 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AFB21065672; Mon, 26 Jan 2009 07:36:02 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.delphij.net (delphij-pt.tunnel.tserv2.fmt.ipv6.he.net [IPv6:2001:470:1f03:2c9::2]) by mx1.freebsd.org (Postfix) with ESMTP id AEB4F8FC1C; Mon, 26 Jan 2009 07:36:01 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.geekcn.org (tarsier.geekcn.org [211.166.10.233]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tarsier.delphij.net (Postfix) with ESMTPS id 91AC12844E; Mon, 26 Jan 2009 15:36:00 +0800 (CST) Received: from localhost (tarsier.geekcn.org [211.166.10.233]) by tarsier.geekcn.org (Postfix) with ESMTP id 3CEDCEB6319; Mon, 26 Jan 2009 15:35:59 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([211.166.10.233]) by localhost (mail.geekcn.org [211.166.10.233]) (amavisd-new, port 10024) with ESMTP id tyKVcbM88JoP; Mon, 26 Jan 2009 15:35:53 +0800 (CST) Received: from charlie.delphij.net (c-67-188-86-134.hsd1.ca.comcast.net [67.188.86.134]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTPSA id D51F7EB62EF; Mon, 26 Jan 2009 15:35:50 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:reply-to:organization:user-agent: mime-version:to:cc:subject:references:in-reply-to: x-enigmail-version:openpgp:content-type:content-transfer-encoding; b=N4ueZ5zIKg2c/Np1Lby8NS/Oj15Xdfyy8B178FDJQ1Bd/BMQ41KFNrOFgyxl/cRxv sTCF3sCb5r1ceCg/WYQNg== Message-ID: <497D67D4.4010100@delphij.net> Date: Sun, 25 Jan 2009 23:35:48 -0800 From: Xin LI Organization: The FreeBSD Project User-Agent: Thunderbird 2.0.0.19 (X11/20090112) MIME-Version: 1.0 To: Ben Kaduk References: <200901252308.n0PN8lvg030020@svn.freebsd.org> <47d0403c0901251837k4ea0fdk4ccaa8774c791634@mail.gmail.com> In-Reply-To: <47d0403c0901251837k4ea0fdk4ccaa8774c791634@mail.gmail.com> X-Enigmail-Version: 0.95.7 OpenPGP: id=18EDEBA0; url=http://www.delphij.net/delphij.asc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Xin LI Subject: Re: svn commit: r187700 - head/lib/libc/string X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 07:36:05 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ben Kaduk wrote: [...] >> + * >> + * This is more than 5.2 times as compared to the raw implementation >> + * on Intel T7300 under EM64T mode for strings longer than word length. > > The grammar is not quite right, here. Did you mean to say "more than 5.2 > times as fast as the raw implementation [...]" Yes I believe that you are right here, thanks! Fixed. Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) iEYEARECAAYFAkl9Z9QACgkQi+vbBBjt66B+NQCgwYwHTSS4qjmvJjnkwGTE88uY F+gAn2B8aOQm4qFUCXWwZrrRrLyQ/31t =rGR3 -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 08:35:25 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 752A1106564A; Mon, 26 Jan 2009 08:35:25 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85]) by mx1.freebsd.org (Postfix) with ESMTP id 52F948FC12; Mon, 26 Jan 2009 08:35:25 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1]) by dragon.nuxi.org (8.14.2/8.14.2) with ESMTP id n0Q8ZI3Z041744; Mon, 26 Jan 2009 00:35:18 -0800 (PST) (envelope-from obrien@dragon.nuxi.org) Received: (from obrien@localhost) by dragon.nuxi.org (8.14.2/8.14.2/Submit) id n0Q8ZIH4041743; Mon, 26 Jan 2009 00:35:18 -0800 (PST) (envelope-from obrien) Date: Mon, 26 Jan 2009 00:35:18 -0800 From: "David O'Brien" To: "M. Warner Losh" Message-ID: <20090126083518.GB87007@dragon.NUXI.org> References: <200901220621.n0M6LU5v002745@svn.freebsd.org> <20090122.104114.1927899760.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090122.104114.1927899760.imp@bsdimp.com> X-Operating-System: FreeBSD 8.0-CURRENT User-Agent: Mutt/1.5.16 (2007-06-09) Cc: svn-src-head@FreeBSD.org, jeff@FreeBSD.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r187580 - head/tools/sched X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 08:35:26 -0000 On Thu, Jan 22, 2009 at 10:41:14AM -0700, M. Warner Losh wrote: > In message: <200901220621.n0M6LU5v002745@svn.freebsd.org> > Jeff Roberson writes: > : Author: jeff > : Date: Thu Jan 22 06:21:30 2009 > : New Revision: 187580 > : URL: http://svn.freebsd.org/changeset/base/187580 > : > : Log: > : - Update my copyright. > : +# Copyright (c) 2002-2003, 2009, Jeffrey Roberson > > Stylistically, this should be 2002-2009. We don't need to list each > and every year, so the project's policy is to list the earliest and > the latest year. There is debate on this. GCC/Bintuils/GDB require years to be specifically listed in which changes occur. Generally this means discrete years, but I believe "2002-2003, 2009" maybe accepted also. The listed years should not imply changes happened in years there was no change, which 2002-2009 would imply. This is also what the lawyers at work require. > See, for example, http://www.oppedahl.com/copyrights/ for the > reasoning behind this. Unfortunately this returns "(61) Connection refused". -- -- David (obrien@FreeBSD.org) From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 12:59:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81771106566B; Mon, 26 Jan 2009 12:59:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E06F8FC1A; Mon, 26 Jan 2009 12:59:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QCxBpM050257; Mon, 26 Jan 2009 12:59:11 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QCxBMr050254; Mon, 26 Jan 2009 12:59:11 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200901261259.n0QCxBMr050254@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 26 Jan 2009 12:59:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187708 - in head: etc/defaults etc/rc.d share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 12:59:12 -0000 Author: bz Date: Mon Jan 26 12:59:11 2009 New Revision: 187708 URL: http://svn.freebsd.org/changeset/base/187708 Log: Update jail startup script for multi-IPv4/v6/no-IP jails. Note: this is only really necessary because of the ifconfig logic to add/remove the jail IPs upon start/stop. Consensus among simon and I is that the logic should really be factored out from the startup script and put into a proper management solution. - We now support starting of no-IP jails. - Remove the global jail__netmask option as it is only helpful to set netmasks/prefixes for the right address family and per address. - Implement jail__ip options to support both address familes with regard to ifconfig logic. - Implement _multi support suffix to the jail__ip option to configure additional addresses to avoid overlong, unreadbale jail__ip lines with lots of addresses. Submitted by: initial work from Ruben van Staveren Discussed on: freebsd-jail in Nov 2008. Reviewed by: simon, ru (partial, older version) MFC after: 1 week Modified: head/etc/defaults/rc.conf head/etc/rc.d/jail head/share/man/man5/rc.conf.5 Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Mon Jan 26 07:31:28 2009 (r187707) +++ head/etc/defaults/rc.conf Mon Jan 26 12:59:11 2009 (r187708) @@ -617,14 +617,16 @@ jail_sysvipc_allow="NO" # Allow SystemV # each jail, specified in jail_list, with the following variables. # NOTES: # - replace 'example' with the jail's name. -# - except rootdir, hostname and ip, all of the following variables may be made -# global jail variables if you don't specify a jail name (ie. jail_interface). +# - except rootdir, hostname, ip and the _multi addresses, +# all of the following variables may be made global jail variables +# if you don't specify a jail name (ie. jail_interface, jail_devfs_ruleset). # #jail_example_rootdir="/usr/jail/default" # Jail's root directory #jail_example_hostname="default.domain.com" # Jail's hostname -#jail_example_ip="192.0.2.10" # Jail's IP number -#jail_example_interface="" # Interface to create the IP alias on -#jail_example_fib="0" # routing table for setfib(1) +#jail_example_interface="" # Jail's interface variable to create IP aliases on +#jail_example_fib="0" # Routing table for setfib(1) +#jail_example_ip="192.0.2.10,2001:db8::17" # Jail's primary IPv4 and IPv6 address +#jail_example_ip_multi0="2001:db8::10" # and another IPv6 address #jail_example_exec_start="/bin/sh /etc/rc" # command to execute in jail for starting #jail_example_exec_afterstart0="/bin/sh command" # command to execute after the one for # starting the jail. More than one can be Modified: head/etc/rc.d/jail ============================================================================== --- head/etc/rc.d/jail Mon Jan 26 07:31:28 2009 (r187707) +++ head/etc/rc.d/jail Mon Jan 26 12:59:11 2009 (r187708) @@ -39,7 +39,6 @@ init_variables() _procdir="${_rootdir}/proc" eval _hostname=\"\$jail_${_j}_hostname\" eval _ip=\"\$jail_${_j}_ip\" - eval _netmask=\"\${jail_${_j}_netmask:-255.255.255.255}\" eval _interface=\"\${jail_${_j}_interface:-${jail_interface}}\" eval _exec=\"\$jail_${_j}_exec\" eval _exec_start=\"\${jail_${_j}_exec_start:-${jail_exec_start}}\" @@ -94,7 +93,7 @@ init_variables() debug "$_j mount enable: $_mount" debug "$_j hostname: $_hostname" debug "$_j ip: $_ip" - debug "$_j netmask: $_netmask" + jail_show_addresses ${_j} debug "$_j interface: $_interface" debug "$_j fib: $_fib" debug "$_j root: $_rootdir" @@ -128,10 +127,6 @@ init_variables() if [ -z "${_rootdir}" ]; then err 3 "$name: No root directory has been defined for ${_j}" fi - if [ -z "${_ip}" ]; then - err 3 "$name: No IP address has been defined for ${_j}" - fi - } # set_sysctl rc_knob mib msg @@ -277,6 +272,208 @@ jail_mount_fstab() mount -a -F "${_fstab}" } +# jail_show_addresses jail +# Debug print the input for the given _multi aliases +# for a jail for init_variables(). +# +jail_show_addresses() +{ + local _j _type alias + _j="$1" + alias=0 + + if [ -z "${_j}" ]; then + warn "jail_show_addresses: you must specify a jail" + return + fi + + while : ; do + eval _addr=\"\$jail_${_j}_ip_multi${alias}\" + if [ -n "${_addr}" ]; then + debug "${_j} ip_multi${alias}: $_addr" + alias=$((${alias} + 1)) + else + break + fi + done +} + +# jail_extract_address argument +# The second argument is the string from one of the _ip +# or the _multi variables. In case of a comma separated list +# only one argument must be passed in at a time. +# The function alters the _type, _iface, _addr and _mask variables. +# +jail_extract_address() +{ + local _i + _i=$1 + + if [ -z "${_i}" ]; then + warn "jail_extract_address: called without input" + return + fi + + # Check if we have an interface prefix given and split into + # iFace and rest. + case "${_i}" in + *\|*) # ifN|.. prefix there + _iface=${_i%%|*} + _r=${_i##*|} + ;; + *) _iface="" + _r=${_i} + ;; + esac + + # In case the IP has no interface given, check if we have a global one. + _iface=${_iface:-${_interface}} + + # Set address, cut off any prefix/netmask/prefixlen. + _addr=${_r} + _addr=${_addr%%[/ ]*} + + # Theoretically we can return here if interface is not set, + # as we only care about the _mask if we call ifconfig. + # This is not done because we may want to santize IP addresses + # based on _type later, and optionally change the type as well. + + # Extract the prefix/netmask/prefixlen part by cutting off the address. + _mask=${_r} + _mask=`expr "${_mask}" : "${_addr}\(.*\)"` + + # Identify type {inet,inet6}. + case "${_addr}" in + *\.*\.*\.*) _type="inet" ;; + *:*) _type="inet6" ;; + *) warn "jail_extract_address: type not identified" + ;; + esac + + # Handle the special /netmask instead of /prefix or + # "netmask xxx" case for legacy IP. + # We do NOT support shortend class-full netmasks. + if [ "${_type}" = "inet" ]; then + case "${_mask}" in + /*\.*\.*\.*) _mask=" netmask ${_mask#/}" ;; + *) ;; + esac + + # In case _mask is still not set use /32. + _mask=${_mask:-/32} + + elif [ "${_type}" = "inet6" ]; then + # In case _maske is not set for IPv6, use /128. + _mask=${_mask:-/128} + fi +} + +# jail_handle_ips_option {add,del} input +# Handle a single argument imput which can be a comma separated +# list of addresses (theoretically with an option interface and +# prefix/netmask/prefixlen). +# +jail_handle_ips_option() +{ + local _x _action _type _i + _action=$1 + _x=$2 + + if [ -z "${_x}" ]; then + # No IP given. This can happen for the primary address + # of each address family. + return + fi + + # Loop, in case we find a comma separated list, we need to handle + # each argument on its own. + while [ ${#_x} -gt 0 ]; do + case "${_x}" in + *,*) # Extract the first argument and strip it off the list. + _i=`expr "${_x}" : '^\([^,]*\)'` + _x=`expr "${_x}" : "^[^,]*,\(.*\)"` + ;; + *) _i=${_x} + _x="" + ;; + esac + + _type="" + _iface="" + _addr="" + _mask="" + jail_extract_address "${_i}" + + # make sure we got an address. + case "${_addr}" in + "") continue ;; + *) ;; + esac + + # Append address to list of addresses for the jail command. + case "${_addrl}" in + "") _addrl="${_addr}" ;; + *) _addrl="${_addrl},${_addr}" ;; + esac + + # Configure interface alias if requested by a given interface + # and if we could correctly parse everything. + case "${_iface}" in + "") continue ;; + esac + case "${_type}" in + inet) ;; + inet6) ;; + *) warn "Could not determine address family. Not going" \ + "to ${_action} address '${_addr}' for ${_jail}." + continue + ;; + esac + case "${_action}" in + add) ifconfig ${_iface} ${_type} ${_addr}${_mask} alias + ;; + del) # When removing the IP, ignore the _mask. + ifconfig ${_iface} ${_type} ${_addr} -alias + ;; + esac + done +} + +# jail_ips {add,del} +# Extract the comma separated list of addresses and return them +# for the jail command. +# Handle more than one address via the _multi option as well. +# If an interface is given also add/remove an alias for the +# address with an optional netmask. +# +jail_ips() +{ + local _action + _action=$1 + + case "${_action}" in + add) ;; + del) ;; + *) warn "jail_ips: invalid action '${_action}'" + return + ;; + esac + + # Handle addresses. + jail_handle_ips_option ${_action} "${_ip}" + # Handle jail_xxx_ip_multi + alias=0 + while : ; do + eval _x=\"\$jail_${_jail}_ip_multi${alias}\" + case "${_x}" in + "") break ;; + *) jail_handle_ips_option ${_action} "${_x}" + alias=$((${alias} + 1)) + ;; + esac + done +} + jail_start() { echo -n 'Configuring jails:' @@ -298,9 +495,8 @@ jail_start() echo -n " [${_hostname} already running (/var/run/jail_${_jail}.id exists)]" continue; fi - if [ -n "${_interface}" ]; then - ifconfig ${_interface} alias ${_ip} netmask ${_netmask} - fi + _addrl="" + jail_ips "add" if [ -n "${_fib}" ]; then _setfib="setfib -F '${_fib}'" else @@ -360,7 +556,7 @@ jail_start() fi _tmp_jail=${_tmp_dir}/jail.$$ eval ${_setfib} jail ${_flags} -i ${_rootdir} ${_hostname} \ - ${_ip} ${_exec_start} > ${_tmp_jail} 2>&1 + \"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1 if [ "$?" -eq 0 ] ; then _jail_id=$(head -1 ${_tmp_jail}) @@ -381,9 +577,7 @@ jail_start() echo ${_jail_id} > /var/run/jail_${_jail}.id else jail_umount_fs - if [ -n "${_interface}" ]; then - ifconfig ${_interface} -alias ${_ip} - fi + jail_ips "del" echo " cannot start jail \"${_jail}\": " tail +2 ${_tmp_jail} fi @@ -412,9 +606,7 @@ jail_stop() jail_umount_fs echo -n " $_hostname" fi - if [ -n "${_interface}" ]; then - ifconfig ${_interface} -alias ${_ip} - fi + jail_ips "del" rm /var/run/jail_${_jail}.id else echo " cannot stop jail ${_jail}. No jail id in /var/run" Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Mon Jan 26 07:31:28 2009 (r187707) +++ head/share/man/man5/rc.conf.5 Mon Jan 26 12:59:11 2009 (r187708) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 24, 2009 +.Dd January 25, 2009 .Dt RC.CONF 5 .Os .Sh NAME @@ -3426,8 +3426,38 @@ Set to the fully qualified domain name ( .It Va jail_ Ns Ao Ar jname Ac Ns Va _ip .Pq Vt str Unset by default. -Set to the IP address assigned to jail -.Va jname . +Set to the (primary) IPv4 and/or IPv6 address(es) assigned to the jail. +The argument can be a sole address or a comma separated list of addresses. +Additionally each address can be prefixed by the name of an interface +followed by a pipe to overwrite +.Va jail_ Ns Ao Ar jname Ac Ns Va _interface +or +.Va jail_interface +and/or suffixed by a netmask, prefixlen or prefix. +In case no netmask, prefixlen or prefix is given, +.Sq /32 +will be used for IPv4 and +.Sq /128 +will be used for an IPv6 address. +If no address is given for the jail then the jail will be started with +no networking support. +.It Va jail_ Ns Ao Ar jname Ac Ns Va _ip_multi Ns Aq Ar n +.Pq Vt str +Unset by default. +Set additional IPv4 and/or IPv6 address(es) assigned to the jail. +The sequence starts with +.Dq Li _multi0 +and the numbers have to be strictly ascending. +These entries follow the same syntax as their primary +.Va jail_ Ns Ao Ar jname Ac Ns Va _ip +entry. +The order of the entries can be important as the first address for +each address family found will be the primary address of the jail. +See +.Va ip-addresses +option in +.Xr jail 8 +for more details. .It Va jail_ Ns Ao Ar jname Ac Ns Va _flags .Pq Vt str Set to @@ -3440,12 +3470,6 @@ These are flags to pass to Unset by default. When set, sets the interface to use when setting IP address alias. Note that the alias is created at jail startup and removed at jail shutdown. -.It Va jail_ Ns Ao Ar jname Ac Ns Va _netmask -.Pq Vt str -Set to -.Li 255.255.255.255 -by default. -This is the IP netmask to use when setting IP address alias. .It Va jail_ Ns Ao Ar jname Ac Ns Va _fib .Pq Vt str Unset by default. From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 13:53:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D596F106564A; Mon, 26 Jan 2009 13:53:39 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A869E8FC16; Mon, 26 Jan 2009 13:53:39 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QDrdfD051457; Mon, 26 Jan 2009 13:53:39 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QDrdT1051454; Mon, 26 Jan 2009 13:53:39 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200901261353.n0QDrdT1051454@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 26 Jan 2009 13:53:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187709 - in head: share/man/man4 sys/dev/iicbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 13:53:40 -0000 Author: raj Date: Mon Jan 26 13:53:39 2009 New Revision: 187709 URL: http://svn.freebsd.org/changeset/base/187709 Log: Teach iic(4) the 'repeated start' I2C condition. This will be used by the upcoming i2c(8) diag utility. Reviewed by: bms, stas Obtained from: Semihalf Modified: head/share/man/man4/iic.4 head/sys/dev/iicbus/iic.c head/sys/dev/iicbus/iic.h Modified: head/share/man/man4/iic.4 ============================================================================== --- head/share/man/man4/iic.4 Mon Jan 26 12:59:11 2009 (r187708) +++ head/share/man/man4/iic.4 Mon Jan 26 13:53:39 2009 (r187709) @@ -45,13 +45,19 @@ In order to control I2C devices, use .Pa /dev/iic? with the following ioctls: -.Bl -tag -width ".Dv I2CRSTCARD" +.Bl -tag -width ".Dv I2CRPTSTART" .It Dv I2CSTART .Pq Vt "struct iiccmd" Sends the start condition to the slave specified by the .Va slave element to the bus. All other elements are ignored. +.It Dv I2CRPTSTART +.Pq Vt "struct iiccmd" +Sends the repeated start condition to the slave specified by the +.Va slave +element to the bus. +All other elements are ignored. .It Dv I2CSTOP No argument is passed. Sends the stop condition to the bus. Modified: head/sys/dev/iicbus/iic.c ============================================================================== --- head/sys/dev/iicbus/iic.c Mon Jan 26 12:59:11 2009 (r187708) +++ head/sys/dev/iicbus/iic.c Mon Jan 26 13:53:39 2009 (r187709) @@ -368,6 +368,11 @@ iicioctl(struct cdev *dev, u_long cmd, c } free(usrbufs, M_TEMP); break; + + case I2CRPTSTART: + error = iicbus_repeated_start(parent, s->slave, 0); + break; + default: error = ENOTTY; } Modified: head/sys/dev/iicbus/iic.h ============================================================================== --- head/sys/dev/iicbus/iic.h Mon Jan 26 12:59:11 2009 (r187708) +++ head/sys/dev/iicbus/iic.h Mon Jan 26 13:53:39 2009 (r187709) @@ -60,5 +60,6 @@ struct iic_rdwr_data { #define I2CWRITE _IOW('i', 4, struct iiccmd) /* send data */ #define I2CREAD _IOW('i', 5, struct iiccmd) /* receive data */ #define I2CRDWR _IOW('i', 6, struct iic_rdwr_data) /* General read/write interface */ +#define I2CRPTSTART _IOW('i', 7, struct iiccmd) /* repeated start */ #endif From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 14:00:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C0CB10656CA; Mon, 26 Jan 2009 14:00:51 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB4168FC1E; Mon, 26 Jan 2009 14:00:50 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QE0oOj051768; Mon, 26 Jan 2009 14:00:50 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QE0o5n051764; Mon, 26 Jan 2009 14:00:50 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200901261400.n0QE0o5n051764@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 26 Jan 2009 14:00:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187712 - in head/usr.sbin: . i2c X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 14:00:52 -0000 Author: raj Date: Mon Jan 26 14:00:50 2009 New Revision: 187712 URL: http://svn.freebsd.org/changeset/base/187712 Log: Introduce the I2C diagnostic utility. It let's discover and inspect slave devices on the bus. Reviewed by: bms, stas Obtained from: Semihalf Added: head/usr.sbin/i2c/ head/usr.sbin/i2c/Makefile (contents, props changed) head/usr.sbin/i2c/i2c.8 (contents, props changed) head/usr.sbin/i2c/i2c.c (contents, props changed) Modified: head/usr.sbin/Makefile Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Mon Jan 26 13:57:05 2009 (r187711) +++ head/usr.sbin/Makefile Mon Jan 26 14:00:50 2009 (r187712) @@ -65,6 +65,7 @@ SUBDIR= ${_ac} \ getpmac \ gstat \ ${_gssd} \ + i2c \ ifmcstat \ inetd \ iostat \ Added: head/usr.sbin/i2c/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/i2c/Makefile Mon Jan 26 14:00:50 2009 (r187712) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +PROG= i2c +MAN= i2c.8 + +WARNS?= 2 + +.include Added: head/usr.sbin/i2c/i2c.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/i2c/i2c.8 Mon Jan 26 14:00:50 2009 (r187712) @@ -0,0 +1,168 @@ +.\" +.\" Copyright (C) 2008-2009 Semihalf, Michal Hajduk and Bartlomiej Sieka +.\" 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 AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" + +.Dd Jan 23, 2009 +.Dt I2C 8 +.Os +.Sh NAME +.Nm i2c +.Nd test I2C bus and slave devices +.Sh SYNOPSIS +.Nm +.Cm -a Ar address +.Op Fl f Ar device +.Op Fl d Ar r|w +.Op Fl w Ar 0|8|16 +.Op Fl o Ar offset +.Op Fl c Ar count +.Op Fl m Ar ss|rs|no +.Op Fl b +.Op Fl v +.Nm +.Cm -s +.Op Fl f Ar device +.Op Fl n Ar skip_addr +.Op Fl v +.Nm +.Cm -r +.Op Fl f Ar device +.Op Fl v +.Sh DESCRIPTION +The +.Nm +utility can be used to perform raw data transfers (read or write) with devices +on the I2C bus. It can also scan the bus for available devices and reset the +I2C controller. +.Pp +The options are as follows: +.Bl -tag -width ".Fl d Ar direction" +.It Fl a Ar address +7-bit address on the I2C device to operate on (hex). +.It Fl b +binary mode - when performing a read operation, the data read from the device +is output in binary format on stdout; when doing a write, the binary data to +be written to the device is read from stdin. +.It Fl c Ar count +number of bytes to transfer (dec). +.It Fl d Ar r|w +transfer direction: r - read, w - write. +.It Fl f Ar device +I2C bus to use (default is /dev/iic0). +.It Fl m Ar ss|rs|no +addressing mode, i.e., I2C bus operations performed after the offset for the +transfer has been written to the device and before the actual read/write +operation. rs - repeated start; ss - stop start; no - none. +.It Fl n Ar skip_addr +skip address - address(es) to be skipped during bus scan. +The are two ways to specify addresses to ignore: by range 'a..b' or +using selected addresses 'a:b:c'. This option is available only when "-s" is +used. +.It Fl o Ar offset +offset within the device for data transfer (hex). +.It Fl r +reset the controller. +.It Fl s +scan the bus for devices. +.It Fl v +be verbose +.It Fl w Ar 0|8|16 +device addressing width (in bits). +.El +.Sh WARNINGS +Great care must be taken when manipulating slave I2C devices with the +.Nm +utility. Often times important configuration data for the system is kept in +non-volatile but write enabled memories located on the I2C bus, for example +Ethernet hardware addresses, RAM module parameters (SPD), processor reset +configuration word etc. +.Pp +It is very easy to render the whole system unusable when such configuration +data is deleted or altered, so use the +.Dq -d w +(write) command only if you know exactly what you are doing. +.Pp +Also avoid ungraceful interrupting of an ongoing transaction on the I2C bus, +as it can lead to potentially dangerous effects. Consider the following +scenario: when the host CPU is reset (for whatever reason) in the middle of a +started I2C transaction, the I2C slave device could be left in write mode +waiting for data or offset to arrive. When the CPU reinitializes itself and +talks to this I2C slave device again, the commands and other control info it +sends are treated by the slave device as data or offset it was waiting for, +and there's great potential for corruption if such a write is performed. +.Sh EXAMPLES +.Pp +.Bl -bullet +.It +Scan the default bus (/dev/iic0) for devices: +.Pp +i2c -s +.It +Scan the default bus (/dev/iic0) for devices and skip addresses 0x56 and +0x45. +.Pp +i2c -s -n 0x56:0x45 +.It +Scan the default bus (/dev/iic0) for devices and skip address range +0x34 to 0x56. +.Pp +i2c -s -n 0x34..0x56 +.It +Read 8 bytes of data from device at address 0x56 (e.g., an EEPROM): +.Pp +i2c -a 0x56 -d r -c 8 +.It +Write 16 bytes of data from file data.bin to device 0x56 at offset 0x10: +.Pp +i2c -a 0x56 -d w -c 16 -o 0x10 -b < data.bin +.It +Copy 4 bytes between two EEPROMs (0x56 on /dev/iic1 to 0x57 on /dev/iic0): +.Pp +i2c -a 0x56 -f /dev/iic1 -d r -c 0x4 -b | i2c -a 0x57 -f /dev/iic0 -d w -c 4 -b +.It +Reset the controller: +.Pp +i2c -f /dev/iic1 -r +.El +.Sh SEE ALSO +.Xr iic 4 , +.Xr iicbus 4 +.Sh HISTORY +The +.Nm +utility appeared in +.Fx 8.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +utility and this manual page were written by +.An Bartlomiej Sieka +.Aq tur@semihalf.com +and +.An Michal Hajduk +.Aq mih@semihalf.com . Added: head/usr.sbin/i2c/i2c.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/i2c/i2c.c Mon Jan 26 14:00:50 2009 (r187712) @@ -0,0 +1,633 @@ +/*- + * Copyright (C) 2008-2009 Semihalf, Michal Hajduk and Bartlomiej Sieka + * 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define I2C_DEV "/dev/iic0" +#define I2C_MODE_NOTSET 0 +#define I2C_MODE_NONE 1 +#define I2C_MODE_STOP_START 2 +#define I2C_MODE_REPEATED_START 3 + +struct options { + int width; + int count; + int verbose; + int addr_set; + int binary; + int scan; + int skip; + int reset; + int mode; + char dir; + uint32_t addr; + uint32_t off; +}; + +struct skip_range { + int start; + int end; +}; + +__dead2 static void +usage(void) +{ + + fprintf(stderr, "usage: %s -a addr [-f device] [-d [r|w]] [-o offset] " + "[-w [0|8|16]] [-c count] [-m [ss|rs|no]] [-b] [-v]\n", + getprogname()); + fprintf(stderr, " %s -s [-f device] [-n skip_addr] -v\n", + getprogname()); + fprintf(stderr, " %s -r [-f device] -v\n", getprogname()); + exit(EX_USAGE); +} + +static struct skip_range +skip_get_range(char *skip_addr) +{ + struct skip_range addr_range; + char *token; + + addr_range.start = 0; + addr_range.end = 0; + + token = strsep(&skip_addr, ".."); + if (token) { + addr_range.start = strtoul(token, 0, 16); + token = strsep(&skip_addr, ".."); + if ((token != NULL) && !atoi(token)) { + token = strsep(&skip_addr, ".."); + if (token) + addr_range.end = strtoul(token, 0, 16); + } + } + + return (addr_range); +} + +/* Parse the string to get hex 7 bits addresses */ +static int +skip_get_tokens(char *skip_addr, int *sk_addr, int max_index) +{ + char *token; + int i; + + for (i = 0; i < max_index; i++) { + token = strsep(&skip_addr, ":"); + if (token == NULL) + break; + sk_addr[i] = strtoul(token, 0, 16); + } + return (i); +} + +static int +scan_bus(struct iiccmd cmd, char *dev, int skip, char *skip_addr) +{ + struct skip_range addr_range = { 0, 0 }; + int *tokens, fd, error, i, index, j; + int len = 0, do_skip = 0, no_range = 1; + + fd = open(dev, O_RDWR); + if (fd == -1) { + fprintf(stderr, "Error opening I2C controller (%s) for " + "scanning: %s\n", dev, strerror(errno)); + return (EX_NOINPUT); + } + + if (skip) { + len = strlen(skip_addr); + if (strstr(skip_addr, "..") != NULL) { + addr_range = skip_get_range(skip_addr); + no_range = 0; + } else { + tokens = (int *)malloc((len / 2 + 1) * sizeof(int)); + if (tokens == NULL) { + fprintf(stderr, "Error allocating tokens " + "buffer\n"); + goto out; + } + index = skip_get_tokens(skip_addr, tokens, + len / 2 + 1); + } + + if (!no_range && (addr_range.start > addr_range.end)) { + fprintf(stderr, "Skip address out of range\n"); + goto out; + } + } + + printf("Scanning I2C devices on %s: ", dev); + for (i = 1; i < 127; i++) { + + if (skip && ( addr_range.start < addr_range.end)) { + if (i >= addr_range.start && i <= addr_range.end) + continue; + + } else if (skip && no_range) + for (j = 0; j < index; j++) { + if (tokens[j] == i) { + do_skip = 1; + break; + } + } + + if (do_skip) { + do_skip = 0; + continue; + } + + cmd.slave = i << 1; + cmd.last = 1; + cmd.count = 0; + error = ioctl(fd, I2CRSTCARD, &cmd); + if (error) + goto out; + + cmd.slave = i << 1; + cmd.last = 1; + error = ioctl(fd, I2CSTART, &cmd); + if (!error) + printf("%x ", i); + cmd.slave = i << 1; + cmd.last = 1; + error = ioctl(fd, I2CSTOP, &cmd); + } + printf("\n"); + + error = ioctl(fd, I2CRSTCARD, &cmd); +out: + close(fd); + if (skip && no_range) + free(tokens); + + if (error) { + fprintf(stderr, "Error scanning I2C controller (%s): %s\n", + dev, strerror(errno)); + return (EX_NOINPUT); + } else + return (EX_OK); +} + +static int +reset_bus(struct iiccmd cmd, char *dev) +{ + int fd, error; + + fd = open(dev, O_RDWR); + if (fd == -1) { + fprintf(stderr, "Error opening I2C controller (%s) for " + "resetting: %s\n", dev, strerror(errno)); + return (EX_NOINPUT); + } + + printf("Resetting I2C controller on %s: ", dev); + error = ioctl(fd, I2CRSTCARD, &cmd); + close (fd); + + if (error) { + printf("error: %s\n", strerror(errno)); + return (EX_IOERR); + } else { + printf("OK\n"); + return (EX_OK); + } +} + +static char * +prepare_buf(int size, uint32_t off) +{ + char *buf; + + buf = malloc(size); + if (buf == NULL) + return (buf); + + if (size == 1) + buf[0] = off & 0xff; + else if (size == 2) { + buf[0] = (off >> 8) & 0xff; + buf[1] = off & 0xff; + } + + return (buf); +} + +static int +i2c_write(char *dev, struct options i2c_opt, char *i2c_buf) +{ + struct iiccmd cmd; + int ch, i, error, fd, bufsize; + char *err_msg, *buf; + + /* + * Read data to be written to the chip from stdin + */ + if (i2c_opt.verbose && !i2c_opt.binary) + fprintf(stderr, "Enter %u bytes of data: ", i2c_opt.count); + + for (i = 0; i < i2c_opt.count; i++) { + ch = getchar(); + if (ch == EOF) { + free(i2c_buf); + err(1, "not enough data, exiting\n"); + } + i2c_buf[i] = ch; + } + + fd = open(dev, O_RDWR); + if (fd == -1) { + free(i2c_buf); + err(1, "open failed"); + } + + /* + * Write offset where the data will go + */ + cmd.slave = i2c_opt.addr; + error = ioctl(fd, I2CSTART, &cmd); + if (error == -1) { + err_msg = "ioctl: error sending start condition"; + goto err1; + } + + if (i2c_opt.width) { + bufsize = i2c_opt.width / 8; + buf = prepare_buf(bufsize, i2c_opt.off); + if (buf == NULL) { + err_msg = "error: offset malloc"; + goto err1; + } + + cmd.count = bufsize; + cmd.buf = buf; + error = ioctl(fd, I2CWRITE, &cmd); + free(buf); + if (error == -1) { + err_msg = "ioctl: error when write offset"; + goto err1; + } + } + + /* Mode - stop start */ + if (i2c_opt.mode == I2C_MODE_STOP_START) { + cmd.slave = i2c_opt.addr; + error = ioctl(fd, I2CSTOP, &cmd); + if (error == -1) { + err_msg = "ioctl: error sending stop condition"; + goto err2; + } + cmd.slave = i2c_opt.addr; + error = ioctl(fd, I2CSTART, &cmd); + if (error == -1) { + err_msg = "ioctl: error sending start condition"; + goto err1; + } + } + /* Mode - repeated start */ + if (i2c_opt.mode == I2C_MODE_REPEATED_START) { + cmd.slave = i2c_opt.addr; + error = ioctl(fd, I2CRPTSTART, &cmd); + if (error == -1) { + err_msg = "ioctl: error sending repeated start " + "condition"; + goto err1; + } + } + + /* + * Write the data + */ + cmd.count = i2c_opt.count; + cmd.buf = i2c_buf; + cmd.last = 0; + error = ioctl(fd, I2CWRITE, &cmd); + if (error == -1) { + err_msg = "ioctl: error when write"; + goto err1; + } + cmd.slave = i2c_opt.addr; + error = ioctl(fd, I2CSTOP, &cmd); + if (error == -1) { + err_msg = "ioctl: error sending stop condition"; + goto err2; + } + + close(fd); + return (0); + +err1: + cmd.slave = i2c_opt.addr; + error = ioctl(fd, I2CSTOP, &cmd); + if (error == -1) + fprintf(stderr, "error sending stop condtion\n"); +err2: + if (err_msg) + fprintf(stderr, err_msg); + + close(fd); + return (1); +} + +static int +i2c_read(char *dev, struct options i2c_opt, char *i2c_buf) +{ + struct iiccmd cmd; + int i, fd, error, bufsize; + char *err_msg, data = 0, *buf; + + fd = open(dev, O_RDWR); + if (fd == -1) + err(1, "open failed"); + + bzero(&cmd, sizeof(cmd)); + + if (i2c_opt.width) { + cmd.slave = i2c_opt.addr; + cmd.count = 1; + cmd.last = 0; + cmd.buf = &data; + error = ioctl(fd, I2CSTART, &cmd); + if (error == -1) { + err_msg = "ioctl: error sending start condition"; + goto err1; + } + bufsize = i2c_opt.width / 8; + buf = prepare_buf(bufsize, i2c_opt.off); + if (buf == NULL) { + err_msg = "error: offset malloc"; + goto err1; + } + + cmd.count = bufsize; + cmd.buf = buf; + cmd.last = 0; + error = ioctl(fd, I2CWRITE, &cmd); + free(buf); + if (error == -1) { + err_msg = "ioctl: error when write offset"; + goto err1; + } + + if (i2c_opt.mode == I2C_MODE_STOP_START) { + cmd.slave = i2c_opt.addr; + error = ioctl(fd, I2CSTOP, &cmd); + if (error == -1) + goto err2; + } + } + cmd.slave = i2c_opt.addr; + cmd.count = 1; + cmd.last = 0; + cmd.buf = &data; + if (i2c_opt.mode == I2C_MODE_STOP_START) { + error = ioctl(fd, I2CSTART, &cmd); + if (error == -1) { + err_msg = "ioctl: error sending start condition"; + goto err1; + } + } else if (i2c_opt.mode == I2C_MODE_REPEATED_START) { + error = ioctl(fd, I2CRPTSTART, &cmd); + if (error == -1) { + err_msg = "ioctl: error sending repeated start " + "condition"; + goto err1; + } + } + error = ioctl(fd, I2CSTOP, &cmd); + if (error == -1) + goto err2; + + for (i = 0; i < i2c_opt.count; i++) { + error = read(fd, &i2c_buf[i], 1); + if (error == -1) { + err_msg = "ioctl: error while reading"; + goto err1; + } + } + + close(fd); + return (0); + +err1: + cmd.slave = i2c_opt.addr; + error = ioctl(fd, I2CSTOP, &cmd); + if (error == -1) + fprintf(stderr, "error sending stop condtion\n"); +err2: + if (err_msg) + fprintf(stderr, err_msg); + + close(fd); + return (1); +} + +int +main(int argc, char** argv) +{ + struct iiccmd cmd; + struct options i2c_opt; + char *dev, *skip_addr, *err_msg, *i2c_buf; + int error, chunk_size, i, j, ch; + + errno = 0; + error = 0; + + /* Line-break the output every chunk_size bytes */ + chunk_size = 16; + + dev = I2C_DEV; + err_msg = NULL; + + /* Default values */ + i2c_opt.addr_set = 0; + i2c_opt.off = 0; + i2c_opt.verbose = 0; + i2c_opt.dir = 'r'; /* direction = read */ + i2c_opt.width = 8; + i2c_opt.count = 1; + i2c_opt.binary = 0; /* ASCII text output */ + i2c_opt.scan = 0; /* no bus scan */ + i2c_opt.skip = 0; /* scan all addresses */ + i2c_opt.reset = 0; /* no bus reset */ + i2c_opt.mode = I2C_MODE_NOTSET; + + while ((ch = getopt(argc, argv, "a:f:d:o:w:c:m:n:sbvrh")) != -1) { + switch(ch) { + case 'a': + i2c_opt.addr = (strtoul(optarg, 0, 16) << 1); + if (i2c_opt.addr == 0 && errno == EINVAL) + i2c_opt.addr_set = 0; + else + i2c_opt.addr_set = 1; + break; + case 'f': + dev = optarg; + break; + case 'd': + i2c_opt.dir = optarg[0]; + break; + case 'o': + i2c_opt.off = strtoul(optarg, 0, 16); + if (i2c_opt.off == 0 && errno == EINVAL) + error = 1; + break; + case 'w': + i2c_opt.width = atoi(optarg); + break; + case 'c': + i2c_opt.count = atoi(optarg); + break; + case 'm': + if (!strcmp(optarg, "no")) + i2c_opt.mode = I2C_MODE_NONE; + else if (!strcmp(optarg, "ss")) + i2c_opt.mode = I2C_MODE_STOP_START; + else if (!strcmp(optarg, "rs")) + i2c_opt.mode = I2C_MODE_REPEATED_START; + else + usage(); + break; + case 'n': + i2c_opt.skip = 1; + skip_addr = optarg; + break; + case 's': + i2c_opt.scan = 1; + break; + case 'b': + i2c_opt.binary = 1; + break; + case 'v': + i2c_opt.verbose = 1; + break; + case 'r': + i2c_opt.reset = 1; + break; + case 'h': + default: + usage(); + } + } + argc -= optind; + argv += optind; + + /* Set default mode if option -m is not specified */ + if (i2c_opt.mode == I2C_MODE_NOTSET) { + if (i2c_opt.dir == 'r') + i2c_opt.mode = I2C_MODE_STOP_START; + else if (i2c_opt.dir == 'w') + i2c_opt.mode = I2C_MODE_NONE; + } + + /* Basic sanity check of command line arguments */ + if (i2c_opt.scan) { + if (i2c_opt.addr_set) + usage(); + } else if (i2c_opt.reset) { + if (i2c_opt.addr_set) + usage(); + } else if (error) { + usage(); + } else if ((i2c_opt.dir == 'r' || i2c_opt.dir == 'w')) { + if ((i2c_opt.addr_set == 0) || + !(i2c_opt.width == 0 || i2c_opt.width == 8 || + i2c_opt.width == 16)) + usage(); + } + + if (i2c_opt.verbose) + fprintf(stderr, "dev: %s, addr: 0x%x, r/w: %c, " + "offset: 0x%02x, width: %u, count: %u\n", dev, + i2c_opt.addr >> 1, i2c_opt.dir, i2c_opt.off, + i2c_opt.width, i2c_opt.count); + + if (i2c_opt.scan) + exit(scan_bus(cmd, dev, i2c_opt.skip, skip_addr)); + + if (i2c_opt.reset) + exit(reset_bus(cmd, dev)); + + i2c_buf = malloc(i2c_opt.count); + if (i2c_buf == NULL) + err(1, "data malloc"); + + if (i2c_opt.dir == 'w') { + error = i2c_write(dev, i2c_opt, i2c_buf); + if (error) { + free(i2c_buf); + return (1); + } + } + if (i2c_opt.dir == 'r') { + error = i2c_read(dev, i2c_opt, i2c_buf); + if (error) { + free(i2c_buf); + return (1); + } + } + + if (i2c_opt.verbose) + fprintf(stderr, "\nData %s (hex):\n", i2c_opt.dir == 'r' ? + "read" : "written"); + + i = 0; + j = 0; + while (i < i2c_opt.count) { + if (i2c_opt.verbose || (i2c_opt.dir == 'r' && + !i2c_opt.binary)) + fprintf (stderr, "%02hhx ", i2c_buf[i++]); + + if (i2c_opt.dir == 'r' && i2c_opt.binary) { + fprintf(stdout, "%c", i2c_buf[j++]); + if(!i2c_opt.verbose) + i++; + } + if (!i2c_opt.verbose && (i2c_opt.dir == 'w')) + break; + if ((i % chunk_size) == 0) + fprintf(stderr, "\n"); + } + if ((i % chunk_size) != 0) + fprintf(stderr, "\n"); + + free(i2c_buf); + return (0); +} From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 14:03:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C054106567C; Mon, 26 Jan 2009 14:03:39 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 598718FC21; Mon, 26 Jan 2009 14:03:39 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QE3d8v051860; Mon, 26 Jan 2009 14:03:39 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QE3dKJ051858; Mon, 26 Jan 2009 14:03:39 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901261403.n0QE3dKJ051858@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 26 Jan 2009 14:03:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187713 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 14:03:40 -0000 Author: luigi Date: Mon Jan 26 14:03:39 2009 New Revision: 187713 URL: http://svn.freebsd.org/changeset/base/187713 Log: Some implementations of getopt() expect that argv[0] is always the program name, and ignore that entry. ipfw2.c code instead skips this entry and starts with options at offset 0, relying on a more tolerant implementation of the library. This change fixes the issue by always passing a program name in the first entry to getopt. The motivation for this change is to remove a potential compatibility issue should we use a different getopt() implementation in the future. No functional changes. Submitted by: Marta Carbone (parts) MFC after: 4 weeks Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon Jan 26 14:00:50 2009 (r187712) +++ head/sbin/ipfw/ipfw2.c Mon Jan 26 14:03:39 2009 (r187713) @@ -6090,7 +6090,8 @@ show_nat(int ac, char **av) } /* - * Called with the arguments (excluding program name). + * Called with the arguments, including program name because getopt + * wants it to be present. * Returns 0 if successful, 1 if empty command, errx() in case of errors. */ static int @@ -6102,16 +6103,16 @@ ipfw_main(int oldac, char **oldav) int do_acct = 0; /* Show packet/byte count */ #define WHITESP " \t\f\v\n\r" - if (oldac == 0) - return 1; - else if (oldac == 1) { + if (oldac < 2) + return 1; /* need at least one argument */ + if (oldac == 2) { /* * If we are called with a single string, try to split it into * arguments for subsequent parsing. * But first, remove spaces after a ',', by copying the string * in-place. */ - char *arg = oldav[0]; /* The string... */ + char *arg = oldav[1]; /* The string is the first arg. */ int l = strlen(arg); int copy = 0; /* 1 if we need to copy, 0 otherwise */ int i, j; @@ -6142,13 +6143,17 @@ ipfw_main(int oldac, char **oldav) if (index(WHITESP, arg[i]) != NULL) ac++; - av = calloc(ac, sizeof(char *)); + /* + * Allocate the argument list, including one entry for + * the program name because getopt expects it. + */ + av = calloc(ac + 1, sizeof(char *)); /* - * Second, copy arguments from cmd[] to av[]. For each one, + * Second, copy arguments from arg[] to av[]. For each one, * j is the initial character, i is the one past the end. */ - for (ac = 0, i = j = 0; i < l; i++) + for (ac = 1, i = j = 0; i < l; i++) if (index(WHITESP, arg[i]) != NULL || i == l-1) { if (i == l-1) i++; @@ -6164,7 +6169,7 @@ ipfw_main(int oldac, char **oldav) int first, i, l; av = calloc(oldac, sizeof(char *)); - for (first = i = ac = 0, l = 0; i < oldac; i++) { + for (first = i = ac = 1, l = 0; i < oldac; i++) { char *arg = oldav[i]; int k = strlen(arg); @@ -6183,6 +6188,7 @@ ipfw_main(int oldac, char **oldav) } } + av[0] = strdup(oldav[0]); /* copy progname from the caller */ /* Set the force flag for non-interactive processes */ if (!do_force) do_force = !isatty(STDIN_FILENO); @@ -6191,7 +6197,7 @@ ipfw_main(int oldac, char **oldav) save_ac = ac; save_av = av; - optind = optreset = 0; + optind = optreset = 1; /* restart getopt() */ while ((ch = getopt(ac, av, "abcdefhinNqs:STtv")) != -1) switch (ch) { case 'a': @@ -6371,13 +6377,13 @@ ipfw_readfile(int ac, char *av[]) { #define MAX_ARGS 32 char buf[BUFSIZ]; - char *cmd = NULL, *filename = av[ac-1]; + const char *progname = av[0]; /* original program name */ + const char *cmd = NULL; /* preprocessor name, if any */ + const char *filename = av[ac-1]; /* file to read */ int c, lineno=0; FILE *f = NULL; pid_t preproc = 0; - filename = av[ac-1]; - while ((c = getopt(ac, av, "cfNnp:qS")) != -1) { switch(c) { case 'c': @@ -6397,18 +6403,28 @@ ipfw_readfile(int ac, char *av[]) break; case 'p': - cmd = optarg; /* - * Skip previous args and delete last one, so we - * pass all but the last argument to the preprocessor - * via av[optind-1] + * ipfw -p cmd [args] filename + * + * We are done with getopt(). All arguments + * except the filename go to the preprocessor, + * so we need to do the following: + * - check that a filename is actually present; + * - advance av by optind-1 to skip arguments + * already processed; + * - decrease ac by optind, to remove the args + * already processed and the final filename; + * - set the last entry in av[] to NULL so + * popen() can detect the end of the array; + * - set optind=ac to let getopt() terminate. */ - av += optind - 1; - ac -= optind - 1; - if (ac < 2) + if (optind == ac) errx(EX_USAGE, "no filename argument"); + cmd = optarg; av[ac-1] = NULL; - fprintf(stderr, "command is %s\n", av[0]); + av += optind - 1; + ac -= optind; + optind = ac; break; case 'q': @@ -6424,8 +6440,6 @@ ipfw_readfile(int ac, char *av[]) " summary ``ipfw''"); } - if (cmd != NULL) - break; } if (cmd == NULL && ac != optind + 1) { @@ -6474,13 +6488,14 @@ ipfw_readfile(int ac, char *av[]) while (fgets(buf, BUFSIZ, f)) { /* read commands */ char linename[10]; - char *args[1]; + char *args[2]; lineno++; sprintf(linename, "Line %d", lineno); setprogname(linename); /* XXX */ - args[0] = buf; - ipfw_main(1, args); + args[0] = strdup(progname); + args[1] = buf; + ipfw_main(2, args); } fclose(f); if (cmd != NULL) { @@ -6510,7 +6525,7 @@ main(int ac, char *av[]) if (ac > 1 && av[ac - 1][0] == '/' && access(av[ac - 1], R_OK) == 0) ipfw_readfile(ac, av); else { - if (ipfw_main(ac-1, av+1)) + if (ipfw_main(ac, av)) show_usage(); } return EX_OK; From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 14:12:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55A42106564A; Mon, 26 Jan 2009 14:12:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 43CE88FC12; Mon, 26 Jan 2009 14:12:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QECDH3052208; Mon, 26 Jan 2009 14:12:13 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QECDLO052207; Mon, 26 Jan 2009 14:12:13 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200901261412.n0QECDLO052207@svn.freebsd.org> From: John Baldwin Date: Mon, 26 Jan 2009 14:12:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187714 - head/sys/dev/ppbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 14:12:13 -0000 Author: jhb Date: Mon Jan 26 14:12:12 2009 New Revision: 187714 URL: http://svn.freebsd.org/changeset/base/187714 Log: Add missing locking around setting the ppc interrupt handler IVAR. Reported by: many Modified: head/sys/dev/ppbus/ppbconf.c Modified: head/sys/dev/ppbus/ppbconf.c ============================================================================== --- head/sys/dev/ppbus/ppbconf.c Mon Jan 26 14:03:39 2009 (r187713) +++ head/sys/dev/ppbus/ppbconf.c Mon Jan 26 14:12:12 2009 (r187714) @@ -393,8 +393,10 @@ ppbus_attach(device_t dev) ppb->ppc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE); if (ppb->ppc_irq_res != NULL) { + mtx_lock(ppb->ppc_lock); error = BUS_WRITE_IVAR(device_get_parent(dev), dev, PPC_IVAR_INTR_HANDLER, (uintptr_t)&ppbus_intr); + mtx_unlock(ppb->ppc_lock); if (error) { device_printf(dev, "Unable to set interrupt handler\n"); return (error); From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 14:21:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 922D41065672; Mon, 26 Jan 2009 14:21:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 803DA8FC21; Mon, 26 Jan 2009 14:21:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QEL0SE052502; Mon, 26 Jan 2009 14:21:00 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QEL08q052501; Mon, 26 Jan 2009 14:21:00 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200901261421.n0QEL08q052501@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 26 Jan 2009 14:21:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187715 - head/sys/fs/fifofs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 14:21:01 -0000 Author: kib Date: Mon Jan 26 14:21:00 2009 New Revision: 187715 URL: http://svn.freebsd.org/changeset/base/187715 Log: The kernel may do unbalanced calls to fifo_close() for fifo vnode, without corresponding number of fifo_open(). This causes assertion failure in fifo_close() due to vp->v_fifoinfo being NULL for kernel with INVARIANTS, or NULL pointer dereference otherwise. In fact, we may ignore excess calls to fifo_close() without bad consequences. Turn KASSERT() into the return, and print warning for now. Tested by: pho Reviewed by: rwatson MFC after: 2 weeks Modified: head/sys/fs/fifofs/fifo_vnops.c Modified: head/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- head/sys/fs/fifofs/fifo_vnops.c Mon Jan 26 14:12:12 2009 (r187714) +++ head/sys/fs/fifofs/fifo_vnops.c Mon Jan 26 14:21:00 2009 (r187715) @@ -423,7 +423,10 @@ fifo_close(ap) struct fifoinfo *fip = vp->v_fifoinfo; ASSERT_VOP_LOCKED(vp, "fifo_close"); - KASSERT(fip != NULL, ("fifo_close: no v_fifoinfo")); + if (fip == NULL) { + printf("fifo_close: no v_fifoinfo %p\n", vp); + return (0); + } if (ap->a_fflag & FREAD) { fip->fi_readers--; if (fip->fi_readers == 0) From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 14:26:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97EF41065670; Mon, 26 Jan 2009 14:26:35 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 852648FC16; Mon, 26 Jan 2009 14:26:35 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QEQZDo052656; Mon, 26 Jan 2009 14:26:35 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QEQZVP052654; Mon, 26 Jan 2009 14:26:35 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901261426.n0QEQZVP052654@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 26 Jan 2009 14:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187716 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 14:26:36 -0000 Author: luigi Date: Mon Jan 26 14:26:35 2009 New Revision: 187716 URL: http://svn.freebsd.org/changeset/base/187716 Log: wrap all malloc/calloc/realloc calls so they exit on failure without having to check in each place. Remove an wrong strdup from previous commit. Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon Jan 26 14:21:00 2009 (r187715) +++ head/sbin/ipfw/ipfw2.c Mon Jan 26 14:26:35 2009 (r187716) @@ -511,6 +511,26 @@ align_uint64(uint64_t *pll) { return ret; } +static void * +safe_calloc(size_t number, size_t size) +{ + void *ret = calloc(number, size); + + if (ret == NULL) + err(EX_OSERR, "calloc"); + return ret; +} + +static void * +safe_realloc(void *ptr, size_t size) +{ + void *ret = realloc(ptr, size); + + if (ret == NULL) + err(EX_OSERR, "realloc"); + return ret; +} + /* * conditionally runs the command. */ @@ -718,9 +738,7 @@ strtoport(char *s, char **end, int base, if (*s1 == '\\' && s1[1] != '\0') s1++; - buf = malloc(s1 - s + 1); - if (buf == NULL) - return 0; + buf = safe_calloc(s1 - s + 1, 1); /* * copy into a buffer skipping backslashes @@ -813,9 +831,7 @@ altq_fetch(void) } if (pfioc.altq.qid == 0) continue; - altq = malloc(sizeof(*altq)); - if (altq == NULL) - err(EX_OSERR, "malloc"); + altq = safe_calloc(1, sizeof(*altq)); *altq = pfioc.altq; TAILQ_INSERT_TAIL(&altq_entries, altq, entries); } @@ -2381,8 +2397,7 @@ sets_handler(int ac, char *av[]) char const *msg; nbytes = sizeof(struct ip_fw); - if ((data = calloc(1, nbytes)) == NULL) - err(EX_OSERR, "calloc"); + data = safe_calloc(1, nbytes); if (do_cmd(IP_FW_GET, data, (uintptr_t)&nbytes) < 0) err(EX_OSERR, "getsockopt(IP_FW_GET)"); bcopy(&((struct ip_fw *)data)->next_rule, @@ -2531,8 +2546,7 @@ list(int ac, char *av[], int show_counte while (nbytes >= nalloc) { nalloc = nalloc * 2 + 200; nbytes = nalloc; - if ((data = realloc(data, nbytes)) == NULL) - err(EX_OSERR, "realloc"); + data = safe_realloc(data, nbytes); if (do_cmd(ocmd, data, (uintptr_t)&nbytes) < 0) err(EX_OSERR, "getsockopt(IP_%s_GET)", do_pipe ? "DUMMYNET" : "FW"); @@ -3331,8 +3345,7 @@ set_addr_dynamic(const char *ifn, struct */ if (sysctl(mib, 6, NULL, &needed, NULL, 0) == -1) err(1, "iflist-sysctl-estimate"); - if ((buf = malloc(needed)) == NULL) - errx(1, "malloc failed"); + buf = safe_calloc(1, needed); if (sysctl(mib, 6, buf, &needed, NULL, 0) == -1) err(1, "iflist-sysctl-get"); lim = buf + needed; @@ -5985,9 +5998,7 @@ table_list(ipfw_table_entry ent, int nee return; l = sizeof(*tbl) + a * sizeof(ipfw_table_entry); - tbl = malloc(l); - if (tbl == NULL) - err(EX_OSERR, "malloc"); + tbl = safe_calloc(1, l); tbl->tbl = ent.tbl; if (do_cmd(IP_FW_TABLE_LIST, tbl, (uintptr_t)&l) < 0) err(EX_OSERR, "getsockopt(IP_FW_TABLE_LIST)"); @@ -6053,8 +6064,7 @@ show_nat(int ac, char **av) while (nbytes >= nalloc) { nalloc = nalloc * 2; nbytes = nalloc; - if ((data = realloc(data, nbytes)) == NULL) - err(EX_OSERR, "realloc"); + data = safe_realloc(data, nbytes); if (do_cmd(cmd, data, (uintptr_t)&nbytes) < 0) err(EX_OSERR, "getsockopt(IP_FW_GET_%s)", (cmd == IP_FW_NAT_GET_LOG) ? "LOG" : "CONFIG"); @@ -6147,7 +6157,7 @@ ipfw_main(int oldac, char **oldav) * Allocate the argument list, including one entry for * the program name because getopt expects it. */ - av = calloc(ac + 1, sizeof(char *)); + av = safe_calloc(ac + 1, sizeof(char *)); /* * Second, copy arguments from arg[] to av[]. For each one, @@ -6157,7 +6167,7 @@ ipfw_main(int oldac, char **oldav) if (index(WHITESP, arg[i]) != NULL || i == l-1) { if (i == l-1) i++; - av[ac] = calloc(i-j+1, 1); + av[ac] = safe_calloc(i-j+1, 1); bcopy(arg+j, av[ac], i-j); ac++; j = i + 1; @@ -6168,7 +6178,7 @@ ipfw_main(int oldac, char **oldav) */ int first, i, l; - av = calloc(oldac, sizeof(char *)); + av = safe_calloc(oldac, sizeof(char *)); for (first = i = ac = 1, l = 0; i < oldac; i++) { char *arg = oldav[i]; int k = strlen(arg); @@ -6176,7 +6186,7 @@ ipfw_main(int oldac, char **oldav) l += k; if (arg[k-1] != ',' || i == oldac-1) { /* Time to copy. */ - av[ac] = calloc(l+1, 1); + av[ac] = safe_calloc(l+1, 1); for (l=0; first <= i; first++) { strcat(av[ac]+l, oldav[first]); l += strlen(oldav[first]); @@ -6377,7 +6387,7 @@ ipfw_readfile(int ac, char *av[]) { #define MAX_ARGS 32 char buf[BUFSIZ]; - const char *progname = av[0]; /* original program name */ + char *progname = av[0]; /* original program name */ const char *cmd = NULL; /* preprocessor name, if any */ const char *filename = av[ac-1]; /* file to read */ int c, lineno=0; @@ -6493,7 +6503,7 @@ ipfw_readfile(int ac, char *av[]) lineno++; sprintf(linename, "Line %d", lineno); setprogname(linename); /* XXX */ - args[0] = strdup(progname); + args[0] = progname; args[1] = buf; ipfw_main(2, args); } From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 14:43:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 684541065677; Mon, 26 Jan 2009 14:43:19 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54F348FC1A; Mon, 26 Jan 2009 14:43:19 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QEhJ2h053194; Mon, 26 Jan 2009 14:43:19 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QEhJKw053190; Mon, 26 Jan 2009 14:43:19 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200901261443.n0QEhJKw053190@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 26 Jan 2009 14:43:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187717 - head/sys/dev/sound/macio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 14:43:20 -0000 Author: nwhitehorn Date: Mon Jan 26 14:43:18 2009 New Revision: 187717 URL: http://svn.freebsd.org/changeset/base/187717 Log: Change the way our softc is stored to use the devinfo facility provided by pcm instead of the regular device softc interface. This brings the AOA driver in line with the other pcm drivers. Requested by: ariff Modified: head/sys/dev/sound/macio/aoa.c head/sys/dev/sound/macio/aoa.h head/sys/dev/sound/macio/davbus.c head/sys/dev/sound/macio/i2s.c Modified: head/sys/dev/sound/macio/aoa.c ============================================================================== --- head/sys/dev/sound/macio/aoa.c Mon Jan 26 14:26:35 2009 (r187716) +++ head/sys/dev/sound/macio/aoa.c Mon Jan 26 14:43:18 2009 (r187717) @@ -106,7 +106,7 @@ aoa_dma_set_program(struct aoa_dma *dma) static struct aoa_dma * aoa_dma_create(device_t self) { - struct aoa_softc *sc = device_get_softc(self); + struct aoa_softc *sc = pcm_getdevinfo(self); struct aoa_dma *dma; bus_dma_tag_t tag; int err; @@ -215,7 +215,7 @@ aoa_chan_init(kobj_t obj, void *devinfo, struct pcm_channel *c, int dir) { device_t self = devinfo; - struct aoa_softc *sc = device_get_softc(self); + struct aoa_softc *sc = pcm_getdevinfo(self); struct aoa_dma *dma; int max_slots, err; @@ -357,12 +357,12 @@ static kobj_method_t aoa_chan_methods[] CHANNEL_DECLARE(aoa_chan); int -aoa_attach(device_t self) +aoa_attach(device_t self, void *sc) { char status[SND_STATUSLEN]; int err; - if (pcm_register(self, self, 1, 0)) + if (pcm_register(self, sc, 1, 0)) return (ENXIO); err = pcm_getbuffersize(self, AOA_BUFFER_SIZE, AOA_BUFFER_SIZE, Modified: head/sys/dev/sound/macio/aoa.h ============================================================================== --- head/sys/dev/sound/macio/aoa.h Mon Jan 26 14:26:35 2009 (r187716) +++ head/sys/dev/sound/macio/aoa.h Mon Jan 26 14:43:18 2009 (r187717) @@ -28,17 +28,19 @@ #ifndef SOUND_AOA_H #define SOUND_AOA_H +#ifndef AOA_DEBUG #define DPRINTF(x) /* nothing */ -/* #define DPRINTF(x) printf x */ +#else +#define DPRINTF(x) printf x +#endif struct aoa_softc { - u_int8_t sc_super[PCM_SOFTC_SIZE]; void *sc_intrp; struct resource *sc_odma; }; void aoa_interrupt(void *); -int aoa_attach(device_t); +int aoa_attach(device_t, void *sc); #endif /* SOUND_AOA_H */ Modified: head/sys/dev/sound/macio/davbus.c ============================================================================== --- head/sys/dev/sound/macio/davbus.c Mon Jan 26 14:26:35 2009 (r187716) +++ head/sys/dev/sound/macio/davbus.c Mon Jan 26 14:43:18 2009 (r187717) @@ -78,7 +78,7 @@ static device_method_t pcm_davbus_method static driver_t pcm_davbus_driver = { "pcm", pcm_davbus_methods, - sizeof(struct davbus_softc) + PCM_SOFTC_SIZE }; DRIVER_MODULE(pcm_davbus, macio, pcm_davbus_driver, pcm_devclass, 0, 0); @@ -91,7 +91,6 @@ static int davbus_probe(device_t self) { const char *name; - struct davbus_softc *sc; name = ofw_bus_get_name(self); if (!name) @@ -100,11 +99,6 @@ davbus_probe(device_t self) if (strcmp(name, "davbus") != 0) return (ENXIO); - sc = device_get_softc(self); - if (!sc) - return (ENOMEM); - bzero(sc, sizeof(*sc)); - device_set_desc(self, "Apple DAVBus Audio Controller"); return (0); @@ -495,12 +489,14 @@ screamer_setrecsrc(struct snd_mixer *m, static int davbus_attach(device_t self) { - struct davbus_softc *sc = device_get_softc(self); + struct davbus_softc *sc; struct resource *dbdma_irq, *cintr; void *cookie; char compat[64]; int rid, oirq, err; + sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); + sc->dev = self; sc->node = ofw_bus_get_node(self); sc->soundnode = OF_child(sc->node); @@ -559,7 +555,7 @@ davbus_attach(device_t self) DAVBUS_OUTPUT_SUBFRAME0 | DAVBUS_RATE_44100 | DAVBUS_INTR_PORTCHG); /* Attach DBDMA engine and PCM layer */ - err = aoa_attach(self); + err = aoa_attach(self,sc); if (err) return (err); Modified: head/sys/dev/sound/macio/i2s.c ============================================================================== --- head/sys/dev/sound/macio/i2s.c Mon Jan 26 14:26:35 2009 (r187716) +++ head/sys/dev/sound/macio/i2s.c Mon Jan 26 14:43:18 2009 (r187717) @@ -111,7 +111,7 @@ static device_method_t pcm_i2s_methods[] static driver_t pcm_i2s_driver = { "pcm", pcm_i2s_methods, - sizeof(struct i2s_softc) + PCM_SOFTC_SIZE }; DRIVER_MODULE(pcm_i2s, macio, pcm_i2s_driver, pcm_devclass, 0, 0); @@ -153,7 +153,6 @@ static int i2s_probe(device_t self) { const char *name; - struct i2s_softc *sc; name = ofw_bus_get_name(self); if (!name) @@ -162,11 +161,6 @@ i2s_probe(device_t self) if (strcmp(name, "i2s") != 0) return (ENXIO); - sc = device_get_softc(self); - if (!sc) - return (ENOMEM); - bzero(sc, sizeof(*sc)); - device_set_desc(self, "Apple I2S Audio Controller"); return (0); @@ -177,11 +171,13 @@ static phandle_t of_find_firstchild_byna static int i2s_attach(device_t self) { - struct i2s_softc *sc = device_get_softc(self); + struct i2s_softc *sc; struct resource *dbdma_irq; void *dbdma_ih; int rid, oirq, err; phandle_t port; + + sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); sc->dev = self; sc->node = ofw_bus_get_node(self); @@ -242,7 +238,7 @@ i2s_attach(device_t self) if (config_intrhook_establish(i2s_delayed_attach) != 0) return (ENOMEM); - return (aoa_attach(self)); + return (aoa_attach(self,sc)); } /***************************************************************************** @@ -322,7 +318,6 @@ aoagpio_probe(device_t gpio) /* Try to find a match. */ for (m = gpio_controls; m->name != NULL; m++) { if (strcmp(name, m->name) == 0) { - sc = device_get_softc(gpio); gpio_ctrls[m->ctrl] = sc; sc->dev = gpio; @@ -731,7 +726,7 @@ i2s_postattach(void *arg) KASSERT(self != NULL, ("bad arg")); KASSERT(i2s_delayed_attach != NULL, ("bogus call")); - sc = device_get_softc(self); + sc = pcm_getdevinfo(self); /* Reset the codec. */ i2s_audio_hw_reset(sc); From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 14:58:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5E3E1065672; Mon, 26 Jan 2009 14:58:09 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 83D278FC17; Mon, 26 Jan 2009 14:58:09 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id 142C546B0C; Mon, 26 Jan 2009 09:58:09 -0500 (EST) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n0QEw2xr078018; Mon, 26 Jan 2009 09:58:02 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Ed Schouten Date: Mon, 26 Jan 2009 09:00:23 -0500 User-Agent: KMail/1.9.7 References: <200901241820.n0OIKFs9095243@svn.freebsd.org> In-Reply-To: <200901241820.n0OIKFs9095243@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901260900.24276.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 26 Jan 2009 09:58:02 -0500 (EST) X-Virus-Scanned: ClamAV 0.94.2/8904/Mon Jan 26 08:06:06 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187671 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 14:58:10 -0000 On Saturday 24 January 2009 1:20:15 pm Ed Schouten wrote: > Author: ed > Date: Sat Jan 24 18:20:15 2009 > New Revision: 187671 > URL: http://svn.freebsd.org/changeset/base/187671 > > Log: > Mark kern.ttys as MPSAFE. > > sysctl now allows Giantless calls, so make kern.ttys use this. If it > needs Giant, it locks the proper TTY anyway. You want CTLFLAG_MPSAFE, not CTLFLAG_NOLOCK. NOLOCK means something else (it has to do with sysctl_wire_old_buffer()). -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 15:01:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE8EA10656C0; Mon, 26 Jan 2009 15:01:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE6438FC23; Mon, 26 Jan 2009 15:01:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QF1lif053567; Mon, 26 Jan 2009 15:01:47 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QF1lLr053566; Mon, 26 Jan 2009 15:01:47 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200901261501.n0QF1lLr053566@svn.freebsd.org> From: John Baldwin Date: Mon, 26 Jan 2009 15:01:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187718 - head/sys/cam X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 15:01:51 -0000 Author: jhb Date: Mon Jan 26 15:01:47 2009 New Revision: 187718 URL: http://svn.freebsd.org/changeset/base/187718 Log: Now that mtx_sleep/msleep can accept Giant as the interlock, simplify the CAM locking code slightly to no longer special case sleeping when a sim uses Giant for its lock. Tested by: trasz Modified: head/sys/cam/cam_periph.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Mon Jan 26 14:43:18 2009 (r187717) +++ head/sys/cam/cam_periph.c Mon Jan 26 15:01:47 2009 (r187718) @@ -326,7 +326,6 @@ cam_periph_release(struct cam_periph *pe int cam_periph_hold(struct cam_periph *periph, int priority) { - struct mtx *mtx; int error; /* @@ -339,14 +338,11 @@ cam_periph_hold(struct cam_periph *perip if (cam_periph_acquire(periph) != CAM_REQ_CMP) return (ENXIO); - mtx = periph->sim->mtx; - mtx_assert(mtx, MA_OWNED); - if (mtx == &Giant) - mtx = NULL; - + mtx_assert(periph->sim->mtx, MA_OWNED); while ((periph->flags & CAM_PERIPH_LOCKED) != 0) { periph->flags |= CAM_PERIPH_LOCK_WANTED; - if ((error = msleep(periph, mtx, priority, "caplck", 0)) != 0) { + if ((error = mtx_sleep(periph, periph->sim->mtx, priority, + "caplck", 0)) != 0) { cam_periph_release_locked(periph); return (error); } @@ -767,7 +763,6 @@ union ccb * cam_periph_getccb(struct cam_periph *periph, u_int32_t priority) { struct ccb_hdr *ccb_h; - struct mtx *mtx; mtx_assert(periph->sim->mtx, MA_OWNED); CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdgetccb\n")); @@ -780,11 +775,8 @@ cam_periph_getccb(struct cam_periph *per && (SLIST_FIRST(&periph->ccb_list)->pinfo.priority == priority)) break; mtx_assert(periph->sim->mtx, MA_OWNED); - if (periph->sim->mtx == &Giant) - mtx = NULL; - else - mtx = periph->sim->mtx; - msleep(&periph->ccb_list, mtx, PRIBIO, "cgticb", 0); + mtx_sleep(&periph->ccb_list, periph->sim->mtx, PRIBIO, "cgticb", + 0); } ccb_h = SLIST_FIRST(&periph->ccb_list); @@ -795,17 +787,12 @@ cam_periph_getccb(struct cam_periph *per void cam_periph_ccbwait(union ccb *ccb) { - struct mtx *mtx; struct cam_sim *sim; sim = xpt_path_sim(ccb->ccb_h.path); - if (sim->mtx == &Giant) - mtx = NULL; - else - mtx = sim->mtx; if ((ccb->ccb_h.pinfo.index != CAM_UNQUEUED_INDEX) || ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG)) - msleep(&ccb->ccb_h.cbfcnp, mtx, PRIBIO, "cbwait", 0); + mtx_sleep(&ccb->ccb_h.cbfcnp, sim->mtx, PRIBIO, "cbwait", 0); } int From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 15:32:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17A2F1065675; Mon, 26 Jan 2009 15:32:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 05B7B8FC21; Mon, 26 Jan 2009 15:32:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QFWdTj054238; Mon, 26 Jan 2009 15:32:39 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QFWdMi054237; Mon, 26 Jan 2009 15:32:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200901261532.n0QFWdMi054237@svn.freebsd.org> From: John Baldwin Date: Mon, 26 Jan 2009 15:32:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187719 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 15:32:40 -0000 Author: jhb Date: Mon Jan 26 15:32:39 2009 New Revision: 187719 URL: http://svn.freebsd.org/changeset/base/187719 Log: Whitespace tweak. Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Mon Jan 26 15:01:47 2009 (r187718) +++ head/sys/kern/subr_smp.c Mon Jan 26 15:32:39 2009 (r187719) @@ -115,7 +115,7 @@ static volatile int smp_rv_ncpus; static void (*volatile smp_rv_setup_func)(void *arg); static void (*volatile smp_rv_action_func)(void *arg); static void (*volatile smp_rv_teardown_func)(void *arg); -static void * volatile smp_rv_func_arg; +static void *volatile smp_rv_func_arg; static volatile int smp_rv_waiters[3]; /* From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 15:55:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C89C2106575E; Mon, 26 Jan 2009 15:55:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5FD28FC18; Mon, 26 Jan 2009 15:55:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QFtFlj054943; Mon, 26 Jan 2009 15:55:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QFtFI9054942; Mon, 26 Jan 2009 15:55:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200901261555.n0QFtFI9054942@svn.freebsd.org> From: Alexander Motin Date: Mon, 26 Jan 2009 15:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187721 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 15:55:16 -0000 Author: mav Date: Mon Jan 26 15:55:15 2009 New Revision: 187721 URL: http://svn.freebsd.org/changeset/base/187721 Log: Specify analog beep pin widget for several AD codecs. It gives working speaker control for that systems. Modified: head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Mon Jan 26 15:39:42 2009 (r187720) +++ head/sys/dev/sound/pci/hda/hdac.c Mon Jan 26 15:55:15 2009 (r187721) @@ -83,7 +83,7 @@ #include "mixer_if.h" -#define HDA_DRV_TEST_REV "20090113_0125" +#define HDA_DRV_TEST_REV "20090126_0126" SND_DECLARE_FILE("$FreeBSD$"); @@ -2585,8 +2585,15 @@ hdac_widget_getcaps(struct hdac_widget * Change beeper pin node type to beeper to help parser. */ *waspin = 0; switch (id) { + case HDA_CODEC_AD1882: + case HDA_CODEC_AD1883: + case HDA_CODEC_AD1984: + case HDA_CODEC_AD1984A: + case HDA_CODEC_AD1984B: + case HDA_CODEC_AD1987: case HDA_CODEC_AD1988: case HDA_CODEC_AD1988B: + case HDA_CODEC_AD1989B: beeper = 26; break; case HDA_CODEC_ALC260: From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 16:16:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A94B41065674; Mon, 26 Jan 2009 16:16:58 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 122858FC17; Mon, 26 Jan 2009 16:16:58 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 03F081CE4B; Mon, 26 Jan 2009 17:16:57 +0100 (CET) Date: Mon, 26 Jan 2009 17:16:56 +0100 From: Ed Schouten To: John Baldwin Message-ID: <20090126161656.GF17198@hoeg.nl> References: <200901241820.n0OIKFs9095243@svn.freebsd.org> <200901260900.24276.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GV0iVqYguTV4Q9ER" Content-Disposition: inline In-Reply-To: <200901260900.24276.jhb@freebsd.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187671 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 16:16:59 -0000 --GV0iVqYguTV4Q9ER Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * John Baldwin wrote: > On Saturday 24 January 2009 1:20:15 pm Ed Schouten wrote: > > Author: ed > > Date: Sat Jan 24 18:20:15 2009 > > New Revision: 187671 > > URL: http://svn.freebsd.org/changeset/base/187671 > >=20 > > Log: > > Mark kern.ttys as MPSAFE. > > =20 > > sysctl now allows Giantless calls, so make kern.ttys use this. If it > > needs Giant, it locks the proper TTY anyway. >=20 > You want CTLFLAG_MPSAFE, not CTLFLAG_NOLOCK. NOLOCK means something else= (it=20 > has to do with sysctl_wire_old_buffer()). Ah, indeed. I'll fix this ASAP (this evening). --=20 Ed Schouten WWW: http://80386.nl/ --GV0iVqYguTV4Q9ER Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkl94fgACgkQ52SDGA2eCwUwEgCfSKPCLE2jQ+yHY2otXP2ZYsQT fPkAn37gSI82du09PCuQW1BB2+ycZwm/ =c8Ib -----END PGP SIGNATURE----- --GV0iVqYguTV4Q9ER-- From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 16:43:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B82A106566B; Mon, 26 Jan 2009 16:43:18 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59B248FC1C; Mon, 26 Jan 2009 16:43:18 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QGhIlA055933; Mon, 26 Jan 2009 16:43:18 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QGhI3x055932; Mon, 26 Jan 2009 16:43:18 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200901261643.n0QGhI3x055932@svn.freebsd.org> From: Ed Schouten Date: Mon, 26 Jan 2009 16:43:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187722 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 16:43:18 -0000 Author: ed Date: Mon Jan 26 16:43:18 2009 New Revision: 187722 URL: http://svn.freebsd.org/changeset/base/187722 Log: Use the proper flag to let kern.ttys be executed without Giant. Pointed out by: jhb Modified: head/sys/kern/tty.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Mon Jan 26 15:55:15 2009 (r187721) +++ head/sys/kern/tty.c Mon Jan 26 16:43:18 2009 (r187722) @@ -1053,7 +1053,7 @@ sysctl_kern_ttys(SYSCTL_HANDLER_ARGS) return (error); } -SYSCTL_PROC(_kern, OID_AUTO, ttys, CTLTYPE_OPAQUE|CTLFLAG_RD|CTLFLAG_NOLOCK, +SYSCTL_PROC(_kern, OID_AUTO, ttys, CTLTYPE_OPAQUE|CTLFLAG_RD|CTLFLAG_MPSAFE, 0, 0, sysctl_kern_ttys, "S,xtty", "List of TTYs"); /* From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 17:00:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 892BD10656F7; Mon, 26 Jan 2009 17:00:58 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 765728FC29; Mon, 26 Jan 2009 17:00:58 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QH0wau056321; Mon, 26 Jan 2009 17:00:58 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QH0wFi056320; Mon, 26 Jan 2009 17:00:58 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200901261700.n0QH0wFi056320@svn.freebsd.org> From: Roman Divacky Date: Mon, 26 Jan 2009 17:00:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187723 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 17:00:59 -0000 Author: rdivacky Date: Mon Jan 26 17:00:58 2009 New Revision: 187723 URL: http://svn.freebsd.org/changeset/base/187723 Log: kmod.mk includes bsd.sys.mk anyway so use CSTD instead of homegrown reimplementation of the same. Note that this changes -std=c99 to -std=iso9899:1999 but those two are synonyms. Approved by: kib (mentor) Reviewed by: ru Modified: head/sys/conf/kmod.mk Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Mon Jan 26 16:43:18 2009 (r187722) +++ head/sys/conf/kmod.mk Mon Jan 26 17:00:58 2009 (r187723) @@ -89,10 +89,9 @@ CFLAGS+= -DKLD_MODULE .if ${CC} == "icc" NOSTDINC= -X .else -C_DIALECT= -std=c99 +CSTD= c99 NOSTDINC= -nostdinc .endif -CFLAGS+= ${C_DIALECT} CFLAGS:= ${CFLAGS:N-I*} ${NOSTDINC} ${INCLMAGIC} ${CFLAGS:M-I*} .if defined(KERNBUILDDIR) CFLAGS+= -DHAVE_KERNEL_OPTION_HEADERS -include ${KERNBUILDDIR}/opt_global.h From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 17:09:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BAEE10656F3; Mon, 26 Jan 2009 17:09:27 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DED308FC12; Mon, 26 Jan 2009 17:09:26 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QH9QYi056528; Mon, 26 Jan 2009 17:09:26 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QH9Qkk056527; Mon, 26 Jan 2009 17:09:26 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <200901261709.n0QH9Qkk056527@svn.freebsd.org> From: "David E. O'Brien" Date: Mon, 26 Jan 2009 17:09:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187724 - head/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 17:09:30 -0000 Author: obrien Date: Mon Jan 26 17:09:26 2009 New Revision: 187724 URL: http://svn.freebsd.org/changeset/base/187724 Log: No need to wrap _PATH_SYSPATH. It makes it harder to grep(1) for its value. (also unwrapping better matches existing style) Modified: head/include/paths.h Modified: head/include/paths.h ============================================================================== --- head/include/paths.h Mon Jan 26 17:00:58 2009 (r187723) +++ head/include/paths.h Mon Jan 26 17:09:26 2009 (r187724) @@ -45,8 +45,7 @@ #define _PATH_STDPATH \ "/usr/bin:/bin:/usr/sbin:/sbin:" /* Locate system binaries */ -#define _PATH_SYSPATH \ - "/sbin:/usr/sbin" +#define _PATH_SYSPATH "/sbin:/usr/sbin" #define _PATH_AUTHCONF "/etc/auth.conf" #define _PATH_BSHELL "/bin/sh" From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 17:30:38 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45188106579D; Mon, 26 Jan 2009 17:30:38 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id F0B3A8FC23; Mon, 26 Jan 2009 17:30:37 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n0QHR3iY048859; Mon, 26 Jan 2009 10:27:03 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 26 Jan 2009 10:27:49 -0700 (MST) Message-Id: <20090126.102749.-1017604081.imp@bsdimp.com> To: obrien@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090126083518.GB87007@dragon.NUXI.org> References: <200901220621.n0M6LU5v002745@svn.freebsd.org> <20090122.104114.1927899760.imp@bsdimp.com> <20090126083518.GB87007@dragon.NUXI.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, jeff@FreeBSD.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r187580 - head/tools/sched X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 17:30:39 -0000 In message: <20090126083518.GB87007@dragon.NUXI.org> "David O'Brien" writes: : On Thu, Jan 22, 2009 at 10:41:14AM -0700, M. Warner Losh wrote: : > In message: <200901220621.n0M6LU5v002745@svn.freebsd.org> : > Jeff Roberson writes: : > : Author: jeff : > : Date: Thu Jan 22 06:21:30 2009 : > : New Revision: 187580 : > : URL: http://svn.freebsd.org/changeset/base/187580 : > : : > : Log: : > : - Update my copyright. : > : +# Copyright (c) 2002-2003, 2009, Jeffrey Roberson : > : > Stylistically, this should be 2002-2009. We don't need to list each : > and every year, so the project's policy is to list the earliest and : > the latest year. : : There is debate on this. GCC/Bintuils/GDB require years to be : specifically listed in which changes occur. Generally this means : discrete years, but I believe "2002-2003, 2009" maybe accepted also. : The listed years should not imply changes happened in years there was no : change, which 2002-2009 would imply. : : This is also what the lawyers at work require. Right. But this is the FreeBSD project, and we, as a project, have determined that ranges are sufficient. There's no debate within the project about policy. Of course, other projects do other things. : > See, for example, http://www.oppedahl.com/copyrights/ for the : > reasoning behind this. : : Unfortunately this returns "(61) Connection refused". Works for me just now. Warner From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 17:42:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EE9810656DB; Mon, 26 Jan 2009 17:42:02 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C0AD8FC1E; Mon, 26 Jan 2009 17:42:02 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QHg27m057392; Mon, 26 Jan 2009 17:42:02 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QHg2Ll057390; Mon, 26 Jan 2009 17:42:02 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200901261742.n0QHg2Ll057390@svn.freebsd.org> From: Andrew Thompson Date: Mon, 26 Jan 2009 17:42:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187725 - in head/sys/dev: usb usb2/quirk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 17:42:03 -0000 Author: thompsa Date: Mon Jan 26 17:42:02 2009 New Revision: 187725 URL: http://svn.freebsd.org/changeset/base/187725 Log: Add a usb hid quirk. Submitted by: Andre Guibert de Bruet Modified: head/sys/dev/usb/usbdevs head/sys/dev/usb2/quirk/usb2_quirk.c Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Mon Jan 26 17:09:26 2009 (r187724) +++ head/sys/dev/usb/usbdevs Mon Jan 26 17:42:02 2009 (r187725) @@ -1508,6 +1508,7 @@ product IOMEGA ZIP250 0x0030 Zip 250 /* Ituner networks products */ product ITUNERNET USBLCD2X20 0x0002 USB-LCD 2x20 +product ITUNERNET USBLCD4X20 0xc001 USB-LCD 4x20 /* Jablotron products */ product JABLOTRON PC60B 0x0001 PC-60B Modified: head/sys/dev/usb2/quirk/usb2_quirk.c ============================================================================== --- head/sys/dev/usb2/quirk/usb2_quirk.c Mon Jan 26 17:09:26 2009 (r187724) +++ head/sys/dev/usb2/quirk/usb2_quirk.c Mon Jan 26 17:42:02 2009 (r187725) @@ -95,6 +95,7 @@ static struct usb2_quirk_entry usb2_quir {USB_QUIRK_ENTRY(USB_VENDOR_CYBERPOWER, USB_PRODUCT_CYBERPOWER_1500CAVRLCD, 0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)}, {USB_QUIRK_ENTRY(USB_VENDOR_DELORME, USB_PRODUCT_DELORME_EARTHMATE, 0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)}, {USB_QUIRK_ENTRY(USB_VENDOR_ITUNERNET, USB_PRODUCT_ITUNERNET_USBLCD2X20, 0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)}, + {USB_QUIRK_ENTRY(USB_VENDOR_ITUNERNET, USB_PRODUCT_ITUNERNET_USBLCD4X20, 0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)}, {USB_QUIRK_ENTRY(USB_VENDOR_MGE, USB_PRODUCT_MGE_UPS1, 0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)}, {USB_QUIRK_ENTRY(USB_VENDOR_MGE, USB_PRODUCT_MGE_UPS2, 0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)}, {USB_QUIRK_ENTRY(USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPHONE, 0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)}, From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 17:43:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8BB31065672; Mon, 26 Jan 2009 17:43:59 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C688C8FC20; Mon, 26 Jan 2009 17:43:59 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QHhx9F057463; Mon, 26 Jan 2009 17:43:59 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QHhwVH057461; Mon, 26 Jan 2009 17:43:58 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200901261743.n0QHhwVH057461@svn.freebsd.org> From: Andrew Thompson Date: Mon, 26 Jan 2009 17:43:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187726 - in head/sys/dev: usb usb2/storage X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 17:44:00 -0000 Author: thompsa Date: Mon Jan 26 17:43:58 2009 New Revision: 187726 URL: http://svn.freebsd.org/changeset/base/187726 Log: Add umass quirk. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usbdevs head/sys/dev/usb2/storage/umass2.c Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Mon Jan 26 17:42:02 2009 (r187725) +++ head/sys/dev/usb/usbdevs Mon Jan 26 17:43:58 2009 (r187726) @@ -1801,6 +1801,7 @@ product MSYSTEMS DISKONKEY2 0x0011 DiskO /* Myson products */ product MYSON HEDEN 0x8818 USB-IDE +product MYSON STARREADER 0x9920 USB flash card adapter /* National Semiconductor */ product NATIONAL BEARPAW1200 0x1000 BearPaw 1200 Modified: head/sys/dev/usb2/storage/umass2.c ============================================================================== --- head/sys/dev/usb2/storage/umass2.c Mon Jan 26 17:42:02 2009 (r187725) +++ head/sys/dev/usb2/storage/umass2.c Mon Jan 26 17:43:58 2009 (r187726) @@ -612,6 +612,10 @@ static const struct umass_devdescr umass UMASS_PROTO_SCSI | UMASS_PROTO_BBB, NO_INQUIRY | IGNORE_RESIDUE }, + {USB_VENDOR_MYSON, USB_PRODUCT_MYSON_STARREADER, RID_WILDCARD, + UMASS_PROTO_SCSI | UMASS_PROTO_BBB, + NO_SYNCHRONIZE_CACHE + }, {USB_VENDOR_NEODIO, USB_PRODUCT_NEODIO_ND3260, RID_WILDCARD, UMASS_PROTO_SCSI | UMASS_PROTO_BBB, FORCE_SHORT_INQUIRY From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 17:45:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B52E710656BE; Mon, 26 Jan 2009 17:45:50 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A10378FC1A; Mon, 26 Jan 2009 17:45:50 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QHjoUw057570; Mon, 26 Jan 2009 17:45:50 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QHjomp057569; Mon, 26 Jan 2009 17:45:50 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200901261745.n0QHjomp057569@svn.freebsd.org> From: Andrew Thompson Date: Mon, 26 Jan 2009 17:45:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187727 - head/sys/dev/usb2/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 17:45:52 -0000 Author: thompsa Date: Mon Jan 26 17:45:50 2009 New Revision: 187727 URL: http://svn.freebsd.org/changeset/base/187727 Log: Fix up USB_GET_REPORT_DESC ioctl. Submitted by: daichi Modified: head/sys/dev/usb2/include/usb2_ioctl.h Modified: head/sys/dev/usb2/include/usb2_ioctl.h ============================================================================== --- head/sys/dev/usb2/include/usb2_ioctl.h Mon Jan 26 17:43:58 2009 (r187726) +++ head/sys/dev/usb2/include/usb2_ioctl.h Mon Jan 26 17:45:50 2009 (r187727) @@ -223,7 +223,7 @@ struct usb2_gen_quirk { #define USB_DEVICEENUMERATE _IOW ('U', 6, int) /* Generic HID device */ -#define USB_GET_REPORT_DESC _IOR ('U', 21, struct usb2_gen_descriptor) +#define USB_GET_REPORT_DESC _IOWR('U', 21, struct usb2_gen_descriptor) #define USB_SET_IMMED _IOW ('U', 22, int) #define USB_GET_REPORT _IOWR('U', 23, struct usb2_gen_descriptor) #define USB_SET_REPORT _IOW ('U', 24, struct usb2_gen_descriptor) From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 17:47:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71E2B106568C; Mon, 26 Jan 2009 17:47:32 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D3A28FC12; Mon, 26 Jan 2009 17:47:32 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QHlWEG057644; Mon, 26 Jan 2009 17:47:32 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QHlWEL057643; Mon, 26 Jan 2009 17:47:32 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200901261747.n0QHlWEL057643@svn.freebsd.org> From: Andrew Thompson Date: Mon, 26 Jan 2009 17:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187728 - head/sys/dev/usb2/serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 17:47:34 -0000 Author: thompsa Date: Mon Jan 26 17:47:32 2009 New Revision: 187728 URL: http://svn.freebsd.org/changeset/base/187728 Log: MFp4 //depot/projects/usb/ @156521 U3G regression issue. Patch to support multiple modem instances per logical USB interface. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb2/serial/u3g2.c Modified: head/sys/dev/usb2/serial/u3g2.c ============================================================================== --- head/sys/dev/usb2/serial/u3g2.c Mon Jan 26 17:45:50 2009 (r187727) +++ head/sys/dev/usb2/serial/u3g2.c Mon Jan 26 17:47:32 2009 (r187728) @@ -93,9 +93,9 @@ enum { struct u3g_softc { struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom; + struct usb2_com_softc sc_ucom[U3G_MAXPORTS]; - struct usb2_xfer *sc_xfer[U3G_N_TRANSFER]; + struct usb2_xfer *sc_xfer[U3G_MAXPORTS][U3G_N_TRANSFER]; struct usb2_device *sc_udev; uint8_t sc_iface_no; /* interface number */ @@ -382,8 +382,11 @@ u3g_probe(device_t self) static int u3g_attach(device_t dev) { + struct usb2_config u3g_config_tmp[U3G_N_TRANSFER]; struct usb2_attach_arg *uaa = device_get_ivars(dev); struct u3g_softc *sc = device_get_softc(dev); + uint8_t n; + uint8_t m; int error; DPRINTF("sc=%p\n", sc); @@ -391,6 +394,10 @@ u3g_attach(device_t dev) if (sc == NULL) { return (ENOMEM); } + /* copy in USB config */ + for (n = 0; n != U3G_N_TRANSFER; n++) + u3g_config_tmp[n] = u3g_config[n]; + device_set_usb2_desc(dev); sc->sc_udev = uaa->device; @@ -398,23 +405,41 @@ u3g_attach(device_t dev) sc->sc_iface_index = uaa->info.bIfaceIndex; sc->sc_speed = u3g_speeds[U3G_GET_SPEED(uaa)]; - error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index, - sc->sc_xfer, u3g_config, U3G_N_TRANSFER, sc, &Giant); + for (m = 0; m != U3G_MAXPORTS; m++) { - if (error) { - DPRINTF("could not allocate all pipes\n"); - goto detach; + /* update BULK endpoint index */ + for (n = 0; n != U3G_N_TRANSFER; n++) + u3g_config_tmp[n].ep_index = m; + + /* try to allocate a set of BULK endpoints */ + error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index, + sc->sc_xfer[m], u3g_config_tmp, U3G_N_TRANSFER, + &sc->sc_ucom[m], &Giant); + + if (error) { + if (m != 0) + break; /* end of endpoints */ + DPRINTF("could not allocate all pipes\n"); + goto detach; + } + /* set stall by default */ + usb2_transfer_set_stall(sc->sc_xfer[m][U3G_BULK_WR]); + usb2_transfer_set_stall(sc->sc_xfer[m][U3G_BULK_RD]); } - /* set stall by default */ - usb2_transfer_set_stall(sc->sc_xfer[U3G_BULK_WR]); - usb2_transfer_set_stall(sc->sc_xfer[U3G_BULK_RD]); - error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &u3g_callback, &Giant); + sc->sc_numports = m; + + error = usb2_com_attach(&sc->sc_super_ucom, sc->sc_ucom, + sc->sc_numports, sc, &u3g_callback, &Giant); if (error) { DPRINTF("usb2_com_attach failed\n"); goto detach; } + if (sc->sc_numports != 1) { + /* be verbose */ + device_printf(dev, "Found %u ports.\n", + (unsigned int)sc->sc_numports); + } return (0); detach: @@ -426,12 +451,15 @@ static int u3g_detach(device_t dev) { struct u3g_softc *sc = device_get_softc(dev); + uint8_t m; DPRINTF("sc=%p\n", sc); - usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); + /* NOTE: It is not dangerous to detach more ports than attached! */ + usb2_com_detach(&sc->sc_super_ucom, sc->sc_ucom, U3G_MAXPORTS); - usb2_transfer_unsetup(sc->sc_xfer, U3G_N_TRANSFER); + for (m = 0; m != U3G_MAXPORTS; m++) + usb2_transfer_unsetup(sc->sc_xfer[m], U3G_N_TRANSFER); return (0); } @@ -442,7 +470,7 @@ u3g_start_read(struct usb2_com_softc *uc struct u3g_softc *sc = ucom->sc_parent; /* start read endpoint */ - usb2_transfer_start(sc->sc_xfer[U3G_BULK_RD]); + usb2_transfer_start(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_RD]); return; } @@ -452,7 +480,7 @@ u3g_stop_read(struct usb2_com_softc *uco struct u3g_softc *sc = ucom->sc_parent; /* stop read endpoint */ - usb2_transfer_stop(sc->sc_xfer[U3G_BULK_RD]); + usb2_transfer_stop(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_RD]); return; } @@ -461,7 +489,7 @@ u3g_start_write(struct usb2_com_softc *u { struct u3g_softc *sc = ucom->sc_parent; - usb2_transfer_start(sc->sc_xfer[U3G_BULK_WR]); + usb2_transfer_start(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_WR]); return; } @@ -470,21 +498,21 @@ u3g_stop_write(struct usb2_com_softc *uc { struct u3g_softc *sc = ucom->sc_parent; - usb2_transfer_stop(sc->sc_xfer[U3G_BULK_WR]); + usb2_transfer_stop(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_WR]); return; } static void u3g_write_callback(struct usb2_xfer *xfer) { - struct u3g_softc *sc = xfer->priv_sc; + struct usb2_com_softc *ucom = xfer->priv_sc; uint32_t actlen; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: case USB_ST_SETUP: tr_setup: - if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0, + if (usb2_com_get_data(ucom, xfer->frbuffers, 0, U3G_BSIZE, &actlen)) { xfer->frlengths[0] = actlen; usb2_start_hardware(xfer); @@ -505,11 +533,11 @@ tr_setup: static void u3g_read_callback(struct usb2_xfer *xfer) { - struct u3g_softc *sc = xfer->priv_sc; + struct usb2_com_softc *ucom = xfer->priv_sc; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen); + usb2_com_put_data(ucom, xfer->frbuffers, 0, xfer->actlen); case USB_ST_SETUP: tr_setup: From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 17:49:22 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5026910657A6; Mon, 26 Jan 2009 17:49:19 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85]) by mx1.freebsd.org (Postfix) with ESMTP id D35E78FC1C; Mon, 26 Jan 2009 17:49:15 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1]) by dragon.nuxi.org (8.14.2/8.14.2) with ESMTP id n0QHn8pR004651; Mon, 26 Jan 2009 09:49:08 -0800 (PST) (envelope-from obrien@dragon.nuxi.org) Received: (from obrien@localhost) by dragon.nuxi.org (8.14.2/8.14.2/Submit) id n0QHn80K004650; Mon, 26 Jan 2009 09:49:08 -0800 (PST) (envelope-from obrien) Date: Mon, 26 Jan 2009 09:49:08 -0800 From: "David O'Brien" To: "M. Warner Losh" Message-ID: <20090126174908.GF87007@dragon.NUXI.org> References: <200901220621.n0M6LU5v002745@svn.freebsd.org> <20090122.104114.1927899760.imp@bsdimp.com> <20090126083518.GB87007@dragon.NUXI.org> <20090126.102749.-1017604081.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090126.102749.-1017604081.imp@bsdimp.com> X-Operating-System: FreeBSD 8.0-CURRENT User-Agent: Mutt/1.5.16 (2007-06-09) Cc: svn-src-head@FreeBSD.org, jeff@FreeBSD.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r187580 - head/tools/sched X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 17:49:26 -0000 On Mon, Jan 26, 2009 at 10:27:49AM -0700, M. Warner Losh wrote: > In message: <20090126083518.GB87007@dragon.NUXI.org> > "David O'Brien" writes: > : On Thu, Jan 22, 2009 at 10:41:14AM -0700, M. Warner Losh wrote: > : > In message: <200901220621.n0M6LU5v002745@svn.freebsd.org> > : > Jeff Roberson writes: > : > : Log: > : > : - Update my copyright. > : > : +# Copyright (c) 2002-2003, 2009, Jeffrey Roberson > : > > : > Stylistically, this should be 2002-2009. We don't need to list each > : > and every year, so the project's policy is to list the earliest and > : > the latest year. > : > : There is debate on this. GCC/Bintuils/GDB require years to be > : specifically listed in which changes occur. Generally this means > : discrete years, but I believe "2002-2003, 2009" maybe accepted also. > : The listed years should not imply changes happened in years there was no > : change, which 2002-2009 would imply. > : This is also what the lawyers at work require. > > Right. But this is the FreeBSD project, and we, as a project, have > determined that ranges are sufficient. There's no debate within the > project about policy. Of course, other projects do other things. Right, but for The FreeBSD Project are ranges sufficient or necessary? You didn't seem happy with Jeff's text, so it almost sounds like you're saying its necessary. -- -- David (obrien@FreeBSD.org) From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 17:49:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DD6E1065811; Mon, 26 Jan 2009 17:49:58 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F8848FC27; Mon, 26 Jan 2009 17:49:58 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QHnwNt057792; Mon, 26 Jan 2009 17:49:58 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QHnwZm057789; Mon, 26 Jan 2009 17:49:58 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200901261749.n0QHnwZm057789@svn.freebsd.org> From: Andrew Thompson Date: Mon, 26 Jan 2009 17:49:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187730 - in head/sys/dev/usb2: controller core X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 17:50:01 -0000 Author: thompsa Date: Mon Jan 26 17:49:58 2009 New Revision: 187730 URL: http://svn.freebsd.org/changeset/base/187730 Log: MFp4 //depot/projects/usb/ @156522,156530 UHCI SOF Quirk. Makes some broken USB devices work again. Reported by several people. Patch made by me. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb2/controller/uhci2.c head/sys/dev/usb2/controller/usb2_controller.h head/sys/dev/usb2/core/usb2_hub.c Modified: head/sys/dev/usb2/controller/uhci2.c ============================================================================== --- head/sys/dev/usb2/controller/uhci2.c Mon Jan 26 17:49:48 2009 (r187729) +++ head/sys/dev/usb2/controller/uhci2.c Mon Jan 26 17:49:58 2009 (r187730) @@ -2396,6 +2396,24 @@ uhci_portreset(uhci_softc_t *sc, uint16_ else return (USB_ERR_IOERROR); + /* + * Before we do anything, turn on SOF messages on the USB + * BUS. Some USB devices do not cope without them! + */ + if (!(UREAD2(sc, UHCI_CMD) & UHCI_CMD_RS)) { + + DPRINTF("Activating SOFs!\n"); + + UHCICMD(sc, (UHCI_CMD_MAXP | UHCI_CMD_RS)); + + /* wait a little bit */ + if (use_polling) { + DELAY(10000); + } else { + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 10); + } + } + x = URWMASK(UREAD2(sc, port)); UWRITE2(sc, port, x | UHCI_PORTSC_PR); @@ -3320,7 +3338,13 @@ uhci_set_hw_power(struct usb2_bus *bus) flags = bus->hw_power_state; + /* + * WARNING: Some FULL speed USB devices require periodic SOF + * messages! If any USB devices are connected through the + * UHCI, power save will be disabled! + */ if (flags & (USB_HW_POWER_CONTROL | + USB_HW_POWER_NON_ROOT_HUB | USB_HW_POWER_BULK | USB_HW_POWER_INTERRUPT | USB_HW_POWER_ISOC)) { Modified: head/sys/dev/usb2/controller/usb2_controller.h ============================================================================== --- head/sys/dev/usb2/controller/usb2_controller.h Mon Jan 26 17:49:48 2009 (r187729) +++ head/sys/dev/usb2/controller/usb2_controller.h Mon Jan 26 17:49:58 2009 (r187730) @@ -84,6 +84,11 @@ struct usb2_bus_methods { * are active: */ #define USB_HW_POWER_ISOC 0x08 + /* + * The following flag is set if one or more non-root-HUB devices + * are present on the given USB bus: + */ +#define USB_HW_POWER_NON_ROOT_HUB 0x10 /* USB Device mode only - Mandatory */ Modified: head/sys/dev/usb2/core/usb2_hub.c ============================================================================== --- head/sys/dev/usb2/core/usb2_hub.c Mon Jan 26 17:49:48 2009 (r187729) +++ head/sys/dev/usb2/core/usb2_hub.c Mon Jan 26 17:49:58 2009 (r187730) @@ -1503,7 +1503,7 @@ usb2_bus_powerd(struct usb2_bus *bus) unsigned int temp; unsigned int limit; unsigned int mintime; - uint32_t type_refs[4]; + uint32_t type_refs[5]; uint8_t x; uint8_t rem_wakeup; @@ -1564,6 +1564,7 @@ usb2_bus_powerd(struct usb2_bus *bus) type_refs[1] = 0; type_refs[2] = 0; type_refs[3] = 0; + type_refs[4] = 0; /* Re-loop all the devices to get the actual state */ @@ -1574,6 +1575,9 @@ usb2_bus_powerd(struct usb2_bus *bus) if (udev == NULL) continue; + /* we found a non-Root-Hub USB device */ + type_refs[4] += 1; + /* "last_xfer_time" can be updated by a resume */ temp = ticks - udev->pwr_save.last_xfer_time; @@ -1604,6 +1608,8 @@ usb2_bus_powerd(struct usb2_bus *bus) bus->hw_power_state |= USB_HW_POWER_INTERRUPT; if (type_refs[UE_ISOCHRONOUS] != 0) bus->hw_power_state |= USB_HW_POWER_ISOC; + if (type_refs[4] != 0) + bus->hw_power_state |= USB_HW_POWER_NON_ROOT_HUB; } USB_BUS_UNLOCK(bus); From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 17:50:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DA66106584D; Mon, 26 Jan 2009 17:50:22 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 750EF8FC2A; Mon, 26 Jan 2009 17:50:20 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QHoKFp057844; Mon, 26 Jan 2009 17:50:20 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QHoKWM057842; Mon, 26 Jan 2009 17:50:20 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200901261750.n0QHoKWM057842@svn.freebsd.org> From: Andrew Thompson Date: Mon, 26 Jan 2009 17:50:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187731 - head/sys/dev/usb2/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 17:50:28 -0000 Author: thompsa Date: Mon Jan 26 17:50:20 2009 New Revision: 187731 URL: http://svn.freebsd.org/changeset/base/187731 Log: Regen. Modified: head/sys/dev/usb2/include/usb2_devid.h head/sys/dev/usb2/include/usb2_devtable.h Modified: head/sys/dev/usb2/include/usb2_devid.h ============================================================================== --- head/sys/dev/usb2/include/usb2_devid.h Mon Jan 26 17:49:58 2009 (r187730) +++ head/sys/dev/usb2/include/usb2_devid.h Mon Jan 26 17:50:20 2009 (r187731) @@ -4,7 +4,7 @@ * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * FreeBSD: head/sys/dev/usb/usbdevs 187163 2009-01-13 19:01:25Z thompsa + * FreeBSD: head/sys/dev/usb/usbdevs 187726 2009-01-26 17:43:58Z thompsa */ /* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */ @@ -630,6 +630,7 @@ #define USB_VENDOR_LINKSYS3 0x1915 /* Linksys */ #define USB_VENDOR_QUALCOMMINC 0x19d2 /* Qualcomm, Incorporated */ #define USB_VENDOR_STELERA 0x1a8d /* Stelera Wireless */ +#define USB_VENDOR_DRESDENELEKTRONIK 0x1cf1 /* dresden elektronik */ #define USB_VENDOR_DLINK 0x2001 /* D-Link */ #define USB_VENDOR_PLANEX2 0x2019 /* Planex Communications */ #define USB_VENDOR_ERICSSON 0x2282 /* Ericsson */ @@ -1176,6 +1177,9 @@ /* DrayTek products */ #define USB_PRODUCT_DRAYTEK_VIGOR550 0x0550 /* Vigor550 */ +/* dresden elektronik products */ +#define USB_PRODUCT_DRESDENELEKTRONIK_SENSORTERMINALBOARD 0x0001 /* SensorTerminalBoard */ + /* Dynastream Innovations */ #define USB_PRODUCT_DYNASTREAM_ANTDEVBOARD 0x1003 /* ANT dev board */ @@ -1511,6 +1515,7 @@ /* Ituner networks products */ #define USB_PRODUCT_ITUNERNET_USBLCD2X20 0x0002 /* USB-LCD 2x20 */ +#define USB_PRODUCT_ITUNERNET_USBLCD4X20 0xc001 /* USB-LCD 4x20 */ /* Jablotron products */ #define USB_PRODUCT_JABLOTRON_PC60B 0x0001 /* PC-60B */ @@ -1803,6 +1808,7 @@ /* Myson products */ #define USB_PRODUCT_MYSON_HEDEN 0x8818 /* USB-IDE */ +#define USB_PRODUCT_MYSON_STARREADER 0x9920 /* USB flash card adapter */ /* National Semiconductor */ #define USB_PRODUCT_NATIONAL_BEARPAW1200 0x1000 /* BearPaw 1200 */ @@ -1833,6 +1839,7 @@ #define USB_PRODUCT_NETGEAR_WG111V2_2 0x4240 /* PrismGT USB 2.0 WLAN */ #define USB_PRODUCT_NETGEAR_WG111U 0x4300 /* WG111U */ #define USB_PRODUCT_NETGEAR_WG111U_NF 0x4301 /* WG111U (no firmware) */ +#define USB_PRODUCT_NETGEAR_WG111V2 0x6a00 /* WG111V2 */ #define USB_PRODUCT_NETGEAR2_MA101 0x4100 /* MA101 */ #define USB_PRODUCT_NETGEAR2_MA101B 0x4102 /* MA101 Rev B */ #define USB_PRODUCT_NETGEAR3_WG111T 0x4250 /* WG111T */ @@ -2047,6 +2054,7 @@ /* ReakTek products */ /* Green House and CompUSA OEM this part */ #define USB_PRODUCT_REALTEK_USBKR100 0x8150 /* USBKR100 USB Ethernet */ +#define USB_PRODUCT_REALTEK_RTL8187 0x8187 /* RTL8187 Wireless Adapter */ /* Ricoh products */ #define USB_PRODUCT_RICOH_VGPVCC2 0x1830 /* VGP-VCC2 Camera */ Modified: head/sys/dev/usb2/include/usb2_devtable.h ============================================================================== --- head/sys/dev/usb2/include/usb2_devtable.h Mon Jan 26 17:49:58 2009 (r187730) +++ head/sys/dev/usb2/include/usb2_devtable.h Mon Jan 26 17:50:20 2009 (r187731) @@ -4,7 +4,7 @@ * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * FreeBSD: head/sys/dev/usb/usbdevs 187163 2009-01-13 19:01:25Z thompsa + * FreeBSD: head/sys/dev/usb/usbdevs 187726 2009-01-26 17:43:58Z thompsa */ /* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */ @@ -2027,6 +2027,12 @@ const struct usb_knowndev usb_knowndevs[ "Vigor550", }, { + USB_VENDOR_DRESDENELEKTRONIK, USB_PRODUCT_DRESDENELEKTRONIK_SENSORTERMINALBOARD, + 0, + "dresden elektronik", + "SensorTerminalBoard", + }, + { USB_VENDOR_DYNASTREAM, USB_PRODUCT_DYNASTREAM_ANTDEVBOARD, 0, "Dynastream Innovations", @@ -3401,6 +3407,12 @@ const struct usb_knowndev usb_knowndevs[ "USB-LCD 2x20", }, { + USB_VENDOR_ITUNERNET, USB_PRODUCT_ITUNERNET_USBLCD4X20, + 0, + "I-Tuner Networks", + "USB-LCD 4x20", + }, + { USB_VENDOR_JABLOTRON, USB_PRODUCT_JABLOTRON_PC60B, 0, "Jablotron", @@ -4601,6 +4613,12 @@ const struct usb_knowndev usb_knowndevs[ "USB-IDE", }, { + USB_VENDOR_MYSON, USB_PRODUCT_MYSON_STARREADER, + 0, + "Myson Technology", + "USB flash card adapter", + }, + { USB_VENDOR_NATIONAL, USB_PRODUCT_NATIONAL_BEARPAW1200, 0, "National Semiconductor", @@ -4709,6 +4727,12 @@ const struct usb_knowndev usb_knowndevs[ "WG111U (no firmware)", }, { + USB_VENDOR_NETGEAR, USB_PRODUCT_NETGEAR_WG111V2, + 0, + "BayNETGEAR", + "WG111V2", + }, + { USB_VENDOR_NETGEAR2, USB_PRODUCT_NETGEAR2_MA101, 0, "Netgear", @@ -5603,6 +5627,12 @@ const struct usb_knowndev usb_knowndevs[ "USBKR100 USB Ethernet", }, { + USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8187, + 0, + "Realtek", + "RTL8187 Wireless Adapter", + }, + { USB_VENDOR_RICOH, USB_PRODUCT_RICOH_VGPVCC2, 0, "Ricoh", @@ -10709,6 +10739,12 @@ const struct usb_knowndev usb_knowndevs[ NULL, }, { + USB_VENDOR_DRESDENELEKTRONIK, 0, + USB_KNOWNDEV_NOPROD, + "dresden elektronik", + NULL, + }, + { USB_VENDOR_DLINK, 0, USB_KNOWNDEV_NOPROD, "D-Link", From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 17:55:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30468106579C; Mon, 26 Jan 2009 17:55:08 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C19F8FC1C; Mon, 26 Jan 2009 17:55:08 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QHt7iB057979; Mon, 26 Jan 2009 17:55:07 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QHt7YM057978; Mon, 26 Jan 2009 17:55:07 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200901261755.n0QHt7YM057978@svn.freebsd.org> From: Andrew Thompson Date: Mon, 26 Jan 2009 17:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187732 - head/sys/dev/usb2/controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 17:55:11 -0000 Author: thompsa Date: Mon Jan 26 17:55:07 2009 New Revision: 187732 URL: http://svn.freebsd.org/changeset/base/187732 Log: MFp4 //depot/projects/usb/ @156706 Adjust an UHCI portreset delay. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb2/controller/uhci2.c Modified: head/sys/dev/usb2/controller/uhci2.c ============================================================================== --- head/sys/dev/usb2/controller/uhci2.c Mon Jan 26 17:50:20 2009 (r187731) +++ head/sys/dev/usb2/controller/uhci2.c Mon Jan 26 17:55:07 2009 (r187732) @@ -2431,12 +2431,16 @@ uhci_portreset(uhci_softc_t *sc, uint16_ x = URWMASK(UREAD2(sc, port)); UWRITE2(sc, port, x & ~UHCI_PORTSC_PR); - if (use_polling) { - /* polling */ - DELAY(1000); - } else { - usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); - } + + mtx_unlock(&sc->sc_bus.bus_mtx); + + /* + * This delay needs to be exactly 100us, else some USB devices + * fail to attach! + */ + DELAY(100); + + mtx_lock(&sc->sc_bus.bus_mtx); DPRINTFN(4, "uhci port %d reset, status1 = 0x%04x\n", index, UREAD2(sc, port)); From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 18:01:13 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2B4510657FD; Mon, 26 Jan 2009 18:01:13 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 78C498FC24; Mon, 26 Jan 2009 18:01:13 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n0QHvF8X049551; Mon, 26 Jan 2009 10:57:15 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 26 Jan 2009 10:58:01 -0700 (MST) Message-Id: <20090126.105801.1031244444.imp@bsdimp.com> To: obrien@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090126174908.GF87007@dragon.NUXI.org> References: <20090126083518.GB87007@dragon.NUXI.org> <20090126.102749.-1017604081.imp@bsdimp.com> <20090126174908.GF87007@dragon.NUXI.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, jeff@FreeBSD.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r187580 - head/tools/sched X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 18:01:15 -0000 In message: <20090126174908.GF87007@dragon.NUXI.org> "David O'Brien" writes: : On Mon, Jan 26, 2009 at 10:27:49AM -0700, M. Warner Losh wrote: : > In message: <20090126083518.GB87007@dragon.NUXI.org> : > "David O'Brien" writes: : > : On Thu, Jan 22, 2009 at 10:41:14AM -0700, M. Warner Losh wrote: : > : > In message: <200901220621.n0M6LU5v002745@svn.freebsd.org> : > : > Jeff Roberson writes: : > : > : Log: : > : > : - Update my copyright. : > : > : +# Copyright (c) 2002-2003, 2009, Jeffrey Roberson : > : > : > : > Stylistically, this should be 2002-2009. We don't need to list each : > : > and every year, so the project's policy is to list the earliest and : > : > the latest year. : > : : > : There is debate on this. GCC/Bintuils/GDB require years to be : > : specifically listed in which changes occur. Generally this means : > : discrete years, but I believe "2002-2003, 2009" maybe accepted also. : > : The listed years should not imply changes happened in years there was no : > : change, which 2002-2009 would imply. : > : This is also what the lawyers at work require. : > : > Right. But this is the FreeBSD project, and we, as a project, have : > determined that ranges are sufficient. There's no debate within the : > project about policy. Of course, other projects do other things. : : Right, but for The FreeBSD Project are ranges sufficient or necessary? : You didn't seem happy with Jeff's text, so it almost sounds like you're : saying its necessary. Read what I said. The preferred style is 2002-2009, and that's the strong recommendation for people to follow unless there's a compelling reason to differ. Some of the "edge" cases have been listed in this thread: (1) Work that's done to the same file, both on your own, and for clients who own the work. (2) Interaction with external projects. (3) Strong developer preference for listing years. Listing the years provides extra data, but doesn't give any extra legal strength. Warner From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 18:14:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7031F1065753; Mon, 26 Jan 2009 18:14:21 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E7058FC1D; Mon, 26 Jan 2009 18:14:21 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QIELI7058431; Mon, 26 Jan 2009 18:14:21 GMT (envelope-from trhodes@svn.freebsd.org) Received: (from trhodes@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QIEL1r058430; Mon, 26 Jan 2009 18:14:21 GMT (envelope-from trhodes@svn.freebsd.org) Message-Id: <200901261814.n0QIEL1r058430@svn.freebsd.org> From: Tom Rhodes Date: Mon, 26 Jan 2009 18:14:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187734 - head/bin/chmod X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 18:14:22 -0000 Author: trhodes Date: Mon Jan 26 18:14:21 2009 New Revision: 187734 URL: http://svn.freebsd.org/changeset/base/187734 Log: Make the Monty Python quote more google friendly instead of hacking it apart. Discussed with: Christoph Mallon Modified: head/bin/chmod/chmod.1 Modified: head/bin/chmod/chmod.1 ============================================================================== --- head/bin/chmod/chmod.1 Mon Jan 26 17:56:27 2009 (r187733) +++ head/bin/chmod/chmod.1 Mon Jan 26 18:14:21 2009 (r187734) @@ -32,7 +32,7 @@ .\" @(#)chmod.1 8.4 (Berkeley) 3/31/94 .\" $FreeBSD$ .\" -.Dd January 23, 2009 +.Dd January 26, 2009 .Dt CHMOD 1 .Os .Sh NAME @@ -347,5 +347,4 @@ command appeared in .Sh BUGS There is no .Ar perm -option for the naughty bits which are ``S'' and -``T'' respectively. +option for the naughty bits of a horse. From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 19:00:54 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4952106566B; Mon, 26 Jan 2009 19:00:54 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 7E10C8FC13; Mon, 26 Jan 2009 19:00:54 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n0QJ3B9X031847; Mon, 26 Jan 2009 14:03:11 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n0QJ3ALm031846; Mon, 26 Jan 2009 14:03:10 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Mon, 26 Jan 2009 14:03:10 -0500 From: David Schultz To: Bruce Evans Message-ID: <20090126190310.GA31728@zim.MIT.EDU> Mail-Followup-To: Bruce Evans , Ed Schouten , Tom Rhodes , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <200901230058.n0N0wEjY026935@svn.freebsd.org> <20090125162123.GB17198@hoeg.nl> <20090126041926.J43097@delplex.bde.org> <20090125175751.GC17198@hoeg.nl> <20090126051910.E2148@besplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090126051910.E2148@besplex.bde.org> Cc: svn-src-head@FreeBSD.ORG, Ed Schouten , svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Tom Rhodes Subject: Re: svn commit: r187607 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 19:00:55 -0000 On Mon, Jan 26, 2009, Bruce Evans wrote: > - P_SYSTEM has something to do with swapping, and I also removed the > PS_INMEM setting for init. I have always used NO_SWAPPING and haven't > used a swap partition since memory sizes reached 64MB, so I wouldn't > have noticed problems with this. init doesn't run often so it is > quite likely to be swapped (if allowed to) if real memory runs out. Process kstack swapping was removed several years ago, so "swapping out" a process just deactivates all of its pages. In principle this could be safe to do with init, but it's probably a bad idea, and perhaps could lead to deadlock in the out-of-swap-space -> kill a process -> reparent the zombie to init path. PS_INMEM will prevent init from being swapped out. From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 20:11:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D4FB1065670; Mon, 26 Jan 2009 20:11:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 242E48FC25; Mon, 26 Jan 2009 20:11:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1LRXoE-000PxK-Ja; Mon, 26 Jan 2009 22:11:50 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n0QKBk8l032919 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 26 Jan 2009 22:11:46 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n0QKBkq4001103; Mon, 26 Jan 2009 22:11:46 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n0QKBksI001102; Mon, 26 Jan 2009 22:11:46 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 26 Jan 2009 22:11:46 +0200 From: Kostik Belousov To: David Schultz Message-ID: <20090126201146.GD2009@deviant.kiev.zoral.com.ua> References: <200901230058.n0N0wEjY026935@svn.freebsd.org> <20090125162123.GB17198@hoeg.nl> <20090126041926.J43097@delplex.bde.org> <20090125175751.GC17198@hoeg.nl> <20090126051910.E2148@besplex.bde.org> <20090126190310.GA31728@zim.MIT.EDU> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Km1U/tdNT/EmXiR1" Content-Disposition: inline In-Reply-To: <20090126190310.GA31728@zim.MIT.EDU> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1LRXoE-000PxK-Ja 889438f64eadba0efe29647fe13d7c05 X-Terabit: YES Cc: Ed Schouten , src-committers@freebsd.org, Tom Rhodes , svn-src-all@freebsd.org, Bruce Evans , svn-src-head@freebsd.org Subject: Re: svn commit: r187607 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 20:11:54 -0000 --Km1U/tdNT/EmXiR1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 26, 2009 at 02:03:10PM -0500, David Schultz wrote: > On Mon, Jan 26, 2009, Bruce Evans wrote: > > - P_SYSTEM has something to do with swapping, and I also removed the > > PS_INMEM setting for init. I have always used NO_SWAPPING and haven't > > used a swap partition since memory sizes reached 64MB, so I wouldn't > > have noticed problems with this. init doesn't run often so it is > > quite likely to be swapped (if allowed to) if real memory runs out. >=20 > Process kstack swapping was removed several years ago, so > "swapping out" a process just deactivates all of its pages. > In principle this could be safe to do with init, but it's probably > a bad idea, and perhaps could lead to deadlock in the > out-of-swap-space -> kill a process -> reparent the zombie to init > path. PS_INMEM will prevent init from being swapped out. Process kernel stacks swapping, or more explicitely, allowance to page out threads kernel stacks, is in the kernel. It is performed by vmdaemon, look for the call to swapout_procs(). Kernel stack contains pcb, but not the struct thread. Notifying the target process about raised signal requires only struct proc and referenced structures (p_sigact, p_sigqueue etc) that cannot be paged out. More interesting propery of the P_SYSTEM process is the immunity to the oom killer. But vm_pageout_oom() explicitely cares to not kill pid 1 or pid < 48. P.S. Your Mail-Followup-To: header may be considered offensive. --Km1U/tdNT/EmXiR1 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkl+GQEACgkQC3+MBN1Mb4iRXwCaA2vumXSbwEUGQzVRivIrEHVH a8wAn06B+8q4OSe8EMDqfRa35H7sVDm1 =RN0m -----END PGP SIGNATURE----- --Km1U/tdNT/EmXiR1-- From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 20:58:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F01810657B7; Mon, 26 Jan 2009 20:58:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 463748FC13; Mon, 26 Jan 2009 20:58:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QKw5Z1062809; Mon, 26 Jan 2009 20:58:05 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QKw50L062808; Mon, 26 Jan 2009 20:58:05 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200901262058.n0QKw50L062808@svn.freebsd.org> From: John Baldwin Date: Mon, 26 Jan 2009 20:58:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187740 - head/sys/dev/ppbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 20:58:11 -0000 Author: jhb Date: Mon Jan 26 20:58:05 2009 New Revision: 187740 URL: http://svn.freebsd.org/changeset/base/187740 Log: Don't unlock the parent ppc lock until after releasing the ppbus. Submitted by: csjp Modified: head/sys/dev/ppbus/lpt.c Modified: head/sys/dev/ppbus/lpt.c ============================================================================== --- head/sys/dev/ppbus/lpt.c Mon Jan 26 20:24:04 2009 (r187739) +++ head/sys/dev/ppbus/lpt.c Mon Jan 26 20:58:05 2009 (r187740) @@ -380,8 +380,8 @@ lpt_attach(device_t dev) } ppb_wctr(ppbus, LPC_NINIT); - ppb_unlock(ppbus); lpt_release_ppbus(dev); + ppb_unlock(ppbus); /* declare our interrupt handler */ sc->sc_intr_resource = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 20:59:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B86C010656E6; Mon, 26 Jan 2009 20:59:41 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A44088FC1C; Mon, 26 Jan 2009 20:59:41 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QKxfxv062892; Mon, 26 Jan 2009 20:59:41 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QKxfl8062890; Mon, 26 Jan 2009 20:59:41 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200901262059.n0QKxfl8062890@svn.freebsd.org> From: Maksim Yevmenkin Date: Mon, 26 Jan 2009 20:59:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187741 - head/sys/dev/usb2/bluetooth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 20:59:44 -0000 Author: emax Date: Mon Jan 26 20:59:41 2009 New Revision: 187741 URL: http://svn.freebsd.org/changeset/base/187741 Log: Clean up ng_ubt2. Get rid of excessive use of NG_NODE_REF/UNREF(). Make detach() completely synchronous. Properly handle stalled USB transfers (use internal mechanism instead of submitting own control transfers). Rename/remove a couple of variables and update comments. This work was done in close collaboration with HPS. Reviewed by: HPS Modified: head/sys/dev/usb2/bluetooth/ng_ubt2.c head/sys/dev/usb2/bluetooth/ng_ubt2_var.h Modified: head/sys/dev/usb2/bluetooth/ng_ubt2.c ============================================================================== --- head/sys/dev/usb2/bluetooth/ng_ubt2.c Mon Jan 26 20:58:05 2009 (r187740) +++ head/sys/dev/usb2/bluetooth/ng_ubt2.c Mon Jan 26 20:59:41 2009 (r187741) @@ -33,29 +33,25 @@ /* * NOTE: ng_ubt2 driver has a split personality. On one side it is - * a USB2 device driver and on the other it is a Netgraph node. This + * a USB device driver and on the other it is a Netgraph node. This * driver will *NOT* create traditional /dev/ enties, only Netgraph * node. * - * NOTE ON LOCKS USED: ng_ubt2 drives uses 3 locks (mutexes) + * NOTE ON LOCKS USED: ng_ubt2 drives uses 2 locks (mutexes) * - * 1) sc_if_mtx[0] - lock for device's interface #0. This lock is used - * by USB2 for any USB request going over device's interface #0, i.e. - * interrupt, control and bulk transfers. + * 1) sc_if_mtx - lock for device's interface #0 and #1. This lock is used + * by USB for any USB request going over device's interface #0 and #1, + * i.e. interrupt, control, bulk and isoc. transfers. * - * 2) sc_if_mtx[1] - lock for device's interface #1. This lock is used - * by USB2 for any USB request going over device's interface #1, i.e - * isoc. transfers. - * - * 3) sc_mbufq_mtx - lock for mbufq and task flags. This lock is used - * to protect device's outgoing mbuf queues and task flags. This lock - * *SHOULD NOT* be grabbed for a long time. In fact, think of it as a - * spin lock. + * 2) sc_ng_mtx - this lock is used to protect shared (between USB, Netgraph + * and Taskqueue) data, such as outgoing mbuf queues, task flags and hook + * pointer. This lock *SHOULD NOT* be grabbed for a long time. In fact, + * think of it as a spin lock. * * NOTE ON LOCKING STRATEGY: ng_ubt2 driver operates in 3 different contexts. * * 1) USB context. This is where all the USB related stuff happens. All - * callbacks run in this context. All callbacks are called (by USB2) with + * callbacks run in this context. All callbacks are called (by USB) with * appropriate interface lock held. It is (generally) allowed to grab * any additional locks. * @@ -63,35 +59,37 @@ * Since we mark node as WRITER, the Netgraph node will be "locked" (from * Netgraph point of view). Any variable that is only modified from the * Netgraph context does not require any additonal locking. It is generally - * *NOT* allowed to grab *ANY* additional lock. Whatever you do, *DO NOT* - * grab any long-sleep lock in the Netgraph context. In fact, the only - * lock that is allowed in the Netgraph context is the sc_mbufq_mtx lock. + * *NOT* allowed to grab *ANY* additional locks. Whatever you do, *DO NOT* + * grab any lock in the Netgraph context that could cause de-scheduling of + * the Netgraph thread for significant amount of time. In fact, the only + * lock that is allowed in the Netgraph context is the sc_ng_mtx lock. + * Also make sure that any code that is called from the Netgraph context + * follows the rule above. * - * 3) Taskqueue context. This is where ubt_task runs. Since we are NOT allowed - * to grab any locks in the Netgraph context, and, USB2 requires us to - * grab interface lock before doing things with transfers, we need to - * transition from the Netgraph context to the Taskqueue context before - * we can call into USB2 subsystem. + * 3) Taskqueue context. This is where ubt_task runs. Since we are generally + * NOT allowed to grab any lock that could cause de-scheduling in the + * Netgraph context, and, USB requires us to grab interface lock before + * doing things with transfers, it is safer to transition from the Netgraph + * context to the Taskqueue context before we can call into USB subsystem. * * So, to put everything together, the rules are as follows. * It is OK to call from the USB context or the Taskqueue context into * the Netgraph context (i.e. call NG_SEND_xxx functions). In other words * it is allowed to call into the Netgraph context with locks held. * Is it *NOT* OK to call from the Netgraph context into the USB context, - * because USB2 requires us to grab interface locks and we can not do that. - * To avoid this, we set task flags to indicate which actions we want to - * perform and schedule ubt_task which would run in the Taskqueue context. + * because USB requires us to grab interface locks, and, it is safer to + * avoid it. So, to make things safer we set task flags to indicate which + * actions we want to perform and schedule ubt_task which would run in the + * Taskqueue context. * Is is OK to call from the Taskqueue context into the USB context, * and, ubt_task does just that (i.e. grabs appropriate interface locks - * before calling into USB2). - * Access to the outgoing queues and task flags is controlled by the - * sc_mbufq_mtx lock. It is an unavoidable evil. Again, sc_mbufq_mtx should - * really be a spin lock. - * All USB callbacks accept Netgraph node pointer as private data. To - * ensure that Netgraph node pointer remains valid for the duration of the - * transfer, we grab a referrence to the node. In other words, if transfer is - * pending, then we should have a referrence on the node. NG_NODE_[NOT_]VALID - * macro is used to check if node is still present and pointer is valid. + * before calling into USB). + * Access to the outgoing queues, task flags and hook pointer is + * controlled by the sc_ng_mtx lock. It is an unavoidable evil. Again, + * sc_ng_mtx should really be a spin lock (and it is very likely to an + * equivalent of spin lock due to adaptive nature of freebsd mutexes). + * All USB callbacks accept softc pointer as a private data. USB ensures + * that this pointer is valid. */ #include @@ -128,9 +126,10 @@ static device_probe_t ubt_probe; static device_attach_t ubt_attach; static device_detach_t ubt_detach; -static int ubt_task_schedule(ubt_softc_p, int); +static void ubt_task_schedule(ubt_softc_p, int); static task_fn_t ubt_task; -static void ubt_xfer_start(ubt_softc_p, int); + +#define ubt_xfer_start(sc, i) usb2_transfer_start((sc)->sc_xfer[(i)]) /* Netgraph methods */ static ng_constructor_t ng_ubt_constructor; @@ -243,15 +242,13 @@ static struct ng_type typestruct = /* USB methods */ static usb2_callback_t ubt_ctrl_write_callback; static usb2_callback_t ubt_intr_read_callback; -static usb2_callback_t ubt_intr_read_clear_stall_callback; static usb2_callback_t ubt_bulk_read_callback; -static usb2_callback_t ubt_bulk_read_clear_stall_callback; static usb2_callback_t ubt_bulk_write_callback; -static usb2_callback_t ubt_bulk_write_clear_stall_callback; static usb2_callback_t ubt_isoc_read_callback; static usb2_callback_t ubt_isoc_write_callback; -static int ubt_isoc_read_one_frame(struct usb2_xfer *, int); +static int ubt_fwd_mbuf_up(ubt_softc_p, struct mbuf **); +static int ubt_isoc_read_one_frame(struct usb2_xfer *, int); /* * USB config @@ -279,8 +276,9 @@ static const struct usb2_config ubt_con .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, + .if_index = 0, .mh.bufsize = UBT_BULK_WRITE_BUFFER_SIZE, - .mh.flags = { .pipe_bof = 1, }, + .mh.flags = { .pipe_bof = 1, .force_short_xfer = 1, }, .mh.callback = &ubt_bulk_write_callback, }, /* Incoming bulk transfer - ACL packets */ @@ -288,6 +286,7 @@ static const struct usb2_config ubt_con .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, + .if_index = 0, .mh.bufsize = UBT_BULK_READ_BUFFER_SIZE, .mh.flags = { .pipe_bof = 1, .short_xfer_ok = 1, }, .mh.callback = &ubt_bulk_read_callback, @@ -297,6 +296,7 @@ static const struct usb2_config ubt_con .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, + .if_index = 0, .mh.flags = { .pipe_bof = 1, .short_xfer_ok = 1, }, .mh.bufsize = UBT_INTR_BUFFER_SIZE, .mh.callback = &ubt_intr_read_callback, @@ -306,43 +306,11 @@ static const struct usb2_config ubt_con .type = UE_CONTROL, .endpoint = 0x00, /* control pipe */ .direction = UE_DIR_ANY, + .if_index = 0, .mh.bufsize = UBT_CTRL_BUFFER_SIZE, .mh.callback = &ubt_ctrl_write_callback, .mh.timeout = 5000, /* 5 seconds */ }, - /* Outgoing control transfer to clear stall on outgoing bulk transfer */ - [UBT_IF_0_BULK_CS_WR] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* control pipe */ - .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.callback = &ubt_bulk_write_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ - }, - /* Outgoing control transfer to clear stall on incoming bulk transfer */ - [UBT_IF_0_BULK_CS_RD] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* control pipe */ - .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.callback = &ubt_bulk_read_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ - }, - /* - * Outgoing control transfer to clear stall on incoming - * interrupt transfer - */ - [UBT_IF_0_INTR_CS_RD] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* control pipe */ - .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.callback = &ubt_intr_read_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ - }, /* * Interface #1 @@ -353,6 +321,7 @@ static const struct usb2_config ubt_con .type = UE_ISOCHRONOUS, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, + .if_index = 1, .mh.bufsize = 0, /* use "wMaxPacketSize * frames" */ .mh.frames = UBT_ISOC_NFRAMES, .mh.flags = { .short_xfer_ok = 1, }, @@ -363,6 +332,7 @@ static const struct usb2_config ubt_con .type = UE_ISOCHRONOUS, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, + .if_index = 1, .mh.bufsize = 0, /* use "wMaxPacketSize * frames" */ .mh.frames = UBT_ISOC_NFRAMES, .mh.flags = { .short_xfer_ok = 1, }, @@ -373,6 +343,7 @@ static const struct usb2_config ubt_con .type = UE_ISOCHRONOUS, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, + .if_index = 1, .mh.bufsize = 0, /* use "wMaxPacketSize * frames" */ .mh.frames = UBT_ISOC_NFRAMES, .mh.flags = { .short_xfer_ok = 1, }, @@ -383,6 +354,7 @@ static const struct usb2_config ubt_con .type = UE_ISOCHRONOUS, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, + .if_index = 1, .mh.bufsize = 0, /* use "wMaxPacketSize * frames" */ .mh.frames = UBT_ISOC_NFRAMES, .mh.flags = { .short_xfer_ok = 1, }, @@ -399,13 +371,16 @@ static const struct usb2_config ubt_con * * where VENDOR_ID and PRODUCT_ID are hex numbers. */ -static const struct usb2_device_id ubt_ignore_devs[] = { + +static const struct usb2_device_id ubt_ignore_devs[] = +{ /* AVM USB Bluetooth-Adapter BlueFritz! v1.0 */ { USB_VPI(USB_VENDOR_AVM, 0x2200, 0) }, }; /* List of supported bluetooth devices */ -static const struct usb2_device_id ubt_devs[] = { +static const struct usb2_device_id ubt_devs[] = +{ /* Generic Bluetooth class devices */ { USB_IFACE_CLASS(UDCLASS_WIRELESS), USB_IFACE_SUBCLASS(UDSUBCLASS_RF), @@ -450,27 +425,26 @@ ubt_attach(device_t dev) struct ubt_softc *sc = device_get_softc(dev); struct usb2_endpoint_descriptor *ed; uint16_t wMaxPacketSize; - uint8_t alt_index, iface_index, i, j; + uint8_t alt_index, i, j; + uint8_t iface_index[2] = { 0, 1 }; device_set_usb2_desc(dev); - snprintf(sc->sc_name, sizeof(sc->sc_name), - "%s", device_get_nameunit(dev)); + sc->sc_dev = dev; + sc->sc_debug = NG_UBT_WARN_LEVEL; /* * Create Netgraph node */ - sc->sc_hook = NULL; - if (ng_make_node_common(&typestruct, &sc->sc_node) != 0) { - device_printf(dev, "could not create Netgraph node\n"); + UBT_ALERT(sc, "could not create Netgraph node\n"); return (ENXIO); } /* Name Netgraph node */ - if (ng_name_node(sc->sc_node, sc->sc_name) != 0) { - device_printf(dev, "could not name Netgraph node\n"); + if (ng_name_node(sc->sc_node, device_get_nameunit(dev)) != 0) { + UBT_ALERT(sc, "could not name Netgraph node\n"); NG_NODE_UNREF(sc->sc_node); return (ENXIO); } @@ -481,15 +455,9 @@ ubt_attach(device_t dev) * Initialize device softc structure */ - /* state */ - sc->sc_debug = NG_UBT_WARN_LEVEL; - sc->sc_flags = 0; - UBT_STAT_RESET(sc); - /* initialize locks */ - mtx_init(&sc->sc_mbufq_mtx, "ubt mbufq", NULL, MTX_DEF); - mtx_init(&sc->sc_if_mtx[0], "ubt if0", NULL, MTX_DEF | MTX_RECURSE); - mtx_init(&sc->sc_if_mtx[1], "ubt if1", NULL, MTX_DEF | MTX_RECURSE); + mtx_init(&sc->sc_ng_mtx, "ubt ng", NULL, MTX_DEF); + mtx_init(&sc->sc_if_mtx, "ubt if", NULL, MTX_DEF | MTX_RECURSE); /* initialize packet queues */ NG_BT_MBUFQ_INIT(&sc->sc_cmdq, UBT_DEFAULT_QLEN); @@ -497,15 +465,12 @@ ubt_attach(device_t dev) NG_BT_MBUFQ_INIT(&sc->sc_scoq, UBT_DEFAULT_QLEN); /* initialize glue task */ - sc->sc_task_flags = 0; - TASK_INIT(&sc->sc_task, 0, ubt_task, sc->sc_node); + TASK_INIT(&sc->sc_task, 0, ubt_task, sc); /* * Configure Bluetooth USB device. Discover all required USB * interfaces and endpoints. * - * Device is expected to be a high-speed device. - * * USB device must present two interfaces: * 1) Interface 0 that has 3 endpoints * 1) Interrupt endpoint to receive HCI events @@ -520,25 +485,9 @@ ubt_attach(device_t dev) * configurations with different packet size. */ - bzero(&sc->sc_xfer, sizeof(sc->sc_xfer)); - /* - * Interface 0 - */ - - iface_index = 0; - if (usb2_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, - ubt_config, UBT_IF_0_N_TRANSFER, - sc->sc_node, &sc->sc_if_mtx[0])) { - device_printf(dev, "could not allocate transfers for " \ - "interface 0!\n"); - goto detach; - } - - /* - * Interface 1 - * (search alternate settings, and find the descriptor with the largest - * wMaxPacketSize) + * For interface #1 search alternate settings, and find + * the descriptor with the largest wMaxPacketSize */ wMaxPacketSize = 0; @@ -572,21 +521,18 @@ ubt_attach(device_t dev) j ++; } - /* Set alt configuration only if we found it */ + /* Set alt configuration on interface #1 only if we found it */ if (wMaxPacketSize > 0 && usb2_set_alt_interface_index(uaa->device, 1, alt_index)) { - device_printf(dev, "could not set alternate setting %d " \ + UBT_ALERT(sc, "could not set alternate setting %d " \ "for interface 1!\n", alt_index); goto detach; } - iface_index = 1; - if (usb2_transfer_setup(uaa->device, &iface_index, - &sc->sc_xfer[UBT_IF_0_N_TRANSFER], - &ubt_config[UBT_IF_0_N_TRANSFER], UBT_IF_1_N_TRANSFER, - sc->sc_node, &sc->sc_if_mtx[1])) { - device_printf(dev, "could not allocate transfers for " \ - "interface 1!\n"); + /* Setup transfers for both interfaces */ + if (usb2_transfer_setup(uaa->device, iface_index, sc->sc_xfer, + ubt_config, UBT_N_TRANSFER, sc, &sc->sc_if_mtx)) { + UBT_ALERT(sc, "could not allocate transfers\n"); goto detach; } @@ -616,29 +562,25 @@ ubt_detach(device_t dev) /* Destroy Netgraph node */ if (node != NULL) { sc->sc_node = NULL; - - NG_NODE_SET_PRIVATE(node, NULL); NG_NODE_REALLY_DIE(node); - NG_NODE_REF(node); ng_rmnode_self(node); } + /* Make sure ubt_task in gone */ + taskqueue_drain(taskqueue_swi, &sc->sc_task); + /* Free USB transfers, if any */ usb2_transfer_unsetup(sc->sc_xfer, UBT_N_TRANSFER); - if (node != NULL) - NG_NODE_UNREF(node); - /* Destroy queues */ - UBT_MBUFQ_LOCK(sc); + UBT_NG_LOCK(sc); NG_BT_MBUFQ_DESTROY(&sc->sc_cmdq); NG_BT_MBUFQ_DESTROY(&sc->sc_aclq); NG_BT_MBUFQ_DESTROY(&sc->sc_scoq); - UBT_MBUFQ_UNLOCK(sc); + UBT_NG_UNLOCK(sc); - mtx_destroy(&sc->sc_if_mtx[0]); - mtx_destroy(&sc->sc_if_mtx[1]); - mtx_destroy(&sc->sc_mbufq_mtx); + mtx_destroy(&sc->sc_if_mtx); + mtx_destroy(&sc->sc_ng_mtx); return (0); } /* ubt_detach */ @@ -652,42 +594,27 @@ ubt_detach(device_t dev) static void ubt_ctrl_write_callback(struct usb2_xfer *xfer) { - node_p node = xfer->priv_sc; - struct ubt_softc *sc; + struct ubt_softc *sc = xfer->priv_sc; struct usb2_device_request req; struct mbuf *m; - if (NG_NODE_NOT_VALID(node)) { - NG_NODE_UNREF(node); - return; /* netgraph node is gone */ - } - - sc = NG_NODE_PRIVATE(node); - switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - if (xfer->error != 0) - UBT_STAT_OERROR(sc); - else { - UBT_INFO(sc, "sent %d bytes to control pipe\n", - xfer->actlen); - - UBT_STAT_BYTES_SENT(sc, xfer->actlen); - UBT_STAT_PCKTS_SENT(sc); - } + UBT_INFO(sc, "sent %d bytes to control pipe\n", xfer->actlen); + UBT_STAT_BYTES_SENT(sc, xfer->actlen); + UBT_STAT_PCKTS_SENT(sc); /* FALLTHROUGH */ case USB_ST_SETUP: send_next: /* Get next command mbuf, if any */ - UBT_MBUFQ_LOCK(sc); + UBT_NG_LOCK(sc); NG_BT_MBUFQ_DEQUEUE(&sc->sc_cmdq, m); - UBT_MBUFQ_UNLOCK(sc); + UBT_NG_UNLOCK(sc); if (m == NULL) { UBT_INFO(sc, "HCI command queue is empty\n"); - NG_NODE_UNREF(node); - return; + break; /* transfer complete */ } /* Initialize a USB control request and then schedule it */ @@ -720,7 +647,7 @@ send_next: goto send_next; } - NG_NODE_UNREF(node); /* cancelled */ + /* transfer cancelled */ break; } } /* ubt_ctrl_write_callback */ @@ -734,24 +661,9 @@ send_next: static void ubt_intr_read_callback(struct usb2_xfer *xfer) { - node_p node = xfer->priv_sc; - struct ubt_softc *sc; + struct ubt_softc *sc = xfer->priv_sc; struct mbuf *m; ng_hci_event_pkt_t *hdr; - int error; - - if (NG_NODE_NOT_VALID(node)) { - NG_NODE_UNREF(node); - return; /* netgraph node is gone */ - } - - sc = NG_NODE_PRIVATE(node); - - if ((sc->sc_hook == NULL) || NG_HOOK_NOT_VALID(sc->sc_hook)) { - UBT_INFO(sc, "no upstream hook\n"); - NG_NODE_UNREF(node); - return; /* upstream hook is gone */ - } m = NULL; @@ -809,10 +721,7 @@ ubt_intr_read_callback(struct usb2_xfer UBT_STAT_PCKTS_RECV(sc); UBT_STAT_BYTES_RECV(sc, m->m_pkthdr.len); - NG_SEND_DATA_ONLY(error, sc->sc_hook, m); - if (error != 0) - UBT_STAT_IERROR(sc); - + ubt_fwd_mbuf_up(sc, &m); /* m == NULL at this point */ /* FALLTHROUGH */ @@ -820,12 +729,8 @@ ubt_intr_read_callback(struct usb2_xfer submit_next: NG_FREE_M(m); /* checks for m != NULL */ - if (sc->sc_flags & UBT_FLAG_INTR_STALL) - usb2_transfer_start(sc->sc_xfer[UBT_IF_0_INTR_CS_RD]); - else { - xfer->frlengths[0] = xfer->max_data_length; - usb2_start_hardware(xfer); - } + xfer->frlengths[0] = xfer->max_data_length; + usb2_start_hardware(xfer); break; default: /* Error */ @@ -834,44 +739,15 @@ submit_next: usb2_errstr(xfer->error)); /* Try to clear stall first */ - sc->sc_flags |= UBT_FLAG_INTR_STALL; - usb2_transfer_start(sc->sc_xfer[UBT_IF_0_INTR_CS_RD]); - } else - NG_NODE_UNREF(node); /* cancelled */ + xfer->flags.stall_pipe = 1; + goto submit_next; + } + /* transfer cancelled */ break; } } /* ubt_intr_read_callback */ /* - * Called when outgoing control transfer initiated to clear stall on - * interrupt pipe has completed. - * USB context. - */ - -static void -ubt_intr_read_clear_stall_callback(struct usb2_xfer *xfer) -{ - node_p node = xfer->priv_sc; - struct ubt_softc *sc; - struct usb2_xfer *xfer_other; - - if (NG_NODE_NOT_VALID(node)) { - NG_NODE_UNREF(node); - return; /* netgraph node is gone */ - } - - sc = NG_NODE_PRIVATE(node); - xfer_other = sc->sc_xfer[UBT_IF_0_INTR_DT_RD]; - - if (usb2_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - sc->sc_flags &= ~UBT_FLAG_INTR_STALL; - usb2_transfer_start(xfer_other); - } else - NG_NODE_UNREF(node); /* cant clear stall */ -} /* ubt_intr_read_clear_stall_callback */ - -/* * Called when incoming bulk transfer (ACL packet) has completed, i.e. * ACL packet was received from the device. * USB context. @@ -880,25 +756,10 @@ ubt_intr_read_clear_stall_callback(struc static void ubt_bulk_read_callback(struct usb2_xfer *xfer) { - node_p node = xfer->priv_sc; - struct ubt_softc *sc; + struct ubt_softc *sc = xfer->priv_sc; struct mbuf *m; ng_hci_acldata_pkt_t *hdr; uint16_t len; - int error; - - if (NG_NODE_NOT_VALID(node)) { - NG_NODE_UNREF(node); - return; /* netgraph node is gone */ - } - - sc = NG_NODE_PRIVATE(node); - - if ((sc->sc_hook == NULL) || NG_HOOK_NOT_VALID(sc->sc_hook)) { - UBT_INFO(sc, "no upstream hook\n"); - NG_NODE_UNREF(node); - return; /* upstream hook is gone */ - } m = NULL; @@ -956,10 +817,7 @@ ubt_bulk_read_callback(struct usb2_xfer UBT_STAT_PCKTS_RECV(sc); UBT_STAT_BYTES_RECV(sc, m->m_pkthdr.len); - NG_SEND_DATA_ONLY(error, sc->sc_hook, m); - if (error != 0) - UBT_STAT_IERROR(sc); - + ubt_fwd_mbuf_up(sc, &m); /* m == NULL at this point */ /* FALLTHOUGH */ @@ -967,12 +825,8 @@ ubt_bulk_read_callback(struct usb2_xfer submit_next: NG_FREE_M(m); /* checks for m != NULL */ - if (sc->sc_flags & UBT_FLAG_READ_STALL) - usb2_transfer_start(sc->sc_xfer[UBT_IF_0_BULK_CS_RD]); - else { - xfer->frlengths[0] = xfer->max_data_length; - usb2_start_hardware(xfer); - } + xfer->frlengths[0] = xfer->max_data_length; + usb2_start_hardware(xfer); break; default: /* Error */ @@ -981,44 +835,15 @@ submit_next: usb2_errstr(xfer->error)); /* Try to clear stall first */ - sc->sc_flags |= UBT_FLAG_READ_STALL; - usb2_transfer_start(sc->sc_xfer[UBT_IF_0_BULK_CS_RD]); - } else - NG_NODE_UNREF(node); /* cancelled */ + xfer->flags.stall_pipe = 1; + goto submit_next; + } + /* transfer cancelled */ break; } } /* ubt_bulk_read_callback */ /* - * Called when outgoing control transfer initiated to clear stall on - * incoming bulk pipe has completed. - * USB context. - */ - -static void -ubt_bulk_read_clear_stall_callback(struct usb2_xfer *xfer) -{ - node_p node = xfer->priv_sc; - struct ubt_softc *sc; - struct usb2_xfer *xfer_other; - - if (NG_NODE_NOT_VALID(node)) { - NG_NODE_UNREF(node); - return; /* netgraph node is gone */ - } - - sc = NG_NODE_PRIVATE(node); - xfer_other = sc->sc_xfer[UBT_IF_0_BULK_DT_RD]; - - if (usb2_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - sc->sc_flags &= ~UBT_FLAG_READ_STALL; - usb2_transfer_start(xfer_other); - } else - NG_NODE_UNREF(node); /* cant clear stall */ -} /* ubt_bulk_read_clear_stall_callback */ - -/* * Called when outgoing bulk transfer (ACL packet) has completed, i.e. * ACL packet was sent to the device. * USB context. @@ -1027,40 +852,26 @@ ubt_bulk_read_clear_stall_callback(struc static void ubt_bulk_write_callback(struct usb2_xfer *xfer) { - node_p node = xfer->priv_sc; - struct ubt_softc *sc; + struct ubt_softc *sc = xfer->priv_sc; struct mbuf *m; - if (NG_NODE_NOT_VALID(node)) { - NG_NODE_UNREF(node); - return; /* netgraph node is gone */ - } - - sc = NG_NODE_PRIVATE(node); - switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - if (xfer->error != 0) - UBT_STAT_OERROR(sc); - else { - UBT_INFO(sc, "sent %d bytes to bulk-out pipe\n", - xfer->actlen); - - UBT_STAT_BYTES_SENT(sc, xfer->actlen); - UBT_STAT_PCKTS_SENT(sc); - } + UBT_INFO(sc, "sent %d bytes to bulk-out pipe\n", xfer->actlen); + UBT_STAT_BYTES_SENT(sc, xfer->actlen); + UBT_STAT_PCKTS_SENT(sc); /* FALLTHROUGH */ case USB_ST_SETUP: +send_next: /* Get next mbuf, if any */ - UBT_MBUFQ_LOCK(sc); + UBT_NG_LOCK(sc); NG_BT_MBUFQ_DEQUEUE(&sc->sc_aclq, m); - UBT_MBUFQ_UNLOCK(sc); + UBT_NG_UNLOCK(sc); if (m == NULL) { UBT_INFO(sc, "ACL data queue is empty\n"); - NG_NODE_UNREF(node); - return; /* transfer completed */ + break; /* transfer completed */ } /* @@ -1087,44 +898,15 @@ ubt_bulk_write_callback(struct usb2_xfer UBT_STAT_OERROR(sc); /* try to clear stall first */ - sc->sc_flags |= UBT_FLAG_WRITE_STALL; - usb2_transfer_start(sc->sc_xfer[UBT_IF_0_BULK_CS_WR]); - } else - NG_NODE_UNREF(node); /* cancelled */ + xfer->flags.stall_pipe = 1; + goto send_next; + } + /* transfer cancelled */ break; } } /* ubt_bulk_write_callback */ /* - * Called when outgoing control transfer initiated to clear stall on - * outgoing bulk pipe has completed. - * USB context. - */ - -static void -ubt_bulk_write_clear_stall_callback(struct usb2_xfer *xfer) -{ - node_p node = xfer->priv_sc; - struct ubt_softc *sc; - struct usb2_xfer *xfer_other; - - if (NG_NODE_NOT_VALID(node)) { - NG_NODE_UNREF(node); - return; /* netgraph node is gone */ - } - - sc = NG_NODE_PRIVATE(node); - xfer_other = sc->sc_xfer[UBT_IF_0_BULK_DT_WR]; - - if (usb2_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - sc->sc_flags &= ~UBT_FLAG_WRITE_STALL; - usb2_transfer_start(xfer_other); - } else - NG_NODE_UNREF(node); /* cant clear stall */ -} /* ubt_bulk_write_clear_stall_callback */ - -/* * Called when incoming isoc transfer (SCO packet) has completed, i.e. * SCO packet was received from the device. * USB context. @@ -1133,23 +915,9 @@ ubt_bulk_write_clear_stall_callback(stru static void ubt_isoc_read_callback(struct usb2_xfer *xfer) { - node_p node = xfer->priv_sc; - struct ubt_softc *sc; + struct ubt_softc *sc = xfer->priv_sc; int n; - if (NG_NODE_NOT_VALID(node)) { - NG_NODE_UNREF(node); - return; /* netgraph node is gone */ - } - - sc = NG_NODE_PRIVATE(node); - - if ((sc->sc_hook == NULL) || NG_HOOK_NOT_VALID(sc->sc_hook)) { - UBT_INFO(sc, "no upstream hook\n"); - NG_NODE_UNREF(node); - return; /* upstream hook is gone */ - } - switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: for (n = 0; n < xfer->nframes; n ++) @@ -1169,10 +937,9 @@ read_next: if (xfer->error != USB_ERR_CANCELLED) { UBT_STAT_IERROR(sc); goto read_next; - /* NOT REACHED */ } - NG_NODE_UNREF(node); /* cancelled */ + /* transfer cancelled */ break; } } /* ubt_isoc_read_callback */ @@ -1188,7 +955,7 @@ ubt_isoc_read_one_frame(struct usb2_xfer { struct ubt_softc *sc = xfer->priv_sc; struct mbuf *m; - int len, want, got, error; + int len, want, got; /* Get existing SCO reassembly buffer */ m = sc->sc_isoc_in_buffer; @@ -1250,10 +1017,7 @@ ubt_isoc_read_one_frame(struct usb2_xfer UBT_STAT_PCKTS_RECV(sc); UBT_STAT_BYTES_RECV(sc, m->m_pkthdr.len); - NG_SEND_DATA_ONLY(error, sc->sc_hook, m); - if (error != 0) - UBT_STAT_IERROR(sc); - + ubt_fwd_mbuf_up(sc, &m); /* m == NULL at this point */ } @@ -1272,29 +1036,15 @@ ubt_isoc_read_one_frame(struct usb2_xfer static void ubt_isoc_write_callback(struct usb2_xfer *xfer) { - node_p node = xfer->priv_sc; - struct ubt_softc *sc; + struct ubt_softc *sc = xfer->priv_sc; struct mbuf *m; int n, space, offset; - if (NG_NODE_NOT_VALID(node)) { - NG_NODE_UNREF(node); - return; /* netgraph node is gone */ - } - - sc = NG_NODE_PRIVATE(node); - switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - if (xfer->error) - UBT_STAT_OERROR(sc); - else { - UBT_INFO(sc, "sent %d bytes to isoc-out pipe\n", - xfer->actlen); - - UBT_STAT_BYTES_SENT(sc, xfer->actlen); - UBT_STAT_PCKTS_SENT(sc); - } + UBT_INFO(sc, "sent %d bytes to isoc-out pipe\n", xfer->actlen); + UBT_STAT_BYTES_SENT(sc, xfer->actlen); + UBT_STAT_PCKTS_SENT(sc); /* FALLTHROUGH */ case USB_ST_SETUP: @@ -1305,9 +1055,9 @@ send_next: while (space > 0) { if (m == NULL) { - UBT_MBUFQ_LOCK(sc); + UBT_NG_LOCK(sc); NG_BT_MBUFQ_DEQUEUE(&sc->sc_scoq, m); - UBT_MBUFQ_UNLOCK(sc); + UBT_NG_UNLOCK(sc); if (m == NULL) break; @@ -1328,9 +1078,9 @@ send_next: /* Put whatever is left from mbuf back on queue */ if (m != NULL) { - UBT_MBUFQ_LOCK(sc); + UBT_NG_LOCK(sc); NG_BT_MBUFQ_PREPEND(&sc->sc_scoq, m); - UBT_MBUFQ_UNLOCK(sc); + UBT_NG_UNLOCK(sc); } /* @@ -1353,14 +1103,60 @@ send_next: if (xfer->error != USB_ERR_CANCELLED) { UBT_STAT_OERROR(sc); goto send_next; - /* NOT REACHED */ } - NG_NODE_UNREF(node); /* cancelled */ + /* transfer cancelled */ break; } } +/* + * Utility function to forward provided mbuf upstream (i.e. up the stack). + * Modifies value of the mbuf pointer (sets it to NULL). + * Save to call from any context. + */ + +static int +ubt_fwd_mbuf_up(ubt_softc_p sc, struct mbuf **m) +{ + hook_p hook; + int error; + + /* + * Close the race with Netgraph hook newhook/disconnect methods. + * Save the hook pointer atomically. Two cases are possible: + * + * 1) The hook pointer is NULL. It means disconnect method got + * there first. In this case we are done. + * + * 2) The hook pointer is not NULL. It means that hook pointer + * could be either in valid or invalid (i.e. in the process + * of disconnect) state. In any case grab an extra reference + * to protect the hook pointer. + * + * It is ok to pass hook in invalid state to NG_SEND_DATA_ONLY() as + * it checks for it. Drop extra reference after NG_SEND_DATA_ONLY(). + */ + + UBT_NG_LOCK(sc); + if ((hook = sc->sc_hook) != NULL) + NG_HOOK_REF(hook); + UBT_NG_UNLOCK(sc); + + if (hook == NULL) { + NG_FREE_M(*m); + return (ENETDOWN); + } + + NG_SEND_DATA_ONLY(error, hook, *m); + NG_HOOK_UNREF(hook); + + if (error != 0) + UBT_STAT_IERROR(sc); + + return (error); +} /* ubt_fwd_mbuf_up */ + /**************************************************************************** **************************************************************************** ** Glue @@ -1368,47 +1164,49 @@ send_next: ****************************************************************************/ /* - * Schedule glue task. Should be called with sc_mbufq_mtx held. + * Schedule glue task. Should be called with sc_ng_mtx held. * Netgraph context. */ -static int +static void ubt_task_schedule(ubt_softc_p sc, int action) { - mtx_assert(&sc->sc_mbufq_mtx, MA_OWNED); + mtx_assert(&sc->sc_ng_mtx, MA_OWNED); - if ((sc->sc_task_flags & action) == 0) { - /* - * Try to handle corner case when "start all" and "stop all" - * actions can both be set before task is executed. - * - * Assume the following: - * 1) "stop all" after "start all" cancels "start all", and, - * keeps "stop all" - * - * 2) "start all" after "stop all" is fine because task is - * executing "stop all" first - */ + /* + * Try to handle corner case when "start all" and "stop all" + * actions can both be set before task is executed. + * + * The rules are + * + * sc_task_flags action new sc_task_flags + * ------------------------------------------------------ + * 0 start start + * 0 stop stop + * start start start + * start stop stop + * stop start stop|start + * stop stop stop *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 21:07:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A93361065670; Mon, 26 Jan 2009 21:07:12 +0000 (UTC) (envelope-from csjp@freebsd.org) Received: from mx-01queue01.mts.net (mx-01queue01.mts.net [142.161.3.10]) by mx1.freebsd.org (Postfix) with ESMTP id 1B6668FC18; Mon, 26 Jan 2009 21:07:12 +0000 (UTC) (envelope-from csjp@freebsd.org) Received: from wnpgmb021pw-sp03.mts.net ([10.204.128.23]) by mx-02mtaout02.mts.net with ESMTP id <20090126205530.DGQQ3962.mx-02mtaout02.mts.net@wnpgmb021pw-sp03.mts.net>; Mon, 26 Jan 2009 14:55:30 -0600 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkcFAGyyfUmOoTnP/2dsb2JhbACBbcdehUs X-IronPort-AV: E=Sophos;i="4.37,327,1231135200"; d="diff'?scan'208";a="58314245" Received: from wnpgmb1309w-ad05-57-207.dynamic.mts.net (HELO jnz.my.domain) ([142.161.57.207]) by wnpgmb021pw-sp03.mts.net with ESMTP; 26 Jan 2009 14:55:30 -0600 Received: from jnz.my.domain (localhost [127.0.0.1]) by jnz.my.domain (8.14.3/8.14.2) with ESMTP id n0QKtUQj044650; Mon, 26 Jan 2009 14:55:30 -0600 (CST) (envelope-from csjp@jnz.my.domain) Received: (from csjp@localhost) by jnz.my.domain (8.14.3/8.14.2/Submit) id n0QKtU6o044649; Mon, 26 Jan 2009 14:55:30 -0600 (CST) (envelope-from csjp) Date: Mon, 26 Jan 2009 14:55:29 -0600 From: Christian Peron To: John Baldwin Message-ID: <20090126205529.GA44291@jnz.sqrt.ca> References: <200901261412.n0QECDLO052207@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Kj7319i9nmIyA2yE" Content-Disposition: inline In-Reply-To: <200901261412.n0QECDLO052207@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r187714 - head/sys/dev/ppbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 21:07:13 -0000 --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline John I think I found another issue relating to these changes. The patch I have attached fixes a panic on bootup in lpt. Any objections? On Mon, Jan 26, 2009 at 02:12:13PM +0000, John Baldwin wrote: > Author: jhb > Date: Mon Jan 26 14:12:12 2009 > New Revision: 187714 > URL: http://svn.freebsd.org/changeset/base/187714 > > Log: > Add missing locking around setting the ppc interrupt handler IVAR. > > Reported by: many > > Modified: > head/sys/dev/ppbus/ppbconf.c > > Modified: head/sys/dev/ppbus/ppbconf.c > ============================================================================== > --- head/sys/dev/ppbus/ppbconf.c Mon Jan 26 14:03:39 2009 (r187713) > +++ head/sys/dev/ppbus/ppbconf.c Mon Jan 26 14:12:12 2009 (r187714) > @@ -393,8 +393,10 @@ ppbus_attach(device_t dev) > ppb->ppc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, > RF_SHAREABLE); > if (ppb->ppc_irq_res != NULL) { > + mtx_lock(ppb->ppc_lock); > error = BUS_WRITE_IVAR(device_get_parent(dev), dev, > PPC_IVAR_INTR_HANDLER, (uintptr_t)&ppbus_intr); > + mtx_unlock(ppb->ppc_lock); > if (error) { > device_printf(dev, "Unable to set interrupt handler\n"); > return (error); --Kj7319i9nmIyA2yE Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="lpt.c.diff" Index: lpt.c =================================================================== --- lpt.c (revision 187723) +++ lpt.c (working copy) @@ -380,9 +380,8 @@ } ppb_wctr(ppbus, LPC_NINIT); - ppb_unlock(ppbus); lpt_release_ppbus(dev); - + ppb_unlock(ppbus); /* declare our interrupt handler */ sc->sc_intr_resource = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE); --Kj7319i9nmIyA2yE-- From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 21:45:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C41D106564A; Mon, 26 Jan 2009 21:45:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFA3B8FC08; Mon, 26 Jan 2009 21:45:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QLjXNq063917; Mon, 26 Jan 2009 21:45:33 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QLjX7S063916; Mon, 26 Jan 2009 21:45:33 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200901262145.n0QLjX7S063916@svn.freebsd.org> From: Warner Losh Date: Mon, 26 Jan 2009 21:45:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187742 - head/usr.sbin/config X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 21:45:34 -0000 Author: imp Date: Mon Jan 26 21:45:33 2009 New Revision: 187742 URL: http://svn.freebsd.org/changeset/base/187742 Log: Delete commented out ancient history. Modified: head/usr.sbin/config/config.8 Modified: head/usr.sbin/config/config.8 ============================================================================== --- head/usr.sbin/config/config.8 Mon Jan 26 20:59:41 2009 (r187741) +++ head/usr.sbin/config/config.8 Mon Jan 26 21:45:33 2009 (r187742) @@ -42,20 +42,6 @@ .Nm .Op Fl x Ar kernel .Sh DESCRIPTION -.\" This is the old version of the -.\" .Nm -.\" utility. -.\" It understands the old autoconfiguration scheme -.\" used on the HP300, i386, DECstation, and derivative platforms. -.\" The new version of -.\" .Nm -.\" is used with the -.\" SPARC platform. -.\" Only the version of -.\" .Nm -.\" applicable to the architecture that you are running -.\" will be installed on your machine. -.\" .Pp The .Nm utility builds a set of system configuration files from the file From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 22:36:43 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 965FB106566B; Mon, 26 Jan 2009 22:36:43 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 4DF358FC0C; Mon, 26 Jan 2009 22:36:43 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n0QMdJ66032817; Mon, 26 Jan 2009 17:39:19 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n0QMdJFn032816; Mon, 26 Jan 2009 17:39:19 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Mon, 26 Jan 2009 17:39:19 -0500 From: David Schultz To: Kostik Belousov Message-ID: <20090126223919.GA32717@zim.MIT.EDU> Mail-Followup-To: Kostik Belousov , Bruce Evans , Ed Schouten , Tom Rhodes , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <200901230058.n0N0wEjY026935@svn.freebsd.org> <20090125162123.GB17198@hoeg.nl> <20090126041926.J43097@delplex.bde.org> <20090125175751.GC17198@hoeg.nl> <20090126051910.E2148@besplex.bde.org> <20090126190310.GA31728@zim.MIT.EDU> <20090126201146.GD2009@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090126201146.GD2009@deviant.kiev.zoral.com.ua> Cc: Ed Schouten , src-committers@FreeBSD.ORG, Tom Rhodes , svn-src-all@FreeBSD.ORG, Bruce Evans , svn-src-head@FreeBSD.ORG Subject: Re: svn commit: r187607 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 22:36:44 -0000 On Mon, Jan 26, 2009, Kostik Belousov wrote: > > Process kstack swapping was removed several years ago, so > > "swapping out" a process just deactivates all of its pages. > > In principle this could be safe to do with init, but it's probably > > a bad idea, and perhaps could lead to deadlock in the > > out-of-swap-space -> kill a process -> reparent the zombie to init > > path. PS_INMEM will prevent init from being swapped out. > > Process kernel stacks swapping, or more explicitely, allowance to page out > threads kernel stacks, is in the kernel. It is performed by vmdaemon, > look for the call to swapout_procs(). Oops, you're right---I meant swapping of struct user. Presumably there's nothing magic about init's pcb and kstack, though. > P.S. Your Mail-Followup-To: header may be considered offensive. In the absence of a Mail-Followup-To or Reply-To header in the message I'm replying to, mutt seems to generate a Mail-Followup-To for everyone but me (since it knows I'm subscribed and wants to direct others not to CC me.) It doesn't know if anyone else wants a CC or not because they didn't use Mail-Followup-To, so it includes them by default. I think this is what it's supposed to do, but if you know of a knob that I ought to turn, let me know. From owner-svn-src-head@FreeBSD.ORG Mon Jan 26 23:05:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F84410656BA; Mon, 26 Jan 2009 23:05:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E9558FC1A; Mon, 26 Jan 2009 23:05:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0QN5ojc065680; Mon, 26 Jan 2009 23:05:50 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0QN5ovS065679; Mon, 26 Jan 2009 23:05:50 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901262305.n0QN5ovS065679@svn.freebsd.org> From: Sam Leffler Date: Mon, 26 Jan 2009 23:05:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187743 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2009 23:05:51 -0000 Author: sam Date: Mon Jan 26 23:05:50 2009 New Revision: 187743 URL: http://svn.freebsd.org/changeset/base/187743 Log: Remove DETACH event handling; this is race prone and does nothing useful. Leave a comment for the next person that thinks they need to be helpful. Reviewed by: imp, jhb MFC after: 2 weeks Modified: head/etc/devd.conf Modified: head/etc/devd.conf ============================================================================== --- head/etc/devd.conf Mon Jan 26 21:45:33 2009 (r187742) +++ head/etc/devd.conf Mon Jan 26 23:05:50 2009 (r187743) @@ -31,18 +31,17 @@ options { # Configure the interface on attach. Due to a historical accident, this # script is called pccard_ether. # +# NB: DETACH events are ignored; the kernel should handle all cleanup +# (routes, arp cache) if you need to do something beware of races +# against immediate create of a device w/ the same name; e.g. +# ifconfig bridge0 destroy; ifconfig bridge0 create +# notify 0 { match "system" "IFNET"; match "type" "ATTACH"; action "/etc/pccard_ether $subsystem start"; }; -notify 0 { - match "system" "IFNET"; - match "type" "DETACH"; - action "/etc/pccard_ether $subsystem stop"; -}; - # # Try to start dhclient on Ethernet like interfaces when the link comes # up. Only devices that are configured to support DHCP will actually From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 00:22:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9ECF1065673; Tue, 27 Jan 2009 00:22:16 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DAC38FC1A; Tue, 27 Jan 2009 00:22:16 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0R0MGDr067549; Tue, 27 Jan 2009 00:22:16 GMT (envelope-from trhodes@svn.freebsd.org) Received: (from trhodes@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0R0MGin067548; Tue, 27 Jan 2009 00:22:16 GMT (envelope-from trhodes@svn.freebsd.org) Message-Id: <200901270022.n0R0MGin067548@svn.freebsd.org> From: Tom Rhodes Date: Tue, 27 Jan 2009 00:22:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187746 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 00:22:17 -0000 Author: trhodes Date: Tue Jan 27 00:22:16 2009 New Revision: 187746 URL: http://svn.freebsd.org/changeset/base/187746 Log: Add ENOMEM to the return values. Remove invalid return values. Remove reference to non-existent manual pages. Remove reference to rfork (it does not discuss RFSTOPPED). Add sys/unistd.h to the list of includes (required for RFSTOPPED). PR: 126227 Submitted by: Mateusz Guzik (based on, original version) Reviewed by: jhb, Christoph Mallon Modified: head/share/man/man9/kthread.9 Modified: head/share/man/man9/kthread.9 ============================================================================== --- head/share/man/man9/kthread.9 Mon Jan 26 23:17:19 2009 (r187745) +++ head/share/man/man9/kthread.9 Tue Jan 27 00:22:16 2009 (r187746) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 26, 2007 +.Dd January 26, 2009 .Dt KTHREAD 9 .Os .Sh NAME @@ -43,12 +43,6 @@ .Fn kthread_start "const void *udata" .Ft void .Fn kthread_shutdown "void *arg" "int howto" -.Ft int -.Fo kthread_add -.Fa "void (*func)(void *)" "void *arg" "struct proc *procp" -.Fa "struct thread **newtdpp" "int flags" "int pages" -.Fa "const char *fmt" ... -.Fc .Ft void .Fn kthread_exit "void" .Ft int @@ -57,6 +51,13 @@ .Fn kthread_suspend "struct thread *td" "int timo" .Ft void .Fn kthread_suspend_check "struct thread *td" +.In sys/unistd.h +.Ft int +.Fo kthread_add +.Fa "void (*func)(void *)" "void *arg" "struct proc *procp" +.Fa "struct thread **newtdpp" "int flags" "int pages" +.Fa "const char *fmt" ... +.Fc .Ft int .Fo kproc_kthread_add .Fa "void (*func)(void *)" "void *arg" @@ -142,8 +143,12 @@ If this argument is then it is ignored. The .Fa flags -argument specifies a set of flags as described in -.Xr rfork 2 . +argument may be set to +.Dv RFSTOPPED +to leave the thread in a stopped state. +The caller must call +.Fn sched_add +to start the thread. The .Fa pages argument specifies the size of the new kernel thread's stack in pages. @@ -274,23 +279,10 @@ The .Fn kthread_add function will fail if: .Bl -tag -width Er -.It Bq Er EAGAIN -The system-imposed limit on the total -number of processes under execution would be exceeded. -The limit is given by the -.Xr sysctl 3 -MIB variable -.Dv KERN_MAXPROC . -.It Bq Er EINVAL -The -.Dv RFCFDG -flag was specified in the -.Fa flags -parameter. +.It Bq Er ENOMEM +Memory for a thread's stack could not be allocated. .El .Sh SEE ALSO -.Xr rfork 2 , -.Xr exit1 9 , .Xr kproc 9 , .Xr SYSINIT 9 , .Xr wakeup 9 From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 00:23:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89011106564A; Tue, 27 Jan 2009 00:23:43 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7430F8FC0A; Tue, 27 Jan 2009 00:23:43 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0R0Nh8a067622; Tue, 27 Jan 2009 00:23:43 GMT (envelope-from trhodes@svn.freebsd.org) Received: (from trhodes@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0R0Nhq8067621; Tue, 27 Jan 2009 00:23:43 GMT (envelope-from trhodes@svn.freebsd.org) Message-Id: <200901270023.n0R0Nhq8067621@svn.freebsd.org> From: Tom Rhodes Date: Tue, 27 Jan 2009 00:23:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187747 - head/share/man/man7 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 00:23:45 -0000 Author: trhodes Date: Tue Jan 27 00:23:43 2009 New Revision: 187747 URL: http://svn.freebsd.org/changeset/base/187747 Log: s/use/using/ in previous commit. Suggested by: jhb Modified: head/share/man/man7/tuning.7 Modified: head/share/man/man7/tuning.7 ============================================================================== --- head/share/man/man7/tuning.7 Tue Jan 27 00:22:16 2009 (r187746) +++ head/share/man/man7/tuning.7 Tue Jan 27 00:23:43 2009 (r187747) @@ -412,7 +412,7 @@ Increasing this value to a higher settin improve performance on systems where space for mapping pipe buffers is quickly exhausted. This exhaustion is not fatal; however, and it will only cause pipes to -to fall back to use double-copy. +to fall back to using double-copy. .Pp The .Va kern.ipc.shm_use_phys From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 00:29:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95F0C1065670; Tue, 27 Jan 2009 00:29:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 84D888FC0A; Tue, 27 Jan 2009 00:29:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0R0TJTV067780; Tue, 27 Jan 2009 00:29:19 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0R0TJHI067779; Tue, 27 Jan 2009 00:29:19 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200901270029.n0R0TJHI067779@svn.freebsd.org> From: Xin LI Date: Tue, 27 Jan 2009 00:29:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187748 - head/sbin/fsck_ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 00:29:20 -0000 Author: delphij Date: Tue Jan 27 00:29:19 2009 New Revision: 187748 URL: http://svn.freebsd.org/changeset/base/187748 Log: Follow up with previous commit: mention -D, not -C when cg check failed. Submitted by: obrien Modified: head/sbin/fsck_ffs/fsutil.c Modified: head/sbin/fsck_ffs/fsutil.c ============================================================================== --- head/sbin/fsck_ffs/fsutil.c Tue Jan 27 00:23:43 2009 (r187747) +++ head/sbin/fsck_ffs/fsutil.c Tue Jan 27 00:29:19 2009 (r187748) @@ -442,7 +442,7 @@ check_cgmagic(int cg, struct cg *cgp) rerun = 1; } } else - printf("YOU MAY NEED TO RERUN FSCK WITH -C IF IT CRASHED.\n"); + printf("YOU MAY NEED TO RERUN FSCK WITH -D IF IT CRASHED.\n"); } } From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 07:29:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 587C2106566C; Tue, 27 Jan 2009 07:29:38 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 446FD8FC17; Tue, 27 Jan 2009 07:29:38 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0R7Tcmf077521; Tue, 27 Jan 2009 07:29:38 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0R7TcJ1077516; Tue, 27 Jan 2009 07:29:38 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200901270729.n0R7TcJ1077516@svn.freebsd.org> From: Jeff Roberson Date: Tue, 27 Jan 2009 07:29:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187761 - in head: lib/libpmc sys/dev/hwpmc sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 07:29:39 -0000 Author: jeff Date: Tue Jan 27 07:29:37 2009 New Revision: 187761 URL: http://svn.freebsd.org/changeset/base/187761 Log: - Add support for nehalem/corei7 cpus. This supports all of the core counters defined in the reference manual. It does not support the 'uncore' events. Reviewed by: jkoshy Sponsored by: Nokia Modified: head/lib/libpmc/libpmc.c head/sys/dev/hwpmc/hwpmc_core.c head/sys/dev/hwpmc/hwpmc_intel.c head/sys/dev/hwpmc/pmc_events.h head/sys/sys/pmc.h Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Tue Jan 27 02:18:42 2009 (r187760) +++ head/lib/libpmc/libpmc.c Tue Jan 27 07:29:37 2009 (r187761) @@ -152,6 +152,11 @@ static const struct pmc_event_descr core __PMC_EV_ALIAS_CORE2() }; +static const struct pmc_event_descr corei7_event_table[] = +{ + __PMC_EV_ALIAS_COREI7() +}; + /* * PMC_MDEP_TABLE(NAME, PRIMARYCLASS, ADDITIONAL_CLASSES...) * @@ -165,6 +170,7 @@ static const struct pmc_event_descr core PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(core, IAP, PMC_CLASS_TSC); PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); +PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(k7, K7, PMC_CLASS_TSC); PMC_MDEP_TABLE(k8, K8, PMC_CLASS_TSC); PMC_MDEP_TABLE(p4, P4, PMC_CLASS_TSC); @@ -194,6 +200,7 @@ PMC_CLASS_TABLE_DESC(iaf, IAF, iaf, iaf) PMC_CLASS_TABLE_DESC(atom, IAP, atom, iap); PMC_CLASS_TABLE_DESC(core, IAP, core, iap); PMC_CLASS_TABLE_DESC(core2, IAP, core2, iap); +PMC_CLASS_TABLE_DESC(corei7, IAP, corei7, iap); #endif #if defined(__i386__) PMC_CLASS_TABLE_DESC(k7, K7, k7, k7); @@ -448,6 +455,7 @@ static struct pmc_event_alias core2_alia EV_ALIAS(NULL, NULL) }; #define atom_aliases core2_aliases +#define corei7_aliases core2_aliases #define IAF_KW_OS "os" #define IAF_KW_USR "usr" @@ -604,7 +612,8 @@ iap_allocate_pmc(enum pmc_event pe, char return (-1); } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_ATOM || cpu_info.pm_cputype == PMC_CPU_INTEL_CORE2 || - cpu_info.pm_cputype == PMC_CPU_INTEL_CORE2EXTREME) { + cpu_info.pm_cputype == PMC_CPU_INTEL_CORE2EXTREME || + cpu_info.pm_cputype == PMC_CPU_INTEL_COREI7) { if (KWMATCH(p, IAP_KW_SNOOPRESPONSE)) { n = pmc_parse_mask(iap_snoopresponse_mask, p, &evmask); @@ -2278,6 +2287,10 @@ pmc_event_names_of_class(enum pmc_class ev = core2_event_table; count = PMC_EVENT_TABLE_SIZE(core2); break; + case PMC_CPU_INTEL_COREI7: + ev = corei7_event_table; + count = PMC_EVENT_TABLE_SIZE(corei7); + break; } break; case PMC_CLASS_TSC: @@ -2462,6 +2475,11 @@ pmc_init(void) pmc_class_table[n++] = &iaf_class_table_descr; pmc_class_table[n] = &core2_class_table_descr; break; + case PMC_CPU_INTEL_COREI7: + PMC_MDEP_INIT(corei7); + pmc_class_table[n++] = &iaf_class_table_descr; + pmc_class_table[n] = &corei7_class_table_descr; + break; case PMC_CPU_INTEL_PIV: PMC_MDEP_INIT(p4); pmc_class_table[n] = &p4_class_table_descr; @@ -2560,6 +2578,10 @@ _pmc_name_of_event(enum pmc_event pe, en ev = core2_event_table; evfence = core2_event_table + PMC_EVENT_TABLE_SIZE(core2); break; + case PMC_CPU_INTEL_COREI7: + ev = corei7_event_table; + evfence = corei7_event_table + PMC_EVENT_TABLE_SIZE(corei7); + break; default: /* Unknown CPU type. */ break; } Modified: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_core.c Tue Jan 27 02:18:42 2009 (r187760) +++ head/sys/dev/hwpmc/hwpmc_core.c Tue Jan 27 07:29:37 2009 (r187761) @@ -530,9 +530,11 @@ struct iap_event_descr { #define IAP_F_CC2 (1 << 1) /* CPU: Core2 family */ #define IAP_F_CC2E (1 << 2) /* CPU: Core2 Extreme only */ #define IAP_F_CA (1 << 3) /* CPU: Atom */ -#define IAP_F_FM (1 << 4) /* Fixed mask */ +#define IAP_F_I7 (1 << 4) /* CPU: Core i7 */ +#define IAP_F_FM (1 << 5) /* Fixed mask */ -#define IAP_F_ALLCPUS (IAP_F_CC | IAP_F_CC2 | IAP_F_CC2E | IAP_F_CA) +#define IAP_F_ALLCPUS \ + (IAP_F_CC | IAP_F_CC2 | IAP_F_CC2E | IAP_F_CA | IAP_F_I7) /* Sub fields of UMASK that this event supports. */ #define IAP_M_CORE (1 << 0) /* Core specificity */ @@ -569,13 +571,13 @@ static struct iap_event_descr iap_events IAPDESCR(03H_00H, 0x03, 0x00, IAP_F_FM | IAP_F_CC), IAPDESCR(03H_02H, 0x03, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(03H_04H, 0x03, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(03H_04H, 0x03, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), IAPDESCR(03H_08H, 0x03, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(03H_10H, 0x03, 0x10, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(03H_20H, 0x03, 0x20, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(04H_00H, 0x04, 0x00, IAP_F_FM | IAP_F_CC), - IAPDESCR(04H_01H, 0x04, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(04H_01H, 0x04, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), IAPDESCR(04H_02H, 0x04, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(04H_08H, 0x04, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2), @@ -590,8 +592,8 @@ static struct iap_event_descr iap_events IAPDESCR(07H_06H, 0x07, 0x06, IAP_F_FM | IAP_F_CA), IAPDESCR(07H_08H, 0x07, 0x08, IAP_F_FM | IAP_F_CA), - IAPDESCR(08H_01H, 0x08, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(08H_02H, 0x08, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(08H_01H, 0x08, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(08H_02H, 0x08, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), IAPDESCR(08H_04H, 0x08, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(08H_05H, 0x08, 0x05, IAP_F_FM | IAP_F_CA), IAPDESCR(08H_06H, 0x08, 0x06, IAP_F_FM | IAP_F_CA), @@ -599,15 +601,15 @@ static struct iap_event_descr iap_events IAPDESCR(08H_08H, 0x08, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(08H_09H, 0x08, 0x09, IAP_F_FM | IAP_F_CA), - IAPDESCR(09H_01H, 0x09, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(09H_02H, 0x09, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(09H_01H, 0x09, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(09H_02H, 0x09, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), - IAPDESCR(0CH_01H, 0x0C, 0x01, IAP_F_FM | IAP_F_CC2), + IAPDESCR(0CH_01H, 0x0C, 0x01, IAP_F_FM | IAP_F_CC2 | IAP_F_I7), IAPDESCR(0CH_02H, 0x0C, 0x02, IAP_F_FM | IAP_F_CC2), IAPDESCR(0CH_03H, 0x0C, 0x03, IAP_F_FM | IAP_F_CA), IAPDESCR(10H_00H, 0x10, 0x00, IAP_F_FM | IAP_F_ALLCPUS), - IAPDESCR(10H_01H, 0x10, 0x01, IAP_F_FM | IAP_F_CA), + IAPDESCR(10H_01H, 0x10, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_I7), IAPDESCR(10H_81H, 0x10, 0x81, IAP_F_FM | IAP_F_CA), IAPDESCR(11H_00H, 0x11, 0x00, IAP_F_FM | IAP_F_CC | IAP_F_CC2), @@ -615,20 +617,20 @@ static struct iap_event_descr iap_events IAPDESCR(11H_81H, 0x11, 0x81, IAP_F_FM | IAP_F_CA), IAPDESCR(12H_00H, 0x12, 0x00, IAP_F_FM | IAP_F_ALLCPUS), - IAPDESCR(12H_01H, 0x12, 0x01, IAP_F_FM | IAP_F_CA), + IAPDESCR(12H_01H, 0x12, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_I7), IAPDESCR(12H_81H, 0x12, 0x81, IAP_F_FM | IAP_F_CA), IAPDESCR(13H_00H, 0x13, 0x00, IAP_F_FM | IAP_F_ALLCPUS), - IAPDESCR(13H_01H, 0x13, 0x01, IAP_F_FM | IAP_F_CA), + IAPDESCR(13H_01H, 0x13, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_I7), IAPDESCR(13H_81H, 0x13, 0x81, IAP_F_FM | IAP_F_CA), IAPDESCR(14H_00H, 0x14, 0x00, IAP_F_FM | IAP_F_CC | IAP_F_CC2), - IAPDESCR(14H_01H, 0x14, 0x01, IAP_F_FM | IAP_F_CA), + IAPDESCR(14H_01H, 0x14, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_I7), IAPDESCR(18H_00H, 0x18, 0x00, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(19H_00H, 0x19, 0x00, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(19H_01H, 0x19, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(19H_01H, 0x19, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), IAPDESCR(19H_02H, 0x19, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(21H, 0x21, IAP_M_CORE, IAP_F_ALLCPUS), @@ -674,7 +676,7 @@ static struct iap_event_descr iap_events IAPDESCR(42H_10H, 0x42, 0x10, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(43H_01H, 0x43, 0x01, IAP_F_FM | IAP_F_ALLCPUS), - IAPDESCR(43H_02H, 0x43, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(43H_02H, 0x43, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), IAPDESCR(44H_02H, 0x44, 0x02, IAP_F_FM | IAP_F_CC), @@ -685,8 +687,8 @@ static struct iap_event_descr iap_events IAPDESCR(48H_00H, 0x48, 0x00, IAP_F_FM | IAP_F_ALLCPUS), IAPDESCR(49H_00H, 0x49, 0x00, IAP_F_FM | IAP_F_CC), - IAPDESCR(49H_01H, 0x49, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(49H_02H, 0x49, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(49H_01H, 0x49, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(49H_02H, 0x49, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), IAPDESCR(4BH_00H, 0x4B, 0x00, IAP_F_FM | IAP_F_ALLCPUS), IAPDESCR(4BH_01H, 0x4B, 0x01, IAP_F_FM | IAP_F_ALLCPUS), @@ -760,8 +762,8 @@ static struct iap_event_descr iap_events IAPDESCR(7FH, 0x7F, IAP_M_CORE, IAP_F_CA | IAP_F_CC2), IAPDESCR(80H_00H, 0x80, 0x00, IAP_F_FM | IAP_F_ALLCPUS), - IAPDESCR(80H_02H, 0x80, 0x02, IAP_F_FM | IAP_F_CA), - IAPDESCR(80H_03H, 0x80, 0x03, IAP_F_FM | IAP_F_CA), + IAPDESCR(80H_02H, 0x80, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_I7), + IAPDESCR(80H_03H, 0x80, 0x03, IAP_F_FM | IAP_F_CA | IAP_F_I7), IAPDESCR(81H_00H, 0x81, 0x00, IAP_F_FM | IAP_F_ALLCPUS), @@ -816,10 +818,10 @@ static struct iap_event_descr iap_events IAPDESCR(ABH_02H, 0xAB, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(B0H_00H, 0xB0, 0x00, IAP_F_FM | IAP_F_ALLCPUS), - IAPDESCR(B0H_80H, 0xB0, 0x80, IAP_F_FM | IAP_F_CA), + IAPDESCR(B0H_80H, 0xB0, 0x80, IAP_F_FM | IAP_F_CA | IAP_F_I7), IAPDESCR(B1H_00H, 0xB1, 0x00, IAP_F_FM | IAP_F_ALLCPUS), - IAPDESCR(B1H_80H, 0xB1, 0x80, IAP_F_FM | IAP_F_CA), + IAPDESCR(B1H_80H, 0xB1, 0x80, IAP_F_FM | IAP_F_CA | IAP_F_I7), IAPDESCR(B3H_01H, 0xB3, 0x01, IAP_F_FM | IAP_F_ALLCPUS), IAPDESCR(B3H_02H, 0xB3, 0x02, IAP_F_FM | IAP_F_ALLCPUS), @@ -835,8 +837,8 @@ static struct iap_event_descr iap_events IAPDESCR(B3H_A0H, 0xB3, 0xA0, IAP_F_FM | IAP_F_CA), IAPDESCR(C0H_00H, 0xC0, 0x00, IAP_F_FM | IAP_F_ALLCPUS), - IAPDESCR(C0H_01H, 0xC0, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(C0H_02H, 0xC0, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(C0H_01H, 0xC0, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(C0H_02H, 0xC0, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), IAPDESCR(C0H_04H, 0xC0, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(C0H_08H, 0xC0, 0x08, IAP_F_FM | IAP_F_CC2E), @@ -845,22 +847,22 @@ static struct iap_event_descr iap_events IAPDESCR(C1H_FEH, 0xC1, 0xFE, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(C2H_00H, 0xC2, 0x00, IAP_F_FM | IAP_F_CC), - IAPDESCR(C2H_01H, 0xC2, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(C2H_02H, 0xC2, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(C2H_04H, 0xC2, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(C2H_01H, 0xC2, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(C2H_02H, 0xC2, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(C2H_04H, 0xC2, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), IAPDESCR(C2H_07H, 0xC2, 0x07, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(C2H_08H, 0xC2, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(C2H_0FH, 0xC2, 0x0F, IAP_F_FM | IAP_F_CC2), IAPDESCR(C2H_10H, 0xC2, 0x10, IAP_F_FM | IAP_F_CA), IAPDESCR(C3H_00H, 0xC3, 0x00, IAP_F_FM | IAP_F_CC), - IAPDESCR(C3H_01H, 0xC3, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(C3H_04H, 0xC3, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(C3H_01H, 0xC3, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(C3H_04H, 0xC3, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), IAPDESCR(C4H_00H, 0xC4, 0x00, IAP_F_FM | IAP_F_ALLCPUS), - IAPDESCR(C4H_01H, 0xC4, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(C4H_02H, 0xC4, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(C4H_04H, 0xC4, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(C4H_01H, 0xC4, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(C4H_02H, 0xC4, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(C4H_04H, 0xC4, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), IAPDESCR(C4H_08H, 0xC4, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(C4H_0CH, 0xC4, 0x0C, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(C4H_0FH, 0xC4, 0x0F, IAP_F_FM | IAP_F_CA), @@ -872,11 +874,11 @@ static struct iap_event_descr iap_events IAPDESCR(C6H_02H, 0xC6, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(C7H_00H, 0xC7, 0x00, IAP_F_FM | IAP_F_CC), - IAPDESCR(C7H_01H, 0xC7, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(C7H_02H, 0xC7, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(C7H_04H, 0xC7, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(C7H_08H, 0xC7, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(C7H_10H, 0xC7, 0x10, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(C7H_01H, 0xC7, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(C7H_02H, 0xC7, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(C7H_04H, 0xC7, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(C7H_08H, 0xC7, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(C7H_10H, 0xC7, 0x10, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), IAPDESCR(C7H_1FH, 0xC7, 0x1F, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(C8H_00H, 0xC8, 0x00, IAP_F_FM | IAP_F_ALLCPUS), @@ -889,15 +891,15 @@ static struct iap_event_descr iap_events IAPDESCR(CAH_04H, 0xCA, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(CAH_08H, 0xCA, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(CBH_01H, 0xCB, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(CBH_02H, 0xCB, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(CBH_04H, 0xCB, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(CBH_08H, 0xCB, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(CBH_10H, 0xCB, 0x10, IAP_F_FM | IAP_F_CC2), + IAPDESCR(CBH_01H, 0xCB, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(CBH_02H, 0xCB, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(CBH_04H, 0xCB, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(CBH_08H, 0xCB, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(CBH_10H, 0xCB, 0x10, IAP_F_FM | IAP_F_CC2 | IAP_F_I7), IAPDESCR(CCH_00H, 0xCC, 0x00, IAP_F_FM | IAP_F_CC), IAPDESCR(CCH_01H, 0xCC, 0x01, IAP_F_FM | IAP_F_ALLCPUS), - IAPDESCR(CCH_02H, 0xCC, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(CCH_02H, 0xCC, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), IAPDESCR(CDH_00H, 0xCD, 0x00, IAP_F_FM | IAP_F_ALLCPUS), IAPDESCR(CEH_00H, 0xCE, 0x00, IAP_F_FM | IAP_F_ALLCPUS), @@ -905,20 +907,20 @@ static struct iap_event_descr iap_events IAPDESCR(D0H_00H, 0xD0, 0x00, IAP_F_FM | IAP_F_CC), - IAPDESCR(D2H_01H, 0xD2, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(D2H_02H, 0xD2, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(D2H_04H, 0xD2, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(D2H_08H, 0xD2, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(D2H_0FH, 0xD2, 0x0F, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(D2H_01H, 0xD2, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(D2H_02H, 0xD2, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(D2H_04H, 0xD2, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(D2H_08H, 0xD2, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), + IAPDESCR(D2H_0FH, 0xD2, 0x0F, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), IAPDESCR(D2H_10H, 0xD2, 0x10, IAP_F_FM | IAP_F_CC2E), - IAPDESCR(D4H_01H, 0xD4, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(D4H_01H, 0xD4, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), IAPDESCR(D4H_02H, 0xD4, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(D4H_04H, 0xD4, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(D4H_08H, 0xD4, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(D4H_0FH, 0xD4, 0x0F, IAP_F_FM | IAP_F_CA | IAP_F_CC2), - IAPDESCR(D5H_01H, 0xD5, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2), + IAPDESCR(D5H_01H, 0xD5, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7), IAPDESCR(D5H_02H, 0xD5, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(D5H_04H, 0xD5, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(D5H_08H, 0xD5, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2), @@ -951,7 +953,7 @@ static struct iap_event_descr iap_events IAPDESCR(DCH_1FH, 0xDC, 0x1F, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(E0H_00H, 0xE0, 0x00, IAP_F_FM | IAP_F_CC | IAP_F_CC2), - IAPDESCR(E0H_01H, 0xE0, 0x01, IAP_F_FM | IAP_F_CA), + IAPDESCR(E0H_01H, 0xE0, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_I7), IAPDESCR(E2H_00H, 0xE2, 0x00, IAP_F_FM | IAP_F_CC), IAPDESCR(E4H_00H, 0xE4, 0x00, IAP_F_FM | IAP_F_ALLCPUS), @@ -960,7 +962,244 @@ static struct iap_event_descr iap_events IAPDESCR(E6H_01H, 0xE6, 0x01, IAP_F_FM | IAP_F_CA), IAPDESCR(F0H_00H, 0xF0, 0x00, IAP_F_FM | IAP_F_ALLCPUS), - IAPDESCR(F8H_00H, 0xF8, 0x00, IAP_F_FM | IAP_F_ALLCPUS) + IAPDESCR(F8H_00H, 0xF8, 0x00, IAP_F_FM | IAP_F_ALLCPUS), + + /* Added with nehalem. */ + IAPDESCR(02H_01H, 0x02, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(03H_01H, 0x03, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(05H_01H, 0x05, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(05H_02H, 0x05, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(05H_03H, 0x05, 0x03, IAP_F_FM | IAP_F_I7), + IAPDESCR(06H_01H, 0x06, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(06H_02H, 0x06, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(06H_04H, 0x06, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(06H_08H, 0x06, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(06H_0FH, 0x06, 0x0F, IAP_F_FM | IAP_F_I7), + IAPDESCR(08H_10H, 0x08, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(08H_20H, 0x08, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(08H_40H, 0x08, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(08H_80H, 0x08, 0x80, IAP_F_FM | IAP_F_I7), + IAPDESCR(09H_04H, 0x09, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(09H_08H, 0x09, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(0BH_01H, 0x0B, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(0BH_02H, 0x0B, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(0EH_01H, 0x0E, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(0EH_02H, 0x0E, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(0FH_02H, 0x0F, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(0FH_08H, 0x0F, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(0FH_10H, 0x0F, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(0FH_20H, 0x0F, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(10H_02H, 0x10, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(10H_04H, 0x10, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(10H_08H, 0x10, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(10H_10H, 0x10, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(10H_20H, 0x10, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(10H_40H, 0x10, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(10H_80H, 0x10, 0x80, IAP_F_FM | IAP_F_I7), + IAPDESCR(12H_02H, 0x12, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(12H_04H, 0x12, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(12H_08H, 0x12, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(12H_10H, 0x12, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(12H_20H, 0x12, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(12H_40H, 0x12, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(13H_02H, 0x13, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(13H_04H, 0x13, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(13H_07H, 0x13, 0x07, IAP_F_FM | IAP_F_I7), + IAPDESCR(14H_02H, 0x14, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(17H_01H, 0x17, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(18H_01H, 0x18, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(1DH_01H, 0x1D, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(1DH_02H, 0x1D, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(1DH_04H, 0x1D, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(1EH_01H, 0x1E, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(24H_01H, 0x24, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(24H_02H, 0x24, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(24H_03H, 0x24, 0x03, IAP_F_FM | IAP_F_I7), + IAPDESCR(24H_04H, 0x24, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(24H_08H, 0x24, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(24H_0CH, 0x24, 0x0C, IAP_F_FM | IAP_F_I7), + IAPDESCR(24H_10H, 0x24, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(24H_20H, 0x24, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(24H_30H, 0x24, 0x30, IAP_F_FM | IAP_F_I7), + IAPDESCR(24H_40H, 0x24, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(24H_80H, 0x24, 0x80, IAP_F_FM | IAP_F_I7), + IAPDESCR(24H_AAH, 0x24, 0xAA, IAP_F_FM | IAP_F_I7), + IAPDESCR(24H_C0H, 0x24, 0xC0, IAP_F_FM | IAP_F_I7), + IAPDESCR(24H_FFH, 0x24, 0xFF, IAP_F_FM | IAP_F_I7), + IAPDESCR(26H_01H, 0x26, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(26H_02H, 0x26, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(26H_04H, 0x26, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(26H_08H, 0x26, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(26H_0FH, 0x26, 0x0F, IAP_F_FM | IAP_F_I7), + IAPDESCR(26H_10H, 0x26, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(26H_20H, 0x26, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(26H_40H, 0x26, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(26H_80H, 0x26, 0x80, IAP_F_FM | IAP_F_I7), + IAPDESCR(26H_F0H, 0x26, 0xF0, IAP_F_FM | IAP_F_I7), + IAPDESCR(26H_FFH, 0x26, 0xFF, IAP_F_FM | IAP_F_I7), + IAPDESCR(27H_01H, 0x27, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(27H_02H, 0x27, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(27H_04H, 0x27, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(27H_08H, 0x27, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(27H_0EH, 0x27, 0x0E, IAP_F_FM | IAP_F_I7), + IAPDESCR(27H_0FH, 0x27, 0x0F, IAP_F_FM | IAP_F_I7), + IAPDESCR(27H_10H, 0x27, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(27H_20H, 0x27, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(27H_40H, 0x27, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(27H_80H, 0x27, 0x80, IAP_F_FM | IAP_F_I7), + IAPDESCR(27H_E0H, 0x27, 0xE0, IAP_F_FM | IAP_F_I7), + IAPDESCR(27H_F0H, 0x27, 0xF0, IAP_F_FM | IAP_F_I7), + IAPDESCR(28H_01H, 0x28, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(28H_02H, 0x28, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(28H_04H, 0x28, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(28H_08H, 0x28, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(28H_0FH, 0x28, 0x0F, IAP_F_FM | IAP_F_I7), + IAPDESCR(3DH_01H, 0x3D, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(40H_01H, 0x40, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(40H_02H, 0x40, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(40H_04H, 0x40, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(40H_08H, 0x40, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(40H_0FH, 0x40, 0x0F, IAP_F_FM | IAP_F_I7), + IAPDESCR(41H_01H, 0x41, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(41H_02H, 0x41, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(41H_04H, 0x41, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(41H_08H, 0x41, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(41H_0FH, 0x41, 0x0F, IAP_F_FM | IAP_F_I7), + IAPDESCR(42H_01H, 0x42, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(42H_02H, 0x42, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(42H_04H, 0x42, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(42H_08H, 0x42, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(48H_02H, 0x48, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(49H_10H, 0x49, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(49H_20H, 0x49, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(49H_40H, 0x49, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(49H_80H, 0x49, 0x80, IAP_F_FM | IAP_F_I7), + IAPDESCR(4BH_08H, 0x4B, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(4CH_01H, 0x4C, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(4DH_01H, 0x4D, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(4EH_01H, 0x4E, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(4EH_02H, 0x4E, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(4EH_04H, 0x4E, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(4FH_02H, 0x4F, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(4FH_04H, 0x4F, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(4FH_08H, 0x4F, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(51H_01H, 0x51, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(51H_02H, 0x51, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(51H_04H, 0x51, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(51H_08H, 0x51, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(52H_01H, 0x52, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(53H_01H, 0x53, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(60H_01H, 0x60, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(60H_02H, 0x60, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(60H_04H, 0x60, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(60H_08H, 0x60, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(63H_01H, 0x63, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(63H_02H, 0x63, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(6CH_01H, 0x6C, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(80H_01H, 0x80, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(80H_04H, 0x80, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(80H_10H, 0x80, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(81H_01H, 0x81, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(81H_02H, 0x81, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(82H_01H, 0x82, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(83H_01H, 0x83, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(85H_01H, 0x85, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(85H_02H, 0x85, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(85H_04H, 0x85, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(85H_10H, 0x85, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(85H_20H, 0x85, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(85H_40H, 0x85, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(85H_80H, 0x85, 0x80, IAP_F_FM | IAP_F_I7), + IAPDESCR(87H_01H, 0x87, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(87H_02H, 0x87, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(87H_04H, 0x87, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(87H_08H, 0x87, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(87H_0FH, 0x87, 0x0F, IAP_F_FM | IAP_F_I7), + IAPDESCR(88H_01H, 0x88, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(88H_02H, 0x88, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(88H_04H, 0x88, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(88H_07H, 0x88, 0x07, IAP_F_FM | IAP_F_I7), + IAPDESCR(88H_08H, 0x88, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(88H_10H, 0x88, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(88H_20H, 0x88, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(88H_30H, 0x88, 0x30, IAP_F_FM | IAP_F_I7), + IAPDESCR(88H_40H, 0x88, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(89H_01H, 0x89, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(89H_02H, 0x89, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(89H_04H, 0x89, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(89H_07H, 0x89, 0x07, IAP_F_FM | IAP_F_I7), + IAPDESCR(89H_08H, 0x89, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(89H_10H, 0x89, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(89H_20H, 0x89, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(89H_30H, 0x89, 0x30, IAP_F_FM | IAP_F_I7), + IAPDESCR(89H_40H, 0x89, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(89H_7FH, 0x89, 0x7F, IAP_F_FM | IAP_F_I7), + IAPDESCR(A2H_01H, 0xA2, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(A2H_02H, 0xA2, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(A2H_04H, 0xA2, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(A2H_08H, 0xA2, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(A2H_10H, 0xA2, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(A2H_20H, 0xA2, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(A2H_40H, 0xA2, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(A2H_80H, 0xA2, 0x80, IAP_F_FM | IAP_F_I7), + IAPDESCR(A6H_01H, 0xA6, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(A7H_01H, 0xA7, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(A8H_01H, 0xA8, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(B0H_01H, 0xB0, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(B0H_02H, 0xB0, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(B0H_04H, 0xB0, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(B0H_08H, 0xB0, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(B0H_20H, 0xB0, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(B0H_40H, 0xB0, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(B1H_01H, 0xB1, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(B1H_02H, 0xB1, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(B1H_04H, 0xB1, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(B1H_08H, 0xB1, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(B1H_10H, 0xB1, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(B1H_20H, 0xB1, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(B1H_40H, 0xB1, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(B2H_01H, 0xB2, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(B7H_01H, 0xB7, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(B8H_01H, 0xB8, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(B8H_02H, 0xB8, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(B8H_04H, 0xB8, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(BAH_01H, 0xBA, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(BAH_02H, 0xBA, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(C3H_02H, 0xC3, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(C3H_10H, 0xC3, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(C5H_02H, 0xC5, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(C8H_20H, 0xC8, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(CBH_40H, 0xCB, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(CBH_80H, 0xCB, 0x80, IAP_F_FM | IAP_F_I7), + IAPDESCR(CCH_03H, 0xCC, 0x03, IAP_F_FM | IAP_F_I7), + IAPDESCR(D0H_01H, 0xD0, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(D1H_02H, 0xD1, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(D1H_04H, 0xD1, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(D1H_08H, 0xD1, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(DBH_01H, 0xDB, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(E4H_01H, 0xE4, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(E5H_01H, 0xE5, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(F3H_04H, 0xF3, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(F3H_08H, 0xF3, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(F3H_10H, 0xF3, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(F3H_20H, 0xF3, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(F4H_01H, 0xF4, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(F4H_02H, 0xF4, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(F4H_04H, 0xF4, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(F4H_08H, 0xF4, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(F4H_10H, 0xF4, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(F6H_01H, 0xF6, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(F7H_01H, 0xF7, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(F7H_02H, 0xF7, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(F7H_04H, 0xF7, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(F8H_01H, 0xF8, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(FDH_01H, 0xFD, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(FDH_02H, 0xFD, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(FDH_04H, 0xFD, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(FDH_08H, 0xFD, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(FDH_10H, 0xFD, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(FDH_20H, 0xFD, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(FDH_40H, 0xFD, 0x40, IAP_F_FM | IAP_F_I7), }; static const int niap_events = sizeof(iap_events) / sizeof(iap_events[0]); @@ -1113,6 +1352,9 @@ iap_allocate_pmc(int cpu, int ri, struct case PMC_CPU_INTEL_CORE2EXTREME: cpuflag = IAP_F_CC2 | IAP_F_CC2E; break; + case PMC_CPU_INTEL_COREI7: + cpuflag = IAP_F_I7; + break; } for (n = 0, ie = iap_events; n < niap_events; n++, ie++) Modified: head/sys/dev/hwpmc/hwpmc_intel.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_intel.c Tue Jan 27 02:18:42 2009 (r187760) +++ head/sys/dev/hwpmc/hwpmc_intel.c Tue Jan 27 07:29:37 2009 (r187761) @@ -130,6 +130,10 @@ pmc_intel_initialize(void) cputype = PMC_CPU_INTEL_ATOM; nclasses = 3; break; + case 0x1A: + cputype = PMC_CPU_INTEL_COREI7; + nclasses = 3; + break; } break; #if defined(__i386__) || defined(__amd64__) @@ -169,6 +173,7 @@ pmc_intel_initialize(void) case PMC_CPU_INTEL_CORE: case PMC_CPU_INTEL_CORE2: case PMC_CPU_INTEL_CORE2EXTREME: + case PMC_CPU_INTEL_COREI7: error = pmc_core_initialize(pmc_mdep, ncpus); break; Modified: head/sys/dev/hwpmc/pmc_events.h ============================================================================== --- head/sys/dev/hwpmc/pmc_events.h Tue Jan 27 02:18:42 2009 (r187760) +++ head/sys/dev/hwpmc/pmc_events.h Tue Jan 27 07:29:37 2009 (r187761) @@ -738,10 +738,245 @@ __PMC_EV(IAP, EVENT_E4H_00H) \ __PMC_EV(IAP, EVENT_E6H_00H) \ __PMC_EV(IAP, EVENT_E6H_01H) \ __PMC_EV(IAP, EVENT_F0H_00H) \ -__PMC_EV(IAP, EVENT_F8H_00H) +__PMC_EV(IAP, EVENT_F8H_00H) \ +__PMC_EV(IAP, EVENT_02H_01H) \ +__PMC_EV(IAP, EVENT_03H_01H) \ +__PMC_EV(IAP, EVENT_05H_01H) \ +__PMC_EV(IAP, EVENT_05H_02H) \ +__PMC_EV(IAP, EVENT_05H_03H) \ +__PMC_EV(IAP, EVENT_06H_01H) \ +__PMC_EV(IAP, EVENT_06H_02H) \ +__PMC_EV(IAP, EVENT_06H_04H) \ +__PMC_EV(IAP, EVENT_06H_08H) \ +__PMC_EV(IAP, EVENT_06H_0FH) \ +__PMC_EV(IAP, EVENT_08H_10H) \ +__PMC_EV(IAP, EVENT_08H_20H) \ +__PMC_EV(IAP, EVENT_08H_40H) \ +__PMC_EV(IAP, EVENT_08H_80H) \ +__PMC_EV(IAP, EVENT_09H_04H) \ +__PMC_EV(IAP, EVENT_09H_08H) \ +__PMC_EV(IAP, EVENT_0BH_01H) \ +__PMC_EV(IAP, EVENT_0BH_02H) \ +__PMC_EV(IAP, EVENT_0EH_01H) \ +__PMC_EV(IAP, EVENT_0EH_02H) \ +__PMC_EV(IAP, EVENT_0FH_02H) \ +__PMC_EV(IAP, EVENT_0FH_08H) \ +__PMC_EV(IAP, EVENT_0FH_10H) \ +__PMC_EV(IAP, EVENT_0FH_20H) \ +__PMC_EV(IAP, EVENT_10H_02H) \ +__PMC_EV(IAP, EVENT_10H_04H) \ +__PMC_EV(IAP, EVENT_10H_08H) \ +__PMC_EV(IAP, EVENT_10H_10H) \ +__PMC_EV(IAP, EVENT_10H_20H) \ +__PMC_EV(IAP, EVENT_10H_40H) \ +__PMC_EV(IAP, EVENT_10H_80H) \ +__PMC_EV(IAP, EVENT_12H_02H) \ +__PMC_EV(IAP, EVENT_12H_04H) \ +__PMC_EV(IAP, EVENT_12H_08H) \ +__PMC_EV(IAP, EVENT_12H_10H) \ +__PMC_EV(IAP, EVENT_12H_20H) \ +__PMC_EV(IAP, EVENT_12H_40H) \ +__PMC_EV(IAP, EVENT_13H_02H) \ +__PMC_EV(IAP, EVENT_13H_04H) \ +__PMC_EV(IAP, EVENT_13H_07H) \ +__PMC_EV(IAP, EVENT_14H_02H) \ +__PMC_EV(IAP, EVENT_17H_01H) \ +__PMC_EV(IAP, EVENT_18H_01H) \ +__PMC_EV(IAP, EVENT_1DH_01H) \ +__PMC_EV(IAP, EVENT_1DH_02H) \ +__PMC_EV(IAP, EVENT_1DH_04H) \ +__PMC_EV(IAP, EVENT_1EH_01H) \ +__PMC_EV(IAP, EVENT_24H_01H) \ +__PMC_EV(IAP, EVENT_24H_02H) \ +__PMC_EV(IAP, EVENT_24H_03H) \ +__PMC_EV(IAP, EVENT_24H_04H) \ +__PMC_EV(IAP, EVENT_24H_08H) \ +__PMC_EV(IAP, EVENT_24H_0CH) \ +__PMC_EV(IAP, EVENT_24H_10H) \ +__PMC_EV(IAP, EVENT_24H_20H) \ +__PMC_EV(IAP, EVENT_24H_30H) \ +__PMC_EV(IAP, EVENT_24H_40H) \ +__PMC_EV(IAP, EVENT_24H_80H) \ +__PMC_EV(IAP, EVENT_24H_AAH) \ +__PMC_EV(IAP, EVENT_24H_C0H) \ +__PMC_EV(IAP, EVENT_24H_FFH) \ +__PMC_EV(IAP, EVENT_26H_01H) \ +__PMC_EV(IAP, EVENT_26H_02H) \ +__PMC_EV(IAP, EVENT_26H_04H) \ +__PMC_EV(IAP, EVENT_26H_08H) \ +__PMC_EV(IAP, EVENT_26H_0FH) \ +__PMC_EV(IAP, EVENT_26H_10H) \ +__PMC_EV(IAP, EVENT_26H_20H) \ +__PMC_EV(IAP, EVENT_26H_40H) \ +__PMC_EV(IAP, EVENT_26H_80H) \ +__PMC_EV(IAP, EVENT_26H_F0H) \ +__PMC_EV(IAP, EVENT_26H_FFH) \ +__PMC_EV(IAP, EVENT_27H_01H) \ +__PMC_EV(IAP, EVENT_27H_02H) \ +__PMC_EV(IAP, EVENT_27H_04H) \ +__PMC_EV(IAP, EVENT_27H_08H) \ +__PMC_EV(IAP, EVENT_27H_0EH) \ +__PMC_EV(IAP, EVENT_27H_0FH) \ +__PMC_EV(IAP, EVENT_27H_10H) \ +__PMC_EV(IAP, EVENT_27H_20H) \ +__PMC_EV(IAP, EVENT_27H_40H) \ +__PMC_EV(IAP, EVENT_27H_80H) \ +__PMC_EV(IAP, EVENT_27H_E0H) \ +__PMC_EV(IAP, EVENT_27H_F0H) \ +__PMC_EV(IAP, EVENT_28H_01H) \ +__PMC_EV(IAP, EVENT_28H_02H) \ +__PMC_EV(IAP, EVENT_28H_04H) \ +__PMC_EV(IAP, EVENT_28H_08H) \ +__PMC_EV(IAP, EVENT_28H_0FH) \ +__PMC_EV(IAP, EVENT_3DH_01H) \ +__PMC_EV(IAP, EVENT_40H_01H) \ +__PMC_EV(IAP, EVENT_40H_02H) \ +__PMC_EV(IAP, EVENT_40H_04H) \ +__PMC_EV(IAP, EVENT_40H_08H) \ +__PMC_EV(IAP, EVENT_40H_0FH) \ +__PMC_EV(IAP, EVENT_41H_01H) \ +__PMC_EV(IAP, EVENT_41H_02H) \ +__PMC_EV(IAP, EVENT_41H_04H) \ +__PMC_EV(IAP, EVENT_41H_08H) \ +__PMC_EV(IAP, EVENT_41H_0FH) \ +__PMC_EV(IAP, EVENT_42H_01H) \ +__PMC_EV(IAP, EVENT_42H_02H) \ +__PMC_EV(IAP, EVENT_42H_04H) \ +__PMC_EV(IAP, EVENT_42H_08H) \ +__PMC_EV(IAP, EVENT_48H_02H) \ +__PMC_EV(IAP, EVENT_49H_10H) \ +__PMC_EV(IAP, EVENT_49H_20H) \ +__PMC_EV(IAP, EVENT_49H_40H) \ +__PMC_EV(IAP, EVENT_49H_80H) \ +__PMC_EV(IAP, EVENT_4BH_08H) \ +__PMC_EV(IAP, EVENT_4CH_01H) \ +__PMC_EV(IAP, EVENT_4DH_01H) \ +__PMC_EV(IAP, EVENT_4EH_01H) \ +__PMC_EV(IAP, EVENT_4EH_02H) \ +__PMC_EV(IAP, EVENT_4EH_04H) \ +__PMC_EV(IAP, EVENT_4FH_02H) \ +__PMC_EV(IAP, EVENT_4FH_04H) \ +__PMC_EV(IAP, EVENT_4FH_08H) \ +__PMC_EV(IAP, EVENT_51H_01H) \ +__PMC_EV(IAP, EVENT_51H_02H) \ +__PMC_EV(IAP, EVENT_51H_04H) \ +__PMC_EV(IAP, EVENT_51H_08H) \ +__PMC_EV(IAP, EVENT_52H_01H) \ +__PMC_EV(IAP, EVENT_53H_01H) \ +__PMC_EV(IAP, EVENT_60H_01H) \ +__PMC_EV(IAP, EVENT_60H_02H) \ +__PMC_EV(IAP, EVENT_60H_04H) \ +__PMC_EV(IAP, EVENT_60H_08H) \ +__PMC_EV(IAP, EVENT_63H_01H) \ +__PMC_EV(IAP, EVENT_63H_02H) \ +__PMC_EV(IAP, EVENT_6CH_01H) \ +__PMC_EV(IAP, EVENT_80H_01H) \ +__PMC_EV(IAP, EVENT_80H_04H) \ +__PMC_EV(IAP, EVENT_80H_10H) \ +__PMC_EV(IAP, EVENT_81H_01H) \ +__PMC_EV(IAP, EVENT_81H_02H) \ +__PMC_EV(IAP, EVENT_82H_01H) \ +__PMC_EV(IAP, EVENT_83H_01H) \ +__PMC_EV(IAP, EVENT_85H_01H) \ +__PMC_EV(IAP, EVENT_85H_02H) \ +__PMC_EV(IAP, EVENT_85H_04H) \ +__PMC_EV(IAP, EVENT_85H_10H) \ +__PMC_EV(IAP, EVENT_85H_20H) \ +__PMC_EV(IAP, EVENT_85H_40H) \ +__PMC_EV(IAP, EVENT_85H_80H) \ +__PMC_EV(IAP, EVENT_87H_01H) \ +__PMC_EV(IAP, EVENT_87H_02H) \ +__PMC_EV(IAP, EVENT_87H_04H) \ +__PMC_EV(IAP, EVENT_87H_08H) \ +__PMC_EV(IAP, EVENT_87H_0FH) \ +__PMC_EV(IAP, EVENT_88H_01H) \ +__PMC_EV(IAP, EVENT_88H_02H) \ +__PMC_EV(IAP, EVENT_88H_04H) \ +__PMC_EV(IAP, EVENT_88H_07H) \ +__PMC_EV(IAP, EVENT_88H_08H) \ +__PMC_EV(IAP, EVENT_88H_10H) \ +__PMC_EV(IAP, EVENT_88H_20H) \ +__PMC_EV(IAP, EVENT_88H_30H) \ +__PMC_EV(IAP, EVENT_88H_40H) \ +__PMC_EV(IAP, EVENT_89H_01H) \ +__PMC_EV(IAP, EVENT_89H_02H) \ +__PMC_EV(IAP, EVENT_89H_04H) \ +__PMC_EV(IAP, EVENT_89H_07H) \ +__PMC_EV(IAP, EVENT_89H_08H) \ +__PMC_EV(IAP, EVENT_89H_10H) \ +__PMC_EV(IAP, EVENT_89H_20H) \ +__PMC_EV(IAP, EVENT_89H_30H) \ +__PMC_EV(IAP, EVENT_89H_40H) \ +__PMC_EV(IAP, EVENT_89H_7FH) \ +__PMC_EV(IAP, EVENT_A2H_01H) \ +__PMC_EV(IAP, EVENT_A2H_02H) \ +__PMC_EV(IAP, EVENT_A2H_04H) \ +__PMC_EV(IAP, EVENT_A2H_08H) \ +__PMC_EV(IAP, EVENT_A2H_10H) \ +__PMC_EV(IAP, EVENT_A2H_20H) \ +__PMC_EV(IAP, EVENT_A2H_40H) \ +__PMC_EV(IAP, EVENT_A2H_80H) \ +__PMC_EV(IAP, EVENT_A6H_01H) \ +__PMC_EV(IAP, EVENT_A7H_01H) \ +__PMC_EV(IAP, EVENT_A8H_01H) \ +__PMC_EV(IAP, EVENT_B0H_01H) \ +__PMC_EV(IAP, EVENT_B0H_02H) \ +__PMC_EV(IAP, EVENT_B0H_04H) \ +__PMC_EV(IAP, EVENT_B0H_08H) \ +__PMC_EV(IAP, EVENT_B0H_20H) \ +__PMC_EV(IAP, EVENT_B0H_40H) \ +__PMC_EV(IAP, EVENT_B1H_01H) \ +__PMC_EV(IAP, EVENT_B1H_02H) \ +__PMC_EV(IAP, EVENT_B1H_04H) \ +__PMC_EV(IAP, EVENT_B1H_08H) \ +__PMC_EV(IAP, EVENT_B1H_10H) \ +__PMC_EV(IAP, EVENT_B1H_20H) \ +__PMC_EV(IAP, EVENT_B1H_40H) \ +__PMC_EV(IAP, EVENT_B2H_01H) \ +__PMC_EV(IAP, EVENT_B7H_01H) \ +__PMC_EV(IAP, EVENT_B8H_01H) \ +__PMC_EV(IAP, EVENT_B8H_02H) \ +__PMC_EV(IAP, EVENT_B8H_04H) \ +__PMC_EV(IAP, EVENT_BAH_01H) \ +__PMC_EV(IAP, EVENT_BAH_02H) \ +__PMC_EV(IAP, EVENT_C3H_02H) \ +__PMC_EV(IAP, EVENT_C3H_10H) \ +__PMC_EV(IAP, EVENT_C5H_02H) \ +__PMC_EV(IAP, EVENT_C8H_20H) \ +__PMC_EV(IAP, EVENT_CBH_40H) \ +__PMC_EV(IAP, EVENT_CBH_80H) \ +__PMC_EV(IAP, EVENT_CCH_03H) \ +__PMC_EV(IAP, EVENT_D0H_01H) \ +__PMC_EV(IAP, EVENT_D1H_02H) \ +__PMC_EV(IAP, EVENT_D1H_04H) \ +__PMC_EV(IAP, EVENT_D1H_08H) \ +__PMC_EV(IAP, EVENT_DBH_01H) \ +__PMC_EV(IAP, EVENT_E4H_01H) \ +__PMC_EV(IAP, EVENT_E5H_01H) \ +__PMC_EV(IAP, EVENT_F3H_04H) \ +__PMC_EV(IAP, EVENT_F3H_08H) \ +__PMC_EV(IAP, EVENT_F3H_10H) \ +__PMC_EV(IAP, EVENT_F3H_20H) \ +__PMC_EV(IAP, EVENT_F4H_01H) \ +__PMC_EV(IAP, EVENT_F4H_02H) \ +__PMC_EV(IAP, EVENT_F4H_04H) \ +__PMC_EV(IAP, EVENT_F4H_08H) \ +__PMC_EV(IAP, EVENT_F4H_10H) \ +__PMC_EV(IAP, EVENT_F6H_01H) \ +__PMC_EV(IAP, EVENT_F7H_01H) \ +__PMC_EV(IAP, EVENT_F7H_02H) \ +__PMC_EV(IAP, EVENT_F7H_04H) \ +__PMC_EV(IAP, EVENT_F8H_01H) \ +__PMC_EV(IAP, EVENT_FDH_01H) \ +__PMC_EV(IAP, EVENT_FDH_02H) \ +__PMC_EV(IAP, EVENT_FDH_04H) \ +__PMC_EV(IAP, EVENT_FDH_08H) \ +__PMC_EV(IAP, EVENT_FDH_10H) \ +__PMC_EV(IAP, EVENT_FDH_20H) \ +__PMC_EV(IAP, EVENT_FDH_40H) #define PMC_EV_IAP_FIRST PMC_EV_IAP_EVENT_02H_81H -#define PMC_EV_IAP_LAST PMC_EV_IAP_EVENT_F8H_00H +#define PMC_EV_IAP_LAST PMC_EV_IAP_EVENT_FDH_40H /* * Map "architectural" event names to event ids. @@ -1378,6 +1613,309 @@ __PMC_EV_ALIAS("UOPS_RETIRED.STD_STA", __PMC_EV_ALIAS("X87_OPS_RETIRED.ANY", IAP_EVENT_C1H_FEH) \ __PMC_EV_ALIAS("X87_OPS_RETIRED.FXCH", IAP_EVENT_C1H_01H) +/* + * Aliases for Core i7 PMC events. + */ +#define __PMC_EV_ALIAS_COREI7() \ +__PMC_EV_ALIAS_INTEL_ARCHITECTURAL() \ +__PMC_EV_ALIAS("SB_FORWARD.ANY", IAP_EVENT_02H_01H) \ +__PMC_EV_ALIAS("LOAD_BLOCK.STD", IAP_EVENT_03H_01H) \ +__PMC_EV_ALIAS("LOAD_BLOCK.ADDRESS_OFFSET", IAP_EVENT_03H_04H) \ +__PMC_EV_ALIAS("SB_DRAIN.CYCLES", IAP_EVENT_04H_01H) \ +__PMC_EV_ALIAS("MISALIGN_MEM_REF.LOAD", IAP_EVENT_05H_01H) \ +__PMC_EV_ALIAS("MISALIGN_MEM_REF.STORE", IAP_EVENT_05H_02H) \ +__PMC_EV_ALIAS("MISALIGN_MEM_REF.ANY", IAP_EVENT_05H_03H) \ +__PMC_EV_ALIAS("STORE_BLOCKS.NOT_STA", IAP_EVENT_06H_01H) \ +__PMC_EV_ALIAS("STORE_BLOCKS.STA", IAP_EVENT_06H_02H) \ +__PMC_EV_ALIAS("STORE_BLOCKS.AT_RET", IAP_EVENT_06H_04H) \ +__PMC_EV_ALIAS("STORE_BLOCKS.L1D_BLOCK", IAP_EVENT_06H_08H) \ +__PMC_EV_ALIAS("STORE_BLOCKS.ANY", IAP_EVENT_06H_0FH) \ +__PMC_EV_ALIAS("PARTIAL_ADDRESS_ALIAS", IAP_EVENT_07H_01H) \ +__PMC_EV_ALIAS("DTLB_LOAD_MISSES.ANY", IAP_EVENT_08H_01H) \ +__PMC_EV_ALIAS("DTLB_LOAD_MISSES.WALK_COMPLETED", IAP_EVENT_08H_02H) \ +__PMC_EV_ALIAS("DTLB_LOAD_MISSES.STLB_HIT", IAP_EVENT_08H_10H) \ +__PMC_EV_ALIAS("DTLB_LOAD_MISSES.PDE_MISS", IAP_EVENT_08H_20H) \ +__PMC_EV_ALIAS("DTLB_LOAD_MISSES.PDP_MISS", IAP_EVENT_08H_40H) \ +__PMC_EV_ALIAS("DTLB_LOAD_MISSES.LARGE_WALK_COMPLETED", IAP_EVENT_08H_80H) \ +__PMC_EV_ALIAS("MEMORY_DISAMBIGURATION.RESET", IAP_EVENT_09H_01H) \ +__PMC_EV_ALIAS("MEMORY_DISAMBIGURATION.SUCCESS", IAP_EVENT_09H_02H) \ +__PMC_EV_ALIAS("MEMORY_DISAMBIGURATION.WATCHDOG", IAP_EVENT_09H_04H) \ +__PMC_EV_ALIAS("MEMORY_DISAMBIGURATION.WATCH_CYCLES", IAP_EVENT_09H_08H) \ +__PMC_EV_ALIAS("MEM_INST_RETIRED.LOADS", IAP_EVENT_0BH_01H) \ +__PMC_EV_ALIAS("MEM_INST_RETIRED.STORES", IAP_EVENT_0BH_02H) \ +__PMC_EV_ALIAS("MEM_STORE_RETIRED.DTLB_MISS", IAP_EVENT_0CH_01H) \ +__PMC_EV_ALIAS("UOPS_ISSUED.ANY", IAP_EVENT_0EH_01H) \ +__PMC_EV_ALIAS("UOPS_ISSUED.FUSED", IAP_EVENT_0EH_02H) \ +__PMC_EV_ALIAS("MEM_UNCORE_RETIRED.OTHER_CORE_L2_HITM", IAP_EVENT_0FH_02H) \ +__PMC_EV_ALIAS("MEM_UNCORE_RETIRED.REMOTE_CACHE_LOCAL_HOME_HIT", IAP_EVENT_0FH_08H) \ +__PMC_EV_ALIAS("MEM_UNCORE_RETIRED.REMOTE_DRAM", IAP_EVENT_0FH_10H) \ +__PMC_EV_ALIAS("MEM_UNCORE_RETIRED.LOCAL_DRAM", IAP_EVENT_0FH_20H) \ +__PMC_EV_ALIAS("FP_COMP_OPS_EXE.X87", IAP_EVENT_10H_01H) \ +__PMC_EV_ALIAS("FP_COMP_OPS_EXE.MMX", IAP_EVENT_10H_02H) \ +__PMC_EV_ALIAS("FP_COMP_OPS_EXE.SSE_FP", IAP_EVENT_10H_04H) \ +__PMC_EV_ALIAS("FP_COMP_OPS_EXE.SSE2_INTEGER", IAP_EVENT_10H_08H) \ +__PMC_EV_ALIAS("FP_COMP_OPS_EXE.SSE_FP_PACKED", IAP_EVENT_10H_10H) \ +__PMC_EV_ALIAS("FP_COMP_OPS_EXE.SSE_FP_SCALAR", IAP_EVENT_10H_20H) \ +__PMC_EV_ALIAS("FP_COMP_OPS_EXE.SSE_SINGLE_PRECISION", IAP_EVENT_10H_40H) \ +__PMC_EV_ALIAS("FP_COMP_OPS_EXE.SSE_DOUBLE_PRECISION", IAP_EVENT_10H_80H) \ +__PMC_EV_ALIAS("SIMD_INT_128.PACKED_MPY", IAP_EVENT_12H_01H) \ +__PMC_EV_ALIAS("SIMD_INT_128.PACKED_SHIFT", IAP_EVENT_12H_02H) \ +__PMC_EV_ALIAS("SIMD_INT_128.PACK", IAP_EVENT_12H_04H) \ +__PMC_EV_ALIAS("SIMD_INT_128.UNPACK", IAP_EVENT_12H_08H) \ +__PMC_EV_ALIAS("SIMD_INT_128.PACKED_LOGICAL", IAP_EVENT_12H_10H) \ +__PMC_EV_ALIAS("SIMD_INT_128.PACKED_ARITH", IAP_EVENT_12H_20H) \ +__PMC_EV_ALIAS("SIMD_INT_128.SHUFFLE_MOVE", IAP_EVENT_12H_40H) \ +__PMC_EV_ALIAS("LOAD_DISPATCH.RS", IAP_EVENT_13H_01H) \ +__PMC_EV_ALIAS("LOAD_DISPATCH.RS_DELAYED", IAP_EVENT_13H_02H) \ +__PMC_EV_ALIAS("LOAD_DISPATCH.MOB", IAP_EVENT_13H_04H) \ +__PMC_EV_ALIAS("LOAD_DISPATCH.ANY", IAP_EVENT_13H_07H) \ +__PMC_EV_ALIAS("ARITH.CYCLES_DIV_BUSY", IAP_EVENT_14H_01H) \ +__PMC_EV_ALIAS("ARITH.MUL", IAP_EVENT_14H_02H) \ +__PMC_EV_ALIAS("INST_QUEUE_WRITES", IAP_EVENT_17H_01H) \ +__PMC_EV_ALIAS("INST_DECODED.DEC0", IAP_EVENT_18H_01H) \ +__PMC_EV_ALIAS("TWO_UOP_INSTS_DECODED", IAP_EVENT_19H_01H) \ +__PMC_EV_ALIAS("HW_INT.RCV", IAP_EVENT_1DH_01H) \ +__PMC_EV_ALIAS("HW_INT.CYCLES_MASKED", IAP_EVENT_1DH_02H) \ +__PMC_EV_ALIAS("HW_INT.CYCLES_PENDING_AND_MASKED", IAP_EVENT_1DH_04H) \ +__PMC_EV_ALIAS("INST_QUEUE_WRITE_CYCLES", IAP_EVENT_1EH_01H) \ +__PMC_EV_ALIAS("L2_RQSTS.LD_HIT", IAP_EVENT_24H_01H) \ +__PMC_EV_ALIAS("L2_RQSTS.LD_MISS", IAP_EVENT_24H_02H) \ +__PMC_EV_ALIAS("L2_RQSTS.LOADS", IAP_EVENT_24H_03H) \ +__PMC_EV_ALIAS("L2_RQSTS.RFO_HIT", IAP_EVENT_24H_04H) \ +__PMC_EV_ALIAS("L2_RQSTS.RFO_MISS", IAP_EVENT_24H_08H) \ +__PMC_EV_ALIAS("L2_RQSTS.RFOS", IAP_EVENT_24H_0CH) \ +__PMC_EV_ALIAS("L2_RQSTS.IFETCH_HIT", IAP_EVENT_24H_10H) \ +__PMC_EV_ALIAS("L2_RQSTS.IFETCH_MISS", IAP_EVENT_24H_20H) \ +__PMC_EV_ALIAS("L2_RQSTS.IFETCHES", IAP_EVENT_24H_30H) \ +__PMC_EV_ALIAS("L2_RQSTS.PREFETCH_HIT", IAP_EVENT_24H_40H) \ +__PMC_EV_ALIAS("L2_RQSTS.PREFETCH_MISS", IAP_EVENT_24H_80H) \ +__PMC_EV_ALIAS("L2_RQSTS.PREFETCHES", IAP_EVENT_24H_C0H) \ +__PMC_EV_ALIAS("L2_RQSTS.MISS", IAP_EVENT_24H_AAH) \ +__PMC_EV_ALIAS("L2_RQSTS.REFERENCES", IAP_EVENT_24H_FFH) \ +__PMC_EV_ALIAS("L2_DATA_RQSTS.DEMAND.I_STATE", IAP_EVENT_26H_01H) \ +__PMC_EV_ALIAS("L2_DATA_RQSTS.DEMAND.S_STATE", IAP_EVENT_26H_02H) \ +__PMC_EV_ALIAS("L2_DATA_RQSTS.DEMAND.E_STATE", IAP_EVENT_26H_04H) \ +__PMC_EV_ALIAS("L2_DATA_RQSTS.DEMAND.M_STATE", IAP_EVENT_26H_08H) \ +__PMC_EV_ALIAS("L2_DATA_RQSTS.DEMAND.MESI", IAP_EVENT_26H_0FH) \ +__PMC_EV_ALIAS("L2_DATA_RQSTS.PREFETCH.I_STATE", IAP_EVENT_26H_10H) \ +__PMC_EV_ALIAS("L2_DATA_RQSTS.PREFETCH.S_STATE", IAP_EVENT_26H_20H) \ +__PMC_EV_ALIAS("L2_DATA_RQSTS.PREFETCH.E_STATE", IAP_EVENT_26H_40H) \ +__PMC_EV_ALIAS("L2_DATA_RQSTS.PREFETCH.M_STATE", IAP_EVENT_26H_80H) \ +__PMC_EV_ALIAS("L2_DATA_RQSTS.PREFETCH.MESI", IAP_EVENT_26H_F0H) \ +__PMC_EV_ALIAS("L2_DATA_RQSTS.ANY", IAP_EVENT_26H_FFH) \ +__PMC_EV_ALIAS("L2_WRITE.RFO.I_STATE", IAP_EVENT_27H_01H) \ +__PMC_EV_ALIAS("L2_WRITE.RFO.S_STATE", IAP_EVENT_27H_02H) \ +__PMC_EV_ALIAS("L2_WRITE.RFO.E_STATE", IAP_EVENT_27H_04H) \ +__PMC_EV_ALIAS("L2_WRITE.RFO.M_STATE", IAP_EVENT_27H_08H) \ +__PMC_EV_ALIAS("L2_WRITE.RFO.HIT", IAP_EVENT_27H_0EH) \ +__PMC_EV_ALIAS("L2_WRITE.RFO.MESI", IAP_EVENT_27H_0FH) \ +__PMC_EV_ALIAS("L2_WRITE.LOCK.I_STATE", IAP_EVENT_27H_10H) \ +__PMC_EV_ALIAS("L2_WRITE.LOCK.S_STATE", IAP_EVENT_27H_20H) \ +__PMC_EV_ALIAS("L2_WRITE.LOCK.E_STATE", IAP_EVENT_27H_40H) \ +__PMC_EV_ALIAS("L2_WRITE.LOCK.M_STATE", IAP_EVENT_27H_80H) \ +__PMC_EV_ALIAS("L2_WRITE.LOCK.HIT", IAP_EVENT_27H_E0H) \ +__PMC_EV_ALIAS("L2_WRITE.LOCK.MESI", IAP_EVENT_27H_F0H) \ +__PMC_EV_ALIAS("L1D_WB_L2.I_STATE", IAP_EVENT_28H_01H) \ +__PMC_EV_ALIAS("L1D_WB_L2.S_STATE", IAP_EVENT_28H_02H) \ +__PMC_EV_ALIAS("L1D_WB_L2.E_STATE", IAP_EVENT_28H_04H) \ +__PMC_EV_ALIAS("L1D_WB_L2.M_STATE", IAP_EVENT_28H_08H) \ +__PMC_EV_ALIAS("L1D_WB_L2.MESI", IAP_EVENT_28H_0FH) \ +__PMC_EV_ALIAS("LONGEST_LAT_CACHE.REFERENCE", IAP_EVENT_2EH_4FH) \ +__PMC_EV_ALIAS("LONGEST_LAT_CACHE.MISS", IAP_EVENT_2EH_41H) \ +__PMC_EV_ALIAS("CPU_CLK_UNHALTED.THREAD_P", IAP_EVENT_3CH_00H) \ +__PMC_EV_ALIAS("CPU_CLK_UNHALTED.REF_P", IAP_EVENT_3CH_01H) \ +__PMC_EV_ALIAS("UOPS_DECODED.DEC0", IAP_EVENT_3DH_01H) \ +__PMC_EV_ALIAS("L1D_CACHE_LD.I_STATE", IAP_EVENT_40H_01H) \ +__PMC_EV_ALIAS("L1D_CACHE_LD.S_STATE", IAP_EVENT_40H_02H) \ +__PMC_EV_ALIAS("L1D_CACHE_LD.E_STATE", IAP_EVENT_40H_04H) \ +__PMC_EV_ALIAS("L1D_CACHE_LD.M_STATE", IAP_EVENT_40H_08H) \ +__PMC_EV_ALIAS("L1D_CACHE_LD.MESI", IAP_EVENT_40H_0FH) \ +__PMC_EV_ALIAS("L1D_CACHE_ST.I_STATE", IAP_EVENT_41H_01H) \ +__PMC_EV_ALIAS("L1D_CACHE_ST.S_STATE", IAP_EVENT_41H_02H) \ +__PMC_EV_ALIAS("L1D_CACHE_ST.E_STATE", IAP_EVENT_41H_04H) \ +__PMC_EV_ALIAS("L1D_CACHE_ST.M_STATE", IAP_EVENT_41H_08H) \ +__PMC_EV_ALIAS("L1D_CACHE_ST.MESI", IAP_EVENT_41H_0FH) \ +__PMC_EV_ALIAS("L1D_CACHE_LOCK.HIT", IAP_EVENT_42H_01H) \ +__PMC_EV_ALIAS("L1D_CACHE_LOCK.S_STATE", IAP_EVENT_42H_02H) \ +__PMC_EV_ALIAS("L1D_CACHE_LOCK.E_STATE", IAP_EVENT_42H_04H) \ +__PMC_EV_ALIAS("L1D_CACHE_LOCK.M_STATE", IAP_EVENT_42H_08H) \ +__PMC_EV_ALIAS("L1D_ALL_REF.ANY", IAP_EVENT_43H_01H) \ +__PMC_EV_ALIAS("L1D_ALL_REF.CACHEABLE", IAP_EVENT_43H_02H) \ +__PMC_EV_ALIAS("L1D_PEND_MISS.LOAD_BUFFERS_FULL", IAP_EVENT_48H_02H) \ +__PMC_EV_ALIAS("DTLB_MISSES.ANY", IAP_EVENT_49H_01H) \ +__PMC_EV_ALIAS("DTLB_MISSES.WALK_COMPLETED", IAP_EVENT_49H_02H) \ +__PMC_EV_ALIAS("DTLB_MISSES.STLB_HIT", IAP_EVENT_49H_10H) \ +__PMC_EV_ALIAS("DTLB_MISSES.PDE_MISS", IAP_EVENT_49H_20H) \ +__PMC_EV_ALIAS("DTLB_MISSES.PDP_MISS", IAP_EVENT_49H_40H) \ +__PMC_EV_ALIAS("DTLB_MISSES.LARGE_WALK_COMPLETED", IAP_EVENT_49H_80H) \ +__PMC_EV_ALIAS("SSE_MEM_EXEC.NTA", IAP_EVENT_4BH_01H) \ +__PMC_EV_ALIAS("SSE_MEM_EXEC.STREAMING_STORES", IAP_EVENT_4BH_08H) \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 07:40:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 675A6106568A; Tue, 27 Jan 2009 07:40:17 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A0E78FC08; Tue, 27 Jan 2009 07:40:17 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0R7eH6x077861; Tue, 27 Jan 2009 07:40:17 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0R7eHY7077859; Tue, 27 Jan 2009 07:40:17 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901270740.n0R7eHY7077859@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 27 Jan 2009 07:40:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187762 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 07:40:18 -0000 Author: luigi Date: Tue Jan 27 07:40:16 2009 New Revision: 187762 URL: http://svn.freebsd.org/changeset/base/187762 Log: remove a couple of rarely used #define; change PRINT_UINT from a macro to a function (renaming is postponed to reduce clutter) Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Tue Jan 27 07:29:37 2009 (r187761) +++ head/sbin/ipfw/ipfw2.c Tue Jan 27 07:40:16 2009 (r187762) @@ -77,7 +77,6 @@ int comment_only, /* only print action and comment */ verbose; -#define IP_MASK_ALL 0xffffffff /* * the following macro returns an error message if we run out of * arguments. @@ -113,14 +112,16 @@ int } \ } while (0) -#define PRINT_UINT_ARG(str, arg) do { \ - if (str != NULL) \ - printf("%s",str); \ - if (arg == IP_FW_TABLEARG) \ - printf("tablearg"); \ - else \ - printf("%u", (uint32_t)arg); \ -} while (0) +static void +PRINT_UINT_ARG(const char *str, uint32_t arg) +{ + if (str != NULL) + printf("%s",str); + if (arg == IP_FW_TABLEARG) + printf("tablearg"); + else + printf("%u", arg); +} /* * _s_x is a structure that stores a string <-> token pairs, used in @@ -501,8 +502,6 @@ struct _s_x rule_options[] = { { NULL, 0 } /* terminator */ }; -#define TABLEARG "tablearg" - static __inline uint64_t align_uint64(uint64_t *pll) { uint64_t ret; @@ -2958,7 +2957,7 @@ fill_ip(ipfw_insn_ip *cmd, char *av) return; } /* A single IP can be stored in an optimized format */ - if (d[1] == IP_MASK_ALL && av == NULL && len == 0) { + if (d[1] == ~0 && av == NULL && len == 0) { cmd->o.len |= F_INSN_SIZE(ipfw_insn_u32); return; } @@ -4916,7 +4915,7 @@ chkarg: if (action->arg1 <= 0 || action->arg1 >= IP_FW_TABLEARG) errx(EX_DATAERR, "illegal argument for %s", *(av - 1)); - } else if (_substrcmp(*av, TABLEARG) == 0) { + } else if (_substrcmp(*av, "tablearg") == 0) { action->arg1 = IP_FW_TABLEARG; } else if (i == TOK_DIVERT || i == TOK_TEE) { struct servent *s; From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 09:04:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40DE61065674; Tue, 27 Jan 2009 09:04:30 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 157A88FC18; Tue, 27 Jan 2009 09:04:30 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0R94TdB079433; Tue, 27 Jan 2009 09:04:29 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0R94T4V079432; Tue, 27 Jan 2009 09:04:29 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901270904.n0R94T4V079432@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 27 Jan 2009 09:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187763 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 09:04:30 -0000 Author: luigi Date: Tue Jan 27 09:04:29 2009 New Revision: 187763 URL: http://svn.freebsd.org/changeset/base/187763 Log: I believe this is safe to build with WARNS=2 now Modified: head/sbin/ipfw/Makefile Modified: head/sbin/ipfw/Makefile ============================================================================== --- head/sbin/ipfw/Makefile Tue Jan 27 07:40:16 2009 (r187762) +++ head/sbin/ipfw/Makefile Tue Jan 27 09:04:29 2009 (r187763) @@ -2,7 +2,7 @@ PROG= ipfw SRCS= ipfw2.c -WARNS?= 0 +WARNS?= 2 MAN= ipfw.8 .include From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 09:06:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07A211065675; Tue, 27 Jan 2009 09:06:26 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8ED88FC1F; Tue, 27 Jan 2009 09:06:25 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0R96PDC079508; Tue, 27 Jan 2009 09:06:25 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0R96PRk079506; Tue, 27 Jan 2009 09:06:25 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901270906.n0R96PRk079506@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 27 Jan 2009 09:06:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187764 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 09:06:26 -0000 Author: luigi Date: Tue Jan 27 09:06:25 2009 New Revision: 187764 URL: http://svn.freebsd.org/changeset/base/187764 Log: put all options in a single struct, and document them. This will allow us to easily restore the original values when processing commands from a file (where each individual line can have its own options). Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Tue Jan 27 09:04:29 2009 (r187763) +++ head/sbin/ipfw/ipfw2.c Tue Jan 27 09:06:25 2009 (r187764) @@ -59,23 +59,43 @@ #include #include -int - do_value_as_ip, /* show table value as IP */ - do_resolv, /* Would try to resolve all */ - do_time, /* Show time stamps */ - do_quiet, /* Be quiet in add and flush */ - do_pipe, /* this cmd refers to a pipe */ - do_nat, /* Nat configuration. */ - do_sort, /* field to sort results (0 = no) */ - do_dynamic, /* display dynamic rules */ - do_expired, /* display expired dynamic rules */ - do_compact, /* show rules in compact mode */ - do_force, /* do not ask for confirmation */ - use_set, /* work with specified set number */ - show_sets, /* display rule sets */ - test_only, /* only check syntax */ - comment_only, /* only print action and comment */ - verbose; +/* + * Options that can be set on the command line. + * When reading commands from a file, a subset of the options can also + * be applied globally by specifying them before the file name. + * After that, each line can contain its own option that changes + * the global value. + * XXX The context is not restored after each line. + */ + +struct cmdline_opts { + /* boolean options: */ + int do_value_as_ip; /* show table value as IP */ + int do_resolv; /* try to resolve all ip to names */ + int do_time; /* Show time stamps */ + int do_quiet; /* Be quiet in add and flush */ + int do_pipe; /* this cmd refers to a pipe */ + int do_nat; /* this cmd refers to a nat config */ + int do_dynamic; /* display dynamic rules */ + int do_expired; /* display expired dynamic rules */ + int do_compact; /* show rules in compact mode */ + int do_force; /* do not ask for confirmation */ + int show_sets; /* display the set each rule belongs to */ + int test_only; /* only check syntax */ + int comment_only; /* only print action and comment */ + int verbose; /* be verbose on some commands */ + + /* The options below can have multiple values. */ + + int do_sort; /* field to sort results (0 = no) */ + /* valid fields are 1 and above */ + + int use_set; /* work with specified set number */ + /* 0 means all sets, otherwise apply to set use_set - 1 */ + +}; + +struct cmdline_opts co; /* * the following macro returns an error message if we run out of @@ -539,7 +559,7 @@ do_cmd(int optname, void *optval, uintpt static int s = -1; /* the socket */ int i; - if (test_only) + if (co.test_only) return 0; if (s == -1) @@ -648,13 +668,13 @@ print_port(int proto, uint16_t port) if (proto == IPPROTO_ETHERTYPE) { char const *s; - if (do_resolv && (s = match_value(ether_types, port)) ) + if (co.do_resolv && (s = match_value(ether_types, port)) ) printf("%s", s); else printf("0x%04x", port); } else { struct servent *se = NULL; - if (do_resolv) { + if (co.do_resolv) { struct protoent *pe = getprotobynumber(proto); se = getservbyport(htons(port), pe ? pe->p_name : NULL); @@ -1121,7 +1141,7 @@ print_ip(ipfw_insn_ip *cmd, char const * int mb = /* mask length */ (cmd->o.opcode == O_IP_SRC || cmd->o.opcode == O_IP_DST) ? 32 : contigmask((uint8_t *)&(a[1]), 32); - if (mb == 32 && do_resolv) + if (mb == 32 && co.do_resolv) he = gethostbyaddr((char *)&(a[0]), sizeof(u_long), AF_INET); if (he != NULL) /* resolved to name */ printf("%s", he->h_name); @@ -1233,7 +1253,7 @@ print_ip6(ipfw_insn_ip6 *cmd, char const (cmd->o.opcode == O_IP6_SRC || cmd->o.opcode == O_IP6_DST) ? 128 : contigmask((uint8_t *)&(a[1]), 128); - if (mb == 128 && do_resolv) + if (mb == 128 && co.do_resolv) he = gethostbyaddr((char *)a, sizeof(*a), AF_INET6); if (he != NULL) /* resolved to name */ printf("%s", he->h_name); @@ -1444,7 +1464,7 @@ print_ext6hdr( ipfw_insn *cmd ) static void show_prerequisites(int *flags, int want, int cmd __unused) { - if (comment_only) + if (co.comment_only) return; if ( (*flags & HAVE_IP) == HAVE_IP) *flags |= HAVE_OPTIONS; @@ -1483,7 +1503,7 @@ show_ipfw(struct ip_fw *rule, int pcwidt bcopy(&rule->next_rule, &set_disable, sizeof(set_disable)); if (set_disable & (1 << rule->set)) { /* disabled */ - if (!show_sets) + if (!co.show_sets) return; else printf("# DISABLED "); @@ -1494,9 +1514,9 @@ show_ipfw(struct ip_fw *rule, int pcwidt printf("%*llu %*llu ", pcwidth, align_uint64(&rule->pcnt), bcwidth, align_uint64(&rule->bcnt)); - if (do_time == 2) + if (co.do_time == 2) printf("%10u ", rule->timestamp); - else if (do_time == 1) { + else if (co.do_time == 1) { char timestr[30]; time_t t = (time_t)0; @@ -1516,7 +1536,7 @@ show_ipfw(struct ip_fw *rule, int pcwidt } } - if (show_sets) + if (co.show_sets) printf("set %d ", rule->set); /* @@ -1677,14 +1697,14 @@ show_ipfw(struct ip_fw *rule, int pcwidt } } if (rule->_pad & 1) { /* empty rules before options */ - if (!do_compact) { + if (!co.do_compact) { show_prerequisites(&flags, HAVE_PROTO, 0); printf(" from any to any"); } flags |= HAVE_IP | HAVE_OPTIONS; } - if (comment_only) + if (co.comment_only) comment = "..."; for (l = rule->act_ofs, cmd = rule->cmd ; @@ -1692,7 +1712,7 @@ show_ipfw(struct ip_fw *rule, int pcwidt /* useful alias */ ipfw_insn_u32 *cmd32 = (ipfw_insn_u32 *)cmd; - if (comment_only) { + if (co.comment_only) { if (cmd->opcode != O_NOP) continue; printf(" // %s\n", (char *)(cmd + 1)); @@ -2079,7 +2099,7 @@ show_dyn_ipfw(ipfw_dyn_rule *d, int pcwi uint16_t rulenum; char buf[INET6_ADDRSTRLEN]; - if (!do_expired) { + if (!co.do_expired) { if (!d->expire && !(d->dyn_type == O_LIMIT_PARENT)) return; } @@ -2126,8 +2146,8 @@ show_dyn_ipfw(ipfw_dyn_rule *d, int pcwi static int sort_q(const void *pa, const void *pb) { - int rev = (do_sort < 0); - int field = rev ? -do_sort : do_sort; + int rev = (co.do_sort < 0); + int field = rev ? -co.do_sort : co.do_sort; long long res = 0; const struct dn_flow_queue *a = pa; const struct dn_flow_queue *b = pb; @@ -2166,7 +2186,7 @@ list_queues(struct dn_flow_set *fs, stru if (fs->rq_elements == 0) return; - if (do_sort != 0) + if (co.do_sort != 0) heapsort(q, fs->rq_elements, sizeof *q, sort_q); /* Print IPv4 flows */ @@ -2209,7 +2229,7 @@ list_queues(struct dn_flow_set *fs, stru printf("%4qu %8qu %2u %4u %3u\n", q[l].tot_pkts, q[l].tot_bytes, q[l].len, q[l].len_bytes, q[l].drops); - if (verbose) + if (co.verbose) printf(" S %20qd F %20qd\n", q[l].S, q[l].F); } @@ -2254,7 +2274,7 @@ list_queues(struct dn_flow_set *fs, stru printf(" %4qu %8qu %2u %4u %3u\n", q[l].tot_pkts, q[l].tot_bytes, q[l].len, q[l].len_bytes, q[l].drops); - if (verbose) + if (co.verbose) printf(" S %20qd F %20qd\n", q[l].S, q[l].F); } } @@ -2323,7 +2343,7 @@ list_pipes(void *data, uint nbytes, int next = (char *)p + l; nbytes -= l; - if ((rulenum != 0 && rulenum != p->pipe_nr) || do_pipe == 2) + if ((rulenum != 0 && rulenum != p->pipe_nr) || co.do_pipe == 2) continue; /* @@ -2343,7 +2363,7 @@ list_pipes(void *data, uint nbytes, int sprintf(prefix, "%05d: %s %4d ms ", p->pipe_nr, buf, p->delay); print_flowset_parms(&(p->fs), prefix); - if (verbose) + if (co.verbose) printf(" V %20qd\n", p->V >> MY_M); q = (struct dn_flow_queue *)(p+1); @@ -2358,8 +2378,8 @@ list_pipes(void *data, uint nbytes, int next = (char *)fs + l; nbytes -= l; - if (rulenum != 0 && ((rulenum != fs->fs_nr && do_pipe == 2) || - (rulenum != fs->parent_nr && do_pipe == 1))) { + if (rulenum != 0 && ((rulenum != fs->fs_nr && co.do_pipe == 2) || + (rulenum != fs->parent_nr && co.do_pipe == 1))) { continue; } @@ -2526,12 +2546,12 @@ list(int ac, char *av[], int show_counte int seen = 0; uint8_t set; - const int ocmd = do_pipe ? IP_DUMMYNET_GET : IP_FW_GET; + const int ocmd = co.do_pipe ? IP_DUMMYNET_GET : IP_FW_GET; int nalloc = 1024; /* start somewhere... */ last = 0; - if (test_only) { + if (co.test_only) { fprintf(stderr, "Testing only, list disabled\n"); return; } @@ -2548,10 +2568,10 @@ list(int ac, char *av[], int show_counte data = safe_realloc(data, nbytes); if (do_cmd(ocmd, data, (uintptr_t)&nbytes) < 0) err(EX_OSERR, "getsockopt(IP_%s_GET)", - do_pipe ? "DUMMYNET" : "FW"); + co.do_pipe ? "DUMMYNET" : "FW"); } - if (do_pipe) { + if (co.do_pipe) { list_pipes(data, nbytes, ac, av); goto done; } @@ -2579,7 +2599,7 @@ list(int ac, char *av[], int show_counte if (show_counters) { for (n = 0, r = data; n < nstat; n++, r = NEXT(r)) { /* skip rules from another set */ - if (use_set && r->set != use_set - 1) + if (co.use_set && r->set != co.use_set - 1) continue; /* packet counter */ @@ -2595,13 +2615,13 @@ list(int ac, char *av[], int show_counte bcwidth = width; } } - if (do_dynamic && ndyn) { + if (co.do_dynamic && ndyn) { for (n = 0, d = dynrules; n < ndyn; n++, d++) { - if (use_set) { + if (co.use_set) { /* skip rules from another set */ bcopy((char *)&d->rule + sizeof(uint16_t), &set, sizeof(uint8_t)); - if (set != use_set - 1) + if (set != co.use_set - 1) continue; } width = snprintf(NULL, 0, "%llu", @@ -2618,18 +2638,18 @@ list(int ac, char *av[], int show_counte /* if no rule numbers were specified, list all rules */ if (ac == 0) { for (n = 0, r = data; n < nstat; n++, r = NEXT(r)) { - if (use_set && r->set != use_set - 1) + if (co.use_set && r->set != co.use_set - 1) continue; show_ipfw(r, pcwidth, bcwidth); } - if (do_dynamic && ndyn) { + if (co.do_dynamic && ndyn) { printf("## Dynamic rules (%d):\n", ndyn); for (n = 0, d = dynrules; n < ndyn; n++, d++) { - if (use_set) { + if (co.use_set) { bcopy((char *)&d->rule + sizeof(uint16_t), &set, sizeof(uint8_t)); - if (set != use_set - 1) + if (set != co.use_set - 1) continue; } show_dyn_ipfw(d, pcwidth, bcwidth); @@ -2653,7 +2673,7 @@ list(int ac, char *av[], int show_counte for (n = seen = 0, r = data; n < nstat; n++, r = NEXT(r) ) { if (r->rulenum > last) break; - if (use_set && r->set != use_set - 1) + if (co.use_set && r->set != co.use_set - 1) continue; if (r->rulenum >= rnum && r->rulenum <= last) { show_ipfw(r, pcwidth, bcwidth); @@ -2668,7 +2688,7 @@ list(int ac, char *av[], int show_counte } } - if (do_dynamic && ndyn) { + if (co.do_dynamic && ndyn) { printf("## Dynamic rules:\n"); for (lac = ac, lav = av; lac != 0; lac--) { last = rnum = strtoul(*lav++, &endptr, 10); @@ -2683,10 +2703,10 @@ list(int ac, char *av[], int show_counte bcopy(&d->rule, &rulenum, sizeof(rulenum)); if (rulenum > rnum) break; - if (use_set) { + if (co.use_set) { bcopy((char *)&d->rule + sizeof(uint16_t), &set, sizeof(uint8_t)); - if (set != use_set - 1) + if (set != co.use_set - 1) continue; } if (r->rulenum >= rnum && r->rulenum <= last) @@ -3247,7 +3267,7 @@ delete(int ac, char *av[]) /* Do not allow using the following syntax: * ipfw set N delete set M */ - if (use_set) + if (co.use_set) errx(EX_DATAERR, "invalid syntax"); do_set = 1; /* delete set */ ac--; av++; @@ -3256,14 +3276,14 @@ delete(int ac, char *av[]) /* Rule number */ while (ac && isdigit(**av)) { i = atoi(*av); av++; ac--; - if (do_nat) { + if (co.do_nat) { exitval = do_cmd(IP_FW_NAT_DEL, &i, sizeof i); if (exitval) { exitval = EX_UNAVAILABLE; warn("rule %u not available", i); } - } else if (do_pipe) { - if (do_pipe == 1) + } else if (co.do_pipe) { + if (co.do_pipe == 1) p.pipe_nr = i; else p.fs.fs_nr = i; @@ -3271,12 +3291,12 @@ delete(int ac, char *av[]) if (i) { exitval = 1; warn("rule %u: setsockopt(IP_DUMMYNET_DEL)", - do_pipe == 1 ? p.pipe_nr : p.fs.fs_nr); + co.do_pipe == 1 ? p.pipe_nr : p.fs.fs_nr); } } else { - if (use_set) + if (co.use_set) rulenum = (i & 0xffff) | (5 << 24) | - ((use_set - 1) << 16); + ((co.use_set - 1) << 16); else rulenum = (i & 0xffff) | (do_set << 24); i = do_cmd(IP_FW_DEL, &rulenum, sizeof rulenum); @@ -3360,7 +3380,7 @@ set_addr_dynamic(const char *ifn, struct ifm = (struct if_msghdr *)next; next += ifm->ifm_msglen; if (ifm->ifm_version != RTM_VERSION) { - if (verbose) + if (co.verbose) warnx("routing message version %d " "not understood", ifm->ifm_version); continue; @@ -3385,7 +3405,7 @@ set_addr_dynamic(const char *ifn, struct ifam = (struct ifa_msghdr *)next; next += ifam->ifam_msglen; if (ifam->ifam_version != RTM_VERSION) { - if (verbose) + if (co.verbose) warnx("routing message version %d " "not understood", ifam->ifam_version); continue; @@ -4073,7 +4093,7 @@ config_nat(int ac, char **av) if (i) err(1, "setsockopt(%s)", "IP_FW_NAT_CFG"); - if (!do_quiet) { + if (!co.do_quiet) { /* After every modification, we show the resultant rule. */ int _ac = 3; char *_av[] = {"show", "config", id}; @@ -4095,7 +4115,7 @@ config_pipe(int ac, char **av) /* Pipe number */ if (ac && isdigit(**av)) { i = atoi(*av); av++; ac--; - if (do_pipe == 1) + if (co.do_pipe == 1) p.pipe_nr = i; else p.fs.fs_nr = i; @@ -4291,7 +4311,7 @@ end_mask: case TOK_BW: NEED1("bw needs bandwidth or interface\n"); - if (do_pipe != 1) + if (co.do_pipe != 1) errx(EX_DATAERR, "bandwidth only valid for pipes"); /* * set clocking interface or bandwidth value @@ -4323,7 +4343,7 @@ end_mask: break; case TOK_DELAY: - if (do_pipe != 1) + if (co.do_pipe != 1) errx(EX_DATAERR, "delay only valid for pipes"); NEED1("delay needs argument 0..10000ms\n"); p.delay = strtoul(av[0], NULL, 0); @@ -4331,7 +4351,7 @@ end_mask: break; case TOK_WEIGHT: - if (do_pipe == 1) + if (co.do_pipe == 1) errx(EX_DATAERR,"weight only valid for queues"); NEED1("weight needs argument 0..100\n"); p.fs.weight = strtoul(av[0], &end, 0); @@ -4339,7 +4359,7 @@ end_mask: break; case TOK_PIPE: - if (do_pipe == 1) + if (co.do_pipe == 1) errx(EX_DATAERR,"pipe only valid for queues"); NEED1("pipe needs pipe_number\n"); p.fs.parent_nr = strtoul(av[0], &end, 0); @@ -4350,12 +4370,12 @@ end_mask: errx(EX_DATAERR, "unrecognised option ``%s''", av[-1]); } } - if (do_pipe == 1) { + if (co.do_pipe == 1) { if (p.pipe_nr == 0) errx(EX_DATAERR, "pipe_nr must be > 0"); if (p.delay > 10000) errx(EX_DATAERR, "delay must be < 10000"); - } else { /* do_pipe == 2, queue */ + } else { /* co.do_pipe == 2, queue */ if (p.fs.parent_nr == 0) errx(EX_DATAERR, "pipe must be > 0"); if (p.fs.weight >100) @@ -5767,7 +5787,7 @@ done: i = (char *)dst - (char *)rule; if (do_cmd(IP_FW_ADD, rule, (uintptr_t)&i) == -1) err(EX_UNAVAILABLE, "getsockopt(%s)", "IP_FW_ADD"); - if (!do_quiet) + if (!co.do_quiet) show_ipfw(rule, 0, 0); } @@ -5785,7 +5805,7 @@ zero(int ac, char *av[], int optname /* /* clear all entries */ if (do_cmd(optname, NULL, 0) < 0) err(EX_UNAVAILABLE, "setsockopt(IP_FW_%s)", name); - if (!do_quiet) + if (!co.do_quiet) printf("%s.\n", optname == IP_FW_ZERO ? "Accounting cleared":"Logging counts reset"); @@ -5800,15 +5820,15 @@ zero(int ac, char *av[], int optname /* errx(EX_DATAERR, "invalid rule number %s\n", *av); saved_arg = arg; - if (use_set) - arg |= (1 << 24) | ((use_set - 1) << 16); + if (co.use_set) + arg |= (1 << 24) | ((co.use_set - 1) << 16); av++; ac--; if (do_cmd(optname, &arg, sizeof(arg))) { warn("rule %u: setsockopt(IP_FW_%s)", saved_arg, name); failed = EX_UNAVAILABLE; - } else if (!do_quiet) + } else if (!co.do_quiet) printf("Entry %d %s.\n", saved_arg, optname == IP_FW_ZERO ? "cleared" : "logging count reset"); @@ -5823,9 +5843,9 @@ zero(int ac, char *av[], int optname /* static void flush(int force) { - int cmd = do_pipe ? IP_DUMMYNET_FLUSH : IP_FW_FLUSH; + int cmd = co.do_pipe ? IP_DUMMYNET_FLUSH : IP_FW_FLUSH; - if (!force && !do_quiet) { /* need to ask user */ + if (!force && !co.do_quiet) { /* need to ask user */ int c; printf("Are you sure? [yn] "); @@ -5841,15 +5861,15 @@ flush(int force) return; } /* `ipfw set N flush` - is the same that `ipfw delete set N` */ - if (use_set) { - uint32_t arg = ((use_set - 1) & 0xffff) | (1 << 24); + if (co.use_set) { + uint32_t arg = ((co.use_set - 1) & 0xffff) | (1 << 24); if (do_cmd(IP_FW_DEL, &arg, sizeof(arg)) < 0) err(EX_UNAVAILABLE, "setsockopt(IP_FW_DEL)"); } else if (do_cmd(cmd, NULL, 0) < 0) err(EX_UNAVAILABLE, "setsockopt(IP_%s_FLUSH)", - do_pipe ? "DUMMYNET" : "FW"); - if (!do_quiet) - printf("Flushed all %s.\n", do_pipe ? "pipes" : "rules"); + co.do_pipe ? "DUMMYNET" : "FW"); + if (!co.do_quiet) + printf("Flushed all %s.\n", co.do_pipe ? "pipes" : "rules"); } /* @@ -5952,7 +5972,7 @@ table_handler(int ac, char *av[]) if (do_cmd(do_add ? IP_FW_TABLE_ADD : IP_FW_TABLE_DEL, &ent, sizeof(ent)) < 0) { /* If running silent, don't bomb out on these errors. */ - if (!(do_quiet && (errno == (do_add ? EEXIST : ESRCH)))) + if (!(co.do_quiet && (errno == (do_add ? EEXIST : ESRCH)))) err(EX_OSERR, "setsockopt(IP_FW_TABLE_%s)", do_add ? "ADD" : "DEL"); /* In silent mode, react to a failed add by deleting */ @@ -6006,7 +6026,7 @@ table_list(ipfw_table_entry ent, int nee for (a = 0; a < tbl->cnt; a++) { unsigned int tval; tval = tbl->ent[a].value; - if (do_value_as_ip) { + if (co.do_value_as_ip) { char tbuf[128]; strncpy(tbuf, inet_ntoa(*(struct in_addr *) &tbl->ent[a].addr), 127); @@ -6041,7 +6061,7 @@ show_nat(int ac, char **av) lrule = IPFW_DEFAULT_RULE; /* max ipfw rule number */ ac--; av++; - if (test_only) + if (co.test_only) return; /* Parse parameters. */ @@ -6199,8 +6219,8 @@ ipfw_main(int oldac, char **oldav) av[0] = strdup(oldav[0]); /* copy progname from the caller */ /* Set the force flag for non-interactive processes */ - if (!do_force) - do_force = !isatty(STDIN_FILENO); + if (!co.do_force) + co.do_force = !isatty(STDIN_FILENO); /* Save arguments for final freeing of memory. */ save_ac = ac; @@ -6214,24 +6234,24 @@ ipfw_main(int oldac, char **oldav) break; case 'b': - comment_only = 1; - do_compact = 1; + co.comment_only = 1; + co.do_compact = 1; break; case 'c': - do_compact = 1; + co.do_compact = 1; break; case 'd': - do_dynamic = 1; + co.do_dynamic = 1; break; case 'e': - do_expired = 1; + co.do_expired = 1; break; case 'f': - do_force = 1; + co.do_force = 1; break; case 'h': /* help */ @@ -6240,39 +6260,39 @@ ipfw_main(int oldac, char **oldav) break; /* NOTREACHED */ case 'i': - do_value_as_ip = 1; + co.do_value_as_ip = 1; break; case 'n': - test_only = 1; + co.test_only = 1; break; case 'N': - do_resolv = 1; + co.do_resolv = 1; break; case 'q': - do_quiet = 1; + co.do_quiet = 1; break; case 's': /* sort */ - do_sort = atoi(optarg); + co.do_sort = atoi(optarg); break; case 'S': - show_sets = 1; + co.show_sets = 1; break; case 't': - do_time = 1; + co.do_time = 1; break; case 'T': - do_time = 2; /* numeric timestamp */ + co.do_time = 2; /* numeric timestamp */ break; case 'v': /* verbose */ - verbose = 1; + co.verbose = 1; break; default: @@ -6299,25 +6319,25 @@ ipfw_main(int oldac, char **oldav) /* * Optional: pipe, queue or nat. */ - do_nat = 0; - do_pipe = 0; + co.do_nat = 0; + co.do_pipe = 0; if (!strncmp(*av, "nat", strlen(*av))) - do_nat = 1; + co.do_nat = 1; else if (!strncmp(*av, "pipe", strlen(*av))) - do_pipe = 1; + co.do_pipe = 1; else if (_substrcmp(*av, "queue") == 0) - do_pipe = 2; + co.do_pipe = 2; else if (!strncmp(*av, "set", strlen(*av))) { if (ac > 1 && isdigit(av[1][0])) { - use_set = strtonum(av[1], 0, RESVD_SET, &errstr); + co.use_set = strtonum(av[1], 0, RESVD_SET, &errstr); if (errstr) errx(EX_DATAERR, "invalid set number %s\n", av[1]); - ac -= 2; av += 2; use_set++; + ac -= 2; av += 2; co.use_set++; } } - if (do_pipe || do_nat) { + if (co.do_pipe || co.do_nat) { ac--; av++; } @@ -6328,7 +6348,7 @@ ipfw_main(int oldac, char **oldav) * but the code is easier to parse as 'nat|pipe config NN' * so we swap the two arguments. */ - if ((do_pipe || do_nat) && ac > 1 && isdigit(*av[0])) { + if ((co.do_pipe || co.do_nat) && ac > 1 && isdigit(*av[0])) { char *p = av[0]; av[0] = av[1]; @@ -6336,14 +6356,14 @@ ipfw_main(int oldac, char **oldav) } int try_next = 0; - if (use_set == 0) { + if (co.use_set == 0) { if (_substrcmp(*av, "add") == 0) add(ac, av); - else if (do_nat && _substrcmp(*av, "show") == 0) + else if (co.do_nat && _substrcmp(*av, "show") == 0) show_nat(ac, av); - else if (do_pipe && _substrcmp(*av, "config") == 0) + else if (co.do_pipe && _substrcmp(*av, "config") == 0) config_pipe(ac, av); - else if (do_nat && _substrcmp(*av, "config") == 0) + else if (co.do_nat && _substrcmp(*av, "config") == 0) config_nat(ac, av); else if (_substrcmp(*av, "set") == 0) sets_handler(ac, av); @@ -6357,11 +6377,11 @@ ipfw_main(int oldac, char **oldav) try_next = 1; } - if (use_set || try_next) { + if (co.use_set || try_next) { if (_substrcmp(*av, "delete") == 0) delete(ac, av); else if (_substrcmp(*av, "flush") == 0) - flush(do_force); + flush(co.do_force); else if (_substrcmp(*av, "zero") == 0) zero(ac, av, IP_FW_ZERO); else if (_substrcmp(*av, "resetlog") == 0) @@ -6396,19 +6416,19 @@ ipfw_readfile(int ac, char *av[]) while ((c = getopt(ac, av, "cfNnp:qS")) != -1) { switch(c) { case 'c': - do_compact = 1; + co.do_compact = 1; break; case 'f': - do_force = 1; + co.do_force = 1; break; case 'N': - do_resolv = 1; + co.do_resolv = 1; break; case 'n': - test_only = 1; + co.test_only = 1; break; case 'p': @@ -6437,11 +6457,11 @@ ipfw_readfile(int ac, char *av[]) break; case 'q': - do_quiet = 1; + co.do_quiet = 1; break; case 'S': - show_sets = 1; + co.show_sets = 1; break; default: From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 09:27:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE247106566C; Tue, 27 Jan 2009 09:27:13 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9257B8FC0A; Tue, 27 Jan 2009 09:27:13 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0R9RD8G079934; Tue, 27 Jan 2009 09:27:13 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0R9RDbY079932; Tue, 27 Jan 2009 09:27:13 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901270927.n0R9RDbY079932@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 27 Jan 2009 09:27:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187765 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 09:27:14 -0000 Author: luigi Date: Tue Jan 27 09:27:13 2009 New Revision: 187765 URL: http://svn.freebsd.org/changeset/base/187765 Log: put the usage() function inline, it was only 1 line and used once; slightly reformat the help() text; slightly correct the text for the 'extraneous filename' error message; Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Tue Jan 27 09:06:25 2009 (r187764) +++ head/sbin/ipfw/ipfw2.c Tue Jan 27 09:27:13 2009 (r187765) @@ -245,8 +245,6 @@ static struct _s_x ether_types[] = { { NULL, 0 } }; -static void show_usage(void); - enum tokens { TOK_NULL=0, @@ -2726,20 +2724,12 @@ done: } static void -show_usage(void) -{ - fprintf(stderr, "usage: ipfw [options]\n" -"do \"ipfw -h\" or see ipfw manpage for details\n" -); - exit(EX_USAGE); -} - -static void help(void) { fprintf(stderr, -"ipfw syntax summary (but please do read the ipfw(8) manpage):\n" -"ipfw [-abcdefhnNqStTv] where is one of:\n" +"ipfw syntax summary (but please do read the ipfw(8) manpage):\n\n" +"\tipfw [-abcdefhnNqStTv] \n\n" +"where is one of the following:\n\n" "add [num] [set N] [prob x] RULE-BODY\n" "{pipe|queue} N config PIPE-BODY\n" "[pipe|queue] {zero|delete|show} [N{,N}]\n" @@ -6471,10 +6461,8 @@ ipfw_readfile(int ac, char *av[]) } - if (cmd == NULL && ac != optind + 1) { - fprintf(stderr, "ac %d, optind %d\n", ac, optind); - errx(EX_USAGE, "extraneous filename arguments"); - } + if (cmd == NULL && ac != optind + 1) + errx(EX_USAGE, "extraneous filename arguments %s", av[ac-1]); if ((f = fopen(filename, "r")) == NULL) err(EX_UNAVAILABLE, "fopen: %s", filename); @@ -6554,8 +6542,11 @@ main(int ac, char *av[]) if (ac > 1 && av[ac - 1][0] == '/' && access(av[ac - 1], R_OK) == 0) ipfw_readfile(ac, av); else { - if (ipfw_main(ac, av)) - show_usage(); + if (ipfw_main(ac, av)) { + errx(EX_USAGE, + "usage: ipfw [options]\n" + "do \"ipfw -h\" or \"man ipfw\" for details"); + } } return EX_OK; } From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 09:38:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F791106564A; Tue, 27 Jan 2009 09:38:45 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DB6E8FC08; Tue, 27 Jan 2009 09:38:45 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0R9cjWx080211; Tue, 27 Jan 2009 09:38:45 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0R9cjE1080210; Tue, 27 Jan 2009 09:38:45 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200901270938.n0R9cjE1080210@svn.freebsd.org> From: Stanislav Sedov Date: Tue, 27 Jan 2009 09:38:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187766 - head/sys/dev/puc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 09:38:45 -0000 Author: stas Date: Tue Jan 27 09:38:44 2009 New Revision: 187766 URL: http://svn.freebsd.org/changeset/base/187766 Log: - Add support for Moxa Technologies CP-168EL/PCIe card. Submitted by: dmarck MFC after: 1 week Modified: head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/pucdata.c ============================================================================== --- head/sys/dev/puc/pucdata.c Tue Jan 27 09:27:13 2009 (r187765) +++ head/sys/dev/puc/pucdata.c Tue Jan 27 09:38:44 2009 (r187766) @@ -530,6 +530,12 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_8S, 0x18, 0, 8, }, + { 0x1393, 0x1682, 0xffff, 0, + "Moxa Technologies, CP-168EL/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_8S, 0x18, 0, 8, + }, + { 0x13a8, 0x0158, 0xffff, 0, "Cronyx Omega2-PCI", DEFAULT_RCLK * 8, From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 10:18:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F6A4106564A; Tue, 27 Jan 2009 10:18:56 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F07F58FC1C; Tue, 27 Jan 2009 10:18:55 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RAItSA081173; Tue, 27 Jan 2009 10:18:55 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RAItgK081169; Tue, 27 Jan 2009 10:18:55 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901271018.n0RAItgK081169@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 27 Jan 2009 10:18:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187767 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 10:18:56 -0000 Author: luigi Date: Tue Jan 27 10:18:55 2009 New Revision: 187767 URL: http://svn.freebsd.org/changeset/base/187767 Log: Start splitting the monster file in smaller blocks. In this episode: - introduce a common header with a minimal set of common definitions; - bring the main() function and options parser in main.c - rename the main functions with an ipfw_ prefix No code changes except for the introduction of a global variable, resvd_set_number, which stores the RESVD_SET value from ip_fw.h and is used to remove the dependency of main.c from ip_fw.h (and the subtree of dependencies) for just a single constant. Added: head/sbin/ipfw/ipfw2.h (contents, props changed) head/sbin/ipfw/main.c (contents, props changed) Modified: head/sbin/ipfw/Makefile head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/Makefile ============================================================================== --- head/sbin/ipfw/Makefile Tue Jan 27 09:38:44 2009 (r187766) +++ head/sbin/ipfw/Makefile Tue Jan 27 10:18:55 2009 (r187767) @@ -1,7 +1,7 @@ # $FreeBSD$ PROG= ipfw -SRCS= ipfw2.c +SRCS= ipfw2.c main.c WARNS?= 2 MAN= ipfw.8 Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Tue Jan 27 09:38:44 2009 (r187766) +++ head/sbin/ipfw/ipfw2.c Tue Jan 27 10:18:55 2009 (r187767) @@ -24,7 +24,8 @@ #include #include #include -#include + +#include "ipfw2.h" #include #include @@ -32,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -59,49 +59,9 @@ #include #include -/* - * Options that can be set on the command line. - * When reading commands from a file, a subset of the options can also - * be applied globally by specifying them before the file name. - * After that, each line can contain its own option that changes - * the global value. - * XXX The context is not restored after each line. - */ - -struct cmdline_opts { - /* boolean options: */ - int do_value_as_ip; /* show table value as IP */ - int do_resolv; /* try to resolve all ip to names */ - int do_time; /* Show time stamps */ - int do_quiet; /* Be quiet in add and flush */ - int do_pipe; /* this cmd refers to a pipe */ - int do_nat; /* this cmd refers to a nat config */ - int do_dynamic; /* display dynamic rules */ - int do_expired; /* display expired dynamic rules */ - int do_compact; /* show rules in compact mode */ - int do_force; /* do not ask for confirmation */ - int show_sets; /* display the set each rule belongs to */ - int test_only; /* only check syntax */ - int comment_only; /* only print action and comment */ - int verbose; /* be verbose on some commands */ +struct cmdline_opts co; /* global options */ - /* The options below can have multiple values. */ - - int do_sort; /* field to sort results (0 = no) */ - /* valid fields are 1 and above */ - - int use_set; /* work with specified set number */ - /* 0 means all sets, otherwise apply to set use_set - 1 */ - -}; - -struct cmdline_opts co; - -/* - * the following macro returns an error message if we run out of - * arguments. - */ -#define NEED1(msg) {if (!ac) errx(EX_USAGE, msg);} +int resvd_set_number = RESVD_SET; #define GET_UINT_ARG(arg, min, max, tok, s_x) do { \ if (!ac) \ @@ -143,19 +103,6 @@ PRINT_UINT_ARG(const char *str, uint32_t printf("%u", arg); } -/* - * _s_x is a structure that stores a string <-> token pairs, used in - * various places in the parser. Entries are stored in arrays, - * with an entry with s=NULL as terminator. - * The search routines are match_token() and match_value(). - * Often, an element with x=0 contains an error string. - * - */ -struct _s_x { - char const *s; - int x; -}; - static struct _s_x f_tcpflags[] = { { "syn", TH_SYN }, { "fin", TH_FIN }, @@ -528,7 +475,7 @@ align_uint64(uint64_t *pll) { return ret; } -static void * +void * safe_calloc(size_t number, size_t size) { void *ret = calloc(number, size); @@ -538,7 +485,7 @@ safe_calloc(size_t number, size_t size) return ret; } -static void * +void * safe_realloc(void *ptr, size_t size) { void *ret = realloc(ptr, size); @@ -615,7 +562,7 @@ match_value(struct _s_x *p, int value) * This function will be removed in the future through the usual * deprecation process. */ -static int +int _substrcmp(const char *str1, const char* str2) { @@ -2396,8 +2343,8 @@ list_pipes(void *data, uint nbytes, int * ipfw set move X to Y * ipfw set move rule X to Y */ -static void -sets_handler(int ac, char *av[]) +void +ipfw_sets_handler(int ac, char *av[]) { uint32_t set_disable, masks[2]; int i, nbytes; @@ -2496,8 +2443,8 @@ sets_handler(int ac, char *av[]) errx(EX_USAGE, "invalid set command %s\n", *av); } -static void -sysctl_handler(int ac, char *av[], int which) +void +ipfw_sysctl_handler(int ac, char *av[], int which) { ac--; av++; @@ -2526,8 +2473,8 @@ sysctl_handler(int ac, char *av[], int w } } -static void -list(int ac, char *av[], int show_counters) +void +ipfw_list(int ac, char *av[], int show_counters) { struct ip_fw *r; ipfw_dyn_rule *dynrules, *d; @@ -2723,52 +2670,6 @@ done: #undef NEXT } -static void -help(void) -{ - fprintf(stderr, -"ipfw syntax summary (but please do read the ipfw(8) manpage):\n\n" -"\tipfw [-abcdefhnNqStTv] \n\n" -"where is one of the following:\n\n" -"add [num] [set N] [prob x] RULE-BODY\n" -"{pipe|queue} N config PIPE-BODY\n" -"[pipe|queue] {zero|delete|show} [N{,N}]\n" -"nat N config {ip IPADDR|if IFNAME|log|deny_in|same_ports|unreg_only|reset|\n" -" reverse|proxy_only|redirect_addr linkspec|\n" -" redirect_port linkspec|redirect_proto linkspec}\n" -"set [disable N... enable N...] | move [rule] X to Y | swap X Y | show\n" -"set N {show|list|zero|resetlog|delete} [N{,N}] | flush\n" -"table N {add ip[/bits] [value] | delete ip[/bits] | flush | list}\n" -"table all {flush | list}\n" -"\n" -"RULE-BODY: check-state [PARAMS] | ACTION [PARAMS] ADDR [OPTION_LIST]\n" -"ACTION: check-state | allow | count | deny | unreach{,6} CODE |\n" -" skipto N | {divert|tee} PORT | forward ADDR |\n" -" pipe N | queue N | nat N | setfib FIB\n" -"PARAMS: [log [logamount LOGLIMIT]] [altq QUEUE_NAME]\n" -"ADDR: [ MAC dst src ether_type ] \n" -" [ ip from IPADDR [ PORT ] to IPADDR [ PORTLIST ] ]\n" -" [ ipv6|ip6 from IP6ADDR [ PORT ] to IP6ADDR [ PORTLIST ] ]\n" -"IPADDR: [not] { any | me | ip/bits{x,y,z} | table(t[,v]) | IPLIST }\n" -"IP6ADDR: [not] { any | me | me6 | ip6/bits | IP6LIST }\n" -"IP6LIST: { ip6 | ip6/bits }[,IP6LIST]\n" -"IPLIST: { ip | ip/bits | ip:mask }[,IPLIST]\n" -"OPTION_LIST: OPTION [OPTION_LIST]\n" -"OPTION: bridged | diverted | diverted-loopback | diverted-output |\n" -" {dst-ip|src-ip} IPADDR | {dst-ip6|src-ip6|dst-ipv6|src-ipv6} IP6ADDR |\n" -" {dst-port|src-port} LIST |\n" -" estab | frag | {gid|uid} N | icmptypes LIST | in | out | ipid LIST |\n" -" iplen LIST | ipoptions SPEC | ipprecedence | ipsec | iptos SPEC |\n" -" ipttl LIST | ipversion VER | keep-state | layer2 | limit ... |\n" -" icmp6types LIST | ext6hdr LIST | flow-id N[,N] | fib FIB |\n" -" mac ... | mac-type LIST | proto LIST | {recv|xmit|via} {IF|IPADDR} |\n" -" setup | {tcpack|tcpseq|tcpwin} NN | tcpflags SPEC | tcpoptions SPEC |\n" -" tcpdatalen LIST | verrevpath | versrcreach | antispoof\n" -); -exit(0); -} - - static int lookup_host (char *host, struct in_addr *ipaddr) { @@ -3240,8 +3141,8 @@ fill_flags(ipfw_insn *cmd, enum ipfw_opc } -static void -delete(int ac, char *av[]) +void +ipfw_delete(int ac, char *av[]) { uint32_t rulenum; struct dn_pipe p; @@ -3871,9 +3772,6 @@ nospace: } static void -show_nat(int ac, char **av); - -static void print_nat_config(unsigned char *buf) { struct cfg_nat *n; @@ -3988,8 +3886,8 @@ print_nat_config(unsigned char *buf) printf("\n"); } -static void -config_nat(int ac, char **av) +void +ipfw_config_nat(int ac, char **av) { struct cfg_nat *n; /* Nat instance configuration. */ int i, len, off, tok; @@ -4087,12 +3985,12 @@ config_nat(int ac, char **av) /* After every modification, we show the resultant rule. */ int _ac = 3; char *_av[] = {"show", "config", id}; - show_nat(_ac, _av); + ipfw_show_nat(_ac, _av); } } -static void -config_pipe(int ac, char **av) +void +ipfw_config_pipe(int ac, char **av) { struct dn_pipe p; int i; @@ -4772,8 +4670,8 @@ add_dst(ipfw_insn *cmd, char *av, u_char * various match patterns, log/altq actions, and the actual action. * */ -static void -add(int ac, char *av[]) +void +ipfw_add(int ac, char *av[]) { /* * rules are added into the 'rulebuf' and then copied in @@ -5781,13 +5679,18 @@ done: show_ipfw(rule, 0, 0); } -static void -zero(int ac, char *av[], int optname /* IP_FW_ZERO or IP_FW_RESETLOG */) +/* + * clear the counters or the log counters. + */ +void +ipfw_zero(int ac, char *av[], int optname /* 0 = IP_FW_ZERO, 1 = IP_FW_RESETLOG */) { uint32_t arg, saved_arg; int failed = EX_OK; - char const *name = optname == IP_FW_ZERO ? "ZERO" : "RESETLOG"; char const *errstr; + char const *name = optname ? "RESETLOG" : "ZERO"; + + optname = optname ? IP_FW_RESETLOG : IP_FW_ZERO; av++; ac--; @@ -5830,8 +5733,8 @@ zero(int ac, char *av[], int optname /* exit(failed); } -static void -flush(int force) +void +ipfw_flush(int force) { int cmd = co.do_pipe ? IP_DUMMYNET_FLUSH : IP_FW_FLUSH; @@ -5862,18 +5765,6 @@ flush(int force) printf("Flushed all %s.\n", co.do_pipe ? "pipes" : "rules"); } -/* - * Free a the (locally allocated) copy of command line arguments. - */ -static void -free_args(int ac, char **av) -{ - int i; - - for (i=0; i < ac; i++) - free(av[i]); - free(av); -} static void table_list(ipfw_table_entry ent, int need_header); @@ -5884,8 +5775,8 @@ static void table_list(ipfw_table_entry * ipfw table {N | all} flush * ipfw table {N | all} list */ -static void -table_handler(int ac, char *av[]) +void +ipfw_table_handler(int ac, char *av[]) { ipfw_table_entry ent; int do_add; @@ -6033,8 +5924,8 @@ table_list(ipfw_table_entry ent, int nee free(tbl); } -static void -show_nat(int ac, char **av) +void +ipfw_show_nat(int ac, char **av) { struct cfg_nat *n; struct cfg_redir *e; @@ -6107,446 +5998,3 @@ show_nat(int ac, char **av) } } } - -/* - * Called with the arguments, including program name because getopt - * wants it to be present. - * Returns 0 if successful, 1 if empty command, errx() in case of errors. - */ -static int -ipfw_main(int oldac, char **oldav) -{ - int ch, ac, save_ac; - const char *errstr; - char **av, **save_av; - int do_acct = 0; /* Show packet/byte count */ - -#define WHITESP " \t\f\v\n\r" - if (oldac < 2) - return 1; /* need at least one argument */ - if (oldac == 2) { - /* - * If we are called with a single string, try to split it into - * arguments for subsequent parsing. - * But first, remove spaces after a ',', by copying the string - * in-place. - */ - char *arg = oldav[1]; /* The string is the first arg. */ - int l = strlen(arg); - int copy = 0; /* 1 if we need to copy, 0 otherwise */ - int i, j; - for (i = j = 0; i < l; i++) { - if (arg[i] == '#') /* comment marker */ - break; - if (copy) { - arg[j++] = arg[i]; - copy = !index("," WHITESP, arg[i]); - } else { - copy = !index(WHITESP, arg[i]); - if (copy) - arg[j++] = arg[i]; - } - } - if (!copy && j > 0) /* last char was a 'blank', remove it */ - j--; - l = j; /* the new argument length */ - arg[j++] = '\0'; - if (l == 0) /* empty string! */ - return 1; - - /* - * First, count number of arguments. Because of the previous - * processing, this is just the number of blanks plus 1. - */ - for (i = 0, ac = 1; i < l; i++) - if (index(WHITESP, arg[i]) != NULL) - ac++; - - /* - * Allocate the argument list, including one entry for - * the program name because getopt expects it. - */ - av = safe_calloc(ac + 1, sizeof(char *)); - - /* - * Second, copy arguments from arg[] to av[]. For each one, - * j is the initial character, i is the one past the end. - */ - for (ac = 1, i = j = 0; i < l; i++) - if (index(WHITESP, arg[i]) != NULL || i == l-1) { - if (i == l-1) - i++; - av[ac] = safe_calloc(i-j+1, 1); - bcopy(arg+j, av[ac], i-j); - ac++; - j = i + 1; - } - } else { - /* - * If an argument ends with ',' join with the next one. - */ - int first, i, l; - - av = safe_calloc(oldac, sizeof(char *)); - for (first = i = ac = 1, l = 0; i < oldac; i++) { - char *arg = oldav[i]; - int k = strlen(arg); - - l += k; - if (arg[k-1] != ',' || i == oldac-1) { - /* Time to copy. */ - av[ac] = safe_calloc(l+1, 1); - for (l=0; first <= i; first++) { - strcat(av[ac]+l, oldav[first]); - l += strlen(oldav[first]); - } - ac++; - l = 0; - first = i+1; - } - } - } - - av[0] = strdup(oldav[0]); /* copy progname from the caller */ - /* Set the force flag for non-interactive processes */ - if (!co.do_force) - co.do_force = !isatty(STDIN_FILENO); - - /* Save arguments for final freeing of memory. */ - save_ac = ac; - save_av = av; - - optind = optreset = 1; /* restart getopt() */ - while ((ch = getopt(ac, av, "abcdefhinNqs:STtv")) != -1) - switch (ch) { - case 'a': - do_acct = 1; - break; - - case 'b': - co.comment_only = 1; - co.do_compact = 1; - break; - - case 'c': - co.do_compact = 1; - break; - - case 'd': - co.do_dynamic = 1; - break; - - case 'e': - co.do_expired = 1; - break; - - case 'f': - co.do_force = 1; - break; - - case 'h': /* help */ - free_args(save_ac, save_av); - help(); - break; /* NOTREACHED */ - - case 'i': - co.do_value_as_ip = 1; - break; - - case 'n': - co.test_only = 1; - break; - - case 'N': - co.do_resolv = 1; - break; - - case 'q': - co.do_quiet = 1; - break; - - case 's': /* sort */ - co.do_sort = atoi(optarg); - break; - - case 'S': - co.show_sets = 1; - break; - - case 't': - co.do_time = 1; - break; - - case 'T': - co.do_time = 2; /* numeric timestamp */ - break; - - case 'v': /* verbose */ - co.verbose = 1; - break; - - default: - free_args(save_ac, save_av); - return 1; - } - - ac -= optind; - av += optind; - NEED1("bad arguments, for usage summary ``ipfw''"); - - /* - * An undocumented behaviour of ipfw1 was to allow rule numbers first, - * e.g. "100 add allow ..." instead of "add 100 allow ...". - * In case, swap first and second argument to get the normal form. - */ - if (ac > 1 && isdigit(*av[0])) { - char *p = av[0]; - - av[0] = av[1]; - av[1] = p; - } - - /* - * Optional: pipe, queue or nat. - */ - co.do_nat = 0; - co.do_pipe = 0; - if (!strncmp(*av, "nat", strlen(*av))) - co.do_nat = 1; - else if (!strncmp(*av, "pipe", strlen(*av))) - co.do_pipe = 1; - else if (_substrcmp(*av, "queue") == 0) - co.do_pipe = 2; - else if (!strncmp(*av, "set", strlen(*av))) { - if (ac > 1 && isdigit(av[1][0])) { - co.use_set = strtonum(av[1], 0, RESVD_SET, &errstr); - if (errstr) - errx(EX_DATAERR, - "invalid set number %s\n", av[1]); - ac -= 2; av += 2; co.use_set++; - } - } - - if (co.do_pipe || co.do_nat) { - ac--; - av++; - } - NEED1("missing command"); - - /* - * For pipes, queues and nats we normally say 'nat|pipe NN config' - * but the code is easier to parse as 'nat|pipe config NN' - * so we swap the two arguments. - */ - if ((co.do_pipe || co.do_nat) && ac > 1 && isdigit(*av[0])) { - char *p = av[0]; - - av[0] = av[1]; - av[1] = p; - } - - int try_next = 0; - if (co.use_set == 0) { - if (_substrcmp(*av, "add") == 0) - add(ac, av); - else if (co.do_nat && _substrcmp(*av, "show") == 0) - show_nat(ac, av); - else if (co.do_pipe && _substrcmp(*av, "config") == 0) - config_pipe(ac, av); - else if (co.do_nat && _substrcmp(*av, "config") == 0) - config_nat(ac, av); - else if (_substrcmp(*av, "set") == 0) - sets_handler(ac, av); - else if (_substrcmp(*av, "table") == 0) - table_handler(ac, av); - else if (_substrcmp(*av, "enable") == 0) - sysctl_handler(ac, av, 1); - else if (_substrcmp(*av, "disable") == 0) - sysctl_handler(ac, av, 0); - else - try_next = 1; - } - - if (co.use_set || try_next) { - if (_substrcmp(*av, "delete") == 0) - delete(ac, av); - else if (_substrcmp(*av, "flush") == 0) - flush(co.do_force); - else if (_substrcmp(*av, "zero") == 0) - zero(ac, av, IP_FW_ZERO); - else if (_substrcmp(*av, "resetlog") == 0) - zero(ac, av, IP_FW_RESETLOG); - else if (_substrcmp(*av, "print") == 0 || - _substrcmp(*av, "list") == 0) - list(ac, av, do_acct); - else if (_substrcmp(*av, "show") == 0) - list(ac, av, 1 /* show counters */); - else - errx(EX_USAGE, "bad command `%s'", *av); - } - - /* Free memory allocated in the argument parsing. */ - free_args(save_ac, save_av); - return 0; -} - - -static void -ipfw_readfile(int ac, char *av[]) -{ -#define MAX_ARGS 32 - char buf[BUFSIZ]; - char *progname = av[0]; /* original program name */ - const char *cmd = NULL; /* preprocessor name, if any */ - const char *filename = av[ac-1]; /* file to read */ - int c, lineno=0; - FILE *f = NULL; - pid_t preproc = 0; - - while ((c = getopt(ac, av, "cfNnp:qS")) != -1) { - switch(c) { - case 'c': - co.do_compact = 1; - break; - - case 'f': - co.do_force = 1; - break; - - case 'N': - co.do_resolv = 1; - break; - - case 'n': - co.test_only = 1; - break; - - case 'p': - /* - * ipfw -p cmd [args] filename - * - * We are done with getopt(). All arguments - * except the filename go to the preprocessor, - * so we need to do the following: - * - check that a filename is actually present; - * - advance av by optind-1 to skip arguments - * already processed; - * - decrease ac by optind, to remove the args - * already processed and the final filename; - * - set the last entry in av[] to NULL so - * popen() can detect the end of the array; - * - set optind=ac to let getopt() terminate. - */ - if (optind == ac) - errx(EX_USAGE, "no filename argument"); - cmd = optarg; - av[ac-1] = NULL; - av += optind - 1; - ac -= optind; - optind = ac; - break; - - case 'q': - co.do_quiet = 1; - break; - - case 'S': - co.show_sets = 1; - break; - - default: - errx(EX_USAGE, "bad arguments, for usage" - " summary ``ipfw''"); - } - - } - - if (cmd == NULL && ac != optind + 1) - errx(EX_USAGE, "extraneous filename arguments %s", av[ac-1]); - - if ((f = fopen(filename, "r")) == NULL) - err(EX_UNAVAILABLE, "fopen: %s", filename); - - if (cmd != NULL) { /* pipe through preprocessor */ - int pipedes[2]; - - if (pipe(pipedes) == -1) - err(EX_OSERR, "cannot create pipe"); - - preproc = fork(); - if (preproc == -1) - err(EX_OSERR, "cannot fork"); - - if (preproc == 0) { - /* - * Child, will run the preprocessor with the - * file on stdin and the pipe on stdout. - */ - if (dup2(fileno(f), 0) == -1 - || dup2(pipedes[1], 1) == -1) - err(EX_OSERR, "dup2()"); - fclose(f); - close(pipedes[1]); - close(pipedes[0]); - execvp(cmd, av); - err(EX_OSERR, "execvp(%s) failed", cmd); - } else { /* parent, will reopen f as the pipe */ - fclose(f); - close(pipedes[1]); - if ((f = fdopen(pipedes[0], "r")) == NULL) { - int savederrno = errno; - - (void)kill(preproc, SIGTERM); - errno = savederrno; - err(EX_OSERR, "fdopen()"); - } - } - } - - while (fgets(buf, BUFSIZ, f)) { /* read commands */ - char linename[10]; - char *args[2]; - - lineno++; - sprintf(linename, "Line %d", lineno); - setprogname(linename); /* XXX */ - args[0] = progname; - args[1] = buf; - ipfw_main(2, args); - } - fclose(f); - if (cmd != NULL) { - int status; - - if (waitpid(preproc, &status, 0) == -1) - errx(EX_OSERR, "waitpid()"); - if (WIFEXITED(status) && WEXITSTATUS(status) != EX_OK) - errx(EX_UNAVAILABLE, - "preprocessor exited with status %d", - WEXITSTATUS(status)); - else if (WIFSIGNALED(status)) - errx(EX_UNAVAILABLE, - "preprocessor exited with signal %d", - WTERMSIG(status)); - } -} - -int -main(int ac, char *av[]) -{ - /* - * If the last argument is an absolute pathname, interpret it - * as a file to be preprocessed. - */ - - if (ac > 1 && av[ac - 1][0] == '/' && access(av[ac - 1], R_OK) == 0) - ipfw_readfile(ac, av); - else { - if (ipfw_main(ac, av)) { - errx(EX_USAGE, - "usage: ipfw [options]\n" - "do \"ipfw -h\" or \"man ipfw\" for details"); - } - } - return EX_OK; -} Added: head/sbin/ipfw/ipfw2.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ipfw/ipfw2.h Tue Jan 27 10:18:55 2009 (r187767) @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2002-2003 Luigi Rizzo + * Copyright (c) 1996 Alex Nash, Paul Traina, Poul-Henning Kamp + * Copyright (c) 1994 Ugen J.S.Antsilevich + * + * Idea and grammar partially left from: + * Copyright (c) 1993 Daniel Boulet + * + * Redistribution and use in source forms, with and without modification, + * are permitted provided that this entire comment appears intact. + * + * Redistribution in binary form may occur without any restrictions. + * Obviously, it would be nice if you gave credit where credit is due + * but requiring it would be too onerous. + * + * This software is provided ``AS IS'' without any warranties of any kind. + * + * NEW command line interface for IP firewall facility + * + * $FreeBSD$ + */ + +/* + * Options that can be set on the command line. + * When reading commands from a file, a subset of the options can also + * be applied globally by specifying them before the file name. + * After that, each line can contain its own option that changes + * the global value. + * XXX The context is not restored after each line. + */ + +struct cmdline_opts { + /* boolean options: */ + int do_value_as_ip; /* show table value as IP */ + int do_resolv; /* try to resolve all ip to names */ + int do_time; /* Show time stamps */ + int do_quiet; /* Be quiet in add and flush */ + int do_pipe; /* this cmd refers to a pipe */ + int do_nat; /* this cmd refers to a nat config */ + int do_dynamic; /* display dynamic rules */ + int do_expired; /* display expired dynamic rules */ + int do_compact; /* show rules in compact mode */ + int do_force; /* do not ask for confirmation */ + int show_sets; /* display the set each rule belongs to */ + int test_only; /* only check syntax */ + int comment_only; /* only print action and comment */ + int verbose; /* be verbose on some commands */ + + /* The options below can have multiple values. */ + + int do_sort; /* field to sort results (0 = no) */ + /* valid fields are 1 and above */ + + int use_set; /* work with specified set number */ + /* 0 means all sets, otherwise apply to set use_set - 1 */ + +}; + +extern struct cmdline_opts co; + +/* + * _s_x is a structure that stores a string <-> token pairs, used in + * various places in the parser. Entries are stored in arrays, + * with an entry with s=NULL as terminator. + * The search routines are match_token() and match_value(). + * Often, an element with x=0 contains an error string. + * + */ +struct _s_x { + char const *s; + int x; +}; + +/* + * the following macro returns an error message if we run out of + * arguments. + */ +#define NEED1(msg) {if (!ac) errx(EX_USAGE, msg);} + +/* memory allocation support */ +void *safe_calloc(size_t number, size_t size); +void *safe_realloc(void *ptr, size_t size); + +/* a string comparison function used for historical compatibility */ +int _substrcmp(const char *str1, const char* str2); + +/* + * The reserved set numer. This is a constant in ip_fw.h + * but we store it in a variable so other files do not depend + * in that header just for one constant. + */ +extern int resvd_set_number; + +void ipfw_add(int ac, char *av[]); +void ipfw_show_nat(int ac, char **av); +void ipfw_config_pipe(int ac, char **av); +void ipfw_config_nat(int ac, char **av); +void ipfw_sets_handler(int ac, char *av[]); +void ipfw_table_handler(int ac, char *av[]); +void ipfw_sysctl_handler(int ac, char *av[], int which); +void ipfw_delete(int ac, char *av[]); +void ipfw_flush(int force); +void ipfw_zero(int ac, char *av[], int optname); +void ipfw_list(int ac, char *av[], int show_counters); + Added: head/sbin/ipfw/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ipfw/main.c Tue Jan 27 10:18:55 2009 (r187767) @@ -0,0 +1,539 @@ +/* + * Copyright (c) 2002-2003 Luigi Rizzo + * Copyright (c) 1996 Alex Nash, Paul Traina, Poul-Henning Kamp + * Copyright (c) 1994 Ugen J.S.Antsilevich + * + * Idea and grammar partially left from: + * Copyright (c) 1993 Daniel Boulet + * + * Redistribution and use in source forms, with and without modification, + * are permitted provided that this entire comment appears intact. + * + * Redistribution in binary form may occur without any restrictions. + * Obviously, it would be nice if you gave credit where credit is due + * but requiring it would be too onerous. + * + * This software is provided ``AS IS'' without any warranties of any kind. + * + * Command line interface for IP firewall facility + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ipfw2.h" + +static void +help(void) +{ + fprintf(stderr, +"ipfw syntax summary (but please do read the ipfw(8) manpage):\n\n" +"\tipfw [-abcdefhnNqStTv] \n\n" +"where is one of the following:\n\n" +"add [num] [set N] [prob x] RULE-BODY\n" +"{pipe|queue} N config PIPE-BODY\n" +"[pipe|queue] {zero|delete|show} [N{,N}]\n" +"nat N config {ip IPADDR|if IFNAME|log|deny_in|same_ports|unreg_only|reset|\n" +" reverse|proxy_only|redirect_addr linkspec|\n" +" redirect_port linkspec|redirect_proto linkspec}\n" +"set [disable N... enable N...] | move [rule] X to Y | swap X Y | show\n" +"set N {show|list|zero|resetlog|delete} [N{,N}] | flush\n" +"table N {add ip[/bits] [value] | delete ip[/bits] | flush | list}\n" +"table all {flush | list}\n" +"\n" +"RULE-BODY: check-state [PARAMS] | ACTION [PARAMS] ADDR [OPTION_LIST]\n" +"ACTION: check-state | allow | count | deny | unreach{,6} CODE |\n" +" skipto N | {divert|tee} PORT | forward ADDR |\n" +" pipe N | queue N | nat N | setfib FIB\n" +"PARAMS: [log [logamount LOGLIMIT]] [altq QUEUE_NAME]\n" +"ADDR: [ MAC dst src ether_type ] \n" +" [ ip from IPADDR [ PORT ] to IPADDR [ PORTLIST ] ]\n" +" [ ipv6|ip6 from IP6ADDR [ PORT ] to IP6ADDR [ PORTLIST ] ]\n" +"IPADDR: [not] { any | me | ip/bits{x,y,z} | table(t[,v]) | IPLIST }\n" +"IP6ADDR: [not] { any | me | me6 | ip6/bits | IP6LIST }\n" +"IP6LIST: { ip6 | ip6/bits }[,IP6LIST]\n" +"IPLIST: { ip | ip/bits | ip:mask }[,IPLIST]\n" +"OPTION_LIST: OPTION [OPTION_LIST]\n" +"OPTION: bridged | diverted | diverted-loopback | diverted-output |\n" +" {dst-ip|src-ip} IPADDR | {dst-ip6|src-ip6|dst-ipv6|src-ipv6} IP6ADDR |\n" +" {dst-port|src-port} LIST |\n" +" estab | frag | {gid|uid} N | icmptypes LIST | in | out | ipid LIST |\n" +" iplen LIST | ipoptions SPEC | ipprecedence | ipsec | iptos SPEC |\n" +" ipttl LIST | ipversion VER | keep-state | layer2 | limit ... |\n" +" icmp6types LIST | ext6hdr LIST | flow-id N[,N] | fib FIB |\n" +" mac ... | mac-type LIST | proto LIST | {recv|xmit|via} {IF|IPADDR} |\n" +" setup | {tcpack|tcpseq|tcpwin} NN | tcpflags SPEC | tcpoptions SPEC |\n" +" tcpdatalen LIST | verrevpath | versrcreach | antispoof\n" +); + + exit(0); +} + +/* + * Free a the (locally allocated) copy of command line arguments. + */ +static void +free_args(int ac, char **av) +{ + int i; + + for (i=0; i < ac; i++) + free(av[i]); + free(av); +} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 11:03:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B54AD1065672; Tue, 27 Jan 2009 11:03:47 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3F738FC23; Tue, 27 Jan 2009 11:03:47 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RB3l80084616; Tue, 27 Jan 2009 11:03:47 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RB3lQW084615; Tue, 27 Jan 2009 11:03:47 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901271103.n0RB3lQW084615@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 27 Jan 2009 11:03:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187768 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 11:03:48 -0000 Author: luigi Date: Tue Jan 27 11:03:47 2009 New Revision: 187768 URL: http://svn.freebsd.org/changeset/base/187768 Log: never mind, for the time being let's stick with WARNS=0 until we sort out all proper printf formats. Modified: head/sbin/ipfw/Makefile Modified: head/sbin/ipfw/Makefile ============================================================================== --- head/sbin/ipfw/Makefile Tue Jan 27 10:18:55 2009 (r187767) +++ head/sbin/ipfw/Makefile Tue Jan 27 11:03:47 2009 (r187768) @@ -1,8 +1,8 @@ # $FreeBSD$ PROG= ipfw -SRCS= ipfw2.c main.c -WARNS?= 2 +SRCS= ipfw2.c dummynet.c main.c +WARNS?= 0 MAN= ipfw.8 .include From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 11:07:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 827E3106564A; Tue, 27 Jan 2009 11:07:00 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F2838FC1A; Tue, 27 Jan 2009 11:07:00 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RB70Dx084715; Tue, 27 Jan 2009 11:07:00 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RB70Nc084712; Tue, 27 Jan 2009 11:07:00 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901271107.n0RB70Nc084712@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 27 Jan 2009 11:07:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187769 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 11:07:01 -0000 Author: luigi Date: Tue Jan 27 11:06:59 2009 New Revision: 187769 URL: http://svn.freebsd.org/changeset/base/187769 Log: Put dummynet-related code in a separate file. To this purpose, add prototypes for global functions in ipfw2.h and move there also the list of tokens used in various places in the code. Added: head/sbin/ipfw/dummynet.c (contents, props changed) Modified: head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h Added: head/sbin/ipfw/dummynet.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ipfw/dummynet.c Tue Jan 27 11:06:59 2009 (r187769) @@ -0,0 +1,717 @@ +/* + * Copyright (c) 2002-2003 Luigi Rizzo + * Copyright (c) 1996 Alex Nash, Paul Traina, Poul-Henning Kamp + * Copyright (c) 1994 Ugen J.S.Antsilevich + * + * Idea and grammar partially left from: + * Copyright (c) 1993 Daniel Boulet + * + * Redistribution and use in source forms, with and without modification, + * are permitted provided that this entire comment appears intact. + * + * Redistribution in binary form may occur without any restrictions. + * Obviously, it would be nice if you gave credit where credit is due + * but requiring it would be too onerous. + * + * This software is provided ``AS IS'' without any warranties of any kind. + * + * NEW command line interface for IP firewall facility + * + * $FreeBSD$ + * + * dummynet support + */ + +#include +#include +#include +#include + +#include "ipfw2.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +static struct _s_x dummynet_params[] = { + { "plr", TOK_PLR }, + { "noerror", TOK_NOERROR }, + { "buckets", TOK_BUCKETS }, + { "dst-ip", TOK_DSTIP }, + { "src-ip", TOK_SRCIP }, + { "dst-port", TOK_DSTPORT }, + { "src-port", TOK_SRCPORT }, + { "proto", TOK_PROTO }, + { "weight", TOK_WEIGHT }, + { "all", TOK_ALL }, + { "mask", TOK_MASK }, + { "droptail", TOK_DROPTAIL }, + { "red", TOK_RED }, + { "gred", TOK_GRED }, + { "bw", TOK_BW }, + { "bandwidth", TOK_BW }, + { "delay", TOK_DELAY }, + { "pipe", TOK_PIPE }, + { "queue", TOK_QUEUE }, + { "flow-id", TOK_FLOWID}, + { "dst-ipv6", TOK_DSTIP6}, + { "dst-ip6", TOK_DSTIP6}, + { "src-ipv6", TOK_SRCIP6}, + { "src-ip6", TOK_SRCIP6}, + { "dummynet-params", TOK_NULL }, + { NULL, 0 } /* terminator */ +}; + +static int +sort_q(const void *pa, const void *pb) +{ + int rev = (co.do_sort < 0); + int field = rev ? -co.do_sort : co.do_sort; + long long res = 0; + const struct dn_flow_queue *a = pa; + const struct dn_flow_queue *b = pb; + + switch (field) { + case 1: /* pkts */ + res = a->len - b->len; + break; + case 2: /* bytes */ + res = a->len_bytes - b->len_bytes; + break; + + case 3: /* tot pkts */ + res = a->tot_pkts - b->tot_pkts; + break; + + case 4: /* tot bytes */ + res = a->tot_bytes - b->tot_bytes; + break; + } + if (res < 0) + res = -1; + if (res > 0) + res = 1; + return (int)(rev ? res : -res); +} + +static void +list_queues(struct dn_flow_set *fs, struct dn_flow_queue *q) +{ + int l; + int index_printed, indexes = 0; + char buff[255]; + struct protoent *pe; + + if (fs->rq_elements == 0) + return; + + if (co.do_sort != 0) + heapsort(q, fs->rq_elements, sizeof *q, sort_q); + + /* Print IPv4 flows */ + index_printed = 0; + for (l = 0; l < fs->rq_elements; l++) { + struct in_addr ina; + + /* XXX: Should check for IPv4 flows */ + if (IS_IP6_FLOW_ID(&(q[l].id))) + continue; + + if (!index_printed) { + index_printed = 1; + if (indexes > 0) /* currently a no-op */ + printf("\n"); + indexes++; + printf(" " + "mask: 0x%02x 0x%08x/0x%04x -> 0x%08x/0x%04x\n", + fs->flow_mask.proto, + fs->flow_mask.src_ip, fs->flow_mask.src_port, + fs->flow_mask.dst_ip, fs->flow_mask.dst_port); + + printf("BKT Prot ___Source IP/port____ " + "____Dest. IP/port____ " + "Tot_pkt/bytes Pkt/Byte Drp\n"); + } + + printf("%3d ", q[l].hash_slot); + pe = getprotobynumber(q[l].id.proto); + if (pe) + printf("%-4s ", pe->p_name); + else + printf("%4u ", q[l].id.proto); + ina.s_addr = htonl(q[l].id.src_ip); + printf("%15s/%-5d ", + inet_ntoa(ina), q[l].id.src_port); + ina.s_addr = htonl(q[l].id.dst_ip); + printf("%15s/%-5d ", + inet_ntoa(ina), q[l].id.dst_port); + printf("%4qu %8qu %2u %4u %3u\n", + q[l].tot_pkts, q[l].tot_bytes, + q[l].len, q[l].len_bytes, q[l].drops); + if (co.verbose) + printf(" S %20qd F %20qd\n", + q[l].S, q[l].F); + } + + /* Print IPv6 flows */ + index_printed = 0; + for (l = 0; l < fs->rq_elements; l++) { + if (!IS_IP6_FLOW_ID(&(q[l].id))) + continue; + + if (!index_printed) { + index_printed = 1; + if (indexes > 0) + printf("\n"); + indexes++; + printf("\n mask: proto: 0x%02x, flow_id: 0x%08x, ", + fs->flow_mask.proto, fs->flow_mask.flow_id6); + inet_ntop(AF_INET6, &(fs->flow_mask.src_ip6), + buff, sizeof(buff)); + printf("%s/0x%04x -> ", buff, fs->flow_mask.src_port); + inet_ntop( AF_INET6, &(fs->flow_mask.dst_ip6), + buff, sizeof(buff) ); + printf("%s/0x%04x\n", buff, fs->flow_mask.dst_port); + + printf("BKT ___Prot___ _flow-id_ " + "______________Source IPv6/port_______________ " + "_______________Dest. IPv6/port_______________ " + "Tot_pkt/bytes Pkt/Byte Drp\n"); + } + printf("%3d ", q[l].hash_slot); + pe = getprotobynumber(q[l].id.proto); + if (pe != NULL) + printf("%9s ", pe->p_name); + else + printf("%9u ", q[l].id.proto); + printf("%7d %39s/%-5d ", q[l].id.flow_id6, + inet_ntop(AF_INET6, &(q[l].id.src_ip6), buff, sizeof(buff)), + q[l].id.src_port); + printf(" %39s/%-5d ", + inet_ntop(AF_INET6, &(q[l].id.dst_ip6), buff, sizeof(buff)), + q[l].id.dst_port); + printf(" %4qu %8qu %2u %4u %3u\n", + q[l].tot_pkts, q[l].tot_bytes, + q[l].len, q[l].len_bytes, q[l].drops); + if (co.verbose) + printf(" S %20qd F %20qd\n", q[l].S, q[l].F); + } +} + +static void +print_flowset_parms(struct dn_flow_set *fs, char *prefix) +{ + int l; + char qs[30]; + char plr[30]; + char red[90]; /* Display RED parameters */ + + l = fs->qsize; + if (fs->flags_fs & DN_QSIZE_IS_BYTES) { + if (l >= 8192) + sprintf(qs, "%d KB", l / 1024); + else + sprintf(qs, "%d B", l); + } else + sprintf(qs, "%3d sl.", l); + if (fs->plr) + sprintf(plr, "plr %f", 1.0 * fs->plr / (double)(0x7fffffff)); + else + plr[0] = '\0'; + if (fs->flags_fs & DN_IS_RED) /* RED parameters */ + sprintf(red, + "\n\t %cRED w_q %f min_th %d max_th %d max_p %f", + (fs->flags_fs & DN_IS_GENTLE_RED) ? 'G' : ' ', + 1.0 * fs->w_q / (double)(1 << SCALE_RED), + SCALE_VAL(fs->min_th), + SCALE_VAL(fs->max_th), + 1.0 * fs->max_p / (double)(1 << SCALE_RED)); + else + sprintf(red, "droptail"); + + printf("%s %s%s %d queues (%d buckets) %s\n", + prefix, qs, plr, fs->rq_elements, fs->rq_size, red); +} + +void +ipfw_list_pipes(void *data, uint nbytes, int ac, char *av[]) +{ + int rulenum; + void *next = data; + struct dn_pipe *p = (struct dn_pipe *) data; + struct dn_flow_set *fs; + struct dn_flow_queue *q; + int l; + + if (ac > 0) + rulenum = strtoul(*av++, NULL, 10); + else + rulenum = 0; + for (; nbytes >= sizeof *p; p = (struct dn_pipe *)next) { + double b = p->bandwidth; + char buf[30]; + char prefix[80]; + + if (SLIST_NEXT(p, next) != (struct dn_pipe *)DN_IS_PIPE) + break; /* done with pipes, now queues */ + + /* + * compute length, as pipe have variable size + */ + l = sizeof(*p) + p->fs.rq_elements * sizeof(*q); + next = (char *)p + l; + nbytes -= l; + + if ((rulenum != 0 && rulenum != p->pipe_nr) || co.do_pipe == 2) + continue; + + /* + * Print rate (or clocking interface) + */ + if (p->if_name[0] != '\0') + sprintf(buf, "%s", p->if_name); + else if (b == 0) + sprintf(buf, "unlimited"); + else if (b >= 1000000) + sprintf(buf, "%7.3f Mbit/s", b/1000000); + else if (b >= 1000) + sprintf(buf, "%7.3f Kbit/s", b/1000); + else + sprintf(buf, "%7.3f bit/s ", b); + + sprintf(prefix, "%05d: %s %4d ms ", + p->pipe_nr, buf, p->delay); + print_flowset_parms(&(p->fs), prefix); + if (co.verbose) + printf(" V %20qd\n", p->V >> MY_M); + + q = (struct dn_flow_queue *)(p+1); + list_queues(&(p->fs), q); + } + for (fs = next; nbytes >= sizeof *fs; fs = next) { + char prefix[80]; + + if (SLIST_NEXT(fs, next) != (struct dn_flow_set *)DN_IS_QUEUE) + break; + l = sizeof(*fs) + fs->rq_elements * sizeof(*q); + next = (char *)fs + l; + nbytes -= l; + + if (rulenum != 0 && ((rulenum != fs->fs_nr && co.do_pipe == 2) || + (rulenum != fs->parent_nr && co.do_pipe == 1))) { + continue; + } + + q = (struct dn_flow_queue *)(fs+1); + sprintf(prefix, "q%05d: weight %d pipe %d ", + fs->fs_nr, fs->weight, fs->parent_nr); + print_flowset_parms(fs, prefix); + list_queues(fs, q); + } +} + +/* + * Delete pipe or queue i + */ +int +ipfw_delete_pipe(int pipe_or_queue, int n) +{ + struct dn_pipe p; + int i; + + memset(&p, 0, sizeof p); + if (pipe_or_queue == 1) + p.pipe_nr = i; /* pipe */ + else + p.fs.fs_nr = i; /* queue */ + i = do_cmd(IP_DUMMYNET_DEL, &p, sizeof p); + if (i) { + i = 1; + warn("rule %u: setsockopt(IP_DUMMYNET_DEL)", i); + } + return i; +} + +void +ipfw_config_pipe(int ac, char **av) +{ + struct dn_pipe p; + int i; + char *end; + void *par = NULL; + + memset(&p, 0, sizeof p); + + av++; ac--; + /* Pipe number */ + if (ac && isdigit(**av)) { + i = atoi(*av); av++; ac--; + if (co.do_pipe == 1) + p.pipe_nr = i; + else + p.fs.fs_nr = i; + } + while (ac > 0) { + double d; + int tok = match_token(dummynet_params, *av); + ac--; av++; + + switch(tok) { + case TOK_NOERROR: + p.fs.flags_fs |= DN_NOERROR; + break; + + case TOK_PLR: + NEED1("plr needs argument 0..1\n"); + d = strtod(av[0], NULL); + if (d > 1) + d = 1; + else if (d < 0) + d = 0; + p.fs.plr = (int)(d*0x7fffffff); + ac--; av++; + break; + + case TOK_QUEUE: + NEED1("queue needs queue size\n"); + end = NULL; + p.fs.qsize = strtoul(av[0], &end, 0); + if (*end == 'K' || *end == 'k') { + p.fs.flags_fs |= DN_QSIZE_IS_BYTES; + p.fs.qsize *= 1024; + } else if (*end == 'B' || + _substrcmp2(end, "by", "bytes") == 0) { + p.fs.flags_fs |= DN_QSIZE_IS_BYTES; + } + ac--; av++; + break; + + case TOK_BUCKETS: + NEED1("buckets needs argument\n"); + p.fs.rq_size = strtoul(av[0], NULL, 0); + ac--; av++; + break; + + case TOK_MASK: + NEED1("mask needs mask specifier\n"); + /* + * per-flow queue, mask is dst_ip, dst_port, + * src_ip, src_port, proto measured in bits + */ + par = NULL; + + bzero(&p.fs.flow_mask, sizeof(p.fs.flow_mask)); + end = NULL; + + while (ac >= 1) { + uint32_t *p32 = NULL; + uint16_t *p16 = NULL; + uint32_t *p20 = NULL; + struct in6_addr *pa6 = NULL; + uint32_t a; + + tok = match_token(dummynet_params, *av); + ac--; av++; + switch(tok) { + case TOK_ALL: + /* + * special case, all bits significant + */ + p.fs.flow_mask.dst_ip = ~0; + p.fs.flow_mask.src_ip = ~0; + p.fs.flow_mask.dst_port = ~0; + p.fs.flow_mask.src_port = ~0; + p.fs.flow_mask.proto = ~0; + n2mask(&(p.fs.flow_mask.dst_ip6), 128); + n2mask(&(p.fs.flow_mask.src_ip6), 128); + p.fs.flow_mask.flow_id6 = ~0; + p.fs.flags_fs |= DN_HAVE_FLOW_MASK; + goto end_mask; + + case TOK_DSTIP: + p32 = &p.fs.flow_mask.dst_ip; + break; + + case TOK_SRCIP: + p32 = &p.fs.flow_mask.src_ip; + break; + + case TOK_DSTIP6: + pa6 = &(p.fs.flow_mask.dst_ip6); + break; + + case TOK_SRCIP6: + pa6 = &(p.fs.flow_mask.src_ip6); + break; + + case TOK_FLOWID: + p20 = &p.fs.flow_mask.flow_id6; + break; + + case TOK_DSTPORT: + p16 = &p.fs.flow_mask.dst_port; + break; + + case TOK_SRCPORT: + p16 = &p.fs.flow_mask.src_port; + break; + + case TOK_PROTO: + break; + + default: + ac++; av--; /* backtrack */ + goto end_mask; + } + if (ac < 1) + errx(EX_USAGE, "mask: value missing"); + if (*av[0] == '/') { + a = strtoul(av[0]+1, &end, 0); + if (pa6 == NULL) + a = (a == 32) ? ~0 : (1 << a) - 1; + } else + a = strtoul(av[0], &end, 0); + if (p32 != NULL) + *p32 = a; + else if (p16 != NULL) { + if (a > 0xFFFF) + errx(EX_DATAERR, + "port mask must be 16 bit"); + *p16 = (uint16_t)a; + } else if (p20 != NULL) { + if (a > 0xfffff) + errx(EX_DATAERR, + "flow_id mask must be 20 bit"); + *p20 = (uint32_t)a; + } else if (pa6 != NULL) { + if (a > 128) + errx(EX_DATAERR, + "in6addr invalid mask len"); + else + n2mask(pa6, a); + } else { + if (a > 0xFF) + errx(EX_DATAERR, + "proto mask must be 8 bit"); + p.fs.flow_mask.proto = (uint8_t)a; + } + if (a != 0) + p.fs.flags_fs |= DN_HAVE_FLOW_MASK; + ac--; av++; + } /* end while, config masks */ +end_mask: + break; + + case TOK_RED: + case TOK_GRED: + NEED1("red/gred needs w_q/min_th/max_th/max_p\n"); + p.fs.flags_fs |= DN_IS_RED; + if (tok == TOK_GRED) + p.fs.flags_fs |= DN_IS_GENTLE_RED; + /* + * the format for parameters is w_q/min_th/max_th/max_p + */ + if ((end = strsep(&av[0], "/"))) { + double w_q = strtod(end, NULL); + if (w_q > 1 || w_q <= 0) + errx(EX_DATAERR, "0 < w_q <= 1"); + p.fs.w_q = (int) (w_q * (1 << SCALE_RED)); + } + if ((end = strsep(&av[0], "/"))) { + p.fs.min_th = strtoul(end, &end, 0); + if (*end == 'K' || *end == 'k') + p.fs.min_th *= 1024; + } + if ((end = strsep(&av[0], "/"))) { + p.fs.max_th = strtoul(end, &end, 0); + if (*end == 'K' || *end == 'k') + p.fs.max_th *= 1024; + } + if ((end = strsep(&av[0], "/"))) { + double max_p = strtod(end, NULL); + if (max_p > 1 || max_p <= 0) + errx(EX_DATAERR, "0 < max_p <= 1"); + p.fs.max_p = (int)(max_p * (1 << SCALE_RED)); + } + ac--; av++; + break; + + case TOK_DROPTAIL: + p.fs.flags_fs &= ~(DN_IS_RED|DN_IS_GENTLE_RED); + break; + + case TOK_BW: + NEED1("bw needs bandwidth or interface\n"); + if (co.do_pipe != 1) + errx(EX_DATAERR, "bandwidth only valid for pipes"); + /* + * set clocking interface or bandwidth value + */ + if (av[0][0] >= 'a' && av[0][0] <= 'z') { + int l = sizeof(p.if_name)-1; + /* interface name */ + strncpy(p.if_name, av[0], l); + p.if_name[l] = '\0'; + p.bandwidth = 0; + } else { + p.if_name[0] = '\0'; + p.bandwidth = strtoul(av[0], &end, 0); + if (*end == 'K' || *end == 'k') { + end++; + p.bandwidth *= 1000; + } else if (*end == 'M') { + end++; + p.bandwidth *= 1000000; + } + if ((*end == 'B' && + _substrcmp2(end, "Bi", "Bit/s") != 0) || + _substrcmp2(end, "by", "bytes") == 0) + p.bandwidth *= 8; + if (p.bandwidth < 0) + errx(EX_DATAERR, "bandwidth too large"); + } + ac--; av++; + break; + + case TOK_DELAY: + if (co.do_pipe != 1) + errx(EX_DATAERR, "delay only valid for pipes"); + NEED1("delay needs argument 0..10000ms\n"); + p.delay = strtoul(av[0], NULL, 0); + ac--; av++; + break; + + case TOK_WEIGHT: + if (co.do_pipe == 1) + errx(EX_DATAERR,"weight only valid for queues"); + NEED1("weight needs argument 0..100\n"); + p.fs.weight = strtoul(av[0], &end, 0); + ac--; av++; + break; + + case TOK_PIPE: + if (co.do_pipe == 1) + errx(EX_DATAERR,"pipe only valid for queues"); + NEED1("pipe needs pipe_number\n"); + p.fs.parent_nr = strtoul(av[0], &end, 0); + ac--; av++; + break; + + default: + errx(EX_DATAERR, "unrecognised option ``%s''", av[-1]); + } + } + if (co.do_pipe == 1) { + if (p.pipe_nr == 0) + errx(EX_DATAERR, "pipe_nr must be > 0"); + if (p.delay > 10000) + errx(EX_DATAERR, "delay must be < 10000"); + } else { /* co.do_pipe == 2, queue */ + if (p.fs.parent_nr == 0) + errx(EX_DATAERR, "pipe must be > 0"); + if (p.fs.weight >100) + errx(EX_DATAERR, "weight must be <= 100"); + } + if (p.fs.flags_fs & DN_QSIZE_IS_BYTES) { + size_t len; + long limit; + + len = sizeof(limit); + if (sysctlbyname("net.inet.ip.dummynet.pipe_byte_limit", + &limit, &len, NULL, 0) == -1) + limit = 1024*1024; + if (p.fs.qsize > limit) + errx(EX_DATAERR, "queue size must be < %ldB", limit); + } else { + size_t len; + long limit; + + len = sizeof(limit); + if (sysctlbyname("net.inet.ip.dummynet.pipe_slot_limit", + &limit, &len, NULL, 0) == -1) + limit = 100; + if (p.fs.qsize > limit) + errx(EX_DATAERR, "2 <= queue size <= %ld", limit); + } + if (p.fs.flags_fs & DN_IS_RED) { + size_t len; + int lookup_depth, avg_pkt_size; + double s, idle, weight, w_q; + struct clockinfo ck; + int t; + + if (p.fs.min_th >= p.fs.max_th) + errx(EX_DATAERR, "min_th %d must be < than max_th %d", + p.fs.min_th, p.fs.max_th); + if (p.fs.max_th == 0) + errx(EX_DATAERR, "max_th must be > 0"); + + len = sizeof(int); + if (sysctlbyname("net.inet.ip.dummynet.red_lookup_depth", + &lookup_depth, &len, NULL, 0) == -1) + errx(1, "sysctlbyname(\"%s\")", + "net.inet.ip.dummynet.red_lookup_depth"); + if (lookup_depth == 0) + errx(EX_DATAERR, "net.inet.ip.dummynet.red_lookup_depth" + " must be greater than zero"); + + len = sizeof(int); + if (sysctlbyname("net.inet.ip.dummynet.red_avg_pkt_size", + &avg_pkt_size, &len, NULL, 0) == -1) + + errx(1, "sysctlbyname(\"%s\")", + "net.inet.ip.dummynet.red_avg_pkt_size"); + if (avg_pkt_size == 0) + errx(EX_DATAERR, + "net.inet.ip.dummynet.red_avg_pkt_size must" + " be greater than zero"); + + len = sizeof(struct clockinfo); + if (sysctlbyname("kern.clockrate", &ck, &len, NULL, 0) == -1) + errx(1, "sysctlbyname(\"%s\")", "kern.clockrate"); + + /* + * Ticks needed for sending a medium-sized packet. + * Unfortunately, when we are configuring a WF2Q+ queue, we + * do not have bandwidth information, because that is stored + * in the parent pipe, and also we have multiple queues + * competing for it. So we set s=0, which is not very + * correct. But on the other hand, why do we want RED with + * WF2Q+ ? + */ + if (p.bandwidth==0) /* this is a WF2Q+ queue */ + s = 0; + else + s = (double)ck.hz * avg_pkt_size * 8 / p.bandwidth; + + /* + * max idle time (in ticks) before avg queue size becomes 0. + * NOTA: (3/w_q) is approx the value x so that + * (1-w_q)^x < 10^-3. + */ + w_q = ((double)p.fs.w_q) / (1 << SCALE_RED); + idle = s * 3. / w_q; + p.fs.lookup_step = (int)idle / lookup_depth; + if (!p.fs.lookup_step) + p.fs.lookup_step = 1; + weight = 1 - w_q; + for (t = p.fs.lookup_step; t > 1; --t) + weight *= 1 - w_q; + p.fs.lookup_weight = (int)(weight * (1 << SCALE_RED)); + } + i = do_cmd(IP_DUMMYNET_CONFIGURE, &p, sizeof p); + if (i) + err(1, "setsockopt(%s)", "IP_DUMMYNET_CONFIGURE"); +} Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Tue Jan 27 11:03:47 2009 (r187768) +++ head/sbin/ipfw/ipfw2.c Tue Jan 27 11:06:59 2009 (r187769) @@ -54,7 +54,6 @@ #include #include #include -#include #include #include #include @@ -192,150 +191,8 @@ static struct _s_x ether_types[] = { { NULL, 0 } }; -enum tokens { - TOK_NULL=0, - TOK_OR, - TOK_NOT, - TOK_STARTBRACE, - TOK_ENDBRACE, - - TOK_ACCEPT, - TOK_COUNT, - TOK_PIPE, - TOK_QUEUE, - TOK_DIVERT, - TOK_TEE, - TOK_NETGRAPH, - TOK_NGTEE, - TOK_FORWARD, - TOK_SKIPTO, - TOK_DENY, - TOK_REJECT, - TOK_RESET, - TOK_UNREACH, - TOK_CHECKSTATE, - TOK_NAT, - - TOK_ALTQ, - TOK_LOG, - TOK_TAG, - TOK_UNTAG, - - TOK_TAGGED, - TOK_UID, - TOK_GID, - TOK_JAIL, - TOK_IN, - TOK_LIMIT, - TOK_KEEPSTATE, - TOK_LAYER2, - TOK_OUT, - TOK_DIVERTED, - TOK_DIVERTEDLOOPBACK, - TOK_DIVERTEDOUTPUT, - TOK_XMIT, - TOK_RECV, - TOK_VIA, - TOK_FRAG, - TOK_IPOPTS, - TOK_IPLEN, - TOK_IPID, - TOK_IPPRECEDENCE, - TOK_IPTOS, - TOK_IPTTL, - TOK_IPVER, - TOK_ESTAB, - TOK_SETUP, - TOK_TCPDATALEN, - TOK_TCPFLAGS, - TOK_TCPOPTS, - TOK_TCPSEQ, - TOK_TCPACK, - TOK_TCPWIN, - TOK_ICMPTYPES, - TOK_MAC, - TOK_MACTYPE, - TOK_VERREVPATH, - TOK_VERSRCREACH, - TOK_ANTISPOOF, - TOK_IPSEC, - TOK_COMMENT, - - TOK_PLR, - TOK_NOERROR, - TOK_BUCKETS, - TOK_DSTIP, - TOK_SRCIP, - TOK_DSTPORT, - TOK_SRCPORT, - TOK_ALL, - TOK_MASK, - TOK_BW, - TOK_DELAY, - TOK_RED, - TOK_GRED, - TOK_DROPTAIL, - TOK_PROTO, - TOK_WEIGHT, - TOK_IP, - TOK_IF, - TOK_ALOG, - TOK_DENY_INC, - TOK_SAME_PORTS, - TOK_UNREG_ONLY, - TOK_RESET_ADDR, - TOK_ALIAS_REV, - TOK_PROXY_ONLY, - TOK_REDIR_ADDR, - TOK_REDIR_PORT, - TOK_REDIR_PROTO, - - TOK_IPV6, - TOK_FLOWID, - TOK_ICMP6TYPES, - TOK_EXT6HDR, - TOK_DSTIP6, - TOK_SRCIP6, - - TOK_IPV4, - TOK_UNREACH6, - TOK_RESET6, - - TOK_FIB, - TOK_SETFIB, -}; - -struct _s_x dummynet_params[] = { - { "plr", TOK_PLR }, - { "noerror", TOK_NOERROR }, - { "buckets", TOK_BUCKETS }, - { "dst-ip", TOK_DSTIP }, - { "src-ip", TOK_SRCIP }, - { "dst-port", TOK_DSTPORT }, - { "src-port", TOK_SRCPORT }, - { "proto", TOK_PROTO }, - { "weight", TOK_WEIGHT }, - { "all", TOK_ALL }, - { "mask", TOK_MASK }, - { "droptail", TOK_DROPTAIL }, - { "red", TOK_RED }, - { "gred", TOK_GRED }, - { "bw", TOK_BW }, - { "bandwidth", TOK_BW }, - { "delay", TOK_DELAY }, - { "pipe", TOK_PIPE }, - { "queue", TOK_QUEUE }, - { "flow-id", TOK_FLOWID}, - { "dst-ipv6", TOK_DSTIP6}, - { "dst-ip6", TOK_DSTIP6}, - { "src-ipv6", TOK_SRCIP6}, - { "src-ip6", TOK_SRCIP6}, - { "dummynet-params", TOK_NULL }, - { NULL, 0 } /* terminator */ -}; - -struct _s_x nat_params[] = { +static struct _s_x nat_params[] = { { "ip", TOK_IP }, { "if", TOK_IF }, { "log", TOK_ALOG }, @@ -351,7 +208,7 @@ struct _s_x nat_params[] = { { NULL, 0 } /* terminator */ }; -struct _s_x rule_actions[] = { +static struct _s_x rule_actions[] = { { "accept", TOK_ACCEPT }, { "pass", TOK_ACCEPT }, { "allow", TOK_ACCEPT }, @@ -380,7 +237,7 @@ struct _s_x rule_actions[] = { { NULL, 0 } /* terminator */ }; -struct _s_x rule_action_params[] = { +static struct _s_x rule_action_params[] = { { "altq", TOK_ALTQ }, { "log", TOK_LOG }, { "tag", TOK_TAG }, @@ -388,7 +245,7 @@ struct _s_x rule_action_params[] = { { NULL, 0 } /* terminator */ }; -struct _s_x rule_options[] = { +static struct _s_x rule_options[] = { { "tagged", TOK_TAGGED }, { "uid", TOK_UID }, { "gid", TOK_GID }, @@ -498,7 +355,7 @@ safe_realloc(void *ptr, size_t size) /* * conditionally runs the command. */ -static int +int do_cmd(int optname, void *optval, uintptr_t optlen) { static int s = -1; /* the socket */ @@ -528,7 +385,7 @@ do_cmd(int optname, void *optval, uintpt * match_token takes a table and a string, returns the value associated * with the string (-1 in case of failure). */ -static int +int match_token(struct _s_x *table, char *string) { struct _s_x *pt; @@ -590,7 +447,7 @@ _substrcmp(const char *str1, const char* * This function will be removed in the future through the usual * deprecation process. */ -static int +int _substrcmp2(const char *str1, const char* str2, const char* str3) { @@ -631,7 +488,7 @@ print_port(int proto, uint16_t port) } } -struct _s_x _port_name[] = { +static struct _s_x _port_name[] = { {"dst-port", O_IP_DSTPORT}, {"src-port", O_IP_SRCPORT}, {"ipid", O_IPID}, @@ -2088,254 +1945,6 @@ show_dyn_ipfw(ipfw_dyn_rule *d, int pcwi printf("\n"); } -static int -sort_q(const void *pa, const void *pb) -{ - int rev = (co.do_sort < 0); - int field = rev ? -co.do_sort : co.do_sort; - long long res = 0; - const struct dn_flow_queue *a = pa; - const struct dn_flow_queue *b = pb; - - switch (field) { - case 1: /* pkts */ - res = a->len - b->len; - break; - case 2: /* bytes */ - res = a->len_bytes - b->len_bytes; - break; - - case 3: /* tot pkts */ - res = a->tot_pkts - b->tot_pkts; - break; - - case 4: /* tot bytes */ - res = a->tot_bytes - b->tot_bytes; - break; - } - if (res < 0) - res = -1; - if (res > 0) - res = 1; - return (int)(rev ? res : -res); -} - -static void -list_queues(struct dn_flow_set *fs, struct dn_flow_queue *q) -{ - int l; - int index_printed, indexes = 0; - char buff[255]; - struct protoent *pe; - - if (fs->rq_elements == 0) - return; - - if (co.do_sort != 0) - heapsort(q, fs->rq_elements, sizeof *q, sort_q); - - /* Print IPv4 flows */ - index_printed = 0; - for (l = 0; l < fs->rq_elements; l++) { - struct in_addr ina; - *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 12:01:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA3601065686; Tue, 27 Jan 2009 12:01:57 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C0FE38FD2D; Tue, 27 Jan 2009 12:01:30 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RC1UuX085754; Tue, 27 Jan 2009 12:01:30 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RC1Us3085751; Tue, 27 Jan 2009 12:01:30 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901271201.n0RC1Us3085751@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 27 Jan 2009 12:01:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187770 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 12:02:22 -0000 Author: luigi Date: Tue Jan 27 12:01:30 2009 New Revision: 187770 URL: http://svn.freebsd.org/changeset/base/187770 Log: Put nat and ipv6 support in their own files. Usual moving of code with no changes from ipfw2.c to the newly created files, and addition of prototypes to ipfw2.h I have added forward declarations for ipfw_insn_* in ipfw2.h to avoid a global dependency on ip_fw.h Added: head/sbin/ipfw/ipv6.c (contents, props changed) head/sbin/ipfw/nat.c (contents, props changed) Modified: head/sbin/ipfw/Makefile head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h Modified: head/sbin/ipfw/Makefile ============================================================================== --- head/sbin/ipfw/Makefile Tue Jan 27 11:06:59 2009 (r187769) +++ head/sbin/ipfw/Makefile Tue Jan 27 12:01:30 2009 (r187770) @@ -1,7 +1,7 @@ # $FreeBSD$ PROG= ipfw -SRCS= ipfw2.c dummynet.c main.c +SRCS= ipfw2.c dummynet.c ipv6.c main.c nat.c WARNS?= 0 MAN= ipfw.8 Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Tue Jan 27 11:06:59 2009 (r187769) +++ head/sbin/ipfw/ipfw2.c Tue Jan 27 12:01:30 2009 (r187770) @@ -52,11 +52,9 @@ #include #include #include -#include #include #include #include -#include struct cmdline_opts co; /* global options */ @@ -192,22 +190,6 @@ static struct _s_x ether_types[] = { }; -static struct _s_x nat_params[] = { - { "ip", TOK_IP }, - { "if", TOK_IF }, - { "log", TOK_ALOG }, - { "deny_in", TOK_DENY_INC }, - { "same_ports", TOK_SAME_PORTS }, - { "unreg_only", TOK_UNREG_ONLY }, - { "reset", TOK_RESET_ADDR }, - { "reverse", TOK_ALIAS_REV }, - { "proxy_only", TOK_PROXY_ONLY }, - { "redirect_addr", TOK_REDIR_ADDR }, - { "redirect_port", TOK_REDIR_PORT }, - { "redirect_proto", TOK_REDIR_PROTO }, - { NULL, 0 } /* terminator */ -}; - static struct _s_x rule_actions[] = { { "accept", TOK_ACCEPT }, { "pass", TOK_ACCEPT }, @@ -401,7 +383,7 @@ match_token(struct _s_x *table, char *st * match_value takes a table and a value, returns the string associated * with the value (NULL in case of failure). */ -static char const * +char const * match_value(struct _s_x *p, int value) { for (; p->s != NULL; p++) @@ -786,40 +768,6 @@ print_reject_code(uint16_t code) printf("unreach %u", code); } -static struct _s_x icmp6codes[] = { - { "no-route", ICMP6_DST_UNREACH_NOROUTE }, - { "admin-prohib", ICMP6_DST_UNREACH_ADMIN }, - { "address", ICMP6_DST_UNREACH_ADDR }, - { "port", ICMP6_DST_UNREACH_NOPORT }, - { NULL, 0 } -}; - -static void -fill_unreach6_code(u_short *codep, char *str) -{ - int val; - char *s; - - val = strtoul(str, &s, 0); - if (s == str || *s != '\0' || val >= 0x100) - val = match_token(icmp6codes, str); - if (val < 0) - errx(EX_DATAERR, "unknown ICMPv6 unreachable code ``%s''", str); - *codep = val; - return; -} - -static void -print_unreach6_code(uint16_t code) -{ - char const *s = match_value(icmp6codes, code); - - if (s != NULL) - printf("unreach6 %s", s); - else - printf("unreach6 %u", code); -} - /* * Returns the number of bits set (from left) in a contiguous bitmask, * or -1 if the mask is not contiguous. @@ -831,7 +779,7 @@ print_unreach6_code(uint16_t code) * the first bit on the wire is bit 0 of the first byte. * len is the max length in bits. */ -static int +int contigmask(uint8_t *p, int len) { int i, n; @@ -1022,226 +970,6 @@ print_icmptypes(ipfw_insn_u32 *cmd) } } -/* - * Print the ip address contained in a command. - */ -static void -print_ip6(ipfw_insn_ip6 *cmd, char const *s) -{ - struct hostent *he = NULL; - int len = F_LEN((ipfw_insn *) cmd) - 1; - struct in6_addr *a = &(cmd->addr6); - char trad[255]; - - printf("%s%s ", cmd->o.len & F_NOT ? " not": "", s); - - if (cmd->o.opcode == O_IP6_SRC_ME || cmd->o.opcode == O_IP6_DST_ME) { - printf("me6"); - return; - } - if (cmd->o.opcode == O_IP6) { - printf(" ip6"); - return; - } - - /* - * len == 4 indicates a single IP, whereas lists of 1 or more - * addr/mask pairs have len = (2n+1). We convert len to n so we - * use that to count the number of entries. - */ - - for (len = len / 4; len > 0; len -= 2, a += 2) { - int mb = /* mask length */ - (cmd->o.opcode == O_IP6_SRC || cmd->o.opcode == O_IP6_DST) ? - 128 : contigmask((uint8_t *)&(a[1]), 128); - - if (mb == 128 && co.do_resolv) - he = gethostbyaddr((char *)a, sizeof(*a), AF_INET6); - if (he != NULL) /* resolved to name */ - printf("%s", he->h_name); - else if (mb == 0) /* any */ - printf("any"); - else { /* numeric IP followed by some kind of mask */ - if (inet_ntop(AF_INET6, a, trad, sizeof( trad ) ) == NULL) - printf("Error ntop in print_ip6\n"); - printf("%s", trad ); - if (mb < 0) /* XXX not really legal... */ - printf(":%s", - inet_ntop(AF_INET6, &a[1], trad, sizeof(trad))); - else if (mb < 128) - printf("/%d", mb); - } - if (len > 2) - printf(","); - } -} - -static void -fill_icmp6types(ipfw_insn_icmp6 *cmd, char *av) -{ - uint8_t type; - - bzero(cmd, sizeof(*cmd)); - while (*av) { - if (*av == ',') - av++; - type = strtoul(av, &av, 0); - if (*av != ',' && *av != '\0') - errx(EX_DATAERR, "invalid ICMP6 type"); - /* - * XXX: shouldn't this be 0xFF? I can't see any reason why - * we shouldn't be able to filter all possiable values - * regardless of the ability of the rest of the kernel to do - * anything useful with them. - */ - if (type > ICMP6_MAXTYPE) - errx(EX_DATAERR, "ICMP6 type out of range"); - cmd->d[type / 32] |= ( 1 << (type % 32)); - } - cmd->o.opcode = O_ICMP6TYPE; - cmd->o.len |= F_INSN_SIZE(ipfw_insn_icmp6); -} - - -static void -print_icmp6types(ipfw_insn_u32 *cmd) -{ - int i, j; - char sep= ' '; - - printf(" ip6 icmp6types"); - for (i = 0; i < 7; i++) - for (j=0; j < 32; ++j) { - if ( (cmd->d[i] & (1 << (j))) == 0) - continue; - printf("%c%d", sep, (i*32 + j)); - sep = ','; - } -} - -static void -print_flow6id( ipfw_insn_u32 *cmd) -{ - uint16_t i, limit = cmd->o.arg1; - char sep = ','; - - printf(" flow-id "); - for( i=0; i < limit; ++i) { - if (i == limit - 1) - sep = ' '; - printf("%d%c", cmd->d[i], sep); - } -} - -/* structure and define for the extension header in ipv6 */ -static struct _s_x ext6hdrcodes[] = { - { "frag", EXT_FRAGMENT }, - { "hopopt", EXT_HOPOPTS }, - { "route", EXT_ROUTING }, - { "dstopt", EXT_DSTOPTS }, - { "ah", EXT_AH }, - { "esp", EXT_ESP }, - { "rthdr0", EXT_RTHDR0 }, - { "rthdr2", EXT_RTHDR2 }, - { NULL, 0 } -}; - -/* fills command for the extension header filtering */ -static int -fill_ext6hdr( ipfw_insn *cmd, char *av) -{ - int tok; - char *s = av; - - cmd->arg1 = 0; - - while(s) { - av = strsep( &s, ",") ; - tok = match_token(ext6hdrcodes, av); - switch (tok) { - case EXT_FRAGMENT: - cmd->arg1 |= EXT_FRAGMENT; - break; - - case EXT_HOPOPTS: - cmd->arg1 |= EXT_HOPOPTS; - break; - - case EXT_ROUTING: - cmd->arg1 |= EXT_ROUTING; - break; - - case EXT_DSTOPTS: - cmd->arg1 |= EXT_DSTOPTS; - break; - - case EXT_AH: - cmd->arg1 |= EXT_AH; - break; - - case EXT_ESP: - cmd->arg1 |= EXT_ESP; - break; - - case EXT_RTHDR0: - cmd->arg1 |= EXT_RTHDR0; - break; - - case EXT_RTHDR2: - cmd->arg1 |= EXT_RTHDR2; - break; - - default: - errx( EX_DATAERR, "invalid option for ipv6 exten header" ); - break; - } - } - if (cmd->arg1 == 0 ) - return 0; - cmd->opcode = O_EXT_HDR; - cmd->len |= F_INSN_SIZE( ipfw_insn ); - return 1; -} - -static void -print_ext6hdr( ipfw_insn *cmd ) -{ - char sep = ' '; - - printf(" extension header:"); - if (cmd->arg1 & EXT_FRAGMENT ) { - printf("%cfragmentation", sep); - sep = ','; - } - if (cmd->arg1 & EXT_HOPOPTS ) { - printf("%chop options", sep); - sep = ','; - } - if (cmd->arg1 & EXT_ROUTING ) { - printf("%crouting options", sep); - sep = ','; - } - if (cmd->arg1 & EXT_RTHDR0 ) { - printf("%crthdr0", sep); - sep = ','; - } - if (cmd->arg1 & EXT_RTHDR2 ) { - printf("%crthdr2", sep); - sep = ','; - } - if (cmd->arg1 & EXT_DSTOPTS ) { - printf("%cdestination options", sep); - sep = ','; - } - if (cmd->arg1 & EXT_AH ) { - printf("%cauthentication header", sep); - sep = ','; - } - if (cmd->arg1 & EXT_ESP ) { - printf("%cencapsulated security payload", sep); - } -} - /* * show_ipfw() prints the body of an ipfw rule. * Because the standard rule has at least proto src_ip dst_ip, we use @@ -2490,21 +2218,6 @@ fill_ip(ipfw_insn_ip *cmd, char *av) } -/* Try to find ipv6 address by hostname */ -static int -lookup_host6 (char *host, struct in6_addr *ip6addr) -{ - struct hostent *he; - - if (!inet_pton(AF_INET6, host, ip6addr)) { - if ((he = gethostbyname2(host, AF_INET6)) == NULL) - return(-1); - memcpy(ip6addr, he->h_addr_list[0], sizeof( struct in6_addr)); - } - return(0); -} - - /* n2mask sets n bits of the mask */ void n2mask(struct in6_addr *mask, int n) @@ -2526,196 +2239,6 @@ n2mask(struct in6_addr *mask, int n) /* - * fill the addr and mask fields in the instruction as appropriate from av. - * Update length as appropriate. - * The following formats are allowed: - * any matches any IP6. Actually returns an empty instruction. - * me returns O_IP6_*_ME - * - * 03f1::234:123:0342 single IP6 addres - * 03f1::234:123:0342/24 address/mask - * 03f1::234:123:0342/24,03f1::234:123:0343/ List of address - * - * Set of address (as in ipv6) not supported because ipv6 address - * are typically random past the initial prefix. - * Return 1 on success, 0 on failure. - */ -static int -fill_ip6(ipfw_insn_ip6 *cmd, char *av) -{ - int len = 0; - struct in6_addr *d = &(cmd->addr6); - /* - * Needed for multiple address. - * Note d[1] points to struct in6_add r mask6 of cmd - */ - - cmd->o.len &= ~F_LEN_MASK; /* zero len */ - - if (strcmp(av, "any") == 0) - return (1); - - - if (strcmp(av, "me") == 0) { /* Set the data for "me" opt*/ - cmd->o.len |= F_INSN_SIZE(ipfw_insn); - return (1); - } - - if (strcmp(av, "me6") == 0) { /* Set the data for "me" opt*/ - cmd->o.len |= F_INSN_SIZE(ipfw_insn); - return (1); - } - - av = strdup(av); - while (av) { - /* - * After the address we can have '/' indicating a mask, - * or ',' indicating another address follows. - */ - - char *p; - int masklen; - char md = '\0'; - - if ((p = strpbrk(av, "/,")) ) { - md = *p; /* save the separator */ - *p = '\0'; /* terminate address string */ - p++; /* and skip past it */ - } - /* now p points to NULL, mask or next entry */ - - /* lookup stores address in *d as a side effect */ - if (lookup_host6(av, d) != 0) { - /* XXX: failed. Free memory and go */ - errx(EX_DATAERR, "bad address \"%s\"", av); - } - /* next, look at the mask, if any */ - masklen = (md == '/') ? atoi(p) : 128; - if (masklen > 128 || masklen < 0) - errx(EX_DATAERR, "bad width \"%s\''", p); - else - n2mask(&d[1], masklen); - - APPLY_MASK(d, &d[1]) /* mask base address with mask */ - - /* find next separator */ - - if (md == '/') { /* find separator past the mask */ - p = strpbrk(p, ","); - if (p != NULL) - p++; - } - av = p; - - /* Check this entry */ - if (masklen == 0) { - /* - * 'any' turns the entire list into a NOP. - * 'not any' never matches, so it is removed from the - * list unless it is the only item, in which case we - * report an error. - */ - if (cmd->o.len & F_NOT && av == NULL && len == 0) - errx(EX_DATAERR, "not any never matches"); - continue; - } - - /* - * A single IP can be stored alone - */ - if (masklen == 128 && av == NULL && len == 0) { - len = F_INSN_SIZE(struct in6_addr); - break; - } - - /* Update length and pointer to arguments */ - len += F_INSN_SIZE(struct in6_addr)*2; - d += 2; - } /* end while */ - - /* - * Total length of the command, remember that 1 is the size of - * the base command. - */ - if (len + 1 > F_LEN_MASK) - errx(EX_DATAERR, "address list too long"); - cmd->o.len |= len+1; - free(av); - return (1); -} - -/* - * fills command for ipv6 flow-id filtering - * note that the 20 bit flow number is stored in a array of u_int32_t - * it's supported lists of flow-id, so in the o.arg1 we store how many - * additional flow-id we want to filter, the basic is 1 - */ -static void -fill_flow6( ipfw_insn_u32 *cmd, char *av ) -{ - u_int32_t type; /* Current flow number */ - u_int16_t nflow = 0; /* Current flow index */ - char *s = av; - cmd->d[0] = 0; /* Initializing the base number*/ - - while (s) { - av = strsep( &s, ",") ; - type = strtoul(av, &av, 0); - if (*av != ',' && *av != '\0') - errx(EX_DATAERR, "invalid ipv6 flow number %s", av); - if (type > 0xfffff) - errx(EX_DATAERR, "flow number out of range %s", av); - cmd->d[nflow] |= type; - nflow++; - } - if( nflow > 0 ) { - cmd->o.opcode = O_FLOW6ID; - cmd->o.len |= F_INSN_SIZE(ipfw_insn_u32) + nflow; - cmd->o.arg1 = nflow; - } - else { - errx(EX_DATAERR, "invalid ipv6 flow number %s", av); - } -} - -static ipfw_insn * -add_srcip6(ipfw_insn *cmd, char *av) -{ - - fill_ip6((ipfw_insn_ip6 *)cmd, av); - if (F_LEN(cmd) == 0) { /* any */ - } else if (F_LEN(cmd) == F_INSN_SIZE(ipfw_insn)) { /* "me" */ - cmd->opcode = O_IP6_SRC_ME; - } else if (F_LEN(cmd) == - (F_INSN_SIZE(struct in6_addr) + F_INSN_SIZE(ipfw_insn))) { - /* single IP, no mask*/ - cmd->opcode = O_IP6_SRC; - } else { /* addr/mask opt */ - cmd->opcode = O_IP6_SRC_MASK; - } - return cmd; -} - -static ipfw_insn * -add_dstip6(ipfw_insn *cmd, char *av) -{ - - fill_ip6((ipfw_insn_ip6 *)cmd, av); - if (F_LEN(cmd) == 0) { /* any */ - } else if (F_LEN(cmd) == F_INSN_SIZE(ipfw_insn)) { /* "me" */ - cmd->opcode = O_IP6_DST_ME; - } else if (F_LEN(cmd) == - (F_INSN_SIZE(struct in6_addr) + F_INSN_SIZE(ipfw_insn))) { - /* single IP, no mask*/ - cmd->opcode = O_IP6_DST; - } else { /* addr/mask opt */ - cmd->opcode = O_IP6_DST_MASK; - } - return cmd; -} - - -/* * helper function to process a set of flags and set bits in the * appropriate masks. */ @@ -2824,769 +2347,6 @@ fill_iface(ipfw_insn_if *cmd, char *arg) errx(EX_DATAERR, "bad ip address ``%s''", arg); } -/* - * Search for interface with name "ifn", and fill n accordingly: - * - * n->ip ip address of interface "ifn" - * n->if_name copy of interface name "ifn" - */ -static void -set_addr_dynamic(const char *ifn, struct cfg_nat *n) -{ - size_t needed; - int mib[6]; - char *buf, *lim, *next; - struct if_msghdr *ifm; - struct ifa_msghdr *ifam; - struct sockaddr_dl *sdl; - struct sockaddr_in *sin; - int ifIndex, ifMTU; - - mib[0] = CTL_NET; - mib[1] = PF_ROUTE; - mib[2] = 0; - mib[3] = AF_INET; - mib[4] = NET_RT_IFLIST; - mib[5] = 0; -/* - * Get interface data. - */ - if (sysctl(mib, 6, NULL, &needed, NULL, 0) == -1) - err(1, "iflist-sysctl-estimate"); - buf = safe_calloc(1, needed); - if (sysctl(mib, 6, buf, &needed, NULL, 0) == -1) - err(1, "iflist-sysctl-get"); - lim = buf + needed; -/* - * Loop through interfaces until one with - * given name is found. This is done to - * find correct interface index for routing - * message processing. - */ - ifIndex = 0; - next = buf; - while (next < lim) { - ifm = (struct if_msghdr *)next; - next += ifm->ifm_msglen; - if (ifm->ifm_version != RTM_VERSION) { - if (co.verbose) - warnx("routing message version %d " - "not understood", ifm->ifm_version); - continue; - } - if (ifm->ifm_type == RTM_IFINFO) { - sdl = (struct sockaddr_dl *)(ifm + 1); - if (strlen(ifn) == sdl->sdl_nlen && - strncmp(ifn, sdl->sdl_data, sdl->sdl_nlen) == 0) { - ifIndex = ifm->ifm_index; - ifMTU = ifm->ifm_data.ifi_mtu; - break; - } - } - } - if (!ifIndex) - errx(1, "unknown interface name %s", ifn); -/* - * Get interface address. - */ - sin = NULL; - while (next < lim) { - ifam = (struct ifa_msghdr *)next; - next += ifam->ifam_msglen; - if (ifam->ifam_version != RTM_VERSION) { - if (co.verbose) - warnx("routing message version %d " - "not understood", ifam->ifam_version); - continue; - } - if (ifam->ifam_type != RTM_NEWADDR) - break; - if (ifam->ifam_addrs & RTA_IFA) { - int i; - char *cp = (char *)(ifam + 1); - - for (i = 1; i < RTA_IFA; i <<= 1) { - if (ifam->ifam_addrs & i) - cp += SA_SIZE((struct sockaddr *)cp); - } - if (((struct sockaddr *)cp)->sa_family == AF_INET) { - sin = (struct sockaddr_in *)cp; - break; - } - } - } - if (sin == NULL) - errx(1, "%s: cannot get interface address", ifn); - - n->ip = sin->sin_addr; - strncpy(n->if_name, ifn, IF_NAMESIZE); - - free(buf); -} - -/* - * XXX - The following functions, macros and definitions come from natd.c: - * it would be better to move them outside natd.c, in a file - * (redirect_support.[ch]?) shared by ipfw and natd, but for now i can live - * with it. - */ - -/* - * Definition of a port range, and macros to deal with values. - * FORMAT: HI 16-bits == first port in range, 0 == all ports. - * LO 16-bits == number of ports in range - * NOTES: - Port values are not stored in network byte order. - */ - -#define port_range u_long - -#define GETLOPORT(x) ((x) >> 0x10) -#define GETNUMPORTS(x) ((x) & 0x0000ffff) -#define GETHIPORT(x) (GETLOPORT((x)) + GETNUMPORTS((x))) - -/* Set y to be the low-port value in port_range variable x. */ -#define SETLOPORT(x,y) ((x) = ((x) & 0x0000ffff) | ((y) << 0x10)) - -/* Set y to be the number of ports in port_range variable x. */ -#define SETNUMPORTS(x,y) ((x) = ((x) & 0xffff0000) | (y)) - -static void -StrToAddr (const char* str, struct in_addr* addr) -{ - struct hostent* hp; - - if (inet_aton (str, addr)) - return; - - hp = gethostbyname (str); - if (!hp) - errx (1, "unknown host %s", str); - - memcpy (addr, hp->h_addr, sizeof (struct in_addr)); -} - -static int -StrToPortRange (const char* str, const char* proto, port_range *portRange) -{ - char* sep; - struct servent* sp; - char* end; - u_short loPort; - u_short hiPort; - - /* First see if this is a service, return corresponding port if so. */ - sp = getservbyname (str,proto); - if (sp) { - SETLOPORT(*portRange, ntohs(sp->s_port)); - SETNUMPORTS(*portRange, 1); - return 0; - } - - /* Not a service, see if it's a single port or port range. */ - sep = strchr (str, '-'); - if (sep == NULL) { - SETLOPORT(*portRange, strtol(str, &end, 10)); - if (end != str) { - /* Single port. */ - SETNUMPORTS(*portRange, 1); - return 0; - } - - /* Error in port range field. */ - errx (EX_DATAERR, "%s/%s: unknown service", str, proto); - } - - /* Port range, get the values and sanity check. */ - sscanf (str, "%hu-%hu", &loPort, &hiPort); - SETLOPORT(*portRange, loPort); - SETNUMPORTS(*portRange, 0); /* Error by default */ - if (loPort <= hiPort) - SETNUMPORTS(*portRange, hiPort - loPort + 1); - - if (GETNUMPORTS(*portRange) == 0) - errx (EX_DATAERR, "invalid port range %s", str); - - return 0; -} - -static int -StrToProto (const char* str) -{ - if (!strcmp (str, "tcp")) - return IPPROTO_TCP; - - if (!strcmp (str, "udp")) - return IPPROTO_UDP; - - errx (EX_DATAERR, "unknown protocol %s. Expected tcp or udp", str); -} - -static int -StrToAddrAndPortRange (const char* str, struct in_addr* addr, char* proto, - port_range *portRange) -{ - char* ptr; - - ptr = strchr (str, ':'); - if (!ptr) - errx (EX_DATAERR, "%s is missing port number", str); - - *ptr = '\0'; - ++ptr; - - StrToAddr (str, addr); - return StrToPortRange (ptr, proto, portRange); -} - -/* End of stuff taken from natd.c. */ - -#define INC_ARGCV() do { \ - (*_av)++; \ - (*_ac)--; \ - av = *_av; \ - ac = *_ac; \ -} while(0) - -/* - * The next 3 functions add support for the addr, port and proto redirect and - * their logic is loosely based on SetupAddressRedirect(), SetupPortRedirect() - * and SetupProtoRedirect() from natd.c. - * - * Every setup_* function fills at least one redirect entry - * (struct cfg_redir) and zero or more server pool entry (struct cfg_spool) - * in buf. - * - * The format of data in buf is: - * - * - * cfg_nat cfg_redir cfg_spool ...... cfg_spool - * - * ------------------------------------- ------------ - * | | .....X ... | | | | ..... - * ------------------------------------- ...... ------------ - * ^ - * spool_cnt n=0 ...... n=(X-1) - * - * len points to the amount of available space in buf - * space counts the memory consumed by every function - * - * XXX - Every function get all the argv params so it - * has to check, in optional parameters, that the next - * args is a valid option for the redir entry and not - * another token. Only redir_port and redir_proto are - * affected by this. - */ - -static int -setup_redir_addr(char *spool_buf, int len, - int *_ac, char ***_av) -{ - char **av, *sep; /* Token separator. */ - /* Temporary buffer used to hold server pool ip's. */ - char tmp_spool_buf[NAT_BUF_LEN]; - int ac, space, lsnat; - struct cfg_redir *r; - struct cfg_spool *tmp; - - av = *_av; - ac = *_ac; - space = 0; - lsnat = 0; - if (len >= SOF_REDIR) { - r = (struct cfg_redir *)spool_buf; - /* Skip cfg_redir at beginning of buf. */ - spool_buf = &spool_buf[SOF_REDIR]; - space = SOF_REDIR; - len -= SOF_REDIR; - } else - goto nospace; - r->mode = REDIR_ADDR; - /* Extract local address. */ - if (ac == 0) - errx(EX_DATAERR, "redirect_addr: missing local address"); - sep = strchr(*av, ','); - if (sep) { /* LSNAT redirection syntax. */ - r->laddr.s_addr = INADDR_NONE; - /* Preserve av, copy spool servers to tmp_spool_buf. */ - strncpy(tmp_spool_buf, *av, strlen(*av)+1); - lsnat = 1; - } else - StrToAddr(*av, &r->laddr); - INC_ARGCV(); - - /* Extract public address. */ - if (ac == 0) - errx(EX_DATAERR, "redirect_addr: missing public address"); - StrToAddr(*av, &r->paddr); - INC_ARGCV(); - - /* Setup LSNAT server pool. */ - if (sep) { - sep = strtok(tmp_spool_buf, ","); - while (sep != NULL) { - tmp = (struct cfg_spool *)spool_buf; - if (len < SOF_SPOOL) - goto nospace; - len -= SOF_SPOOL; - space += SOF_SPOOL; - StrToAddr(sep, &tmp->addr); - tmp->port = ~0; - r->spool_cnt++; - /* Point to the next possible cfg_spool. */ - spool_buf = &spool_buf[SOF_SPOOL]; - sep = strtok(NULL, ","); - } - } - return(space); -nospace: - errx(EX_DATAERR, "redirect_addr: buf is too small\n"); -} - -static int -setup_redir_port(char *spool_buf, int len, - int *_ac, char ***_av) -{ - char **av, *sep, *protoName; - char tmp_spool_buf[NAT_BUF_LEN]; - int ac, space, lsnat; - struct cfg_redir *r; - struct cfg_spool *tmp; - u_short numLocalPorts; - port_range portRange; - - av = *_av; - ac = *_ac; - space = 0; - lsnat = 0; - numLocalPorts = 0; - - if (len >= SOF_REDIR) { - r = (struct cfg_redir *)spool_buf; - /* Skip cfg_redir at beginning of buf. */ - spool_buf = &spool_buf[SOF_REDIR]; - space = SOF_REDIR; - len -= SOF_REDIR; - } else - goto nospace; - r->mode = REDIR_PORT; - /* - * Extract protocol. - */ - if (ac == 0) - errx (EX_DATAERR, "redirect_port: missing protocol"); - r->proto = StrToProto(*av); - protoName = *av; - INC_ARGCV(); - - /* - * Extract local address. - */ - if (ac == 0) - errx (EX_DATAERR, "redirect_port: missing local address"); - - sep = strchr(*av, ','); - /* LSNAT redirection syntax. */ - if (sep) { - r->laddr.s_addr = INADDR_NONE; - r->lport = ~0; - numLocalPorts = 1; - /* Preserve av, copy spool servers to tmp_spool_buf. */ - strncpy(tmp_spool_buf, *av, strlen(*av)+1); - lsnat = 1; - } else { - if (StrToAddrAndPortRange (*av, &r->laddr, protoName, - &portRange) != 0) - errx(EX_DATAERR, "redirect_port:" - "invalid local port range"); - - r->lport = GETLOPORT(portRange); - numLocalPorts = GETNUMPORTS(portRange); - } - INC_ARGCV(); - - /* - * Extract public port and optionally address. - */ - if (ac == 0) - errx (EX_DATAERR, "redirect_port: missing public port"); - - sep = strchr (*av, ':'); - if (sep) { - if (StrToAddrAndPortRange (*av, &r->paddr, protoName, - &portRange) != 0) - errx(EX_DATAERR, "redirect_port:" - "invalid public port range"); - } else { - r->paddr.s_addr = INADDR_ANY; - if (StrToPortRange (*av, protoName, &portRange) != 0) - errx(EX_DATAERR, "redirect_port:" - "invalid public port range"); - } - - r->pport = GETLOPORT(portRange); - r->pport_cnt = GETNUMPORTS(portRange); - INC_ARGCV(); - - /* - * Extract remote address and optionally port. - */ - /* - * NB: isalpha(**av) => we've to check that next parameter is really an - * option for this redirect entry, else stop here processing arg[cv]. - */ - if (ac != 0 && !isalpha(**av)) { - sep = strchr (*av, ':'); - if (sep) { - if (StrToAddrAndPortRange (*av, &r->raddr, protoName, - &portRange) != 0) - errx(EX_DATAERR, "redirect_port:" - "invalid remote port range"); - } else { - SETLOPORT(portRange, 0); - SETNUMPORTS(portRange, 1); - StrToAddr (*av, &r->raddr); - } - INC_ARGCV(); - } else { - SETLOPORT(portRange, 0); - SETNUMPORTS(portRange, 1); - r->raddr.s_addr = INADDR_ANY; - } - r->rport = GETLOPORT(portRange); - r->rport_cnt = GETNUMPORTS(portRange); - - /* - * Make sure port ranges match up, then add the redirect ports. - */ - if (numLocalPorts != r->pport_cnt) - errx(EX_DATAERR, "redirect_port:" - "port ranges must be equal in size"); - - /* Remote port range is allowed to be '0' which means all ports. */ - if (r->rport_cnt != numLocalPorts && - (r->rport_cnt != 1 || r->rport != 0)) - errx(EX_DATAERR, "redirect_port: remote port must" - "be 0 or equal to local port range in size"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 12:24:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DCA4106566B; Tue, 27 Jan 2009 12:24:53 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C2968FC13; Tue, 27 Jan 2009 12:24:53 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RCOrdV086200; Tue, 27 Jan 2009 12:24:53 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RCOr1p086199; Tue, 27 Jan 2009 12:24:53 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901271224.n0RCOr1p086199@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 27 Jan 2009 12:24:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187771 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 12:24:54 -0000 Author: luigi Date: Tue Jan 27 12:24:53 2009 New Revision: 187771 URL: http://svn.freebsd.org/changeset/base/187771 Log: fix wrong variable usage... Modified: head/sbin/ipfw/dummynet.c Modified: head/sbin/ipfw/dummynet.c ============================================================================== --- head/sbin/ipfw/dummynet.c Tue Jan 27 12:01:30 2009 (r187770) +++ head/sbin/ipfw/dummynet.c Tue Jan 27 12:24:53 2009 (r187771) @@ -326,10 +326,9 @@ ipfw_list_pipes(void *data, uint nbytes, * Delete pipe or queue i */ int -ipfw_delete_pipe(int pipe_or_queue, int n) +ipfw_delete_pipe(int pipe_or_queue, int i) { struct dn_pipe p; - int i; memset(&p, 0, sizeof p); if (pipe_or_queue == 1) From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 19:37:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14BCD106566B; Tue, 27 Jan 2009 19:37:31 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 02A948FC21; Tue, 27 Jan 2009 19:37:31 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RJbUA1094650; Tue, 27 Jan 2009 19:37:30 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RJbUfY094649; Tue, 27 Jan 2009 19:37:30 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <200901271937.n0RJbUfY094649@svn.freebsd.org> From: Nick Hibma Date: Tue, 27 Jan 2009 19:37:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187780 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 19:37:31 -0000 Author: n_hibma Date: Tue Jan 27 19:37:30 2009 New Revision: 187780 URL: http://svn.freebsd.org/changeset/base/187780 Log: Fix the input buffer at 1024. The previous calculated buffer size exceeded the maximum size of 1 page for OHCI controllers. Other serial drivers use the same size, so I assume this should be enough (1MB/s throughput?). Modified: head/sys/dev/usb/u3g.c Modified: head/sys/dev/usb/u3g.c ============================================================================== --- head/sys/dev/usb/u3g.c Tue Jan 27 19:25:00 2009 (r187779) +++ head/sys/dev/usb/u3g.c Tue Jan 27 19:37:30 2009 (r187780) @@ -108,6 +108,9 @@ static const struct u3g_speeds_s u3g_spe {7200000, 384000}, }; +#define U3GIBUFSIZE 1024 +#define U3GOBUFSIZE 1024 + /* * Various supported device vendors/products. */ @@ -296,10 +299,9 @@ u3g_attach(device_t self) ucom->sc_iface = uaa->ifaces[i]; ucom->sc_bulkin_no = bulkin_no; ucom->sc_bulkout_no = bulkout_no; - // Allocate a buffer enough for 10ms worth of data - ucom->sc_ibufsize = u3g_speeds[sc->sc_speed].ispeed/10/USB_FRAMES_PER_SECOND*10; - ucom->sc_ibufsizepad = ucom->sc_ibufsize; - ucom->sc_obufsize = u3g_speeds[sc->sc_speed].ospeed/10/USB_FRAMES_PER_SECOND*10; + ucom->sc_ibufsize = U3GIBUFSIZE; + ucom->sc_ibufsizepad = U3GIBUFSIZE; + ucom->sc_obufsize = U3GOBUFSIZE; ucom->sc_opkthdrlen = 0; ucom->sc_callback = &u3g_callback; @@ -362,7 +364,6 @@ u3g_open(void *addr, int portno) * anyway. * Note: We abuse the fact that ucom sets the speed through * ispeed/ospeed, not through ispeedwat/ospeedwat. - * XXX Are the speeds correct? */ if (portno == 0) { struct u3g_softc *sc = addr; From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 20:13:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D1BD106566C; Tue, 27 Jan 2009 20:13:25 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE4148FC0C; Tue, 27 Jan 2009 20:13:24 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RKDO1L095436; Tue, 27 Jan 2009 20:13:24 GMT (envelope-from keramida@svn.freebsd.org) Received: (from keramida@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RKDOBR095434; Tue, 27 Jan 2009 20:13:24 GMT (envelope-from keramida@svn.freebsd.org) Message-Id: <200901272013.n0RKDOBR095434@svn.freebsd.org> From: Giorgos Keramidas Date: Tue, 27 Jan 2009 20:13:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187782 - in head: etc/rc.d share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 20:13:25 -0000 Author: keramida (doc committer) Date: Tue Jan 27 20:13:24 2009 New Revision: 187782 URL: http://svn.freebsd.org/changeset/base/187782 Log: When synchronizing the clock at system startup time, use both the -g and -q options. They do a slightly different thing and both are necessary when the time difference is large. Noticed by: danger, in the forums Approved by: roberto MFC after: 1 week Modified: head/etc/rc.d/ntpd head/share/man/man5/rc.conf.5 Modified: head/etc/rc.d/ntpd ============================================================================== --- head/etc/rc.d/ntpd Tue Jan 27 19:56:38 2009 (r187781) +++ head/etc/rc.d/ntpd Tue Jan 27 20:13:24 2009 (r187782) @@ -23,7 +23,7 @@ ntpd_precmd() rc_flags="-c ${ntpd_config} ${ntpd_flags}" if checkyesno ntpd_sync_on_start; then - rc_flags="-g $rc_flags" + rc_flags="-q -g $rc_flags" fi if [ -z "$ntpd_chrootdir" ]; then Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Tue Jan 27 19:56:38 2009 (r187781) +++ head/share/man/man5/rc.conf.5 Tue Jan 27 20:13:24 2009 (r187782) @@ -2065,12 +2065,16 @@ If set to .Xr ntpd 8 is run with the .Fl g -flag, which syncs the system's clock on startup. +and +.Fl q +flags, which syncs the system's clock on startup. See .Xr ntpd 8 for more information regarding the .Fl g -option. +and +.Fl q +options. This is a preferred alternative to using .Xr ntpdate 8 or specifying the From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 20:26:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3191B1065673; Tue, 27 Jan 2009 20:26:46 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EF528FC12; Tue, 27 Jan 2009 20:26:46 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RKQkHQ095988; Tue, 27 Jan 2009 20:26:46 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RKQjq3095984; Tue, 27 Jan 2009 20:26:45 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901272026.n0RKQjq3095984@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 27 Jan 2009 20:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187787 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 20:26:46 -0000 Author: luigi Date: Tue Jan 27 20:26:45 2009 New Revision: 187787 URL: http://svn.freebsd.org/changeset/base/187787 Log: fix printing of uint64_t values, so we can use WARNS=2 Modified: head/sbin/ipfw/Makefile head/sbin/ipfw/dummynet.c head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h Modified: head/sbin/ipfw/Makefile ============================================================================== --- head/sbin/ipfw/Makefile Tue Jan 27 20:25:55 2009 (r187786) +++ head/sbin/ipfw/Makefile Tue Jan 27 20:26:45 2009 (r187787) @@ -2,7 +2,7 @@ PROG= ipfw SRCS= ipfw2.c dummynet.c ipv6.c main.c nat.c -WARNS?= 0 +WARNS?= 2 MAN= ipfw.8 .include Modified: head/sbin/ipfw/dummynet.c ============================================================================== --- head/sbin/ipfw/dummynet.c Tue Jan 27 20:25:55 2009 (r187786) +++ head/sbin/ipfw/dummynet.c Tue Jan 27 20:26:45 2009 (r187787) @@ -157,12 +157,13 @@ list_queues(struct dn_flow_set *fs, stru ina.s_addr = htonl(q[l].id.dst_ip); printf("%15s/%-5d ", inet_ntoa(ina), q[l].id.dst_port); - printf("%4qu %8qu %2u %4u %3u\n", - q[l].tot_pkts, q[l].tot_bytes, + printf("%4llu %8llu %2u %4u %3u\n", + align_uint64(&q[l].tot_pkts), + align_uint64(&q[l].tot_bytes), q[l].len, q[l].len_bytes, q[l].drops); if (co.verbose) - printf(" S %20qd F %20qd\n", - q[l].S, q[l].F); + printf(" S %20llu F %20llu\n", + align_uint64(&q[l].S), align_uint64(&q[l].F)); } /* Print IPv6 flows */ @@ -202,11 +203,14 @@ list_queues(struct dn_flow_set *fs, stru printf(" %39s/%-5d ", inet_ntop(AF_INET6, &(q[l].id.dst_ip6), buff, sizeof(buff)), q[l].id.dst_port); - printf(" %4qu %8qu %2u %4u %3u\n", - q[l].tot_pkts, q[l].tot_bytes, + printf(" %4llu %8llu %2u %4u %3u\n", + align_uint64(&q[l].tot_pkts), + align_uint64(&q[l].tot_bytes), q[l].len, q[l].len_bytes, q[l].drops); if (co.verbose) - printf(" S %20qd F %20qd\n", q[l].S, q[l].F); + printf(" S %20llu F %20llu\n", + align_uint64(&q[l].S), + align_uint64(&q[l].F)); } } @@ -295,7 +299,7 @@ ipfw_list_pipes(void *data, uint nbytes, p->pipe_nr, buf, p->delay); print_flowset_parms(&(p->fs), prefix); if (co.verbose) - printf(" V %20qd\n", p->V >> MY_M); + printf(" V %20llu\n", align_uint64(&p->V) >> MY_M); q = (struct dn_flow_queue *)(p+1); list_queues(&(p->fs), q); Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Tue Jan 27 20:25:55 2009 (r187786) +++ head/sbin/ipfw/ipfw2.c Tue Jan 27 20:26:45 2009 (r187787) @@ -306,8 +306,18 @@ static struct _s_x rule_options[] = { { NULL, 0 } /* terminator */ }; -static __inline uint64_t -align_uint64(uint64_t *pll) { +/* + * The following is used to generate a printable argument for + * 64-bit numbers, irrespective of platform alignment and bit size. + * Because all the printf in this program use %llu as a format, + * we just return an unsigned long long, which is larger than + * we need in certain cases, but saves the hassle of using + * PRIu64 as a format specifier. + * We don't care about inlining, this is not performance critical code. + */ +unsigned long long +align_uint64(const uint64_t *pll) +{ uint64_t ret; bcopy (pll, &ret, sizeof(ret)); Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Tue Jan 27 20:25:55 2009 (r187786) +++ head/sbin/ipfw/ipfw2.h Tue Jan 27 20:26:45 2009 (r187787) @@ -190,6 +190,8 @@ enum tokens { */ #define NEED1(msg) {if (!ac) errx(EX_USAGE, msg);} +unsigned long long align_uint64(const uint64_t *pll); + /* memory allocation support */ void *safe_calloc(size_t number, size_t size); void *safe_realloc(void *ptr, size_t size); From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 20:36:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AE841065672 for ; Tue, 27 Jan 2009 20:36:44 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by mx1.freebsd.org (Postfix) with ESMTP id AED078FC19 for ; Tue, 27 Jan 2009 20:36:43 +0000 (UTC) (envelope-from max@love2party.net) Received: from vampire.homelinux.org (dslb-088-066-034-230.pools.arcor-ip.net [88.66.34.230]) by mrelayeu.kundenserver.de (node=mrelayeu8) with ESMTP (Nemesis) id 0ML31I-1LRufq0XeI-0003S2; Tue, 27 Jan 2009 21:36:42 +0100 Received: (qmail 51468 invoked from network); 27 Jan 2009 20:36:39 -0000 Received: from fbsd8.laiers.local (192.168.4.200) by mx.laiers.local with SMTP; 27 Jan 2009 20:36:39 -0000 From: Max Laier Organization: FreeBSD To: Luigi Rizzo Date: Tue, 27 Jan 2009 21:36:38 +0100 User-Agent: KMail/1.10.4 (FreeBSD/8.0-CURRENT; KDE/4.1.4; i386; ; ) References: <200901272026.n0RKQjq3095984@svn.freebsd.org> In-Reply-To: <200901272026.n0RKQjq3095984@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901272136.39409.max@love2party.net> X-Provags-ID: V01U2FsdGVkX18u+zCG1aW1KmWtMjxppj50olGz9eWTqlhyC3u cEAXjLub66wccfWJwB74P+bt+uNYp4tL9wXsaxAnxzVn6L3Sda BnTntODlpNBQ0WqjlmoEA== Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187787 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 20:36:44 -0000 On Tuesday 27 January 2009 21:26:45 Luigi Rizzo wrote: > Author: luigi > Date: Tue Jan 27 20:26:45 2009 > New Revision: 187787 > URL: http://svn.freebsd.org/changeset/base/187787 > > Log: > fix printing of uint64_t values, so we can use WARNS=2 ... > Modified: head/sbin/ipfw/ipfw2.c > =========================================================================== > --- head/sbin/ipfw/ipfw2.c Tue Jan 27 20:25:55 2009 (r187786) > +++ head/sbin/ipfw/ipfw2.c Tue Jan 27 20:26:45 2009 (r187787) > @@ -306,8 +306,18 @@ static struct _s_x rule_options[] = { > { NULL, 0 } /* terminator */ > }; > > -static __inline uint64_t > -align_uint64(uint64_t *pll) { > +/* > + * The following is used to generate a printable argument for > + * 64-bit numbers, irrespective of platform alignment and bit size. > + * Because all the printf in this program use %llu as a format, > + * we just return an unsigned long long, which is larger than > + * we need in certain cases, but saves the hassle of using > + * PRIu64 as a format specifier. > + * We don't care about inlining, this is not performance critical code. > + */ You can always use uintmax_t and print with %ju instead. I'm also not sure that you really need this. None of the structures that hold the 64bit values are packed and thus should be correctly aligned. A simple cast to uintmax_t should be sufficient. > +unsigned long long > +align_uint64(const uint64_t *pll) > +{ > uint64_t ret; > > bcopy (pll, &ret, sizeof(ret)); -- /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 20:45:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E143E106566B; Tue, 27 Jan 2009 20:45:06 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.9.129]) by mx1.freebsd.org (Postfix) with ESMTP id 9FDA08FC16; Tue, 27 Jan 2009 20:45:06 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id E3B807309E; Tue, 27 Jan 2009 21:50:37 +0100 (CET) Date: Tue, 27 Jan 2009 21:50:37 +0100 From: Luigi Rizzo To: Max Laier Message-ID: <20090127205037.GA35494@onelab2.iet.unipi.it> References: <200901272026.n0RKQjq3095984@svn.freebsd.org> <200901272136.39409.max@love2party.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200901272136.39409.max@love2party.net> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r187787 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 20:45:07 -0000 On Tue, Jan 27, 2009 at 09:36:38PM +0100, Max Laier wrote: > On Tuesday 27 January 2009 21:26:45 Luigi Rizzo wrote: ... > > Modified: head/sbin/ipfw/ipfw2.c > > =========================================================================== > > --- head/sbin/ipfw/ipfw2.c Tue Jan 27 20:25:55 2009 (r187786) > > +++ head/sbin/ipfw/ipfw2.c Tue Jan 27 20:26:45 2009 (r187787) > > @@ -306,8 +306,18 @@ static struct _s_x rule_options[] = { > > { NULL, 0 } /* terminator */ > > }; > > > > -static __inline uint64_t > > -align_uint64(uint64_t *pll) { > > +/* > > + * The following is used to generate a printable argument for > > + * 64-bit numbers, irrespective of platform alignment and bit size. > > + * Because all the printf in this program use %llu as a format, > > + * we just return an unsigned long long, which is larger than > > + * we need in certain cases, but saves the hassle of using > > + * PRIu64 as a format specifier. > > + * We don't care about inlining, this is not performance critical code. > > + */ > > You can always use uintmax_t and print with %ju instead. I'm also not sure > that you really need this. None of the structures that hold the 64bit values > are packed and thus should be correctly aligned. A simple cast to uintmax_t > should be sufficient. maybe -- but some of the align_uint64() were already there, and i did not feel like changing the code without a real chance to test it on a machine with alignment issues. as you can see the format was often bogus, partly for historical reasons (some fields changed from 32 to long to 64 bit over time, and signed/unsigned was sometimes wrong). I first want to finish the partitioning the code, and then will look at other details. cheers luigi From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 21:48:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEE4310656F8; Tue, 27 Jan 2009 21:48:47 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A1858FC2A; Tue, 27 Jan 2009 21:48:47 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RLmlcU097752; Tue, 27 Jan 2009 21:48:47 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RLml09097747; Tue, 27 Jan 2009 21:48:47 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200901272148.n0RLml09097747@svn.freebsd.org> From: Robert Watson Date: Tue, 27 Jan 2009 21:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187790 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 21:48:48 -0000 Author: rwatson Date: Tue Jan 27 21:48:47 2009 New Revision: 187790 URL: http://svn.freebsd.org/changeset/base/187790 Log: Following a fair amount of real world experience with ACLs and extended attributes since FreeBSD 5, make the following semantic changes: - Don't update the inode modification time (mtime) when extended attributes (and hence also ACLs) are added, modified, or removed. - Don't update the inode access tie (atime) when extended attributes (and hence also ACLs) are queried. This means that rsync (and related tools) won't improperly think that the data in the file has changed when only the ACL has changed. Note that ffs_reallocblks() has not been changed to not update on an IO_EXT transaction, but currently EAs don't use the cluster write routines so this shouldn't be a problem. If EAs grow support for clustering, then VOP_REALLOCBLKS() will need to grow a flag argument to carry down IO_EXT to UFS. MFC after: 1 week PR: ports/125739 Reported by: Alexander Zagrebin Tested by: pluknet , Greg Byshenk Discussed with: kib, kientzle, timur, Alexander Bokovoy Modified: head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_balloc.c head/sys/ufs/ffs/ffs_extern.h head/sys/ufs/ffs/ffs_inode.c head/sys/ufs/ffs/ffs_vnops.c Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Tue Jan 27 20:34:14 2009 (r187789) +++ head/sys/ufs/ffs/ffs_alloc.c Tue Jan 27 21:48:47 2009 (r187790) @@ -130,10 +130,10 @@ static int ffs_reallocblks_ufs2(struct v * available block is located. */ int -ffs_alloc(ip, lbn, bpref, size, cred, bnp) +ffs_alloc(ip, lbn, bpref, size, flags, cred, bnp) struct inode *ip; ufs2_daddr_t lbn, bpref; - int size; + int size, flags; struct ucred *cred; ufs2_daddr_t *bnp; { @@ -191,7 +191,10 @@ retry: UFS_UNLOCK(ump); } DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + delta); - ip->i_flag |= IN_CHANGE | IN_UPDATE; + if (flags & IO_EXT) + ip->i_flag |= IN_CHANGE; + else + ip->i_flag |= IN_CHANGE | IN_UPDATE; *bnp = bno; return (0); } @@ -227,12 +230,12 @@ nospace: * invoked to get an appropriate block. */ int -ffs_realloccg(ip, lbprev, bprev, bpref, osize, nsize, cred, bpp) +ffs_realloccg(ip, lbprev, bprev, bpref, osize, nsize, flags, cred, bpp) struct inode *ip; ufs2_daddr_t lbprev; ufs2_daddr_t bprev; ufs2_daddr_t bpref; - int osize, nsize; + int osize, nsize, flags; struct ucred *cred; struct buf **bpp; { @@ -317,7 +320,10 @@ retry: UFS_UNLOCK(ump); } DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + delta); - ip->i_flag |= IN_CHANGE | IN_UPDATE; + if (flags & IO_EXT) + ip->i_flag |= IN_CHANGE; + else + ip->i_flag |= IN_CHANGE | IN_UPDATE; allocbuf(bp, nsize); bp->b_flags |= B_DONE; if ((bp->b_flags & (B_MALLOC | B_VMIO)) != B_VMIO) @@ -392,7 +398,10 @@ retry: UFS_UNLOCK(ump); } DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + delta); - ip->i_flag |= IN_CHANGE | IN_UPDATE; + if (flags & IO_EXT) + ip->i_flag |= IN_CHANGE; + else + ip->i_flag |= IN_CHANGE | IN_UPDATE; allocbuf(bp, nsize); bp->b_flags |= B_DONE; if ((bp->b_flags & (B_MALLOC | B_VMIO)) != B_VMIO) Modified: head/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_balloc.c Tue Jan 27 20:34:14 2009 (r187789) +++ head/sys/ufs/ffs/ffs_balloc.c Tue Jan 27 21:48:47 2009 (r187790) @@ -133,7 +133,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t UFS_LOCK(ump); error = ffs_realloccg(ip, nb, dp->di_db[nb], ffs_blkpref_ufs1(ip, lastlbn, (int)nb, - &dp->di_db[0]), osize, (int)fs->fs_bsize, cred, &bp); + &dp->di_db[0]), osize, (int)fs->fs_bsize, flags, + cred, &bp); if (error) return (error); if (DOINGSOFTDEP(vp)) @@ -184,7 +185,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t UFS_LOCK(ump); error = ffs_realloccg(ip, lbn, dp->di_db[lbn], ffs_blkpref_ufs1(ip, lbn, (int)lbn, - &dp->di_db[0]), osize, nsize, cred, &bp); + &dp->di_db[0]), osize, nsize, flags, + cred, &bp); if (error) return (error); if (DOINGSOFTDEP(vp)) @@ -200,7 +202,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t UFS_LOCK(ump); error = ffs_alloc(ip, lbn, ffs_blkpref_ufs1(ip, lbn, (int)lbn, &dp->di_db[0]), - nsize, cred, &newb); + nsize, flags, cred, &newb); if (error) return (error); bp = getblk(vp, lbn, nsize, 0, 0, 0); @@ -241,7 +243,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t UFS_LOCK(ump); pref = ffs_blkpref_ufs1(ip, lbn, 0, (ufs1_daddr_t *)0); if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, - cred, &newb)) != 0) { + flags, cred, &newb)) != 0) { curthread->td_pflags &= saved_inbdflush; return (error); } @@ -291,8 +293,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t UFS_LOCK(ump); if (pref == 0) pref = ffs_blkpref_ufs1(ip, lbn, 0, (ufs1_daddr_t *)0); - if ((error = - ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, cred, &newb)) != 0) { + if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, + flags, cred, &newb)) != 0) { brelse(bp); goto fail; } @@ -346,7 +348,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t UFS_LOCK(ump); pref = ffs_blkpref_ufs1(ip, lbn, indirs[i].in_off, &bap[0]); error = ffs_alloc(ip, - lbn, pref, (int)fs->fs_bsize, cred, &newb); + lbn, pref, (int)fs->fs_bsize, flags, cred, &newb); if (error) { brelse(bp); goto fail; @@ -534,7 +536,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t dp->di_extb[nb], ffs_blkpref_ufs2(ip, lastlbn, (int)nb, &dp->di_extb[0]), osize, - (int)fs->fs_bsize, cred, &bp); + (int)fs->fs_bsize, flags, cred, &bp); if (error) return (error); if (DOINGSOFTDEP(vp)) @@ -545,7 +547,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t dp->di_extsize = smalllblktosize(fs, nb + 1); dp->di_extb[nb] = dbtofsb(fs, bp->b_blkno); bp->b_xflags |= BX_ALTDATA; - ip->i_flag |= IN_CHANGE | IN_UPDATE; + ip->i_flag |= IN_CHANGE; if (flags & IO_SYNC) bwrite(bp); else @@ -588,7 +590,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t error = ffs_realloccg(ip, -1 - lbn, dp->di_extb[lbn], ffs_blkpref_ufs2(ip, lbn, (int)lbn, - &dp->di_extb[0]), osize, nsize, cred, &bp); + &dp->di_extb[0]), osize, nsize, flags, + cred, &bp); if (error) return (error); bp->b_xflags |= BX_ALTDATA; @@ -605,7 +608,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t UFS_LOCK(ump); error = ffs_alloc(ip, lbn, ffs_blkpref_ufs2(ip, lbn, (int)lbn, &dp->di_extb[0]), - nsize, cred, &newb); + nsize, flags, cred, &newb); if (error) return (error); bp = getblk(vp, -1 - lbn, nsize, 0, 0, 0); @@ -618,7 +621,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t nsize, 0, bp); } dp->di_extb[lbn] = dbtofsb(fs, bp->b_blkno); - ip->i_flag |= IN_CHANGE | IN_UPDATE; + ip->i_flag |= IN_CHANGE; *bpp = bp; return (0); } @@ -636,7 +639,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t error = ffs_realloccg(ip, nb, dp->di_db[nb], ffs_blkpref_ufs2(ip, lastlbn, (int)nb, &dp->di_db[0]), osize, (int)fs->fs_bsize, - cred, &bp); + flags, cred, &bp); if (error) return (error); if (DOINGSOFTDEP(vp)) @@ -688,7 +691,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t UFS_LOCK(ump); error = ffs_realloccg(ip, lbn, dp->di_db[lbn], ffs_blkpref_ufs2(ip, lbn, (int)lbn, - &dp->di_db[0]), osize, nsize, cred, &bp); + &dp->di_db[0]), osize, nsize, flags, + cred, &bp); if (error) return (error); if (DOINGSOFTDEP(vp)) @@ -704,7 +708,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t UFS_LOCK(ump); error = ffs_alloc(ip, lbn, ffs_blkpref_ufs2(ip, lbn, (int)lbn, - &dp->di_db[0]), nsize, cred, &newb); + &dp->di_db[0]), nsize, flags, cred, &newb); if (error) return (error); bp = getblk(vp, lbn, nsize, 0, 0, 0); @@ -745,7 +749,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t UFS_LOCK(ump); pref = ffs_blkpref_ufs2(ip, lbn, 0, (ufs2_daddr_t *)0); if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, - cred, &newb)) != 0) { + flags, cred, &newb)) != 0) { curthread->td_pflags &= saved_inbdflush; return (error); } @@ -795,8 +799,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t UFS_LOCK(ump); if (pref == 0) pref = ffs_blkpref_ufs2(ip, lbn, 0, (ufs2_daddr_t *)0); - if ((error = - ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, cred, &newb)) != 0) { + if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, + flags, cred, &newb)) != 0) { brelse(bp); goto fail; } @@ -850,7 +854,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t UFS_LOCK(ump); pref = ffs_blkpref_ufs2(ip, lbn, indirs[i].in_off, &bap[0]); error = ffs_alloc(ip, - lbn, pref, (int)fs->fs_bsize, cred, &newb); + lbn, pref, (int)fs->fs_bsize, flags, cred, &newb); if (error) { brelse(bp); goto fail; Modified: head/sys/ufs/ffs/ffs_extern.h ============================================================================== --- head/sys/ufs/ffs/ffs_extern.h Tue Jan 27 20:34:14 2009 (r187789) +++ head/sys/ufs/ffs/ffs_extern.h Tue Jan 27 21:48:47 2009 (r187790) @@ -48,8 +48,8 @@ struct vnode; struct vop_fsync_args; struct vop_reallocblks_args; -int ffs_alloc(struct inode *, - ufs2_daddr_t, ufs2_daddr_t, int, struct ucred *, ufs2_daddr_t *); +int ffs_alloc(struct inode *, ufs2_daddr_t, ufs2_daddr_t, int, int, + struct ucred *, ufs2_daddr_t *); int ffs_balloc_ufs1(struct vnode *a_vp, off_t a_startoffset, int a_size, struct ucred *a_cred, int a_flags, struct buf **a_bpp); int ffs_balloc_ufs2(struct vnode *a_vp, off_t a_startoffset, int a_size, @@ -72,7 +72,7 @@ void ffs_load_inode(struct buf *, struct int ffs_mountroot(void); int ffs_reallocblks(struct vop_reallocblks_args *); int ffs_realloccg(struct inode *, ufs2_daddr_t, ufs2_daddr_t, - ufs2_daddr_t, int, int, struct ucred *, struct buf **); + ufs2_daddr_t, int, int, int, struct ucred *, struct buf **); int ffs_sbupdate(struct ufsmount *, int, int); void ffs_setblock(struct fs *, u_char *, ufs1_daddr_t); int ffs_snapblkfree(struct fs *, struct vnode *, ufs2_daddr_t, long, ino_t); Modified: head/sys/ufs/ffs/ffs_inode.c ============================================================================== --- head/sys/ufs/ffs/ffs_inode.c Tue Jan 27 20:34:14 2009 (r187789) +++ head/sys/ufs/ffs/ffs_inode.c Tue Jan 27 21:48:47 2009 (r187790) @@ -225,7 +225,7 @@ ffs_truncate(vp, length, flags, cred, td oldblks[i] = ip->i_din2->di_extb[i]; ip->i_din2->di_extb[i] = 0; } - ip->i_flag |= IN_CHANGE | IN_UPDATE; + ip->i_flag |= IN_CHANGE; if ((error = ffs_update(vp, 1))) return (error); for (i = 0; i < NXADDR; i++) { Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Tue Jan 27 20:34:14 2009 (r187789) +++ head/sys/ufs/ffs/ffs_vnops.c Tue Jan 27 21:48:47 2009 (r187790) @@ -1006,14 +1006,6 @@ ffs_extread(struct vnode *vp, struct uio bqrelse(bp); } } - - if ((error == 0 || uio->uio_resid != orig_resid) && - (vp->v_mount->mnt_flag & MNT_NOATIME) == 0 && - (ip->i_flag & IN_ACCESS) == 0) { - VI_LOCK(vp); - ip->i_flag |= IN_ACCESS; - VI_UNLOCK(vp); - } return (error); } @@ -1119,7 +1111,7 @@ ffs_extwrite(struct vnode *vp, struct ui bdwrite(bp); if (error || xfersize == 0) break; - ip->i_flag |= IN_CHANGE | IN_UPDATE; + ip->i_flag |= IN_CHANGE; } /* * If we successfully wrote any data, and we are not the superuser From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 22:18:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D84FF106564A; Tue, 27 Jan 2009 22:18:05 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C405E8FC08; Tue, 27 Jan 2009 22:18:05 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RMI5XY098398; Tue, 27 Jan 2009 22:18:05 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RMI4O6098370; Tue, 27 Jan 2009 22:18:04 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901272218.n0RMI4O6098370@svn.freebsd.org> From: Sam Leffler Date: Tue, 27 Jan 2009 22:18:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187791 - in head/contrib/wpa_supplicant: . doc/docbook wpa_gui wpa_gui-qt4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 22:18:06 -0000 Author: sam Date: Tue Jan 27 22:18:04 2009 New Revision: 187791 URL: http://svn.freebsd.org/changeset/base/187791 Log: update to 0.5.11: some useful bug fixes (check ChangeLog) Submitted by: scf MFC after: 3 weeks Modified: head/contrib/wpa_supplicant/ (props changed) head/contrib/wpa_supplicant/ChangeLog head/contrib/wpa_supplicant/Makefile head/contrib/wpa_supplicant/base64.c head/contrib/wpa_supplicant/ctrl_iface.c head/contrib/wpa_supplicant/ctrl_iface_dbus.c head/contrib/wpa_supplicant/ctrl_iface_unix.c head/contrib/wpa_supplicant/dbus_dict_helpers.c head/contrib/wpa_supplicant/doc/docbook/wpa_background.8 head/contrib/wpa_supplicant/doc/docbook/wpa_cli.8 head/contrib/wpa_supplicant/doc/docbook/wpa_cli.sgml head/contrib/wpa_supplicant/doc/docbook/wpa_passphrase.8 head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.8 head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5 head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.conf.sgml head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.sgml head/contrib/wpa_supplicant/driver_ndis.c head/contrib/wpa_supplicant/eap.c head/contrib/wpa_supplicant/eap_aka.c head/contrib/wpa_supplicant/eap_gpsk.c head/contrib/wpa_supplicant/eap_gpsk_common.c head/contrib/wpa_supplicant/eap_ttls.c head/contrib/wpa_supplicant/eloop.c head/contrib/wpa_supplicant/eloop.h head/contrib/wpa_supplicant/eloop_none.c head/contrib/wpa_supplicant/mlme.c head/contrib/wpa_supplicant/os_unix.c head/contrib/wpa_supplicant/preauth_test.c head/contrib/wpa_supplicant/radius.c head/contrib/wpa_supplicant/sha1.c head/contrib/wpa_supplicant/tls_openssl.c head/contrib/wpa_supplicant/version.h head/contrib/wpa_supplicant/wpa.c head/contrib/wpa_supplicant/wpa.h head/contrib/wpa_supplicant/wpa_cli.c head/contrib/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp head/contrib/wpa_supplicant/wpa_gui-qt4/scanresults.cpp head/contrib/wpa_supplicant/wpa_gui-qt4/wpagui.cpp head/contrib/wpa_supplicant/wpa_gui/networkconfig.ui.h head/contrib/wpa_supplicant/wpa_gui/userdatarequest.ui.h head/contrib/wpa_supplicant/wpa_gui/wpagui.ui.h head/contrib/wpa_supplicant/wpa_i.h head/contrib/wpa_supplicant/wpa_supplicant.c Modified: head/contrib/wpa_supplicant/ChangeLog ============================================================================== --- head/contrib/wpa_supplicant/ChangeLog Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/ChangeLog Tue Jan 27 22:18:04 2009 (r187791) @@ -1,5 +1,31 @@ ChangeLog for wpa_supplicant +2008-11-28 - v0.5.11 + * fixed race condition between disassociation event and group key + handshake to avoid getting stuck in incorrect state [Bug 261] + * updated D-Bus usage to avoid deprecated functions + * silence SIOCSIWAUTH ioctl failure message (these can be ignored in + most cases and are now only shown in debug output) + * increase timeout for IBSS connection + * driver_wext: do not overwrite BSS frequency if channel was already + received + * driver_wext: set interface down for mode switches, if needed (e.g., + for mac80211) + * driver_wext: fixed re-initialization of a removed and re-inserted + interface (e.g., USB dongle or on resume if driver was unloaded for + suspend) + * improve per-SSID scanning for drivers that report background scan + results frequently + * fixed scanning behavior after a failed initial association + * driver_wext: fixed processing of invalid event messages from kernel + not to crash wpa_supplicant (this could happen when using 64-bit + kernel with 32-bit userspace) + * fixed EAP-AKA to use RES Length field in AT_RES as length in bits, + not bytes + * fixed canceling of PMKSA caching when using drivers that generate + RSN IE and refuse to drop PMKIDs that wpa_supplicant does not know + about + 2008-02-19 - v0.5.10 * added support for Makefile builds to include debug-log-to-a-file functionality (CONFIG_DEBUG_FILE=y and -f on command line) Modified: head/contrib/wpa_supplicant/Makefile ============================================================================== --- head/contrib/wpa_supplicant/Makefile Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/Makefile Tue Jan 27 22:18:04 2009 (r187791) @@ -149,7 +149,10 @@ endif ifdef CONFIG_DRIVER_NDIS CFLAGS += -DCONFIG_DRIVER_NDIS -OBJS_d += driver_ndis.o driver_ndis_.o +OBJS_d += driver_ndis.o +ifdef CONFIG_NDIS_EVENTS_INTEGRATED +OBJS_d += driver_ndis_.o +endif ifndef CONFIG_L2_PACKET CONFIG_L2_PACKET=pcap endif Modified: head/contrib/wpa_supplicant/base64.c ============================================================================== --- head/contrib/wpa_supplicant/base64.c Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/base64.c Tue Jan 27 22:18:04 2009 (r187791) @@ -115,7 +115,7 @@ unsigned char * base64_decode(const unsi count++; } - if (count % 4) + if (count == 0 || count % 4) return NULL; olen = count / 4 * 3; Modified: head/contrib/wpa_supplicant/ctrl_iface.c ============================================================================== --- head/contrib/wpa_supplicant/ctrl_iface.c Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/ctrl_iface.c Tue Jan 27 22:18:04 2009 (r187791) @@ -76,6 +76,7 @@ static int wpa_supplicant_ctrl_iface_set } +#ifdef IEEE8021X_EAPOL static int wpa_supplicant_ctrl_iface_preauth(struct wpa_supplicant *wpa_s, char *addr) { @@ -94,6 +95,7 @@ static int wpa_supplicant_ctrl_iface_pre return 0; } +#endif /* IEEE8021X_EAPOL */ #ifdef CONFIG_PEERKEY @@ -1126,9 +1128,11 @@ char * wpa_supplicant_ctrl_iface_process wpa_s->reassociate = 1; wpa_supplicant_req_scan(wpa_s, 0, 0); } +#ifdef IEEE8021X_EAPOL } else if (os_strncmp(buf, "PREAUTH ", 8) == 0) { if (wpa_supplicant_ctrl_iface_preauth(wpa_s, buf + 8)) reply_len = -1; +#endif /* IEEE8021X_EAPOL */ #ifdef CONFIG_PEERKEY } else if (os_strncmp(buf, "STKSTART ", 9) == 0) { if (wpa_supplicant_ctrl_iface_stkstart(wpa_s, buf + 9)) Modified: head/contrib/wpa_supplicant/ctrl_iface_dbus.c ============================================================================== --- head/contrib/wpa_supplicant/ctrl_iface_dbus.c Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/ctrl_iface_dbus.c Tue Jan 27 22:18:04 2009 (r187791) @@ -30,10 +30,10 @@ #include "wpa_ctrl.h" #include "eap.h" -#define DBUS_VERSION (DBUS_VERSION_MAJOR << 8 | DBUS_VERSION_MINOR) +#define _DBUS_VERSION (DBUS_VERSION_MAJOR << 8 | DBUS_VERSION_MINOR) #define DBUS_VER(major, minor) ((major) << 8 | (minor)) -#if DBUS_VERSION < DBUS_VER(1,1) +#if _DBUS_VERSION < DBUS_VER(1,1) #define dbus_watch_get_unix_fd dbus_watch_get_fd #endif Modified: head/contrib/wpa_supplicant/ctrl_iface_unix.c ============================================================================== --- head/contrib/wpa_supplicant/ctrl_iface_unix.c Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/ctrl_iface_unix.c Tue Jan 27 22:18:04 2009 (r187791) @@ -305,7 +305,7 @@ wpa_supplicant_ctrl_iface_init(struct wp /* Group name not found - try to parse this as gid */ gid = strtol(gid_str, &endp, 10); if (*gid_str == '\0' || *endp != '\0') { - wpa_printf(MSG_DEBUG, "CTRL: Invalid group " + wpa_printf(MSG_ERROR, "CTRL: Invalid group " "'%s'", gid_str); goto fail; } Modified: head/contrib/wpa_supplicant/dbus_dict_helpers.c ============================================================================== --- head/contrib/wpa_supplicant/dbus_dict_helpers.c Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/dbus_dict_helpers.c Tue Jan 27 22:18:04 2009 (r187791) @@ -629,36 +629,56 @@ dbus_bool_t wpa_dbus_dict_open_read(DBus } +#define BYTE_ARRAY_CHUNK_SIZE 34 +#define BYTE_ARRAY_ITEM_SIZE (sizeof (char)) + static dbus_bool_t _wpa_dbus_dict_entry_get_byte_array( - DBusMessageIter *iter, int array_len, int array_type, + DBusMessageIter *iter, int array_type, struct wpa_dbus_dict_entry *entry) { - dbus_uint32_t i = 0; + dbus_uint32_t count = 0; dbus_bool_t success = FALSE; - char byte; + char *buffer; - /* Zero-length arrays are valid. */ - if (array_len == 0) { - entry->bytearray_value = NULL; - entry->array_type = DBUS_TYPE_BYTE; - success = TRUE; - goto done; - } + entry->bytearray_value = NULL; + entry->array_type = DBUS_TYPE_BYTE; - entry->bytearray_value = wpa_zalloc(array_len * sizeof(char)); - if (!entry->bytearray_value) { + buffer = wpa_zalloc(BYTE_ARRAY_ITEM_SIZE * BYTE_ARRAY_CHUNK_SIZE); + if (!buffer) { perror("_wpa_dbus_dict_entry_get_byte_array[dbus]: out of " "memory"); goto done; } - entry->array_type = DBUS_TYPE_BYTE; - entry->array_len = array_len; + entry->bytearray_value = buffer; + entry->array_len = 0; while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_BYTE) { + char byte; + + if ((count % BYTE_ARRAY_CHUNK_SIZE) == 0 && count != 0) { + buffer = realloc(buffer, BYTE_ARRAY_ITEM_SIZE * + (count + BYTE_ARRAY_CHUNK_SIZE)); + if (buffer == NULL) { + perror("_wpa_dbus_dict_entry_get_byte_array[" + "dbus] out of memory trying to " + "retrieve the string array"); + goto done; + } + } + entry->bytearray_value = buffer; + dbus_message_iter_get_basic(iter, &byte); - entry->bytearray_value[i++] = byte; + entry->bytearray_value[count] = byte; + entry->array_len = ++count; dbus_message_iter_next(iter); } + + /* Zero-length arrays are valid. */ + if (entry->array_len == 0) { + free(entry->bytearray_value); + entry->bytearray_value = NULL; + } + success = TRUE; done: @@ -666,8 +686,11 @@ done: } +#define STR_ARRAY_CHUNK_SIZE 8 +#define STR_ARRAY_ITEM_SIZE (sizeof (char *)) + static dbus_bool_t _wpa_dbus_dict_entry_get_string_array( - DBusMessageIter *iter, int array_len, int array_type, + DBusMessageIter *iter, int array_type, struct wpa_dbus_dict_entry *entry) { dbus_uint32_t count = 0; @@ -677,13 +700,7 @@ static dbus_bool_t _wpa_dbus_dict_entry_ entry->strarray_value = NULL; entry->array_type = DBUS_TYPE_STRING; - /* Zero-length arrays are valid. */ - if (array_len == 0) { - success = TRUE; - goto done; - } - - buffer = wpa_zalloc(sizeof (char *) * 8); + buffer = wpa_zalloc(STR_ARRAY_ITEM_SIZE * STR_ARRAY_CHUNK_SIZE); if (buffer == NULL) { perror("_wpa_dbus_dict_entry_get_string_array[dbus] out of " "memory trying to retrieve a string array"); @@ -696,18 +713,15 @@ static dbus_bool_t _wpa_dbus_dict_entry_ const char *value; char *str; - if ((count % 8) == 0 && count != 0) { - char **tmp; - tmp = realloc(buffer, sizeof(char *) * (count + 8)); - if (tmp == NULL) { + if ((count % STR_ARRAY_CHUNK_SIZE) == 0 && count != 0) { + buffer = realloc(buffer, STR_ARRAY_ITEM_SIZE * + (count + STR_ARRAY_CHUNK_SIZE)); + if (buffer == NULL) { perror("_wpa_dbus_dict_entry_get_string_array[" "dbus] out of memory trying to " "retrieve the string array"); - free(buffer); - buffer = NULL; goto done; } - buffer = tmp; } entry->strarray_value = buffer; @@ -723,6 +737,13 @@ static dbus_bool_t _wpa_dbus_dict_entry_ entry->array_len = ++count; dbus_message_iter_next(iter); } + + /* Zero-length arrays are valid. */ + if (entry->array_len == 0) { + free(entry->strarray_value); + entry->strarray_value = NULL; + } + success = TRUE; done: @@ -734,7 +755,6 @@ static dbus_bool_t _wpa_dbus_dict_entry_ DBusMessageIter *iter_dict_val, struct wpa_dbus_dict_entry *entry) { int array_type = dbus_message_iter_get_element_type(iter_dict_val); - int array_len; dbus_bool_t success = FALSE; DBusMessageIter iter_array; @@ -743,20 +763,14 @@ static dbus_bool_t _wpa_dbus_dict_entry_ dbus_message_iter_recurse(iter_dict_val, &iter_array); - array_len = dbus_message_iter_get_array_len(&iter_array); - if (array_len < 0) - return FALSE; - switch (array_type) { case DBUS_TYPE_BYTE: success = _wpa_dbus_dict_entry_get_byte_array(&iter_array, - array_len, array_type, entry); break; case DBUS_TYPE_STRING: success = _wpa_dbus_dict_entry_get_string_array(&iter_array, - array_len, array_type, entry); break; @@ -946,9 +960,17 @@ void wpa_dbus_dict_entry_clear(struct wp break; case DBUS_TYPE_ARRAY: switch (entry->array_type) { - case DBUS_TYPE_BYTE: - free(entry->bytearray_value); - break; + case DBUS_TYPE_BYTE: { + free(entry->bytearray_value); + break; + } + case DBUS_TYPE_STRING: { + unsigned int i; + for (i = 0; i < entry->array_len; i++) + free(entry->strarray_value[i]); + free(entry->strarray_value); + break; + } } break; } Modified: head/contrib/wpa_supplicant/doc/docbook/wpa_background.8 ============================================================================== --- head/contrib/wpa_supplicant/doc/docbook/wpa_background.8 Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/doc/docbook/wpa_background.8 Tue Jan 27 22:18:04 2009 (r187791) @@ -3,7 +3,7 @@ .\" .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng . -.TH "WPA_BACKGROUND" "8" "19 February 2008" "" "" +.TH "WPA_BACKGROUND" "8" "28 November 2008" "" "" .SH NAME wpa_background \- Background information on Wi-Fi Protected Access and IEEE 802.11i Modified: head/contrib/wpa_supplicant/doc/docbook/wpa_cli.8 ============================================================================== --- head/contrib/wpa_supplicant/doc/docbook/wpa_cli.8 Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/doc/docbook/wpa_cli.8 Tue Jan 27 22:18:04 2009 (r187791) @@ -3,7 +3,7 @@ .\" .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng . -.TH "WPA_CLI" "8" "19 February 2008" "" "" +.TH "WPA_CLI" "8" "28 November 2008" "" "" .SH NAME wpa_cli \- WPA command line client @@ -57,17 +57,18 @@ current network. is description o case of OTP request, it includes the challenge from the authentication server. .PP -The reply to these requests can be given with 'identity', -'password', and 'otp' commands. needs to be copied from the -the matching request. 'password' and 'otp' commands can be used -regardless of whether the request was for PASSWORD or OTP. The -main difference between these two commands is that values given -with 'password' are remembered as long as wpa_supplicant is -running whereas values given with 'otp' are used only once and -then forgotten, i.e., wpa_supplicant will ask frontend for a new -value for every use. This can be used to implement -one-time-password lists and generic token card -based -authentication. +The reply to these requests can be given with +\fBidentity\fR, \fBpassword\fR, and +\fBotp\fR commands. needs to be copied from +the matching request. \fBpassword\fR and +\fBotp\fR commands can be used regardless of whether +the request was for PASSWORD or OTP. The main difference between these +two commands is that values given with \fBpassword\fR are +remembered as long as wpa_supplicant is running whereas values given +with \fBotp\fR are used only once and then forgotten, +i.e., wpa_supplicant will ask frontend for a new value for every use. +This can be used to implement one-time-password lists and generic token +card -based authentication. .PP Example request for password and a matching reply: .sp Modified: head/contrib/wpa_supplicant/doc/docbook/wpa_cli.sgml ============================================================================== --- head/contrib/wpa_supplicant/doc/docbook/wpa_cli.sgml Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/doc/docbook/wpa_cli.sgml Tue Jan 27 22:18:04 2009 (r187791) @@ -72,17 +72,18 @@ case of OTP request, it includes the challenge from the authentication server. - The reply to these requests can be given with 'identity', - 'password', and 'otp' commands. <id> needs to be copied from the - the matching request. 'password' and 'otp' commands can be used - regardless of whether the request was for PASSWORD or OTP. The - main difference between these two commands is that values given - with 'password' are remembered as long as wpa_supplicant is - running whereas values given with 'otp' are used only once and - then forgotten, i.e., wpa_supplicant will ask frontend for a new - value for every use. This can be used to implement - one-time-password lists and generic token card -based - authentication. + The reply to these requests can be given with + identity, password, and + otp commands. <id> needs to be copied from + the matching request. password and + otp commands can be used regardless of whether + the request was for PASSWORD or OTP. The main difference between these + two commands is that values given with password are + remembered as long as wpa_supplicant is running whereas values given + with otp are used only once and then forgotten, + i.e., wpa_supplicant will ask frontend for a new value for every use. + This can be used to implement one-time-password lists and generic token + card -based authentication. Example request for password and a matching reply: Modified: head/contrib/wpa_supplicant/doc/docbook/wpa_passphrase.8 ============================================================================== --- head/contrib/wpa_supplicant/doc/docbook/wpa_passphrase.8 Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/doc/docbook/wpa_passphrase.8 Tue Jan 27 22:18:04 2009 (r187791) @@ -3,7 +3,7 @@ .\" .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng . -.TH "WPA_PASSPHRASE" "8" "19 February 2008" "" "" +.TH "WPA_PASSPHRASE" "8" "28 November 2008" "" "" .SH NAME wpa_passphrase \- Generate a WPA PSK from an ASCII passphrase for a SSID Modified: head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.8 ============================================================================== --- head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.8 Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.8 Tue Jan 27 22:18:04 2009 (r187791) @@ -3,7 +3,7 @@ .\" .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng . -.TH "WPA_SUPPLICANT" "8" "19 February 2008" "" "" +.TH "WPA_SUPPLICANT" "8" "28 November 2008" "" "" .SH NAME wpa_supplicant \- Wi-Fi Protected Access client and IEEE 802.1X supplicant @@ -214,7 +214,11 @@ PMKSA caching .RE .SH "AVAILABLE DRIVERS" .PP -The available drivers to specify with the -D option are: +A summary of available driver backends is below. Support for each +of the driver backends is chosen at wpa_supplicant compile time. For a +list of supported driver backends that may be used with the -D option on +your system, refer to the help output of wpa_supplicant +(\fBwpa_supplicant -h\fR). .TP \fBhostap\fR (default) Host AP driver (Intersil Prism2/2.5/3). @@ -250,33 +254,47 @@ BSD 802.11 support (Atheros, etc.). \fBndis\fR Windows NDIS driver. .SH "COMMAND LINE OPTIONS" +.PP +Most command line options have global scope. Some are given per +interface, and are only valid if at least one \fB-i\fR option +is specified, otherwise they're ignored. Option groups for different +interfaces must be separated by \fB-N\fR option. +.TP +\fB-b br_ifname\fR +Optional bridge interface name. (Per interface) .TP \fB-B\fR Run daemon in the background. .TP \fB-i ifname\fR -Interface to listen on. +Interface to listen on. Multiple instances of this option can +be present, one per interface, separated by \fB-N\fR +option (see below). .TP \fB-c filename\fR -Path to configuration file. +Path to configuration file. (Per interface) .TP \fB-P PID_file\fR Path to PID file. .TP \fB-C ctrl_interface\fR -Path to ctrl_interface socket (only used if -c is not). +Path to ctrl_interface socket (Per interface. Only used if +\fB-c\fR is not). .TP \fB-g global ctrl_interface\fR -Path to global ctrl_interface socket. +Path to global ctrl_interface socket. If specified, interface +definitions may be omitted. .TP \fB-D driver\fR -Driver to use. See the available options below. +Driver to use. (Per interface, see the available options +below.) .TP \fB-f output file\fR Log output to specified file instead of stdout. .TP \fB-d\fR -Increase debugging verbosity (-dd even more). +Increase debugging verbosity (\fB-dd\fR even +more). .TP \fB-K\fR Include keys (passwords, etc.) in debug output. @@ -296,7 +314,12 @@ Help. Show a usage message. Show license (GPL and BSD). .TP \fB-q\fR -Decrease debugging verbosity (-qq even less). +Decrease debugging verbosity (\fB-qq\fR even +less). +.TP +\fB-u\fR +Enabled DBus control interface. If enabled, interface +definitions may be omitted. .TP \fB-v\fR Show version. @@ -367,9 +390,9 @@ with other versions) .TP \fBHost AP driver for Prism2/2.5/3 (development snapshot/v0.2.x)\fR (http://hostap.epitest.fi/) Driver needs to be set in -Managed mode ('iwconfig wlan0 mode managed'). Please note -that station firmware version needs to be 1.7.0 or newer to -work in WPA mode. +Managed mode (\fBiwconfig wlan0 mode managed\fR). +Please note that station firmware version needs to be 1.7.0 or +newer to work in WPA mode. .TP \fBLinuxant DriverLoader\fR (http://www.linuxant.com/driverloader/) @@ -506,8 +529,8 @@ can be used to enable WPA support: Add MODE="Managed" and WPA="y" to the network scheme in \fI/etc/pcmcia/wireless.opts\fR\&. .PP -Add the following block to the end of 'start' action handler -in \fI/etc/pcmcia/wireless\fR: +Add the following block to the end of \fBstart\fR +action handler in \fI/etc/pcmcia/wireless\fR: .sp .RS @@ -519,8 +542,8 @@ fi .fi .RE .PP -Add the following block to the end of 'stop' action handler -(may need to be separated from other actions) in +Add the following block to the end of \fBstop\fR +action handler (may need to be separated from other actions) in \fI/etc/pcmcia/wireless\fR: .sp .RS Modified: head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5 ============================================================================== --- head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5 Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5 Tue Jan 27 22:18:04 2009 (r187791) @@ -3,7 +3,7 @@ .\" .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng . -.TH "WPA_SUPPLICANT.CONF" "5" "19 February 2008" "" "" +.TH "WPA_SUPPLICANT.CONF" "5" "28 November 2008" "" "" .SH NAME wpa_supplicant.conf \- configuration file for wpa_supplicant @@ -24,7 +24,7 @@ run in the background. Changes to configuration file can be reloaded be sending SIGHUP signal to \fBwpa_supplicant\fR ('killall -HUP wpa_supplicant'). Similarly, reloading can be triggered with -the 'wpa_cli reconfigure' command. +the \fBwpa_cli reconfigure\fR command. .PP Configuration file can include one or more network blocks, e.g., one for each used SSID. wpa_supplicant will automatically @@ -179,7 +179,7 @@ network={ .TP 3 6. Authentication for wired Ethernet. This can be used with -'wired' interface (-Dwired on command line). +\fBwired\fR interface (-Dwired on command line). .sp .RS Modified: head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.conf.sgml ============================================================================== --- head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.conf.sgml Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.conf.sgml Tue Jan 27 22:18:04 2009 (r187791) @@ -26,7 +26,7 @@ Changes to configuration file can be reloaded be sending SIGHUP signal to wpa_supplicant ('killall -HUP wpa_supplicant'). Similarly, reloading can be triggered with - the 'wpa_cli reconfigure' command. + the wpa_cli reconfigure command. Configuration file can include one or more network blocks, e.g., one for each used SSID. wpa_supplicant will automatically @@ -179,7 +179,7 @@ network={ Authentication for wired Ethernet. This can be used with - 'wired' interface (-Dwired on command line). + wired interface (-Dwired on command line).
ctrl_interface=/var/run/wpa_supplicant Modified: head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.sgml ============================================================================== --- head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.sgml Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/doc/docbook/wpa_supplicant.sgml Tue Jan 27 22:18:04 2009 (r187791) @@ -241,7 +241,11 @@ Available Drivers - The available drivers to specify with the -D option are: + A summary of available driver backends is below. Support for each + of the driver backends is chosen at wpa_supplicant compile time. For a + list of supported driver backends that may be used with the -D option on + your system, refer to the help output of wpa_supplicant + (wpa_supplicant -h). @@ -326,8 +330,19 @@ Command Line Options + Most command line options have global scope. Some are given per + interface, and are only valid if at least one option + is specified, otherwise they're ignored. Option groups for different + interfaces must be separated by option. + -b br_ifname + + Optional bridge interface name. (Per interface) + + + + -B Run daemon in the background. @@ -337,14 +352,16 @@ -i ifname - Interface to listen on. + Interface to listen on. Multiple instances of this option can + be present, one per interface, separated by + option (see below). -c filename - Path to configuration file. + Path to configuration file. (Per interface) @@ -358,21 +375,24 @@ -C ctrl_interface - Path to ctrl_interface socket (only used if -c is not). + Path to ctrl_interface socket (Per interface. Only used if + is not). -g global ctrl_interface - Path to global ctrl_interface socket. + Path to global ctrl_interface socket. If specified, interface + definitions may be omitted. -D driver - Driver to use. See the available options below. + Driver to use. (Per interface, see the available options + below.) @@ -386,7 +406,8 @@ -d - Increase debugging verbosity (-dd even more). + Increase debugging verbosity ( even + more). @@ -430,9 +451,19 @@ -q - Decrease debugging verbosity (-qq even less). + Decrease debugging verbosity ( even + less). + + + -u + + Enabled DBus control interface. If enabled, interface + definitions may be omitted. + + + -v @@ -523,9 +554,9 @@ wpa_supplicant \ snapshot/v0.2.x) (http://hostap.epitest.fi/) Driver needs to be set in - Managed mode ('iwconfig wlan0 mode managed'). Please note - that station firmware version needs to be 1.7.0 or newer to - work in WPA mode. + Managed mode (iwconfig wlan0 mode managed). + Please note that station firmware version needs to be 1.7.0 or + newer to work in WPA mode. @@ -729,8 +760,8 @@ wpa_supplicant -iwlan0 -c/etc/wpa_suppli Add MODE="Managed" and WPA="y" to the network scheme in /etc/pcmcia/wireless.opts. - Add the following block to the end of 'start' action handler - in /etc/pcmcia/wireless: + Add the following block to the end of start + action handler in /etc/pcmcia/wireless:
if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then @@ -739,8 +770,8 @@ fi
- Add the following block to the end of 'stop' action handler - (may need to be separated from other actions) in + Add the following block to the end of stop + action handler (may need to be separated from other actions) in /etc/pcmcia/wireless:
Modified: head/contrib/wpa_supplicant/driver_ndis.c ============================================================================== --- head/contrib/wpa_supplicant/driver_ndis.c Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/driver_ndis.c Tue Jan 27 22:18:04 2009 (r187791) @@ -42,7 +42,9 @@ int close(int fd); #include "driver_ndis.h" int wpa_driver_register_event_cb(struct wpa_driver_ndis_data *drv); +#ifdef CONFIG_NDIS_EVENTS_INTEGRATED void wpa_driver_ndis_event_pipe_cb(void *eloop_data, void *user_data); +#endif /* CONFIG_NDIS_EVENTS_INTEGRATED */ static void wpa_driver_ndis_deinit(void *priv); static void wpa_driver_ndis_poll(void *drv); Modified: head/contrib/wpa_supplicant/eap.c ============================================================================== --- head/contrib/wpa_supplicant/eap.c Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/eap.c Tue Jan 27 22:18:04 2009 (r187791) @@ -892,7 +892,7 @@ static int eap_sm_imsi_identity(struct e #endif /* PCSC_FUNCS */ -static int eap_sm_get_scard_identity(struct eap_sm *sm, struct wpa_ssid *ssid) +static int eap_sm_set_scard_pin(struct eap_sm *sm, struct wpa_ssid *ssid) { #ifdef PCSC_FUNCS if (scard_set_pin(sm->scard_ctx, ssid->pin)) { @@ -907,6 +907,17 @@ static int eap_sm_get_scard_identity(str eap_sm_request_pin(sm); return -1; } + return 0; +#else /* PCSC_FUNCS */ + return -1; +#endif /* PCSC_FUNCS */ +} + +static int eap_sm_get_scard_identity(struct eap_sm *sm, struct wpa_ssid *ssid) +{ +#ifdef PCSC_FUNCS + if (eap_sm_set_scard_pin(sm, ssid)) + return -1; return eap_sm_imsi_identity(sm, ssid); #else /* PCSC_FUNCS */ @@ -973,6 +984,9 @@ u8 * eap_sm_buildIdentity(struct eap_sm eap_sm_request_identity(sm); return NULL; } + } else if (config->pcsc) { + if (eap_sm_set_scard_pin(sm, config) < 0) + return NULL; } *len = sizeof(struct eap_hdr) + 1 + identity_len; Modified: head/contrib/wpa_supplicant/eap_aka.c ============================================================================== --- head/contrib/wpa_supplicant/eap_aka.c Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/eap_aka.c Tue Jan 27 22:18:04 2009 (r187791) @@ -292,7 +292,7 @@ static u8 * eap_aka_response_challenge(s msg = eap_sim_msg_init(EAP_CODE_RESPONSE, req->identifier, EAP_TYPE_AKA, EAP_AKA_SUBTYPE_CHALLENGE); wpa_printf(MSG_DEBUG, " AT_RES"); - eap_sim_msg_add(msg, EAP_SIM_AT_RES, data->res_len, + eap_sim_msg_add(msg, EAP_SIM_AT_RES, data->res_len * 8, data->res, data->res_len); wpa_printf(MSG_DEBUG, " AT_MAC"); eap_sim_msg_add_mac(msg, EAP_SIM_AT_MAC); Modified: head/contrib/wpa_supplicant/eap_gpsk.c ============================================================================== --- head/contrib/wpa_supplicant/eap_gpsk.c Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/eap_gpsk.c Tue Jan 27 22:18:04 2009 (r187791) @@ -240,8 +240,8 @@ const u8 * eap_gpsk_process_csuite_list( return NULL; } if (*list_len == 0 || (*list_len % sizeof(struct eap_gpsk_csuite))) { - wpa_printf(MSG_DEBUG, "EAP-GPSK: Invalid CSuite_List len %d", - *list_len); + wpa_printf(MSG_DEBUG, "EAP-GPSK: Invalid CSuite_List len %lu", + (unsigned long) *list_len); return NULL; } *list = pos; @@ -460,6 +460,7 @@ const u8 * eap_gpsk_validate_id_server(s data->id_server, data->id_server_len); wpa_hexdump_ascii(MSG_DEBUG, "EAP-GPSK: ID_Server in GPSK-3", pos, len); + return NULL; } pos += len; @@ -537,7 +538,9 @@ const u8 * eap_gpsk_validate_gpsk_3_mic( miclen = eap_gpsk_mic_len(data->vendor, data->specifier); if (end - pos < (int) miclen) { wpa_printf(MSG_DEBUG, "EAP-GPSK: Message too short for MIC " - "(left=%d miclen=%d)", end - pos, miclen); + "(left=%lu miclen=%lu)", + (unsigned long) (end - pos), + (unsigned long) miclen); return NULL; } if (eap_gpsk_compute_mic(data->sk, data->sk_len, data->vendor, @@ -589,8 +592,9 @@ static u8 * eap_gpsk_process_gpsk_3(stru return NULL; } if (pos != end) { - wpa_printf(MSG_DEBUG, "EAP-GPSK: Ignored %d bytes of extra " - "data in the end of GPSK-2", end - pos); + wpa_printf(MSG_DEBUG, "EAP-GPSK: Ignored %lu bytes of extra " + "data in the end of GPSK-2", + (unsigned long) (end - pos)); } req = (const struct eap_hdr *) reqData; Modified: head/contrib/wpa_supplicant/eap_gpsk_common.c ============================================================================== --- head/contrib/wpa_supplicant/eap_gpsk_common.c Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/eap_gpsk_common.c Tue Jan 27 22:18:04 2009 (r187791) @@ -376,8 +376,8 @@ static int eap_gpsk_compute_mic_aes(cons const u8 *data, size_t len, u8 *mic) { if (sk_len != 16) { - wpa_printf(MSG_DEBUG, "EAP-GPSK: Invalid SK length %d for " - "AES-CMAC MIC", sk_len); + wpa_printf(MSG_DEBUG, "EAP-GPSK: Invalid SK length %lu for " + "AES-CMAC MIC", (unsigned long) sk_len); return -1; } Modified: head/contrib/wpa_supplicant/eap_ttls.c ============================================================================== --- head/contrib/wpa_supplicant/eap_ttls.c Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/eap_ttls.c Tue Jan 27 22:18:04 2009 (r187791) @@ -673,7 +673,7 @@ static int eap_ttls_phase2_request_mscha /* MS-CHAP-Challenge */ challenge = eap_ttls_implicit_challenge( - sm, data, EAP_TTLS_MSCHAPV2_CHALLENGE_LEN * 2 + 1); + sm, data, EAP_TTLS_MSCHAPV2_CHALLENGE_LEN + 1); if (challenge == NULL) { os_free(buf); wpa_printf(MSG_ERROR, "EAP-TTLS/MSCHAPV2: Failed to derive " @@ -777,7 +777,8 @@ static int eap_ttls_phase2_request_mscha config->identity, config->identity_len); /* MS-CHAP-Challenge */ - challenge = eap_ttls_implicit_challenge(sm, data, EAP_TLS_KEY_LEN); + challenge = eap_ttls_implicit_challenge( + sm, data, EAP_TTLS_MSCHAP_CHALLENGE_LEN + 1); if (challenge == NULL) { os_free(buf); wpa_printf(MSG_ERROR, "EAP-TTLS/MSCHAP: Failed to derive " @@ -907,7 +908,8 @@ static int eap_ttls_phase2_request_chap( config->identity, config->identity_len); /* CHAP-Challenge */ - challenge = eap_ttls_implicit_challenge(sm, data, EAP_TLS_KEY_LEN); + challenge = eap_ttls_implicit_challenge( + sm, data, EAP_TTLS_CHAP_CHALLENGE_LEN + 1); if (challenge == NULL) { os_free(buf); wpa_printf(MSG_ERROR, "EAP-TTLS/CHAP: Failed to derive " Modified: head/contrib/wpa_supplicant/eloop.c ============================================================================== --- head/contrib/wpa_supplicant/eloop.c Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/eloop.c Tue Jan 27 22:18:04 2009 (r187791) @@ -232,7 +232,10 @@ int eloop_register_timeout(unsigned int timeout = os_malloc(sizeof(*timeout)); if (timeout == NULL) return -1; - os_get_time(&timeout->time); + if (os_get_time(&timeout->time) < 0) { + os_free(timeout); + return -1; + } timeout->time.sec += secs; timeout->time.usec += usecs; while (timeout->time.usec >= 1000000) { @@ -302,6 +305,25 @@ int eloop_cancel_timeout(eloop_timeout_h } +int eloop_is_timeout_registered(eloop_timeout_handler handler, + void *eloop_data, void *user_data) +{ + struct eloop_timeout *tmp; + + tmp = eloop.timeout; + while (tmp != NULL) { + if (tmp->handler == handler && + tmp->eloop_data == eloop_data && + tmp->user_data == user_data) + return 1; + + tmp = tmp->next; + } + + return 0; +} + + #ifndef CONFIG_NATIVE_WINDOWS static void eloop_handle_alarm(int sig) { Modified: head/contrib/wpa_supplicant/eloop.h ============================================================================== --- head/contrib/wpa_supplicant/eloop.h Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/eloop.h Tue Jan 27 22:18:04 2009 (r187791) @@ -207,6 +207,19 @@ int eloop_cancel_timeout(eloop_timeout_h void *eloop_data, void *user_data); /** + * eloop_is_timeout_registered - Check if a timeout is already registered + * @handler: Matching callback function + * @eloop_data: Matching eloop_data + * @user_data: Matching user_data + * Returns: 1 if the timeout is registered, 0 if the timeout is not registered + * + * Determine if a matching timeout is registered + * with eloop_register_timeout(). + */ +int eloop_is_timeout_registered(eloop_timeout_handler handler, + void *eloop_data, void *user_data); + +/** * eloop_register_signal - Register handler for signals * @sig: Signal number (e.g., SIGHUP) * @handler: Callback function to be called when the signal is received Modified: head/contrib/wpa_supplicant/eloop_none.c ============================================================================== --- head/contrib/wpa_supplicant/eloop_none.c Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/eloop_none.c Tue Jan 27 22:18:04 2009 (r187791) @@ -197,6 +197,26 @@ int eloop_cancel_timeout(void (*handler) } +int eloop_is_timeout_registered(void (*handler)(void *eloop_ctx, + void *timeout_ctx), + void *eloop_data, void *user_data) +{ + struct eloop_timeout *tmp; + + tmp = eloop.timeout; + while (tmp != NULL) { + if (tmp->handler == handler && + tmp->eloop_data == eloop_data && + tmp->user_data == user_data) + return 1; + + tmp = tmp->next; + } + + return 0; +} + + /* TODO: replace with suitable signal handler */ #if 0 static void eloop_handle_signal(int sig) Modified: head/contrib/wpa_supplicant/mlme.c ============================================================================== --- head/contrib/wpa_supplicant/mlme.c Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/mlme.c Tue Jan 27 22:18:04 2009 (r187791) @@ -985,8 +985,6 @@ static void ieee80211_send_probe_req(str supp_rates[1] = 0; for (i = 0; i < wpa_s->mlme.num_curr_rates; i++) { struct wpa_rate_data *rate = &wpa_s->mlme.curr_rates[i]; - if (!(rate->flags & WPA_RATE_SUPPORTED)) - continue; if (esupp_rates) { pos = buf + len; len++; @@ -996,6 +994,7 @@ static void ieee80211_send_probe_req(str esupp_rates[0] = WLAN_EID_EXT_SUPP_RATES; esupp_rates[1] = 1; pos = &esupp_rates[2]; + len += 3; } else { pos = buf + len; len++; Modified: head/contrib/wpa_supplicant/os_unix.c ============================================================================== --- head/contrib/wpa_supplicant/os_unix.c Tue Jan 27 21:48:47 2009 (r187790) +++ head/contrib/wpa_supplicant/os_unix.c Tue Jan 27 22:18:04 2009 (r187791) @@ -216,7 +216,12 @@ char * os_readfile(const char *name, siz return NULL; } - fread(buf, 1, *len, f); + if (fread(buf, 1, *len, f) != *len) { + fclose(f); + free(buf); + return NULL; + } + fclose(f); return buf; Modified: head/contrib/wpa_supplicant/preauth_test.c ============================================================================== --- head/contrib/wpa_supplicant/preauth_test.c Tue Jan 27 21:48:47 2009 (r187790) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 22:24:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25DA61065680; Tue, 27 Jan 2009 22:24:10 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED37D8FC12; Tue, 27 Jan 2009 22:24:09 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RMO9ZK098568; Tue, 27 Jan 2009 22:24:09 GMT (envelope-from keramida@svn.freebsd.org) Received: (from keramida@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RMO93w098567; Tue, 27 Jan 2009 22:24:09 GMT (envelope-from keramida@svn.freebsd.org) Message-Id: <200901272224.n0RMO93w098567@svn.freebsd.org> From: Giorgos Keramidas Date: Tue, 27 Jan 2009 22:24:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187792 - head/share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 22:24:10 -0000 Author: keramida (doc committer) Date: Tue Jan 27 22:24:09 2009 New Revision: 187792 URL: http://svn.freebsd.org/changeset/base/187792 Log: Bump .Dd for r187782. Modified: head/share/man/man5/rc.conf.5 Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Tue Jan 27 22:18:04 2009 (r187791) +++ head/share/man/man5/rc.conf.5 Tue Jan 27 22:24:09 2009 (r187792) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 25, 2009 +.Dd January 27, 2009 .Dt RC.CONF 5 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 22:43:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A476710657C5; Tue, 27 Jan 2009 22:43:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F7038FC16; Tue, 27 Jan 2009 22:43:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RMhWHf098942; Tue, 27 Jan 2009 22:43:32 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RMhWYZ098941; Tue, 27 Jan 2009 22:43:32 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901272243.n0RMhWYZ098941@svn.freebsd.org> From: Sam Leffler Date: Tue, 27 Jan 2009 22:43:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187793 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 22:43:37 -0000 Author: sam Date: Tue Jan 27 22:43:32 2009 New Revision: 187793 URL: http://svn.freebsd.org/changeset/base/187793 Log: define IEEE80211_CHAN_108A and IEEE80211_CHAN_108G in terms of their non-turbo names to make the relationship more clear Modified: head/sys/net80211/_ieee80211.h Modified: head/sys/net80211/_ieee80211.h ============================================================================== --- head/sys/net80211/_ieee80211.h Tue Jan 27 22:24:09 2009 (r187792) +++ head/sys/net80211/_ieee80211.h Tue Jan 27 22:43:32 2009 (r187793) @@ -186,9 +186,9 @@ struct ieee80211_channel { #define IEEE80211_CHAN_G \ (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN) #define IEEE80211_CHAN_108A \ - (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO) + (IEEE80211_CHAN_A | IEEE80211_CHAN_TURBO) #define IEEE80211_CHAN_108G \ - (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO) + (IEEE80211_CHAN_PUREG | IEEE80211_CHAN_TURBO) #define IEEE80211_CHAN_ST \ (IEEE80211_CHAN_108A | IEEE80211_CHAN_STURBO) From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 22:45:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 878A51065966; Tue, 27 Jan 2009 22:45:31 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 731F78FC1E; Tue, 27 Jan 2009 22:45:31 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RMjVWc099032; Tue, 27 Jan 2009 22:45:31 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RMjVhD099031; Tue, 27 Jan 2009 22:45:31 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901272245.n0RMjVhD099031@svn.freebsd.org> From: Sam Leffler Date: Tue, 27 Jan 2009 22:45:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187794 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 22:45:35 -0000 Author: sam Date: Tue Jan 27 22:45:31 2009 New Revision: 187794 URL: http://svn.freebsd.org/changeset/base/187794 Log: change IEEE80211_IS_CHAN_OFDM and IEEE80211_IS_CHAN_CCK to return true for 11g (dynamic CCK/OFDM) Modified: head/sys/net80211/_ieee80211.h Modified: head/sys/net80211/_ieee80211.h ============================================================================== --- head/sys/net80211/_ieee80211.h Tue Jan 27 22:43:32 2009 (r187793) +++ head/sys/net80211/_ieee80211.h Tue Jan 27 22:45:31 2009 (r187794) @@ -226,9 +226,9 @@ struct ieee80211_channel { #define IEEE80211_IS_CHAN_PASSIVE(_c) \ (((_c)->ic_flags & IEEE80211_CHAN_PASSIVE) != 0) #define IEEE80211_IS_CHAN_OFDM(_c) \ - (((_c)->ic_flags & IEEE80211_CHAN_OFDM) != 0) + (((_c)->ic_flags & (IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN)) != 0) #define IEEE80211_IS_CHAN_CCK(_c) \ - (((_c)->ic_flags & IEEE80211_CHAN_CCK) != 0) + (((_c)->ic_flags & (IEEE80211_CHAN_CCK | IEEE80211_CHAN_DYN)) != 0) #define IEEE80211_IS_CHAN_GFSK(_c) \ (((_c)->ic_flags & IEEE80211_CHAN_GFSK) != 0) #define IEEE80211_IS_CHAN_TURBO(_c) \ From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 22:46:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC12110659A3; Tue, 27 Jan 2009 22:46:34 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3B258FC17; Tue, 27 Jan 2009 22:46:34 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RMkYTT099084; Tue, 27 Jan 2009 22:46:34 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RMkYsl099083; Tue, 27 Jan 2009 22:46:34 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901272246.n0RMkYsl099083@svn.freebsd.org> From: Sam Leffler Date: Tue, 27 Jan 2009 22:46:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187795 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 22:46:38 -0000 Author: sam Date: Tue Jan 27 22:46:34 2009 New Revision: 187795 URL: http://svn.freebsd.org/changeset/base/187795 Log: add new state bit to indicate when interference is observed on the channel Modified: head/sys/net80211/_ieee80211.h Modified: head/sys/net80211/_ieee80211.h ============================================================================== --- head/sys/net80211/_ieee80211.h Tue Jan 27 22:45:31 2009 (r187794) +++ head/sys/net80211/_ieee80211.h Tue Jan 27 22:46:34 2009 (r187795) @@ -276,12 +276,15 @@ struct ieee80211_channel { /* dynamic state */ #define IEEE80211_CHANSTATE_RADAR 0x01 /* radar detected */ #define IEEE80211_CHANSTATE_CACDONE 0x02 /* CAC completed */ +#define IEEE80211_CHANSTATE_CWINT 0x04 /* interference detected */ #define IEEE80211_CHANSTATE_NORADAR 0x10 /* post notify on radar clear */ #define IEEE80211_IS_CHAN_RADAR(_c) \ (((_c)->ic_state & IEEE80211_CHANSTATE_RADAR) != 0) #define IEEE80211_IS_CHAN_CACDONE(_c) \ (((_c)->ic_state & IEEE80211_CHANSTATE_CACDONE) != 0) +#define IEEE80211_IS_CHAN_CWINT(_c) \ + (((_c)->ic_state & IEEE80211_CHANSTATE_CWINT) != 0) /* ni_chan encoding for FH phy */ #define IEEE80211_FH_CHANMOD 80 From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 22:48:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5371A1065790; Tue, 27 Jan 2009 22:48:47 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3FD218FC1A; Tue, 27 Jan 2009 22:48:47 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RMmloe099174; Tue, 27 Jan 2009 22:48:47 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RMmlXm099173; Tue, 27 Jan 2009 22:48:47 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901272248.n0RMmlXm099173@svn.freebsd.org> From: Sam Leffler Date: Tue, 27 Jan 2009 22:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187796 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 22:48:49 -0000 Author: sam Date: Tue Jan 27 22:48:46 2009 New Revision: 187796 URL: http://svn.freebsd.org/changeset/base/187796 Log: fill in ieee channel #'s and max tx power for drivers that work exclusively with frequencies; this mimics how ieee80211_setregdomain works Modified: head/sys/net80211/ieee80211.c Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Tue Jan 27 22:46:34 2009 (r187795) +++ head/sys/net80211/ieee80211.c Tue Jan 27 22:48:46 2009 (r187796) @@ -126,6 +126,21 @@ ieee80211_chan_init(struct ieee80211com for (i = 0; i < ic->ic_nchans; i++) { c = &ic->ic_channels[i]; KASSERT(c->ic_flags != 0, ("channel with no flags")); + /* + * Help drivers that work only with frequencies by filling + * in IEEE channel #'s if not already calculated. Note this + * mimics similar work done in ieee80211_setregdomain when + * changing regulatory state. + */ + if (c->ic_ieee == 0) + c->ic_ieee = ieee80211_mhz2ieee(c->ic_freq,c->ic_flags); + if (IEEE80211_IS_CHAN_HT40(c) && c->ic_extieee == 0) + c->ic_extieee = ieee80211_mhz2ieee(c->ic_freq + + (IEEE80211_IS_CHAN_HT40U(c) ? 20 : -20), + c->ic_flags); + /* default max tx power to max regulatory */ + if (c->ic_maxpower == 0) + c->ic_maxpower = 2*c->ic_maxregpower; setbit(ic->ic_chan_avail, c->ic_ieee); /* * Identify mode capabilities. From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 23:00:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A6541065AF9; Tue, 27 Jan 2009 23:00:39 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E76848FC26; Tue, 27 Jan 2009 23:00:38 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RN0ckf099443; Tue, 27 Jan 2009 23:00:38 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RN0cpV099436; Tue, 27 Jan 2009 23:00:38 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901272300.n0RN0cpV099436@svn.freebsd.org> From: Sam Leffler Date: Tue, 27 Jan 2009 23:00:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187797 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 23:00:42 -0000 Author: sam Date: Tue Jan 27 23:00:38 2009 New Revision: 187797 URL: http://svn.freebsd.org/changeset/base/187797 Log: o make %b msg bit defines public (to user apps too) o rename IEEE80211_C_CRYPTO_BITS to IEEE80211_CRYPTO_BITS Modified: head/sys/net80211/_ieee80211.h head/sys/net80211/ieee80211.h head/sys/net80211/ieee80211_crypto.h head/sys/net80211/ieee80211_ddb.c head/sys/net80211/ieee80211_ht.h head/sys/net80211/ieee80211_node.h head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/_ieee80211.h ============================================================================== --- head/sys/net80211/_ieee80211.h Tue Jan 27 22:48:46 2009 (r187796) +++ head/sys/net80211/_ieee80211.h Tue Jan 27 23:00:38 2009 (r187797) @@ -172,6 +172,11 @@ struct ieee80211_channel { #define IEEE80211_CHAN_HT40 (IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D) #define IEEE80211_CHAN_HT (IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40) +#define IEEE80211_CHAN_BITS \ + "\20\1PRIV0\2PRIV2\3PRIV3\4PRIV4\5TURBO\6CCK\7OFDM\0102GHZ\0115GHZ" \ + "\12PASSIVE\13DYN\14GFSK\15GSM\16STURBO\17HALF\20QUARTER\21HT20" \ + "\22HT40U\23HT40D\24DFS\0254MSXMIT\26NOADHOC\27NOHOSTAP\03011D" + /* * Useful combinations of channel characteristics. */ Modified: head/sys/net80211/ieee80211.h ============================================================================== --- head/sys/net80211/ieee80211.h Tue Jan 27 22:48:46 2009 (r187796) +++ head/sys/net80211/ieee80211.h Tue Jan 27 23:00:38 2009 (r187797) @@ -502,6 +502,11 @@ struct ieee80211_frame_bar { #define IEEE80211_CAPINFO_DSSSOFDM 0x2000 /* bits 14-15 are reserved */ +#define IEEE80211_CAPINFO_BITS \ + "\20\1ESS\2IBSS\3CF_POLLABLE\4CF_POLLREQ\5PRIVACY\6SHORT_PREAMBLE" \ + "\7PBCC\10CHNL_AGILITY\11SPECTRUM_MGMT\13SHORT_SLOTTIME\14RSN" \ + "\16DSSOFDM" + /* * 802.11i/WPA information element (maximally sized). */ @@ -562,6 +567,11 @@ struct ieee80211_ie_htcap { #define IEEE80211_HTCAP_40INTOLERANT 0x4000 /* 40MHz intolerant */ #define IEEE80211_HTCAP_LSIGTXOPPROT 0x8000 /* L-SIG TXOP prot */ +#define IEEE80211_HTCAP_BITS \ + "\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \ + "\13DELBA\14AMSDU(7935)\15DSSSCCK40\16PSMP\1740INTOLERANT" \ + "\20LSIGTXOPPROT" + /* HT parameters (hc_param) */ #define IEEE80211_HTCAP_MAXRXAMPDU 0x03 /* max rx A-MPDU factor */ #define IEEE80211_HTCAP_MAXRXAMPDU_S 0 @@ -754,6 +764,9 @@ struct ieee80211_ath_ie { #define IEEE80211_ERP_USE_PROTECTION 0x02 #define IEEE80211_ERP_LONG_PREAMBLE 0x04 +#define IEEE80211_ERP_BITS \ + "\20\1NON_ERP_PRESENT\2USE_PROTECTION\3LONG_PREAMBLE" + #define ATH_OUI 0x7f0300 /* Atheros OUI */ #define ATH_OUI_TYPE 0x01 #define ATH_OUI_SUBTYPE 0x01 Modified: head/sys/net80211/ieee80211_crypto.h ============================================================================== --- head/sys/net80211/ieee80211_crypto.h Tue Jan 27 22:48:46 2009 (r187796) +++ head/sys/net80211/ieee80211_crypto.h Tue Jan 27 23:00:38 2009 (r187797) @@ -131,6 +131,9 @@ struct ieee80211_key { #define IEEE80211_CRYPTO_TKIPMIC (1< #include -#define IEEE80211_MSG_BITS \ - "\20\3IOCTL\4WDS\5ACTION\6RATECTL\7ROAM\10INACT\11DOTH\12SUPERG" \ - "\13WME\14ACL\15WPA\16RADKEYS\17RADDUMP\20RADIUS\21DOT1X\22POWER" \ - "\23STATE\24OUTPUT\25SCAN\26AUTH\27ASSOC\30NODE\31ELEMID\32XRATE" \ - "\33INPUT\34CRYPTO\35DUPMPKTS\36DEBUG\3711N" - -#define IEEE80211_F_BITS \ - "\20\1TURBOP\2COMP\3FF\4BURST\5PRIVACY\6PUREG\10SCAN\11ASCAN\12SIBSS" \ - "\13SHSLOT\14PMGTON\15DESBSSID\16WME\17BGSCAN\20SWRETRY\21TXPOW_FIXED" \ - "\22IBSSON\23SHPREAMBLE\24DATAPAD\25USEPROT\26USERBARKER\27CSAPENDING" \ - "\30WPA1\31WPA2\32DROPUNENC\33COUNTERM\34HIDESSID\35NOBRIDG\36PCF" \ - "\37DOTH\40DWDS" - -#define IEEE80211_FEXT_BITS \ - "\20\1NONHT_PR\2INACT\3SCANWAIT\4BGSCAN\5WPS\6TSN\7SCANREQ\10RESUME" \ - "\12NONEPR_PR\13SWBMISS\14DFS\15DOTD\22WDSLEGACY\23PROBECHAN\24HT" \ - "\25AMDPU_TX\26AMPDU_TX\27AMSDU_TX\30AMSDU_RX\31USEHT40\32PUREN" \ - "\33SHORTGI20\34SHORTGI40\35HTCOMPAT\36RIFS" - -#define IEEE80211_FVEN_BITS "\20" - -#define IEEE80211_C_BITS \ - "\20\1STA\7FF\10TURBOP\11IBSS\12PMGT" \ - "\13HOSTAP\14AHDEMO\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE" \ - "\21MONITOR\22DFS\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \ - "\37TXFRAG\40TDMA" - -#define IEEE80211_C_CRYPTO_BITS \ - "\20\1WEP\2TKIP\3AES\4AES_CCM\5TKIPMIC\6CKIP\12PMGT" - -#define IEEE80211_C_HTCAP_BITS \ - "\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \ - "\21AMPDU\22AMSDU\23HT\24SMPS\25RIFS" - -/* NB: policy bits not included */ -#define IEEE80211_CHAN_BITS \ - "\20\5TURBO\6CCK\7OFDM\0102GHZ\0115GHZ\12PASSIVE\13DYN\14GFSK" \ - "\15STURBO\16HALF\17QUARTER\20HT20\21HT40U\22HT40D\23DFS" - -#define IEEE80211_NODE_BITS \ - "\20\1AUTH\2QOS\3ERP\5PWR_MGT\6AREF\7HT\10HTCOMPAT\11WPS\12TSN" \ - "\13AMPDU_RX\14AMPDU_TX\15MIMO_PS\16MIMO_RTS\17RIFS\20SGI20\21SGI40" \ - "\22ASSOCID" - -#define IEEE80211_ERP_BITS \ - "\20\1NON_ERP_PRESENT\2USE_PROTECTION\3LONG_PREAMBLE" - -#define IEEE80211_CAPINFO_BITS \ - "\20\1ESS\2IBSS\3CF_POLLABLE\4CF_POLLREQ\5PRIVACY\6SHORT_PREAMBLE" \ - "\7PBCC\10CHNL_AGILITY\11SPECTRUM_MGMT\13SHORT_SLOTTIME\14RSN" \ - "\16DSSOFDM" - -#define IEEE80211_HTCAP_BITS \ - "\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \ - "\13DELBA\14AMSDU(7935)\15DSSSCCK40\16PSMP\1740INTOLERANT" \ - "\20LSIGTXOPPROT" - -#define IEEE80211_AGGR_BITS \ - "\20\1IMMEDIATE\2XCHGPEND\3RUNNING\4SETUP\5NAK" - #define DB_PRINTSYM(prefix, addr) \ db_printf(prefix " "); \ db_printsym((db_addr_t) addr, DB_STGY_ANY); \ @@ -501,7 +441,7 @@ _db_show_com(const struct ieee80211com * db_printf("\tflags_ven=%b\n", ic->ic_flags_ven, IEEE80211_FVEN_BITS); db_printf("\tcaps=%b\n", ic->ic_caps, IEEE80211_C_BITS); db_printf("\tcryptocaps=%b\n", - ic->ic_cryptocaps, IEEE80211_C_CRYPTO_BITS); + ic->ic_cryptocaps, IEEE80211_CRYPTO_BITS); db_printf("\thtcaps=%b\n", ic->ic_htcaps, IEEE80211_HTCAP_BITS); #if 0 Modified: head/sys/net80211/ieee80211_ht.h ============================================================================== --- head/sys/net80211/ieee80211_ht.h Tue Jan 27 22:48:46 2009 (r187796) +++ head/sys/net80211/ieee80211_ht.h Tue Jan 27 23:00:38 2009 (r187797) @@ -71,6 +71,9 @@ struct ieee80211_tx_ampdu { (((tap)->txa_flags & \ (IEEE80211_AGGR_RUNNING|IEEE80211_AGGR_XCHGPEND|IEEE80211_AGGR_NAK)) != 0) +#define IEEE80211_AGGR_BITS \ + "\20\1IMMEDIATE\2XCHGPEND\3RUNNING\4SETUP\5NAK" + /* * Traffic estimator support. We estimate packets/sec for * each AC that is setup for AMPDU or will potentially be Modified: head/sys/net80211/ieee80211_node.h ============================================================================== --- head/sys/net80211/ieee80211_node.h Tue Jan 27 22:48:46 2009 (r187796) +++ head/sys/net80211/ieee80211_node.h Tue Jan 27 23:00:38 2009 (r187797) @@ -206,6 +206,11 @@ MALLOC_DECLARE(M_80211_NODE_IE); IEEE80211_NODE_MIMO_RTS | IEEE80211_NODE_RIFS | \ IEEE80211_NODE_SGI20 | IEEE80211_NODE_SGI40) +#define IEEE80211_NODE_BITS \ + "\20\1AUTH\2QOS\3ERP\5PWR_MGT\6AREF\7HT\10HTCOMPAT\11WPS\12TSN" \ + "\13AMPDU_RX\14AMPDU_TX\15MIMO_PS\16MIMO_RTS\17RIFS\20SGI20\21SGI40" \ + "\22ASSOCID" + #define IEEE80211_NODE_AID(ni) IEEE80211_AID(ni->ni_associd) #define IEEE80211_NODE_STAT(ni,stat) (ni->ni_stats.ns_##stat++) Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Tue Jan 27 22:48:46 2009 (r187796) +++ head/sys/net80211/ieee80211_var.h Tue Jan 27 23:00:38 2009 (r187797) @@ -469,6 +469,13 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_F_DOTH 0x40000000 /* CONF: 11h enabled */ #define IEEE80211_F_DWDS 0x80000000 /* CONF: Dynamic WDS enabled */ +#define IEEE80211_F_BITS \ + "\20\1TURBOP\2COMP\3FF\4BURST\5PRIVACY\6PUREG\10SCAN\11ASCAN\12SIBSS" \ + "\13SHSLOT\14PMGTON\15DESBSSID\16WME\17BGSCAN\20SWRETRY\21TXPOW_FIXED" \ + "\22IBSSON\23SHPREAMBLE\24DATAPAD\25USEPROT\26USERBARKER\27CSAPENDING" \ + "\30WPA1\31WPA2\32DROPUNENC\33COUNTERM\34HIDESSID\35NOBRIDG\36PCF" \ + "\37DOTH\40DWDS" + /* Atheros protocol-specific flags */ #define IEEE80211_F_ATHEROS \ (IEEE80211_F_FF | IEEE80211_F_COMP | IEEE80211_F_TURBOP) @@ -505,6 +512,14 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_FEXT_HTCOMPAT 0x10000000 /* CONF: HT vendor OUI's */ #define IEEE80211_FEXT_RIFS 0x20000000 /* CONF: RIFS enabled */ +#define IEEE80211_FEXT_BITS \ + "\20\1NONHT_PR\2INACT\3SCANWAIT\4BGSCAN\5WPS\6TSN\7SCANREQ\10RESUME" \ + "\12NONEPR_PR\13SWBMISS\14DFS\15DOTD\22WDSLEGACY\23PROBECHAN\24HT" \ + "\25AMDPU_TX\26AMPDU_TX\27AMSDU_TX\30AMSDU_RX\31USEHT40\32PUREN" \ + "\33SHORTGI20\34SHORTGI40\35HTCOMPAT\36RIFS" + +#define IEEE80211_FVEN_BITS "\20" + /* ic_caps/iv_caps: device driver capabilities */ /* 0x2f available */ #define IEEE80211_C_STA 0x00000001 /* CAPABILITY: STA available */ @@ -538,6 +553,12 @@ MALLOC_DECLARE(M_80211_VAP); IEEE80211_C_AHDEMO | IEEE80211_C_MONITOR | IEEE80211_C_WDS | \ IEEE80211_C_TDMA) +#define IEEE80211_C_BITS \ + "\20\1STA\7FF\10TURBOP\11IBSS\12PMGT" \ + "\13HOSTAP\14AHDEMO\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE" \ + "\21MONITOR\22DFS\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \ + "\37TXFRAG\40TDMA" + /* * ic_htcaps/iv_htcaps: HT-specific device/driver capabilities * @@ -551,6 +572,10 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_HTC_SMPS 0x00080000 /* CAPABILITY: MIMO power save*/ #define IEEE80211_HTC_RIFS 0x00100000 /* CAPABILITY: RIFS support */ +#define IEEE80211_C_HTCAP_BITS \ + "\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \ + "\21AMPDU\22AMSDU\23HT\24SMPS\25RIFS" + void ieee80211_ifattach(struct ieee80211com *); void ieee80211_ifdetach(struct ieee80211com *); int ieee80211_vap_setup(struct ieee80211com *, struct ieee80211vap *, @@ -694,6 +719,12 @@ ieee80211_htchanflags(const struct ieee8 #define IEEE80211_MSG_ANY 0xffffffff /* anything */ +#define IEEE80211_MSG_BITS \ + "\20\3IOCTL\4WDS\5ACTION\6RATECTL\7ROAM\10INACT\11DOTH\12SUPERG" \ + "\13WME\14ACL\15WPA\16RADKEYS\17RADDUMP\20RADIUS\21DOT1X\22POWER" \ + "\23STATE\24OUTPUT\25SCAN\26AUTH\27ASSOC\30NODE\31ELEMID\32XRATE" \ + "\33INPUT\34CRYPTO\35DUPMPKTS\36DEBUG\3711N" + #ifdef IEEE80211_DEBUG #define ieee80211_msg(_vap, _m) ((_vap)->iv_debug & (_m)) #define IEEE80211_DPRINTF(_vap, _m, _fmt, ...) do { \ From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 23:01:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8392E1065DAD; Tue, 27 Jan 2009 23:01:14 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F5CD8FC24; Tue, 27 Jan 2009 23:01:14 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RN1E29099493; Tue, 27 Jan 2009 23:01:14 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RN1Eki099492; Tue, 27 Jan 2009 23:01:14 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901272301.n0RN1Eki099492@svn.freebsd.org> From: Sam Leffler Date: Tue, 27 Jan 2009 23:01:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187798 - head/sbin/ifconfig X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 23:01:18 -0000 Author: sam Date: Tue Jan 27 23:01:14 2009 New Revision: 187798 URL: http://svn.freebsd.org/changeset/base/187798 Log: remove %b msg bit defines now public Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Tue Jan 27 23:00:38 2009 (r187797) +++ head/sbin/ifconfig/ifieee80211.c Tue Jan 27 23:01:14 2009 (r187798) @@ -3256,13 +3256,6 @@ list_keys(int s) "\21MONITOR\22DFS\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \ "\37TXFRAG\40TDMA" -#define IEEE80211_CRYPTO_BITS \ - "\20\1WEP\2TKIP\3AES\4AES_CCM\5TKIPMIC\6CKIP\12PMGT" - -#define IEEE80211_HTCAP_BITS \ - "\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \ - "\21AMPDU\22AMSDU\23HT" - static void list_capabilities(int s) { From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 23:06:52 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A8021065F0D; Tue, 27 Jan 2009 23:06:52 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (farley.org [67.64.95.201]) by mx1.freebsd.org (Postfix) with ESMTP id EC4298FC16; Tue, 27 Jan 2009 23:06:50 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from thor.farley.org (HPooka@thor.farley.org [192.168.1.5]) by mail.farley.org (8.14.3/8.14.3) with ESMTP id n0RN6mo9041913; Tue, 27 Jan 2009 17:06:48 -0600 (CST) (envelope-from scf@FreeBSD.org) Date: Tue, 27 Jan 2009 17:06:48 -0600 (CST) From: "Sean C. Farley" To: Sam Leffler In-Reply-To: <200901272218.n0RMI4O6098370@svn.freebsd.org> Message-ID: References: <200901272218.n0RMI4O6098370@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-4.4 required=3.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.farley.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r187791 - in head/contrib/wpa_supplicant: . doc/docbook wpa_gui wpa_gui-qt4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 23:06:54 -0000 On Tue, 27 Jan 2009, Sam Leffler wrote: > Author: sam > Date: Tue Jan 27 22:18:04 2009 > New Revision: 187791 > URL: http://svn.freebsd.org/changeset/base/187791 > > Log: > update to 0.5.11: some useful bug fixes (check ChangeLog) Thank you! I just wish to note for reference that this allows my laptop to connect to a recently updated Aruba AP where it would not with 0.5.10. Sean -- scf@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 23:09:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3488B10656EA; Tue, 27 Jan 2009 23:09:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 20DBF8FC0C; Tue, 27 Jan 2009 23:09:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RN9uiW099662; Tue, 27 Jan 2009 23:09:56 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RN9uhA099661; Tue, 27 Jan 2009 23:09:56 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901272309.n0RN9uhA099661@svn.freebsd.org> From: Sam Leffler Date: Tue, 27 Jan 2009 23:09:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187799 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 23:09:58 -0000 Author: sam Date: Tue Jan 27 23:09:55 2009 New Revision: 187799 URL: http://svn.freebsd.org/changeset/base/187799 Log: o add country codes from Atheros regulatory; these are not listed in the ISO tables, mark them accordingly o add sku's for handling 900MHz cards o add opaque struct defs and change []'s to *'s so this file can be included w/o requiring all of net80211 to be pulled in o make CTRY_DEBUG and CTRY_DEFAULT public Modified: head/sys/net80211/ieee80211_regdomain.h Modified: head/sys/net80211/ieee80211_regdomain.h ============================================================================== --- head/sys/net80211/ieee80211_regdomain.h Tue Jan 27 23:01:14 2009 (r187798) +++ head/sys/net80211/ieee80211_regdomain.h Tue Jan 27 23:09:55 2009 (r187799) @@ -142,11 +142,6 @@ enum ISOCountryCode { CTRY_ITALY = 380, /* Italy */ CTRY_JAMAICA = 388, /* Jamaica */ CTRY_JAPAN = 392, /* Japan */ - CTRY_JAPAN1 = 393, /* Japan (JP1) */ - CTRY_JAPAN2 = 394, /* Japan (JP0) */ - CTRY_JAPAN3 = 395, /* Japan (JP1-1) */ - CTRY_JAPAN4 = 396, /* Japan (JE1) */ - CTRY_JAPAN5 = 397, /* Japan (JE2) */ CTRY_JORDAN = 400, /* Jordan */ CTRY_KAZAKHSTAN = 398, /* Kazakhstan */ CTRY_KENYA = 404, /* Kenya */ @@ -209,6 +204,38 @@ enum ISOCountryCode { CTRY_VIET_NAM = 704, /* Viet Nam */ CTRY_YEMEN = 887, /* Yemen */ CTRY_ZIMBABWE = 716, /* Zimbabwe */ + + /* NB: from here down not listed in 3166; they come from Atheros */ + CTRY_DEBUG = 0x1ff, /* debug */ + CTRY_DEFAULT = 0, /* default */ + + CTRY_UNITED_STATES_FCC49 = 842, /* United States (Public Safety)*/ + CTRY_KOREA_ROC3 = 412, /* South Korea */ + + CTRY_JAPAN1 = 393, /* Japan (JP1) */ + CTRY_JAPAN2 = 394, /* Japan (JP0) */ + CTRY_JAPAN3 = 395, /* Japan (JP1-1) */ + CTRY_JAPAN4 = 396, /* Japan (JE1) */ + CTRY_JAPAN5 = 397, /* Japan (JE2) */ + CTRY_JAPAN6 = 399, /* Japan (JP6) */ + CTRY_JAPAN7 = 4007, /* Japan (J7) */ + CTRY_JAPAN8 = 4008, /* Japan (J8) */ + CTRY_JAPAN9 = 4009, /* Japan (J9) */ + CTRY_JAPAN10 = 4010, /* Japan (J10) */ + CTRY_JAPAN11 = 4011, /* Japan (J11) */ + CTRY_JAPAN12 = 4012, /* Japan (J12) */ + CTRY_JAPAN13 = 4013, /* Japan (J13) */ + CTRY_JAPAN14 = 4014, /* Japan (J14) */ + CTRY_JAPAN15 = 4015, /* Japan (J15) */ + CTRY_JAPAN16 = 4016, /* Japan (J16) */ + CTRY_JAPAN17 = 4017, /* Japan (J17) */ + CTRY_JAPAN18 = 4018, /* Japan (J18) */ + CTRY_JAPAN19 = 4019, /* Japan (J19) */ + CTRY_JAPAN20 = 4020, /* Japan (J20) */ + CTRY_JAPAN21 = 4021, /* Japan (J21) */ + CTRY_JAPAN22 = 4022, /* Japan (J22) */ + CTRY_JAPAN23 = 4023, /* Japan (J23) */ + CTRY_JAPAN24 = 4024, /* Japan (J24) */ }; enum RegdomainCode { @@ -225,21 +252,27 @@ enum RegdomainCode { SKU_APAC3 = 0x5d, /* Asia Pacific w/o ISM band */ SKU_ROW = 0x81, /* China/Taiwan/Rest of World */ SKU_NONE = 0xf0, /* "Region Free" */ - SKU_DEBUG = 0x1ff + SKU_DEBUG = 0x1ff, + + /* NB: from here down private */ + SKU_SR9 = 0x0298, /* Ubiquiti SR9 (900MHz/GSM) */ + SKU_XR9 = 0x0299, /* Ubiquiti XR9 (900MHz/GSM) */ + SKU_GZ901 = 0x029a, /* Zcomax GZ-901 (900MHz/GSM) */ }; #if defined(__KERNEL__) || defined(_KERNEL) -#define CTRY_DEBUG 0x1ff /* debug */ -#define CTRY_DEFAULT 0 /* default */ - +struct ieee80211com; void ieee80211_regdomain_attach(struct ieee80211com *); void ieee80211_regdomain_detach(struct ieee80211com *); +struct ieee80211vap; void ieee80211_regdomain_vattach(struct ieee80211vap *); void ieee80211_regdomain_vdetach(struct ieee80211vap *); +struct ieee80211_regdomain; int ieee80211_init_channels(struct ieee80211com *, const struct ieee80211_regdomain *, const uint8_t bands[]); -void ieee80211_sort_channels(struct ieee80211_channel chans[], int nchans); +struct ieee80211_channel; +void ieee80211_sort_channels(struct ieee80211_channel *chans, int nchans); struct ieee80211_appie; struct ieee80211_appie *ieee80211_alloc_countryie(struct ieee80211com *); struct ieee80211_regdomain_req; From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 23:19:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBA051065948; Tue, 27 Jan 2009 23:19:36 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B90738FC1F; Tue, 27 Jan 2009 23:19:36 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RNJa0e099881; Tue, 27 Jan 2009 23:19:36 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RNJaVj099876; Tue, 27 Jan 2009 23:19:36 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901272319.n0RNJaVj099876@svn.freebsd.org> From: Sam Leffler Date: Tue, 27 Jan 2009 23:19:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187800 - in head/sys: dev/ath net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 23:19:38 -0000 Author: sam Date: Tue Jan 27 23:19:36 2009 New Revision: 187800 URL: http://svn.freebsd.org/changeset/base/187800 Log: change ic_getradiocaps driver callback to include the max # channels so callers know the size of the array passed down Modified: head/sys/dev/ath/if_ath.c head/sys/net80211/ieee80211_ioctl.c head/sys/net80211/ieee80211_regdomain.c head/sys/net80211/ieee80211_var.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Tue Jan 27 23:09:55 2009 (r187799) +++ head/sys/dev/ath/if_ath.c Tue Jan 27 23:19:36 2009 (r187800) @@ -205,7 +205,7 @@ static void ath_newassoc(struct ieee8021 static int ath_setregdomain(struct ieee80211com *, struct ieee80211_regdomain *, int, struct ieee80211_channel []); -static void ath_getradiocaps(struct ieee80211com *, int *, +static void ath_getradiocaps(struct ieee80211com *, int, int *, struct ieee80211_channel []); static int ath_getchannels(struct ath_softc *); static void ath_led_event(struct ath_softc *, int); @@ -6332,7 +6332,7 @@ ath_setregdomain(struct ieee80211com *ic static void ath_getradiocaps(struct ieee80211com *ic, - int *nchans, struct ieee80211_channel chans[]) + int maxchans, int *nchans, struct ieee80211_channel chans[]) { struct ath_softc *sc = ic->ic_ifp->if_softc; struct ath_hal *ah = sc->sc_ah; Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Tue Jan 27 23:09:55 2009 (r187799) +++ head/sys/net80211/ieee80211_ioctl.c Tue Jan 27 23:19:36 2009 (r187800) @@ -708,7 +708,7 @@ ieee80211_ioctl_getdevcaps(struct ieee80 dc->dc_cryptocaps = ic->ic_cryptocaps; dc->dc_htcaps = ic->ic_htcaps; ci = &dc->dc_chaninfo; - ic->ic_getradiocaps(ic, &ci->ic_nchans, ci->ic_chans); + ic->ic_getradiocaps(ic, IEEE80211_CHAN_MAX, &ci->ic_nchans, ci->ic_chans); ieee80211_sort_channels(ci->ic_chans, ci->ic_nchans); error = copyout(dc, ireq->i_data, sizeof(*dc)); free(dc, M_TEMP); Modified: head/sys/net80211/ieee80211_regdomain.c ============================================================================== --- head/sys/net80211/ieee80211_regdomain.c Tue Jan 27 23:09:55 2009 (r187799) +++ head/sys/net80211/ieee80211_regdomain.c Tue Jan 27 23:19:36 2009 (r187800) @@ -44,12 +44,14 @@ __FBSDID("$FreeBSD$"); #include static void -null_getradiocaps(struct ieee80211com *ic, int *n, struct ieee80211_channel *c) +null_getradiocaps(struct ieee80211com *ic, int maxchan, + int *n, struct ieee80211_channel *c) { /* just feed back the current channel list */ - *n = ic->ic_nchans; - memcpy(c, ic->ic_channels, - ic->ic_nchans*sizeof(struct ieee80211_channel)); + *n = ic->ic_nchans; /* XXX return count copied? */ + if (maxchan > ic->ic_nchans) + maxchan = ic->ic_nchans; + memcpy(c, ic->ic_channels, maxchan*sizeof(struct ieee80211_channel)); } static int Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Tue Jan 27 23:09:55 2009 (r187799) +++ head/sys/net80211/ieee80211_var.h Tue Jan 27 23:19:36 2009 (r187800) @@ -208,7 +208,7 @@ struct ieee80211com { ieee80211vap_attach ic_vattach[IEEE80211_OPMODE_MAX]; /* return hardware/radio capabilities */ void (*ic_getradiocaps)(struct ieee80211com *, - int *, struct ieee80211_channel []); + int, int *, struct ieee80211_channel []); /* check and/or prepare regdomain state change */ int (*ic_setregdomain)(struct ieee80211com *, struct ieee80211_regdomain *, From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 23:42:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC4011065670; Tue, 27 Jan 2009 23:42:14 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D93B18FC12; Tue, 27 Jan 2009 23:42:14 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RNgEiY000443; Tue, 27 Jan 2009 23:42:14 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RNgEDW000440; Tue, 27 Jan 2009 23:42:14 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901272342.n0RNgEDW000440@svn.freebsd.org> From: Sam Leffler Date: Tue, 27 Jan 2009 23:42:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187801 - in head: sbin/ifconfig sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 23:42:15 -0000 Author: sam Date: Tue Jan 27 23:42:14 2009 New Revision: 187801 URL: http://svn.freebsd.org/changeset/base/187801 Log: Remove assumptions about the max # channels in ioctl's: o change ioctl's that pass channel lists in/out to handle variable-size arrays instead of a fixed (compile-time) value; we do this in a way that maintains binary compatibility o change ifconfig so all channel list data structures are now allocated to hold MAXCHAN entries (1536); this, for example, allows the kernel to return > IEEE80211_CHAN_MAX entries for calls like IEEE80211_IOC_DEVCAPS Modified: head/sbin/ifconfig/ifieee80211.c head/sys/net80211/ieee80211_ioctl.c head/sys/net80211/ieee80211_ioctl.h Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Tue Jan 27 23:19:36 2009 (r187800) +++ head/sbin/ifconfig/ifieee80211.c Tue Jan 27 23:42:14 2009 (r187801) @@ -79,6 +79,7 @@ #include +#include #include #include #include @@ -119,6 +120,8 @@ #define IEEE80211_NODE_RIFS 0x4000 /* RIFS enabled */ #endif +#define MAXCHAN 1536 /* max 1.5K channels */ + #define MAXCOL 78 static int col; static char spacer; @@ -145,7 +148,7 @@ static void print_channels(int, const st static void regdomain_makechannels(struct ieee80211_regdomain_req *, const struct ieee80211_devcaps_req *); -static struct ieee80211req_chaninfo chaninfo; +static struct ieee80211req_chaninfo *chaninfo; static struct ieee80211_regdomain regdomain; static int gotregdomain = 0; static struct ieee80211_roamparams_req roamparams; @@ -175,10 +178,14 @@ gethtconf(int s) static void getchaninfo(int s) { - if (chaninfo.ic_nchans != 0) + if (chaninfo != NULL) return; - if (get80211(s, IEEE80211_IOC_CHANINFO, &chaninfo, sizeof(chaninfo)) < 0) - errx(1, "unable to get channel information"); + chaninfo = malloc(IEEE80211_CHANINFO_SIZE(MAXCHAN)); + if (chaninfo == NULL) + errx(1, "no space for channel list"); + if (get80211(s, IEEE80211_IOC_CHANINFO, chaninfo, + IEEE80211_CHANINFO_SIZE(MAXCHAN)) < 0) + err(1, "unable to get channel information"); ifmr = ifmedia_getstate(s); gethtconf(s); } @@ -205,19 +212,19 @@ getregdata(void) static int canpromote(int i, int from, int to) { - const struct ieee80211_channel *fc = &chaninfo.ic_chans[i]; + const struct ieee80211_channel *fc = &chaninfo->ic_chans[i]; int j; if ((fc->ic_flags & from) != from) return i; /* NB: quick check exploiting ordering of chans w/ same frequency */ - if (i+1 < chaninfo.ic_nchans && - chaninfo.ic_chans[i+1].ic_freq == fc->ic_freq && - (chaninfo.ic_chans[i+1].ic_flags & to) == to) + if (i+1 < chaninfo->ic_nchans && + chaninfo->ic_chans[i+1].ic_freq == fc->ic_freq && + (chaninfo->ic_chans[i+1].ic_flags & to) == to) return i+1; /* brute force search in case channel list is not ordered */ - for (j = 0; j < chaninfo.ic_nchans; j++) { - const struct ieee80211_channel *tc = &chaninfo.ic_chans[j]; + for (j = 0; j < chaninfo->ic_nchans; j++) { + const struct ieee80211_channel *tc = &chaninfo->ic_chans[j]; if (j != i && tc->ic_freq == fc->ic_freq && (tc->ic_flags & to) == to) return j; @@ -287,13 +294,13 @@ mapfreq(struct ieee80211_channel *chan, { int i; - for (i = 0; i < chaninfo.ic_nchans; i++) { - const struct ieee80211_channel *c = &chaninfo.ic_chans[i]; + for (i = 0; i < chaninfo->ic_nchans; i++) { + const struct ieee80211_channel *c = &chaninfo->ic_chans[i]; if (c->ic_freq == freq && (c->ic_flags & flags) == flags) { if (flags == 0) { /* when ambiguous promote to ``best'' */ - c = &chaninfo.ic_chans[promote(i)]; + c = &chaninfo->ic_chans[promote(i)]; } *chan = *c; return; @@ -307,13 +314,13 @@ mapchan(struct ieee80211_channel *chan, { int i; - for (i = 0; i < chaninfo.ic_nchans; i++) { - const struct ieee80211_channel *c = &chaninfo.ic_chans[i]; + for (i = 0; i < chaninfo->ic_nchans; i++) { + const struct ieee80211_channel *c = &chaninfo->ic_chans[i]; if (c->ic_ieee == ieee && (c->ic_flags & flags) == flags) { if (flags == 0) { /* when ambiguous promote to ``best'' */ - c = &chaninfo.ic_chans[promote(i)]; + c = &chaninfo->ic_chans[promote(i)]; } *chan = *c; return; @@ -331,7 +338,7 @@ getcurchan(int s) int val; /* fall back to legacy ioctl */ if (get80211val(s, IEEE80211_IOC_CHANNEL, &val) < 0) - errx(-1, "cannot figure out current channel"); + err(-1, "cannot figure out current channel"); getchaninfo(s); mapchan(&curchan, val, 0); } @@ -370,7 +377,7 @@ getroam(int s) return; if (get80211(s, IEEE80211_IOC_ROAM, &roamparams, sizeof(roamparams)) < 0) - errx(1, "unable to get roaming parameters"); + err(1, "unable to get roaming parameters"); gotroam = 1; } @@ -388,7 +395,7 @@ gettxparams(int s) return; if (get80211(s, IEEE80211_IOC_TXPARAMS, &txparams, sizeof(txparams)) < 0) - errx(1, "unable to get transmit parameters"); + err(1, "unable to get transmit parameters"); gottxparams = 1; } @@ -406,23 +413,24 @@ getregdomain(int s) return; if (get80211(s, IEEE80211_IOC_REGDOMAIN, ®domain, sizeof(regdomain)) < 0) - errx(1, "unable to get regulatory domain info"); + err(1, "unable to get regulatory domain info"); gotregdomain = 1; } static void getdevcaps(int s, struct ieee80211_devcaps_req *dc) { - if (get80211(s, IEEE80211_IOC_DEVCAPS, dc, sizeof(*dc)) < 0) - errx(1, "unable to get device capabilities"); + if (get80211(s, IEEE80211_IOC_DEVCAPS, dc, + IEEE80211_DEVCAPS_SPACE(dc)) < 0) + err(1, "unable to get device capabilities"); } static void setregdomain_cb(int s, void *arg) { - struct ieee80211_regdomain_req req; + struct ieee80211_regdomain_req *req; struct ieee80211_regdomain *rd = arg; - struct ieee80211_devcaps_req dc; + struct ieee80211_devcaps_req *dc; struct regdata *rdp = getregdata(); if (rd->country != NO_COUNTRY) { @@ -462,34 +470,52 @@ setregdomain_cb(int s, void *arg) rp->name); } } - req.rd = *rd; /* * Fetch the device capabilities and calculate the * full set of netbands for which we request a new * channel list be constructed. Once that's done we * push the regdomain info + channel list to the kernel. */ - getdevcaps(s, &dc); + dc = malloc(IEEE80211_DEVCAPS_SIZE(MAXCHAN)); + if (dc == NULL) + errx(1, "no space for device capabilities"); + dc->dc_chaninfo.ic_nchans = MAXCHAN; + getdevcaps(s, dc); #if 0 if (verbose) { - printf("drivercaps: 0x%x\n", dc.dc_drivercaps); - printf("cryptocaps: 0x%x\n", dc.dc_cryptocaps); - printf("htcaps : 0x%x\n", dc.dc_htcaps); - memcpy(&chaninfo, &dc.dc_chaninfo, sizeof(chaninfo)); - print_channels(s, &dc.dc_chaninfo, 1/*allchans*/, 1/*verbose*/); + printf("drivercaps: 0x%x\n", dc->dc_drivercaps); + printf("cryptocaps: 0x%x\n", dc->dc_cryptocaps); + printf("htcaps : 0x%x\n", dc->dc_htcaps); + memcpy(chaninfo, &dc->dc_chaninfo, + IEEE80211_CHANINFO_SPACE(&dc->dc_chaninfo)); + print_channels(s, &dc->dc_chaninfo, 1/*allchans*/, 1/*verbose*/); } #endif - regdomain_makechannels(&req, &dc); + req = malloc(IEEE80211_REGDOMAIN_SIZE(dc->dc_chaninfo.ic_nchans)); + if (req == NULL) + errx(1, "no space for regdomain request"); + req->rd = *rd; + regdomain_makechannels(req, dc); if (verbose) { LINE_INIT(':'); print_regdomain(rd, 1/*verbose*/); LINE_BREAK(); - memcpy(&chaninfo, &req.chaninfo, sizeof(chaninfo)); - print_channels(s, &req.chaninfo, 1/*allchans*/, 1/*verbose*/); + /* blech, reallocate channel list for new data */ + if (chaninfo != NULL) + free(chaninfo); + chaninfo = malloc(IEEE80211_CHANINFO_SPACE(&req->chaninfo)); + if (chaninfo == NULL) + errx(1, "no space for channel list"); + memcpy(chaninfo, &req->chaninfo, + IEEE80211_CHANINFO_SPACE(&req->chaninfo)); + print_channels(s, &req->chaninfo, 1/*allchans*/, 1/*verbose*/); } - if (req.chaninfo.ic_nchans == 0) + if (req->chaninfo.ic_nchans == 0) errx(1, "no channels calculated"); - set80211(s, IEEE80211_IOC_REGDOMAIN, 0, sizeof(req), &req); + set80211(s, IEEE80211_IOC_REGDOMAIN, 0, + IEEE80211_REGDOMAIN_SPACE(req), req); + free(req); + free(dc); } static int @@ -980,7 +1006,6 @@ static void set80211chanlist(const char *val, int d, int s, const struct afswtch *rafp) { struct ieee80211req_chanlist chanlist; -#define MAXCHAN (sizeof(chanlist.ic_channels)*NBBY) char *temp, *cp, *tp; temp = malloc(strlen(val) + 1); @@ -997,18 +1022,18 @@ set80211chanlist(const char *val, int d, *tp++ = '\0'; switch (sscanf(cp, "%u-%u", &first, &last)) { case 1: - if (first > MAXCHAN) + if (first > IEEE80211_CHAN_MAX) errx(-1, "channel %u out of range, max %zu", - first, MAXCHAN); + first, IEEE80211_CHAN_MAX); setbit(chanlist.ic_channels, first); break; case 2: - if (first > MAXCHAN) + if (first > IEEE80211_CHAN_MAX) errx(-1, "channel %u out of range, max %zu", - first, MAXCHAN); - if (last > MAXCHAN) + first, IEEE80211_CHAN_MAX); + if (last > IEEE80211_CHAN_MAX) errx(-1, "channel %u out of range, max %zu", - last, MAXCHAN); + last, IEEE80211_CHAN_MAX); if (first > last) errx(-1, "void channel range, %u > %u", first, last); @@ -1026,7 +1051,6 @@ set80211chanlist(const char *val, int d, cp = tp; } set80211(s, IEEE80211_IOC_CHANLIST, 0, sizeof(chanlist), &chanlist); -#undef MAXCHAN } static void @@ -1641,7 +1665,7 @@ set80211amsdu(const char *val, int d, in int amsdu; if (get80211val(s, IEEE80211_IOC_AMSDU, &amsdu) < 0) - errx(-1, "cannot get AMSDU setting"); + err(-1, "cannot get AMSDU setting"); if (d < 0) { d = -d; amsdu &= ~d; @@ -1848,6 +1872,7 @@ regdomain_addchans(struct ieee80211req_c break; } c = &ci->ic_chans[ci->ic_nchans++]; + memset(c, 0, sizeof(*c)); c->ic_freq = freq; c->ic_flags = chanFlags | (flags &~ (REQ_FLAGS | IEEE80211_CHAN_HT40)); @@ -1896,7 +1921,14 @@ regdomain_makechannels( errx(1, "internal error, regdomain %d not found", reg->regdomain); if (rd->sku != SKU_DEBUG) { - memset(ci, 0, sizeof(*ci)); + /* + * regdomain_addchans incrememnts the channel count for + * each channel it adds so initialize ic_nchans to zero. + * Note that we know we have enough space to hold all possible + * channels because the devcaps list size was used to + * allocate our request. + */ + ci->ic_nchans = 0; if (!LIST_EMPTY(&rd->bands_11b)) regdomain_addchans(ci, &rd->bands_11b, reg, IEEE80211_CHAN_B, &dc->dc_chaninfo); @@ -1945,7 +1977,8 @@ regdomain_makechannels( qsort(ci->ic_chans, ci->ic_nchans, sizeof(ci->ic_chans[0]), regdomain_sort); } else - *ci = dc->dc_chaninfo; + memcpy(ci, &dc->dc_chaninfo, + IEEE80211_CHANINFO_SPACE(&dc->dc_chaninfo)); } static void @@ -3113,19 +3146,21 @@ static void print_channels(int s, const struct ieee80211req_chaninfo *chans, int allchans, int verb) { - struct ieee80211req_chaninfo achans; + struct ieee80211req_chaninfo *achans; uint8_t reported[IEEE80211_CHAN_BYTES]; const struct ieee80211_channel *c; int i, half; - memset(&achans, 0, sizeof(achans)); + achans = malloc(IEEE80211_CHANINFO_SPACE(chans)); + if (achans == NULL) + errx(1, "no space for active channel list"); + achans->ic_nchans = 0; memset(reported, 0, sizeof(reported)); if (!allchans) { struct ieee80211req_chanlist active; if (get80211(s, IEEE80211_IOC_CHANLIST, &active, sizeof(active)) < 0) errx(1, "unable to get active channel list"); - memset(&achans, 0, sizeof(achans)); for (i = 0; i < chans->ic_nchans; i++) { c = &chans->ic_chans[i]; if (!isset(active.ic_channels, c->ic_ieee)) @@ -3138,9 +3173,9 @@ print_channels(int s, const struct ieee8 */ if (isset(reported, c->ic_ieee) && !verb) { /* XXX we assume duplicates are adjacent */ - achans.ic_chans[achans.ic_nchans-1] = *c; + achans->ic_chans[achans->ic_nchans-1] = *c; } else { - achans.ic_chans[achans.ic_nchans++] = *c; + achans->ic_chans[achans->ic_nchans++] = *c; setbit(reported, c->ic_ieee); } } @@ -3150,33 +3185,34 @@ print_channels(int s, const struct ieee8 /* suppress duplicates as above */ if (isset(reported, c->ic_ieee) && !verb) { /* XXX we assume duplicates are adjacent */ - achans.ic_chans[achans.ic_nchans-1] = *c; + achans->ic_chans[achans->ic_nchans-1] = *c; } else { - achans.ic_chans[achans.ic_nchans++] = *c; + achans->ic_chans[achans->ic_nchans++] = *c; setbit(reported, c->ic_ieee); } } } - half = achans.ic_nchans / 2; - if (achans.ic_nchans % 2) + half = achans->ic_nchans / 2; + if (achans->ic_nchans % 2) half++; - for (i = 0; i < achans.ic_nchans / 2; i++) { - print_chaninfo(&achans.ic_chans[i], verb); - print_chaninfo(&achans.ic_chans[half+i], verb); + for (i = 0; i < achans->ic_nchans / 2; i++) { + print_chaninfo(&achans->ic_chans[i], verb); + print_chaninfo(&achans->ic_chans[half+i], verb); printf("\n"); } - if (achans.ic_nchans % 2) { - print_chaninfo(&achans.ic_chans[i], verb); + if (achans->ic_nchans % 2) { + print_chaninfo(&achans->ic_chans[i], verb); printf("\n"); } + free(achans); } static void list_channels(int s, int allchans) { getchaninfo(s); - print_channels(s, &chaninfo, allchans, verbose); + print_channels(s, chaninfo, allchans, verbose); } static void @@ -3201,48 +3237,52 @@ print_txpow_verbose(const struct ieee802 static void list_txpow(int s) { - struct ieee80211req_chaninfo achans; + struct ieee80211req_chaninfo *achans; uint8_t reported[IEEE80211_CHAN_BYTES]; struct ieee80211_channel *c, *prev; int i, half; getchaninfo(s); - memset(&achans, 0, sizeof(achans)); + achans = malloc(IEEE80211_CHANINFO_SPACE(chaninfo)); + if (achans == NULL) + errx(1, "no space for active channel list"); + achans->ic_nchans = 0; memset(reported, 0, sizeof(reported)); - for (i = 0; i < chaninfo.ic_nchans; i++) { - c = &chaninfo.ic_chans[i]; + for (i = 0; i < chaninfo->ic_nchans; i++) { + c = &chaninfo->ic_chans[i]; /* suppress duplicates as above */ if (isset(reported, c->ic_ieee) && !verbose) { /* XXX we assume duplicates are adjacent */ - prev = &achans.ic_chans[achans.ic_nchans-1]; + prev = &achans->ic_chans[achans->ic_nchans-1]; /* display highest power on channel */ if (c->ic_maxpower > prev->ic_maxpower) *prev = *c; } else { - achans.ic_chans[achans.ic_nchans++] = *c; + achans->ic_chans[achans->ic_nchans++] = *c; setbit(reported, c->ic_ieee); } } if (!verbose) { - half = achans.ic_nchans / 2; - if (achans.ic_nchans % 2) + half = achans->ic_nchans / 2; + if (achans->ic_nchans % 2) half++; - for (i = 0; i < achans.ic_nchans / 2; i++) { - print_txpow(&achans.ic_chans[i]); - print_txpow(&achans.ic_chans[half+i]); + for (i = 0; i < achans->ic_nchans / 2; i++) { + print_txpow(&achans->ic_chans[i]); + print_txpow(&achans->ic_chans[half+i]); printf("\n"); } - if (achans.ic_nchans % 2) { - print_txpow(&achans.ic_chans[i]); + if (achans->ic_nchans % 2) { + print_txpow(&achans->ic_chans[i]); printf("\n"); } } else { - for (i = 0; i < achans.ic_nchans; i++) { - print_txpow_verbose(&achans.ic_chans[i]); + for (i = 0; i < achans->ic_nchans; i++) { + print_txpow_verbose(&achans->ic_chans[i]); printf("\n"); } } + free(achans); } static void @@ -3259,19 +3299,24 @@ list_keys(int s) static void list_capabilities(int s) { - struct ieee80211_devcaps_req dc; + struct ieee80211_devcaps_req *dc; - getdevcaps(s, &dc); - printb("drivercaps", dc.dc_drivercaps, IEEE80211_C_BITS); - if (dc.dc_cryptocaps != 0 || verbose) { + dc = malloc(IEEE80211_DEVCAPS_SIZE(1)); + if (dc == NULL) + errx(1, "no space for device capabilities"); + dc->dc_chaninfo.ic_nchans = 1; + getdevcaps(s, dc); + printb("drivercaps", dc->dc_drivercaps, IEEE80211_C_BITS); + if (dc->dc_cryptocaps != 0 || verbose) { putchar('\n'); - printb("cryptocaps", dc.dc_cryptocaps, IEEE80211_CRYPTO_BITS); + printb("cryptocaps", dc->dc_cryptocaps, IEEE80211_CRYPTO_BITS); } - if (dc.dc_htcaps != 0 || verbose) { + if (dc->dc_htcaps != 0 || verbose) { putchar('\n'); - printb("htcaps", dc.dc_htcaps, IEEE80211_HTCAP_BITS); + printb("htcaps", dc->dc_htcaps, IEEE80211_HTCAP_BITS); } putchar('\n'); + free(dc); } static int @@ -3550,7 +3595,7 @@ list_regdomain(int s, int channelsalso) spacer = ':'; print_regdomain(®domain, 1); LINE_BREAK(); - print_channels(s, &chaninfo, 1/*allchans*/, 1/*verbose*/); + print_channels(s, chaninfo, 1/*allchans*/, 1/*verbose*/); } else print_regdomain(®domain, verbose); } @@ -4362,6 +4407,7 @@ get80211len(int s, int type, void *data, (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name)); ireq.i_type = type; ireq.i_len = len; + assert(ireq.i_len == len); /* NB: check for 16-bit truncation */ ireq.i_data = data; if (ioctl(s, SIOCG80211, &ireq) < 0) return -1; @@ -4393,6 +4439,7 @@ set80211(int s, int type, int val, int l ireq.i_type = type; ireq.i_val = val; ireq.i_len = len; + assert(ireq.i_len == len); /* NB: check for 16-bit truncation */ ireq.i_data = data; if (ioctl(s, SIOCS80211, &ireq) < 0) err(1, "SIOCS80211"); Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Tue Jan 27 23:19:36 2009 (r187800) +++ head/sys/net80211/ieee80211_ioctl.c Tue Jan 27 23:42:14 2009 (r187801) @@ -696,21 +696,27 @@ ieee80211_ioctl_getdevcaps(struct ieee80 { struct ieee80211_devcaps_req *dc; struct ieee80211req_chaninfo *ci; - int error; + int maxchans, error; - if (ireq->i_len != sizeof(struct ieee80211_devcaps_req)) - return EINVAL; - dc = (struct ieee80211_devcaps_req *) malloc( - sizeof(struct ieee80211_devcaps_req), M_TEMP, M_NOWAIT | M_ZERO); + maxchans = 1 + ((ireq->i_len - sizeof(struct ieee80211_devcaps_req)) / + sizeof(struct ieee80211_channel)); + /* NB: require 1 so we know ic_nchans is accessible */ + if (maxchans < 1) + return EINVAL; + /* constrain max request size, 2K channels is ~24Kbytes */ + if (maxchans > 2048) + maxchans = 2048; + dc = (struct ieee80211_devcaps_req *) + malloc(IEEE80211_DEVCAPS_SIZE(maxchans), M_TEMP, M_NOWAIT | M_ZERO); if (dc == NULL) return ENOMEM; dc->dc_drivercaps = ic->ic_caps; dc->dc_cryptocaps = ic->ic_cryptocaps; dc->dc_htcaps = ic->ic_htcaps; ci = &dc->dc_chaninfo; - ic->ic_getradiocaps(ic, IEEE80211_CHAN_MAX, &ci->ic_nchans, ci->ic_chans); + ic->ic_getradiocaps(ic, maxchans, &ci->ic_nchans, ci->ic_chans); ieee80211_sort_channels(ci->ic_chans, ci->ic_nchans); - error = copyout(dc, ireq->i_data, sizeof(*dc)); + error = copyout(dc, ireq->i_data, IEEE80211_DEVCAPS_SPACE(dc)); free(dc, M_TEMP); return error; } @@ -1566,17 +1572,21 @@ static __noinline int ieee80211_ioctl_setchanlist(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; - struct ieee80211req_chanlist list; - u_char chanlist[IEEE80211_CHAN_BYTES]; - int i, nchan, error; + uint8_t *chanlist, *list; + int i, nchan, maxchan, error; - if (ireq->i_len != sizeof(list)) - return EINVAL; - error = copyin(ireq->i_data, &list, sizeof(list)); + if (ireq->i_len > sizeof(ic->ic_chan_active)) + ireq->i_len = sizeof(ic->ic_chan_active); + list = malloc(ireq->i_len + IEEE80211_CHAN_BYTES, M_TEMP, + M_NOWAIT | M_ZERO); + if (list == NULL) + return ENOMEM; + error = copyin(ireq->i_data, list, ireq->i_len); if (error) return error; - memset(chanlist, 0, sizeof(chanlist)); nchan = 0; + chanlist = list + ireq->i_len; /* NB: zero'd already */ + maxchan = ireq->i_len * NBBY; for (i = 0; i < ic->ic_nchans; i++) { const struct ieee80211_channel *c = &ic->ic_channels[i]; /* @@ -1584,7 +1594,7 @@ ieee80211_ioctl_setchanlist(struct ieee8 * available channels so users can do things like specify * 1-255 to get all available channels. */ - if (isset(list.ic_channels, c->ic_ieee)) { + if (c->ic_ieee < maxchan && isset(list, c->ic_ieee)) { setbit(chanlist, c->ic_ieee); nchan++; } @@ -1594,8 +1604,9 @@ ieee80211_ioctl_setchanlist(struct ieee8 if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && /* XXX */ isclr(chanlist, ic->ic_bsschan->ic_ieee)) ic->ic_bsschan = IEEE80211_CHAN_ANYC; - memcpy(ic->ic_chan_active, chanlist, sizeof(ic->ic_chan_active)); + memcpy(ic->ic_chan_active, chanlist, IEEE80211_CHAN_BYTES); ieee80211_scan_flush(vap); + free(list, M_TEMP); return ENETRESET; } @@ -1993,17 +2004,34 @@ ieee80211_ioctl_setregdomain(struct ieee const struct ieee80211req *ireq) { struct ieee80211_regdomain_req *reg; - int error; + int nchans, error; - if (ireq->i_len != sizeof(struct ieee80211_regdomain_req)) + nchans = 1 + ((ireq->i_len - sizeof(struct ieee80211_regdomain_req)) / + sizeof(struct ieee80211_channel)); + if (!(1 <= nchans && nchans <= IEEE80211_CHAN_MAX)) { + IEEE80211_DPRINTF(vap, IEEE80211_MSG_IOCTL, + "%s: bad # chans, i_len %d nchans %d\n", __func__, + ireq->i_len, nchans); return EINVAL; - reg = (struct ieee80211_regdomain_req *) malloc( - sizeof(struct ieee80211_regdomain_req), M_TEMP, M_NOWAIT); - if (reg == NULL) + } + reg = (struct ieee80211_regdomain_req *) + malloc(IEEE80211_REGDOMAIN_SIZE(nchans), M_TEMP, M_NOWAIT); + if (reg == NULL) { + IEEE80211_DPRINTF(vap, IEEE80211_MSG_IOCTL, + "%s: no memory, nchans %d\n", __func__, nchans); return ENOMEM; - error = copyin(ireq->i_data, reg, sizeof(*reg)); - if (error == 0) - error = ieee80211_setregdomain(vap, reg); + } + error = copyin(ireq->i_data, reg, IEEE80211_REGDOMAIN_SIZE(nchans)); + if (error == 0) { + /* NB: validate inline channel count against storage size */ + if (reg->chaninfo.ic_nchans != nchans) { + IEEE80211_DPRINTF(vap, IEEE80211_MSG_IOCTL, + "%s: chan cnt mismatch, %d != %d\n", __func__, + reg->chaninfo.ic_nchans, nchans); + error = EINVAL; + } else + error = ieee80211_setregdomain(vap, reg); + } free(reg, M_TEMP); return (error == 0 ? ENETRESET : error); Modified: head/sys/net80211/ieee80211_ioctl.h ============================================================================== --- head/sys/net80211/ieee80211_ioctl.h Tue Jan 27 23:19:36 2009 (r187800) +++ head/sys/net80211/ieee80211_ioctl.h Tue Jan 27 23:42:14 2009 (r187801) @@ -299,13 +299,13 @@ struct ieee80211req_maclist { }; /* - * Set the active channel list. Note this list is - * intersected with the available channel list in - * calculating the set of channels actually used in - * scanning. + * Set the active channel list by IEEE channel #: each channel + * to be marked active is set in a bit vector. Note this list is + * intersected with the available channel list in calculating + * the set of channels actually used in scanning. */ struct ieee80211req_chanlist { - uint8_t ic_channels[IEEE80211_CHAN_BYTES]; + uint8_t ic_channels[32]; /* NB: can be variable length */ }; /* @@ -313,8 +313,13 @@ struct ieee80211req_chanlist { */ struct ieee80211req_chaninfo { u_int ic_nchans; - struct ieee80211_channel ic_chans[IEEE80211_CHAN_MAX]; + struct ieee80211_channel ic_chans[1]; /* NB: variable length */ }; +#define IEEE80211_CHANINFO_SIZE(_nchan) \ + (sizeof(struct ieee80211req_chaninfo) + \ + (((_nchan)-1) * sizeof(struct ieee80211_channel))) +#define IEEE80211_CHANINFO_SPACE(_ci) \ + IEEE80211_CHANINFO_SIZE((_ci)->ic_nchans) /* * Retrieve the WPA/RSN information element for an associated station. @@ -463,6 +468,11 @@ struct ieee80211_regdomain_req { struct ieee80211_regdomain rd; struct ieee80211req_chaninfo chaninfo; }; +#define IEEE80211_REGDOMAIN_SIZE(_nchan) \ + (sizeof(struct ieee80211_regdomain_req) + \ + (((_nchan)-1) * sizeof(struct ieee80211_channel))) +#define IEEE80211_REGDOMAIN_SPACE(_req) \ + IEEE80211_REGDOMAIN_SIZE((_req)->chaninfo.ic_nchans) /* * Get driver capabilities. Driver, hardware crypto, and @@ -475,6 +485,11 @@ struct ieee80211_devcaps_req { uint32_t dc_htcaps; /* HT/802.11n support */ struct ieee80211req_chaninfo dc_chaninfo; }; +#define IEEE80211_DEVCAPS_SIZE(_nchan) \ + (sizeof(struct ieee80211_devcaps_req) + \ + (((_nchan)-1) * sizeof(struct ieee80211_channel))) +#define IEEE80211_DEVCAPS_SPACE(_dc) \ + IEEE80211_DEVCAPS_SIZE((_dc)->dc_chaninfo.ic_nchans) struct ieee80211_chanswitch_req { struct ieee80211_channel csa_chan; /* new channel */ From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 23:43:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 999591065714; Tue, 27 Jan 2009 23:43:20 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88C5C8FC2B; Tue, 27 Jan 2009 23:43:20 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RNhKO3000503; Tue, 27 Jan 2009 23:43:20 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RNhKZO000502; Tue, 27 Jan 2009 23:43:20 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901272343.n0RNhKZO000502@svn.freebsd.org> From: Sam Leffler Date: Tue, 27 Jan 2009 23:43:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187802 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 23:43:21 -0000 Author: sam Date: Tue Jan 27 23:43:20 2009 New Revision: 187802 URL: http://svn.freebsd.org/changeset/base/187802 Log: fix comment Modified: head/sys/net80211/ieee80211_regdomain.c Modified: head/sys/net80211/ieee80211_regdomain.c ============================================================================== --- head/sys/net80211/ieee80211_regdomain.c Tue Jan 27 23:42:14 2009 (r187801) +++ head/sys/net80211/ieee80211_regdomain.c Tue Jan 27 23:43:20 2009 (r187802) @@ -71,7 +71,7 @@ ieee80211_regdomain_attach(struct ieee80 ic->ic_regdomain.location = ' '; /* both */ ic->ic_regdomain.isocc[0] = 'U'; /* XXX */ ic->ic_regdomain.isocc[1] = 'S'; /* XXX */ - /* XXX? too late to setup default channel list */ + /* NB: driver calls ieee80211_init_channels or similar */ } ic->ic_getradiocaps = null_getradiocaps; ic->ic_setregdomain = null_setregdomain; From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 23:48:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 622C11065676; Tue, 27 Jan 2009 23:48:13 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5132D8FC13; Tue, 27 Jan 2009 23:48:13 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RNmDtI000652; Tue, 27 Jan 2009 23:48:13 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RNmDCS000651; Tue, 27 Jan 2009 23:48:13 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901272348.n0RNmDCS000651@svn.freebsd.org> From: Sam Leffler Date: Tue, 27 Jan 2009 23:48:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187803 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 23:48:13 -0000 Author: sam Date: Tue Jan 27 23:48:13 2009 New Revision: 187803 URL: http://svn.freebsd.org/changeset/base/187803 Log: Extend channel definition with: o max antenna gain o driver private opaque data Note this grows the size of a channel to 16 bytes; which makes the default channel table 4Kbytes (up from 3Kbytes). Modified: head/sys/net80211/_ieee80211.h Modified: head/sys/net80211/_ieee80211.h ============================================================================== --- head/sys/net80211/_ieee80211.h Tue Jan 27 23:43:20 2009 (r187802) +++ head/sys/net80211/_ieee80211.h Tue Jan 27 23:48:13 2009 (r187803) @@ -135,6 +135,9 @@ struct ieee80211_channel { int8_t ic_minpower; /* minimum tx power in .5 dBm */ uint8_t ic_state; /* dynamic state */ uint8_t ic_extieee; /* HT40 extension channel number */ + int8_t ic_maxantgain; /* maximum antenna gain in .5 dBm */ + uint8_t ic_pad; + uint16_t ic_devdata; /* opaque device/driver data */ }; #define IEEE80211_CHAN_MAX 256 From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 01:11:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A3CC106566C; Wed, 28 Jan 2009 01:11:21 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 597218FC08; Wed, 28 Jan 2009 01:11:21 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0S1BL3J003093; Wed, 28 Jan 2009 01:11:21 GMT (envelope-from trhodes@svn.freebsd.org) Received: (from trhodes@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0S1BL7n003092; Wed, 28 Jan 2009 01:11:21 GMT (envelope-from trhodes@svn.freebsd.org) Message-Id: <200901280111.n0S1BL7n003092@svn.freebsd.org> From: Tom Rhodes Date: Wed, 28 Jan 2009 01:11:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187805 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 01:11:22 -0000 Author: trhodes Date: Wed Jan 28 01:11:20 2009 New Revision: 187805 URL: http://svn.freebsd.org/changeset/base/187805 Log: Remove comment about clearerr() being the only method of clearing the EOF indicator, fseek() may also be used for this. Bump document date. PR: 76333 Submitted by: Yoshihiko Sarumaru Modified: head/lib/libc/stdio/ferror.3 Modified: head/lib/libc/stdio/ferror.3 ============================================================================== --- head/lib/libc/stdio/ferror.3 Wed Jan 28 00:15:35 2009 (r187804) +++ head/lib/libc/stdio/ferror.3 Wed Jan 28 01:11:20 2009 (r187805) @@ -32,7 +32,7 @@ .\" @(#)ferror.3 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd January 10, 2003 +.Dd January 27, 2009 .Dt FERROR 3 .Os .Sh NAME @@ -77,8 +77,6 @@ The function tests the end-of-file indicator for the stream pointed to by .Fa stream , returning non-zero if it is set. -The end-of-file indicator can only be cleared by the function -.Fn clearerr . .Pp The function .Fn ferror From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 04:36:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E0291065672; Wed, 28 Jan 2009 04:36:35 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A6BA8FC1D; Wed, 28 Jan 2009 04:36:35 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0S4aZnw007119; Wed, 28 Jan 2009 04:36:35 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0S4aYO7007096; Wed, 28 Jan 2009 04:36:34 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200901280436.n0S4aYO7007096@svn.freebsd.org> From: David Schultz Date: Wed, 28 Jan 2009 04:36:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187808 - in head/contrib/gdtoa: . test test/obad X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 04:36:36 -0000 Author: das Date: Wed Jan 28 04:36:34 2009 New Revision: 187808 URL: http://svn.freebsd.org/changeset/base/187808 Log: Vendor import of gdtoa 20081205. Added: head/contrib/gdtoa/gdtoa_fltrnds.h - copied unchanged from r187807, vendor/gdtoa/dist/gdtoa_fltrnds.h head/contrib/gdtoa/test/obad/ - copied from r187807, vendor/gdtoa/dist/test/obad/ Modified: head/contrib/gdtoa/ (props changed) head/contrib/gdtoa/README head/contrib/gdtoa/g_Qfmt.c head/contrib/gdtoa/g__fmt.c head/contrib/gdtoa/g_ddfmt.c head/contrib/gdtoa/g_dfmt.c head/contrib/gdtoa/g_ffmt.c head/contrib/gdtoa/g_xLfmt.c head/contrib/gdtoa/g_xfmt.c head/contrib/gdtoa/gdtoa.c head/contrib/gdtoa/gdtoa.h head/contrib/gdtoa/gdtoaimp.h head/contrib/gdtoa/gethex.c head/contrib/gdtoa/makefile head/contrib/gdtoa/smisc.c head/contrib/gdtoa/strtod.c head/contrib/gdtoa/strtodg.c head/contrib/gdtoa/strtof.c head/contrib/gdtoa/strtopQ.c head/contrib/gdtoa/strtopd.c head/contrib/gdtoa/strtopdd.c head/contrib/gdtoa/strtopf.c head/contrib/gdtoa/strtopx.c head/contrib/gdtoa/strtopxL.c head/contrib/gdtoa/test/README head/contrib/gdtoa/test/getround.c head/contrib/gdtoa/test/makefile head/contrib/gdtoa/test/xsum0.out head/contrib/gdtoa/xsum0.out Modified: head/contrib/gdtoa/README ============================================================================== --- head/contrib/gdtoa/README Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/README Wed Jan 28 04:36:34 2009 (r187808) @@ -56,7 +56,9 @@ two letters: whose sum is the desired value For decimal -> binary conversions, there are three families of -helper routines: one for round-nearest: +helper routines: one for round-nearest (or the current rounding +mode on IEEE-arithmetic systems that provide the C99 fegetround() +function, if compiled with -DHonor_FLT_ROUNDS): strtof strtod @@ -191,6 +193,9 @@ in the buffer, if the buffer was long en conversion are easily done with the help of gdtoa(), such as %e or %f style and conversions with direction of rounding specified (so that, if desired, the decimal value is either >= or <= the binary value). +On IEEE-arithmetic systems that provide the C99 fegetround() function, +if compiled with -DHonor_FLT_ROUNDS, these routines honor the current +rounding mode. For an example of more general conversions based on dtoa(), see netlib's "printf.c from ampl/solvers". @@ -342,5 +347,11 @@ standard says it should -- when Honor_FL current rounding mode is obtained from fegetround() rather than from FLT_ROUNDS, unless Trust_FLT_ROUNDS is also #defined. +Compile with -DUSE_LOCALE to use the current locale; otherwise +decimal points are assumed to be '.'. With -DUSE_LOCALE, unless +you also compile with -DNO_LOCALE_CACHE, the details about the +current "decimal point" character string are cached and assumed not +to change during the program's execution. + Please send comments to David M. Gay (dmg at acm dot org, with " at " changed at "@" and " dot " changed to "."). Modified: head/contrib/gdtoa/g_Qfmt.c ============================================================================== --- head/contrib/gdtoa/g_Qfmt.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/g_Qfmt.c Wed Jan 28 04:36:34 2009 (r187808) @@ -51,15 +51,20 @@ THIS SOFTWARE. char* #ifdef KR_headers -g_Qfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; unsigned bufsize; +g_Qfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; size_t bufsize; #else -g_Qfmt(char *buf, void *V, int ndig, unsigned bufsize) +g_Qfmt(char *buf, void *V, int ndig, size_t bufsize) #endif { - static FPI fpi = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, 0 }; + static FPI fpi0 = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, 0 }; char *b, *s, *se; ULong bits[4], *L, sign; int decpt, ex, i, mode; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif if (ndig < 0) ndig = 0; @@ -109,6 +114,6 @@ g_Qfmt(char *buf, void *V, int ndig, uns return 0; mode = 0; } - s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se); - return g__fmt(buf, s, se, decpt, sign); + s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); + return g__fmt(buf, s, se, decpt, sign, bufsize); } Modified: head/contrib/gdtoa/g__fmt.c ============================================================================== --- head/contrib/gdtoa/g__fmt.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/g__fmt.c Wed Jan 28 04:36:34 2009 (r187808) @@ -37,24 +37,51 @@ THIS SOFTWARE. char * #ifdef KR_headers -g__fmt(b, s, se, decpt, sign) char *b; char *s; char *se; int decpt; ULong sign; +g__fmt(b, s, se, decpt, sign, blen) char *b; char *s; char *se; int decpt; ULong sign; size_t blen; #else -g__fmt(char *b, char *s, char *se, int decpt, ULong sign) +g__fmt(char *b, char *s, char *se, int decpt, ULong sign, size_t blen) #endif { int i, j, k; - char *s0 = s; + char *be, *s0; + size_t len; #ifdef USE_LOCALE - char decimalpoint = *localeconv()->decimal_point; +#ifdef NO_LOCALE_CACHE + char *decimalpoint = localeconv()->decimal_point; + size_t dlen = strlen(decimalpoint); #else -#define decimalpoint '.' + char *decimalpoint; + static char *decimalpoint_cache; + static size_t dlen; + if (!(s0 = decimalpoint_cache)) { + s0 = localeconv()->decimal_point; + dlen = strlen(s0); + if ((decimalpoint_cache = (char*)malloc(strlen(s0) + 1))) { + strcpy(decimalpoint_cache, s0); + s0 = decimalpoint_cache; + } + } + decimalpoint = s0; +#endif +#else +#define dlen 0 #endif + s0 = s; + len = (se-s) + dlen + 6; /* 6 = sign + e+dd + trailing null */ + if (blen < len) + goto ret0; + be = b + blen - 1; if (sign) *b++ = '-'; if (decpt <= -4 || decpt > se - s + 5) { *b++ = *s++; if (*s) { - *b++ = decimalpoint; +#ifdef USE_LOCALE + while((*b = *decimalpoint++)) + ++b; +#else + *b++ = '.'; +#endif while((*b = *s++) !=0) b++; } @@ -69,6 +96,8 @@ g__fmt(char *b, char *s, char *se, int d for(j = 2, k = 10; 10*k <= decpt; j++, k *= 10){} for(;;) { i = decpt / k; + if (b >= be) + goto ret0; *b++ = i + '0'; if (--j <= 0) break; @@ -78,22 +107,41 @@ g__fmt(char *b, char *s, char *se, int d *b = 0; } else if (decpt <= 0) { - *b++ = decimalpoint; +#ifdef USE_LOCALE + while((*b = *decimalpoint++)) + ++b; +#else + *b++ = '.'; +#endif + if (be < b - decpt + (se - s)) + goto ret0; for(; decpt < 0; decpt++) *b++ = '0'; - while((*b = *s++) !=0) + while((*b = *s++) != 0) b++; } else { - while((*b = *s++) !=0) { + while((*b = *s++) != 0) { b++; - if (--decpt == 0 && *s) - *b++ = decimalpoint; + if (--decpt == 0 && *s) { +#ifdef USE_LOCALE + while(*b = *decimalpoint++) + ++b; +#else + *b++ = '.'; +#endif + } + } + if (b + decpt > be) { + ret0: + b = 0; + goto ret; } for(; decpt > 0; decpt--) *b++ = '0'; *b = 0; } + ret: freedtoa(s0); return b; } Modified: head/contrib/gdtoa/g_ddfmt.c ============================================================================== --- head/contrib/gdtoa/g_ddfmt.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/g_ddfmt.c Wed Jan 28 04:36:34 2009 (r187808) @@ -33,9 +33,9 @@ THIS SOFTWARE. char * #ifdef KR_headers -g_ddfmt(buf, dd, ndig, bufsize) char *buf; double *dd; int ndig; unsigned bufsize; +g_ddfmt(buf, dd, ndig, bufsize) char *buf; double *dd; int ndig; size_t bufsize; #else -g_ddfmt(char *buf, double *dd, int ndig, unsigned bufsize) +g_ddfmt(char *buf, double *dd, int ndig, size_t bufsize) #endif { FPI fpi; @@ -44,6 +44,21 @@ g_ddfmt(char *buf, double *dd, int ndig, int bx, by, decpt, ex, ey, i, j, mode; Bigint *x, *y, *z; double ddx[2]; +#ifdef Honor_FLT_ROUNDS /*{{*/ + int Rounding; +#ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */ + Rounding = Flt_Rounds; +#else /*}{*/ + Rounding = 1; + switch(fegetround()) { + case FE_TOWARDZERO: Rounding = 0; break; + case FE_UPWARD: Rounding = 2; break; + case FE_DOWNWARD: Rounding = 3; + } +#endif /*}}*/ +#else /*}{*/ +#define Rounding FPI_Round_near +#endif /*}}*/ if (bufsize < 10 || bufsize < ndig + 8) return 0; @@ -144,11 +159,11 @@ g_ddfmt(char *buf, double *dd, int ndig, } fpi.emin = 1-1023-53+1; fpi.emax = 2046-1023-106+1; - fpi.rounding = FPI_Round_near; + fpi.rounding = Rounding; fpi.sudden_underflow = 0; i = STRTOG_Normal; s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se); - b = g__fmt(buf, s, se, decpt, z->sign); + b = g__fmt(buf, s, se, decpt, z->sign, bufsize); Bfree(z); return b; } Modified: head/contrib/gdtoa/g_dfmt.c ============================================================================== --- head/contrib/gdtoa/g_dfmt.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/g_dfmt.c Wed Jan 28 04:36:34 2009 (r187808) @@ -33,15 +33,20 @@ THIS SOFTWARE. char* #ifdef KR_headers -g_dfmt(buf, d, ndig, bufsize) char *buf; double *d; int ndig; unsigned bufsize; +g_dfmt(buf, d, ndig, bufsize) char *buf; double *d; int ndig; size_t bufsize; #else -g_dfmt(char *buf, double *d, int ndig, unsigned bufsize) +g_dfmt(char *buf, double *d, int ndig, size_t bufsize) #endif { - static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, 0 }; + static FPI fpi0 = { 53, 1-1023-53+1, 2046-1023-53+1, 1, 0 }; char *b, *s, *se; ULong bits[2], *L, sign; int decpt, ex, i, mode; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif if (ndig < 0) ndig = 0; @@ -52,6 +57,8 @@ g_dfmt(char *buf, double *d, int ndig, u sign = L[_0] & 0x80000000L; if ((L[_0] & 0x7ff00000) == 0x7ff00000) { /* Infinity or NaN */ + if (bufsize < 10) + return 0; if (L[_0] & 0xfffff || L[_1]) { return strcp(buf, "NaN"); } @@ -78,12 +85,9 @@ g_dfmt(char *buf, double *d, int ndig, u ex = 1; ex -= 0x3ff + 52; mode = 2; - if (ndig <= 0) { - if (bufsize < 25) - return 0; + if (ndig <= 0) mode = 0; - } i = STRTOG_Normal; - s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se); - return g__fmt(buf, s, se, decpt, sign); + s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); + return g__fmt(buf, s, se, decpt, sign, bufsize); } Modified: head/contrib/gdtoa/g_ffmt.c ============================================================================== --- head/contrib/gdtoa/g_ffmt.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/g_ffmt.c Wed Jan 28 04:36:34 2009 (r187808) @@ -33,15 +33,20 @@ THIS SOFTWARE. char* #ifdef KR_headers -g_ffmt(buf, f, ndig, bufsize) char *buf; float *f; int ndig; unsigned bufsize; +g_ffmt(buf, f, ndig, bufsize) char *buf; float *f; int ndig; size_t bufsize; #else -g_ffmt(char *buf, float *f, int ndig, unsigned bufsize) +g_ffmt(char *buf, float *f, int ndig, size_t bufsize) #endif { - static FPI fpi = { 24, 1-127-24+1, 254-127-24+1, 1, 0 }; + static FPI fpi0 = { 24, 1-127-24+1, 254-127-24+1, 1, 0 }; char *b, *s, *se; ULong bits[1], *L, sign; int decpt, ex, i, mode; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif if (ndig < 0) ndig = 0; @@ -83,6 +88,6 @@ g_ffmt(char *buf, float *f, int ndig, un mode = 0; } i = STRTOG_Normal; - s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se); - return g__fmt(buf, s, se, decpt, sign); + s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); + return g__fmt(buf, s, se, decpt, sign, bufsize); } Modified: head/contrib/gdtoa/g_xLfmt.c ============================================================================== --- head/contrib/gdtoa/g_xLfmt.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/g_xLfmt.c Wed Jan 28 04:36:34 2009 (r187808) @@ -49,15 +49,20 @@ THIS SOFTWARE. char* #ifdef KR_headers -g_xLfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; unsigned bufsize; +g_xLfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; size_t bufsize; #else -g_xLfmt(char *buf, void *V, int ndig, unsigned bufsize) +g_xLfmt(char *buf, void *V, int ndig, size_t bufsize) #endif { - static FPI fpi = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; + static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; char *b, *s, *se; ULong bits[2], *L, sign; int decpt, ex, i, mode; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif if (ndig < 0) ndig = 0; @@ -103,6 +108,6 @@ g_xLfmt(char *buf, void *V, int ndig, un return 0; mode = 0; } - s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se); - return g__fmt(buf, s, se, decpt, sign); + s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); + return g__fmt(buf, s, se, decpt, sign, bufsize); } Modified: head/contrib/gdtoa/g_xfmt.c ============================================================================== --- head/contrib/gdtoa/g_xfmt.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/g_xfmt.c Wed Jan 28 04:36:34 2009 (r187808) @@ -53,16 +53,21 @@ THIS SOFTWARE. char* #ifdef KR_headers -g_xfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; unsigned bufsize; +g_xfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; size_t bufsize; #else -g_xfmt(char *buf, void *V, int ndig, unsigned bufsize) +g_xfmt(char *buf, void *V, int ndig, size_t bufsize) #endif { - static FPI fpi = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; + static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; char *b, *s, *se; ULong bits[2], sign; UShort *L; int decpt, ex, i, mode; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif if (ndig < 0) ndig = 0; @@ -109,6 +114,6 @@ g_xfmt(char *buf, void *V, int ndig, uns return 0; mode = 0; } - s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se); - return g__fmt(buf, s, se, decpt, sign); + s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); + return g__fmt(buf, s, se, decpt, sign, bufsize); } Modified: head/contrib/gdtoa/gdtoa.c ============================================================================== --- head/contrib/gdtoa/gdtoa.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/gdtoa.c Wed Jan 28 04:36:34 2009 (r187808) @@ -417,11 +417,9 @@ gdtoa if (dval(d) > ds + dval(eps)) goto bump_up; else if (dval(d) < ds - dval(eps)) { - while(*--s == '0'){} - s++; if (dval(d)) inex = STRTOG_Inexlo; - goto ret1; + goto clear_trailing0; } break; } @@ -479,8 +477,12 @@ gdtoa } ++*s++; } - else + else { inex = STRTOG_Inexlo; + clear_trailing0: + while(*--s == '0'){} + ++s; + } break; } } @@ -738,7 +740,7 @@ gdtoa if (b->wds > 1 || b->x[0]) inex = STRTOG_Inexlo; while(*--s == '0'){} - s++; + ++s; } ret: Bfree(S); Modified: head/contrib/gdtoa/gdtoa.h ============================================================================== --- head/contrib/gdtoa/gdtoa.h Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/gdtoa.h Wed Jan 28 04:36:34 2009 (r187808) @@ -33,6 +33,7 @@ THIS SOFTWARE. #define GDTOA_H_INCLUDED #include "arith.h" +#include /* for size_t */ #ifndef Long #define Long long @@ -111,12 +112,12 @@ extern float strtof ANSI((CONST char *, extern double strtod ANSI((CONST char *, char **)); extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*)); -extern char* g_ddfmt ANSI((char*, double*, int, unsigned)); -extern char* g_dfmt ANSI((char*, double*, int, unsigned)); -extern char* g_ffmt ANSI((char*, float*, int, unsigned)); -extern char* g_Qfmt ANSI((char*, void*, int, unsigned)); -extern char* g_xfmt ANSI((char*, void*, int, unsigned)); -extern char* g_xLfmt ANSI((char*, void*, int, unsigned)); +extern char* g_ddfmt ANSI((char*, double*, int, size_t)); +extern char* g_dfmt ANSI((char*, double*, int, size_t)); +extern char* g_ffmt ANSI((char*, float*, int, size_t)); +extern char* g_Qfmt ANSI((char*, void*, int, size_t)); +extern char* g_xfmt ANSI((char*, void*, int, size_t)); +extern char* g_xLfmt ANSI((char*, void*, int, size_t)); extern int strtoId ANSI((CONST char*, char**, double*, double*)); extern int strtoIdd ANSI((CONST char*, char**, double*, double*)); Copied: head/contrib/gdtoa/gdtoa_fltrnds.h (from r187807, vendor/gdtoa/dist/gdtoa_fltrnds.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/gdtoa/gdtoa_fltrnds.h Wed Jan 28 04:36:34 2009 (r187808, copy of r187807, vendor/gdtoa/dist/gdtoa_fltrnds.h) @@ -0,0 +1,18 @@ + FPI *fpi, fpi1; + int Rounding; +#ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */ + Rounding = Flt_Rounds; +#else /*}{*/ + Rounding = 1; + switch(fegetround()) { + case FE_TOWARDZERO: Rounding = 0; break; + case FE_UPWARD: Rounding = 2; break; + case FE_DOWNWARD: Rounding = 3; + } +#endif /*}}*/ + fpi = &fpi0; + if (Rounding != 1) { + fpi1 = fpi0; + fpi = &fpi1; + fpi1.rounding = Rounding; + } Modified: head/contrib/gdtoa/gdtoaimp.h ============================================================================== --- head/contrib/gdtoa/gdtoaimp.h Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/gdtoaimp.h Wed Jan 28 04:36:34 2009 (r187808) @@ -128,8 +128,10 @@ THIS SOFTWARE. * conversions of IEEE doubles in single-threaded executions with * 8-byte pointers, PRIVATE_MEM >= 7400 appears to suffice; with * 4-byte pointers, PRIVATE_MEM >= 7112 appears adequate. - * #define INFNAN_CHECK on IEEE systems to cause strtod to check for - * Infinity and NaN (case insensitively). + * #define NO_INFNAN_CHECK if you do not wish to have INFNAN_CHECK + * #defined automatically on IEEE systems. On such systems, + * when INFNAN_CHECK is #defined, strtod checks + * for Infinity and NaN (case insensitively). * When INFNAN_CHECK is #defined and No_Hex_NaN is not #defined, * strtodg also accepts (case insensitively) strings of the form * NaN(x), where x is a string of hexadecimal digits (optionally @@ -177,6 +179,9 @@ THIS SOFTWARE. #include "gdtoa.h" #include "gd_qnan.h" +#ifdef Honor_FLT_ROUNDS +#include +#endif #ifdef DEBUG #include "stdio.h" @@ -206,6 +211,7 @@ extern Char *MALLOC ANSI((size_t)); #define INFNAN_CHECK #define USE_LOCALE +#define NO_LOCALE_CACHE #define Honor_FLT_ROUNDS #define Trust_FLT_ROUNDS @@ -608,7 +614,7 @@ extern void memcpy_D2A ANSI((void*, cons extern void freedtoa ANSI((char*)); extern char *gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp, int mode, int ndigits, int *decpt, char **rve)); - extern char *g__fmt ANSI((char*, char*, char*, int, ULong)); + extern char *g__fmt ANSI((char*, char*, char*, int, ULong, size_t)); extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int)); extern void hexdig_init_D2A(Void); extern int hexnan ANSI((CONST char**, FPI*, ULong*)); @@ -626,7 +632,7 @@ extern void memcpy_D2A ANSI((void*, cons extern double ratio ANSI((Bigint*, Bigint*)); extern void rshift ANSI((Bigint*, int)); extern char *rv_alloc ANSI((int)); - extern Bigint *s2b ANSI((CONST char*, int, int, ULong)); + extern Bigint *s2b ANSI((CONST char*, int, int, ULong, int)); extern Bigint *set_ones ANSI((Bigint*, int)); extern char *strcp ANSI((char*, const char*)); extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*)); @@ -668,6 +674,10 @@ extern void memcpy_D2A ANSI((void*, cons * (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.) */ #ifdef IEEE_Arith +#ifndef NO_INFNAN_CHECK +#undef INFNAN_CHECK +#define INFNAN_CHECK +#endif #ifdef IEEE_MC68k #define _0 0 #define _1 1 Modified: head/contrib/gdtoa/gethex.c ============================================================================== --- head/contrib/gdtoa/gethex.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/gethex.c Wed Jan 28 04:36:34 2009 (r187808) @@ -49,9 +49,21 @@ gethex( CONST char **sp, FPI *fpi, Long ULong L, lostbits, *x; Long e, e1; #ifdef USE_LOCALE - unsigned char decimalpoint = *localeconv()->decimal_point; + int i; +#ifdef NO_LOCALE_CACHE + const unsigned char *decimalpoint = (unsigned char*)localeconv()->decimal_point; #else -#define decimalpoint '.' + const unsigned char *decimalpoint; + static unsigned char *decimalpoint_cache; + if (!(s0 = decimalpoint_cache)) { + s0 = (unsigned char*)localeconv()->decimal_point; + if ((decimalpoint_cache = (char*)malloc(strlen(s0) + 1))) { + strcpy(decimalpoint_cache, s0); + s0 = decimalpoint_cache; + } + } + decimalpoint = s0; +#endif #endif if (!hexdig['0']) @@ -66,11 +78,21 @@ gethex( CONST char **sp, FPI *fpi, Long decpt = 0; zret = 0; e = 0; - if (!hexdig[*s]) { + if (hexdig[*s]) + havedig++; + else { zret = 1; - if (*s != decimalpoint) +#ifdef USE_LOCALE + for(i = 0; decimalpoint[i]; ++i) { + if (s[i] != decimalpoint[i]) + goto pcheck; + } + decpt = s += i; +#else + if (*s != '.') goto pcheck; decpt = ++s; +#endif if (!hexdig[*s]) goto pcheck; while(*s == '0') @@ -82,11 +104,20 @@ gethex( CONST char **sp, FPI *fpi, Long } while(hexdig[*s]) s++; - if (*s == decimalpoint && !decpt) { +#ifdef USE_LOCALE + if (*s == *decimalpoint && !decpt) { + for(i = 1; decimalpoint[i]; ++i) { + if (s[i] != decimalpoint[i]) + goto pcheck; + } + decpt = s += i; +#else + if (*s == '.' && !decpt) { decpt = ++s; +#endif while(hexdig[*s]) s++; - } + }/*}*/ if (decpt) e = -(((Long)(s-decpt)) << 2); pcheck: @@ -118,7 +149,7 @@ gethex( CONST char **sp, FPI *fpi, Long } *sp = (char*)s; if (!havedig) - *sp = s0 - 1; + *sp = (char*)s0 - 1; if (zret) return STRTOG_Zero; if (big) { @@ -168,16 +199,26 @@ gethex( CONST char **sp, FPI *fpi, Long return STRTOG_Normal | STRTOG_Inexlo; } n = s1 - s0 - 1; - for(k = 0; n > 7; n >>= 1) + for(k = 0; n > (1 << kshift-2) - 1; n >>= 1) k++; b = Balloc(k); x = b->x; n = 0; L = 0; +#ifdef USE_LOCALE + for(i = 0; decimalpoint[i+1]; ++i); +#endif while(s1 > s0) { - if (*--s1 == decimalpoint) +#ifdef USE_LOCALE + if (*--s1 == decimalpoint[i]) { + s1 -= i; continue; - if (n == 32) { + } +#else + if (*--s1 == '.') + continue; +#endif + if (n == ULbits) { *x++ = L; L = 0; n = 0; @@ -187,7 +228,7 @@ gethex( CONST char **sp, FPI *fpi, Long } *x++ = L; b->wds = n = x - b->x; - n = 32*n - hi0bits(L); + n = ULbits*n - hi0bits(L); nbits = fpi->nbits; lostbits = 0; x = b->x; Modified: head/contrib/gdtoa/makefile ============================================================================== --- head/contrib/gdtoa/makefile Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/makefile Wed Jan 28 04:36:34 2009 (r187808) @@ -25,7 +25,7 @@ .SUFFIXES: .c .o CC = cc -CFLAGS = -g -DINFNAN_CHECK +CFLAGS = -g .c.o: $(CC) -c $(CFLAGS) $*.c @@ -55,9 +55,9 @@ gdtoa.a: dmisc.c dtoa.c g_Qfmt.c g__fmt. # If your system lacks ranlib, you do not need it. xs0 = README arithchk.c dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c g_dfmt.c\ - g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gdtoa.h gdtoaimp.h gethex.c\ - gmisc.c hd_init.c hexnan.c makefile misc.c qnan.c smisc.c strtoIQ.c\ - strtoId.c strtoIdd.c strtoIf.c strtoIg.c strtoIx.c strtoIxL.c\ + g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gdtoa.h gdtoa_fltrnds.h gdtoaimp.h\ + gethex.c gmisc.c hd_init.c hexnan.c makefile misc.c qnan.c smisc.c\ + strtoIQ.c strtoId.c strtoIdd.c strtoIf.c strtoIg.c strtoIx.c strtoIxL.c\ strtod.c strtodI.c strtodg.c strtodnrp.c strtof.c strtopQ.c strtopd.c\ strtopdd.c strtopf.c strtopx.c strtopxL.c strtorQ.c strtord.c strtordd.c\ strtorf.c strtorx.c strtorxL.c sum.c ulp.c Modified: head/contrib/gdtoa/smisc.c ============================================================================== --- head/contrib/gdtoa/smisc.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/smisc.c Wed Jan 28 04:36:34 2009 (r187808) @@ -34,9 +34,9 @@ THIS SOFTWARE. Bigint * s2b #ifdef KR_headers - (s, nd0, nd, y9) CONST char *s; int nd0, nd; ULong y9; + (s, nd0, nd, y9, dplen) CONST char *s; int dplen, nd0, nd; ULong y9; #else - (CONST char *s, int nd0, int nd, ULong y9) + (CONST char *s, int nd0, int nd, ULong y9, int dplen) #endif { Bigint *b; @@ -60,10 +60,10 @@ s2b s += 9; do b = multadd(b, 10, *s++ - '0'); while(++i < nd0); - s++; + s += dplen; } else - s += 10; + s += dplen + 9; for(; i < nd; i++) b = multadd(b, 10, *s++ - '0'); return b; Modified: head/contrib/gdtoa/strtod.c ============================================================================== --- head/contrib/gdtoa/strtod.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/strtod.c Wed Jan 28 04:36:34 2009 (r187808) @@ -80,6 +80,28 @@ strtod #ifdef SET_INEXACT int inexact, oldinexact; #endif +#ifdef USE_LOCALE /*{{*/ +#ifdef NO_LOCALE_CACHE + char *decimalpoint = localeconv()->decimal_point; + int dplen = strlen(decimalpoint); +#else + char *decimalpoint; + static char *decimalpoint_cache; + static int dplen; + if (!(s0 = decimalpoint_cache)) { + s0 = localeconv()->decimal_point; + if ((decimalpoint_cache = (char*)malloc(strlen(s0) + 1))) { + strcpy(decimalpoint_cache, s0); + s0 = decimalpoint_cache; + } + dplen = strlen(s0); + } + decimalpoint = (char*)s0; +#endif /*NO_LOCALE_CACHE*/ +#else /*USE_LOCALE}{*/ +#define dplen 1 +#endif /*USE_LOCALE}}*/ + #ifdef Honor_FLT_ROUNDS /*{*/ int Rounding; #ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */ @@ -118,7 +140,7 @@ strtod } break2: if (*s == '0') { -#ifndef NO_HEX_FP /*{{*/ +#ifndef NO_HEX_FP /*{*/ { static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI }; Long exp; @@ -157,7 +179,7 @@ strtod goto ret; } } -#endif +#endif /*}*/ nz0 = 1; while(*++s == '0') ; if (!*s) @@ -172,13 +194,17 @@ strtod z = 10*z + c - '0'; nd0 = nd; #ifdef USE_LOCALE - if (c == *localeconv()->decimal_point) + if (c == *decimalpoint) { + for(i = 1; decimalpoint[i]; ++i) + if (s[i] != decimalpoint[i]) + goto dig_done; + s += i; + c = *s; #else - if (c == '.') + if (c == '.') { + c = *++s; #endif - { decpt = 1; - c = *++s; if (!nd) { for(; c == '0'; c = *++s) nz++; @@ -207,7 +233,7 @@ strtod nz = 0; } } - } + }/*}*/ dig_done: e = 0; if (c == 'e' || c == 'E') { @@ -527,7 +553,7 @@ strtod /* Put digits into bd: true value = bd * 10^e */ - bd0 = s2b(s0, nd0, nd, y); + bd0 = s2b(s0, nd0, nd, y, dplen); for(;;) { bd = Balloc(bd0->k); @@ -974,7 +1000,11 @@ strtod dval(rv) *= dval(rv0); #ifndef NO_ERRNO /* try to avoid the bug of testing an 8087 register value */ +#ifdef IEEE_Arith + if (!(word0(rv) & Exp_mask)) +#else if (word0(rv) == 0 && word1(rv) == 0) +#endif errno = ERANGE; #endif } Modified: head/contrib/gdtoa/strtodg.c ============================================================================== --- head/contrib/gdtoa/strtodg.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/strtodg.c Wed Jan 28 04:36:34 2009 (r187808) @@ -331,6 +331,27 @@ strtodg Long L; ULong *b, *be, y, z; Bigint *ab, *bb, *bb1, *bd, *bd0, *bs, *delta, *rvb, *rvb0; +#ifdef USE_LOCALE /*{{*/ +#ifdef NO_LOCALE_CACHE + char *decimalpoint = localeconv()->decimal_point; + int dplen = strlen(decimalpoint); +#else + char *decimalpoint; + static char *decimalpoint_cache; + static int dplen; + if (!(s0 = decimalpoint_cache)) { + s0 = localeconv()->decimal_point; + if ((decimalpoint_cache = (char*)malloc(strlen(s0) + 1))) { + strcpy(decimalpoint_cache, s0); + s0 = decimalpoint_cache; + } + dplen = strlen(s0); + } + decimalpoint = (char*)s0; +#endif /*NO_LOCALE_CACHE*/ +#else /*USE_LOCALE}{*/ +#define dplen 1 +#endif /*USE_LOCALE}}*/ irv = STRTOG_Zero; denorm = sign = nz0 = nz = 0; @@ -389,13 +410,17 @@ strtodg z = 10*z + c - '0'; nd0 = nd; #ifdef USE_LOCALE - if (c == *localeconv()->decimal_point) + if (c == *decimalpoint) { + for(i = 1; decimalpoint[i]; ++i) + if (s[i] != decimalpoint[i]) + goto dig_done; + s += i; + c = *s; #else - if (c == '.') + if (c == '.') { + c = *++s; #endif - { decpt = 1; - c = *++s; if (!nd) { for(; c == '0'; c = *++s) nz++; @@ -424,7 +449,7 @@ strtodg nz = 0; } } - } + }/*}*/ dig_done: e = 0; if (c == 'e' || c == 'E') { @@ -683,7 +708,7 @@ strtodg /* Put digits into bd: true value = bd * 10^e */ - bd0 = s2b(s0, nd0, nd, y); + bd0 = s2b(s0, nd0, nd, y, dplen); for(;;) { bd = Balloc(bd0->k); @@ -992,7 +1017,7 @@ strtodg irv = STRTOG_Normal | STRTOG_Inexlo; *exp = fpi->emax; b = bits; - be = b + (fpi->nbits >> 5) + 1; + be = b + ((fpi->nbits + 31) >> 5); while(b < be) *b++ = -1; if ((j = fpi->nbits & 0x1f)) Modified: head/contrib/gdtoa/strtof.c ============================================================================== --- head/contrib/gdtoa/strtof.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/strtof.c Wed Jan 28 04:36:34 2009 (r187808) @@ -41,19 +41,16 @@ strtof(CONST char *s, char **sp) #endif { static FPI fpi0 = { 24, 1-127-24+1, 254-127-24+1, 1, SI }; - FPI *fpi, fpi1; ULong bits[1]; Long exp; int k; - int Rounding = Flt_Rounds; union { ULong L[1]; float f; } u; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif - fpi = &fpi0; - if (Rounding != FPI_Round_near) { - fpi1 = fpi0; - fpi1.rounding = Rounding; - fpi = &fpi1; - } k = strtodg(s, sp, fpi, &exp, bits); switch(k & STRTOG_Retmask) { case STRTOG_NoNumber: Modified: head/contrib/gdtoa/strtopQ.c ============================================================================== --- head/contrib/gdtoa/strtopQ.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/strtopQ.c Wed Jan 28 04:36:34 2009 (r187808) @@ -56,13 +56,18 @@ strtopQ(s, sp, V) CONST char *s; char ** strtopQ(CONST char *s, char **sp, void *V) #endif { - static FPI fpi = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, SI }; + static FPI fpi0 = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, SI }; ULong bits[4]; Long exp; int k; ULong *L = (ULong*)V; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif - k = strtodg(s, sp, &fpi, &exp, bits); + k = strtodg(s, sp, fpi, &exp, bits); switch(k & STRTOG_Retmask) { case STRTOG_NoNumber: case STRTOG_Zero: Modified: head/contrib/gdtoa/strtopd.c ============================================================================== --- head/contrib/gdtoa/strtopd.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/strtopd.c Wed Jan 28 04:36:34 2009 (r187808) @@ -42,8 +42,13 @@ strtopd(CONST char *s, char **sp, double ULong bits[2]; Long exp; int k; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif - k = strtodg(s, sp, &fpi0, &exp, bits); + k = strtodg(s, sp, fpi, &exp, bits); ULtod((ULong*)d, bits, exp, k); return k; } Modified: head/contrib/gdtoa/strtopdd.c ============================================================================== --- head/contrib/gdtoa/strtopdd.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/strtopdd.c Wed Jan 28 04:36:34 2009 (r187808) @@ -39,9 +39,9 @@ strtopdd(CONST char *s, char **sp, doubl #endif { #ifdef Sudden_Underflow - static FPI fpi = { 106, 1-1023, 2046-1023-106+1, 1, 1 }; + static FPI fpi0 = { 106, 1-1023, 2046-1023-106+1, 1, 1 }; #else - static FPI fpi = { 106, 1-1023-53+1, 2046-1023-106+1, 1, 0 }; + static FPI fpi0 = { 106, 1-1023-53+1, 2046-1023-106+1, 1, 0 }; #endif ULong bits[4]; Long exp; @@ -51,8 +51,13 @@ strtopdd(CONST char *s, char **sp, doubl ULong L[4]; } U; U *u; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif - rv = strtodg(s, sp, &fpi, &exp, bits); + rv = strtodg(s, sp, fpi, &exp, bits); u = (U*)dd; switch(rv & STRTOG_Retmask) { case STRTOG_NoNumber: Modified: head/contrib/gdtoa/strtopf.c ============================================================================== --- head/contrib/gdtoa/strtopf.c Wed Jan 28 03:52:26 2009 (r187807) +++ head/contrib/gdtoa/strtopf.c Wed Jan 28 04:36:34 2009 (r187808) @@ -38,12 +38,17 @@ strtopf(s, sp, f) CONST char *s; char ** strtopf(CONST char *s, char **sp, float *f) #endif { - static FPI fpi = { 24, 1-127-24+1, 254-127-24+1, 1, SI }; + static FPI fpi0 = { 24, 1-127-24+1, 254-127-24+1, 1, SI }; ULong bits[1], *L; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 04:37:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1203C1065675; Wed, 28 Jan 2009 04:37:28 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00E7D8FC24; Wed, 28 Jan 2009 04:37:28 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0S4bRpA007172; Wed, 28 Jan 2009 04:37:27 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0S4bR8e007171; Wed, 28 Jan 2009 04:37:27 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200901280437.n0S4bR8e007171@svn.freebsd.org> From: David Schultz Date: Wed, 28 Jan 2009 04:37:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187809 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 04:37:28 -0000 Author: das Date: Wed Jan 28 04:37:27 2009 New Revision: 187809 URL: http://svn.freebsd.org/changeset/base/187809 Log: Update the manpage to reflect r145172. Modified: head/lib/libc/stdio/printf.3 Modified: head/lib/libc/stdio/printf.3 ============================================================================== --- head/lib/libc/stdio/printf.3 Wed Jan 28 04:36:34 2009 (r187808) +++ head/lib/libc/stdio/printf.3 Wed Jan 28 04:37:27 2009 (r187809) @@ -207,8 +207,7 @@ conversions, this option has no effect. For .Cm o conversions, the precision of the number is increased to force the first -character of the output string to a zero (except if a zero value is printed -with an explicit precision of zero). +character of the output string to a zero. For .Cm x and From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 05:21:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B68B11065673 for ; Wed, 28 Jan 2009 05:21:02 +0000 (UTC) (envelope-from grafan@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.154]) by mx1.freebsd.org (Postfix) with ESMTP id 44B4C8FC1D for ; Wed, 28 Jan 2009 05:21:02 +0000 (UTC) (envelope-from grafan@gmail.com) Received: by fg-out-1718.google.com with SMTP id e12so363277fga.35 for ; Tue, 27 Jan 2009 21:21:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=fcFhHH8NC3/mxhCu20l860P0RwWLh0mrfWc9k5qABok=; b=Q6UqyHQkNvylgRcdK0omAqKCPUhxc69GCO6v1KaYgCbnFjQ7CCyZ4KS6QA7BQCk/Oj GahTmfUb3LbzsOusYQi/T8c4MAo0e5wh4QwLgw71/n/dLfvZb7I1MrjFuk48X+8rdRsM sLSnghi0JQh3nNSjwg/2s9i1sVyZ0delnawDg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=lPF/upPD7+/rVCQtl1L1WZ6CfNE/1u76X14e/UonJ1GJg8P8rn+nnZfiQqM6koX87u kDLmOona3pMejw/+XFiNaaJ2qBth86CBCDeLGwN9HuxsnNCXaC8FgfbcR8S34S5jWYE+ Ap2rmgTUcHHsCtxDUw+kZbg4Vtmikrfc/R6Pk= MIME-Version: 1.0 Received: by 10.181.153.12 with SMTP id f12mr1271925bko.132.1233118222904; Tue, 27 Jan 2009 20:50:22 -0800 (PST) In-Reply-To: <200901272013.n0RKDOBR095434@svn.freebsd.org> References: <200901272013.n0RKDOBR095434@svn.freebsd.org> Date: Wed, 28 Jan 2009 12:50:22 +0800 Message-ID: <6eb82e0901272050l6678ea37idc8ea53e948a15e5@mail.gmail.com> From: Rong-en Fan To: Giorgos Keramidas Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187782 - in head: etc/rc.d share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 05:21:03 -0000 On Wed, Jan 28, 2009 at 4:13 AM, Giorgos Keramidas wrote: > Author: keramida (doc committer) > Date: Tue Jan 27 20:13:24 2009 > New Revision: 187782 > URL: http://svn.freebsd.org/changeset/base/187782 > > Log: > When synchronizing the clock at system startup time, use both > the -g and -q options. They do a slightly different thing and > both are necessary when the time difference is large. > > Noticed by: danger, in the forums > Approved by: roberto > MFC after: 1 week > > Modified: > head/etc/rc.d/ntpd > head/share/man/man5/rc.conf.5 > > Modified: head/etc/rc.d/ntpd > ============================================================================== > --- head/etc/rc.d/ntpd Tue Jan 27 19:56:38 2009 (r187781) > +++ head/etc/rc.d/ntpd Tue Jan 27 20:13:24 2009 (r187782) > @@ -23,7 +23,7 @@ ntpd_precmd() > rc_flags="-c ${ntpd_config} ${ntpd_flags}" > > if checkyesno ntpd_sync_on_start; then > - rc_flags="-g $rc_flags" > + rc_flags="-q -g $rc_flags" > fi > > if [ -z "$ntpd_chrootdir" ]; then > According to ntp(8), -q makes ntpd exits just after the first time the clock is set. Doesn't this mean if ntpd_sync_on_start is on and the time difference is large, then ntpd will exit after the first time sync? Is this the behavior we really want? Shouldn't we keep ntp running after the clock is adjusted? Thanks, Rong-En Fan From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 07:36:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B0FC106564A; Wed, 28 Jan 2009 07:36:37 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id BECD08FC19; Wed, 28 Jan 2009 07:36:36 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from kobe.laptop (adsl21-232.kln.forthnet.gr [77.49.148.232]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id n0S7PiId001090 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 28 Jan 2009 09:25:49 +0200 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n0S7Ph6G050894; Wed, 28 Jan 2009 09:25:43 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n0S7PhdU050893; Wed, 28 Jan 2009 09:25:43 +0200 (EET) (envelope-from keramida@freebsd.org) From: Giorgos Keramidas To: Rong-en Fan References: <200901272013.n0RKDOBR095434@svn.freebsd.org> <6eb82e0901272050l6678ea37idc8ea53e948a15e5@mail.gmail.com> Date: Wed, 28 Jan 2009 09:25:42 +0200 In-Reply-To: <6eb82e0901272050l6678ea37idc8ea53e948a15e5@mail.gmail.com> (Rong-en Fan's message of "Wed, 28 Jan 2009 12:50:22 +0800") Message-ID: <87r62nnb7t.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-MailScanner-ID: n0S7PiId001090 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.47, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL -0.07, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@freebsd.org X-Spam-Status: No Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187782 - in head: etc/rc.d share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 07:36:37 -0000 On Wed, 28 Jan 2009 12:50:22 +0800, Rong-en Fan wrote: > On Wed, Jan 28, 2009 at 4:13 AM, Giorgos Keramidas wrote: >> Modified: head/etc/rc.d/ntpd >> ============================================================================== >> --- head/etc/rc.d/ntpd Tue Jan 27 19:56:38 2009 (r187781) >> +++ head/etc/rc.d/ntpd Tue Jan 27 20:13:24 2009 (r187782) >> @@ -23,7 +23,7 @@ ntpd_precmd() >> rc_flags="-c ${ntpd_config} ${ntpd_flags}" >> >> if checkyesno ntpd_sync_on_start; then >> - rc_flags="-g $rc_flags" >> + rc_flags="-q -g $rc_flags" >> fi >> >> if [ -z "$ntpd_chrootdir" ]; then >> > > According to ntp(8), -q makes ntpd exits just after the first time the > clock is set. Yes, you are right :) > Doesn't this mean if ntpd_sync_on_start is on and the time difference > is large, then ntpd will exit after the first time sync? Is this the > behavior we really want? > > Shouldn't we keep ntp running after the clock is adjusted? This is correct too. The effect of `ntpd_sync_on_start' is supposed to be the same as if we run `ntpdate' before the real ntpd starts, so this option only applies to the first sync-once instance of ntpd. The real ntpd starts later, and finds the clock pre-synced. From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 07:46:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 282EC1065672; Wed, 28 Jan 2009 07:46:36 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 14D968FC18; Wed, 28 Jan 2009 07:46:36 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0S7kZrw010926; Wed, 28 Jan 2009 07:46:35 GMT (envelope-from rodrigc@svn.freebsd.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0S7kZdP010924; Wed, 28 Jan 2009 07:46:35 GMT (envelope-from rodrigc@svn.freebsd.org) Message-Id: <200901280746.n0S7kZdP010924@svn.freebsd.org> From: Craig Rodrigues Date: Wed, 28 Jan 2009 07:46:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187812 - in head: sbin/mount_nfs sys/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 07:46:36 -0000 Author: rodrigc Date: Wed Jan 28 07:46:35 2009 New Revision: 187812 URL: http://svn.freebsd.org/changeset/base/187812 Log: Fix parsing of acregmin, acregmax, acdirmin and acdirmax NFS mount options when passed as strings via nmount(). Submitted by: Jaakko Heinonen Modified: head/sbin/mount_nfs/mount_nfs.c head/sys/nfsclient/nfs_vfsops.c Modified: head/sbin/mount_nfs/mount_nfs.c ============================================================================== --- head/sbin/mount_nfs/mount_nfs.c Wed Jan 28 05:18:21 2009 (r187811) +++ head/sbin/mount_nfs/mount_nfs.c Wed Jan 28 07:46:35 2009 (r187812) @@ -584,25 +584,25 @@ fallback_mount(struct iovec *iov, int io } if (findopt(iov, iovlen, "acregmin", &opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.acregmin); - if (ret != 1 || args.acregmin <= 0) { + if (ret != 1 || args.acregmin < 0) { errx(1, "illegal acregmin: %s", opt); } } if (findopt(iov, iovlen, "acregmax", &opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.acregmax); - if (ret != 1 || args.acregmax <= 0) { + if (ret != 1 || args.acregmax < 0) { errx(1, "illegal acregmax: %s", opt); } } if (findopt(iov, iovlen, "acdirmin", &opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.acdirmin); - if (ret != 1 || args.acdirmin <= 0) { + if (ret != 1 || args.acdirmin < 0) { errx(1, "illegal acdirmin: %s", opt); } } if (findopt(iov, iovlen, "acdirmax", &opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.acdirmax); - if (ret != 1 || args.acdirmax <= 0) { + if (ret != 1 || args.acdirmax < 0) { errx(1, "illegal acdirmax: %s", opt); } } Modified: head/sys/nfsclient/nfs_vfsops.c ============================================================================== --- head/sys/nfsclient/nfs_vfsops.c Wed Jan 28 05:18:21 2009 (r187811) +++ head/sys/nfsclient/nfs_vfsops.c Wed Jan 28 07:46:35 2009 (r187812) @@ -976,39 +976,43 @@ nfs_mount(struct mount *mp, struct threa } if (vfs_getopt(mp->mnt_optnew, "acregmin", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.acregmin); - if (ret != 1 || args.acregmin <= 0) { + if (ret != 1 || args.acregmin < 0) { vfs_mount_error(mp, "illegal acregmin: %s", opt); error = EINVAL; goto out; } + args.flags |= NFSMNT_ACREGMIN; } if (vfs_getopt(mp->mnt_optnew, "acregmax", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.acregmax); - if (ret != 1 || args.acregmax <= 0) { + if (ret != 1 || args.acregmax < 0) { vfs_mount_error(mp, "illegal acregmax: %s", opt); error = EINVAL; goto out; } + args.flags |= NFSMNT_ACREGMAX; } if (vfs_getopt(mp->mnt_optnew, "acdirmin", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.acdirmin); - if (ret != 1 || args.acdirmin <= 0) { + if (ret != 1 || args.acdirmin < 0) { vfs_mount_error(mp, "illegal acdirmin: %s", opt); error = EINVAL; goto out; } + args.flags |= NFSMNT_ACDIRMIN; } if (vfs_getopt(mp->mnt_optnew, "acdirmax", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.acdirmax); - if (ret != 1 || args.acdirmax <= 0) { + if (ret != 1 || args.acdirmax < 0) { vfs_mount_error(mp, "illegal acdirmax: %s", opt); error = EINVAL; goto out; } + args.flags |= NFSMNT_ACDIRMAX; } if (vfs_getopt(mp->mnt_optnew, "deadthresh", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.deadthresh); From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 08:21:47 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 333D9106566C; Wed, 28 Jan 2009 08:21:47 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id D61848FC0C; Wed, 28 Jan 2009 08:21:46 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id DC44B9CB07B; Wed, 28 Jan 2009 09:19:16 +0100 (CET) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FMpk9zBL0oYM; Wed, 28 Jan 2009 09:19:14 +0100 (CET) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id A203D9CB0EC; Wed, 28 Jan 2009 09:19:14 +0100 (CET) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n0S8JE5h022537; Wed, 28 Jan 2009 09:19:14 +0100 (CET) (envelope-from rdivacky) Date: Wed, 28 Jan 2009 09:19:14 +0100 From: Roman Divacky To: Tom Rhodes Message-ID: <20090128081914.GA22309@freebsd.org> References: <200901280111.n0S1BL7n003092@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200901280111.n0S1BL7n003092@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r187805 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 08:21:47 -0000 On Wed, Jan 28, 2009 at 01:11:21AM +0000, Tom Rhodes wrote: > Author: trhodes > Date: Wed Jan 28 01:11:20 2009 > New Revision: 187805 > URL: http://svn.freebsd.org/changeset/base/187805 > > Log: > Remove comment about clearerr() being the only method of clearing > the EOF indicator, fseek() may also be used for this. why not saying what you state in the commit message in the man page instead of removing the info entirely? > Bump document date. > > PR: 76333 > Submitted by: Yoshihiko Sarumaru > > Modified: > head/lib/libc/stdio/ferror.3 > > Modified: head/lib/libc/stdio/ferror.3 > ============================================================================== > --- head/lib/libc/stdio/ferror.3 Wed Jan 28 00:15:35 2009 (r187804) > +++ head/lib/libc/stdio/ferror.3 Wed Jan 28 01:11:20 2009 (r187805) > @@ -32,7 +32,7 @@ > .\" @(#)ferror.3 8.2 (Berkeley) 4/19/94 > .\" $FreeBSD$ > .\" > -.Dd January 10, 2003 > +.Dd January 27, 2009 > .Dt FERROR 3 > .Os > .Sh NAME > @@ -77,8 +77,6 @@ The function > tests the end-of-file indicator for the stream pointed to by > .Fa stream , > returning non-zero if it is set. > -The end-of-file indicator can only be cleared by the function > -.Fn clearerr . > .Pp > The function > .Fn ferror From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 08:39:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 564FE1065670; Wed, 28 Jan 2009 08:39:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44B328FC19; Wed, 28 Jan 2009 08:39:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0S8dn30011961; Wed, 28 Jan 2009 08:39:49 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0S8dncx011960; Wed, 28 Jan 2009 08:39:49 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200901280839.n0S8dncx011960@svn.freebsd.org> From: Warner Losh Date: Wed, 28 Jan 2009 08:39:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187813 - head/sys/modules/usb2 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 08:39:49 -0000 Author: imp Date: Wed Jan 28 08:39:48 2009 New Revision: 187813 URL: http://svn.freebsd.org/changeset/base/187813 Log: at91dci isn't useful except on arm. Modified: head/sys/modules/usb2/Makefile Modified: head/sys/modules/usb2/Makefile ============================================================================== --- head/sys/modules/usb2/Makefile Wed Jan 28 07:46:35 2009 (r187812) +++ head/sys/modules/usb2/Makefile Wed Jan 28 08:39:48 2009 (r187813) @@ -30,7 +30,9 @@ SUBDIR += bluetooth SUBDIR += bluetooth_ng SUBDIR += bluetooth_fw SUBDIR += controller +.if ${MACHINE_ARCH} == "arm" SUBDIR += controller_at91dci +#endif SUBDIR += controller_ehci SUBDIR += controller_musb SUBDIR += controller_ohci @@ -87,4 +89,3 @@ SUBDIR += wlan_rum SUBDIR += wlan_zyd .include - From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 09:33:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A3141065674; Wed, 28 Jan 2009 09:33:00 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6CF198FC22; Wed, 28 Jan 2009 09:33:00 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0S9X0Vg012913; Wed, 28 Jan 2009 09:33:00 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0S9X0HS012911; Wed, 28 Jan 2009 09:33:00 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200901280933.n0S9X0HS012911@svn.freebsd.org> From: Robert Watson Date: Wed, 28 Jan 2009 09:33:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187814 - head/sbin/dumpfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 09:33:01 -0000 Author: rwatson Date: Wed Jan 28 09:33:00 2009 New Revision: 187814 URL: http://svn.freebsd.org/changeset/base/187814 Log: Add a new flag to dumpfs(8), -f, which causes dumpfs to list all free fragments in the file system by fragment (block) number. This new mode does the necessary arithmetic to generate absolute fragment numbers rather than than the cg-relative numbers printed in the default mode. If -f is passed once, contiguous fragment ranges are collapsed into an X-Y format as free block lists are currently printed in regular dumpfs output, but if specified twice, all block numbers are printed individually, allowing both compact and more script-friendly representation. This proves quite handy when attempting to recover deleted data, as it allows exclusion of non-deleted data from blocks searched. MFC after: 1 week Discussed with: jeff, Richard Clayton Sponsored by: Google, Inc. Modified: head/sbin/dumpfs/dumpfs.8 head/sbin/dumpfs/dumpfs.c Modified: head/sbin/dumpfs/dumpfs.8 ============================================================================== --- head/sbin/dumpfs/dumpfs.8 Wed Jan 28 08:39:48 2009 (r187813) +++ head/sbin/dumpfs/dumpfs.8 Wed Jan 28 09:33:00 2009 (r187814) @@ -36,15 +36,18 @@ .Nd dump file system information .Sh SYNOPSIS .Nm +.Op Fl f .Op Fl m .Ar filesys | device .Sh DESCRIPTION The .Nm utility prints out the super block and cylinder group information -for the file system or special device specified, unless +for the file system or special device specified, unless the +.Fl f +or .Fl m -is specified. +flag is specified. The listing is very long and detailed. This command is useful mostly for finding out certain file system @@ -52,6 +55,15 @@ information such as the file system bloc free space percentage. .Pp If +.Fl f +is specified, a sorted list of all free fragments and free fragment ranges, +as represented in cylinder group block free lists, is printed. +If the flag is specified twice, contiguous free fragments are not collapsed +into ranges and instead printed in a simple list. +Fragment numbers may be converted to raw byte offsets by multiplying by the +fragment size, which may be useful when recovering deleted data. +.Pp +If .Fl m is specified, a .Xr newfs 8 Modified: head/sbin/dumpfs/dumpfs.c ============================================================================== --- head/sbin/dumpfs/dumpfs.c Wed Jan 28 08:39:48 2009 (r187813) +++ head/sbin/dumpfs/dumpfs.c Wed Jan 28 09:33:00 2009 (r187814) @@ -1,4 +1,10 @@ /* + * Copyright (c) 2009 Robert N. M. Watson + * All rights reserved. + * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Copyright (c) 2002 Networks Associates Technology, Inc. * All rights reserved. * @@ -74,8 +80,11 @@ struct uufsd disk; int dumpfs(const char *); int dumpcg(void); +int dumpfreespace(const char *, int); +void dumpfreespacecg(int); int marshal(const char *); void pbits(void *, int); +void pblklist(void *, int, off_t, int); void ufserr(const char *); void usage(void) __dead2; @@ -83,12 +92,15 @@ int main(int argc, char *argv[]) { const char *name; - int ch, domarshal, eval; + int ch, dofreespace, domarshal, eval; - domarshal = eval = 0; + dofreespace = domarshal = eval = 0; - while ((ch = getopt(argc, argv, "m")) != -1) { + while ((ch = getopt(argc, argv, "fm")) != -1) { switch (ch) { + case 'f': + dofreespace++; + break; case 'm': domarshal = 1; break; @@ -102,6 +114,10 @@ main(int argc, char *argv[]) if (argc < 1) usage(); + if (dofreespace && domarshal) + usage(); + if (dofreespace > 2) + usage(); while ((name = *argv++) != NULL) { if (ufs_disk_fillout(&disk, name) == -1) { @@ -109,7 +125,9 @@ main(int argc, char *argv[]) eval |= 1; continue; } - if (domarshal) + if (dofreespace) + eval |= dumpfreespace(name, dofreespace); + else if (domarshal) eval |= marshal(name); else eval |= dumpfs(name); @@ -333,6 +351,30 @@ dumpcg(void) } int +dumpfreespace(const char *name, int fflag) +{ + int i; + + while ((i = cgread(&disk)) != 0) { + if (i == -1) + goto err; + dumpfreespacecg(fflag); + } + return (0); +err: + ufserr(name); + return (1); +} + +void +dumpfreespacecg(int fflag) +{ + + pblklist(cg_blksfree(&acg), afs.fs_fpg, disk.d_lcg * afs.fs_fpg, + fflag); +} + +int marshal(const char *name) { struct fs *fs; @@ -401,6 +443,27 @@ pbits(void *vp, int max) } void +pblklist(void *vp, int max, off_t offset, int fflag) +{ + int i, j; + char *p; + + for (i = 0, p = vp; i < max; i++) { + if (isset(p, i)) { + printf("%jd", (intmax_t)(i + offset)); + if (fflag < 2) { + j = i; + while ((i+1) Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A06C106564A; Wed, 28 Jan 2009 10:41:11 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07F0F8FC0C; Wed, 28 Jan 2009 10:41:11 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SAfA6I017540; Wed, 28 Jan 2009 10:41:10 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SAfApB017539; Wed, 28 Jan 2009 10:41:10 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <200901281041.n0SAfApB017539@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Wed, 28 Jan 2009 10:41:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187815 - head/sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 10:41:12 -0000 Author: vanhu Date: Wed Jan 28 10:41:10 2009 New Revision: 187815 URL: http://svn.freebsd.org/changeset/base/187815 Log: 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 MFC after: 1 month Modified: head/sys/netipsec/ipsec_mbuf.c Modified: head/sys/netipsec/ipsec_mbuf.c ============================================================================== --- head/sys/netipsec/ipsec_mbuf.c Wed Jan 28 09:33:00 2009 (r187814) +++ head/sys/netipsec/ipsec_mbuf.c Wed Jan 28 10:41:10 2009 (r187815) @@ -75,66 +75,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; - V_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; - V_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 */ } + V_ipsec4stat.ips_mbinserted++; } else { /* * Copy the remainder to the back of the mbuf From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 11:04:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 159F4106564A; Wed, 28 Jan 2009 11:04:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 03D9A8FC08; Wed, 28 Jan 2009 11:04:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SB4RGZ017976; Wed, 28 Jan 2009 11:04:27 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SB4Rgj017975; Wed, 28 Jan 2009 11:04:27 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <200901281104.n0SB4Rgj017975@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 28 Jan 2009 11:04:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187816 - head/sys/modules/usb2 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 11:04:28 -0000 Author: glebius Date: Wed Jan 28 11:04:27 2009 New Revision: 187816 URL: http://svn.freebsd.org/changeset/base/187816 Log: Fix typo in last commit. Modified: head/sys/modules/usb2/Makefile Modified: head/sys/modules/usb2/Makefile ============================================================================== --- head/sys/modules/usb2/Makefile Wed Jan 28 10:41:10 2009 (r187815) +++ head/sys/modules/usb2/Makefile Wed Jan 28 11:04:27 2009 (r187816) @@ -32,7 +32,7 @@ SUBDIR += bluetooth_fw SUBDIR += controller .if ${MACHINE_ARCH} == "arm" SUBDIR += controller_at91dci -#endif +.endif SUBDIR += controller_ehci SUBDIR += controller_musb SUBDIR += controller_ohci From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 11:15:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8EA01065670; Wed, 28 Jan 2009 11:15:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 806448FC21; Wed, 28 Jan 2009 11:15:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-120-227.carlnfd1.nsw.optusnet.com.au (c122-107-120-227.carlnfd1.nsw.optusnet.com.au [122.107.120.227]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n0SBFMZm005050 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 28 Jan 2009 22:15:24 +1100 Date: Wed, 28 Jan 2009 22:15:22 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Roman Divacky In-Reply-To: <20090128081914.GA22309@freebsd.org> Message-ID: <20090128212904.E45316@delplex.bde.org> References: <200901280111.n0S1BL7n003092@svn.freebsd.org> <20090128081914.GA22309@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, Tom Rhodes , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187805 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 11:15:33 -0000 On Wed, 28 Jan 2009, Roman Divacky wrote: > On Wed, Jan 28, 2009 at 01:11:21AM +0000, Tom Rhodes wrote: >> Log: >> Remove comment about clearerr() being the only method of clearing >> the EOF indicator, fseek() may also be used for this. fseek() can't always be used for this, since fseek() fails for unseekable files (even SEEK_CUR fails then). However, when it works, it has the advantage(?) of not clobbering the error indicator. The comment was also wrong because the EOF indicator can also be cleared by clearerr_unlocked() in some cases and by fseeko() in the same cases as by fseek(). > why not saying what you state in the commit message in the man page > instead of removing the info entirely? Well, neither C99 nor POSIX say this for feof(). The man page still says that the error indicator can only be cleared by clearerr(). This is false since a sucessful rewind() clears both indicators, and the indicator can be cleared by clearerr_unlocked() in some cases. I think the man page is trying to make the false claims that the indicators are not cleared as side effects and is not trying to list all the functions that do clear the indicators as side effects, and that it shouldn't try to do the latter. The list for the EOF indicator may be quite long and system-and-time-dependent since it includes the closure of all functions that call fseek(), or fseeko()). For both indicators, the list includes the closure of all functions that call clearerr() or clearerr_unlocked(). Perhaps no such functions in standard libraries are permitted to operate on application streams, but this is unclear. Bruce From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 11:25:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 123DF106564A; Wed, 28 Jan 2009 11:25:23 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 007C18FC1E; Wed, 28 Jan 2009 11:25:23 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SBPMmr018377; Wed, 28 Jan 2009 11:25:22 GMT (envelope-from trhodes@svn.freebsd.org) Received: (from trhodes@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SBPMCT018376; Wed, 28 Jan 2009 11:25:22 GMT (envelope-from trhodes@svn.freebsd.org) Message-Id: <200901281125.n0SBPMCT018376@svn.freebsd.org> From: Tom Rhodes Date: Wed, 28 Jan 2009 11:25:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187817 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 11:25:23 -0000 Author: trhodes Date: Wed Jan 28 11:25:22 2009 New Revision: 187817 URL: http://svn.freebsd.org/changeset/base/187817 Log: Remove another comment about clearing EOF indicator. Noticed by: bde Modified: head/lib/libc/stdio/ferror.3 Modified: head/lib/libc/stdio/ferror.3 ============================================================================== --- head/lib/libc/stdio/ferror.3 Wed Jan 28 11:04:27 2009 (r187816) +++ head/lib/libc/stdio/ferror.3 Wed Jan 28 11:25:22 2009 (r187817) @@ -32,7 +32,7 @@ .\" @(#)ferror.3 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd January 27, 2009 +.Dd January 28, 2009 .Dt FERROR 3 .Os .Sh NAME @@ -83,9 +83,6 @@ The function tests the error indicator for the stream pointed to by .Fa stream , returning non-zero if it is set. -The error indicator can only be reset by the -.Fn clearerr -function. .Pp The function .Fn fileno From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 11:27:14 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1C6D1065674; Wed, 28 Jan 2009 11:27:14 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 73B9D8FC0C; Wed, 28 Jan 2009 11:27:14 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-120-227.carlnfd1.nsw.optusnet.com.au (c122-107-120-227.carlnfd1.nsw.optusnet.com.au [122.107.120.227]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n0SBQnH4015485 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 28 Jan 2009 22:26:50 +1100 Date: Wed, 28 Jan 2009 22:26:49 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Kostik Belousov In-Reply-To: <20090126201146.GD2009@deviant.kiev.zoral.com.ua> Message-ID: <20090128221540.M45316@delplex.bde.org> References: <200901230058.n0N0wEjY026935@svn.freebsd.org> <20090125162123.GB17198@hoeg.nl> <20090126041926.J43097@delplex.bde.org> <20090125175751.GC17198@hoeg.nl> <20090126051910.E2148@besplex.bde.org> <20090126190310.GA31728@zim.MIT.EDU> <20090126201146.GD2009@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Ed Schouten , src-committers@FreeBSD.org, Tom Rhodes , svn-src-all@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org, David Schultz Subject: Re: svn commit: r187607 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 11:27:15 -0000 On Mon, 26 Jan 2009, Kostik Belousov wrote: > On Mon, Jan 26, 2009 at 02:03:10PM -0500, David Schultz wrote: >> On Mon, Jan 26, 2009, Bruce Evans wrote: >>> - P_SYSTEM has something to do with swapping, and I also removed the >>> PS_INMEM setting for init. I have always used NO_SWAPPING and haven't >>> used a swap partition since memory sizes reached 64MB, so I wouldn't >>> have noticed problems with this. init doesn't run often so it is >>> quite likely to be swapped (if allowed to) if real memory runs out. >> >> Process kstack swapping was removed several years ago, so >> "swapping out" a process just deactivates all of its pages. >> In principle this could be safe to do with init, but it's probably >> a bad idea, and perhaps could lead to deadlock in the >> out-of-swap-space -> kill a process -> reparent the zombie to init >> path. PS_INMEM will prevent init from being swapped out. > > Process kernel stacks swapping, or more explicitely, allowance to page out > threads kernel stacks, is in the kernel. It is performed by vmdaemon, > look for the call to swapout_procs(). > > Kernel stack contains pcb, but not the struct thread. Notifying the target > process about raised signal requires only struct proc and referenced > structures (p_sigact, p_sigqueue etc) that cannot be paged out. > > More interesting propery of the P_SYSTEM process is the immunity to the > oom killer. But vm_pageout_oom() explicitely cares to not kill pid 1 > or pid < 48. Anyway, I now think my removal of the explicit setting of PS_INMEM is just a style fix (removal of dead code). PS_INMEM is set for process 0 and should be inherited on fork for all processes including init; it should only be cleared for any process long after the fork of init, if swapping occurs, as part of swapping out (mainly to indicate that the swapout has occurred). If swapping out of init is to be prevented, then it should be done of init should be prevented using a flag different from P_SYSTEM, since P_SYSTEM has too much scope and the pid hacks are ugly, but the pid hacks work for now. Bruce From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 11:31:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C543B1065673; Wed, 28 Jan 2009 11:31:09 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 999BA8FC19; Wed, 28 Jan 2009 11:31:09 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SBV9im018504; Wed, 28 Jan 2009 11:31:09 GMT (envelope-from trhodes@svn.freebsd.org) Received: (from trhodes@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SBV9Y2018503; Wed, 28 Jan 2009 11:31:09 GMT (envelope-from trhodes@svn.freebsd.org) Message-Id: <200901281131.n0SBV9Y2018503@svn.freebsd.org> From: Tom Rhodes Date: Wed, 28 Jan 2009 11:31:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187818 - head/sbin/dumpfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 11:31:10 -0000 Author: trhodes Date: Wed Jan 28 11:31:09 2009 New Revision: 187818 URL: http://svn.freebsd.org/changeset/base/187818 Log: Bump doc date for recent change. Modified: head/sbin/dumpfs/dumpfs.8 Modified: head/sbin/dumpfs/dumpfs.8 ============================================================================== --- head/sbin/dumpfs/dumpfs.8 Wed Jan 28 11:25:22 2009 (r187817) +++ head/sbin/dumpfs/dumpfs.8 Wed Jan 28 11:31:09 2009 (r187818) @@ -28,7 +28,7 @@ .\" @(#)dumpfs.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd January 19, 2003 +.Dd January 28, 2009 .Dt DUMPFS 8 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 11:43:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9740A106564A; Wed, 28 Jan 2009 11:43:13 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A40A8FC27; Wed, 28 Jan 2009 11:43:13 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SBhDa1018738; Wed, 28 Jan 2009 11:43:13 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SBhDlE018737; Wed, 28 Jan 2009 11:43:13 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901281143.n0SBhDlE018737@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 28 Jan 2009 11:43:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187819 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 11:43:14 -0000 Author: luigi Date: Wed Jan 28 11:43:12 2009 New Revision: 187819 URL: http://svn.freebsd.org/changeset/base/187819 Log: Avoid the use of duplicated typedefs -- see the comment for details. Modified: head/sbin/ipfw/ipfw2.h Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Wed Jan 28 11:31:09 2009 (r187818) +++ head/sbin/ipfw/ipfw2.h Wed Jan 28 11:43:12 2009 (r187819) @@ -210,12 +210,18 @@ struct in6_addr; void n2mask(struct in6_addr *mask, int n); int contigmask(uint8_t *p, int len); -/* forward declarations to avoid header dependency */ -typedef struct _ipfw_insn ipfw_insn; -typedef struct _ipfw_insn_u32 ipfw_insn_u32; -typedef struct _ipfw_insn_ip6 ipfw_insn_ip6; -typedef struct _ipfw_insn_icmp6 ipfw_insn_icmp6; - +/* + * Forward declarations to avoid include way too many headers. + * C does not allow duplicated typedefs, so we use the base struct + * that the typedef points to. + * Should the typedefs use a different type, the compiler will + * still detect the change when compiling the body of the + * functions involved, so we do not lose error checking. + */ +struct _ipfw_insn; +struct _ipfw_insn_u32; +struct _ipfw_insn_ip6; +struct _ipfw_insn_icmp6; /* * The reserved set numer. This is a constant in ip_fw.h @@ -243,15 +249,15 @@ int ipfw_delete_pipe(int pipe_or_queue, /* ipv6.c */ void print_unreach6_code(uint16_t code); -void print_ip6(ipfw_insn_ip6 *cmd, char const *s); -void print_flow6id( ipfw_insn_u32 *cmd); -void print_icmp6types(ipfw_insn_u32 *cmd); -void print_ext6hdr( ipfw_insn *cmd ); +void print_ip6(struct _ipfw_insn_ip6 *cmd, char const *s); +void print_flow6id(struct _ipfw_insn_u32 *cmd); +void print_icmp6types(struct _ipfw_insn_u32 *cmd); +void print_ext6hdr(struct _ipfw_insn *cmd ); -ipfw_insn *add_srcip6(ipfw_insn *cmd, char *av); -ipfw_insn *add_dstip6(ipfw_insn *cmd, char *av); +struct _ipfw_insn *add_srcip6(struct _ipfw_insn *cmd, char *av); +struct _ipfw_insn *add_dstip6(struct _ipfw_insn *cmd, char *av); -void fill_flow6( ipfw_insn_u32 *cmd, char *av ); +void fill_flow6(struct _ipfw_insn_u32 *cmd, char *av ); void fill_unreach6_code(u_short *codep, char *str); -void fill_icmp6types(ipfw_insn_icmp6 *cmd, char *av); -int fill_ext6hdr( ipfw_insn *cmd, char *av); +void fill_icmp6types(struct _ipfw_insn_icmp6 *cmd, char *av); +int fill_ext6hdr(struct _ipfw_insn *cmd, char *av); From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 12:02:12 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF985106571A; Wed, 28 Jan 2009 12:02:12 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from gloomweaver.pittgoth.com (gloomweaver.pittgoth.com [205.134.165.107]) by mx1.freebsd.org (Postfix) with ESMTP id 01BA28FC13; Wed, 28 Jan 2009 12:02:08 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from localhost.fbsdsecure.org (c-68-83-213-214.hsd1.va.comcast.net [68.83.213.214]) (authenticated bits=0) by gloomweaver.pittgoth.com (8.14.3/8.14.3) with ESMTP id n0SBNNkU089580 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 28 Jan 2009 06:23:24 -0500 (EST) (envelope-from trhodes@FreeBSD.org) Date: Wed, 28 Jan 2009 06:21:59 -0500 From: Tom Rhodes To: Roman Divacky Message-Id: <20090128062159.4c9b9ffb.trhodes@FreeBSD.org> In-Reply-To: <20090128081914.GA22309@freebsd.org> References: <200901280111.n0S1BL7n003092@svn.freebsd.org> <20090128081914.GA22309@freebsd.org> X-Mailer: Sylpheed version 1.0.6 (GTK+ 1.2.10; amd64-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r187805 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 12:02:21 -0000 On Wed, 28 Jan 2009 09:19:14 +0100 Roman Divacky wrote: > On Wed, Jan 28, 2009 at 01:11:21AM +0000, Tom Rhodes wrote: > > Author: trhodes > > Date: Wed Jan 28 01:11:20 2009 > > New Revision: 187805 > > URL: http://svn.freebsd.org/changeset/base/187805 > > > > Log: > > Remove comment about clearerr() being the only method of clearing > > the EOF indicator, fseek() may also be used for this. > > why not saying what you state in the commit message in the man page > instead of removing the info entirely? Isn't there other ways to do this as well? Such as writing extra bytes to the stream? I'm not sure listing every way to clear the EOF indicator is the right way, but open to suggestion. :) Thanks, > > > > Bump document date. > > > > PR: 76333 > > Submitted by: Yoshihiko Sarumaru > > > > Modified: > > head/lib/libc/stdio/ferror.3 > > > > Modified: head/lib/libc/stdio/ferror.3 > > ============================================================================== > > --- head/lib/libc/stdio/ferror.3 Wed Jan 28 00:15:35 2009 (r187804) > > +++ head/lib/libc/stdio/ferror.3 Wed Jan 28 01:11:20 2009 (r187805) > > @@ -32,7 +32,7 @@ > > .\" @(#)ferror.3 8.2 (Berkeley) 4/19/94 > > .\" $FreeBSD$ > > .\" > > -.Dd January 10, 2003 > > +.Dd January 27, 2009 > > .Dt FERROR 3 > > .Os > > .Sh NAME > > @@ -77,8 +77,6 @@ The function > > tests the end-of-file indicator for the stream pointed to by > > .Fa stream , > > returning non-zero if it is set. > > -The end-of-file indicator can only be cleared by the function > > -.Fn clearerr . > > .Pp > > The function > > .Fn ferror > -- Tom Rhodes From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 12:02:21 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 059A91065705; Wed, 28 Jan 2009 12:02:12 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from gloomweaver.pittgoth.com (gloomweaver.pittgoth.com [205.134.165.107]) by mx1.freebsd.org (Postfix) with ESMTP id 816B38FC32; Wed, 28 Jan 2009 12:02:09 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from localhost.fbsdsecure.org (c-68-83-213-214.hsd1.va.comcast.net [68.83.213.214]) (authenticated bits=0) by gloomweaver.pittgoth.com (8.14.3/8.14.3) with ESMTP id n0SBUEs2089606 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 28 Jan 2009 06:30:15 -0500 (EST) (envelope-from trhodes@FreeBSD.org) Date: Wed, 28 Jan 2009 06:28:53 -0500 From: Tom Rhodes To: Bruce Evans Message-Id: <20090128062853.06ee8c95.trhodes@FreeBSD.org> In-Reply-To: <20090128212904.E45316@delplex.bde.org> References: <200901280111.n0S1BL7n003092@svn.freebsd.org> <20090128081914.GA22309@freebsd.org> <20090128212904.E45316@delplex.bde.org> X-Mailer: Sylpheed version 1.0.6 (GTK+ 1.2.10; amd64-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, rdivacky@FreeBSD.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r187805 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 12:02:35 -0000 On Wed, 28 Jan 2009 22:15:22 +1100 (EST) Bruce Evans wrote: > On Wed, 28 Jan 2009, Roman Divacky wrote: > > > On Wed, Jan 28, 2009 at 01:11:21AM +0000, Tom Rhodes wrote: > >> Log: > >> Remove comment about clearerr() being the only method of clearing > >> the EOF indicator, fseek() may also be used for this. > > fseek() can't always be used for this, since fseek() fails for unseekable > files (even SEEK_CUR fails then). However, when it works, it has the > advantage(?) of not clobbering the error indicator. > > The comment was also wrong because the EOF indicator can also be cleared > by clearerr_unlocked() in some cases and by fseeko() in the same cases as > by fseek(). > > > why not saying what you state in the commit message in the man page > > instead of removing the info entirely? > > Well, neither C99 nor POSIX say this for feof(). > > The man page still says that the error indicator can only be cleared by > clearerr(). This is false since a sucessful rewind() clears both > indicators, and the indicator can be cleared by clearerr_unlocked() in > some cases. > > I think the man page is trying to make the false claims that the > indicators are not cleared as side effects and is not trying to list > all the functions that do clear the indicators as side effects, and > that it shouldn't try to do the latter. The list for the EOF indicator > may be quite long and system-and-time-dependent since it includes the > closure of all functions that call fseek(), or fseeko()). For both > indicators, the list includes the closure of all functions that call > clearerr() or clearerr_unlocked(). Perhaps no such functions in > standard libraries are permitted to operate on application streams, > but this is unclear. > > Bruce > Exactly, listing every possible method is a bit much I think. Anyway, I picked off the last mention of it, which I missed earlier. Thanks! -- Tom Rhodes From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 12:08:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F0C51065B81; Wed, 28 Jan 2009 12:08:19 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BEBEC8FC1E; Wed, 28 Jan 2009 12:08:19 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SC8JA5019247; Wed, 28 Jan 2009 12:08:19 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SC8J7p019246; Wed, 28 Jan 2009 12:08:19 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200901281208.n0SC8J7p019246@svn.freebsd.org> From: Robert Watson Date: Wed, 28 Jan 2009 12:08:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187820 - head/sbin/dumpfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 12:08:47 -0000 Author: rwatson Date: Wed Jan 28 12:08:19 2009 New Revision: 187820 URL: http://svn.freebsd.org/changeset/base/187820 Log: Print disk offets as %jd rather than %lld; I fixed one before committing but missed the other, which breaks 64-bit builds. Reported by: bf MFC after: 1 week Modified: head/sbin/dumpfs/dumpfs.c Modified: head/sbin/dumpfs/dumpfs.c ============================================================================== --- head/sbin/dumpfs/dumpfs.c Wed Jan 28 11:43:12 2009 (r187819) +++ head/sbin/dumpfs/dumpfs.c Wed Jan 28 12:08:19 2009 (r187820) @@ -456,7 +456,7 @@ pblklist(void *vp, int max, off_t offset while ((i+1) Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 933BF106566C; Wed, 28 Jan 2009 13:11:22 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 672648FC1B; Wed, 28 Jan 2009 13:11:22 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SDBM2T021089; Wed, 28 Jan 2009 13:11:22 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SDBM5D021088; Wed, 28 Jan 2009 13:11:22 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901281311.n0SDBM5D021088@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 28 Jan 2009 13:11:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187821 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 13:11:23 -0000 Author: luigi Date: Wed Jan 28 13:11:22 2009 New Revision: 187821 URL: http://svn.freebsd.org/changeset/base/187821 Log: For some reason (probably dating ages ago) an #ifdef SYSCTL_NODE / #endif section included a lot of stuff that did not belong there. So split the block in multiple components each around the relevant stuff. This said, I wonder if building a kernel where SYSCTL_NODE is not defined is supported at all. Submitted by: Marta Carbone Modified: head/sys/netinet/ip_fw2.c Modified: head/sys/netinet/ip_fw2.c ============================================================================== --- head/sys/netinet/ip_fw2.c Wed Jan 28 12:08:19 2009 (r187820) +++ head/sys/netinet/ip_fw2.c Wed Jan 28 13:11:22 2009 (r187821) @@ -197,6 +197,7 @@ SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, d NULL, IPFW_DEFAULT_RULE, "The default/max possible rule number."); SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, tables_max, CTLFLAG_RD, NULL, IPFW_TABLES_MAX, "The maximum number of tables."); +#endif /* SYSCTL_NODE */ /* * Description of dynamic rules. @@ -277,6 +278,7 @@ static u_int32_t dyn_count; /* # of dyna static u_int32_t dyn_max; /* max # of dynamic rules */ #endif /* VIMAGE_GLOBALS */ +#ifdef SYSCTL_NODE SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, dyn_buckets, CTLFLAG_RW, dyn_buckets, 0, "Number of dyn. buckets"); SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, curr_dyn_buckets, @@ -302,18 +304,19 @@ SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet "Lifetime of dyn. rules for other situations"); SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, dyn_keepalive, CTLFLAG_RW, dyn_keepalive, 0, "Enable keepalives for dyn. rules"); - +#endif /* SYSCTL_NODE */ #ifdef INET6 /* * IPv6 specific variables */ +#ifdef SYSCTL_NODE SYSCTL_DECL(_net_inet6_ip6); +#endif /* SYSCTL_NODE */ static struct sysctl_ctx_list ip6_fw_sysctl_ctx; static struct sysctl_oid *ip6_fw_sysctl_tree; #endif /* INET6 */ -#endif /* SYSCTL_NODE */ #ifdef VIMAGE_GLOBALS static int fw_deny_unknown_exthdrs; From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 13:26:37 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87ED2106566B; Wed, 28 Jan 2009 13:26:37 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id D314F8FC08; Wed, 28 Jan 2009 13:26:36 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (adsl21-232.kln.forthnet.gr [77.49.148.232]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id n0SD9wAj023640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 28 Jan 2009 15:10:03 +0200 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n0SD9vwr003438; Wed, 28 Jan 2009 15:09:57 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n0SD9uMp003437; Wed, 28 Jan 2009 15:09:56 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Tom Rhodes References: <200901280111.n0S1BL7n003092@svn.freebsd.org> Date: Wed, 28 Jan 2009 15:09:56 +0200 In-Reply-To: <200901280111.n0S1BL7n003092@svn.freebsd.org> (Tom Rhodes's message of "Wed, 28 Jan 2009 01:11:21 +0000 (UTC)") Message-ID: <873af38tln.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-MailScanner-ID: n0SD9wAj023640 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.866, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.53, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r187805 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 13:26:38 -0000 On Wed, 28 Jan 2009 01:11:21 +0000 (UTC), Tom Rhodes wrote: > Author: trhodes > Date: Wed Jan 28 01:11:20 2009 > New Revision: 187805 > URL: http://svn.freebsd.org/changeset/base/187805 > > Log: > Remove comment about clearerr() being the only method of clearing > the EOF indicator, fseek() may also be used for this. > > Bump document date. I don't like this, sorry... Having a pointer to clearerr() is nice. Removing it *deletes* useful information, but we should add _more_ of it. How about this instead? The end-of-file indicator may be cleared by explicitly calling .Fn clearerr , or as a side-effect of other operations, i.e.\& .Fn fseek . From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 13:39:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 407D4106566C; Wed, 28 Jan 2009 13:39:02 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E9238FC08; Wed, 28 Jan 2009 13:39:02 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SDd28e021997; Wed, 28 Jan 2009 13:39:02 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SDd2Bb021996; Wed, 28 Jan 2009 13:39:02 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901281339.n0SDd2Bb021996@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 28 Jan 2009 13:39:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187822 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 13:39:02 -0000 Author: luigi Date: Wed Jan 28 13:39:01 2009 New Revision: 187822 URL: http://svn.freebsd.org/changeset/base/187822 Log: initialize a couple of variables, gcc 4.2.4-4 (linux) reports some possible uninitialized uses and the warning does make sense. Modified: head/sys/netinet/ip_fw2.c Modified: head/sys/netinet/ip_fw2.c ============================================================================== --- head/sys/netinet/ip_fw2.c Wed Jan 28 13:11:22 2009 (r187821) +++ head/sys/netinet/ip_fw2.c Wed Jan 28 13:39:01 2009 (r187822) @@ -2254,6 +2254,7 @@ ipfw_chk(struct ip_fw_args *args) if (m->m_flags & M_SKIP_FIREWALL) return (IP_FW_PASS); /* accept */ + dst_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 */ @@ -2711,7 +2712,7 @@ check_body: uint32_t a = (cmd->opcode == O_IP_DST_LOOKUP) ? dst_ip.s_addr : src_ip.s_addr; - uint32_t v; + uint32_t v = 0; match = lookup_table(chain, cmd->arg1, a, &v); From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 13:55:52 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 104031065675; Wed, 28 Jan 2009 13:55:52 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from gloomweaver.pittgoth.com (gloomweaver.pittgoth.com [205.134.165.107]) by mx1.freebsd.org (Postfix) with ESMTP id C66038FC24; Wed, 28 Jan 2009 13:55:51 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from localhost.fbsdsecure.org (c-68-83-213-214.hsd1.va.comcast.net [68.83.213.214]) (authenticated bits=0) by gloomweaver.pittgoth.com (8.14.3/8.14.3) with ESMTP id n0SDux21090144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 28 Jan 2009 08:56:59 -0500 (EST) (envelope-from trhodes@FreeBSD.org) Date: Wed, 28 Jan 2009 08:55:37 -0500 From: Tom Rhodes To: Giorgos Keramidas Message-Id: <20090128085537.2d6c9c34.trhodes@FreeBSD.org> In-Reply-To: <873af38tln.fsf@kobe.laptop> References: <200901280111.n0S1BL7n003092@svn.freebsd.org> <873af38tln.fsf@kobe.laptop> X-Mailer: Sylpheed version 1.0.6 (GTK+ 1.2.10; amd64-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r187805 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 13:55:53 -0000 On Wed, 28 Jan 2009 15:09:56 +0200 Giorgos Keramidas wrote: > On Wed, 28 Jan 2009 01:11:21 +0000 (UTC), Tom Rhodes wrote: > > Author: trhodes > > Date: Wed Jan 28 01:11:20 2009 > > New Revision: 187805 > > URL: http://svn.freebsd.org/changeset/base/187805 > > > > Log: > > Remove comment about clearerr() being the only method of clearing > > the EOF indicator, fseek() may also be used for this. > > > > Bump document date. > > I don't like this, sorry... Having a pointer to clearerr() is nice. > Removing it *deletes* useful information, but we should add _more_ of > it. > > How about this instead? > > The end-of-file indicator may be cleared by explicitly calling > .Fn clearerr , > or as a side-effect of other operations, i.e.\& > .Fn fseek . I think 'side-effect" is wrong here - it may not be a "side effect" at all, but, on purpose. :) Sorry, I have no other suggestions right now. -- Tom Rhodes From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 14:08:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F5BF106564A; Wed, 28 Jan 2009 14:08:04 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id F2AA38FC14; Wed, 28 Jan 2009 14:08:03 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id 950E146B65; Wed, 28 Jan 2009 09:08:03 -0500 (EST) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n0SE7vZk097088; Wed, 28 Jan 2009 09:07:57 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Giorgos Keramidas Date: Wed, 28 Jan 2009 09:05:36 -0500 User-Agent: KMail/1.9.7 References: <200901280111.n0S1BL7n003092@svn.freebsd.org> <873af38tln.fsf@kobe.laptop> In-Reply-To: <873af38tln.fsf@kobe.laptop> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901280905.37365.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Wed, 28 Jan 2009 09:07:57 -0500 (EST) X-Virus-Scanned: ClamAV 0.94.2/8914/Wed Jan 28 01:40:00 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, Tom Rhodes , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187805 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 14:08:04 -0000 On Wednesday 28 January 2009 8:09:56 am Giorgos Keramidas wrote: > On Wed, 28 Jan 2009 01:11:21 +0000 (UTC), Tom Rhodes wrote: > > Author: trhodes > > Date: Wed Jan 28 01:11:20 2009 > > New Revision: 187805 > > URL: http://svn.freebsd.org/changeset/base/187805 > > > > Log: > > Remove comment about clearerr() being the only method of clearing > > the EOF indicator, fseek() may also be used for this. > > > > Bump document date. > > I don't like this, sorry... Having a pointer to clearerr() is nice. > Removing it *deletes* useful information, but we should add _more_ of > it. > > How about this instead? > > The end-of-file indicator may be cleared by explicitly calling > .Fn clearerr , > or as a side-effect of other operations, i.e.\& > .Fn fseek . s/i.e./e.g./ and I think this may be a good compromise. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 14:08:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E8CA1065704; Wed, 28 Jan 2009 14:08:10 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id CB3DE8FC1C; Wed, 28 Jan 2009 14:08:09 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id 756A146B6C; Wed, 28 Jan 2009 09:08:09 -0500 (EST) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n0SE7vZl097088; Wed, 28 Jan 2009 09:08:03 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Tom Rhodes Date: Wed, 28 Jan 2009 09:07:51 -0500 User-Agent: KMail/1.9.7 References: <200901280111.n0S1BL7n003092@svn.freebsd.org> <873af38tln.fsf@kobe.laptop> <20090128085537.2d6c9c34.trhodes@FreeBSD.org> In-Reply-To: <20090128085537.2d6c9c34.trhodes@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901280907.52256.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Wed, 28 Jan 2009 09:08:03 -0500 (EST) X-Virus-Scanned: ClamAV 0.94.2/8914/Wed Jan 28 01:40:00 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Giorgos Keramidas , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187805 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 14:08:12 -0000 On Wednesday 28 January 2009 8:55:37 am Tom Rhodes wrote: > On Wed, 28 Jan 2009 15:09:56 +0200 > Giorgos Keramidas wrote: > > > On Wed, 28 Jan 2009 01:11:21 +0000 (UTC), Tom Rhodes wrote: > > > Author: trhodes > > > Date: Wed Jan 28 01:11:20 2009 > > > New Revision: 187805 > > > URL: http://svn.freebsd.org/changeset/base/187805 > > > > > > Log: > > > Remove comment about clearerr() being the only method of clearing > > > the EOF indicator, fseek() may also be used for this. > > > > > > Bump document date. > > > > I don't like this, sorry... Having a pointer to clearerr() is nice. > > Removing it *deletes* useful information, but we should add _more_ of > > it. > > > > How about this instead? > > > > The end-of-file indicator may be cleared by explicitly calling > > .Fn clearerr , > > or as a side-effect of other operations, i.e.\& > > .Fn fseek . > > I think 'side-effect" is wrong here - it may not be a "side > effect" at all, but, on purpose. :) If one solely wants to clear the indicator then clearerr() is probably what you should do. Using fseek() only to clear the indicator would be bad form. One should be using fseek() because they need to seek to a different location in the stream, not to clear the error. Thus, I agree with Giorgos' wording. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 14:27:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1B9C1065762; Wed, 28 Jan 2009 14:27:42 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 1F69C8FC16; Wed, 28 Jan 2009 14:27:41 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from kobe.laptop (adsl21-232.kln.forthnet.gr [77.49.148.232]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id n0SERXDo032187 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 28 Jan 2009 16:27:38 +0200 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n0SERW0a004270; Wed, 28 Jan 2009 16:27:32 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n0SERWH9004269; Wed, 28 Jan 2009 16:27:32 +0200 (EET) (envelope-from keramida@freebsd.org) From: Giorgos Keramidas To: John Baldwin References: <200901280111.n0S1BL7n003092@svn.freebsd.org> <873af38tln.fsf@kobe.laptop> <20090128085537.2d6c9c34.trhodes@FreeBSD.org> <200901280907.52256.jhb@freebsd.org> Date: Wed, 28 Jan 2009 16:27:32 +0200 In-Reply-To: <200901280907.52256.jhb@freebsd.org> (John Baldwin's message of "Wed, 28 Jan 2009 09:07:51 -0500") Message-ID: <87k58fh5ez.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-MailScanner-ID: n0SERXDo032187 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.46, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL -0.06, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@freebsd.org X-Spam-Status: No Cc: svn-src-head@freebsd.org, Tom Rhodes , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187805 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 14:27:43 -0000 On Wed, 28 Jan 2009 09:07:51 -0500, John Baldwin wrote: > On Wednesday 28 January 2009 8:55:37 am Tom Rhodes wrote: >> On Wed, 28 Jan 2009 15:09:56 +0200 Giorgos Keramidas wrote: >> > On Wed, 28 Jan 2009 01:11:21 +0000 (UTC), Tom Rhodes wrote: >> > > Author: trhodes >> > > Date: Wed Jan 28 01:11:20 2009 >> > > New Revision: 187805 >> > > URL: http://svn.freebsd.org/changeset/base/187805 >> > > >> > > Log: >> > > Remove comment about clearerr() being the only method of clearing >> > > the EOF indicator, fseek() may also be used for this. >> > > >> > > Bump document date. >> > >> > I don't like this, sorry... Having a pointer to clearerr() is nice. >> > Removing it *deletes* useful information, but we should add _more_ of >> > it. >> > >> > How about this instead? >> > >> > The end-of-file indicator may be cleared by explicitly calling >> > .Fn clearerr , >> > or as a side-effect of other operations, i.e.\& >> > .Fn fseek . >> >> I think 'side-effect" is wrong here - it may not be a "side >> effect" at all, but, on purpose. :) > > If one solely wants to clear the indicator then clearerr() is probably > what you should do. Using fseek() only to clear the indicator would > be bad form. One should be using fseek() because they need to seek to > a different location in the stream, not to clear the error. Thus, I > agree with Giorgos' wording. Precisely. We are not suggesting that users SHOULD use side-effects, just noting one example. The _intent_ of a function to clear EOF is more important than the fact that it happens 'in addition to' other things as opposed to 'because we asked for it'. From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 14:38:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2FBA1065676; Wed, 28 Jan 2009 14:38:41 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C11288FC1B; Wed, 28 Jan 2009 14:38:41 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SEcfdY023129; Wed, 28 Jan 2009 14:38:41 GMT (envelope-from trhodes@svn.freebsd.org) Received: (from trhodes@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SEcf9a023128; Wed, 28 Jan 2009 14:38:41 GMT (envelope-from trhodes@svn.freebsd.org) Message-Id: <200901281438.n0SEcf9a023128@svn.freebsd.org> From: Tom Rhodes Date: Wed, 28 Jan 2009 14:38:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187823 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 14:38:42 -0000 Author: trhodes Date: Wed Jan 28 14:38:41 2009 New Revision: 187823 URL: http://svn.freebsd.org/changeset/base/187823 Log: Better wording for clearing EOF indicator. Submitted by: keramida and jhb Modified: head/lib/libc/stdio/ferror.3 Modified: head/lib/libc/stdio/ferror.3 ============================================================================== --- head/lib/libc/stdio/ferror.3 Wed Jan 28 13:39:01 2009 (r187822) +++ head/lib/libc/stdio/ferror.3 Wed Jan 28 14:38:41 2009 (r187823) @@ -77,6 +77,10 @@ The function tests the end-of-file indicator for the stream pointed to by .Fa stream , returning non-zero if it is set. +The end-of-file indicator may be cleared by explicitly calling +.Fn clearerr , +or as a side-effect of other operations, e.g.\& +.Fn fseek . .Pp The function .Fn ferror From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 14:40:33 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 063A0106564A; Wed, 28 Jan 2009 14:40:33 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from gloomweaver.pittgoth.com (gloomweaver.pittgoth.com [205.134.165.107]) by mx1.freebsd.org (Postfix) with ESMTP id B5D7B8FC14; Wed, 28 Jan 2009 14:40:32 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from localhost.fbsdsecure.org (c-68-83-213-214.hsd1.va.comcast.net [68.83.213.214]) (authenticated bits=0) by gloomweaver.pittgoth.com (8.14.3/8.14.3) with ESMTP id n0SEfhal090322 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 28 Jan 2009 09:41:43 -0500 (EST) (envelope-from trhodes@FreeBSD.org) Date: Wed, 28 Jan 2009 09:40:20 -0500 From: Tom Rhodes To: Giorgos Keramidas Message-Id: <20090128094020.0e399ba9.trhodes@FreeBSD.org> In-Reply-To: <87k58fh5ez.fsf@kobe.laptop> References: <200901280111.n0S1BL7n003092@svn.freebsd.org> <873af38tln.fsf@kobe.laptop> <20090128085537.2d6c9c34.trhodes@FreeBSD.org> <200901280907.52256.jhb@freebsd.org> <87k58fh5ez.fsf@kobe.laptop> X-Mailer: Sylpheed version 1.0.6 (GTK+ 1.2.10; amd64-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, jhb@FreeBSD.org Subject: Re: svn commit: r187805 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 14:40:33 -0000 On Wed, 28 Jan 2009 16:27:32 +0200 Giorgos Keramidas wrote: > On Wed, 28 Jan 2009 09:07:51 -0500, John Baldwin wrote: > > On Wednesday 28 January 2009 8:55:37 am Tom Rhodes wrote: > >> On Wed, 28 Jan 2009 15:09:56 +0200 Giorgos Keramidas wrote: > >> > On Wed, 28 Jan 2009 01:11:21 +0000 (UTC), Tom Rhodes wrote: > >> > > Author: trhodes > >> > > Date: Wed Jan 28 01:11:20 2009 > >> > > New Revision: 187805 > >> > > URL: http://svn.freebsd.org/changeset/base/187805 > >> > > > >> > > Log: > >> > > Remove comment about clearerr() being the only method of clearing > >> > > the EOF indicator, fseek() may also be used for this. > >> > > > >> > > Bump document date. > >> > > >> > I don't like this, sorry... Having a pointer to clearerr() is nice. > >> > Removing it *deletes* useful information, but we should add _more_ of > >> > it. > >> > > >> > How about this instead? > >> > > >> > The end-of-file indicator may be cleared by explicitly calling > >> > .Fn clearerr , > >> > or as a side-effect of other operations, i.e.\& > >> > .Fn fseek . > >> > >> I think 'side-effect" is wrong here - it may not be a "side > >> effect" at all, but, on purpose. :) > > > > If one solely wants to clear the indicator then clearerr() is probably > > what you should do. Using fseek() only to clear the indicator would > > be bad form. One should be using fseek() because they need to seek to > > a different location in the stream, not to clear the error. Thus, I > > agree with Giorgos' wording. > > Precisely. We are not suggesting that users SHOULD use side-effects, > just noting one example. The _intent_ of a function to clear EOF is > more important than the fact that it happens 'in addition to' other > things as opposed to 'because we asked for it'. > > See latest change, took your wording and John's follow up, thanks! -- Tom Rhodes From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 15:12:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 143481065674; Wed, 28 Jan 2009 15:12:56 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out5.smtp.messagingengine.com (out5.smtp.messagingengine.com [66.111.4.29]) by mx1.freebsd.org (Postfix) with ESMTP id D9E838FC17; Wed, 28 Jan 2009 15:12:55 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.fastmail.fm (Postfix) with ESMTP id 3133C25FA70; Wed, 28 Jan 2009 10:12:55 -0500 (EST) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Wed, 28 Jan 2009 10:12:55 -0500 X-Sasl-enc: tGGy8coEl0quh+NUJo4W/rJEkMKktfhdGdt3yTyShvgR 1233155574 Received: from empiric.lon.incunabulum.net (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id 7E120296FB; Wed, 28 Jan 2009 10:12:54 -0500 (EST) Message-ID: <498075F5.1030206@FreeBSD.org> Date: Wed, 28 Jan 2009 15:12:53 +0000 From: "Bruce M. Simpson" User-Agent: Thunderbird 2.0.0.19 (X11/20090126) MIME-Version: 1.0 To: Luigi Rizzo References: <200901281339.n0SDd2Bb021996@svn.freebsd.org> In-Reply-To: <200901281339.n0SDd2Bb021996@svn.freebsd.org> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187822 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 15:12:56 -0000 Luigi Rizzo wrote: > Log: > initialize a couple of variables, gcc 4.2.4-4 (linux) reports > some possible uninitialized uses and the warning does make sense. > No way. Are you cross-compiling FreeBSD on Linux? Spill, dude? From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 15:21:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 378A7106564A; Wed, 28 Jan 2009 15:21:39 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 251AB8FC1C; Wed, 28 Jan 2009 15:21:39 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SFLdr9024000; Wed, 28 Jan 2009 15:21:39 GMT (envelope-from trhodes@svn.freebsd.org) Received: (from trhodes@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SFLdX1023999; Wed, 28 Jan 2009 15:21:39 GMT (envelope-from trhodes@svn.freebsd.org) Message-Id: <200901281521.n0SFLdX1023999@svn.freebsd.org> From: Tom Rhodes Date: Wed, 28 Jan 2009 15:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187824 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 15:21:39 -0000 Author: trhodes Date: Wed Jan 28 15:21:38 2009 New Revision: 187824 URL: http://svn.freebsd.org/changeset/base/187824 Log: Update the description of KERN_PROC. PR: 100242 Reviewed by: jhb Modified: head/lib/libc/gen/sysctl.3 Modified: head/lib/libc/gen/sysctl.3 ============================================================================== --- head/lib/libc/gen/sysctl.3 Wed Jan 28 14:38:41 2009 (r187823) +++ head/lib/libc/gen/sysctl.3 Wed Jan 28 15:21:38 2009 (r187824) @@ -28,7 +28,7 @@ .\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd March 27, 2008 +.Dd January 28, 2009 .Dt SYSCTL 3 .Os .Sh NAME @@ -440,10 +440,8 @@ attempts to comply. .It Li KERN_PROC Return selected information about specific running processes. .Pp -For the following names, an array of pairs of -.Va struct proc -followed by corresponding -.Va struct eproc +For the following names, an array of +.Va struct kinfo_proc structures is returned, whose size depends on the current number of such objects in the system. .Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 15:22:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23E4210656D8; Wed, 28 Jan 2009 15:22:45 +0000 (UTC) (envelope-from tabthorpe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 103A78FC16; Wed, 28 Jan 2009 15:22:45 +0000 (UTC) (envelope-from tabthorpe@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SFMifD024067; Wed, 28 Jan 2009 15:22:44 GMT (envelope-from tabthorpe@svn.freebsd.org) Received: (from tabthorpe@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SFMijw024065; Wed, 28 Jan 2009 15:22:44 GMT (envelope-from tabthorpe@svn.freebsd.org) Message-Id: <200901281522.n0SFMijw024065@svn.freebsd.org> From: Thomas Abthorpe Date: Wed, 28 Jan 2009 15:22:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187825 - head/share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 15:22:46 -0000 Author: tabthorpe (ports committer) Date: Wed Jan 28 15:22:44 2009 New Revision: 187825 URL: http://svn.freebsd.org/changeset/base/187825 Log: - Add initial version of portindex(5) manual page PR: docs/70652 Submitted by: Paul Armstrong Reviewed by: pav keramida trhodes Approved by: keramida MFC after: 3 days Added: head/share/man/man5/portindex.5 (contents, props changed) Modified: head/share/man/man5/Makefile Modified: head/share/man/man5/Makefile ============================================================================== --- head/share/man/man5/Makefile Wed Jan 28 15:21:38 2009 (r187824) +++ head/share/man/man5/Makefile Wed Jan 28 15:22:44 2009 (r187825) @@ -51,6 +51,7 @@ MAN= acct.5 \ pbm.5 \ periodic.conf.5 \ phones.5 \ + portindex.5 \ portsnap.conf.5 \ procfs.5 \ protocols.5 \ Added: head/share/man/man5/portindex.5 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man5/portindex.5 Wed Jan 28 15:22:44 2009 (r187825) @@ -0,0 +1,101 @@ +.\" +.\" Copyright (c) 2004 Paul Armstrong +.\" Copyright (c) 2009 Thomas Abthorpe +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 28, 2009 +.Dt PORTINDEX 5 +.Os +.Sh NAME +.Nm INDEX +.Nd "File containing information about the state of the ports tree" +.Sh DESCRIPTION +The port index file in +.Pa /usr/ports +contains various bits of information about the ports tree. +Each major branch of +.Fx +has a separate index file, named +.Dq INDEX- Ns Ar N , +where +.Ar N +is the major version number of the +.Fx +branch, i.e.: +.Pa INDEX-7 , +or +.Pa INDEX-8 . +.Bl -tag -compact -width indent +.It Cm \&name +The name of the package. +.It Cm \&path +The path to the port directory. +.It Cm \&install prefix +The default install prefix. +.It Cm \&short description +A short description. +.It Cm \&full description +The path to the full description. +.It Cm \&maintainer email +The email address of the maintainer. +.It Cm \&index +The categories this port is part of. +.It Cm \&build dependencies +Ports required to be installed prior to building this port. +.It Cm \&run dependencies +Ports required to be installed for this port to run. +.It Cm \&website +The project website for the port. +.It Cm \&e-deps +Ports that may be required to extract this port. +.It Cm \&p-deps +Ports that may be required to patch this port. +.It Cm \&f-deps +Ports that may be required to fetch this port. +.El +.Sh FILES +.Bl -tag -width /usr/ports/INDEX-8 +.It Pa /usr/ports/INDEX- Ns Ar N +where +.Ar N +is the major version number of the +.Fx +branch. +.El +.Sh EXAMPLES +.Bd -literal +vim-6.3.15|/usr/ports/editors/vim|/usr/local|Vi "workalike", with many additional features|/usr/ports/editors/vim/pkg-descr|obrien@FreeBSD.org|editors|libiconv-1.9.2_1|libiconv-1.9.2_1|http://www.vim.org/||| +.Ed +.Sh SEE ALSO +.Xr csup 1 , +.Xr build 1 , +.Xr ports 7 +.Sh AUTHORS +.An -nosplit +This manual page was written by +.An Paul Armstrong +and +.An Thomas Abthorpe Aq tabthorpe@FreeBSD.org . From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 15:31:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A84B11065670; Wed, 28 Jan 2009 15:31:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 95FD18FC08; Wed, 28 Jan 2009 15:31:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SFVGRa024258; Wed, 28 Jan 2009 15:31:16 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SFVGvi024257; Wed, 28 Jan 2009 15:31:16 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200901281531.n0SFVGvi024257@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 28 Jan 2009 15:31:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187826 - head/sys/opencrypto X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 15:31:17 -0000 Author: bz Date: Wed Jan 28 15:31:16 2009 New Revision: 187826 URL: http://svn.freebsd.org/changeset/base/187826 Log: While OpenBSD's crypto/ framework has sha1 and md5 implementations that can cope with a result buffer of NULL in the "Final" function, we cannot. Thus pass in a temporary buffer long enough for either md5 or sha1 results so that we do not panic. PR: bin/126468 MFC after: 1 week Modified: head/sys/opencrypto/cryptosoft.c Modified: head/sys/opencrypto/cryptosoft.c ============================================================================== --- head/sys/opencrypto/cryptosoft.c Wed Jan 28 15:22:44 2009 (r187825) +++ head/sys/opencrypto/cryptosoft.c Wed Jan 28 15:31:16 2009 (r187826) @@ -433,12 +433,17 @@ swcr_authprepare(struct auth_hash *axf, break; case CRYPTO_MD5_KPDK: case CRYPTO_SHA1_KPDK: + { + /* We need a buffer that can hold an md5 and a sha1 result. */ + u_char buf[SHA1_RESULTLEN]; + sw->sw_klen = klen; bcopy(key, sw->sw_octx, klen); axf->Init(sw->sw_ictx); axf->Update(sw->sw_ictx, key, klen); - axf->Final(NULL, sw->sw_ictx); + axf->Final(buf, sw->sw_ictx); break; + } default: printf("%s: CRD_F_KEY_EXPLICIT flag given, but algorithm %d " "doesn't use keys.\n", __func__, axf->type); From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 15:45:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 403AC1065697; Wed, 28 Jan 2009 15:45:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27]) by mx1.freebsd.org (Postfix) with ESMTP id EAAF58FC21; Wed, 28 Jan 2009 15:45:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from localhost (amavis.str.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 31D1C41C733; Wed, 28 Jan 2009 16:45:06 +0100 (CET) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([62.111.66.27]) by localhost (amavis.str.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id oLGPsOTNN2vu; Wed, 28 Jan 2009 16:45:05 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id A8C4741C730; Wed, 28 Jan 2009 16:45:05 +0100 (CET) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 0DD3F4448E6; Wed, 28 Jan 2009 15:40:49 +0000 (UTC) Date: Wed, 28 Jan 2009 15:40:48 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <200901281531.n0SFVGvi024257@svn.freebsd.org> Message-ID: <20090128153859.B45963@maildrop.int.zabbadoz.net> References: <200901281531.n0SFVGvi024257@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Subject: Re: svn commit: r187826 - head/sys/opencrypto X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 15:45:08 -0000 On Wed, 28 Jan 2009, Bjoern A. Zeeb wrote: > Author: bz > Date: Wed Jan 28 15:31:16 2009 > New Revision: 187826 > URL: http://svn.freebsd.org/changeset/base/187826 > > Log: > While OpenBSD's crypto/ framework has sha1 and md5 implementations that > can cope with a result buffer of NULL in the "Final" function, we cannot. > Thus pass in a temporary buffer long enough for either md5 or sha1 results > so that we do not panic. There is on thing in the code I didn't want to change: We are not interested in the result of the operation and MD5Final would bzero the sw->sw_ictx as well. So why are we (and every one else using similar code) doing the calculation at all? I feel like I must be missing something here... > PR: bin/126468 > MFC after: 1 week > > Modified: > head/sys/opencrypto/cryptosoft.c > > Modified: head/sys/opencrypto/cryptosoft.c > ============================================================================== > --- head/sys/opencrypto/cryptosoft.c Wed Jan 28 15:22:44 2009 (r187825) > +++ head/sys/opencrypto/cryptosoft.c Wed Jan 28 15:31:16 2009 (r187826) > @@ -433,12 +433,17 @@ swcr_authprepare(struct auth_hash *axf, > break; > case CRYPTO_MD5_KPDK: > case CRYPTO_SHA1_KPDK: > + { > + /* We need a buffer that can hold an md5 and a sha1 result. */ > + u_char buf[SHA1_RESULTLEN]; > + > sw->sw_klen = klen; > bcopy(key, sw->sw_octx, klen); > axf->Init(sw->sw_ictx); > axf->Update(sw->sw_ictx, key, klen); > - axf->Final(NULL, sw->sw_ictx); > + axf->Final(buf, sw->sw_ictx); > break; > + } > default: > printf("%s: CRD_F_KEY_EXPLICIT flag given, but algorithm %d " > "doesn't use keys.\n", __func__, axf->type); > -- Bjoern A. Zeeb The greatest risk is not taking one. From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 15:54:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A307106564A; Wed, 28 Jan 2009 15:54:29 +0000 (UTC) (envelope-from tabthorpe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27D868FC38; Wed, 28 Jan 2009 15:54:29 +0000 (UTC) (envelope-from tabthorpe@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SFsTNX024951; Wed, 28 Jan 2009 15:54:29 GMT (envelope-from tabthorpe@svn.freebsd.org) Received: (from tabthorpe@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SFsTAO024950; Wed, 28 Jan 2009 15:54:29 GMT (envelope-from tabthorpe@svn.freebsd.org) Message-Id: <200901281554.n0SFsTAO024950@svn.freebsd.org> From: Thomas Abthorpe Date: Wed, 28 Jan 2009 15:54:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187827 - head/share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 15:54:29 -0000 Author: tabthorpe (ports committer) Date: Wed Jan 28 15:54:28 2009 New Revision: 187827 URL: http://svn.freebsd.org/changeset/base/187827 Log: - Re-order SEE ALSO entries Noticed by: brueffer Approved by: trhodes Modified: head/share/man/man5/portindex.5 Modified: head/share/man/man5/portindex.5 ============================================================================== --- head/share/man/man5/portindex.5 Wed Jan 28 15:31:16 2009 (r187826) +++ head/share/man/man5/portindex.5 Wed Jan 28 15:54:28 2009 (r187827) @@ -90,8 +90,8 @@ branch. vim-6.3.15|/usr/ports/editors/vim|/usr/local|Vi "workalike", with many additional features|/usr/ports/editors/vim/pkg-descr|obrien@FreeBSD.org|editors|libiconv-1.9.2_1|libiconv-1.9.2_1|http://www.vim.org/||| .Ed .Sh SEE ALSO -.Xr csup 1 , .Xr build 1 , +.Xr csup 1 , .Xr ports 7 .Sh AUTHORS .An -nosplit From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 16:23:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79519106567C; Wed, 28 Jan 2009 16:23:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6729A8FC17; Wed, 28 Jan 2009 16:23:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SGNLfr026035; Wed, 28 Jan 2009 16:23:21 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SGNLYL026034; Wed, 28 Jan 2009 16:23:21 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200901281623.n0SGNLYL026034@svn.freebsd.org> From: Warner Losh Date: Wed, 28 Jan 2009 16:23:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187828 - head/sbin/restore X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 16:23:22 -0000 Author: imp Date: Wed Jan 28 16:23:21 2009 New Revision: 187828 URL: http://svn.freebsd.org/changeset/base/187828 Log: Restore necessary NUL termination of locname. Submitted by: ian dowse MFC after: 2 days Modified: head/sbin/restore/interactive.c Modified: head/sbin/restore/interactive.c ============================================================================== --- head/sbin/restore/interactive.c Wed Jan 28 15:54:28 2009 (r187827) +++ head/sbin/restore/interactive.c Wed Jan 28 16:23:21 2009 (r187828) @@ -545,6 +545,7 @@ printlist(char *name, char *basename) strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)) continue; + locname[namelen] = '\0'; if (namelen + dp->d_namlen >= MAXPATHLEN) { fprintf(stderr, "%s%s: name exceeds %d char\n", locname, dp->d_name, MAXPATHLEN); From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 17:06:33 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB21A106564A; Wed, 28 Jan 2009 17:06:33 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id A9D828FC16; Wed, 28 Jan 2009 17:06:33 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n0SH5AVT006333; Wed, 28 Jan 2009 10:05:11 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Wed, 28 Jan 2009 10:05:32 -0700 (MST) Message-Id: <20090128.100532.270753022.imp@bsdimp.com> To: keramida@ceid.upatras.gr From: "M. Warner Losh" In-Reply-To: <873af38tln.fsf@kobe.laptop> References: <200901280111.n0S1BL7n003092@svn.freebsd.org> <873af38tln.fsf@kobe.laptop> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, trhodes@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r187805 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 17:06:34 -0000 In message: <873af38tln.fsf@kobe.laptop> Giorgos Keramidas writes: : On Wed, 28 Jan 2009 01:11:21 +0000 (UTC), Tom Rhodes wrote: : > Author: trhodes : > Date: Wed Jan 28 01:11:20 2009 : > New Revision: 187805 : > URL: http://svn.freebsd.org/changeset/base/187805 : > : > Log: : > Remove comment about clearerr() being the only method of clearing : > the EOF indicator, fseek() may also be used for this. : > : > Bump document date. : : I don't like this, sorry... Having a pointer to clearerr() is nice. : Removing it *deletes* useful information, but we should add _more_ of : it. : : How about this instead? : : The end-of-file indicator may be cleared by explicitly calling : .Fn clearerr , : or as a side-effect of other operations, i.e.\& : .Fn fseek . s/fseek/lseek/ Warner From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 17:53:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CF94106566B; Wed, 28 Jan 2009 17:53:44 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id DFAA98FC14; Wed, 28 Jan 2009 17:53:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id 7CE5B46B5C; Wed, 28 Jan 2009 12:53:43 -0500 (EST) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n0SHrbP1098530; Wed, 28 Jan 2009 12:53:37 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: "M. Warner Losh" Date: Wed, 28 Jan 2009 12:53:13 -0500 User-Agent: KMail/1.9.7 References: <200901280111.n0S1BL7n003092@svn.freebsd.org> <873af38tln.fsf@kobe.laptop> <20090128.100532.270753022.imp@bsdimp.com> In-Reply-To: <20090128.100532.270753022.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901281253.13907.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Wed, 28 Jan 2009 12:53:37 -0500 (EST) X-Virus-Scanned: ClamAV 0.94.2/8914/Wed Jan 28 01:40:00 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: keramida@ceid.upatras.gr, trhodes@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r187805 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 17:53:44 -0000 On Wednesday 28 January 2009 12:05:32 pm M. Warner Losh wrote: > In message: <873af38tln.fsf@kobe.laptop> > Giorgos Keramidas writes: > : On Wed, 28 Jan 2009 01:11:21 +0000 (UTC), Tom Rhodes wrote: > : > Author: trhodes > : > Date: Wed Jan 28 01:11:20 2009 > : > New Revision: 187805 > : > URL: http://svn.freebsd.org/changeset/base/187805 > : > > : > Log: > : > Remove comment about clearerr() being the only method of clearing > : > the EOF indicator, fseek() may also be used for this. > : > > : > Bump document date. > : > : I don't like this, sorry... Having a pointer to clearerr() is nice. > : Removing it *deletes* useful information, but we should add _more_ of > : it. > : > : How about this instead? > : > : The end-of-file indicator may be cleared by explicitly calling > : .Fn clearerr , > : or as a side-effect of other operations, i.e.\& > : .Fn fseek . > > s/fseek/lseek/ clearerr(), fseek() etc. are all stdio routines. It would be a bit hard for lseek(2) to clear the error flag in the FILE struct in userland. :) -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 17:57:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F24A3106566C; Wed, 28 Jan 2009 17:57:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DDA428FC0A; Wed, 28 Jan 2009 17:57:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SHvGlb027889; Wed, 28 Jan 2009 17:57:16 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SHvGt8027878; Wed, 28 Jan 2009 17:57:16 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200901281757.n0SHvGt8027878@svn.freebsd.org> From: Ed Schouten Date: Wed, 28 Jan 2009 17:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187830 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs compat/linux compat/svr4 dev/xen/blkback fs/cd9660 nfs4client nfsclient nfsserver sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 17:57:17 -0000 Author: ed Date: Wed Jan 28 17:57:16 2009 New Revision: 187830 URL: http://svn.freebsd.org/changeset/base/187830 Log: Last step of splitting up minor and unit numbers: remove minor(). Inside the kernel, the minor() function was responsible for obtaining the device minor number of a character device. Because we made device numbers dynamically allocated and independent of the unit number passed to make_dev() a long time ago, it was actually a misnomer. If you really want to obtain the device number, you should use dev2udev(). We already converted all the drivers to use dev2unit() to obtain the device unit number, which is still used by a lot of drivers. I've noticed not a single driver passes NULL to dev2unit(). Even if they would, its behaviour would make little sense. This is why I've removed the NULL check. Ths commit removes minor(), minor2unit() and unit2minor() from the kernel. Because there was a naming collision with uminor(), we can rename umajor() and uminor() back to major() and minor(). This means that the makedev(3) manual page also applies to kernel space code now. I suspect umajor() and uminor() isn't used that often in external code, but to make it easier for other parties to port their code, I've increased __FreeBSD_version to 800062. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c head/sys/compat/linux/linux_stats.c head/sys/compat/svr4/svr4_types.h head/sys/dev/xen/blkback/blkback.c head/sys/fs/cd9660/cd9660_rrip.c head/sys/nfs4client/nfs4_subs.c head/sys/nfsclient/nfs_vnops.c head/sys/nfsserver/nfs_srvsubs.c head/sys/sys/conf.h head/sys/sys/param.h head/sys/sys/types.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Wed Jan 28 16:37:49 2009 (r187829) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Wed Jan 28 17:57:16 2009 (r187830) @@ -494,7 +494,7 @@ zfs_init_fs(zfsvfs_t *zfsvfs, znode_t ** static uint64_t zfs_expldev(dev_t dev) { - return (((uint64_t)umajor(dev) << NBITSMINOR64) | uminor(dev)); + return (((uint64_t)major(dev) << NBITSMINOR64) | minor(dev)); } /* * Special cmpldev for ZFS private use. Modified: head/sys/compat/linux/linux_stats.c ============================================================================== --- head/sys/compat/linux/linux_stats.c Wed Jan 28 16:37:49 2009 (r187829) +++ head/sys/compat/linux/linux_stats.c Wed Jan 28 17:57:16 2009 (r187830) @@ -88,7 +88,7 @@ disk_foo(struct somestat *tbuf) /* XXX this may not be quite right */ /* Map major number to 0 */ - tbuf.st_dev = uminor(buf->st_dev) & 0xf; + tbuf.st_dev = minor(buf->st_dev) & 0xf; tbuf.st_rdev = buf->st_rdev & 0xff; } dev_relthread(dev); @@ -156,7 +156,7 @@ newstat_copyout(struct stat *buf, void * struct l_newstat tbuf; bzero(&tbuf, sizeof(tbuf)); - tbuf.st_dev = uminor(buf->st_dev) | (umajor(buf->st_dev) << 8); + tbuf.st_dev = minor(buf->st_dev) | (major(buf->st_dev) << 8); tbuf.st_ino = buf->st_ino; tbuf.st_mode = buf->st_mode; tbuf.st_nlink = buf->st_nlink; @@ -487,7 +487,7 @@ stat64_copyout(struct stat *buf, void *u struct l_stat64 lbuf; bzero(&lbuf, sizeof(lbuf)); - lbuf.st_dev = uminor(buf->st_dev) | (umajor(buf->st_dev) << 8); + lbuf.st_dev = minor(buf->st_dev) | (major(buf->st_dev) << 8); lbuf.st_ino = buf->st_ino; lbuf.st_mode = buf->st_mode; lbuf.st_nlink = buf->st_nlink; Modified: head/sys/compat/svr4/svr4_types.h ============================================================================== --- head/sys/compat/svr4/svr4_types.h Wed Jan 28 16:37:49 2009 (r187829) +++ head/sys/compat/svr4/svr4_types.h Wed Jan 28 17:57:16 2009 (r187830) @@ -69,13 +69,13 @@ typedef struct timespec svr4_timestruc_ (((y) << 0) & 0x00ff))) #define svr4_to_bsd_odev_t(d) makedev(svr4_omajor(d), svr4_ominor(d)) -#define bsd_to_svr4_odev_t(d) svr4_omakedev(umajor(d), uminor(d)) +#define bsd_to_svr4_odev_t(d) svr4_omakedev(major(d), minor(d)) #define svr4_major(x) ((int32_t)((((x) & 0xfffc0000) >> 18))) #define svr4_minor(x) ((int32_t)((((x) & 0x0003ffff) >> 0))) #define svr4_makedev(x,y) ((svr4_dev_t)((((x) << 18) & 0xfffc0000) | \ (((y) << 0) & 0x0003ffff))) #define svr4_to_bsd_dev_t(d) makedev(svr4_major(d), svr4_minor(d)) -#define bsd_to_svr4_dev_t(d) svr4_makedev(umajor(d), uminor(d)) +#define bsd_to_svr4_dev_t(d) svr4_makedev(major(d), minor(d)) #endif /* !_SVR4_TYPES_H_ */ Modified: head/sys/dev/xen/blkback/blkback.c ============================================================================== --- head/sys/dev/xen/blkback/blkback.c Wed Jan 28 16:37:49 2009 (r187829) +++ head/sys/dev/xen/blkback/blkback.c Wed Jan 28 17:57:16 2009 (r187830) @@ -1135,8 +1135,8 @@ open_device(blkif_t *blkif) } blkif->media_num_sectors = blkif->media_size >> blkif->sector_size_shift; - blkif->major = umajor(vattr.va_rdev); - blkif->minor = uminor(vattr.va_rdev); + blkif->major = major(vattr.va_rdev); + blkif->minor = minor(vattr.va_rdev); DPRINTF("opened dev=%s major=%d minor=%d sector_size=%u media_size=%lld\n", blkif->dev_name, blkif->major, blkif->minor, blkif->sector_size, blkif->media_size); Modified: head/sys/fs/cd9660/cd9660_rrip.c ============================================================================== --- head/sys/fs/cd9660/cd9660_rrip.c Wed Jan 28 16:37:49 2009 (r187829) +++ head/sys/fs/cd9660/cd9660_rrip.c Wed Jan 28 17:57:16 2009 (r187830) @@ -416,9 +416,9 @@ cd9660_rrip_device(p,ana) low = isonum_733(p->dev_t_low); if (high == 0) - ana->inop->inode.iso_rdev = makedev(umajor(low), uminor(low)); + ana->inop->inode.iso_rdev = makedev(major(low), minor(low)); else - ana->inop->inode.iso_rdev = makedev(high, uminor(low)); + ana->inop->inode.iso_rdev = makedev(high, minor(low)); ana->fields &= ~ISO_SUSP_DEVICE; return ISO_SUSP_DEVICE; } Modified: head/sys/nfs4client/nfs4_subs.c ============================================================================== --- head/sys/nfs4client/nfs4_subs.c Wed Jan 28 16:37:49 2009 (r187829) +++ head/sys/nfs4client/nfs4_subs.c Wed Jan 28 17:57:16 2009 (r187830) @@ -668,7 +668,7 @@ nfsm_v4build_create_xx(struct nfs4_compo nfsm_buildf_xx(mb, bpos, "s", strlen(c->linktext), c->linktext); else if (c->type == NFCHR || c->type == NFBLK) nfsm_buildf_xx(mb, bpos, "uu", - umajor(c->vap->va_rdev), uminor(c->vap->va_rdev)); + major(c->vap->va_rdev), minor(c->vap->va_rdev)); /* Name */ nfsm_buildf_xx(mb, bpos, "s", c->namelen, c->name); Modified: head/sys/nfsclient/nfs_vnops.c ============================================================================== --- head/sys/nfsclient/nfs_vnops.c Wed Jan 28 16:37:49 2009 (r187829) +++ head/sys/nfsclient/nfs_vnops.c Wed Jan 28 17:57:16 2009 (r187830) @@ -1314,8 +1314,8 @@ nfs_mknodrpc(struct vnode *dvp, struct v nfsm_v3attrbuild(vap, FALSE); if (vap->va_type == VCHR || vap->va_type == VBLK) { tl = nfsm_build(u_int32_t *, 2 * NFSX_UNSIGNED); - *tl++ = txdr_unsigned(umajor(vap->va_rdev)); - *tl = txdr_unsigned(uminor(vap->va_rdev)); + *tl++ = txdr_unsigned(major(vap->va_rdev)); + *tl = txdr_unsigned(minor(vap->va_rdev)); } } else { sp = nfsm_build(struct nfsv2_sattr *, NFSX_V2SATTR); Modified: head/sys/nfsserver/nfs_srvsubs.c ============================================================================== --- head/sys/nfsserver/nfs_srvsubs.c Wed Jan 28 16:37:49 2009 (r187829) +++ head/sys/nfsserver/nfs_srvsubs.c Wed Jan 28 17:57:16 2009 (r187830) @@ -1057,8 +1057,8 @@ nfsm_srvfattr(struct nfsrv_descript *nfs fp->fa_mode = vtonfsv3_mode(vap->va_mode); txdr_hyper(vap->va_size, &fp->fa3_size); txdr_hyper(vap->va_bytes, &fp->fa3_used); - fp->fa3_rdev.specdata1 = txdr_unsigned(umajor(vap->va_rdev)); - fp->fa3_rdev.specdata2 = txdr_unsigned(uminor(vap->va_rdev)); + fp->fa3_rdev.specdata1 = txdr_unsigned(major(vap->va_rdev)); + fp->fa3_rdev.specdata2 = txdr_unsigned(minor(vap->va_rdev)); fp->fa3_fsid.nfsuquad[0] = 0; fp->fa3_fsid.nfsuquad[1] = txdr_unsigned(vap->va_fsid); fp->fa3_fileid.nfsuquad[0] = 0; Modified: head/sys/sys/conf.h ============================================================================== --- head/sys/sys/conf.h Wed Jan 28 16:37:49 2009 (r187829) +++ head/sys/sys/conf.h Wed Jan 28 17:57:16 2009 (r187830) @@ -274,10 +274,7 @@ void dev_lock(void); void dev_unlock(void); void setconf(void); -#define dev2unit(d) ((d) ? (d)->si_drv0 : NODEV) -#define minor(d) ((d) ? (d)->si_drv0 : NODEV) -#define unit2minor(u) (u) -#define minor2unit(m) (m) +#define dev2unit(d) ((d)->si_drv0) typedef void (*cdevpriv_dtr_t)(void *data); int devfs_get_cdevpriv(void **datap); Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Wed Jan 28 16:37:49 2009 (r187829) +++ head/sys/sys/param.h Wed Jan 28 17:57:16 2009 (r187830) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800061 /* Master, propagated to newvers */ +#define __FreeBSD_version 800062 /* Master, propagated to newvers */ #ifndef LOCORE #include Modified: head/sys/sys/types.h ============================================================================== --- head/sys/sys/types.h Wed Jan 28 16:37:49 2009 (r187829) +++ head/sys/sys/types.h Wed Jan 28 17:57:16 2009 (r187830) @@ -317,17 +317,9 @@ typedef struct vm_page *vm_page_t; * minor() gives a cookie instead of an index since we don't want to * change the meanings of bits 0-15 or waste time and space shifting * bits 16-31 for devices that don't use them. - * - * XXX: In the kernel we must name it umajor() and uminor(), because - * minor() is still in use by . */ -#ifdef _KERNEL -#define umajor(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */ -#define uminor(x) ((int)((x)&0xffff00ff)) /* minor number */ -#else /* !_KERNEL */ -#define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */ +#define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */ #define minor(x) ((int)((x)&0xffff00ff)) /* minor number */ -#endif /* _KERNEL */ #define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */ /* From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 18:00:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5964E106566C; Wed, 28 Jan 2009 18:00:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44A058FC0A; Wed, 28 Jan 2009 18:00:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SI0NN4028009; Wed, 28 Jan 2009 18:00:23 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SI0MuQ028003; Wed, 28 Jan 2009 18:00:22 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901281800.n0SI0MuQ028003@svn.freebsd.org> From: Sam Leffler Date: Wed, 28 Jan 2009 18:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187831 - in head/sys: conf dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 18:00:24 -0000 Author: sam Date: Wed Jan 28 18:00:22 2009 New Revision: 187831 URL: http://svn.freebsd.org/changeset/base/187831 Log: Overhaul regulatory support: o remove HAL_CHANNEL; convert the hal to use net80211 channels; this mostly involves mechanical changes to variable names and channel attribute macros o gut HAL_CHANNEL_PRIVATE as most of the contents are now redundant with the net80211 channel available o change api for ath_hal_init_channels: no more reglass id's, no more outdoor indication (was a noop), anM contents o add ath_hal_getchannels to have the hal construct a channel list without altering runtime state; this is used to retrieve the calibration list for the device in ath_getradiocaps o add ath_hal_set_channels to take a channel list and regulatory data from above and construct internal state to match (maps frequencies for 900MHz cards, setup for CTL lookups, etc) o compact the private channel table: we keep one private channel per frequency instead of one per HAL_CHANNEL; this gives a big space savings and potentially improves ani and calibration by sharing state (to be seen; didn't see anything in testing); a new config option AH_MAXCHAN controls the table size (default to 96 which was chosen to be ~3x the largest expected size) o shrink ani state and change to mirror private channel table (one entry per frequency indexed by ic_devdata) o move ani state flags to private channel state o remove country codes; use net80211 definitions instead o remove GSM regulatory support; it's no longer needed now that we pass in channel lists from above o consolidate ADHOC_NO_11A attribute with DISALLOW_ADHOC_11A o simplify initial channel list construction based on the EEPROM contents; we preserve country code support for now but may want to just fallback to a WWR sku and dispatch the discovered country code up to user space so the channel list can be constructed using the master regdomain tables o defer to net80211 for max antenna gain o eliminate sorting of internal channel table; now that we use ic_devdata as an index, table lookups are O(1) o remove internal copy of the country code; the public one is sufficient o remove AH_SUPPORT_11D conditional compilation; we always support 11d o remove ath_hal_ispublicsafetysku; not needed any more o remove ath_hal_isgsmsku; no more GSM stuff o move Conformance Test Limit (CTL) state from private channel to a lookup using per-band pointers cached in the private state block o remove regulatory class id support; was unused and belongs in net80211 o fix channel list construction to set IEEE80211_CHAN_NOADHOC, IEEE80211_CHAN_NOHOSTAP, and IEEE80211_CHAN_4MSXMIT o remove private channel flags CHANNEL_DFS and CHANNEL_4MS_LIMIT; these are now set in the constructed net80211 channel o store CHANNEL_NFCREQUIRED (Noise Floor Required) channel attribute in one of the driver-private flag bits of the net80211 channel o move 900MHz frequency mapping into the hal; the mapped frequency is stored in the private channel and used throughout the hal (no more mapping in the driver and/or net80211) o remove ath_hal_mhz2ieee; it's no longer needed as net80211 does the calculation and available in the net80211 channel o change noise floor calibration logic to work with compacted private channel table setup; this may require revisiting as we no longer can distinguish channel attributes (e.g. 11b vs 11g vs turbo) but since the data is used only to calculate status data we can live with it for now o change ah_getChipPowerLimits internal method to operate on a single channel instead of all channels in the private channel table o add ath_hal_gethwchannel to map a net80211 channel to a h/w frequency (always the same except for 900MHz channels) o add HAL_EEBADREG and HAL_EEBADCC status codes to better identify regulatory problems o remove CTRY_DEBUG and CTRY_DEFAULT enum's; these come from net80211 now o change ath_hal_getwirelessmodes to really return wireless modes supported by the hardware (was previously applying regulatory constraints) o return channel interference status with IEEE80211_CHANSTATE_CWINT (should change to a callback so hal api's can take const pointers) o remove some #define's no longer needed with the inclusion of Sponsored by: Carlson Wireless Modified: head/sys/conf/options head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ah_internal.h head/sys/dev/ath/ath_hal/ah_regdomain.c head/sys/dev/ath/ath_hal/ar5210/ar5210.h head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c head/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c head/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c head/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c head/sys/dev/ath/ath_hal/ar5211/ar5211.h head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c head/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c head/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c head/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c head/sys/dev/ath/ath_hal/ar5212/ar2316.c head/sys/dev/ath/ath_hal/ar5212/ar2317.c head/sys/dev/ath/ath_hal/ar5212/ar2413.c head/sys/dev/ath/ath_hal/ar5212/ar2425.c head/sys/dev/ath/ath_hal/ar5212/ar5111.c head/sys/dev/ath/ath_hal/ar5212/ar5112.c head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c head/sys/dev/ath/ath_hal/ar5212/ar5413.c head/sys/dev/ath/ath_hal/ar5312/ar5312.h head/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c head/sys/dev/ath/ath_hal/ar5416/ar2133.c head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.h head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athvar.h Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Wed Jan 28 17:57:16 2009 (r187830) +++ head/sys/conf/options Wed Jan 28 18:00:22 2009 (r187831) @@ -762,7 +762,7 @@ AH_WRITE_EEPROM opt_ah.h AH_PRIVATE_DIAG opt_ah.h AH_NEED_DESC_SWAP opt_ah.h AH_USE_INIPDGAIN opt_ah.h -AH_SUPPORT_11D opt_ah.h +AH_MAXCHAN opt_ah.h # options for the Marvell 8335 wireless driver MALO_DEBUG opt_malo.h Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Wed Jan 28 17:57:16 2009 (r187830) +++ head/sys/dev/ath/ath_hal/ah.c Wed Jan 28 18:00:22 2009 (r187831) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting + * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * Copyright (c) 2002-2008 Atheros Communications, Inc. * * Permission to use, copy, modify, and/or distribute this software for any @@ -78,6 +78,15 @@ ath_hal_attach(uint16_t devid, HAL_SOFTC return AH_NULL; } +/* + * Return the mask of available modes based on the hardware capabilities. + */ +u_int +ath_hal_getwirelessmodes(struct ath_hal*ah) +{ + return ath_hal_getWirelessModes(ah); +} + /* linker set of registered RF backends */ OS_SET_DECLARE(ah_rfs, struct ath_hal_rf); @@ -152,8 +161,10 @@ ath_hal_computetxtime(struct ath_hal *ah kbps = rates->info[rateix].rateKbps; /* * index can be invalid duting dynamic Turbo transitions. + * XXX */ - if(kbps == 0) return 0; + if (kbps == 0) + return 0; switch (rates->info[rateix].phy) { case IEEE80211_T_CCK: @@ -187,8 +198,8 @@ ath_hal_computetxtime(struct ath_hal *ah #define OFDM_PLCP_BITS_QUARTER 22 #define OFDM_SYMBOL_TIME_QUARTER 16 - if (AH_PRIVATE(ah)->ah_curchan && - IS_CHAN_QUARTER_RATE(AH_PRIVATE(ah)->ah_curchan)) { + if (AH_PRIVATE(ah)->ah_curchan != AH_NULL && + IEEE80211_IS_CHAN_QUARTER(AH_PRIVATE(ah)->ah_curchan)) { bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_QUARTER) / 1000; HALASSERT(bitsPerSymbol != 0); @@ -197,8 +208,8 @@ ath_hal_computetxtime(struct ath_hal *ah txTime = OFDM_SIFS_TIME_QUARTER + OFDM_PREAMBLE_TIME_QUARTER + (numSymbols * OFDM_SYMBOL_TIME_QUARTER); - } else if (AH_PRIVATE(ah)->ah_curchan && - IS_CHAN_HALF_RATE(AH_PRIVATE(ah)->ah_curchan)) { + } else if (AH_PRIVATE(ah)->ah_curchan != AH_NULL && + IEEE80211_IS_CHAN_HALF(AH_PRIVATE(ah)->ah_curchan)) { bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_HALF) / 1000; HALASSERT(bitsPerSymbol != 0); @@ -252,71 +263,6 @@ ath_hal_computetxtime(struct ath_hal *ah return txTime; } -static __inline int -mapgsm(u_int freq, u_int flags) -{ - freq *= 10; - if (flags & CHANNEL_QUARTER) - freq += 5; - else if (flags & CHANNEL_HALF) - freq += 10; - else - freq += 20; - return (freq - 24220) / 5; -} - -static __inline int -mappsb(u_int freq, u_int flags) -{ - return ((freq * 10) + (((freq % 5) == 2) ? 5 : 0) - 49400) / 5; -} - -/* - * Convert GHz frequency to IEEE channel number. - */ -int -ath_hal_mhz2ieee(struct ath_hal *ah, u_int freq, u_int flags) -{ - if (flags & CHANNEL_2GHZ) { /* 2GHz band */ - if (freq == 2484) - return 14; - if (freq < 2484) { - if (ath_hal_isgsmsku(ah)) - return mapgsm(freq, flags); - return ((int)freq - 2407) / 5; - } else - return 15 + ((freq - 2512) / 20); - } else if (flags & CHANNEL_5GHZ) {/* 5Ghz band */ - if (ath_hal_ispublicsafetysku(ah) && - IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq)) { - return mappsb(freq, flags); - } else if ((flags & CHANNEL_A) && (freq <= 5000)) { - return (freq - 4000) / 5; - } else { - return (freq - 5000) / 5; - } - } else { /* either, guess */ - if (freq == 2484) - return 14; - if (freq < 2484) { - if (ath_hal_isgsmsku(ah)) - return mapgsm(freq, flags); - return ((int)freq - 2407) / 5; - } - if (freq < 5000) { - if (ath_hal_ispublicsafetysku(ah) && - IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq)) { - return mappsb(freq, flags); - } else if (freq > 4900) { - return (freq - 4000) / 5; - } else { - return 15 + ((freq - 2512) / 20); - } - } - return (freq - 5000) / 5; - } -} - typedef enum { WIRELESS_MODE_11a = 0, WIRELESS_MODE_TURBO = 1, @@ -328,15 +274,15 @@ typedef enum { } WIRELESS_MODE; static WIRELESS_MODE -ath_hal_chan2wmode(struct ath_hal *ah, const HAL_CHANNEL *chan) +ath_hal_chan2wmode(struct ath_hal *ah, const struct ieee80211_channel *chan) { - if (IS_CHAN_CCK(chan)) + if (IEEE80211_IS_CHAN_B(chan)) return WIRELESS_MODE_11b; - if (IS_CHAN_G(chan)) + if (IEEE80211_IS_CHAN_G(chan)) return WIRELESS_MODE_11g; - if (IS_CHAN_108G(chan)) + if (IEEE80211_IS_CHAN_108G(chan)) return WIRELESS_MODE_108g; - if (IS_CHAN_TURBO(chan)) + if (IEEE80211_IS_CHAN_TURBO(chan)) return WIRELESS_MODE_TURBO; return WIRELESS_MODE_11a; } @@ -350,17 +296,17 @@ static const uint8_t CLOCK_RATE[] = { 4 u_int ath_hal_mac_clks(struct ath_hal *ah, u_int usecs) { - const HAL_CHANNEL *c = (const HAL_CHANNEL *) AH_PRIVATE(ah)->ah_curchan; + const struct ieee80211_channel *c = AH_PRIVATE(ah)->ah_curchan; u_int clks; /* NB: ah_curchan may be null when called attach time */ if (c != AH_NULL) { clks = usecs * CLOCK_RATE[ath_hal_chan2wmode(ah, c)]; - if (IS_CHAN_HT40(c)) + if (IEEE80211_IS_CHAN_HT40(c)) clks <<= 1; - else if (IS_CHAN_HALF_RATE(c)) + else if (IEEE80211_IS_CHAN_HALF(c)) clks >>= 1; - else if (IS_CHAN_QUARTER_RATE(c)) + else if (IEEE80211_IS_CHAN_QUARTER(c)) clks >>= 2; } else clks = usecs * CLOCK_RATE[WIRELESS_MODE_11b]; @@ -370,17 +316,17 @@ ath_hal_mac_clks(struct ath_hal *ah, u_i u_int ath_hal_mac_usec(struct ath_hal *ah, u_int clks) { - const HAL_CHANNEL *c = (const HAL_CHANNEL *) AH_PRIVATE(ah)->ah_curchan; + const struct ieee80211_channel *c = AH_PRIVATE(ah)->ah_curchan; u_int usec; /* NB: ah_curchan may be null when called attach time */ if (c != AH_NULL) { usec = clks / CLOCK_RATE[ath_hal_chan2wmode(ah, c)]; - if (IS_CHAN_HT40(c)) + if (IEEE80211_IS_CHAN_HT40(c)) usec >>= 1; - else if (IS_CHAN_HALF_RATE(c)) + else if (IEEE80211_IS_CHAN_HALF(c)) usec <<= 1; - else if (IS_CHAN_QUARTER_RATE(c)) + else if (IEEE80211_IS_CHAN_QUARTER(c)) usec <<= 2; } else usec = clks / CLOCK_RATE[WIRELESS_MODE_11b]; @@ -505,11 +451,7 @@ ath_hal_getcapability(struct ath_hal *ah } return HAL_ENOTSUPP; case HAL_CAP_11D: -#ifdef AH_SUPPORT_11D return HAL_OK; -#else - return HAL_ENOTSUPP; -#endif case HAL_CAP_RXORN_FATAL: /* HAL_INT_RXORN treated as fatal */ return AH_PRIVATE(ah)->ah_rxornIsFatal ? HAL_OK : HAL_ENOTSUPP; case HAL_CAP_HT: @@ -764,7 +706,7 @@ static const int16_t NOISE_FLOOR[] = { - * implement the ah_getChanNoise method. */ int16_t -ath_hal_getChanNoise(struct ath_hal *ah, HAL_CHANNEL *chan) +ath_hal_getChanNoise(struct ath_hal *ah, const struct ieee80211_channel *chan) { HAL_CHANNEL_INTERNAL *ichan; @@ -772,7 +714,7 @@ ath_hal_getChanNoise(struct ath_hal *ah, if (ichan == AH_NULL) { HALDEBUG(ah, HAL_DEBUG_NFCAL, "%s: invalid channel %u/0x%x; no mapping\n", - __func__, chan->channel, chan->channelFlags); + __func__, chan->ic_freq, chan->ic_flags); return 0; } if (ichan->rawNoiseFloor == 0) { @@ -811,8 +753,8 @@ ath_hal_process_noisefloor(struct ath_ha c = &AH_PRIVATE(ah)->ah_channels[i]; if (c->rawNoiseFloor >= 0) continue; - mode = ath_hal_chan2wmode(ah, (HAL_CHANNEL *) c); - HALASSERT(mode < WIRELESS_MODE_MAX); + /* XXX can't identify proper mode */ + mode = IS_CHAN_5GHZ(c) ? WIRELESS_MODE_11a : WIRELESS_MODE_11g; nf = c->rawNoiseFloor + NOISE_FLOOR[mode] + ath_hal_getNfAdjust(ah, c); if (IS_CHAN_5GHZ(c)) { @@ -838,9 +780,8 @@ ath_hal_process_noisefloor(struct ath_ha /* Apply correction factor */ c->noiseFloorAdjust = ath_hal_getNfAdjust(ah, c) + (IS_CHAN_5GHZ(c) ? correct5 : correct2); - HALDEBUG(ah, HAL_DEBUG_NFCAL, "%u/0x%x raw nf %d adjust %d\n", - c->channel, c->channelFlags, c->rawNoiseFloor, - c->noiseFloorAdjust); + HALDEBUG(ah, HAL_DEBUG_NFCAL, "%u raw nf %d adjust %d\n", + c->channel, c->rawNoiseFloor, c->noiseFloorAdjust); } } Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Wed Jan 28 17:57:16 2009 (r187830) +++ head/sys/dev/ath/ath_hal/ah.h Wed Jan 28 18:00:22 2009 (r187831) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting + * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * Copyright (c) 2002-2008 Atheros Communications, Inc. * * Permission to use, copy, modify, and/or distribute this software for any @@ -14,7 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: ah.h,v 1.15 2008/11/15 03:43:50 sam Exp $ + * $FreeBSD$ */ #ifndef _ATH_AH_H_ @@ -63,6 +63,8 @@ typedef enum { HAL_ENOTSUPP = 13, /* Hardware revision not supported */ HAL_ESELFTEST = 14, /* Hardware self-test failed */ HAL_EINPROGRESS = 15, /* Operation incomplete */ + HAL_EEBADREG = 16, /* EEPROM invalid regulatory contents */ + HAL_EEBADCC = 17, /* EEPROM invalid country code */ } HAL_STATUS; typedef enum { @@ -362,64 +364,8 @@ typedef enum { HAL_RFGAIN_NEED_CHANGE = 2 } HAL_RFGAIN; -/* - * Channels are specified by frequency. - */ -typedef struct { - uint32_t channelFlags; /* see below */ - uint16_t channel; /* setting in Mhz */ - uint8_t privFlags; - int8_t maxRegTxPower; /* max regulatory tx power in dBm */ - int8_t maxTxPower; /* max true tx power in 0.5 dBm */ - int8_t minTxPower; /* min true tx power in 0.5 dBm */ -} HAL_CHANNEL; - -/* channelFlags */ -#define CHANNEL_CW_INT 0x00002 /* CW interference detected on channel */ -#define CHANNEL_TURBO 0x00010 /* Turbo Channel */ -#define CHANNEL_CCK 0x00020 /* CCK channel */ -#define CHANNEL_OFDM 0x00040 /* OFDM channel */ -#define CHANNEL_2GHZ 0x00080 /* 2 GHz spectrum channel */ -#define CHANNEL_5GHZ 0x00100 /* 5 GHz spectrum channel */ -#define CHANNEL_PASSIVE 0x00200 /* Only passive scan allowed in the channel */ -#define CHANNEL_DYN 0x00400 /* dynamic CCK-OFDM channel */ -#define CHANNEL_STURBO 0x02000 /* Static turbo, no 11a-only usage */ -#define CHANNEL_HALF 0x04000 /* Half rate channel */ -#define CHANNEL_QUARTER 0x08000 /* Quarter rate channel */ -#define CHANNEL_HT20 0x10000 /* 11n 20MHZ channel */ -#define CHANNEL_HT40PLUS 0x20000 /* 11n 40MHZ channel w/ ext chan above */ -#define CHANNEL_HT40MINUS 0x40000 /* 11n 40MHZ channel w/ ext chan below */ - -/* privFlags */ -#define CHANNEL_INTERFERENCE 0x01 /* Software use: channel interference - used for as AR as well as RADAR - interference detection */ -#define CHANNEL_DFS 0x02 /* DFS required on channel */ -#define CHANNEL_4MS_LIMIT 0x04 /* 4msec packet limit on this channel */ -#define CHANNEL_DFS_CLEAR 0x08 /* if channel has been checked for DFS */ - -#define CHANNEL_A (CHANNEL_5GHZ|CHANNEL_OFDM) -#define CHANNEL_B (CHANNEL_2GHZ|CHANNEL_CCK) -#define CHANNEL_PUREG (CHANNEL_2GHZ|CHANNEL_OFDM) -#ifdef notdef -#define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_DYN) -#else -#define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_OFDM) -#endif -#define CHANNEL_T (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_TURBO) -#define CHANNEL_ST (CHANNEL_T|CHANNEL_STURBO) -#define CHANNEL_108G (CHANNEL_2GHZ|CHANNEL_OFDM|CHANNEL_TURBO) -#define CHANNEL_108A CHANNEL_T -#define CHANNEL_G_HT20 (CHANNEL_G|CHANNEL_HT20) -#define CHANNEL_A_HT20 (CHANNEL_A|CHANNEL_HT20) -#define CHANNEL_G_HT40PLUS (CHANNEL_G|CHANNEL_HT40PLUS) -#define CHANNEL_G_HT40MINUS (CHANNEL_G|CHANNEL_HT40MINUS) -#define CHANNEL_A_HT40PLUS (CHANNEL_A|CHANNEL_HT40PLUS) -#define CHANNEL_A_HT40MINUS (CHANNEL_A|CHANNEL_HT40MINUS) -#define CHANNEL_ALL \ - (CHANNEL_OFDM | CHANNEL_CCK| CHANNEL_2GHZ | CHANNEL_5GHZ | \ - CHANNEL_TURBO | CHANNEL_HT20 | CHANNEL_HT40PLUS | CHANNEL_HT40MINUS) -#define CHANNEL_ALL_NOTURBO (CHANNEL_ALL &~ CHANNEL_TURBO) +typedef uint16_t HAL_CTRY_CODE; /* country code */ +typedef uint16_t HAL_REG_DOMAIN; /* regulatory domain code */ #define HAL_ANTENNA_MIN_MODE 0 #define HAL_ANTENNA_FIXED_A 1 @@ -434,14 +380,6 @@ typedef struct { uint32_t beacons; } HAL_MIB_STATS; -typedef uint16_t HAL_CTRY_CODE; /* country code */ -typedef uint16_t HAL_REG_DOMAIN; /* regulatory domain code */ - -enum { - CTRY_DEBUG = 0x1ff, /* debug country code */ - CTRY_DEFAULT = 0 /* default country code */ -}; - enum { HAL_MODE_11A = 0x001, /* 11a channels */ HAL_MODE_TURBO = 0x002, /* 11a turbo-only channels */ @@ -630,6 +568,7 @@ typedef struct { struct ath_desc; struct ath_tx_status; struct ath_rx_status; +struct ieee80211_channel; /* * Hardware Access Layer (HAL) API. @@ -665,16 +604,18 @@ struct ath_hal { /* Reset functions */ HAL_BOOL __ahdecl(*ah_reset)(struct ath_hal *, HAL_OPMODE, - HAL_CHANNEL *, HAL_BOOL bChannelChange, - HAL_STATUS *status); + struct ieee80211_channel *, + HAL_BOOL bChannelChange, HAL_STATUS *status); HAL_BOOL __ahdecl(*ah_phyDisable)(struct ath_hal *); HAL_BOOL __ahdecl(*ah_disable)(struct ath_hal *); void __ahdecl(*ah_setPCUConfig)(struct ath_hal *); - HAL_BOOL __ahdecl(*ah_perCalibration)(struct ath_hal*, HAL_CHANNEL *, - HAL_BOOL *); - HAL_BOOL __ahdecl(*ah_perCalibrationN)(struct ath_hal *, HAL_CHANNEL *, - u_int chainMask, HAL_BOOL longCal, HAL_BOOL *isCalDone); - HAL_BOOL __ahdecl(*ah_resetCalValid)(struct ath_hal *, HAL_CHANNEL *); + HAL_BOOL __ahdecl(*ah_perCalibration)(struct ath_hal*, + struct ieee80211_channel *, HAL_BOOL *); + HAL_BOOL __ahdecl(*ah_perCalibrationN)(struct ath_hal *, + struct ieee80211_channel *, u_int chainMask, + HAL_BOOL longCal, HAL_BOOL *isCalDone); + HAL_BOOL __ahdecl(*ah_resetCalValid)(struct ath_hal *, + const struct ieee80211_channel *); HAL_BOOL __ahdecl(*ah_setTxPowerLimit)(struct ath_hal *, uint32_t); /* Transmit functions */ @@ -735,7 +676,8 @@ struct ath_hal { struct ath_desc *next, uint64_t tsf, struct ath_rx_status *); void __ahdecl(*ah_rxMonitor)(struct ath_hal *, - const HAL_NODE_STATS *, HAL_CHANNEL *); + const HAL_NODE_STATS *, + const struct ieee80211_channel *); void __ahdecl(*ah_procMibEvent)(struct ath_hal *, const HAL_NODE_STATS *); @@ -804,7 +746,8 @@ struct ath_hal { HAL_BOOL __ahdecl(*ah_setPowerMode)(struct ath_hal*, HAL_POWER_MODE mode, int setChip); HAL_POWER_MODE __ahdecl(*ah_getPowerMode)(struct ath_hal*); - int16_t __ahdecl(*ah_getChanNoise)(struct ath_hal *, HAL_CHANNEL *); + int16_t __ahdecl(*ah_getChanNoise)(struct ath_hal *, + const struct ieee80211_channel *); /* Beacon Management Functions */ void __ahdecl(*ah_setBeaconTimers)(struct ath_hal*, @@ -847,53 +790,64 @@ extern struct ath_hal * __ahdecl ath_hal HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS* status); /* - * Return a list of channels available for use with the hardware. - * The list is based on what the hardware is capable of, the specified - * country code, the modeSelect mask, and whether or not outdoor - * channels are to be permitted. + * Regulatory interfaces. Drivers should use ath_hal_init_channels to + * request a set of channels for a particular country code and/or + * regulatory domain. If CTRY_DEFAULT and SKU_NONE are specified then + * this list is constructed according to the contents of the EEPROM. + * ath_hal_getchannels acts similarly but does not alter the operating + * state; this can be used to collect information for a particular + * regulatory configuration. Finally ath_hal_set_channels installs a + * channel list constructed outside the driver. The HAL will adopt the + * channel list and setup internal state according to the specified + * regulatory configuration (e.g. conformance test limits). * - * The channel list is returned in the supplied array. maxchans - * defines the maximum size of this array. nchans contains the actual - * number of channels returned. If a problem occurred or there were - * no channels that met the criteria then AH_FALSE is returned. - */ -extern HAL_BOOL __ahdecl ath_hal_init_channels(struct ath_hal *, - HAL_CHANNEL *chans, u_int maxchans, u_int *nchans, - uint8_t *regclassids, u_int maxregids, u_int *nregids, - HAL_CTRY_CODE cc, u_int modeSelect, - HAL_BOOL enableOutdoor, HAL_BOOL enableExtendedChannels); + * For all interfaces the channel list is returned in the supplied array. + * maxchans defines the maximum size of this array. nchans contains the + * actual number of channels returned. If a problem occurred then a + * status code != HAL_OK is returned. + */ +struct ieee80211_channel; /* - * Calibrate noise floor data following a channel scan or similar. - * This must be called prior retrieving noise floor data. + * Return a list of channels according to the specified regulatory. */ -extern void __ahdecl ath_hal_process_noisefloor(struct ath_hal *ah); +extern HAL_STATUS __ahdecl ath_hal_getchannels(struct ath_hal *, + struct ieee80211_channel *chans, u_int maxchans, int *nchans, + u_int modeSelect, HAL_CTRY_CODE cc, HAL_REG_DOMAIN regDmn, + HAL_BOOL enableExtendedChannels); /* - * Return bit mask of wireless modes supported by the hardware. + * Return a list of channels and install it as the current operating + * regulatory list. */ -extern u_int __ahdecl ath_hal_getwirelessmodes(struct ath_hal*, HAL_CTRY_CODE); +extern HAL_STATUS __ahdecl ath_hal_init_channels(struct ath_hal *, + struct ieee80211_channel *chans, u_int maxchans, int *nchans, + u_int modeSelect, HAL_CTRY_CODE cc, HAL_REG_DOMAIN rd, + HAL_BOOL enableExtendedChannels); /* - * Calculate the transmit duration of a frame. + * Install the list of channels as the current operating regulatory + * and setup related state according to the country code and sku. */ -extern uint16_t __ahdecl ath_hal_computetxtime(struct ath_hal *, - const HAL_RATE_TABLE *rates, uint32_t frameLen, - uint16_t rateix, HAL_BOOL shortPreamble); +extern HAL_STATUS __ahdecl ath_hal_set_channels(struct ath_hal *, + struct ieee80211_channel *chans, int nchans, + HAL_CTRY_CODE cc, HAL_REG_DOMAIN regDmn); /* - * Return if device is public safety. + * Calibrate noise floor data following a channel scan or similar. + * This must be called prior retrieving noise floor data. */ -extern HAL_BOOL __ahdecl ath_hal_ispublicsafetysku(struct ath_hal *); +extern void __ahdecl ath_hal_process_noisefloor(struct ath_hal *ah); /* - * Return if device is operating in 900 MHz band. + * Return bit mask of wireless modes supported by the hardware. */ -extern HAL_BOOL ath_hal_isgsmsku(struct ath_hal *); +extern u_int __ahdecl ath_hal_getwirelessmodes(struct ath_hal*); /* - * Convert between IEEE channel number and channel frequency - * using the specified channel flags; e.g. CHANNEL_2GHZ. + * Calculate the transmit duration of a frame. */ -extern int __ahdecl ath_hal_mhz2ieee(struct ath_hal *, u_int mhz, u_int flags); +extern uint16_t __ahdecl ath_hal_computetxtime(struct ath_hal *, + const HAL_RATE_TABLE *rates, uint32_t frameLen, + uint16_t rateix, HAL_BOOL shortPreamble); #endif /* _ATH_AH_H_ */ Modified: head/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_internal.h Wed Jan 28 17:57:16 2009 (r187830) +++ head/sys/dev/ath/ath_hal/ah_internal.h Wed Jan 28 18:00:22 2009 (r187831) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting + * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * Copyright (c) 2002-2008 Atheros Communications, Inc. * * Permission to use, copy, modify, and/or distribute this software for any @@ -27,6 +27,8 @@ #define AH_MIN(a,b) ((a)<(b)?(a):(b)) #define AH_MAX(a,b) ((a)>(b)?(a):(b)) +#include + #ifndef NBBY #define NBBY 8 /* number of bits/byte */ #endif @@ -108,32 +110,44 @@ OS_DATA_SET(ah_rfs, _name##_rf) struct ath_hal_rf *ath_hal_rfprobe(struct ath_hal *ah, HAL_STATUS *ecode); /* - * Internal form of a HAL_CHANNEL. Note that the structure - * must be defined such that you can cast references to a - * HAL_CHANNEL so don't shuffle the first two members. + * Maximum number of internal channels. Entries are per unique + * frequency so this might be need to be increased to handle all + * usage cases; typically no more than 32 are really needed but + * dynamically allocating the data structures is a bit painful + * right now. + */ +#ifndef AH_MAXCHAN +#define AH_MAXCHAN 96 +#endif + +/* + * Internal per-channel state. These are found + * using ic_devdata in the ieee80211_channel. */ typedef struct { - uint32_t channelFlags; - uint16_t channel; /* NB: must be first for casting */ + uint16_t channel; /* h/w frequency, NB: may be mapped */ uint8_t privFlags; - int8_t maxRegTxPower; - int8_t maxTxPower; - int8_t minTxPower; /* as above... */ - - HAL_BOOL bssSendHere; - uint8_t gainI; - HAL_BOOL iqCalValid; - uint8_t calValid; /* bitmask of cal types */ +#define CHANNEL_IQVALID 0x01 /* IQ calibration valid */ +#define CHANNEL_ANI_INIT 0x02 /* ANI state initialized */ +#define CHANNEL_ANI_SETUP 0x04 /* ANI state setup */ + uint8_t calValid; /* bitmask of cal types */ int8_t iCoff; int8_t qCoff; int16_t rawNoiseFloor; int16_t noiseFloorAdjust; - int8_t antennaMax; - uint32_t regDmnFlags; /* Flags for channel use in reg */ - uint32_t conformanceTestLimit; /* conformance test limit from reg domain */ - uint16_t mainSpur; /* cached spur value for this cahnnel */ + uint16_t mainSpur; /* cached spur value for this channel */ } HAL_CHANNEL_INTERNAL; +/* channel requires noise floor check */ +#define CHANNEL_NFCREQUIRED IEEE80211_CHAN_PRIV0 + +/* all full-width channels */ +#define IEEE80211_CHAN_ALLFULL \ + (IEEE80211_CHAN_ALL - (IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER)) +#define IEEE80211_CHAN_ALLTURBOFULL \ + (IEEE80211_CHAN_ALLTURBO - \ + (IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER)) + typedef struct { uint32_t halChanSpreadSupport : 1, halSleepAfterBeaconBroken : 1, @@ -189,6 +203,8 @@ typedef struct { uint8_t halNumAntCfg5GHz; } HAL_CAPABILITIES; +struct regDomain; + /* * The ``private area'' follows immediately after the ``public area'' * in the data structure returned by ath_hal_attach. Private data are @@ -228,7 +244,7 @@ struct ath_hal_private { uint32_t gpio, uint32_t val); void (*ah_gpioSetIntr)(struct ath_hal*, u_int, uint32_t); HAL_BOOL (*ah_getChipPowerLimits)(struct ath_hal *, - HAL_CHANNEL *, uint32_t); + struct ieee80211_channel *); int16_t (*ah_getNfAdjust)(struct ath_hal *, const HAL_CHANNEL_INTERNAL*); void (*ah_getNoiseFloor)(struct ath_hal *, @@ -255,8 +271,8 @@ struct ath_hal_private { uint16_t ah_analog5GhzRev; /* 2GHz radio revision */ uint16_t ah_analog2GhzRev; /* 5GHz radio revision */ - HAL_OPMODE ah_opmode; /* operating mode from reset */ + const struct ieee80211_channel *ah_curchan;/* operating channel */ HAL_CAPABILITIES ah_caps; /* device capabilities */ uint32_t ah_diagreg; /* user-specified AR_DIAG_SW */ int16_t ah_powerLimit; /* tx power cap */ @@ -267,14 +283,13 @@ struct ath_hal_private { /* * State for regulatory domain handling. */ - HAL_REG_DOMAIN ah_currentRD; /* Current regulatory domain */ - HAL_CTRY_CODE ah_countryCode; /* current country code */ - HAL_CHANNEL_INTERNAL ah_channels[256]; /* calculated channel list */ - u_int ah_nchan; /* valid channels in list */ - HAL_CHANNEL_INTERNAL *ah_curchan; /* current channel */ + HAL_REG_DOMAIN ah_currentRD; /* EEPROM regulatory domain */ + HAL_CHANNEL_INTERNAL ah_channels[AH_MAXCHAN]; /* private chan state */ + u_int ah_nchan; /* valid items in ah_channels */ + const struct regDomain *ah_rd2GHz; /* reg state for 2G band */ + const struct regDomain *ah_rd5GHz; /* reg state for 5G band */ uint8_t ah_coverageClass; /* coverage class */ - HAL_BOOL ah_regdomainUpdate; /* regdomain is updated? */ /* * RF Silent handling; setup according to the EEPROM. */ @@ -307,8 +322,8 @@ struct ath_hal_private { AH_PRIVATE(_ah)->ah_gpioGet(_ah, _gpio, _val) #define ath_hal_gpioSetIntr(_ah, _gpio, _ilevel) \ AH_PRIVATE(_ah)->ah_gpioSetIntr(_ah, _gpio, _ilevel) -#define ath_hal_getpowerlimits(_ah, _chans, _nchan) \ - AH_PRIVATE(_ah)->ah_getChipPowerLimits(_ah, _chans, _nchan) +#define ath_hal_getpowerlimits(_ah, _chan) \ + AH_PRIVATE(_ah)->ah_getChipPowerLimits(_ah, _chan) #define ath_hal_getNfAdjust(_ah, _c) \ AH_PRIVATE(_ah)->ah_getNfAdjust(_ah, _c) #define ath_hal_getNoiseFloor(_ah, _nfArray) \ @@ -327,38 +342,22 @@ struct ath_hal_private { #define ath_hal_eepromDiag(_ah, _request, _a, _asize, _r, _rsize) \ AH_PRIVATE(_ah)->ah_eepromDiag(_ah, _request, _a, _asize, _r, _rsize) -#if !defined(_NET_IF_IEEE80211_H_) && !defined(_NET80211__IEEE80211_H_) +#ifndef _NET_IF_IEEE80211_H_ /* * Stuff that would naturally come from _ieee80211.h */ #define IEEE80211_ADDR_LEN 6 -#define IEEE80211_WEP_KEYLEN 5 /* 40bit */ #define IEEE80211_WEP_IVLEN 3 /* 24bit */ #define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ #define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ #define IEEE80211_CRC_LEN 4 -#define IEEE80211_MTU 1500 #define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \ (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN)) - -enum { - IEEE80211_T_DS, /* direct sequence spread spectrum */ - IEEE80211_T_FH, /* frequency hopping */ - IEEE80211_T_OFDM, /* frequency division multiplexing */ - IEEE80211_T_TURBO, /* high rate DS */ - IEEE80211_T_HT, /* HT - full GI */ -}; -#define IEEE80211_T_CCK IEEE80211_T_DS /* more common nomenclatur */ #endif /* _NET_IF_IEEE80211_H_ */ -/* NB: these are defined privately until XR support is announced */ -enum { - ATHEROS_T_XR = IEEE80211_T_HT+1, /* extended range */ -}; - #define HAL_TXQ_USE_LOCKOUT_BKOFF_DIS 0x00000001 #define INIT_AIFS 2 @@ -411,43 +410,11 @@ typedef enum { #define HAL_BIN_WIDTH_TURBO_100HZ 6250 #define HAL_MAX_BINS_ALLOWED 28 -/* - * A = 5GHZ|OFDM - * T = 5GHZ|OFDM|TURBO - * - * IS_CHAN_A(T) will return TRUE. This is probably - * not the default behavior we want. We should migrate to a better mask -- - * perhaps CHANNEL_ALL. - * - * For now, IS_CHAN_G() masks itself with CHANNEL_108G. - * - */ - -#define IS_CHAN_A(_c) (((_c)->channelFlags & CHANNEL_A) == CHANNEL_A) -#define IS_CHAN_B(_c) (((_c)->channelFlags & CHANNEL_B) == CHANNEL_B) -#define IS_CHAN_G(_c) (((_c)->channelFlags & (CHANNEL_108G|CHANNEL_G)) == CHANNEL_G) -#define IS_CHAN_108G(_c)(((_c)->channelFlags & CHANNEL_108G) == CHANNEL_108G) -#define IS_CHAN_T(_c) (((_c)->channelFlags & CHANNEL_T) == CHANNEL_T) -#define IS_CHAN_PUREG(_c) \ - (((_c)->channelFlags & CHANNEL_PUREG) == CHANNEL_PUREG) - -#define IS_CHAN_TURBO(_c) (((_c)->channelFlags & CHANNEL_TURBO) != 0) -#define IS_CHAN_CCK(_c) (((_c)->channelFlags & CHANNEL_CCK) != 0) -#define IS_CHAN_OFDM(_c) (((_c)->channelFlags & CHANNEL_OFDM) != 0) -#define IS_CHAN_5GHZ(_c) (((_c)->channelFlags & CHANNEL_5GHZ) != 0) -#define IS_CHAN_2GHZ(_c) (((_c)->channelFlags & CHANNEL_2GHZ) != 0) -#define IS_CHAN_PASSIVE(_c) (((_c)->channelFlags & CHANNEL_PASSIVE) != 0) -#define IS_CHAN_HALF_RATE(_c) (((_c)->channelFlags & CHANNEL_HALF) != 0) -#define IS_CHAN_QUARTER_RATE(_c) (((_c)->channelFlags & CHANNEL_QUARTER) != 0) +#define IS_CHAN_5GHZ(_c) ((_c)->channel > 4900) +#define IS_CHAN_2GHZ(_c) (!IS_CHAN_5GHZ(_c)) #define IS_CHAN_IN_PUBLIC_SAFETY_BAND(_c) ((_c) > 4940 && (_c) < 4990) -#define CHANNEL_HT40 (CHANNEL_HT40PLUS | CHANNEL_HT40MINUS) -#define CHANNEL_HT (CHANNEL_HT20 | CHANNEL_HT40) -#define IS_CHAN_HT(_c) (((_c)->channelFlags & CHANNEL_HT) != 0) -#define IS_CHAN_HT20(_c) (((_c)->channelFlags & CHANNEL_HT) == CHANNEL_HT20) -#define IS_CHAN_HT40(_c) (((_c)->channelFlags & CHANNEL_HT40) != 0) - /* * Deduce if the host cpu has big- or litt-endian byte order. */ @@ -486,37 +453,6 @@ isBigEndian(void) #define OS_REG_CLR_BIT(_a, _r, _f) \ OS_REG_WRITE(_a, _r, OS_REG_READ(_a, _r) &~ (_f)) -/* - * Regulatory domain support. - */ - -/* - * Return the max allowed antenna gain based on the current - * regulatory domain. - */ -extern u_int ath_hal_getantennareduction(struct ath_hal *, - HAL_CHANNEL *, u_int twiceGain); -/* - * Return the test group for the specific channel based on - * the current regulator domain. - */ -extern u_int ath_hal_getctl(struct ath_hal *, HAL_CHANNEL *); -/* - * Return whether or not a noise floor check is required - * based on the current regulatory domain for the specified - * channel. - */ -extern u_int ath_hal_getnfcheckrequired(struct ath_hal *, HAL_CHANNEL *); - -/* - * Map a public channel definition to the corresponding - * internal data structure. This implicitly specifies - * whether or not the specified channel is ok to use - * based on the current regulatory domain constraints. - */ -extern HAL_CHANNEL_INTERNAL *ath_hal_checkchannel(struct ath_hal *, - const HAL_CHANNEL *); - /* system-configurable parameters */ extern int ath_hal_dma_beacon_response_time; /* in TU's */ extern int ath_hal_sw_beacon_response_time; /* in TU's */ @@ -575,6 +511,57 @@ extern void ath_hal_assert_failed(const #define HALASSERT(_x) #endif /* AH_ASSERT */ +/* + * Regulatory domain support. + */ + +/* + * Return the max allowed antenna gain and apply any regulatory + * domain specific changes. + */ +u_int ath_hal_getantennareduction(struct ath_hal *ah, + const struct ieee80211_channel *chan, u_int twiceGain); + +/* + * Return the test group for the specific channel based on + * the current regulatory setup. + */ +u_int ath_hal_getctl(struct ath_hal *, const struct ieee80211_channel *); + +/* + * Map a public channel definition to the corresponding + * internal data structure. This implicitly specifies + * whether or not the specified channel is ok to use + * based on the current regulatory domain constraints. + */ +#ifndef AH_DEBUG +static OS_INLINE HAL_CHANNEL_INTERNAL * +ath_hal_checkchannel(struct ath_hal *ah, const struct ieee80211_channel *c) +{ + HAL_CHANNEL_INTERNAL *cc; + + HALASSERT(c->ic_devdata < AH_PRIVATE(ah)->ah_nchan); + cc = &AH_PRIVATE(ah)->ah_channels[c->ic_devdata]; + HALASSERT(c->ic_freq == cc->channel || IEEE80211_IS_CHAN_GSM(c)); + return cc; +} +#else +/* NB: non-inline version that checks state */ +HAL_CHANNEL_INTERNAL *ath_hal_checkchannel(struct ath_hal *, + const struct ieee80211_channel *); +#endif /* AH_DEBUG */ + +/* + * Return the h/w frequency for a channel. This may be + * different from ic_freq if this is a GSM device that + * takes 2.4GHz frequencies and down-converts them. + */ +static OS_INLINE uint16_t +ath_hal_gethwchannel(struct ath_hal *ah, const struct ieee80211_channel *c) +{ + return ath_hal_checkchannel(ah, c)->channel; +} + /* * Convert between microseconds and core system clocks. */ @@ -733,7 +720,7 @@ extern void ath_hal_setupratetable(struc /* * Common routine for implementing getChanNoise api. */ -extern int16_t ath_hal_getChanNoise(struct ath_hal *ah, HAL_CHANNEL *chan); +int16_t ath_hal_getChanNoise(struct ath_hal *, const struct ieee80211_channel *); /* * Initialization support. Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah_regdomain.c Wed Jan 28 17:57:16 2009 (r187830) +++ head/sys/dev/ath/ath_hal/ah_regdomain.c Wed Jan 28 18:00:22 2009 (r187831) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting + * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * Copyright (c) 2005-2006 Atheros Communications, Inc. * All rights reserved. * @@ -20,6 +20,10 @@ #include "opt_ah.h" #include "ah.h" + +#include +#include + #include "ah_internal.h" #include "ah_eeprom.h" #include "ah_devid.h" @@ -34,10 +38,6 @@ #define HAL_MODE_11A_TURBO HAL_MODE_108A #define HAL_MODE_11G_TURBO HAL_MODE_108G -/* 10MHz is half the 11A bandwidth used to determine upper edge freq - of the outdoor channel */ -#define HALF_MAXCHANBW 10 - /* * BMLEN defines the size of the bitmask used to hold frequency * band specifications. Note this must agree with the BM macro @@ -76,160 +76,6 @@ typedef uint64_t chanbmask_t[BMLEN]; W1(_fg) | W1(_fh) } /* - * Country/Region Codes - * Numbering from ISO 3166 - */ -enum { - CTRY_ALBANIA = 8, /* Albania */ - CTRY_ALGERIA = 12, /* Algeria */ - CTRY_ARGENTINA = 32, /* Argentina */ - CTRY_ARMENIA = 51, /* Armenia */ - CTRY_AUSTRALIA = 36, /* Australia */ - CTRY_AUSTRIA = 40, /* Austria */ - CTRY_AZERBAIJAN = 31, /* Azerbaijan */ - CTRY_BAHRAIN = 48, /* Bahrain */ - CTRY_BELARUS = 112, /* Belarus */ - CTRY_BELGIUM = 56, /* Belgium */ - CTRY_BELIZE = 84, /* Belize */ - CTRY_BOLIVIA = 68, /* Bolivia */ - CTRY_BRAZIL = 76, /* Brazil */ - CTRY_BRUNEI_DARUSSALAM = 96, /* Brunei Darussalam */ - CTRY_BULGARIA = 100, /* Bulgaria */ - CTRY_CANADA = 124, /* Canada */ - CTRY_CHILE = 152, /* Chile */ - CTRY_CHINA = 156, /* People's Republic of China */ - CTRY_COLOMBIA = 170, /* Colombia */ - CTRY_COSTA_RICA = 188, /* Costa Rica */ - CTRY_CROATIA = 191, /* Croatia */ - CTRY_CYPRUS = 196, - CTRY_CZECH = 203, /* Czech Republic */ - CTRY_DENMARK = 208, /* Denmark */ - CTRY_DOMINICAN_REPUBLIC = 214, /* Dominican Republic */ - CTRY_ECUADOR = 218, /* Ecuador */ - CTRY_EGYPT = 818, /* Egypt */ - CTRY_EL_SALVADOR = 222, /* El Salvador */ - CTRY_ESTONIA = 233, /* Estonia */ - CTRY_FAEROE_ISLANDS = 234, /* Faeroe Islands */ - CTRY_FINLAND = 246, /* Finland */ - CTRY_FRANCE = 250, /* France */ - CTRY_FRANCE2 = 255, /* France2 */ - CTRY_GEORGIA = 268, /* Georgia */ - CTRY_GERMANY = 276, /* Germany */ - CTRY_GREECE = 300, /* Greece */ - CTRY_GUATEMALA = 320, /* Guatemala */ - CTRY_HONDURAS = 340, /* Honduras */ - CTRY_HONG_KONG = 344, /* Hong Kong S.A.R., P.R.C. */ - CTRY_HUNGARY = 348, /* Hungary */ - CTRY_ICELAND = 352, /* Iceland */ - CTRY_INDIA = 356, /* India */ - CTRY_INDONESIA = 360, /* Indonesia */ - CTRY_IRAN = 364, /* Iran */ - CTRY_IRAQ = 368, /* Iraq */ - CTRY_IRELAND = 372, /* Ireland */ - CTRY_ISRAEL = 376, /* Israel */ - CTRY_ITALY = 380, /* Italy */ - CTRY_JAMAICA = 388, /* Jamaica */ - CTRY_JAPAN = 392, /* Japan */ - CTRY_JAPAN1 = 393, /* Japan (JP1) */ - CTRY_JAPAN2 = 394, /* Japan (JP0) */ - CTRY_JAPAN3 = 395, /* Japan (JP1-1) */ - CTRY_JAPAN4 = 396, /* Japan (JE1) */ - CTRY_JAPAN5 = 397, /* Japan (JE2) */ - CTRY_JAPAN6 = 399, /* Japan (JP6) */ - - CTRY_JAPAN7 = 4007, /* Japan (J7) */ - CTRY_JAPAN8 = 4008, /* Japan (J8) */ - CTRY_JAPAN9 = 4009, /* Japan (J9) */ - - CTRY_JAPAN10 = 4010, /* Japan (J10) */ - CTRY_JAPAN11 = 4011, /* Japan (J11) */ - CTRY_JAPAN12 = 4012, /* Japan (J12) */ - - CTRY_JAPAN13 = 4013, /* Japan (J13) */ - CTRY_JAPAN14 = 4014, /* Japan (J14) */ - CTRY_JAPAN15 = 4015, /* Japan (J15) */ - - CTRY_JAPAN16 = 4016, /* Japan (J16) */ - CTRY_JAPAN17 = 4017, /* Japan (J17) */ - CTRY_JAPAN18 = 4018, /* Japan (J18) */ - - CTRY_JAPAN19 = 4019, /* Japan (J19) */ - CTRY_JAPAN20 = 4020, /* Japan (J20) */ - CTRY_JAPAN21 = 4021, /* Japan (J21) */ - - CTRY_JAPAN22 = 4022, /* Japan (J22) */ - CTRY_JAPAN23 = 4023, /* Japan (J23) */ - CTRY_JAPAN24 = 4024, /* Japan (J24) */ - - CTRY_JORDAN = 400, /* Jordan */ - CTRY_KAZAKHSTAN = 398, /* Kazakhstan */ - CTRY_KENYA = 404, /* Kenya */ - CTRY_KOREA_NORTH = 408, /* North Korea */ - CTRY_KOREA_ROC = 410, /* South Korea */ - CTRY_KOREA_ROC2 = 411, /* South Korea */ - CTRY_KOREA_ROC3 = 412, /* South Korea */ - CTRY_KUWAIT = 414, /* Kuwait */ - CTRY_LATVIA = 428, /* Latvia */ - CTRY_LEBANON = 422, /* Lebanon */ - CTRY_LIBYA = 434, /* Libya */ - CTRY_LIECHTENSTEIN = 438, /* Liechtenstein */ - CTRY_LITHUANIA = 440, /* Lithuania */ - CTRY_LUXEMBOURG = 442, /* Luxembourg */ - CTRY_MACAU = 446, /* Macau */ - CTRY_MACEDONIA = 807, /* the Former Yugoslav Republic of Macedonia */ - CTRY_MALAYSIA = 458, /* Malaysia */ - CTRY_MALTA = 470, /* Malta */ - CTRY_MEXICO = 484, /* Mexico */ - CTRY_MONACO = 492, /* Principality of Monaco */ - CTRY_MOROCCO = 504, /* Morocco */ - CTRY_NETHERLANDS = 528, /* Netherlands */ - CTRY_NEW_ZEALAND = 554, /* New Zealand */ - CTRY_NICARAGUA = 558, /* Nicaragua */ - CTRY_NORWAY = 578, /* Norway */ - CTRY_OMAN = 512, /* Oman */ - CTRY_PAKISTAN = 586, /* Islamic Republic of Pakistan */ - CTRY_PANAMA = 591, /* Panama */ - CTRY_PARAGUAY = 600, /* Paraguay */ - CTRY_PERU = 604, /* Peru */ - CTRY_PHILIPPINES = 608, /* Republic of the Philippines */ - CTRY_POLAND = 616, /* Poland */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 18:10:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E25551065672; Wed, 28 Jan 2009 18:10:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D0C0E8FC21; Wed, 28 Jan 2009 18:10:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SIAv5w028236; Wed, 28 Jan 2009 18:10:57 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SIAvBS028235; Wed, 28 Jan 2009 18:10:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200901281810.n0SIAvBS028235@svn.freebsd.org> From: John Baldwin Date: Wed, 28 Jan 2009 18:10:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187832 - head/sys/fs/fifofs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 18:10:59 -0000 Author: jhb Date: Wed Jan 28 18:10:57 2009 New Revision: 187832 URL: http://svn.freebsd.org/changeset/base/187832 Log: Assert an exclusive vnode lock for fifo_cleanup() and fifo_close() since they change v_fifoinfo. Discussed with: ups (a while ago) Modified: head/sys/fs/fifofs/fifo_vnops.c Modified: head/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- head/sys/fs/fifofs/fifo_vnops.c Wed Jan 28 18:00:22 2009 (r187831) +++ head/sys/fs/fifofs/fifo_vnops.c Wed Jan 28 18:10:57 2009 (r187832) @@ -149,7 +149,7 @@ fifo_cleanup(struct vnode *vp) { struct fifoinfo *fip = vp->v_fifoinfo; - ASSERT_VOP_LOCKED(vp, "fifo_cleanup"); + ASSERT_VOP_ELOCKED(vp, "fifo_cleanup"); if (fip->fi_readers == 0 && fip->fi_writers == 0) { vp->v_fifoinfo = NULL; (void)soclose(fip->fi_readsock); @@ -422,7 +422,7 @@ fifo_close(ap) struct vnode *vp = ap->a_vp; struct fifoinfo *fip = vp->v_fifoinfo; - ASSERT_VOP_LOCKED(vp, "fifo_close"); + ASSERT_VOP_ELOCKED(vp, "fifo_close"); if (fip == NULL) { printf("fifo_close: no v_fifoinfo %p\n", vp); return (0); From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 18:14:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A8B4106566B; Wed, 28 Jan 2009 18:14:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 497868FC1B; Wed, 28 Jan 2009 18:14:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SIEOam028344; Wed, 28 Jan 2009 18:14:24 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SIEOxg028343; Wed, 28 Jan 2009 18:14:24 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200901281814.n0SIEOxg028343@svn.freebsd.org> From: John Baldwin Date: Wed, 28 Jan 2009 18:14:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187833 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 18:14:24 -0000 Author: jhb Date: Wed Jan 28 18:14:24 2009 New Revision: 187833 URL: http://svn.freebsd.org/changeset/base/187833 Log: Actually remove the VA_MARK_ATIME flag. This should have been in the earlier commit to add VOP_MARKATIME(). Modified: head/sys/sys/vnode.h Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Wed Jan 28 18:10:57 2009 (r187832) +++ head/sys/sys/vnode.h Wed Jan 28 18:14:24 2009 (r187833) @@ -285,7 +285,6 @@ struct vattr { */ #define VA_UTIMES_NULL 0x01 /* utimes argument was NULL */ #define VA_EXCLUSIVE 0x02 /* exclusive create request */ -#define VA_MARK_ATIME 0x04 /* setting atime for execve/mmap */ /* * Flags for ioflag. (high 16 bits used to ask for read-ahead and From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 18:37:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F38910656C8; Wed, 28 Jan 2009 18:37:47 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C7478FC34; Wed, 28 Jan 2009 18:37:47 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SIbk7T028787; Wed, 28 Jan 2009 18:37:46 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SIbk56028786; Wed, 28 Jan 2009 18:37:46 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901281837.n0SIbk56028786@svn.freebsd.org> From: Sam Leffler Date: Wed, 28 Jan 2009 18:37:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187834 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 18:37:47 -0000 Author: sam Date: Wed Jan 28 18:37:46 2009 New Revision: 187834 URL: http://svn.freebsd.org/changeset/base/187834 Log: change null_getradiocaps to return the actual count of channels instead of the true number; otherwise the caller may use the count to do things with the data it should not (e.g. sort the channel table) Modified: head/sys/net80211/ieee80211_regdomain.c Modified: head/sys/net80211/ieee80211_regdomain.c ============================================================================== --- head/sys/net80211/ieee80211_regdomain.c Wed Jan 28 18:14:24 2009 (r187833) +++ head/sys/net80211/ieee80211_regdomain.c Wed Jan 28 18:37:46 2009 (r187834) @@ -48,10 +48,10 @@ null_getradiocaps(struct ieee80211com *i int *n, struct ieee80211_channel *c) { /* just feed back the current channel list */ - *n = ic->ic_nchans; /* XXX return count copied? */ if (maxchan > ic->ic_nchans) maxchan = ic->ic_nchans; memcpy(c, ic->ic_channels, maxchan*sizeof(struct ieee80211_channel)); + *n = maxchan; } static int From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 18:39:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0107E10656E4; Wed, 28 Jan 2009 18:39:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DEDAC8FC13; Wed, 28 Jan 2009 18:39:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SIdNOM028854; Wed, 28 Jan 2009 18:39:23 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SIdNY9028853; Wed, 28 Jan 2009 18:39:23 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901281839.n0SIdNY9028853@svn.freebsd.org> From: Sam Leffler Date: Wed, 28 Jan 2009 18:39:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187835 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 18:39:24 -0000 Author: sam Date: Wed Jan 28 18:39:23 2009 New Revision: 187835 URL: http://svn.freebsd.org/changeset/base/187835 Log: add an assert to verify the number of channels returned by ic_getradiocaps correlates with the size of the channel array passed down might want to promote this to be always present to catch for driver errors Modified: head/sys/net80211/ieee80211_ioctl.c Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Wed Jan 28 18:37:46 2009 (r187834) +++ head/sys/net80211/ieee80211_ioctl.c Wed Jan 28 18:39:23 2009 (r187835) @@ -715,6 +715,8 @@ ieee80211_ioctl_getdevcaps(struct ieee80 dc->dc_htcaps = ic->ic_htcaps; ci = &dc->dc_chaninfo; ic->ic_getradiocaps(ic, maxchans, &ci->ic_nchans, ci->ic_chans); + KASSERT(ci->ic_nchans <= maxchans, + ("nchans %d maxchans %d", ci->ic_nchans, maxchans)); ieee80211_sort_channels(ci->ic_chans, ci->ic_nchans); error = copyout(dc, ireq->i_data, IEEE80211_DEVCAPS_SPACE(dc)); free(dc, M_TEMP); From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 18:46:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64DD81065881; Wed, 28 Jan 2009 18:46:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5441E8FC1A; Wed, 28 Jan 2009 18:46:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SIkTHw029043; Wed, 28 Jan 2009 18:46:29 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SIkT9e029042; Wed, 28 Jan 2009 18:46:29 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200901281846.n0SIkT9e029042@svn.freebsd.org> From: John Baldwin Date: Wed, 28 Jan 2009 18:46:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187836 - head/sys/fs/cd9660 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 18:46:29 -0000 Author: jhb Date: Wed Jan 28 18:46:29 2009 New Revision: 187836 URL: http://svn.freebsd.org/changeset/base/187836 Log: Sync with ufs_vnops.c:1.245 and remove support for accessing device nodes in ISO 9660 filesystems. Modified: head/sys/fs/cd9660/cd9660_vnops.c Modified: head/sys/fs/cd9660/cd9660_vnops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vnops.c Wed Jan 28 18:39:23 2009 (r187835) +++ head/sys/fs/cd9660/cd9660_vnops.c Wed Jan 28 18:46:29 2009 (r187836) @@ -168,10 +168,14 @@ cd9660_open(ap) int a_fdidx; } */ *ap; { - struct iso_node *ip = VTOI(ap->a_vp); + struct vnode *vp = ap->a_vp; + struct iso_node *ip = VTOI(vp); - vnode_create_vobject(ap->a_vp, ip->i_size, ap->a_td); - return 0; + if (vp->v_type == VCHR || vp->v_type == VBLK) + return (EOPNOTSUPP); + + vnode_create_vobject(vp, ip->i_size, ap->a_td); + return (0); } From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 18:54:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51F461065697; Wed, 28 Jan 2009 18:54:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E5598FC21; Wed, 28 Jan 2009 18:54:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SIsv0C029336; Wed, 28 Jan 2009 18:54:57 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SIsvNX029332; Wed, 28 Jan 2009 18:54:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200901281854.n0SIsvNX029332@svn.freebsd.org> From: John Baldwin Date: Wed, 28 Jan 2009 18:54:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187838 - head/sys/fs/cd9660 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 18:54:58 -0000 Author: jhb Date: Wed Jan 28 18:54:56 2009 New Revision: 187838 URL: http://svn.freebsd.org/changeset/base/187838 Log: Mark cd9660 MPSAFE and add support for using shared vnode locks during pathname lookups. - Remove 'i_offset' and 'i_ino' from the ISO node structure and replace them with local variables in the lookup routine instead. - Cache a copy of 'i_diroff' for use during a lookup in a local variable. - Save a copy of the found directory entry in a malloc'd buffer after a successfull lookup before getting the vnode. This allows us to release the buffer holding the directory block before calling vget() which otherwise resulted in a LOR between "bufwait" and the vnode lock. - Use an inlined version of vn_vget_ino() to handle races with .. lookups. I had to inline the code here since cd9660 uses an internal vget routine to save a disk I/O that would otherwise re-read the directory block. - Honor the requested locking flags during lookups to allow for shared locking. - Honor the requested locking flags passed to VFS_ROOT() and VFS_VGET() similar to UFS. - Don't make every ISO 9660 vnode hold a reference on the vnode of the underlying device vnode of the mountpoint. The mountpoint already holds a suitable reference. Modified: head/sys/fs/cd9660/cd9660_lookup.c head/sys/fs/cd9660/cd9660_node.c head/sys/fs/cd9660/cd9660_node.h head/sys/fs/cd9660/cd9660_vfsops.c Modified: head/sys/fs/cd9660/cd9660_lookup.c ============================================================================== --- head/sys/fs/cd9660/cd9660_lookup.c Wed Jan 28 18:51:11 2009 (r187837) +++ head/sys/fs/cd9660/cd9660_lookup.c Wed Jan 28 18:54:56 2009 (r187838) @@ -94,28 +94,33 @@ cd9660_lookup(ap) struct iso_node *dp; /* inode for directory being searched */ struct iso_mnt *imp; /* filesystem that directory is in */ struct buf *bp; /* a buffer of directory entries */ - struct iso_directory_record *ep = 0;/* the current directory entry */ + struct iso_directory_record *ep;/* the current directory entry */ + struct iso_directory_record *ep2;/* copy of current directory entry */ int entryoffsetinblock; /* offset of ep in bp's buffer */ int saveoffset = 0; /* offset of last directory entry in dir */ + doff_t i_diroff; /* cached i_diroff value. */ + doff_t i_offset; /* cached i_offset value. */ int numdirpasses; /* strategy for directory search */ doff_t endsearch; /* offset to end directory search */ struct vnode *pdp; /* saved dp during symlink work */ struct vnode *tdp; /* returned by cd9660_vget_internal */ u_long bmask; /* block offset mask */ int error; - ino_t ino = 0, saved_ino; - int reclen; + ino_t ino, i_ino; + int ltype, reclen; u_short namelen; int isoflags; char altname[NAME_MAX]; int res; int assoc, len; char *name; + struct mount *mp; struct vnode **vpp = ap->a_vpp; struct componentname *cnp = ap->a_cnp; int flags = cnp->cn_flags; int nameiop = cnp->cn_nameiop; + ep2 = ep = NULL; bp = NULL; *vpp = NULL; vdp = ap->a_dvp; @@ -125,9 +130,11 @@ cd9660_lookup(ap) /* * We now have a segment name to search for, and a directory to search. */ - + ino = reclen = 0; + i_diroff = dp->i_diroff; len = cnp->cn_namelen; name = cnp->cn_nameptr; + /* * A leading `=' means, we are looking for an associated file */ @@ -149,15 +156,14 @@ cd9660_lookup(ap) * of simplicity. */ bmask = imp->im_bmask; - if (nameiop != LOOKUP || dp->i_diroff == 0 || - dp->i_diroff > dp->i_size) { + if (nameiop != LOOKUP || i_diroff == 0 || i_diroff > dp->i_size) { entryoffsetinblock = 0; - dp->i_offset = 0; + i_offset = 0; numdirpasses = 1; } else { - dp->i_offset = dp->i_diroff; - if ((entryoffsetinblock = dp->i_offset & bmask) && - (error = cd9660_blkatoff(vdp, (off_t)dp->i_offset, NULL, &bp))) + i_offset = i_diroff; + if ((entryoffsetinblock = i_offset & bmask) && + (error = cd9660_blkatoff(vdp, (off_t)i_offset, NULL, &bp))) return (error); numdirpasses = 2; nchstats.ncs_2passes++; @@ -165,17 +171,17 @@ cd9660_lookup(ap) endsearch = dp->i_size; searchloop: - while (dp->i_offset < endsearch) { + while (i_offset < endsearch) { /* * If offset is on a block boundary, * read the next directory block. * Release previous if it exists. */ - if ((dp->i_offset & bmask) == 0) { + if ((i_offset & bmask) == 0) { if (bp != NULL) brelse(bp); if ((error = - cd9660_blkatoff(vdp, (off_t)dp->i_offset, NULL, &bp)) != 0) + cd9660_blkatoff(vdp, (off_t)i_offset, NULL, &bp)) != 0) return (error); entryoffsetinblock = 0; } @@ -188,8 +194,8 @@ searchloop: reclen = isonum_711(ep->length); if (reclen == 0) { /* skip to next block, if any */ - dp->i_offset = - (dp->i_offset & ~bmask) + imp->logical_block_size; + i_offset = + (i_offset & ~bmask) + imp->logical_block_size; continue; } @@ -224,7 +230,7 @@ searchloop: * Save directory entry's inode number and * release directory buffer. */ - dp->i_ino = isodirino(ep, imp); + i_ino = isodirino(ep, imp); goto found; } if (namelen != 1 @@ -241,7 +247,7 @@ searchloop: else ino = dbtob(bp->b_blkno) + entryoffsetinblock; - saveoffset = dp->i_offset; + saveoffset = i_offset; } else if (ino) goto foundino; #ifdef NOSORTBUG /* On some CDs directory entries are not sorted correctly */ @@ -257,22 +263,22 @@ searchloop: ino = isodirino(ep, imp); else ino = dbtob(bp->b_blkno) + entryoffsetinblock; - dp->i_ino = ino; - cd9660_rrip_getname(ep,altname,&namelen,&dp->i_ino,imp); + i_ino = ino; + cd9660_rrip_getname(ep, altname, &namelen, &i_ino, imp); if (namelen == cnp->cn_namelen && !bcmp(name,altname,namelen)) goto found; ino = 0; break; } - dp->i_offset += reclen; + i_offset += reclen; entryoffsetinblock += reclen; } if (ino) { foundino: - dp->i_ino = ino; - if (saveoffset != dp->i_offset) { - if (lblkno(imp, dp->i_offset) != + i_ino = ino; + if (saveoffset != i_offset) { + if (lblkno(imp, i_offset) != lblkno(imp, saveoffset)) { if (bp != NULL) brelse(bp); @@ -283,7 +289,8 @@ foundino: entryoffsetinblock = saveoffset & bmask; ep = (struct iso_directory_record *) ((char *)bp->b_data + entryoffsetinblock); - dp->i_offset = saveoffset; + reclen = isonum_711(ep->length); + i_offset = saveoffset; } goto found; } @@ -294,8 +301,8 @@ notfound: */ if (numdirpasses == 2) { numdirpasses--; - dp->i_offset = 0; - endsearch = dp->i_diroff; + i_offset = 0; + endsearch = i_diroff; goto searchloop; } if (bp != NULL) @@ -320,10 +327,10 @@ found: * in the cache as to where the entry was found. */ if ((flags & ISLASTCN) && nameiop == LOOKUP) - dp->i_diroff = dp->i_offset; + dp->i_diroff = i_offset; /* - * Step through the translation in the name. We do not `iput' the + * Step through the translation in the name. We do not `vput' the * directory because we may need it again if a symbolic link * is relative to the current directory. Instead we save it * unlocked as "pdp". We must get the target inode before unlocking @@ -333,7 +340,7 @@ found: * when following backward pointers ".." we must unlock the * parent directory before getting the requested directory. * There is a potential race condition here if both the current - * and parent directories are removed before the `iget' for the + * and parent directories are removed before the `vget' for the * inode associated with ".." returns. We hope that this occurs * infrequently since we cannot avoid this race condition without * implementing a sophisticated deadlock detection algorithm. @@ -342,30 +349,75 @@ found: * that point backwards in the directory structure. */ pdp = vdp; + /* - * If ino is different from dp->i_ino, + * Make a copy of the directory entry for non "." lookups so + * we can drop the buffer before calling vget() to avoid a + * lock order reversal between the vnode lock and the buffer + * lock. + */ + if (dp->i_number != i_ino) { + ep2 = malloc(reclen, M_TEMP, M_WAITOK); + bcopy(ep, ep2, reclen); + ep = ep2; + } + brelse(bp); + + /* + * If ino is different from i_ino, * it's a relocated directory. */ if (flags & ISDOTDOT) { - saved_ino = dp->i_ino; - VOP_UNLOCK(pdp, 0); /* race to get the inode */ - error = cd9660_vget_internal(vdp->v_mount, saved_ino, - LK_EXCLUSIVE, &tdp, - saved_ino != ino, ep); - brelse(bp); - vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY); + /* + * Expanded copy of vn_vget_ino() so that we can use + * cd9660_vget_internal(). + */ + mp = pdp->v_mount; + ltype = VOP_ISLOCKED(pdp); + for (;;) { + error = vfs_busy(mp, MBF_NOWAIT); + if (error == 0) + break; + VOP_UNLOCK(pdp, 0); + pause("vn_vget", 1); + vn_lock(pdp, ltype | LK_RETRY); + if (pdp->v_iflag & VI_DOOMED) + return (ENOENT); + } + VOP_UNLOCK(pdp, 0); + error = cd9660_vget_internal(vdp->v_mount, i_ino, + cnp->cn_lkflags, &tdp, + i_ino != ino, ep); + free(ep2, M_TEMP); + vfs_unbusy(mp); + vn_lock(pdp, ltype | LK_RETRY); + if (pdp->v_iflag & VI_DOOMED) { + if (error == 0) + vput(tdp); + error = ENOENT; + } if (error) return (error); *vpp = tdp; - } else if (dp->i_number == dp->i_ino) { - brelse(bp); + } else if (dp->i_number == i_ino) { VREF(vdp); /* we want ourself, ie "." */ + /* + * When we lookup "." we still can be asked to lock it + * differently. + */ + ltype = cnp->cn_lkflags & LK_TYPE_MASK; + if (ltype != VOP_ISLOCKED(vdp)) { + if (ltype == LK_EXCLUSIVE) + vn_lock(vdp, LK_UPGRADE | LK_RETRY); + else /* if (ltype == LK_SHARED) */ + vn_lock(vdp, LK_DOWNGRADE | LK_RETRY); + } *vpp = vdp; } else { - error = cd9660_vget_internal(vdp->v_mount, dp->i_ino, - LK_EXCLUSIVE, &tdp, - dp->i_ino != ino, ep); - brelse(bp); + error = cd9660_vget_internal(vdp->v_mount, i_ino, + cnp->cn_lkflags, &tdp, + i_ino != ino, ep); + free(ep2, M_TEMP); if (error) return (error); *vpp = tdp; Modified: head/sys/fs/cd9660/cd9660_node.c ============================================================================== --- head/sys/fs/cd9660/cd9660_node.c Wed Jan 28 18:51:11 2009 (r187837) +++ head/sys/fs/cd9660/cd9660_node.c Wed Jan 28 18:54:56 2009 (r187838) @@ -92,7 +92,6 @@ cd9660_reclaim(ap) } */ *ap; { struct vnode *vp = ap->a_vp; - struct iso_node *ip = VTOI(vp); if (prtactive && vrefcnt(vp) != 0) vprint("cd9660_reclaim: pushing active", vp); @@ -108,8 +107,6 @@ cd9660_reclaim(ap) /* * Purge old data structures associated with the inode. */ - if (ip->i_mnt->im_devvp) - vrele(ip->i_mnt->im_devvp); free(vp->v_data, M_ISOFSNODE); vp->v_data = NULL; return (0); Modified: head/sys/fs/cd9660/cd9660_node.h ============================================================================== --- head/sys/fs/cd9660/cd9660_node.h Wed Jan 28 18:51:11 2009 (r187837) +++ head/sys/fs/cd9660/cd9660_node.h Wed Jan 28 18:54:56 2009 (r187838) @@ -64,8 +64,6 @@ struct iso_node { struct lockf *i_lockf; /* head of byte-level lock list */ doff_t i_endoff; /* end of useful stuff in directory */ doff_t i_diroff; /* offset in dir, where we found last entry */ - doff_t i_offset; /* offset of free space in directory */ - ino_t i_ino; /* inode number of found directory */ long iso_extent; /* extent of file */ unsigned long i_size; Modified: head/sys/fs/cd9660/cd9660_vfsops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vfsops.c Wed Jan 28 18:51:11 2009 (r187837) +++ head/sys/fs/cd9660/cd9660_vfsops.c Wed Jan 28 18:54:56 2009 (r187838) @@ -375,6 +375,7 @@ iso_mountfs(devvp, mp) mp->mnt_maxsymlinklen = 0; MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; + mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED; MNT_IUNLOCK(mp); isomp->im_mountp = mp; isomp->im_dev = dev; @@ -545,7 +546,7 @@ cd9660_root(mp, flags, vpp, td) * With RRIP we must use the `.' entry of the root directory. * Simply tell vget, that it's a relocated directory. */ - return (cd9660_vget_internal(mp, ino, LK_EXCLUSIVE, vpp, + return (cd9660_vget_internal(mp, ino, flags, vpp, imp->iso_ftype == ISO_FTYPE_RRIP, dp)); } @@ -659,6 +660,22 @@ cd9660_vget_internal(mp, ino, flags, vpp if (error || *vpp != NULL) return (error); + /* + * We must promote to an exclusive lock for vnode creation. This + * can happen if lookup is passed LOCKSHARED. + */ + if ((flags & LK_TYPE_MASK) == LK_SHARED) { + flags &= ~LK_TYPE_MASK; + flags |= LK_EXCLUSIVE; + } + + /* + * We do not lock vnode creation as it is believed to be too + * expensive for such rare case as simultaneous creation of vnode + * for same ino by different processes. We just allow them to race + * and check later to decide who wins. Let the race begin! + */ + imp = VFSTOISOFS(mp); dev = imp->im_dev; @@ -739,7 +756,6 @@ cd9660_vget_internal(mp, ino, flags, vpp bp = 0; ip->i_mnt = imp; - VREF(imp->im_devvp); if (relocated) { /* @@ -797,6 +813,7 @@ cd9660_vget_internal(mp, ino, flags, vpp vp->v_op = &cd9660_fifoops; break; default: + VN_LOCK_ASHARE(vp); break; } From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 19:05:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAF6B10656C4; Wed, 28 Jan 2009 19:05:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 979BF8FC12; Wed, 28 Jan 2009 19:05:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SJ5It0029607; Wed, 28 Jan 2009 19:05:18 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SJ5IT8029606; Wed, 28 Jan 2009 19:05:18 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200901281905.n0SJ5IT8029606@svn.freebsd.org> From: John Baldwin Date: Wed, 28 Jan 2009 19:05:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187839 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 19:05:19 -0000 Author: jhb Date: Wed Jan 28 19:05:18 2009 New Revision: 187839 URL: http://svn.freebsd.org/changeset/base/187839 Log: Convert the global mutex protecting the directory lookup name cache from a mutex to a reader/writer lock. Lookup operations first grab a read lock and perform the lookup. If the operation results in a need to modify the cache, then it tries to do an upgrade. If that fails, it drops the read lock, obtains a write lock, and redoes the lookup. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Wed Jan 28 18:54:56 2009 (r187838) +++ head/sys/kern/vfs_cache.c Wed Jan 28 19:05:18 2009 (r187839) @@ -42,9 +42,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include +#include #include #include #include @@ -109,11 +109,14 @@ SYSCTL_ULONG(_debug, OID_AUTO, numcachep #endif struct nchstats nchstats; /* cache effectiveness statistics */ -static struct mtx cache_lock; -MTX_SYSINIT(vfscache, &cache_lock, "Name Cache", MTX_DEF); +static struct rwlock cache_lock; +RW_SYSINIT(vfscache, &cache_lock, "Name Cache"); -#define CACHE_LOCK() mtx_lock(&cache_lock) -#define CACHE_UNLOCK() mtx_unlock(&cache_lock) +#define CACHE_UPGRADE_LOCK() rw_try_upgrade(&cache_lock) +#define CACHE_RLOCK() rw_rlock(&cache_lock) +#define CACHE_RUNLOCK() rw_runlock(&cache_lock) +#define CACHE_WLOCK() rw_wlock(&cache_lock) +#define CACHE_WUNLOCK() rw_wunlock(&cache_lock) /* * UMA zones for the VFS cache. @@ -162,6 +165,7 @@ static u_long numposzaps; STATNODE(CTLFL static u_long numposhits; STATNODE(CTLFLAG_RD, numposhits, &numposhits); static u_long numnegzaps; STATNODE(CTLFLAG_RD, numnegzaps, &numnegzaps); static u_long numneghits; STATNODE(CTLFLAG_RD, numneghits, &numneghits); +static u_long numupgrades; STATNODE(CTLFLAG_RD, numupgrades, &numupgrades); SYSCTL_OPAQUE(_vfs_cache, OID_AUTO, nchstats, CTLFLAG_RD | CTLFLAG_MPSAFE, &nchstats, sizeof(nchstats), "LU", "VFS cache effectiveness statistics"); @@ -200,12 +204,12 @@ sysctl_debug_hashstat_rawnchash(SYSCTL_H /* Scan hash tables for applicable entries */ for (ncpp = nchashtbl; n_nchash > 0; n_nchash--, ncpp++) { - CACHE_LOCK(); + CACHE_RLOCK(); count = 0; LIST_FOREACH(ncp, ncpp, nc_hash) { count++; } - CACHE_UNLOCK(); + CACHE_RUNLOCK(); error = SYSCTL_OUT(req, &count, sizeof(count)); if (error) return (error); @@ -235,11 +239,11 @@ sysctl_debug_hashstat_nchash(SYSCTL_HAND /* Scan hash tables for applicable entries */ for (ncpp = nchashtbl; n_nchash > 0; n_nchash--, ncpp++) { count = 0; - CACHE_LOCK(); + CACHE_RLOCK(); LIST_FOREACH(ncp, ncpp, nc_hash) { count++; } - CACHE_UNLOCK(); + CACHE_RUNLOCK(); if (count) used++; if (maxlength < count) @@ -277,7 +281,7 @@ cache_zap(ncp) { struct vnode *vp; - mtx_assert(&cache_lock, MA_OWNED); + rw_assert(&cache_lock, RA_WLOCKED); CTR2(KTR_VFS, "cache_zap(%p) vp %p", ncp, ncp->nc_vp); vp = NULL; LIST_REMOVE(ncp, nc_hash); @@ -324,16 +328,19 @@ cache_lookup(dvp, vpp, cnp) { struct namecache *ncp; u_int32_t hash; - int error, ltype; + int error, ltype, wlocked; if (!doingcache) { cnp->cn_flags &= ~MAKEENTRY; return (0); } retry: - CACHE_LOCK(); + CACHE_RLOCK(); + wlocked = 0; numcalls++; + error = 0; +retry_wlocked: if (cnp->cn_nameptr[0] == '.') { if (cnp->cn_namelen == 1) { *vpp = dvp; @@ -346,8 +353,7 @@ retry: dotdothits++; if (dvp->v_dd == NULL || (cnp->cn_flags & MAKEENTRY) == 0) { - CACHE_UNLOCK(); - return (0); + goto unlock; } *vpp = dvp->v_dd; CTR3(KTR_VFS, "cache_lookup(%p, %s) found %p via ..", @@ -366,23 +372,24 @@ retry: } /* We failed to find an entry */ - if (ncp == 0) { + if (ncp == NULL) { if ((cnp->cn_flags & MAKEENTRY) == 0) { nummisszap++; } else { nummiss++; } nchstats.ncs_miss++; - CACHE_UNLOCK(); - return (0); + goto unlock; } /* We don't want to have an entry, so dump it */ if ((cnp->cn_flags & MAKEENTRY) == 0) { numposzaps++; nchstats.ncs_badhits++; + if (!wlocked && !CACHE_UPGRADE_LOCK()) + goto wlock; cache_zap(ncp); - CACHE_UNLOCK(); + CACHE_WUNLOCK(); return (0); } @@ -400,11 +407,15 @@ retry: if (cnp->cn_nameiop == CREATE) { numnegzaps++; nchstats.ncs_badhits++; + if (!wlocked && !CACHE_UPGRADE_LOCK()) + goto wlock; cache_zap(ncp); - CACHE_UNLOCK(); + CACHE_WUNLOCK(); return (0); } + if (!wlocked && !CACHE_UPGRADE_LOCK()) + goto wlock; numneghits++; /* * We found a "negative" match, so we shift it to the end of @@ -417,9 +428,20 @@ retry: nchstats.ncs_neghits++; if (ncp->nc_flag & NCF_WHITE) cnp->cn_flags |= ISWHITEOUT; - CACHE_UNLOCK(); + CACHE_WUNLOCK(); return (ENOENT); +wlock: + /* + * We need to update the cache after our lookup, so upgrade to + * a write lock and retry the operation. + */ + CACHE_RUNLOCK(); + CACHE_WLOCK(); + numupgrades++; + wlocked = 1; + goto retry_wlocked; + success: /* * On success we return a locked and ref'd vnode as per the lookup @@ -427,7 +449,10 @@ success: */ if (dvp == *vpp) { /* lookup on "." */ VREF(*vpp); - CACHE_UNLOCK(); + if (wlocked) + CACHE_WUNLOCK(); + else + CACHE_RUNLOCK(); /* * When we lookup "." we still can be asked to lock it * differently... @@ -453,7 +478,10 @@ success: VOP_UNLOCK(dvp, 0); } VI_LOCK(*vpp); - CACHE_UNLOCK(); + if (wlocked) + CACHE_WUNLOCK(); + else + CACHE_RUNLOCK(); error = vget(*vpp, cnp->cn_lkflags | LK_INTERLOCK, cnp->cn_thread); if (cnp->cn_flags & ISDOTDOT) vn_lock(dvp, ltype | LK_RETRY); @@ -466,6 +494,13 @@ success: ASSERT_VOP_ELOCKED(*vpp, "cache_lookup"); } return (-1); + +unlock: + if (wlocked) + CACHE_WUNLOCK(); + else + CACHE_RUNLOCK(); + return (0); } /* @@ -509,10 +544,10 @@ cache_enter(dvp, vp, cnp) * cache_purge() time. */ if (cnp->cn_namelen == 2 && cnp->cn_nameptr[1] == '.') { - CACHE_LOCK(); + CACHE_WLOCK(); if (!TAILQ_EMPTY(&dvp->v_cache_dst)) dvp->v_dd = vp; - CACHE_UNLOCK(); + CACHE_WUNLOCK(); return; } } @@ -531,7 +566,7 @@ cache_enter(dvp, vp, cnp) hash = fnv_32_buf(cnp->cn_nameptr, len, FNV1_32_INIT); bcopy(cnp->cn_nameptr, ncp->nc_name, len); hash = fnv_32_buf(&dvp, sizeof(dvp), hash); - CACHE_LOCK(); + CACHE_WLOCK(); /* * See if this vnode or negative entry is already in the cache @@ -543,7 +578,7 @@ cache_enter(dvp, vp, cnp) if (n2->nc_dvp == dvp && n2->nc_nlen == cnp->cn_namelen && !bcmp(n2->nc_name, cnp->cn_nameptr, n2->nc_nlen)) { - CACHE_UNLOCK(); + CACHE_WUNLOCK(); cache_free(ncp); return; } @@ -587,7 +622,7 @@ cache_enter(dvp, vp, cnp) vhold(dvp); if (zap) cache_zap(ncp); - CACHE_UNLOCK(); + CACHE_WUNLOCK(); } /* @@ -618,13 +653,13 @@ cache_purge(vp) { CTR1(KTR_VFS, "cache_purge(%p)", vp); - CACHE_LOCK(); + CACHE_WLOCK(); while (!LIST_EMPTY(&vp->v_cache_src)) cache_zap(LIST_FIRST(&vp->v_cache_src)); while (!TAILQ_EMPTY(&vp->v_cache_dst)) cache_zap(TAILQ_FIRST(&vp->v_cache_dst)); vp->v_dd = NULL; - CACHE_UNLOCK(); + CACHE_WUNLOCK(); } /* @@ -638,14 +673,14 @@ cache_purgevfs(mp) struct namecache *ncp, *nnp; /* Scan hash tables for applicable entries */ - CACHE_LOCK(); + CACHE_WLOCK(); for (ncpp = &nchashtbl[nchash]; ncpp >= nchashtbl; ncpp--) { LIST_FOREACH_SAFE(ncp, ncpp, nc_hash, nnp) { if (ncp->nc_dvp->v_mount == mp) cache_zap(ncp); } } - CACHE_UNLOCK(); + CACHE_WUNLOCK(); } /* @@ -845,7 +880,7 @@ vn_vptocnp(struct vnode **vp, char **bp, int error, vfslocked; vhold(*vp); - CACHE_UNLOCK(); + CACHE_RUNLOCK(); vfslocked = VFS_LOCK_GIANT((*vp)->v_mount); vn_lock(*vp, LK_SHARED | LK_RETRY); error = VOP_VPTOCNP(*vp, &dvp, buf, buflen); @@ -858,10 +893,10 @@ vn_vptocnp(struct vnode **vp, char **bp, } *bp = buf + *buflen; *vp = dvp; - CACHE_LOCK(); + CACHE_RLOCK(); if ((*vp)->v_iflag & VI_DOOMED) { /* forced unmount */ - CACHE_UNLOCK(); + CACHE_RUNLOCK(); vdrop(*vp); return (ENOENT); } @@ -887,7 +922,7 @@ vn_fullpath1(struct thread *td, struct v error = 0; slash_prefixed = 0; - CACHE_LOCK(); + CACHE_RLOCK(); numfullpathcalls++; if (vp->v_type != VDIR) { ncp = TAILQ_FIRST(&vp->v_cache_dst); @@ -896,7 +931,7 @@ vn_fullpath1(struct thread *td, struct v *--bp = ncp->nc_name[i]; if (bp == buf) { numfullpathfail4++; - CACHE_UNLOCK(); + CACHE_RUNLOCK(); return (ENOMEM); } vp = ncp->nc_dvp; @@ -910,7 +945,7 @@ vn_fullpath1(struct thread *td, struct v buflen--; if (buflen < 0) { numfullpathfail4++; - CACHE_UNLOCK(); + CACHE_RUNLOCK(); return (ENOMEM); } slash_prefixed = 1; @@ -918,7 +953,7 @@ vn_fullpath1(struct thread *td, struct v while (vp != rdir && vp != rootvnode) { if (vp->v_vflag & VV_ROOT) { if (vp->v_iflag & VI_DOOMED) { /* forced unmount */ - CACHE_UNLOCK(); + CACHE_RUNLOCK(); error = EBADF; break; } @@ -927,7 +962,7 @@ vn_fullpath1(struct thread *td, struct v } if (vp->v_type != VDIR) { numfullpathfail1++; - CACHE_UNLOCK(); + CACHE_RUNLOCK(); error = ENOTDIR; break; } @@ -939,7 +974,7 @@ vn_fullpath1(struct thread *td, struct v *--bp = ncp->nc_name[i]; if (bp == buf) { numfullpathfail4++; - CACHE_UNLOCK(); + CACHE_RUNLOCK(); error = ENOMEM; break; } @@ -954,7 +989,7 @@ vn_fullpath1(struct thread *td, struct v buflen--; if (buflen < 0) { numfullpathfail4++; - CACHE_UNLOCK(); + CACHE_RUNLOCK(); error = ENOMEM; break; } @@ -965,14 +1000,14 @@ vn_fullpath1(struct thread *td, struct v if (!slash_prefixed) { if (bp == buf) { numfullpathfail4++; - CACHE_UNLOCK(); + CACHE_RUNLOCK(); return (ENOMEM); } else { *--bp = '/'; } } numfullpathfound++; - CACHE_UNLOCK(); + CACHE_RUNLOCK(); *retbuf = bp; return (0); @@ -984,15 +1019,15 @@ vn_commname(struct vnode *vp, char *buf, struct namecache *ncp; int l; - CACHE_LOCK(); + CACHE_RLOCK(); ncp = TAILQ_FIRST(&vp->v_cache_dst); if (!ncp) { - CACHE_UNLOCK(); + CACHE_RUNLOCK(); return (ENOENT); } l = min(ncp->nc_nlen, buflen - 1); memcpy(buf, ncp->nc_name, l); - CACHE_UNLOCK(); + CACHE_RUNLOCK(); buf[l] = '\0'; return (0); } From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 19:09:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7B121065672; Wed, 28 Jan 2009 19:09:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D62938FC20; Wed, 28 Jan 2009 19:09:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SJ9ncP029761; Wed, 28 Jan 2009 19:09:49 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SJ9nog029760; Wed, 28 Jan 2009 19:09:49 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200901281909.n0SJ9nog029760@svn.freebsd.org> From: Warner Losh Date: Wed, 28 Jan 2009 19:09:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187840 - head/sys/fs/cd9660 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 19:09:50 -0000 Author: imp Date: Wed Jan 28 19:09:49 2009 New Revision: 187840 URL: http://svn.freebsd.org/changeset/base/187840 Log: Use the correct field name for the size of the sierra_id. While this is the same size as id, and is unlikely to change, it seems better to use the correct field here. There's no difference in the generated code. Modified: head/sys/fs/cd9660/cd9660_vfsops.c Modified: head/sys/fs/cd9660/cd9660_vfsops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vfsops.c Wed Jan 28 19:05:18 2009 (r187839) +++ head/sys/fs/cd9660/cd9660_vfsops.c Wed Jan 28 19:09:49 2009 (r187840) @@ -264,7 +264,7 @@ iso_mountfs(devvp, mp) vdp = (struct iso_volume_descriptor *)bp->b_data; if (bcmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) != 0) { if (bcmp (vdp->id_sierra, ISO_SIERRA_ID, - sizeof vdp->id) != 0) { + sizeof vdp->id_sierra) != 0) { error = EINVAL; goto out; } else From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 19:15:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78A77106564A; Wed, 28 Jan 2009 19:15:53 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 677F78FC1C; Wed, 28 Jan 2009 19:15:53 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SJFrbO029932; Wed, 28 Jan 2009 19:15:53 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SJFrG5029931; Wed, 28 Jan 2009 19:15:53 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901281915.n0SJFrG5029931@svn.freebsd.org> From: Sam Leffler Date: Wed, 28 Jan 2009 19:15:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187841 - head/sbin/ifconfig X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 19:15:54 -0000 Author: sam Date: Wed Jan 28 19:15:52 2009 New Revision: 187841 URL: http://svn.freebsd.org/changeset/base/187841 Log: Fix 1/2 and 1/4 width channel handling: o only include 1/2 and 1/4 width channels when they are specified in the regulatory database description; previously we treated them as if they were part of the band and blindly added them for 11a/g o check the channel list returned in the devcaps to identify whether a device supports 1/2 or 1/4 width channels on a band; this might be better brought out as a capability bit to avoid filling the channel list w/ 1/2 and 1/4 width channels but then cards that only support these channels in a range of frequencies could not be described (though right now we don't check frequency range only band) Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Wed Jan 28 19:09:49 2009 (r187840) +++ head/sbin/ifconfig/ifieee80211.c Wed Jan 28 19:15:52 2009 (r187841) @@ -1789,6 +1789,19 @@ chanlookup(const struct ieee80211_channe return NULL; } +static int +chanfind(const struct ieee80211_channel chans[], int nchans, int flags) +{ + int i; + + for (i = 0; i < nchans; i++) { + const struct ieee80211_channel *c = &chans[i]; + if ((c->ic_flags & flags) == flags) + return 1; + } + return 0; +} + static void regdomain_addchans(struct ieee80211req_chaninfo *ci, const netband_head *bands, @@ -1799,9 +1812,15 @@ regdomain_addchans(struct ieee80211req_c const struct netband *nb; const struct freqband *b; struct ieee80211_channel *c, *prev; - int freq, channelSep; + int freq, channelSep, hasHalfChans, hasQuarterChans; channelSep = (chanFlags & IEEE80211_CHAN_2GHZ) ? 0 : 40; + hasHalfChans = chanfind(avail->ic_chans, avail->ic_nchans, + IEEE80211_CHAN_HALF | + (chanFlags & (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ))); + hasQuarterChans = chanfind(avail->ic_chans, avail->ic_nchans, + IEEE80211_CHAN_QUARTER | + (chanFlags & (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ))); LIST_FOREACH(nb, bands, next) { b = nb->band; if (verbose) @@ -1812,28 +1831,31 @@ regdomain_addchans(struct ieee80211req_c uint32_t flags = nb->flags | b->flags; /* check if device can operate on this frequency */ - if (chanlookup(avail->ic_chans, avail->ic_nchans, freq, chanFlags) == NULL) { + /* + * XXX GSM frequency mapping is handled in the kernel + * so we cannot find them in the calibration table; + * just construct the list and the kernel will reject + * if it's wrong. + */ + if (chanlookup(avail->ic_chans, avail->ic_nchans, freq, chanFlags) == NULL && + (flags & IEEE80211_CHAN_GSM) == 0) { if (verbose) printf("%u: skip, flags 0x%x not available\n", freq, chanFlags); continue; } - /* - * NB: don't enforce 1/2 and 1/4 rate channels being - * specified in the device's calibration list for - * 900MHz cards because most are not self-identifying. - */ - if ((flags & IEEE80211_CHAN_HALF) && - ((chanFlags & IEEE80211_CHAN_HALF) == 0 && - (flags & IEEE80211_CHAN_GSM) == 0)) { + if ((flags & IEEE80211_CHAN_HALF) && !hasHalfChans) { if (verbose) - printf("%u: skip, device does not support half-rate channels\n", freq); + printf("%u: skip, device does not " + "support half-rate channel\n", + freq); continue; } if ((flags & IEEE80211_CHAN_QUARTER) && - ((chanFlags & IEEE80211_CHAN_QUARTER) == 0 && - (flags & IEEE80211_CHAN_GSM) == 0)) { + !hasQuarterChans) { if (verbose) - printf("%u: skip, device does not support quarter-rate channels\n", freq); + printf("%u: skip, device does not " + "support quarter-rate channel\n", + freq); continue; } if ((flags & IEEE80211_CHAN_HT20) && @@ -1932,26 +1954,12 @@ regdomain_makechannels( if (!LIST_EMPTY(&rd->bands_11b)) regdomain_addchans(ci, &rd->bands_11b, reg, IEEE80211_CHAN_B, &dc->dc_chaninfo); - if (!LIST_EMPTY(&rd->bands_11g)) { + if (!LIST_EMPTY(&rd->bands_11g)) regdomain_addchans(ci, &rd->bands_11g, reg, IEEE80211_CHAN_G, &dc->dc_chaninfo); - regdomain_addchans(ci, &rd->bands_11g, reg, - IEEE80211_CHAN_G | IEEE80211_CHAN_HALF, - &dc->dc_chaninfo); - regdomain_addchans(ci, &rd->bands_11g, reg, - IEEE80211_CHAN_G | IEEE80211_CHAN_QUARTER, - &dc->dc_chaninfo); - } - if (!LIST_EMPTY(&rd->bands_11a)) { + if (!LIST_EMPTY(&rd->bands_11a)) regdomain_addchans(ci, &rd->bands_11a, reg, IEEE80211_CHAN_A, &dc->dc_chaninfo); - regdomain_addchans(ci, &rd->bands_11a, reg, - IEEE80211_CHAN_A | IEEE80211_CHAN_HALF, - &dc->dc_chaninfo); - regdomain_addchans(ci, &rd->bands_11a, reg, - IEEE80211_CHAN_A | IEEE80211_CHAN_QUARTER, - &dc->dc_chaninfo); - } if (!LIST_EMPTY(&rd->bands_11na)) { regdomain_addchans(ci, &rd->bands_11na, reg, IEEE80211_CHAN_A | IEEE80211_CHAN_HT20, From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 19:18:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D018B1065673; Wed, 28 Jan 2009 19:18:58 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B3C838FC08; Wed, 28 Jan 2009 19:18:58 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SJIwmx030019; Wed, 28 Jan 2009 19:18:58 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SJIwRc030018; Wed, 28 Jan 2009 19:18:58 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901281918.n0SJIwRc030018@svn.freebsd.org> From: Sam Leffler Date: Wed, 28 Jan 2009 19:18:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187842 - head/sbin/ifconfig X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 19:18:59 -0000 Author: sam Date: Wed Jan 28 19:18:58 2009 New Revision: 187842 URL: http://svn.freebsd.org/changeset/base/187842 Log: improve debug msgs for regdomain operations; print channel flags symbolically so it's easier to identify channels and why they are added (or not) Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Wed Jan 28 19:15:52 2009 (r187841) +++ head/sbin/ifconfig/ifieee80211.c Wed Jan 28 19:18:58 2009 (r187842) @@ -1823,9 +1823,13 @@ regdomain_addchans(struct ieee80211req_c (chanFlags & (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ))); LIST_FOREACH(nb, bands, next) { b = nb->band; - if (verbose) - printf("%s: chanFlags 0x%x b %p\n", - __func__, chanFlags, b); + if (verbose) { + printf("%s:", __func__); + printb(" chanFlags", chanFlags, IEEE80211_CHAN_BITS); + printb(" bandFlags", nb->flags | b->flags, + IEEE80211_CHAN_BITS); + putchar('\n'); + } prev = NULL; for (freq = b->freqStart; freq <= b->freqEnd; freq += b->chanSep) { uint32_t flags = nb->flags | b->flags; @@ -1839,8 +1843,12 @@ regdomain_addchans(struct ieee80211req_c */ if (chanlookup(avail->ic_chans, avail->ic_nchans, freq, chanFlags) == NULL && (flags & IEEE80211_CHAN_GSM) == 0) { - if (verbose) - printf("%u: skip, flags 0x%x not available\n", freq, chanFlags); + if (verbose) { + printf("%u: skip, ", freq); + printb("flags", chanFlags, + IEEE80211_CHAN_BITS); + printf(" not available\n"); + } continue; } if ((flags & IEEE80211_CHAN_HALF) && !hasHalfChans) { @@ -1861,13 +1869,15 @@ regdomain_addchans(struct ieee80211req_c if ((flags & IEEE80211_CHAN_HT20) && (chanFlags & IEEE80211_CHAN_HT20) == 0) { if (verbose) - printf("%u: skip, device does not support HT20 operation\n", freq); + printf("%u: skip, device does not " + "support HT20 operation\n", freq); continue; } if ((flags & IEEE80211_CHAN_HT40) && (chanFlags & IEEE80211_CHAN_HT40) == 0) { if (verbose) - printf("%u: skip, device does not support HT40 operation\n", freq); + printf("%u: skip, device does not " + "support HT40 operation\n", freq); continue; } if ((flags & REQ_ECM) && !reg->ecm) { @@ -1890,7 +1900,8 @@ regdomain_addchans(struct ieee80211req_c } if (ci->ic_nchans == IEEE80211_CHAN_MAX) { if (verbose) - printf("%u: skip, channel table full\n", freq); + printf("%u: skip, channel table full\n", + freq); break; } c = &ci->ic_chans[ci->ic_nchans++]; @@ -1902,10 +1913,12 @@ regdomain_addchans(struct ieee80211req_c c->ic_maxregpower = nb->maxPowerDFS; else c->ic_maxregpower = nb->maxPower; - if (verbose) - printf("[%3d] add freq %u flags 0x%x power %u\n", - ci->ic_nchans-1, c->ic_freq, c->ic_flags, - c->ic_maxregpower); + if (verbose) { + printf("[%3d] add freq %u ", + ci->ic_nchans-1, c->ic_freq); + printb("flags", c->ic_flags, IEEE80211_CHAN_BITS); + printf(" power %u\n", c->ic_maxregpower); + } /* NB: kernel fills in other fields */ prev = c; } From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 19:20:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E77C21065695; Wed, 28 Jan 2009 19:20:12 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5EDC8FC1D; Wed, 28 Jan 2009 19:20:12 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SJKCfP030086; Wed, 28 Jan 2009 19:20:12 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SJKCbX030085; Wed, 28 Jan 2009 19:20:12 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901281920.n0SJKCbX030085@svn.freebsd.org> From: Sam Leffler Date: Wed, 28 Jan 2009 19:20:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187843 - head/sbin/ifconfig X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 19:20:14 -0000 Author: sam Date: Wed Jan 28 19:20:12 2009 New Revision: 187843 URL: http://svn.freebsd.org/changeset/base/187843 Log: simplify display of 1/2 and 1/4 width channels Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Wed Jan 28 19:18:58 2009 (r187842) +++ head/sbin/ifconfig/ifieee80211.c Wed Jan 28 19:20:12 2009 (r187843) @@ -3119,23 +3119,16 @@ get_chaninfo(const struct ieee80211_chan buf[0] = '\0'; if (IEEE80211_IS_CHAN_FHSS(c)) strlcat(buf, " FHSS", bsize); - if (IEEE80211_IS_CHAN_A(c)) { - if (IEEE80211_IS_CHAN_HALF(c)) - strlcat(buf, " 11a/10Mhz", bsize); - else if (IEEE80211_IS_CHAN_QUARTER(c)) - strlcat(buf, " 11a/5Mhz", bsize); - else - strlcat(buf, " 11a", bsize); - } - if (IEEE80211_IS_CHAN_ANYG(c)) { - if (IEEE80211_IS_CHAN_HALF(c)) - strlcat(buf, " 11g/10Mhz", bsize); - else if (IEEE80211_IS_CHAN_QUARTER(c)) - strlcat(buf, " 11g/5Mhz", bsize); - else - strlcat(buf, " 11g", bsize); - } else if (IEEE80211_IS_CHAN_B(c)) + if (IEEE80211_IS_CHAN_A(c)) + strlcat(buf, " 11a", bsize); + else if (IEEE80211_IS_CHAN_ANYG(c)) + strlcat(buf, " 11g", bsize); + else if (IEEE80211_IS_CHAN_B(c)) strlcat(buf, " 11b", bsize); + if (IEEE80211_IS_CHAN_HALF(c)) + strlcat(buf, "/10Mhz", bsize); + if (IEEE80211_IS_CHAN_QUARTER(c)) + strlcat(buf, "/5Mhz", bsize); if (IEEE80211_IS_CHAN_TURBO(c)) strlcat(buf, " Turbo", bsize); if (precise) { From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 19:23:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9245F10656EA; Wed, 28 Jan 2009 19:23:12 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 807128FC2A; Wed, 28 Jan 2009 19:23:12 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SJNCsw030186; Wed, 28 Jan 2009 19:23:12 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SJNCWh030185; Wed, 28 Jan 2009 19:23:12 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901281923.n0SJNCWh030185@svn.freebsd.org> From: Sam Leffler Date: Wed, 28 Jan 2009 19:23:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187844 - head/sbin/ifconfig X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 19:23:13 -0000 Author: sam Date: Wed Jan 28 19:23:12 2009 New Revision: 187844 URL: http://svn.freebsd.org/changeset/base/187844 Log: pritize the channel we display with list chans so that, among other things, 1/2 and 1/4 width channels are hidden behind the full width channel; this is needed because they are ordered such that they appear after in the channel table Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Wed Jan 28 19:20:12 2009 (r187843) +++ head/sbin/ifconfig/ifieee80211.c Wed Jan 28 19:23:12 2009 (r187844) @@ -3156,6 +3156,30 @@ print_chaninfo(const struct ieee80211_ch get_chaninfo(c, verb, buf, sizeof(buf))); } +static int +chanpref(const struct ieee80211_channel *c) +{ + if (IEEE80211_IS_CHAN_HT40(c)) + return 40; + if (IEEE80211_IS_CHAN_HT20(c)) + return 30; + if (IEEE80211_IS_CHAN_HALF(c)) + return 10; + if (IEEE80211_IS_CHAN_QUARTER(c)) + return 5; + if (IEEE80211_IS_CHAN_TURBO(c)) + return 25; + if (IEEE80211_IS_CHAN_A(c)) + return 20; + if (IEEE80211_IS_CHAN_G(c)) + return 20; + if (IEEE80211_IS_CHAN_B(c)) + return 15; + if (IEEE80211_IS_CHAN_PUREG(c)) + return 15; + return 0; +} + static void print_channels(int s, const struct ieee80211req_chaninfo *chans, int allchans, int verb) @@ -3199,7 +3223,10 @@ print_channels(int s, const struct ieee8 /* suppress duplicates as above */ if (isset(reported, c->ic_ieee) && !verb) { /* XXX we assume duplicates are adjacent */ - achans->ic_chans[achans->ic_nchans-1] = *c; + struct ieee80211_channel *a = + &achans->ic_chans[achans->ic_nchans-1]; + if (chanpref(c) > chanpref(a)) + *a = *c; } else { achans->ic_chans[achans->ic_nchans++] = *c; setbit(reported, c->ic_ieee); From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 19:24:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7524810656E2; Wed, 28 Jan 2009 19:24:29 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62C5B8FC1F; Wed, 28 Jan 2009 19:24:29 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SJOT9U030252; Wed, 28 Jan 2009 19:24:29 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SJOTTE030251; Wed, 28 Jan 2009 19:24:29 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901281924.n0SJOTTE030251@svn.freebsd.org> From: Sam Leffler Date: Wed, 28 Jan 2009 19:24:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187845 - head/sbin/ifconfig X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 19:24:31 -0000 Author: sam Date: Wed Jan 28 19:24:29 2009 New Revision: 187845 URL: http://svn.freebsd.org/changeset/base/187845 Log: include the channel list in list caps when -v is set; ieee channel #'s are not available and we have to hack around the mapchan routine but it lets us see the calibration table w/o forcing the debug regdomain Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Wed Jan 28 19:23:12 2009 (r187844) +++ head/sbin/ifconfig/ifieee80211.c Wed Jan 28 19:24:29 2009 (r187845) @@ -3342,10 +3342,13 @@ list_capabilities(int s) { struct ieee80211_devcaps_req *dc; - dc = malloc(IEEE80211_DEVCAPS_SIZE(1)); + if (verbose) + dc = malloc(IEEE80211_DEVCAPS_SIZE(MAXCHAN)); + else + dc = malloc(IEEE80211_DEVCAPS_SIZE(1)); if (dc == NULL) errx(1, "no space for device capabilities"); - dc->dc_chaninfo.ic_nchans = 1; + dc->dc_chaninfo.ic_nchans = verbose ? MAXCHAN : 1; getdevcaps(s, dc); printb("drivercaps", dc->dc_drivercaps, IEEE80211_C_BITS); if (dc->dc_cryptocaps != 0 || verbose) { @@ -3357,6 +3360,10 @@ list_capabilities(int s) printb("htcaps", dc->dc_htcaps, IEEE80211_HTCAP_BITS); } putchar('\n'); + if (verbose) { + chaninfo = &dc->dc_chaninfo; /* XXX */ + print_channels(s, &dc->dc_chaninfo, 1/*allchans*/, verbose); + } free(dc); } From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 19:25:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD80710656F5; Wed, 28 Jan 2009 19:25:51 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB81E8FC17; Wed, 28 Jan 2009 19:25:51 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SJPplh030317; Wed, 28 Jan 2009 19:25:51 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SJPpXk030316; Wed, 28 Jan 2009 19:25:51 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901281925.n0SJPpXk030316@svn.freebsd.org> From: Sam Leffler Date: Wed, 28 Jan 2009 19:25:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187846 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 19:25:53 -0000 Author: sam Date: Wed Jan 28 19:25:51 2009 New Revision: 187846 URL: http://svn.freebsd.org/changeset/base/187846 Log: Remove gsm hacks now that we can do this "right": o no need for special country codes; it's sufficient to use the sku o no need to specify bands w/ 2.4G frequencies, use the real values o remove duplicate band specs Modified: head/etc/regdomain.xml Modified: head/etc/regdomain.xml ============================================================================== --- head/etc/regdomain.xml Wed Jan 28 19:24:29 2009 (r187845) +++ head/etc/regdomain.xml Wed Jan 28 19:25:51 2009 (r187846) @@ -1133,7 +1133,6 @@ SR9 0x0298 - @@ -1156,20 +1155,19 @@ XR9 0x299 - - + 30 IEEE80211_CHAN_G - + 30 IEEE80211_CHAN_G - + 30 IEEE80211_CHAN_G @@ -1179,7 +1177,6 @@ GZ901 0x29a - @@ -1319,9 +1316,6 @@ 320 Guatemala - - 5002 ZComax GZ-901 - 340 Honduras @@ -1517,12 +1511,6 @@ 792 Turkey - - 5000 Ubiquiti SR9 - - - 5001 Ubiquiti XR9 - 804 Ukraine @@ -1725,55 +1713,37 @@ - 2422 2437 + 907 922 5 5 IEEE80211_CHAN_GSM IEEE80211_CHAN_QUARTER - 2422 2437 + 907 922 10 5 IEEE80211_CHAN_GSM IEEE80211_CHAN_HALF - 2427 2432 - 20 5 - IEEE80211_CHAN_GSM - - - - 2427 2442 - 5 5 - IEEE80211_CHAN_GSM - IEEE80211_CHAN_QUARTER - - - 2427 2442 - 10 5 - IEEE80211_CHAN_GSM - IEEE80211_CHAN_HALF - - - 2432 2437 + 912 917 20 5 IEEE80211_CHAN_GSM - 2447 2467 + 908 923 5 5 IEEE80211_CHAN_GSM IEEE80211_CHAN_QUARTER - 2457 2462 + 913 918 10 5 IEEE80211_CHAN_GSM IEEE80211_CHAN_HALF - 2457 2462 + 913 918 20 5 IEEE80211_CHAN_GSM From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 19:58:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C7D71065737; Wed, 28 Jan 2009 19:58:06 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29C748FC1D; Wed, 28 Jan 2009 19:58:06 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SJw6Xi031895; Wed, 28 Jan 2009 19:58:06 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SJw5i5031891; Wed, 28 Jan 2009 19:58:05 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200901281958.n0SJw5i5031891@svn.freebsd.org> From: Ed Schouten Date: Wed, 28 Jan 2009 19:58:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187864 - in head/sys: fs/devfs kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 19:58:07 -0000 Author: ed Date: Wed Jan 28 19:58:05 2009 New Revision: 187864 URL: http://svn.freebsd.org/changeset/base/187864 Log: Mark most often used sysctl's as MPSAFE. After running a `make buildkernel', I noticed most of the Giant locks in sysctl are only caused by a very small amount of sysctl's: - sysctl.name2oid. This one is locked by SYSCTL_LOCK, just like sysctl.oidfmt. - kern.ident, kern.osrelease, kern.version, etc. These are just constant strings. - kern.arandom, used by the stack protector. It is already protected by arc4_mtx. I also saw the following sysctl's show up. Not as often as the ones above, but still quite often: - security.jail.jailed. Also mark security.jail.list as MPSAFE. They don't need locking or already use allprison_lock. - kern.devname, used by devname(3), ttyname(3), etc. This seems to reduce Giant locking inside sysctl by ~75% in my primitive test setup. Modified: head/sys/fs/devfs/devfs_devs.c head/sys/kern/kern_jail.c head/sys/kern/kern_mib.c head/sys/kern/kern_sysctl.c Modified: head/sys/fs/devfs/devfs_devs.c ============================================================================== --- head/sys/fs/devfs/devfs_devs.c Wed Jan 28 19:55:33 2009 (r187863) +++ head/sys/fs/devfs/devfs_devs.c Wed Jan 28 19:58:05 2009 (r187864) @@ -103,8 +103,9 @@ sysctl_devname(SYSCTL_HANDLER_ARGS) return (error); } -SYSCTL_PROC(_kern, OID_AUTO, devname, CTLTYPE_OPAQUE|CTLFLAG_RW|CTLFLAG_ANYBODY, - NULL, 0, sysctl_devname, "", "devname(3) handler"); +SYSCTL_PROC(_kern, OID_AUTO, devname, + CTLTYPE_OPAQUE|CTLFLAG_RW|CTLFLAG_ANYBODY|CTLFLAG_MPSAFE, + NULL, 0, sysctl_devname, "", "devname(3) handler"); SYSCTL_INT(_debug_sizeof, OID_AUTO, cdev, CTLFLAG_RD, 0, sizeof(struct cdev), "sizeof(struct cdev)"); Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Wed Jan 28 19:55:33 2009 (r187863) +++ head/sys/kern/kern_jail.c Wed Jan 28 19:58:05 2009 (r187864) @@ -1529,8 +1529,9 @@ sysctl_jail_list(SYSCTL_HANDLER_ARGS) return (error); } -SYSCTL_OID(_security_jail, OID_AUTO, list, CTLTYPE_STRUCT | CTLFLAG_RD, - NULL, 0, sysctl_jail_list, "S", "List of active jails"); +SYSCTL_OID(_security_jail, OID_AUTO, list, + CTLTYPE_STRUCT | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, + sysctl_jail_list, "S", "List of active jails"); static int sysctl_jail_jailed(SYSCTL_HANDLER_ARGS) @@ -1542,8 +1543,9 @@ sysctl_jail_jailed(SYSCTL_HANDLER_ARGS) return (error); } -SYSCTL_PROC(_security_jail, OID_AUTO, jailed, CTLTYPE_INT | CTLFLAG_RD, - NULL, 0, sysctl_jail_jailed, "I", "Process in jail?"); +SYSCTL_PROC(_security_jail, OID_AUTO, jailed, + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, + sysctl_jail_jailed, "I", "Process in jail?"); #ifdef DDB DB_SHOW_COMMAND(jails, db_show_jails) Modified: head/sys/kern/kern_mib.c ============================================================================== --- head/sys/kern/kern_mib.c Wed Jan 28 19:55:33 2009 (r187863) +++ head/sys/kern/kern_mib.c Wed Jan 28 19:58:05 2009 (r187864) @@ -87,19 +87,19 @@ SYSCTL_NODE(, OID_AUTO, regression, CTLF "Regression test MIB"); #endif -SYSCTL_STRING(_kern, OID_AUTO, ident, CTLFLAG_RD, +SYSCTL_STRING(_kern, OID_AUTO, ident, CTLFLAG_RD|CTLFLAG_MPSAFE, kern_ident, 0, "Kernel identifier"); -SYSCTL_STRING(_kern, KERN_OSRELEASE, osrelease, CTLFLAG_RD, +SYSCTL_STRING(_kern, KERN_OSRELEASE, osrelease, CTLFLAG_RD|CTLFLAG_MPSAFE, osrelease, 0, "Operating system release"); SYSCTL_INT(_kern, KERN_OSREV, osrevision, CTLFLAG_RD, 0, BSD, "Operating system revision"); -SYSCTL_STRING(_kern, KERN_VERSION, version, CTLFLAG_RD, +SYSCTL_STRING(_kern, KERN_VERSION, version, CTLFLAG_RD|CTLFLAG_MPSAFE, version, 0, "Kernel version"); -SYSCTL_STRING(_kern, KERN_OSTYPE, ostype, CTLFLAG_RD, +SYSCTL_STRING(_kern, KERN_OSTYPE, ostype, CTLFLAG_RD|CTLFLAG_MPSAFE, ostype, 0, "Operating system type"); /* @@ -165,8 +165,9 @@ sysctl_kern_arnd(SYSCTL_HANDLER_ARGS) return (SYSCTL_OUT(req, buf, len)); } -SYSCTL_PROC(_kern, KERN_ARND, arandom, CTLTYPE_OPAQUE | CTLFLAG_RD, - NULL, 0, sysctl_kern_arnd, "", "arc4rand"); +SYSCTL_PROC(_kern, KERN_ARND, arandom, + CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, + sysctl_kern_arnd, "", "arc4rand"); static int sysctl_hw_physmem(SYSCTL_HANDLER_ARGS) @@ -267,7 +268,7 @@ sysctl_hostname(SYSCTL_HANDLER_ARGS) } SYSCTL_PROC(_kern, KERN_HOSTNAME, hostname, - CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_PRISON, + CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_PRISON|CTLFLAG_MPSAFE, 0, 0, sysctl_hostname, "A", "Hostname"); static int regression_securelevel_nonmonotonic = 0; Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Wed Jan 28 19:55:33 2009 (r187863) +++ head/sys/kern/kern_sysctl.c Wed Jan 28 19:58:05 2009 (r187864) @@ -773,8 +773,8 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_AR return (error); } -SYSCTL_PROC(_sysctl, 3, name2oid, CTLFLAG_RW|CTLFLAG_ANYBODY, 0, 0, - sysctl_sysctl_name2oid, "I", ""); +SYSCTL_PROC(_sysctl, 3, name2oid, CTLFLAG_RW|CTLFLAG_ANYBODY|CTLFLAG_MPSAFE, + 0, 0, sysctl_sysctl_name2oid, "I", ""); static int sysctl_sysctl_oidfmt(SYSCTL_HANDLER_ARGS) @@ -796,7 +796,8 @@ sysctl_sysctl_oidfmt(SYSCTL_HANDLER_ARGS } -static SYSCTL_NODE(_sysctl, 4, oidfmt, CTLFLAG_RD, sysctl_sysctl_oidfmt, ""); +static SYSCTL_NODE(_sysctl, 4, oidfmt, CTLFLAG_RD|CTLFLAG_MPSAFE, + sysctl_sysctl_oidfmt, ""); static int sysctl_sysctl_oiddescr(SYSCTL_HANDLER_ARGS) From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 20:04:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F0FE1065676; Wed, 28 Jan 2009 20:04:39 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D9D88FC13; Wed, 28 Jan 2009 20:04:39 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SK4drN032060; Wed, 28 Jan 2009 20:04:39 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SK4din032059; Wed, 28 Jan 2009 20:04:39 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200901282004.n0SK4din032059@svn.freebsd.org> From: Maksim Yevmenkin Date: Wed, 28 Jan 2009 20:04:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187865 - head/sys/dev/usb2/bluetooth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 20:04:40 -0000 Author: emax Date: Wed Jan 28 20:04:39 2009 New Revision: 187865 URL: http://svn.freebsd.org/changeset/base/187865 Log: Make ng_ubt2 (aka usb2_bluetooth_ng) driver only attach as "generic" driver Reviewed by: HPS Modified: head/sys/dev/usb2/bluetooth/ng_ubt2.c Modified: head/sys/dev/usb2/bluetooth/ng_ubt2.c ============================================================================== --- head/sys/dev/usb2/bluetooth/ng_ubt2.c Wed Jan 28 19:58:05 2009 (r187864) +++ head/sys/dev/usb2/bluetooth/ng_ubt2.c Wed Jan 28 20:04:39 2009 (r187865) @@ -406,6 +406,9 @@ ubt_probe(device_t dev) if (uaa->info.bIfaceIndex != 0) return (ENXIO); + if (uaa->use_generic == 0) + return (ENXIO); + if (usb2_lookup_id_by_uaa(ubt_ignore_devs, sizeof(ubt_ignore_devs), uaa) == 0) return (ENXIO); From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 20:06:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E761106567F; Wed, 28 Jan 2009 20:06:02 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7AB6C8FC23; Wed, 28 Jan 2009 20:06:02 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SK621c032131; Wed, 28 Jan 2009 20:06:02 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SK62pa032130; Wed, 28 Jan 2009 20:06:02 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200901282006.n0SK62pa032130@svn.freebsd.org> From: Maksim Yevmenkin Date: Wed, 28 Jan 2009 20:06:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187866 - head/sys/dev/usb2/bluetooth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 20:06:05 -0000 Author: emax Date: Wed Jan 28 20:06:02 2009 New Revision: 187866 URL: http://svn.freebsd.org/changeset/base/187866 Log: Update ubtbcmfw2 (aka usb2_bluetooth_fw) driver Reviewed by: HPS Modified: head/sys/dev/usb2/bluetooth/ubtbcmfw2.c Modified: head/sys/dev/usb2/bluetooth/ubtbcmfw2.c ============================================================================== --- head/sys/dev/usb2/bluetooth/ubtbcmfw2.c Wed Jan 28 20:04:39 2009 (r187865) +++ head/sys/dev/usb2/bluetooth/ubtbcmfw2.c Wed Jan 28 20:06:02 2009 (r187866) @@ -3,7 +3,7 @@ */ /*- - * Copyright (c) 2003 Maksim Yevmenkin + * Copyright (c) 2003-2009 Maksim Yevmenkin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,107 +54,85 @@ #define UBTBCMFW_CONFIG_NO 1 /* Config number */ #define UBTBCMFW_IFACE_IDX 0 /* Control interface */ -#define UBTBCMFW_T_MAX 4 /* units */ + +#define UBTBCMFW_BSIZE 1024 +#define UBTBCMFW_IFQ_MAXLEN 2 enum { - UBTBCMFW_BULK_DT_WR, - UBTBCMFW_BULK_DT_RD, - UBTBCMFW_BULK_CS_WR, - UBTBCMFW_BULK_CS_RD, - UBTBCMFW_N_TRANSFER = 4, + UBTBCMFW_BULK_DT_WR = 0, + UBTBCMFW_INTR_DT_RD, + UBTBCMFW_N_TRANSFER, }; struct ubtbcmfw_softc { - struct usb2_fifo_sc sc_fifo; - struct mtx sc_mtx; - - device_t sc_dev; - struct usb2_device *sc_udev; - struct usb2_xfer *sc_xfer[UBTBCMFW_N_TRANSFER]; - - uint8_t sc_flags; -#define UBTBCMFW_FLAG_WRITE_STALL 0x01 -#define UBTBCMFW_FLAG_READ_STALL 0x02 + struct usb2_device *sc_udev; + struct mtx sc_mtx; + struct usb2_xfer *sc_xfer[UBTBCMFW_N_TRANSFER]; + struct usb2_fifo_sc sc_fifo; }; -#define UBTBCMFW_BSIZE 1024 -#define UBTBCMFW_IFQ_MAXLEN 2 - -/* prototypes */ +/* + * Prototypes + */ -static device_probe_t ubtbcmfw_probe; -static device_attach_t ubtbcmfw_attach; -static device_detach_t ubtbcmfw_detach; - -static usb2_callback_t ubtbcmfw_write_callback; -static usb2_callback_t ubtbcmfw_write_clear_stall_callback; -static usb2_callback_t ubtbcmfw_read_callback; -static usb2_callback_t ubtbcmfw_read_clear_stall_callback; - -static usb2_fifo_close_t ubtbcmfw_close; -static usb2_fifo_cmd_t ubtbcmfw_start_read; -static usb2_fifo_cmd_t ubtbcmfw_start_write; -static usb2_fifo_cmd_t ubtbcmfw_stop_read; -static usb2_fifo_cmd_t ubtbcmfw_stop_write; -static usb2_fifo_ioctl_t ubtbcmfw_ioctl; -static usb2_fifo_open_t ubtbcmfw_open; - -static struct usb2_fifo_methods ubtbcmfw_fifo_methods = { - .f_close = &ubtbcmfw_close, - .f_ioctl = &ubtbcmfw_ioctl, - .f_open = &ubtbcmfw_open, - .f_start_read = &ubtbcmfw_start_read, - .f_start_write = &ubtbcmfw_start_write, - .f_stop_read = &ubtbcmfw_stop_read, - .f_stop_write = &ubtbcmfw_stop_write, - .basename[0] = "ubtbcmfw", - .basename[1] = "ubtbcmfw", - .basename[2] = "ubtbcmfw", - .postfix[0] = "", - .postfix[1] = ".1", - .postfix[2] = ".2", +static device_probe_t ubtbcmfw_probe; +static device_attach_t ubtbcmfw_attach; +static device_detach_t ubtbcmfw_detach; + +static usb2_callback_t ubtbcmfw_write_callback; +static usb2_callback_t ubtbcmfw_read_callback; + +static usb2_fifo_close_t ubtbcmfw_close; +static usb2_fifo_cmd_t ubtbcmfw_start_read; +static usb2_fifo_cmd_t ubtbcmfw_start_write; +static usb2_fifo_cmd_t ubtbcmfw_stop_read; +static usb2_fifo_cmd_t ubtbcmfw_stop_write; +static usb2_fifo_ioctl_t ubtbcmfw_ioctl; +static usb2_fifo_open_t ubtbcmfw_open; + +static struct usb2_fifo_methods ubtbcmfw_fifo_methods = +{ + .f_close = &ubtbcmfw_close, + .f_ioctl = &ubtbcmfw_ioctl, + .f_open = &ubtbcmfw_open, + .f_start_read = &ubtbcmfw_start_read, + .f_start_write = &ubtbcmfw_start_write, + .f_stop_read = &ubtbcmfw_stop_read, + .f_stop_write = &ubtbcmfw_stop_write, + .basename[0] = "ubtbcmfw", + .basename[1] = "ubtbcmfw", + .basename[2] = "ubtbcmfw", + .postfix[0] = "", + .postfix[1] = ".1", + .postfix[2] = ".2", }; -static const struct usb2_config ubtbcmfw_config[UBTBCMFW_T_MAX] = { +/* + * Device's config structure + */ +static const struct usb2_config ubtbcmfw_config[UBTBCMFW_N_TRANSFER] = +{ [UBTBCMFW_BULK_DT_WR] = { - .type = UE_BULK, - .endpoint = 0x02, /* fixed */ - .direction = UE_DIR_OUT, - .mh.bufsize = UBTBCMFW_BSIZE, - .mh.flags = {.pipe_bof = 1,.proxy_buffer = 1,}, - .mh.callback = &ubtbcmfw_write_callback, + .type = UE_BULK, + .endpoint = 0x02, /* fixed */ + .direction = UE_DIR_OUT, + .if_index = UBTBCMFW_IFACE_IDX, + .mh.bufsize = UBTBCMFW_BSIZE, + .mh.flags = { .pipe_bof = 1, .force_short_xfer = 1, + .proxy_buffer = 1, }, + .mh.callback = &ubtbcmfw_write_callback, }, - [UBTBCMFW_BULK_DT_RD] = { - .type = UE_INTERRUPT, - .endpoint = 0x01, /* fixed */ - .direction = UE_DIR_IN, - .mh.bufsize = UBTBCMFW_BSIZE, - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,.proxy_buffer = 1,}, - .mh.callback = &ubtbcmfw_read_callback, - }, - - [UBTBCMFW_BULK_CS_WR] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.flags = {}, - .mh.callback = &ubtbcmfw_write_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ - }, - - [UBTBCMFW_BULK_CS_RD] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.flags = {}, - .mh.callback = &ubtbcmfw_read_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ + [UBTBCMFW_INTR_DT_RD] = { + .type = UE_INTERRUPT, + .endpoint = 0x01, /* fixed */ + .direction = UE_DIR_IN, + .if_index = UBTBCMFW_IFACE_IDX, + .mh.bufsize = UBTBCMFW_BSIZE, + .mh.flags = { .pipe_bof = 1, .short_xfer_ok = 1, + .proxy_buffer = 1, }, + .mh.callback = &ubtbcmfw_read_callback, }, }; @@ -162,19 +140,21 @@ static const struct usb2_config ubtbcmfw * Module */ -static devclass_t ubtbcmfw_devclass; +static devclass_t ubtbcmfw_devclass; -static device_method_t ubtbcmfw_methods[] = { +static device_method_t ubtbcmfw_methods[] = +{ DEVMETHOD(device_probe, ubtbcmfw_probe), DEVMETHOD(device_attach, ubtbcmfw_attach), DEVMETHOD(device_detach, ubtbcmfw_detach), {0, 0} }; -static driver_t ubtbcmfw_driver = { - .name = "ubtbcmfw", - .methods = ubtbcmfw_methods, - .size = sizeof(struct ubtbcmfw_softc), +static driver_t ubtbcmfw_driver = +{ + .name = "ubtbcmfw", + .methods = ubtbcmfw_methods, + .size = sizeof(struct ubtbcmfw_softc), }; DRIVER_MODULE(ubtbcmfw, ushub, ubtbcmfw_driver, ubtbcmfw_devclass, NULL, 0); @@ -188,21 +168,21 @@ MODULE_DEPEND(ubtbcmfw, usb2_core, 1, 1, static int ubtbcmfw_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + const struct usb2_device_id devs[] = { + /* Broadcom BCM2033 devices only */ + { USB_VPI(USB_VENDOR_BROADCOM, USB_PRODUCT_BROADCOM_BCM2033, 0) }, + }; + + struct usb2_attach_arg *uaa = device_get_ivars(dev); - if (uaa->usb2_mode != USB_MODE_HOST) { + if (uaa->usb2_mode != USB_MODE_HOST) return (ENXIO); - } + if (uaa->info.bIfaceIndex != 0) return (ENXIO); - /* Match the boot device. */ - if (uaa->info.idVendor == USB_VENDOR_BROADCOM && - uaa->info.idProduct == USB_PRODUCT_BROADCOM_BCM2033) - return (0); - - return (ENXIO); -} + return (usb2_lookup_id_by_uaa(devs, sizeof(devs), uaa)); +} /* ubtbcmfw_probe */ /* * Attach the device @@ -211,15 +191,11 @@ ubtbcmfw_probe(device_t dev) static int ubtbcmfw_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); - struct ubtbcmfw_softc *sc = device_get_softc(dev); - int32_t err; - uint8_t iface_index; + struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct ubtbcmfw_softc *sc = device_get_softc(dev); + uint8_t iface_index; + int error; - if (sc == NULL) { - return (ENOMEM); - } - sc->sc_dev = dev; sc->sc_udev = uaa->device; device_set_usb2_desc(dev); @@ -227,30 +203,35 @@ ubtbcmfw_attach(device_t dev) mtx_init(&sc->sc_mtx, "ubtbcmfw lock", NULL, MTX_DEF | MTX_RECURSE); iface_index = UBTBCMFW_IFACE_IDX; - err = usb2_transfer_setup(uaa->device, - &iface_index, sc->sc_xfer, ubtbcmfw_config, - UBTBCMFW_T_MAX, sc, &sc->sc_mtx); - if (err) { - device_printf(dev, "allocating USB transfers " - "failed, err=%s\n", usb2_errstr(err)); + error = usb2_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, + ubtbcmfw_config, UBTBCMFW_N_TRANSFER, + sc, &sc->sc_mtx); + if (error != 0) { + device_printf(dev, "allocating USB transfers failed. %s\n", + usb2_errstr(error)); goto detach; } - /* set interface permissions */ + + /* Set interface permissions */ usb2_set_iface_perm(uaa->device, uaa->info.bIfaceIndex, - UID_ROOT, GID_OPERATOR, 0644); + UID_ROOT, GID_OPERATOR, 0644); - err = usb2_fifo_attach(uaa->device, sc, &sc->sc_mtx, - &ubtbcmfw_fifo_methods, &sc->sc_fifo, - device_get_unit(dev), 0 - 1, uaa->info.bIfaceIndex); - if (err) { + error = usb2_fifo_attach(uaa->device, sc, &sc->sc_mtx, + &ubtbcmfw_fifo_methods, &sc->sc_fifo, + device_get_unit(dev), 0 - 1, uaa->info.bIfaceIndex); + if (error != 0) { + device_printf(dev, "could not attach fifo. %s\n", + usb2_errstr(error)); goto detach; } - return (0); /* success */ + + return (0); /* success */ detach: ubtbcmfw_detach(dev); - return (ENOMEM); /* failure */ -} + + return (ENXIO); /* failure */ +} /* ubtbcmfw_attach */ /* * Detach the device @@ -259,191 +240,192 @@ detach: static int ubtbcmfw_detach(device_t dev) { - struct ubtbcmfw_softc *sc = device_get_softc(dev); + struct ubtbcmfw_softc *sc = device_get_softc(dev); usb2_fifo_detach(&sc->sc_fifo); - usb2_transfer_unsetup(sc->sc_xfer, UBTBCMFW_T_MAX); + usb2_transfer_unsetup(sc->sc_xfer, UBTBCMFW_N_TRANSFER); mtx_destroy(&sc->sc_mtx); return (0); -} +} /* ubtbcmfw_detach */ + +/* + * USB write callback + */ static void ubtbcmfw_write_callback(struct usb2_xfer *xfer) { - struct ubtbcmfw_softc *sc = xfer->priv_sc; - struct usb2_fifo *f = sc->sc_fifo.fp[USB_FIFO_RX]; - uint32_t actlen; + struct ubtbcmfw_softc *sc = xfer->priv_sc; + struct usb2_fifo *f = sc->sc_fifo.fp[USB_FIFO_TX]; + uint32_t actlen; switch (USB_GET_STATE(xfer)) { - case USB_ST_TRANSFERRED: case USB_ST_SETUP: - if (sc->sc_flags & UBTBCMFW_FLAG_WRITE_STALL) { - usb2_transfer_start(sc->sc_xfer[UBTBCMFW_BULK_CS_WR]); - return; - } + case USB_ST_TRANSFERRED: +setup_next: if (usb2_fifo_get_data(f, xfer->frbuffers, 0, - UBTBCMFW_BSIZE, &actlen, 0)) { - + xfer->max_data_length, &actlen, 0)) { xfer->frlengths[0] = actlen; usb2_start_hardware(xfer); } - return; + break; - default: /* Error */ + default: /* Error */ if (xfer->error != USB_ERR_CANCELLED) { /* try to clear stall first */ - sc->sc_flags |= UBTBCMFW_FLAG_WRITE_STALL; - usb2_transfer_start(sc->sc_xfer[UBTBCMFW_BULK_CS_WR]); + xfer->flags.stall_pipe = 1; + goto setup_next; } - return; + break; } -} - -static void -ubtbcmfw_write_clear_stall_callback(struct usb2_xfer *xfer) -{ - struct ubtbcmfw_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_xfer[UBTBCMFW_BULK_DT_WR]; +} /* ubtbcmfw_write_callback */ - if (usb2_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - sc->sc_flags &= ~UBTBCMFW_FLAG_WRITE_STALL; - usb2_transfer_start(xfer_other); - } -} +/* + * USB read callback + */ static void ubtbcmfw_read_callback(struct usb2_xfer *xfer) { - struct ubtbcmfw_softc *sc = xfer->priv_sc; - struct usb2_fifo *f = sc->sc_fifo.fp[USB_FIFO_RX]; + struct ubtbcmfw_softc *sc = xfer->priv_sc; + struct usb2_fifo *fifo = sc->sc_fifo.fp[USB_FIFO_RX]; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - usb2_fifo_put_data(f, xfer->frbuffers, - 0, xfer->actlen, 1); + usb2_fifo_put_data(fifo, xfer->frbuffers, 0, xfer->actlen, 1); + /* FALLTHROUGH */ case USB_ST_SETUP: - if (sc->sc_flags & UBTBCMFW_FLAG_READ_STALL) { - usb2_transfer_start(sc->sc_xfer[UBTBCMFW_BULK_CS_RD]); - return; - } - if (usb2_fifo_put_bytes_max(f) != 0) { +setup_next: + if (usb2_fifo_put_bytes_max(fifo) > 0) { xfer->frlengths[0] = xfer->max_data_length; usb2_start_hardware(xfer); } - return; + break; - default: /* Error */ + default: /* Error */ if (xfer->error != USB_ERR_CANCELLED) { /* try to clear stall first */ - sc->sc_flags |= UBTBCMFW_FLAG_READ_STALL; - usb2_transfer_start(sc->sc_xfer[UBTBCMFW_BULK_CS_RD]); + xfer->flags.stall_pipe = 1; + goto setup_next; } - return; + break; } -} - -static void -ubtbcmfw_read_clear_stall_callback(struct usb2_xfer *xfer) -{ - struct ubtbcmfw_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_xfer[UBTBCMFW_BULK_DT_RD]; +} /* ubtbcmfw_read_callback */ - if (usb2_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - sc->sc_flags &= ~UBTBCMFW_FLAG_READ_STALL; - usb2_transfer_start(xfer_other); - } -} +/* + * Called when we about to start read()ing from the device + */ static void ubtbcmfw_start_read(struct usb2_fifo *fifo) { - struct ubtbcmfw_softc *sc = fifo->priv_sc0; + struct ubtbcmfw_softc *sc = fifo->priv_sc0; - usb2_transfer_start(sc->sc_xfer[UBTBCMFW_BULK_DT_RD]); -} + usb2_transfer_start(sc->sc_xfer[UBTBCMFW_INTR_DT_RD]); +} /* ubtbcmfw_start_read */ + +/* + * Called when we about to stop reading (i.e. closing fifo) + */ static void ubtbcmfw_stop_read(struct usb2_fifo *fifo) { - struct ubtbcmfw_softc *sc = fifo->priv_sc0; + struct ubtbcmfw_softc *sc = fifo->priv_sc0; + + usb2_transfer_stop(sc->sc_xfer[UBTBCMFW_INTR_DT_RD]); +} /* ubtbcmfw_stop_read */ - usb2_transfer_stop(sc->sc_xfer[UBTBCMFW_BULK_CS_RD]); - usb2_transfer_stop(sc->sc_xfer[UBTBCMFW_BULK_DT_RD]); -} +/* + * Called when we about to start write()ing to the device, poll()ing + * for write or flushing fifo + */ static void ubtbcmfw_start_write(struct usb2_fifo *fifo) { - struct ubtbcmfw_softc *sc = fifo->priv_sc0; + struct ubtbcmfw_softc *sc = fifo->priv_sc0; usb2_transfer_start(sc->sc_xfer[UBTBCMFW_BULK_DT_WR]); -} +} /* ubtbcmfw_start_write */ + +/* + * Called when we about to stop writing (i.e. closing fifo) + */ static void ubtbcmfw_stop_write(struct usb2_fifo *fifo) { - struct ubtbcmfw_softc *sc = fifo->priv_sc0; + struct ubtbcmfw_softc *sc = fifo->priv_sc0; - usb2_transfer_stop(sc->sc_xfer[UBTBCMFW_BULK_CS_WR]); usb2_transfer_stop(sc->sc_xfer[UBTBCMFW_BULK_DT_WR]); -} +} /* ubtbcmfw_stop_write */ + +/* + * Called when fifo is open + */ static int ubtbcmfw_open(struct usb2_fifo *fifo, int fflags, struct thread *td) { - struct ubtbcmfw_softc *sc = fifo->priv_sc0; + struct ubtbcmfw_softc *sc = fifo->priv_sc0; + struct usb2_xfer *xfer; + + /* + * f_open fifo method can only be called with either FREAD + * or FWRITE flag set at one time. + */ + + if (fflags & FREAD) + xfer = sc->sc_xfer[UBTBCMFW_INTR_DT_RD]; + else if (fflags & FWRITE) + xfer = sc->sc_xfer[UBTBCMFW_BULK_DT_WR]; + else + return (EINVAL); /* XXX can happen? */ + + if (usb2_fifo_alloc_buffer(fifo, xfer->max_data_length, + UBTBCMFW_IFQ_MAXLEN) != 0) + return (ENOMEM); - if (fflags & FREAD) { - if (usb2_fifo_alloc_buffer(fifo, - sc->sc_xfer[UBTBCMFW_BULK_DT_RD]->max_data_length, - UBTBCMFW_IFQ_MAXLEN)) { - return (ENOMEM); - } - } - if (fflags & FWRITE) { - /* clear stall first */ - mtx_lock(&sc->sc_mtx); - sc->sc_flags |= UBTBCMFW_FLAG_WRITE_STALL; - mtx_unlock(&sc->sc_mtx); - if (usb2_fifo_alloc_buffer(fifo, - sc->sc_xfer[UBTBCMFW_BULK_DT_WR]->max_data_length, - UBTBCMFW_IFQ_MAXLEN)) { - return (ENOMEM); - } - } return (0); -} +} /* ubtbcmfw_open */ + +/* + * Called when fifo is closed + */ static void ubtbcmfw_close(struct usb2_fifo *fifo, int fflags, struct thread *td) { - if (fflags & (FREAD | FWRITE)) { + if (fflags & (FREAD | FWRITE)) usb2_fifo_free_buffer(fifo); - } -} +} /* ubtbcmfw_close */ + +/* + * Process ioctl() on USB device + */ static int ubtbcmfw_ioctl(struct usb2_fifo *fifo, u_long cmd, void *data, int fflags, struct thread *td) { - struct ubtbcmfw_softc *sc = fifo->priv_sc0; - int error = 0; + struct ubtbcmfw_softc *sc = fifo->priv_sc0; + int error = 0; switch (cmd) { case USB_GET_DEVICE_DESC: - *(struct usb2_device_descriptor *)data = - *usb2_get_device_descriptor(sc->sc_udev); + memcpy(data, usb2_get_device_descriptor(sc->sc_udev), + sizeof(struct usb2_device_descriptor)); break; default: error = EINVAL; break; } + return (error); -} +} /* ubtbcmfw_ioctl */ From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 20:18:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 009CD1065672; Wed, 28 Jan 2009 20:18:47 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id AD2228FC20; Wed, 28 Jan 2009 20:18:47 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id DC14CFF05; Thu, 29 Jan 2009 09:18:46 +1300 (NZDT) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DhjjFgZDc9Lr; Thu, 29 Jan 2009 09:18:43 +1300 (NZDT) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Thu, 29 Jan 2009 09:18:43 +1300 (NZDT) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id DA7BB1142E; Thu, 29 Jan 2009 09:18:42 +1300 (NZDT) Date: Wed, 28 Jan 2009 12:18:42 -0800 From: Andrew Thompson To: Maksim Yevmenkin Message-ID: <20090128201842.GD41780@citylink.fud.org.nz> References: <200901282006.n0SK62pa032130@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200901282006.n0SK62pa032130@svn.freebsd.org> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187866 - head/sys/dev/usb2/bluetooth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 20:18:48 -0000 On Wed, Jan 28, 2009 at 08:06:02PM +0000, Maksim Yevmenkin wrote: > Author: emax > Date: Wed Jan 28 20:06:02 2009 > New Revision: 187866 > URL: http://svn.freebsd.org/changeset/base/187866 > > Log: > Update ubtbcmfw2 (aka usb2_bluetooth_fw) driver > > Reviewed by: HPS > > enum { > - UBTBCMFW_BULK_DT_WR, > - UBTBCMFW_BULK_DT_RD, > - UBTBCMFW_BULK_CS_WR, > - UBTBCMFW_BULK_CS_RD, > - UBTBCMFW_N_TRANSFER = 4, > + UBTBCMFW_BULK_DT_WR = 0, > + UBTBCMFW_INTR_DT_RD, > + UBTBCMFW_N_TRANSFER, > }; I found it more useful the other way around which showed the number of transfers at a glance of UBTBCMFW_N_TRANSFER. (I realise you removed one) Andrew From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 20:31:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B150A106564A; Wed, 28 Jan 2009 20:31:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 52BB78FC1E; Wed, 28 Jan 2009 20:31:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1LSH3r-0009QA-Ci; Wed, 28 Jan 2009 22:30:59 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n0SKUuNg041765 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 28 Jan 2009 22:30:56 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n0SKUtfW083349; Wed, 28 Jan 2009 22:30:55 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n0SKUt4i083348; Wed, 28 Jan 2009 22:30:55 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 28 Jan 2009 22:30:55 +0200 From: Kostik Belousov To: John Baldwin Message-ID: <20090128203053.GJ2009@deviant.kiev.zoral.com.ua> References: <200901281854.n0SIsvNX029332@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DesjdUuHQDwS2t4N" Content-Disposition: inline In-Reply-To: <200901281854.n0SIsvNX029332@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1LSH3r-0009QA-Ci 5f57fb70b73307df4fcfe00431dde64a X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187838 - head/sys/fs/cd9660 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 20:31:02 -0000 --DesjdUuHQDwS2t4N Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jan 28, 2009 at 06:54:57PM +0000, John Baldwin wrote: > Author: jhb > Date: Wed Jan 28 18:54:56 2009 > New Revision: 187838 > URL: http://svn.freebsd.org/changeset/base/187838 ... > - Use an inlined version of vn_vget_ino() to handle races with .. > lookups. I had to inline the code here since cd9660 uses an internal > vget routine to save a disk I/O that would otherwise re-read the > directory block. Hmm, also please see the ffs_softdep.c:softdep_fsync(), that also needs the similar fix and cannot be converted to vn_vget_ino() due to ffs_vgetf(). I was unable to propose some useful generalization of vn_vget_ino() so far. --DesjdUuHQDwS2t4N Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkmAwHwACgkQC3+MBN1Mb4jd9QCfdLUKq6UeZ2XhJjHesFBQAdA3 xvYAnj5J3mtuXXN7y0LxPwtgtNeUyK08 =AIfG -----END PGP SIGNATURE----- --DesjdUuHQDwS2t4N-- From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 20:35:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2254D1065672; Wed, 28 Jan 2009 20:35:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 107C98FC20; Wed, 28 Jan 2009 20:35:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SKZGbY032686; Wed, 28 Jan 2009 20:35:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SKZGun032684; Wed, 28 Jan 2009 20:35:16 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200901282035.n0SKZGun032684@svn.freebsd.org> From: John Baldwin Date: Wed, 28 Jan 2009 20:35:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187867 - in head/sys/amd64: amd64 include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 20:35:18 -0000 Author: jhb Date: Wed Jan 28 20:35:16 2009 New Revision: 187867 URL: http://svn.freebsd.org/changeset/base/187867 Log: Use a different value for the initial control word for the FPU state for 32-bit processes. The value matches the initial setting used by FreeBSD/i386. Otherwise, 32-bit binaries using floating point would use a slightly different initial state when run on FreeBSD/amd64. MFC after: 1 week Modified: head/sys/amd64/amd64/fpu.c head/sys/amd64/include/fpu.h Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Wed Jan 28 20:06:02 2009 (r187866) +++ head/sys/amd64/amd64/fpu.c Wed Jan 28 20:35:16 2009 (r187867) @@ -391,6 +391,7 @@ fpudna() { struct pcb *pcb; register_t s; + u_short control; if (PCPU_GET(fpcurthread) == curthread) { printf("fpudna: fpcurthread == curthread %d times\n", @@ -421,6 +422,10 @@ fpudna() * explicitly load sanitized registers. */ fxrstor(&fpu_cleanstate); + if (pcb->pcb_flags & PCB_32BIT) { + control = __INITIAL_FPUCW_I386__; + fldcw(&control); + } pcb->pcb_flags |= PCB_FPUINITDONE; } else fxrstor(&pcb->pcb_save); Modified: head/sys/amd64/include/fpu.h ============================================================================== --- head/sys/amd64/include/fpu.h Wed Jan 28 20:06:02 2009 (r187866) +++ head/sys/amd64/include/fpu.h Wed Jan 28 20:35:16 2009 (r187867) @@ -92,6 +92,7 @@ struct savefpu { * SSE2 based math. For FreeBSD/amd64, we go with the default settings. */ #define __INITIAL_FPUCW__ 0x037F +#define __INITIAL_FPUCW_I386__ 0x127F #define __INITIAL_MXCSR__ 0x1F80 #define __INITIAL_MXCSR_MASK__ 0xFFBF From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 20:41:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F135106589E; Wed, 28 Jan 2009 20:41:24 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 28AE48FC1F; Wed, 28 Jan 2009 20:41:24 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id C976246B65; Wed, 28 Jan 2009 15:41:23 -0500 (EST) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n0SKekcl099624; Wed, 28 Jan 2009 15:41:18 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Kostik Belousov Date: Wed, 28 Jan 2009 15:33:05 -0500 User-Agent: KMail/1.9.7 References: <200901281854.n0SIsvNX029332@svn.freebsd.org> <20090128203053.GJ2009@deviant.kiev.zoral.com.ua> In-Reply-To: <20090128203053.GJ2009@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901281533.06173.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Wed, 28 Jan 2009 15:41:18 -0500 (EST) X-Virus-Scanned: ClamAV 0.94.2/8914/Wed Jan 28 01:40:00 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187838 - head/sys/fs/cd9660 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 20:41:26 -0000 On Wednesday 28 January 2009 3:30:55 pm Kostik Belousov wrote: > On Wed, Jan 28, 2009 at 06:54:57PM +0000, John Baldwin wrote: > > Author: jhb > > Date: Wed Jan 28 18:54:56 2009 > > New Revision: 187838 > > URL: http://svn.freebsd.org/changeset/base/187838 > ... > > - Use an inlined version of vn_vget_ino() to handle races with .. > > lookups. I had to inline the code here since cd9660 uses an internal > > vget routine to save a disk I/O that would otherwise re-read the > > directory block. > > Hmm, also please see the ffs_softdep.c:softdep_fsync(), that also > needs the similar fix and cannot be converted to vn_vget_ino() due to > ffs_vgetf(). > > I was unable to propose some useful generalization of vn_vget_ino() > so far. Maybe it would be possible to have subroutines for the before and after bits that go around the vget() (That could be ugly though)? For my udf patches I was able to use vn_vget_ino() which was nice. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 20:47:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB17E1065710 for ; Wed, 28 Jan 2009 20:47:11 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.235]) by mx1.freebsd.org (Postfix) with ESMTP id 7822A8FC1A for ; Wed, 28 Jan 2009 20:47:11 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so7243404rvf.43 for ; Wed, 28 Jan 2009 12:47:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=m9HlUYUKN0lAUaEk/GYm0/s8NzVcDxmkvg/TLiUy08g=; b=kv56XBJTbBH5I9YiNI3QZwhVaMEEqBdgJT+6jz4WNjhHcW2ZEnGUN9l9mVLJKHhZiC K8fo6wKqDLZftkVExBXOWPKyRbiz1bBYbccnsFd2h0upnwLQQQhnJD/9ZyPCW69KjmPA giO+CgfZUHhmkw575d4iTkL6WXrjkv9pW34Ek= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=OvoLmhnc0EHqhBb7WM4PaAfu0rh5hK046uyctC+7se1UTedmcBCjNyrg/0Lv4hfZe8 cq0hDsVALB9eXVGU3M1PT+dN1rI9NQVpMbe19x6z6c4vP5qcEFN3MjNIpk1Eumg8/cUC DPZ/S12G4+ZuymuAVE3X8Ep2zfsyRptZNfsa4= MIME-Version: 1.0 Sender: maksim.yevmenkin@gmail.com Received: by 10.141.113.6 with SMTP id q6mr3517996rvm.212.1233174384677; Wed, 28 Jan 2009 12:26:24 -0800 (PST) In-Reply-To: <20090128201842.GD41780@citylink.fud.org.nz> References: <200901282006.n0SK62pa032130@svn.freebsd.org> <20090128201842.GD41780@citylink.fud.org.nz> Date: Wed, 28 Jan 2009 12:26:24 -0800 X-Google-Sender-Auth: 17c369e818e2363e Message-ID: From: Maksim Yevmenkin To: Andrew Thompson Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187866 - head/sys/dev/usb2/bluetooth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 20:47:13 -0000 On Wed, Jan 28, 2009 at 12:18 PM, Andrew Thompson wrote: > On Wed, Jan 28, 2009 at 08:06:02PM +0000, Maksim Yevmenkin wrote: >> Author: emax >> Date: Wed Jan 28 20:06:02 2009 >> New Revision: 187866 >> URL: http://svn.freebsd.org/changeset/base/187866 >> >> Log: >> Update ubtbcmfw2 (aka usb2_bluetooth_fw) driver >> >> Reviewed by: HPS >> >> enum { >> - UBTBCMFW_BULK_DT_WR, >> - UBTBCMFW_BULK_DT_RD, >> - UBTBCMFW_BULK_CS_WR, >> - UBTBCMFW_BULK_CS_RD, >> - UBTBCMFW_N_TRANSFER = 4, >> + UBTBCMFW_BULK_DT_WR = 0, >> + UBTBCMFW_INTR_DT_RD, >> + UBTBCMFW_N_TRANSFER, >> }; > > I found it more useful the other way around which showed the number of > transfers at a glance of UBTBCMFW_N_TRANSFER. (I realise you removed one) two actually. all transfer stalls are now handled internally (as per HPSs suggestion). in any case, it seemed like a good idea to do it this way because those values used as indexes to an array. just wanted to make sure that all transfers are in their right places :) dont really have a particularly strong opinion on this though :) and its only 2 values we are talking about here :) thanks, max From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 22:09:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55D2C106567A; Wed, 28 Jan 2009 22:09:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 435368FC14; Wed, 28 Jan 2009 22:09:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SM91K5034944; Wed, 28 Jan 2009 22:09:01 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SM91xx034943; Wed, 28 Jan 2009 22:09:01 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200901282209.n0SM91xx034943@svn.freebsd.org> From: Alexander Motin Date: Wed, 28 Jan 2009 22:09:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187875 - head/sys/dev/mmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 22:09:02 -0000 Author: mav Date: Wed Jan 28 22:09:00 2009 New Revision: 187875 URL: http://svn.freebsd.org/changeset/base/187875 Log: Improve mmc driver verbose logging. Make requests logging controllable by hw.mmc.debug sysctl. Modified: head/sys/dev/mmc/mmc.c Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Wed Jan 28 21:57:39 2009 (r187874) +++ head/sys/dev/mmc/mmc.c Wed Jan 28 22:09:00 2009 (r187875) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -104,6 +105,11 @@ struct mmc_ivars { #define CMD_RETRIES 3 +SYSCTL_NODE(_hw, OID_AUTO, mmc, CTLFLAG_RD, 0, "mmc driver"); + +int mmc_debug; +SYSCTL_INT(_hw_mmc, OID_AUTO, debug, CTLFLAG_RW, &mmc_debug, 0, "Debug level"); + /* bus entry points */ static int mmc_probe(device_t dev); static int mmc_attach(device_t dev); @@ -233,7 +239,7 @@ mmc_acquire_bus(device_t busdev, device_ sc->last_rca = rca; /* Prepare bus width for the new card. */ ivar = device_get_ivars(dev); - if (bootverbose) { + if (bootverbose || mmc_debug) { device_printf(busdev, "setting bus width to %d bits\n", (ivar->bus_width == bus_width_4) ? 4 : @@ -315,11 +321,21 @@ mmc_wait_for_req(struct mmc_softc *sc, s req->done = mmc_wakeup; req->done_data = sc; + if (mmc_debug) { + device_printf(sc->dev, "REQUEST: CMD%d arg %#x flags %#x", + req->cmd->opcode, req->cmd->arg, req->cmd->flags); + if (req->cmd->data) { + printf(" data %d\n", (int)req->cmd->data->len); + } else + printf("\n"); + } MMCBR_REQUEST(device_get_parent(sc->dev), sc->dev, req); MMC_LOCK(sc); while ((req->flags & MMC_REQ_DONE) == 0) msleep(req, &sc->sc_mtx, 0, "mmcreq", 0); MMC_UNLOCK(sc); + if (mmc_debug > 1 || (mmc_debug && req->cmd->error)) + device_printf(sc->dev, "RESULT: %d\n", req->cmd->error); return (0); } @@ -340,9 +356,6 @@ mmc_wait_for_cmd(struct mmc_softc *sc, s memset(cmd->resp, 0, sizeof(cmd->resp)); cmd->retries = retries; mreq.cmd = cmd; - if (bootverbose) - device_printf(sc->dev, "CMD: %#x ARG %#x\n", cmd->opcode, - cmd->arg); mmc_wait_for_req(sc, &mreq); return (cmd->error); } @@ -748,9 +761,10 @@ mmc_decode_cid_sd(uint32_t *raw_cid, str cid->oid = mmc_get_bits(raw_cid, 128, 104, 16); for (i = 0; i < 5; i++) cid->pnm[i] = mmc_get_bits(raw_cid, 128, 96 - i * 8, 8); + cid->pnm[5] = 0; cid->prv = mmc_get_bits(raw_cid, 128, 56, 8); cid->psn = mmc_get_bits(raw_cid, 128, 24, 32); - cid->mdt_year = mmc_get_bits(raw_cid, 128, 12, 8) + 2001; + cid->mdt_year = mmc_get_bits(raw_cid, 128, 12, 8) + 2000; cid->mdt_month = mmc_get_bits(raw_cid, 128, 8, 4); } @@ -765,6 +779,7 @@ mmc_decode_cid_mmc(uint32_t *raw_cid, st cid->oid = mmc_get_bits(raw_cid, 128, 104, 8); for (i = 0; i < 6; i++) cid->pnm[i] = mmc_get_bits(raw_cid, 128, 96 - i * 8, 8); + cid->pnm[6] = 0; cid->prv = mmc_get_bits(raw_cid, 128, 48, 8); cid->psn = mmc_get_bits(raw_cid, 128, 16, 32); cid->mdt_month = mmc_get_bits(raw_cid, 128, 12, 4); @@ -1059,6 +1074,29 @@ mmc_send_relative_addr(struct mmc_softc } static void +mmc_log_card(device_t dev, struct mmc_ivars *ivar, int newcard) +{ + device_printf(dev, "Card at relative address %d%s:\n", + ivar->rca, newcard ? " added" : ""); + device_printf(dev, " card: %s%s (0x%x/0x%x/\"%s\" rev %d.%d " + "m/d %02d.%04d s/n %08x)\n", + ivar->mode == mode_sd ? "SD" : "MMC", + ivar->high_cap ? " High Capacity" : "", + ivar->cid.mid, ivar->cid.oid, + ivar->cid.pnm, ivar->cid.prv >> 4, ivar->cid.prv & 0x0f, + ivar->cid.mdt_month, ivar->cid.mdt_year, ivar->cid.psn); + device_printf(dev, " bus: %ubit, %uMHz%s\n", + (ivar->bus_width == bus_width_1 ? 1 : + (ivar->bus_width == bus_width_4 ? 4 : 8)), + (ivar->timing == bus_timing_hs ? + ivar->hs_tran_speed : ivar->tran_speed) / 1000000, + ivar->timing == bus_timing_hs ? ", high speed timing" : ""); + device_printf(dev, " memory: %u blocks, erase sector %u blocks%s\n", + ivar->sec_count, ivar->erase_sector, + ivar->read_only ? ", read-only" : ""); +} + +static void mmc_discover_cards(struct mmc_softc *sc) { struct mmc_ivars *ivar = NULL; @@ -1070,6 +1108,8 @@ mmc_discover_cards(struct mmc_softc *sc) uint16_t rca = 2; u_char switch_res[64]; + if (bootverbose || mmc_debug) + device_printf(sc->dev, "Probing cards\n"); while (1) { err = mmc_all_send_cid(sc, raw_cid); if (err == MMC_ERR_TIMEOUT) @@ -1089,6 +1129,11 @@ mmc_discover_cards(struct mmc_softc *sc) } } free(devlist, M_TEMP); + if (bootverbose || mmc_debug) { + device_printf(sc->dev, "%sard detected (CID %08x%08x%08x%08x)\n", + newcard ? "New c" : "C", + raw_cid[0], raw_cid[1], raw_cid[2], raw_cid[3]); + } if (newcard) { ivar = malloc(sizeof(struct mmc_ivars), M_DEVBUF, M_WAITOK | M_ZERO); @@ -1139,6 +1184,8 @@ mmc_discover_cards(struct mmc_softc *sc) if ((mmcbr_get_caps(sc->dev) & MMC_CAP_4_BIT_DATA) && (ivar->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) ivar->bus_width = bus_width_4; + if (bootverbose || mmc_debug) + mmc_log_card(sc->dev, ivar, newcard); if (newcard) { /* Add device. */ child = device_add_child(sc->dev, NULL, -1); @@ -1194,6 +1241,8 @@ mmc_discover_cards(struct mmc_softc *sc) ivar->bus_width = bus_width_1; ivar->timing = bus_timing_normal; } + if (bootverbose || mmc_debug) + mmc_log_card(sc->dev, ivar, newcard); if (newcard) { /* Add device. */ child = device_add_child(sc->dev, NULL, -1); @@ -1214,6 +1263,9 @@ mmc_rescan_cards(struct mmc_softc *sc) for (i = 0; i < devcount; i++) { ivar = device_get_ivars(devlist[i]); if (mmc_select_card(sc, ivar->rca)) { + if (bootverbose || mmc_debug) + device_printf(sc->dev, "Card at relative address %d lost.\n", + ivar->rca); device_delete_child(sc->dev, devlist[i]); free(ivar, M_DEVBUF); } @@ -1233,6 +1285,9 @@ mmc_delete_cards(struct mmc_softc *sc) return (err); for (i = 0; i < devcount; i++) { ivar = device_get_ivars(devlist[i]); + if (bootverbose || mmc_debug) + device_printf(sc->dev, "Card at relative address %d deleted.\n", + ivar->rca); device_delete_child(sc->dev, devlist[i]); free(ivar, M_DEVBUF); } @@ -1255,21 +1310,30 @@ mmc_go_discovery(struct mmc_softc *sc) mmcbr_set_mode(dev, mode_sd); mmc_power_up(sc); mmcbr_set_bus_mode(dev, pushpull); - if (bootverbose) - device_printf(sc->dev, "Idle cards for SD probe\n"); + if (bootverbose || mmc_debug) + device_printf(sc->dev, "Probing bus\n"); mmc_idle_cards(sc); err = mmc_send_if_cond(sc, 1); - if (bootverbose) - device_printf(sc->dev, "SD: SEND_IF_CONF %d\n", err); + if ((bootverbose || mmc_debug) && err == 0) + device_printf(sc->dev, "SD 2.0 interface conditions: OK\n"); if (mmc_send_app_op_cond(sc, err ? 0 : MMC_OCR_CCS, &ocr) != MMC_ERR_NONE) { + if (bootverbose || mmc_debug) + device_printf(sc->dev, "SD probe: failed\n"); /* * Failed, try MMC */ mmcbr_set_mode(dev, mode_mmc); - if (mmc_send_op_cond(sc, 0, &ocr) != MMC_ERR_NONE) + if (mmc_send_op_cond(sc, 0, &ocr) != MMC_ERR_NONE) { + if (bootverbose || mmc_debug) + device_printf(sc->dev, "MMC probe: failed\n"); ocr = 0; /* Failed both, powerdown. */ - } + } else if (bootverbose || mmc_debug) + device_printf(sc->dev, + "MMC probe: OK (OCR: 0x%08x)\n", ocr); + } else if (bootverbose || mmc_debug) + device_printf(sc->dev, "SD probe: OK (OCR: 0x%08x)\n", ocr); + mmcbr_set_ocr(dev, mmc_select_vdd(sc, ocr)); if (mmcbr_get_ocr(dev) != 0) mmc_idle_cards(sc); @@ -1283,6 +1347,8 @@ mmc_go_discovery(struct mmc_softc *sc) * Make sure that we have a mutually agreeable voltage to at least * one card on the bus. */ + if (bootverbose || mmc_debug) + device_printf(sc->dev, "Current OCR: 0x%08x\n", mmcbr_get_ocr(dev)); if (mmcbr_get_ocr(dev) == 0) { mmc_delete_cards(sc); mmc_power_down(sc); @@ -1344,7 +1410,7 @@ mmc_calculate_clock(struct mmc_softc *sc free(kids, M_TEMP); if (max_timing == bus_timing_hs) max_dtr = max_hs_dtr; - if (bootverbose) { + if (bootverbose || mmc_debug) { device_printf(sc->dev, "setting transfer rate to %d.%03dMHz%s\n", max_dtr / 1000000, (max_dtr / 1000) % 1000, From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 22:53:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24FB21065673; Wed, 28 Jan 2009 22:53:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13AC68FC12; Wed, 28 Jan 2009 22:53:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SMrfGu035747; Wed, 28 Jan 2009 22:53:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SMrfx1035746; Wed, 28 Jan 2009 22:53:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200901282253.n0SMrfx1035746@svn.freebsd.org> From: Alexander Motin Date: Wed, 28 Jan 2009 22:53:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187876 - head/sys/dev/sdhci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 22:53:42 -0000 Author: mav Date: Wed Jan 28 22:53:41 2009 New Revision: 187876 URL: http://svn.freebsd.org/changeset/base/187876 Log: Add hw.sdhci.debug sysctl to control debug level. Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Wed Jan 28 22:09:00 2009 (r187875) +++ head/sys/dev/sdhci/sdhci.c Wed Jan 28 22:53:41 2009 (r187876) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -151,6 +152,12 @@ struct sdhci_softc { struct sdhci_slot slots[6]; }; +SYSCTL_NODE(_hw, OID_AUTO, sdhci, CTLFLAG_RD, 0, "sdhci driver"); + +int sdhci_debug; +TUNABLE_INT("hw.sdhci.debug", &sdhci_debug); +SYSCTL_INT(_hw_sdhci, OID_AUTO, debug, CTLFLAG_RW, &sdhci_debug, 0, "Debug level"); + static inline uint8_t RD1(struct sdhci_slot *slot, bus_size_t off) { @@ -734,7 +741,7 @@ sdhci_attach(device_t dev) if (sc->quirks & SDHCI_QUIRK_FORCE_DMA) slot->opt |= SDHCI_HAVE_DMA; - if (bootverbose) { + if (bootverbose || sdhci_debug) { slot_printf(slot, "%uMHz%s 4bits%s%s%s %s\n", slot->max_clk / 1000000, (caps & SDHCI_CAN_DO_HISPD) ? " HS" : "", @@ -1146,17 +1153,10 @@ sdhci_start(struct sdhci_slot *slot) return; } */ - if (req->cmd->error) { - if (bootverbose) { - slot_printf(slot, - "Command error %d (opcode %u arg %u flags %u " - "dlen %u dflags %u)\n", - req->cmd->error, req->cmd->opcode, req->cmd->arg, - req->cmd->flags, - (req->cmd->data)?(u_int)req->cmd->data->len:0, - (req->cmd->data)?(u_int)req->cmd->data->flags:0); - } - } else if (slot->sc->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST) { + if (sdhci_debug > 1) + slot_printf(slot, "result: %d\n", req->cmd->error); + if (!req->cmd->error && + (slot->sc->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST)) { sdhci_reset(slot, SDHCI_RESET_CMD); sdhci_reset(slot, SDHCI_RESET_DATA); } @@ -1177,9 +1177,12 @@ sdhci_request(device_t brdev, device_t r SDHCI_UNLOCK(slot); return (EBUSY); } -/* printf("%s cmd op %u arg %u flags %u data %ju\n", __func__, - req->cmd->opcode, req->cmd->arg, req->cmd->flags, - (req->cmd->data)?req->cmd->data->len:0); */ + if (sdhci_debug > 1) { + slot_printf(slot, "CMD%u arg %#x flags %#x dlen %u dflags %#x\n", + req->cmd->opcode, req->cmd->arg, req->cmd->flags, + (req->cmd->data)?(u_int)req->cmd->data->len:0, + (req->cmd->data)?req->cmd->data->flags:0); + } slot->req = req; slot->flags = 0; sdhci_start(slot); @@ -1363,23 +1366,23 @@ sdhci_intr(void *arg) SDHCI_UNLOCK(slot); continue; } -/* - slot_printf(slot, "got interrupt %x\n", intmask); -*/ + if (sdhci_debug > 2) + slot_printf(slot, "Interrupt %#x\n", intmask); + /* Handle card presence interrupts. */ if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) { WR4(slot, SDHCI_INT_STATUS, intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)); if (intmask & SDHCI_INT_CARD_REMOVE) { - if (bootverbose) + if (bootverbose || sdhci_debug) slot_printf(slot, "Card removed\n"); callout_stop(&slot->card_callout); taskqueue_enqueue(taskqueue_swi_giant, &slot->card_task); } if (intmask & SDHCI_INT_CARD_INSERT) { - if (bootverbose) + if (bootverbose || sdhci_debug) slot_printf(slot, "Card inserted\n"); callout_reset(&slot->card_callout, hz / 2, sdhci_card_delay, slot); From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 23:18:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0249E106566B; Wed, 28 Jan 2009 23:18:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E54828FC1C; Wed, 28 Jan 2009 23:18:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SNIL6A036272; Wed, 28 Jan 2009 23:18:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SNIL8E036271; Wed, 28 Jan 2009 23:18:21 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200901282318.n0SNIL8E036271@svn.freebsd.org> From: Alexander Motin Date: Wed, 28 Jan 2009 23:18:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187877 - head/sys/dev/mmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 23:18:22 -0000 Author: mav Date: Wed Jan 28 23:18:21 2009 New Revision: 187877 URL: http://svn.freebsd.org/changeset/base/187877 Log: Add one more debug level. Modified: head/sys/dev/mmc/mmc.c Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Wed Jan 28 22:53:41 2009 (r187876) +++ head/sys/dev/mmc/mmc.c Wed Jan 28 23:18:21 2009 (r187877) @@ -321,7 +321,7 @@ mmc_wait_for_req(struct mmc_softc *sc, s req->done = mmc_wakeup; req->done_data = sc; - if (mmc_debug) { + if (mmc_debug > 1) { device_printf(sc->dev, "REQUEST: CMD%d arg %#x flags %#x", req->cmd->opcode, req->cmd->arg, req->cmd->flags); if (req->cmd->data) { @@ -334,7 +334,7 @@ mmc_wait_for_req(struct mmc_softc *sc, s while ((req->flags & MMC_REQ_DONE) == 0) msleep(req, &sc->sc_mtx, 0, "mmcreq", 0); MMC_UNLOCK(sc); - if (mmc_debug > 1 || (mmc_debug && req->cmd->error)) + if (mmc_debug > 2 || (mmc_debug > 1 && req->cmd->error)) device_printf(sc->dev, "RESULT: %d\n", req->cmd->error); return (0); } From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 05:28:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E5B71065673; Thu, 29 Jan 2009 05:28:41 +0000 (UTC) (envelope-from grafan@gmail.com) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.188]) by mx1.freebsd.org (Postfix) with ESMTP id A71538FC1B; Thu, 29 Jan 2009 05:28:40 +0000 (UTC) (envelope-from grafan@gmail.com) Received: by fk-out-0910.google.com with SMTP id f40so4410094fka.11 for ; Wed, 28 Jan 2009 21:28:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=dHcEUdWBnqBXZg+VdzvVBsszHlp4eYItyzGn3ldJE4o=; b=ME2kT7whgQe0GjhbmyjYK7EyCu4V+YQL+HYm693AIZB3vDcRXjnPjbAXooTu0v8mtW phhiGlHlmQVYMHtgNh4tTO3TqA2mm7i35rvFFBr6Ildd7qr0hQdQNNoeyJVU3inLJ10U x/28MPlnnzB5f1KBkNEK6/JHfXctCl5dTyGnQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=YciGfqBHHWd90IUxNqIA/aQvZQzkO3+wHSWFSl5FhrtCp3/Mf6Oj7dGP8Mq4Ejs68f Bs30hDsE9YzYloIZijF9Y/clVf/v5atqfJti25Rj0TFD1pV+w9oYw7xIbyQPUoLBs6RB rJ/ZSR02Lf47T/XExLBngWYTEnlX4MJJx0+Nk= MIME-Version: 1.0 Received: by 10.180.218.15 with SMTP id q15mr3181433bkg.194.1233206919645; Wed, 28 Jan 2009 21:28:39 -0800 (PST) In-Reply-To: <87r62nnb7t.fsf@kobe.laptop> References: <200901272013.n0RKDOBR095434@svn.freebsd.org> <6eb82e0901272050l6678ea37idc8ea53e948a15e5@mail.gmail.com> <87r62nnb7t.fsf@kobe.laptop> Date: Thu, 29 Jan 2009 13:28:39 +0800 Message-ID: <6eb82e0901282128o1e38724bsc2dd7a44ebb7de1e@mail.gmail.com> From: Rong-en Fan To: Giorgos Keramidas Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187782 - in head: etc/rc.d share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 05:28:42 -0000 On Wed, Jan 28, 2009 at 3:25 PM, Giorgos Keramidas wrote: > On Wed, 28 Jan 2009 12:50:22 +0800, Rong-en Fan wrote: >> On Wed, Jan 28, 2009 at 4:13 AM, Giorgos Keramidas wrote: >>> Modified: head/etc/rc.d/ntpd >>> ============================================================================== >>> --- head/etc/rc.d/ntpd Tue Jan 27 19:56:38 2009 (r187781) >>> +++ head/etc/rc.d/ntpd Tue Jan 27 20:13:24 2009 (r187782) >>> @@ -23,7 +23,7 @@ ntpd_precmd() >>> rc_flags="-c ${ntpd_config} ${ntpd_flags}" >>> >>> if checkyesno ntpd_sync_on_start; then >>> - rc_flags="-g $rc_flags" >>> + rc_flags="-q -g $rc_flags" >>> fi >>> >>> if [ -z "$ntpd_chrootdir" ]; then >>> >> >> According to ntp(8), -q makes ntpd exits just after the first time the >> clock is set. > > Yes, you are right :) > >> Doesn't this mean if ntpd_sync_on_start is on and the time difference >> is large, then ntpd will exit after the first time sync? Is this the >> behavior we really want? >> >> Shouldn't we keep ntp running after the clock is adjusted? > > This is correct too. The effect of `ntpd_sync_on_start' is supposed to > be the same as if we run `ntpdate' before the real ntpd starts, so this > option only applies to the first sync-once instance of ntpd. The real > ntpd starts later, and finds the clock pre-synced. Hmm... I think I'm confused. According to rc.d/ntpd, if ntpd_sync_on_start is set to yes, it adds '-q -g' to rc_flags. By doing so, ntpd start makes ntpd exists immediately after the first sync. Then, who is responsible to start the "real ntpd" you said above? Thanks, Rong-En Fan From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 05:59:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5131D1065670; Thu, 29 Jan 2009 05:59:43 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3FA2A8FC12; Thu, 29 Jan 2009 05:59:43 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0T5xhOX043648; Thu, 29 Jan 2009 05:59:43 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0T5xhmL043647; Thu, 29 Jan 2009 05:59:43 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200901290559.n0T5xhmL043647@svn.freebsd.org> From: Ed Schouten Date: Thu, 29 Jan 2009 05:59:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187878 - head/sys/dev/adb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 05:59:43 -0000 Author: ed Date: Thu Jan 29 05:59:42 2009 New Revision: 187878 URL: http://svn.freebsd.org/changeset/base/187878 Log: Make adb_mouse use dev2unit() instead of minor(). A real fix would be to migrate it to si_drv0 to store the softc directly, but this is the quickest way to fix it right now. Modified: head/sys/dev/adb/adb_mouse.c Modified: head/sys/dev/adb/adb_mouse.c ============================================================================== --- head/sys/dev/adb/adb_mouse.c Wed Jan 28 23:18:21 2009 (r187877) +++ head/sys/dev/adb/adb_mouse.c Thu Jan 29 05:59:42 2009 (r187878) @@ -46,7 +46,7 @@ #include "adb.h" -#define CDEV_GET_SOFTC(x) devclass_get_softc(adb_mouse_devclass, minor(x) & 0x1f) +#define CDEV_GET_SOFTC(x) devclass_get_softc(adb_mouse_devclass, dev2unit(x) & 0x1f) static int adb_mouse_probe(device_t dev); static int adb_mouse_attach(device_t dev); From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 06:41:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 715F7106564A; Thu, 29 Jan 2009 06:41:13 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id D12F08FC17; Thu, 29 Jan 2009 06:41:12 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from kobe.laptop (adsl7-92.kln.forthnet.gr [77.49.134.92]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id n0T6f2LN016423 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 29 Jan 2009 08:41:08 +0200 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n0T6f24V036915; Thu, 29 Jan 2009 08:41:02 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n0T6f1Ht036914; Thu, 29 Jan 2009 08:41:01 +0200 (EET) (envelope-from keramida@freebsd.org) From: Giorgos Keramidas To: Rong-en Fan References: <200901272013.n0RKDOBR095434@svn.freebsd.org> <6eb82e0901272050l6678ea37idc8ea53e948a15e5@mail.gmail.com> <87r62nnb7t.fsf@kobe.laptop> <6eb82e0901282128o1e38724bsc2dd7a44ebb7de1e@mail.gmail.com> Date: Thu, 29 Jan 2009 08:41:01 +0200 In-Reply-To: <6eb82e0901282128o1e38724bsc2dd7a44ebb7de1e@mail.gmail.com> (Rong-en Fan's message of "Thu, 29 Jan 2009 13:28:39 +0800") Message-ID: <87hc3i8via.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-MailScanner-ID: n0T6f2LN016423 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.509, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL -0.11, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@freebsd.org X-Spam-Status: No Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187782 - in head: etc/rc.d share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 06:41:14 -0000 On Thu, 29 Jan 2009 13:28:39 +0800, Rong-en Fan wrote: >>> Shouldn't we keep ntp running after the clock is adjusted? >> >> This is correct too. The effect of `ntpd_sync_on_start' is supposed to >> be the same as if we run `ntpdate' before the real ntpd starts, so this >> option only applies to the first sync-once instance of ntpd. The real >> ntpd starts later, and finds the clock pre-synced. > > Hmm... I think I'm confused. According to rc.d/ntpd, if ntpd_sync_on_start > is set to yes, it adds '-q -g' to rc_flags. By doing so, ntpd start makes > ntpd exists immediately after the first sync. Then, who is responsible > to start the "real ntpd" you said above? Oops, testing with ntpd_sync_on_start again I think I broke rc.d/ntpd. I thought precmd was run in _addition_ to the start rc command, but it only runs before it and affects the flags of start too. I think I'll back out the change until we the sync on start for real. The folowing seems to work much better, but it shows a duplicate message about `Starting ntpd.' so I have reverted the broken change until I've worked through the patch a bit more: %%% diff -r 0c625c73ecc0 etc/rc.d/ntpd --- a/etc/rc.d/ntpd Wed Jan 28 18:38:39 2009 +0200 +++ b/etc/rc.d/ntpd Thu Jan 29 08:40:43 2009 +0200 @@ -8,29 +8,48 @@ # BEFORE: LOGIN # KEYWORD: nojail shutdown . /etc/rc.subr name=ntpd rcvar=`set_rcvar` command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" start_precmd="ntpd_precmd" +sync_cmd="ntpd_sync" +extra_commands="sync" load_rc_config $name +ntpd_sync() +{ + rc_flags="-c ${ntpd_config} ${ntpd_flags}" + + # Emulate ntpdate by running once and disabling threshold checks. + local _rc_flags_save="${rc_flags}" + local _sync_on_start="${ntpd_sync_on_start}" + + rc_flags="-q -g $rc_flags" + ntpd_sync_on_start="NO" # Avoid recursion in the next `start' + + run_rc_command start + + rc_flags="${_rc_flags_save}" + ntpd_sync_on_start="${_sync_on_start}" +} + ntpd_precmd() { rc_flags="-c ${ntpd_config} ${ntpd_flags}" if checkyesno ntpd_sync_on_start; then - rc_flags="-q -g $rc_flags" + run_rc_command sync fi if [ -z "$ntpd_chrootdir" ]; then return 0; fi # If running in a chroot cage, ensure that the appropriate files # exist inside the cage, as well as helper symlinks into the cage # from outside. # %%% From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 06:43:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5617106566B; Thu, 29 Jan 2009 06:43:29 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93DF28FC0A; Thu, 29 Jan 2009 06:43:29 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0T6hTMg044509; Thu, 29 Jan 2009 06:43:29 GMT (envelope-from keramida@svn.freebsd.org) Received: (from keramida@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0T6hT4B044507; Thu, 29 Jan 2009 06:43:29 GMT (envelope-from keramida@svn.freebsd.org) Message-Id: <200901290643.n0T6hT4B044507@svn.freebsd.org> From: Giorgos Keramidas Date: Thu, 29 Jan 2009 06:43:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187879 - in head: etc/rc.d share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 06:43:30 -0000 Author: keramida (doc committer) Date: Thu Jan 29 06:43:29 2009 New Revision: 187879 URL: http://svn.freebsd.org/changeset/base/187879 Log: Backout change 187782. It inhibits ntpd from starting at all when ntpd_sync_on_start is set. Noticed by: rafan Modified: head/etc/rc.d/ntpd head/share/man/man5/rc.conf.5 Modified: head/etc/rc.d/ntpd ============================================================================== --- head/etc/rc.d/ntpd Thu Jan 29 05:59:42 2009 (r187878) +++ head/etc/rc.d/ntpd Thu Jan 29 06:43:29 2009 (r187879) @@ -23,7 +23,7 @@ ntpd_precmd() rc_flags="-c ${ntpd_config} ${ntpd_flags}" if checkyesno ntpd_sync_on_start; then - rc_flags="-q -g $rc_flags" + rc_flags="-g $rc_flags" fi if [ -z "$ntpd_chrootdir" ]; then Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Thu Jan 29 05:59:42 2009 (r187878) +++ head/share/man/man5/rc.conf.5 Thu Jan 29 06:43:29 2009 (r187879) @@ -2065,16 +2065,12 @@ If set to .Xr ntpd 8 is run with the .Fl g -and -.Fl q -flags, which syncs the system's clock on startup. +flag, which syncs the system's clock on startup. See .Xr ntpd 8 for more information regarding the .Fl g -and -.Fl q -options. +option. This is a preferred alternative to using .Xr ntpdate 8 or specifying the From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 09:22:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27129106564A; Thu, 29 Jan 2009 09:22:57 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 14F898FC17; Thu, 29 Jan 2009 09:22:57 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0T9MvfO047362; Thu, 29 Jan 2009 09:22:57 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0T9MuJ4047351; Thu, 29 Jan 2009 09:22:56 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200901290922.n0T9MuJ4047351@svn.freebsd.org> From: Jeff Roberson Date: Thu, 29 Jan 2009 09:22:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187880 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 09:22:57 -0000 Author: jeff Date: Thu Jan 29 09:22:56 2009 New Revision: 187880 URL: http://svn.freebsd.org/changeset/base/187880 Log: - Allocate apic vectors on a per-cpu basis. This allows us to allocate more irqs as we have more cpus. This is principally useful on systems with msi devices which may want many irqs per-cpu. Discussed with: jhb Sponsored by: Nokia Modified: head/sys/amd64/amd64/io_apic.c head/sys/amd64/amd64/local_apic.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/msi.c head/sys/amd64/include/apicvar.h head/sys/amd64/include/intr_machdep.h head/sys/i386/i386/io_apic.c head/sys/i386/i386/local_apic.c head/sys/i386/i386/mp_machdep.c head/sys/i386/i386/msi.c head/sys/i386/include/apicvar.h head/sys/i386/include/intr_machdep.h Modified: head/sys/amd64/amd64/io_apic.c ============================================================================== --- head/sys/amd64/amd64/io_apic.c Thu Jan 29 06:43:29 2009 (r187879) +++ head/sys/amd64/amd64/io_apic.c Thu Jan 29 09:22:56 2009 (r187880) @@ -327,39 +327,56 @@ ioapic_assign_cpu(struct intsrc *isrc, u { struct ioapic_intsrc *intpin = (struct ioapic_intsrc *)isrc; struct ioapic *io = (struct ioapic *)isrc->is_pic; + u_int old_vector; + u_int old_id; + /* + * keep 1st core as the destination for NMI + */ + if (intpin->io_irq == IRQ_NMI) + apic_id = 0; + + /* + * Set us up to free the old irq. + */ + old_vector = intpin->io_vector; + old_id = intpin->io_cpu; + if (old_vector && apic_id == old_id) + return; + + /* + * Allocate an APIC vector for this interrupt pin. Once + * we have a vector we program the interrupt pin. + */ intpin->io_cpu = apic_id; + intpin->io_vector = apic_alloc_vector(apic_id, intpin->io_irq); if (bootverbose) { - printf("ioapic%u: Assigning ", io->io_id); + printf("ioapic%u: routing intpin %u (", io->io_id, + intpin->io_intpin); ioapic_print_irq(intpin); - printf(" to local APIC %u\n", intpin->io_cpu); + printf(") to lapic %u vector %u\n", intpin->io_cpu, + intpin->io_vector); } ioapic_program_intpin(intpin); + /* + * Free the old vector after the new one is established. This is done + * to prevent races where we could miss an interrupt. + */ + if (old_vector) + apic_free_vector(old_id, old_vector, intpin->io_irq); } static void ioapic_enable_intr(struct intsrc *isrc) { struct ioapic_intsrc *intpin = (struct ioapic_intsrc *)isrc; - struct ioapic *io = (struct ioapic *)isrc->is_pic; - if (intpin->io_vector == 0) { - /* - * Allocate an APIC vector for this interrupt pin. Once - * we have a vector we program the interrupt pin. - */ - intpin->io_vector = apic_alloc_vector(intpin->io_irq); - if (bootverbose) { - printf("ioapic%u: routing intpin %u (", io->io_id, - intpin->io_intpin); - ioapic_print_irq(intpin); - printf(") to vector %u\n", intpin->io_vector); - } - ioapic_program_intpin(intpin); - apic_enable_vector(intpin->io_vector); - } + if (intpin->io_vector == 0) + ioapic_assign_cpu(isrc, pcpu_find(0)->pc_apic_id); + apic_enable_vector(intpin->io_cpu, intpin->io_vector); } + static void ioapic_disable_intr(struct intsrc *isrc) { @@ -369,11 +386,11 @@ ioapic_disable_intr(struct intsrc *isrc) if (intpin->io_vector != 0) { /* Mask this interrupt pin and free its APIC vector. */ vector = intpin->io_vector; - apic_disable_vector(vector); + apic_disable_vector(intpin->io_cpu, vector); intpin->io_masked = 1; intpin->io_vector = 0; ioapic_program_intpin(intpin); - apic_free_vector(vector, intpin->io_irq); + apic_free_vector(intpin->io_cpu, vector, intpin->io_irq); } } Modified: head/sys/amd64/amd64/local_apic.c ============================================================================== --- head/sys/amd64/amd64/local_apic.c Thu Jan 29 06:43:29 2009 (r187879) +++ head/sys/amd64/amd64/local_apic.c Thu Jan 29 09:22:56 2009 (r187880) @@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -109,6 +111,8 @@ struct lapic { u_long la_hard_ticks; u_long la_stat_ticks; u_long la_prof_ticks; + /* Include IDT_SYSCALL to make indexing easier. */ + u_int la_ioint_irqs[APIC_NUM_IOINTS + 1]; } static lapics[MAX_APIC_ID + 1]; /* XXX: should thermal be an NMI? */ @@ -134,8 +138,6 @@ static inthand_t *ioint_handlers[] = { IDTVEC(apic_isr7), /* 224 - 255 */ }; -/* Include IDT_SYSCALL to make indexing easier. */ -static u_int ioint_irqs[APIC_NUM_IOINTS + 1]; static u_int32_t lapic_timer_divisors[] = { APIC_TDCR_1, APIC_TDCR_2, APIC_TDCR_4, APIC_TDCR_8, APIC_TDCR_16, @@ -215,14 +217,12 @@ lapic_init(vm_paddr_t addr) /* Perform basic initialization of the BSP's local APIC. */ lapic_enable(); - ioint_irqs[IDT_SYSCALL - APIC_IO_INTS] = IRQ_SYSCALL; /* Set BSP's per-CPU local APIC ID. */ PCPU_SET(apic_id, lapic_id()); /* Local APIC timer interrupt. */ setidt(APIC_TIMER_INT, IDTVEC(timerint), SDT_SYSIGT, SEL_KPL, 0); - ioint_irqs[APIC_TIMER_INT - APIC_IO_INTS] = IRQ_TIMER; /* XXX: error/thermal interrupts */ } @@ -254,6 +254,9 @@ lapic_create(u_int apic_id, int boot_cpu lapics[apic_id].la_lvts[i] = lvts[i]; lapics[apic_id].la_lvts[i].lvt_active = 0; } + lapics[apic_id].la_ioint_irqs[IDT_SYSCALL - APIC_IO_INTS] = IRQ_SYSCALL; + lapics[apic_id].la_ioint_irqs[APIC_TIMER_INT - APIC_IO_INTS] = + IRQ_TIMER; #ifdef SMP cpu_add(apic_id, boot_cpu); @@ -664,7 +667,8 @@ lapic_handle_intr(int vector, struct tra if (vector == -1) panic("Couldn't get vector from ISR!"); - isrc = intr_lookup_source(apic_idt_to_irq(vector)); + isrc = intr_lookup_source(apic_idt_to_irq(PCPU_GET(apic_id), + vector)); intr_execute_handlers(isrc, frame); } @@ -779,9 +783,19 @@ lapic_timer_enable_intr(void) lapic->lvt_timer = value; } +u_int +apic_cpuid(u_int apic_id) +{ +#ifdef SMP + return apic_cpuids[apic_id]; +#else + return 0; +#endif +} + /* Request a free IDT vector to be used by the specified IRQ. */ u_int -apic_alloc_vector(u_int irq) +apic_alloc_vector(u_int apic_id, u_int irq) { u_int vector; @@ -793,9 +807,9 @@ apic_alloc_vector(u_int irq) */ mtx_lock_spin(&icu_lock); for (vector = 0; vector < APIC_NUM_IOINTS; vector++) { - if (ioint_irqs[vector] != 0) + if (lapics[apic_id].la_ioint_irqs[vector] != 0) continue; - ioint_irqs[vector] = irq; + lapics[apic_id].la_ioint_irqs[vector] = irq; mtx_unlock_spin(&icu_lock); return (vector + APIC_IO_INTS); } @@ -810,7 +824,7 @@ apic_alloc_vector(u_int irq) * satisfied, 0 is returned. */ u_int -apic_alloc_vectors(u_int *irqs, u_int count, u_int align) +apic_alloc_vectors(u_int apic_id, u_int *irqs, u_int count, u_int align) { u_int first, run, vector; @@ -833,7 +847,7 @@ apic_alloc_vectors(u_int *irqs, u_int co for (vector = 0; vector < APIC_NUM_IOINTS; vector++) { /* Vector is in use, end run. */ - if (ioint_irqs[vector] != 0) { + if (lapics[apic_id].la_ioint_irqs[vector] != 0) { run = 0; first = 0; continue; @@ -853,7 +867,8 @@ apic_alloc_vectors(u_int *irqs, u_int co /* Found a run, assign IRQs and return the first vector. */ for (vector = 0; vector < count; vector++) - ioint_irqs[first + vector] = irqs[vector]; + lapics[apic_id].la_ioint_irqs[first + vector] = + irqs[vector]; mtx_unlock_spin(&icu_lock); return (first + APIC_IO_INTS); } @@ -862,8 +877,14 @@ apic_alloc_vectors(u_int *irqs, u_int co return (0); } +/* + * Enable a vector for a particular apic_id. Since all lapics share idt + * entries and ioint_handlers this enables the vector on all lapics. lapics + * which do not have the vector configured would report spurious interrupts + * should it fire. + */ void -apic_enable_vector(u_int vector) +apic_enable_vector(u_int apic_id, u_int vector) { KASSERT(vector != IDT_SYSCALL, ("Attempt to overwrite syscall entry")); @@ -873,7 +894,7 @@ apic_enable_vector(u_int vector) } void -apic_disable_vector(u_int vector) +apic_disable_vector(u_int apic_id, u_int vector) { KASSERT(vector != IDT_SYSCALL, ("Attempt to overwrite syscall entry")); @@ -884,27 +905,42 @@ apic_disable_vector(u_int vector) /* Release an APIC vector when it's no longer in use. */ void -apic_free_vector(u_int vector, u_int irq) +apic_free_vector(u_int apic_id, u_int vector, u_int irq) { + struct thread *td; KASSERT(vector >= APIC_IO_INTS && vector != IDT_SYSCALL && vector <= APIC_IO_INTS + APIC_NUM_IOINTS, ("Vector %u does not map to an IRQ line", vector)); KASSERT(irq < NUM_IO_INTS, ("Invalid IRQ %u", irq)); - KASSERT(ioint_irqs[vector - APIC_IO_INTS] == irq, ("IRQ mismatch")); + KASSERT(lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] == + irq, ("IRQ mismatch")); + + /* + * Bind us to the cpu that owned the vector before freeing it so + * we don't lose an interrupt delivery race. + */ + td = curthread; + thread_lock(td); + if (sched_is_bound(td)) + panic("apic_free_vector: Thread already bound.\n"); + sched_bind(td, apic_cpuid(apic_id)); mtx_lock_spin(&icu_lock); - ioint_irqs[vector - APIC_IO_INTS] = 0; + lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = 0; mtx_unlock_spin(&icu_lock); + sched_unbind(td); + thread_unlock(td); + } /* Map an IDT vector (APIC) to an IRQ (interrupt source). */ u_int -apic_idt_to_irq(u_int vector) +apic_idt_to_irq(u_int apic_id, u_int vector) { KASSERT(vector >= APIC_IO_INTS && vector != IDT_SYSCALL && vector <= APIC_IO_INTS + APIC_NUM_IOINTS, ("Vector %u does not map to an IRQ line", vector)); - return (ioint_irqs[vector - APIC_IO_INTS]); + return (lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS]); } #ifdef DDB @@ -915,6 +951,7 @@ DB_SHOW_COMMAND(apic, db_show_apic) { struct intsrc *isrc; int i, verbose; + u_int apic_id; u_int irq; if (strcmp(modif, "vv") == 0) @@ -923,9 +960,14 @@ DB_SHOW_COMMAND(apic, db_show_apic) verbose = 1; else verbose = 0; - for (i = 0; i < APIC_NUM_IOINTS + 1 && !db_pager_quit; i++) { - irq = ioint_irqs[i]; - if (irq != 0 && irq != IRQ_SYSCALL) { + for (apic_id = 0; apic_id <= MAX_APIC_ID; apic_id++) { + if (lapics[apic_id].la_present == 0) + continue; + db_printf("Interrupts bound to lapic %u\n", apic_id); + for (i = 0; i < APIC_NUM_IOINTS + 1 && !db_pager_quit; i++) { + irq = lapics[apic_id].la_ioint_irqs[i]; + if (irq == 0 || irq == IRQ_SYSCALL) + continue; db_printf("vec 0x%2x -> ", i + APIC_IO_INTS); if (irq == IRQ_TIMER) db_printf("lapic timer\n"); Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Thu Jan 29 06:43:29 2009 (r187879) +++ head/sys/amd64/amd64/mp_machdep.c Thu Jan 29 09:22:56 2009 (r187880) @@ -152,6 +152,7 @@ struct cpu_info { int cpu_disabled:1; } static cpu_info[MAX_APIC_ID + 1]; int cpu_apic_ids[MAXCPU]; +int apic_cpuids[MAX_APIC_ID + 1]; /* Holds pending bitmap based IPIs per CPU */ static volatile u_int cpu_ipi_pending[MAXCPU]; @@ -349,6 +350,7 @@ cpu_mp_start(void) KASSERT(boot_cpu_id == PCPU_GET(apic_id), ("BSP's APIC ID doesn't match boot_cpu_id")); cpu_apic_ids[0] = boot_cpu_id; + apic_cpuids[boot_cpu_id] = 0; assign_cpu_ids(); @@ -656,6 +658,7 @@ assign_cpu_ids(void) if (mp_ncpus < MAXCPU) { cpu_apic_ids[mp_ncpus] = i; + apic_cpuids[i] = mp_ncpus; mp_ncpus++; } else cpu_info[i].cpu_disabled = 1; Modified: head/sys/amd64/amd64/msi.c ============================================================================== --- head/sys/amd64/amd64/msi.c Thu Jan 29 06:43:29 2009 (r187879) +++ head/sys/amd64/amd64/msi.c Thu Jan 29 09:22:56 2009 (r187880) @@ -161,7 +161,9 @@ msi_enable_intr(struct intsrc *isrc) { struct msi_intsrc *msi = (struct msi_intsrc *)isrc; - apic_enable_vector(msi->msi_vector); + if (msi->msi_vector == 0) + msi_assign_cpu(isrc, 0); + apic_enable_vector(msi->msi_cpu, msi->msi_vector); } static void @@ -169,7 +171,7 @@ msi_disable_intr(struct intsrc *isrc) { struct msi_intsrc *msi = (struct msi_intsrc *)isrc; - apic_disable_vector(msi->msi_vector); + apic_disable_vector(msi->msi_cpu, msi->msi_vector); } static int @@ -199,15 +201,35 @@ static void msi_assign_cpu(struct intsrc *isrc, u_int apic_id) { struct msi_intsrc *msi = (struct msi_intsrc *)isrc; - + int old_vector; + u_int old_id; + int vector; + + /* Store information to free existing irq. */ + old_vector = msi->msi_vector; + old_id = msi->msi_cpu; + if (old_vector && old_id == apic_id) + return; + /* Allocate IDT vector on this cpu. */ + vector = apic_alloc_vector(apic_id, msi->msi_irq); + if (vector == 0) + return; /* XXX alloc_vector panics on failure. */ msi->msi_cpu = apic_id; + msi->msi_vector = vector; if (bootverbose) - printf("msi: Assigning %s IRQ %d to local APIC %u\n", + printf("msi: Assigning %s IRQ %d to local APIC %u vector %u\n", msi->msi_msix ? "MSI-X" : "MSI", msi->msi_irq, - msi->msi_cpu); + msi->msi_cpu, msi->msi_vector); pci_remap_msi_irq(msi->msi_dev, msi->msi_irq); + /* + * Free the old vector after the new one is established. This is done + * to prevent races where we could miss an interrupt. + */ + if (old_vector) + apic_free_vector(old_id, old_vector, msi->msi_irq); } + void msi_init(void) { @@ -263,7 +285,7 @@ int msi_alloc(device_t dev, int count, int maxcount, int *irqs) { struct msi_intsrc *msi, *fsrc; - int cnt, i, vector; + int cnt, i; if (!msi_enabled) return (ENXIO); @@ -309,22 +331,12 @@ again: /* Ok, we now have the IRQs allocated. */ KASSERT(cnt == count, ("count mismatch")); - /* Allocate 'count' IDT vectors. */ - vector = apic_alloc_vectors(irqs, count, maxcount); - if (vector == 0) { - mtx_unlock(&msi_lock); - return (ENOSPC); - } - /* Assign IDT vectors and make these messages owned by 'dev'. */ fsrc = (struct msi_intsrc *)intr_lookup_source(irqs[0]); for (i = 0; i < count; i++) { msi = (struct msi_intsrc *)intr_lookup_source(irqs[i]); msi->msi_dev = dev; - msi->msi_vector = vector + i; - if (bootverbose) - printf("msi: routing MSI IRQ %d to vector %u\n", - msi->msi_irq, msi->msi_vector); + msi->msi_vector = 0; msi->msi_first = fsrc; KASSERT(msi->msi_intsrc.is_handlers == 0, ("dead MSI has handlers")); @@ -377,14 +389,18 @@ msi_release(int *irqs, int count) KASSERT(msi->msi_dev == first->msi_dev, ("owner mismatch")); msi->msi_first = NULL; msi->msi_dev = NULL; - apic_free_vector(msi->msi_vector, msi->msi_irq); + if (msi->msi_vector) + apic_free_vector(msi->msi_cpu, msi->msi_vector, + msi->msi_irq); msi->msi_vector = 0; } /* Clear out the first message. */ first->msi_first = NULL; first->msi_dev = NULL; - apic_free_vector(first->msi_vector, first->msi_irq); + if (first->msi_vector) + apic_free_vector(first->msi_cpu, first->msi_vector, + first->msi_irq); first->msi_vector = 0; first->msi_count = 0; @@ -433,7 +449,7 @@ int msix_alloc(device_t dev, int *irq) { struct msi_intsrc *msi; - int i, vector; + int i; if (!msi_enabled) return (ENXIO); @@ -468,15 +484,9 @@ again: goto again; } - /* Allocate an IDT vector. */ - vector = apic_alloc_vector(i); - if (bootverbose) - printf("msi: routing MSI-X IRQ %d to vector %u\n", msi->msi_irq, - vector); - /* Setup source. */ msi->msi_dev = dev; - msi->msi_vector = vector; + msi->msi_vector = 0; msi->msi_msix = 1; KASSERT(msi->msi_intsrc.is_handlers == 0, ("dead MSI-X has handlers")); @@ -508,7 +518,8 @@ msix_release(int irq) /* Clear out the message. */ msi->msi_dev = NULL; - apic_free_vector(msi->msi_vector, msi->msi_irq); + if (msi->msi_vector) + apic_free_vector(msi->msi_cpu, msi->msi_vector, msi->msi_irq); msi->msi_vector = 0; msi->msi_msix = 0; Modified: head/sys/amd64/include/apicvar.h ============================================================================== --- head/sys/amd64/include/apicvar.h Thu Jan 29 06:43:29 2009 (r187879) +++ head/sys/amd64/include/apicvar.h Thu Jan 29 09:22:56 2009 (r187880) @@ -176,14 +176,17 @@ inthand_t IDTVEC(apic_isr7), IDTVEC(spuriousint), IDTVEC(timerint); extern vm_paddr_t lapic_paddr; +extern int apic_cpuids[]; -u_int apic_alloc_vector(u_int irq); -u_int apic_alloc_vectors(u_int *irqs, u_int count, u_int align); -void apic_disable_vector(u_int vector); -void apic_enable_vector(u_int vector); -void apic_free_vector(u_int vector, u_int irq); -u_int apic_idt_to_irq(u_int vector); +u_int apic_alloc_vector(u_int apic_id, u_int irq); +u_int apic_alloc_vectors(u_int apic_id, u_int *irqs, u_int count, + u_int align); +void apic_disable_vector(u_int apic_id, u_int vector); +void apic_enable_vector(u_int apic_id, u_int vector); +void apic_free_vector(u_int apic_id, u_int vector, u_int irq); +u_int apic_idt_to_irq(u_int apic_id, u_int vector); void apic_register_enumerator(struct apic_enumerator *enumerator); +u_int apic_cpuid(u_int apic_id); void *ioapic_create(vm_paddr_t addr, int32_t apic_id, int intbase); int ioapic_disable_pin(void *cookie, u_int pin); int ioapic_get_vector(void *cookie, u_int pin); Modified: head/sys/amd64/include/intr_machdep.h ============================================================================== --- head/sys/amd64/include/intr_machdep.h Thu Jan 29 06:43:29 2009 (r187879) +++ head/sys/amd64/include/intr_machdep.h Thu Jan 29 09:22:56 2009 (r187880) @@ -47,7 +47,7 @@ * IRQ values beyond 256 are used by MSI. We leave 255 unused to avoid * confusion since 255 is used in PCI to indicate an invalid IRQ. */ -#define NUM_MSI_INTS 128 +#define NUM_MSI_INTS 512 #define FIRST_MSI_INT 256 #define NUM_IO_INTS (FIRST_MSI_INT + NUM_MSI_INTS) Modified: head/sys/i386/i386/io_apic.c ============================================================================== --- head/sys/i386/i386/io_apic.c Thu Jan 29 06:43:29 2009 (r187879) +++ head/sys/i386/i386/io_apic.c Thu Jan 29 09:22:56 2009 (r187880) @@ -327,39 +327,56 @@ ioapic_assign_cpu(struct intsrc *isrc, u { struct ioapic_intsrc *intpin = (struct ioapic_intsrc *)isrc; struct ioapic *io = (struct ioapic *)isrc->is_pic; + u_int old_vector; + u_int old_id; + /* + * keep 1st core as the destination for NMI + */ + if (intpin->io_irq == IRQ_NMI) + apic_id = 0; + + /* + * Set us up to free the old irq. + */ + old_vector = intpin->io_vector; + old_id = intpin->io_cpu; + if (old_vector && apic_id == old_id) + return; + + /* + * Allocate an APIC vector for this interrupt pin. Once + * we have a vector we program the interrupt pin. + */ intpin->io_cpu = apic_id; + intpin->io_vector = apic_alloc_vector(apic_id, intpin->io_irq); if (bootverbose) { - printf("ioapic%u: Assigning ", io->io_id); + printf("ioapic%u: routing intpin %u (", io->io_id, + intpin->io_intpin); ioapic_print_irq(intpin); - printf(" to local APIC %u\n", intpin->io_cpu); + printf(") to lapic %u vector %u\n", intpin->io_cpu, + intpin->io_vector); } ioapic_program_intpin(intpin); + /* + * Free the old vector after the new one is established. This is done + * to prevent races where we could miss an interrupt. + */ + if (old_vector) + apic_free_vector(old_id, old_vector, intpin->io_irq); } static void ioapic_enable_intr(struct intsrc *isrc) { struct ioapic_intsrc *intpin = (struct ioapic_intsrc *)isrc; - struct ioapic *io = (struct ioapic *)isrc->is_pic; - if (intpin->io_vector == 0) { - /* - * Allocate an APIC vector for this interrupt pin. Once - * we have a vector we program the interrupt pin. - */ - intpin->io_vector = apic_alloc_vector(intpin->io_irq); - if (bootverbose) { - printf("ioapic%u: routing intpin %u (", io->io_id, - intpin->io_intpin); - ioapic_print_irq(intpin); - printf(") to vector %u\n", intpin->io_vector); - } - ioapic_program_intpin(intpin); - apic_enable_vector(intpin->io_vector); - } + if (intpin->io_vector == 0) + ioapic_assign_cpu(isrc, pcpu_find(0)->pc_apic_id); + apic_enable_vector(intpin->io_cpu, intpin->io_vector); } + static void ioapic_disable_intr(struct intsrc *isrc) { @@ -369,11 +386,11 @@ ioapic_disable_intr(struct intsrc *isrc) if (intpin->io_vector != 0) { /* Mask this interrupt pin and free its APIC vector. */ vector = intpin->io_vector; - apic_disable_vector(vector); + apic_disable_vector(intpin->io_cpu, vector); intpin->io_masked = 1; intpin->io_vector = 0; ioapic_program_intpin(intpin); - apic_free_vector(vector, intpin->io_irq); + apic_free_vector(intpin->io_cpu, vector, intpin->io_irq); } } Modified: head/sys/i386/i386/local_apic.c ============================================================================== --- head/sys/i386/i386/local_apic.c Thu Jan 29 06:43:29 2009 (r187879) +++ head/sys/i386/i386/local_apic.c Thu Jan 29 09:22:56 2009 (r187880) @@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -109,6 +111,8 @@ struct lapic { u_long la_hard_ticks; u_long la_stat_ticks; u_long la_prof_ticks; + /* Include IDT_SYSCALL to make indexing easier. */ + u_int la_ioint_irqs[APIC_NUM_IOINTS + 1]; } static lapics[MAX_APIC_ID + 1]; /* XXX: should thermal be an NMI? */ @@ -134,8 +138,6 @@ static inthand_t *ioint_handlers[] = { IDTVEC(apic_isr7), /* 224 - 255 */ }; -/* Include IDT_SYSCALL to make indexing easier. */ -static u_int ioint_irqs[APIC_NUM_IOINTS + 1]; static u_int32_t lapic_timer_divisors[] = { APIC_TDCR_1, APIC_TDCR_2, APIC_TDCR_4, APIC_TDCR_8, APIC_TDCR_16, @@ -216,7 +218,6 @@ lapic_init(vm_paddr_t addr) /* Perform basic initialization of the BSP's local APIC. */ lapic_enable(); - ioint_irqs[IDT_SYSCALL - APIC_IO_INTS] = IRQ_SYSCALL; /* Set BSP's per-CPU local APIC ID. */ PCPU_SET(apic_id, lapic_id()); @@ -224,7 +225,6 @@ lapic_init(vm_paddr_t addr) /* Local APIC timer interrupt. */ setidt(APIC_TIMER_INT, IDTVEC(timerint), SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); - ioint_irqs[APIC_TIMER_INT - APIC_IO_INTS] = IRQ_TIMER; /* XXX: error/thermal interrupts */ } @@ -256,6 +256,9 @@ lapic_create(u_int apic_id, int boot_cpu lapics[apic_id].la_lvts[i] = lvts[i]; lapics[apic_id].la_lvts[i].lvt_active = 0; } + lapics[apic_id].la_ioint_irqs[IDT_SYSCALL - APIC_IO_INTS] = IRQ_SYSCALL; + lapics[apic_id].la_ioint_irqs[APIC_TIMER_INT - APIC_IO_INTS] = + IRQ_TIMER; #ifdef SMP cpu_add(apic_id, boot_cpu); @@ -666,7 +669,8 @@ lapic_handle_intr(int vector, struct tra if (vector == -1) panic("Couldn't get vector from ISR!"); - isrc = intr_lookup_source(apic_idt_to_irq(vector)); + isrc = intr_lookup_source(apic_idt_to_irq(PCPU_GET(apic_id), + vector)); intr_execute_handlers(isrc, frame); } @@ -781,9 +785,19 @@ lapic_timer_enable_intr(void) lapic->lvt_timer = value; } +u_int +apic_cpuid(u_int apic_id) +{ +#ifdef SMP + return apic_cpuids[apic_id]; +#else + return 0; +#endif +} + /* Request a free IDT vector to be used by the specified IRQ. */ u_int -apic_alloc_vector(u_int irq) +apic_alloc_vector(u_int apic_id, u_int irq) { u_int vector; @@ -795,9 +809,9 @@ apic_alloc_vector(u_int irq) */ mtx_lock_spin(&icu_lock); for (vector = 0; vector < APIC_NUM_IOINTS; vector++) { - if (ioint_irqs[vector] != 0) + if (lapics[apic_id].la_ioint_irqs[vector] != 0) continue; - ioint_irqs[vector] = irq; + lapics[apic_id].la_ioint_irqs[vector] = irq; mtx_unlock_spin(&icu_lock); return (vector + APIC_IO_INTS); } @@ -812,7 +826,7 @@ apic_alloc_vector(u_int irq) * satisfied, 0 is returned. */ u_int -apic_alloc_vectors(u_int *irqs, u_int count, u_int align) +apic_alloc_vectors(u_int apic_id, u_int *irqs, u_int count, u_int align) { u_int first, run, vector; @@ -835,7 +849,7 @@ apic_alloc_vectors(u_int *irqs, u_int co for (vector = 0; vector < APIC_NUM_IOINTS; vector++) { /* Vector is in use, end run. */ - if (ioint_irqs[vector] != 0) { + if (lapics[apic_id].la_ioint_irqs[vector] != 0) { run = 0; first = 0; continue; @@ -855,7 +869,8 @@ apic_alloc_vectors(u_int *irqs, u_int co /* Found a run, assign IRQs and return the first vector. */ for (vector = 0; vector < count; vector++) - ioint_irqs[first + vector] = irqs[vector]; + lapics[apic_id].la_ioint_irqs[first + vector] = + irqs[vector]; mtx_unlock_spin(&icu_lock); return (first + APIC_IO_INTS); } @@ -864,8 +879,14 @@ apic_alloc_vectors(u_int *irqs, u_int co return (0); } +/* + * Enable a vector for a particular apic_id. Since all lapics share idt + * entries and ioint_handlers this enables the vector on all lapics. lapics + * which do not have the vector configured would report spurious interrupts + * should it fire. + */ void -apic_enable_vector(u_int vector) +apic_enable_vector(u_int apic_id, u_int vector) { KASSERT(vector != IDT_SYSCALL, ("Attempt to overwrite syscall entry")); @@ -876,7 +897,7 @@ apic_enable_vector(u_int vector) } void -apic_disable_vector(u_int vector) +apic_disable_vector(u_int apic_id, u_int vector) { KASSERT(vector != IDT_SYSCALL, ("Attempt to overwrite syscall entry")); @@ -888,27 +909,42 @@ apic_disable_vector(u_int vector) /* Release an APIC vector when it's no longer in use. */ void -apic_free_vector(u_int vector, u_int irq) +apic_free_vector(u_int apic_id, u_int vector, u_int irq) { + struct thread *td; KASSERT(vector >= APIC_IO_INTS && vector != IDT_SYSCALL && vector <= APIC_IO_INTS + APIC_NUM_IOINTS, ("Vector %u does not map to an IRQ line", vector)); KASSERT(irq < NUM_IO_INTS, ("Invalid IRQ %u", irq)); - KASSERT(ioint_irqs[vector - APIC_IO_INTS] == irq, ("IRQ mismatch")); + KASSERT(lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] == + irq, ("IRQ mismatch")); + + /* + * Bind us to the cpu that owned the vector before freeing it so + * we don't lose an interrupt delivery race. + */ + td = curthread; + thread_lock(td); + if (sched_is_bound(td)) + panic("apic_free_vector: Thread already bound.\n"); + sched_bind(td, apic_cpuid(apic_id)); mtx_lock_spin(&icu_lock); - ioint_irqs[vector - APIC_IO_INTS] = 0; + lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = 0; mtx_unlock_spin(&icu_lock); + sched_unbind(td); + thread_unlock(td); + } /* Map an IDT vector (APIC) to an IRQ (interrupt source). */ u_int -apic_idt_to_irq(u_int vector) +apic_idt_to_irq(u_int apic_id, u_int vector) { KASSERT(vector >= APIC_IO_INTS && vector != IDT_SYSCALL && vector <= APIC_IO_INTS + APIC_NUM_IOINTS, ("Vector %u does not map to an IRQ line", vector)); - return (ioint_irqs[vector - APIC_IO_INTS]); + return (lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS]); } #ifdef DDB @@ -919,6 +955,7 @@ DB_SHOW_COMMAND(apic, db_show_apic) { struct intsrc *isrc; int i, verbose; + u_int apic_id; u_int irq; if (strcmp(modif, "vv") == 0) @@ -927,9 +964,14 @@ DB_SHOW_COMMAND(apic, db_show_apic) verbose = 1; else verbose = 0; - for (i = 0; i < APIC_NUM_IOINTS + 1 && !db_pager_quit; i++) { - irq = ioint_irqs[i]; - if (irq != 0 && irq != IRQ_SYSCALL) { + for (apic_id = 0; apic_id <= MAX_APIC_ID; apic_id++) { + if (lapics[apic_id].la_present == 0) + continue; + db_printf("Interrupts bound to lapic %u\n", apic_id); + for (i = 0; i < APIC_NUM_IOINTS + 1 && !db_pager_quit; i++) { + irq = lapics[apic_id].la_ioint_irqs[i]; + if (irq == 0 || irq == IRQ_SYSCALL) + continue; db_printf("vec 0x%2x -> ", i + APIC_IO_INTS); if (irq == IRQ_TIMER) db_printf("lapic timer\n"); Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Thu Jan 29 06:43:29 2009 (r187879) +++ head/sys/i386/i386/mp_machdep.c Thu Jan 29 09:22:56 2009 (r187880) @@ -206,6 +206,7 @@ struct cpu_info { int cpu_disabled:1; } static cpu_info[MAX_APIC_ID + 1]; int cpu_apic_ids[MAXCPU]; +int apic_cpuids[MAX_APIC_ID + 1]; /* Holds pending bitmap based IPIs per CPU */ static volatile u_int cpu_ipi_pending[MAXCPU]; @@ -397,6 +398,7 @@ cpu_mp_start(void) KASSERT(boot_cpu_id == PCPU_GET(apic_id), ("BSP's APIC ID doesn't match boot_cpu_id")); cpu_apic_ids[0] = boot_cpu_id; + apic_cpuids[boot_cpu_id] = 0; assign_cpu_ids(); @@ -705,6 +707,7 @@ assign_cpu_ids(void) if (mp_ncpus < MAXCPU) { cpu_apic_ids[mp_ncpus] = i; + apic_cpuids[i] = mp_ncpus; mp_ncpus++; } else cpu_info[i].cpu_disabled = 1; Modified: head/sys/i386/i386/msi.c ============================================================================== --- head/sys/i386/i386/msi.c Thu Jan 29 06:43:29 2009 (r187879) +++ head/sys/i386/i386/msi.c Thu Jan 29 09:22:56 2009 (r187880) @@ -161,7 +161,9 @@ msi_enable_intr(struct intsrc *isrc) { struct msi_intsrc *msi = (struct msi_intsrc *)isrc; - apic_enable_vector(msi->msi_vector); + if (msi->msi_vector == 0) + msi_assign_cpu(isrc, 0); + apic_enable_vector(msi->msi_cpu, msi->msi_vector); } static void @@ -169,7 +171,7 @@ msi_disable_intr(struct intsrc *isrc) { struct msi_intsrc *msi = (struct msi_intsrc *)isrc; - apic_disable_vector(msi->msi_vector); + apic_disable_vector(msi->msi_cpu, msi->msi_vector); } static int @@ -199,15 +201,35 @@ static void msi_assign_cpu(struct intsrc *isrc, u_int apic_id) { struct msi_intsrc *msi = (struct msi_intsrc *)isrc; - + int old_vector; + u_int old_id; + int vector; + + /* Store information to free existing irq. */ + old_vector = msi->msi_vector; + old_id = msi->msi_cpu; + if (old_vector && old_id == apic_id) + return; + /* Allocate IDT vector on this cpu. */ + vector = apic_alloc_vector(apic_id, msi->msi_irq); + if (vector == 0) + return; /* XXX alloc_vector panics on failure. */ msi->msi_cpu = apic_id; + msi->msi_vector = vector; if (bootverbose) - printf("msi: Assigning %s IRQ %d to local APIC %u\n", + printf("msi: Assigning %s IRQ %d to local APIC %u vector %u\n", msi->msi_msix ? "MSI-X" : "MSI", msi->msi_irq, - msi->msi_cpu); + msi->msi_cpu, msi->msi_vector); pci_remap_msi_irq(msi->msi_dev, msi->msi_irq); + /* + * Free the old vector after the new one is established. This is done + * to prevent races where we could miss an interrupt. + */ + if (old_vector) + apic_free_vector(old_id, old_vector, msi->msi_irq); } + void msi_init(void) { @@ -263,7 +285,7 @@ int msi_alloc(device_t dev, int count, int maxcount, int *irqs) { struct msi_intsrc *msi, *fsrc; - int cnt, i, vector; + int cnt, i; if (!msi_enabled) return (ENXIO); @@ -309,22 +331,12 @@ again: /* Ok, we now have the IRQs allocated. */ KASSERT(cnt == count, ("count mismatch")); - /* Allocate 'count' IDT vectors. */ - vector = apic_alloc_vectors(irqs, count, maxcount); - if (vector == 0) { - mtx_unlock(&msi_lock); - return (ENOSPC); - } - /* Assign IDT vectors and make these messages owned by 'dev'. */ fsrc = (struct msi_intsrc *)intr_lookup_source(irqs[0]); for (i = 0; i < count; i++) { msi = (struct msi_intsrc *)intr_lookup_source(irqs[i]); msi->msi_dev = dev; - msi->msi_vector = vector + i; - if (bootverbose) - printf("msi: routing MSI IRQ %d to vector %u\n", - msi->msi_irq, msi->msi_vector); + msi->msi_vector = 0; msi->msi_first = fsrc; KASSERT(msi->msi_intsrc.is_handlers == 0, ("dead MSI has handlers")); @@ -377,14 +389,18 @@ msi_release(int *irqs, int count) KASSERT(msi->msi_dev == first->msi_dev, ("owner mismatch")); msi->msi_first = NULL; msi->msi_dev = NULL; - apic_free_vector(msi->msi_vector, msi->msi_irq); + if (msi->msi_vector) + apic_free_vector(msi->msi_cpu, msi->msi_vector, + msi->msi_irq); msi->msi_vector = 0; } /* Clear out the first message. */ first->msi_first = NULL; first->msi_dev = NULL; - apic_free_vector(first->msi_vector, first->msi_irq); + if (first->msi_vector) + apic_free_vector(first->msi_cpu, first->msi_vector, + first->msi_irq); first->msi_vector = 0; first->msi_count = 0; @@ -433,7 +449,7 @@ int msix_alloc(device_t dev, int *irq) { struct msi_intsrc *msi; - int i, vector; + int i; if (!msi_enabled) return (ENXIO); @@ -468,15 +484,9 @@ again: goto again; } - /* Allocate an IDT vector. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 09:32:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DB3C106564A; Thu, 29 Jan 2009 09:32:57 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D6F68FC14; Thu, 29 Jan 2009 09:32:57 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0T9WuVH047586; Thu, 29 Jan 2009 09:32:56 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0T9WuMb047585; Thu, 29 Jan 2009 09:32:56 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200901290932.n0T9WuMb047585@svn.freebsd.org> From: Robert Watson Date: Thu, 29 Jan 2009 09:32:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187881 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 09:32:57 -0000 Author: rwatson Date: Thu Jan 29 09:32:56 2009 New Revision: 187881 URL: http://svn.freebsd.org/changeset/base/187881 Log: If a process is a zombie and we couldn't identify another useful state, print out the state as "zombine" in preference to "unknown" when ^T is pressed. MFC after: 3 days Sponsored by: Google, Inc. Modified: head/sys/kern/tty_info.c Modified: head/sys/kern/tty_info.c ============================================================================== --- head/sys/kern/tty_info.c Thu Jan 29 09:22:56 2009 (r187880) +++ head/sys/kern/tty_info.c Thu Jan 29 09:32:56 2009 (r187881) @@ -285,6 +285,8 @@ tty_info(struct tty *tp) state = "suspended"; else if (TD_AWAITING_INTR(td)) state = "intrwait"; + else if (pick->p_state == PRS_ZOMBIE) + state = "zombie"; else state = "unknown"; pctcpu = (sched_pctcpu(td) * 10000 + FSCALE / 2) >> FSHIFT; From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 16:18:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46F2B1065673; Thu, 29 Jan 2009 16:18:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 357B18FC14; Thu, 29 Jan 2009 16:18:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0TGIoXj058185; Thu, 29 Jan 2009 16:18:50 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0TGIo64058184; Thu, 29 Jan 2009 16:18:50 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200901291618.n0TGIo64058184@svn.freebsd.org> From: John Baldwin Date: Thu, 29 Jan 2009 16:18:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187893 - head/sys/dev/adb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 16:18:50 -0000 Author: jhb Date: Thu Jan 29 16:18:49 2009 New Revision: 187893 URL: http://svn.freebsd.org/changeset/base/187893 Log: Use si_drv1 to hold the softc for the adb_mouse character device instead of using devclass_get_softc(). Tested by: nwhitehorn Modified: head/sys/dev/adb/adb_mouse.c Modified: head/sys/dev/adb/adb_mouse.c ============================================================================== --- head/sys/dev/adb/adb_mouse.c Thu Jan 29 11:38:28 2009 (r187892) +++ head/sys/dev/adb/adb_mouse.c Thu Jan 29 16:18:49 2009 (r187893) @@ -46,7 +46,7 @@ #include "adb.h" -#define CDEV_GET_SOFTC(x) devclass_get_softc(adb_mouse_devclass, dev2unit(x) & 0x1f) +#define CDEV_GET_SOFTC(x) (x)->si_drv1 static int adb_mouse_probe(device_t dev); static int adb_mouse_attach(device_t dev); @@ -236,6 +236,7 @@ adb_mouse_attach(device_t dev) sc->cdev = make_dev(&ams_cdevsw, device_get_unit(dev), UID_ROOT, GID_OPERATOR, 0644, "ams%d", device_get_unit(dev)); + sc->cdev->si_drv1 = sc; adb_set_autopoll(dev,1); From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 16:47:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B90C2106568F; Thu, 29 Jan 2009 16:47:15 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A7C1D8FC18; Thu, 29 Jan 2009 16:47:15 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0TGlFR3058777; Thu, 29 Jan 2009 16:47:15 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0TGlFHZ058776; Thu, 29 Jan 2009 16:47:15 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200901291647.n0TGlFHZ058776@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 29 Jan 2009 16:47:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187894 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 16:47:16 -0000 Author: trasz Date: Thu Jan 29 16:47:15 2009 New Revision: 187894 URL: http://svn.freebsd.org/changeset/base/187894 Log: 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: head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Thu Jan 29 16:18:49 2009 (r187893) +++ head/sys/ufs/ffs/ffs_vfsops.c Thu Jan 29 16:47:15 2009 (r187894) @@ -641,6 +641,7 @@ ffs_mountfs(devvp, mp, td) VOP_UNLOCK(devvp, 0); 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 = NULL; } + 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 owner-svn-src-head@FreeBSD.ORG Thu Jan 29 16:51:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7558106564A; Thu, 29 Jan 2009 16:51:09 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5B1E8FC12; Thu, 29 Jan 2009 16:51:09 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0TGp9YY058880; Thu, 29 Jan 2009 16:51:09 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0TGp9NU058879; Thu, 29 Jan 2009 16:51:09 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200901291651.n0TGp9NU058879@svn.freebsd.org> From: Roman Divacky Date: Thu, 29 Jan 2009 16:51:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187895 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 16:51:10 -0000 Author: rdivacky Date: Thu Jan 29 16:51:09 2009 New Revision: 187895 URL: http://svn.freebsd.org/changeset/base/187895 Log: Define NULL to be __null in a case of gnu c++. This makes sentinel attribute work ok in C++. Note that we enable this only for gcc 4.x for any value of x. The __null was introduced in gcc 4.1 (in fact it was commited 12 days after release of gcc 4.0) and as we have never released any version of FreeBSD with gcc 4.0 nor ports support gcc 4.0.x this is a safe check. Using __GNUC_PREREQ__ would require us to include cdefs.h in params.h so we just check __GNUC__. Approved by: kib (mentor) Tested by: exp build of ports (done by pav) Tested by: make universe (done by me) Modified: head/sys/sys/_null.h Modified: head/sys/sys/_null.h ============================================================================== --- head/sys/sys/_null.h Thu Jan 29 16:47:15 2009 (r187894) +++ head/sys/sys/_null.h Thu Jan 29 16:51:09 2009 (r187895) @@ -31,11 +31,15 @@ #if defined(_KERNEL) || !defined(__cplusplus) #define NULL ((void *)0) #else +#if defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4 +#define NULL __null +#else #if defined(__LP64__) #define NULL (0L) #else #define NULL 0 #endif /* __LP64__ */ +#endif /* __GNUG__ */ #endif /* _KERNEL || !__cplusplus */ #endif From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 18:11:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B22C8106566C; Thu, 29 Jan 2009 18:11:42 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 83B8C8FC14; Thu, 29 Jan 2009 18:11:42 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id 1D88946BA4; Thu, 29 Jan 2009 13:11:42 -0500 (EST) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n0TIBat6008136; Thu, 29 Jan 2009 13:11:36 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Edward Tomasz Napierala Date: Thu, 29 Jan 2009 12:09:13 -0500 User-Agent: KMail/1.9.7 References: <200901291647.n0TGlFHZ058776@svn.freebsd.org> In-Reply-To: <200901291647.n0TGlFHZ058776@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901291209.14313.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Thu, 29 Jan 2009 13:11:36 -0500 (EST) X-Virus-Scanned: ClamAV 0.94.2/8919/Thu Jan 29 08:05:38 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187894 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 18:11:43 -0000 On Thursday 29 January 2009 11:47:15 am Edward Tomasz Napierala wrote: > Author: trasz > Date: Thu Jan 29 16:47:15 2009 > New Revision: 187894 > URL: http://svn.freebsd.org/changeset/base/187894 > > Log: > 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 Is this applicable to all filesystems? I'm curious why the VREF() on the vnode associated with the cdev entry (um_devvp) is not sufficient to prevent this? I would have thought that the vnode would have held a reference on the cdev. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 18:15:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F08B10656D9; Thu, 29 Jan 2009 18:15:29 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 1ED458FC13; Thu, 29 Jan 2009 18:15:28 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1LSbQF-000Ie8-Fv; Thu, 29 Jan 2009 20:15:27 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n0TIFO12030509 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 29 Jan 2009 20:15:24 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n0TIFNaN002536; Thu, 29 Jan 2009 20:15:23 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n0TIFNbI002535; Thu, 29 Jan 2009 20:15:23 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 29 Jan 2009 20:15:23 +0200 From: Kostik Belousov To: John Baldwin Message-ID: <20090129181523.GA2471@deviant.kiev.zoral.com.ua> References: <200901291647.n0TGlFHZ058776@svn.freebsd.org> <200901291209.14313.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OgqxwSJOaUobr8KG" Content-Disposition: inline In-Reply-To: <200901291209.14313.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1LSbQF-000Ie8-Fv 32e890d7015aa2f89ca451f8532387ca X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Edward Tomasz Napierala Subject: Re: svn commit: r187894 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 18:15:30 -0000 --OgqxwSJOaUobr8KG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 29, 2009 at 12:09:13PM -0500, John Baldwin wrote: > On Thursday 29 January 2009 11:47:15 am Edward Tomasz Napierala wrote: > > Author: trasz > > Date: Thu Jan 29 16:47:15 2009 > > New Revision: 187894 > > URL: http://svn.freebsd.org/changeset/base/187894 > >=20 > > Log: > > Make sure the cdev doesn't go away while the filesystem is still moun= ted. > > Otherwise dev2udev() could return garbage. > > =20 > > Reviewed by: kib > > Approved by: rwatson (mentor) > > Sponsored by: FreeBSD Foundation >=20 > Is this applicable to all filesystems? I'm curious why the VREF() on the= =20 > vnode associated with the cdev entry (um_devvp) is not sufficient to prev= ent=20 > this? I would have thought that the vnode would have held a reference on= the=20 > cdev. The point of this commit is that devvp vnode may be reclaimed. --OgqxwSJOaUobr8KG Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkmB8jkACgkQC3+MBN1Mb4jNegCfTz/8Vr2bHIQNhF+2/FLG75/s PMQAoKMsGUmxwoV/3p8tB0AdzcBZ9Ecd =OZ25 -----END PGP SIGNATURE----- --OgqxwSJOaUobr8KG-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 18:23:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4380106566B; Thu, 29 Jan 2009 18:23:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 82B588FC20; Thu, 29 Jan 2009 18:23:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1LSbYS-000M5W-C1; Thu, 29 Jan 2009 20:23:56 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n0TINrDT030944 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 29 Jan 2009 20:23:53 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n0TINrRC011940; Thu, 29 Jan 2009 20:23:53 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n0TINrJ2011933; Thu, 29 Jan 2009 20:23:53 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 29 Jan 2009 20:23:53 +0200 From: Kostik Belousov To: Edward Tomasz Napierala Message-ID: <20090129182353.GB2471@deviant.kiev.zoral.com.ua> References: <200901291647.n0TGlFHZ058776@svn.freebsd.org> <200901291209.14313.jhb@freebsd.org> <20090129181523.GA2471@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jho1yZJdad60DJr+" Content-Disposition: inline In-Reply-To: <20090129181523.GA2471@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1LSbYS-000M5W-C1 aee12a121a856b71958df9fd447d0ad1 X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r187894 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 18:23:58 -0000 --jho1yZJdad60DJr+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 29, 2009 at 08:15:23PM +0200, Kostik Belousov wrote: > On Thu, Jan 29, 2009 at 12:09:13PM -0500, John Baldwin wrote: > > On Thursday 29 January 2009 11:47:15 am Edward Tomasz Napierala wrote: > > > Author: trasz > > > Date: Thu Jan 29 16:47:15 2009 > > > New Revision: 187894 > > > URL: http://svn.freebsd.org/changeset/base/187894 > > >=20 > > > Log: > > > Make sure the cdev doesn't go away while the filesystem is still mo= unted. > > > Otherwise dev2udev() could return garbage. > > > =20 > > > Reviewed by: kib > > > Approved by: rwatson (mentor) > > > Sponsored by: FreeBSD Foundation > >=20 > > Is this applicable to all filesystems? I'm curious why the VREF() on t= he=20 > > vnode associated with the cdev entry (um_devvp) is not sufficient to pr= event=20 > > this? I would have thought that the vnode would have held a reference = on the=20 > > cdev. >=20 > The point of this commit is that devvp vnode may be reclaimed. And, in fact, it may be clearer to get the ref while devvp is still locked. I do not think that this is important because mount would fail immediately later when it tries to read from device, but still. --jho1yZJdad60DJr+ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkmB9DgACgkQC3+MBN1Mb4hO0QCfVXn+xfLy193uUXlkorE3GDZ6 hLMAoPFMaoWo7Ckcs/vwnSYpnbiWpVN8 =Vmso -----END PGP SIGNATURE----- --jho1yZJdad60DJr+-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 18:44:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 552191065670; Thu, 29 Jan 2009 18:44:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 248828FC1B; Thu, 29 Jan 2009 18:44:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id BCB9B46B52; Thu, 29 Jan 2009 13:44:07 -0500 (EST) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n0TIi1ia008322; Thu, 29 Jan 2009 13:44:02 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Kostik Belousov Date: Thu, 29 Jan 2009 13:43:54 -0500 User-Agent: KMail/1.9.7 References: <200901291647.n0TGlFHZ058776@svn.freebsd.org> <200901291209.14313.jhb@freebsd.org> <20090129181523.GA2471@deviant.kiev.zoral.com.ua> In-Reply-To: <20090129181523.GA2471@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901291343.55485.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Thu, 29 Jan 2009 13:44:02 -0500 (EST) X-Virus-Scanned: ClamAV 0.94.2/8919/Thu Jan 29 08:05:38 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Edward Tomasz Napierala Subject: Re: svn commit: r187894 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 18:44:08 -0000 On Thursday 29 January 2009 1:15:23 pm Kostik Belousov wrote: > On Thu, Jan 29, 2009 at 12:09:13PM -0500, John Baldwin wrote: > > On Thursday 29 January 2009 11:47:15 am Edward Tomasz Napierala wrote: > > > Author: trasz > > > Date: Thu Jan 29 16:47:15 2009 > > > New Revision: 187894 > > > URL: http://svn.freebsd.org/changeset/base/187894 > > > > > > Log: > > > 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 > > > > Is this applicable to all filesystems? I'm curious why the VREF() on the > > vnode associated with the cdev entry (um_devvp) is not sufficient to prevent > > this? I would have thought that the vnode would have held a reference on the > > cdev. > > The point of this commit is that devvp vnode may be reclaimed. So do all filesystems need this change then? -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 20:34:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33F3D1065679; Thu, 29 Jan 2009 20:34:28 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id C3EC28FC24; Thu, 29 Jan 2009 20:34:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1LSdaj-00026E-MW; Thu, 29 Jan 2009 22:34:25 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n0TKYMwJ038787 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 29 Jan 2009 22:34:22 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n0TKYMGe072894; Thu, 29 Jan 2009 22:34:22 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n0TKYMeA072810; Thu, 29 Jan 2009 22:34:22 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 29 Jan 2009 22:34:22 +0200 From: Kostik Belousov To: John Baldwin Message-ID: <20090129203422.GA1906@deviant.kiev.zoral.com.ua> References: <200901291647.n0TGlFHZ058776@svn.freebsd.org> <200901291209.14313.jhb@freebsd.org> <20090129181523.GA2471@deviant.kiev.zoral.com.ua> <200901291343.55485.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="82I3+IH0IqGh5yIs" Content-Disposition: inline In-Reply-To: <200901291343.55485.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1LSdaj-00026E-MW 06130a34160acc485ef460ae9c893c48 X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Edward Tomasz Napierala Subject: Re: svn commit: r187894 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 20:34:28 -0000 --82I3+IH0IqGh5yIs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 29, 2009 at 01:43:54PM -0500, John Baldwin wrote: > On Thursday 29 January 2009 1:15:23 pm Kostik Belousov wrote: > > On Thu, Jan 29, 2009 at 12:09:13PM -0500, John Baldwin wrote: > > > On Thursday 29 January 2009 11:47:15 am Edward Tomasz Napierala wrote: > > > > Author: trasz > > > > Date: Thu Jan 29 16:47:15 2009 > > > > New Revision: 187894 > > > > URL: http://svn.freebsd.org/changeset/base/187894 > > > >=20 > > > > Log: > > > > Make sure the cdev doesn't go away while the filesystem is still= =20 > mounted. > > > > Otherwise dev2udev() could return garbage. > > > > =20 > > > > Reviewed by: kib > > > > Approved by: rwatson (mentor) > > > > Sponsored by: FreeBSD Foundation > > >=20 > > > Is this applicable to all filesystems? I'm curious why the VREF() on= the=20 > > > vnode associated with the cdev entry (um_devvp) is not sufficient to= =20 > prevent=20 > > > this? I would have thought that the vnode would have held a referenc= e on=20 > the=20 > > > cdev. > >=20 > > The point of this commit is that devvp vnode may be reclaimed. >=20 > So do all filesystems need this change then? I briefly looked over cd9660. It caches the cdev in the im_dev member of its mount structure, that is consequently used as an argument to dev2udev() in cd9660_getattr(). I think that typical answer to your question is "yes". --82I3+IH0IqGh5yIs Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkmCEswACgkQC3+MBN1Mb4jHbACfWS/CFL1Rz/J4Jz8L6vHmVYy+ QlcAoMN5Dq5qy/pxXxzlBLwhLXRSw0rL =1MuM -----END PGP SIGNATURE----- --82I3+IH0IqGh5yIs-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 23:09:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18E1C1065673; Thu, 29 Jan 2009 23:09:13 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0765B8FC19; Thu, 29 Jan 2009 23:09:13 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0TN9CEk067649; Thu, 29 Jan 2009 23:09:12 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0TN9CGi067648; Thu, 29 Jan 2009 23:09:12 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901292309.n0TN9CGi067648@svn.freebsd.org> From: Sam Leffler Date: Thu, 29 Jan 2009 23:09:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187897 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 23:09:13 -0000 Author: sam Date: Thu Jan 29 23:09:12 2009 New Revision: 187897 URL: http://svn.freebsd.org/changeset/base/187897 Log: setup default rate set for static turbo mode Modified: head/sys/net80211/ieee80211.c Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Thu Jan 29 18:33:46 2009 (r187896) +++ head/sys/net80211/ieee80211.c Thu Jan 29 23:09:12 2009 (r187897) @@ -184,6 +184,7 @@ ieee80211_chan_init(struct ieee80211com DEFAULTRATES(IEEE80211_MODE_11A, ieee80211_rateset_11a); DEFAULTRATES(IEEE80211_MODE_TURBO_A, ieee80211_rateset_11a); DEFAULTRATES(IEEE80211_MODE_TURBO_G, ieee80211_rateset_11g); + DEFAULTRATES(IEEE80211_MODE_STURBO_A, ieee80211_rateset_11a); /* * Set auto mode to reset active channel state and any desired channel. From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 23:11:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9E8A10656D0; Thu, 29 Jan 2009 23:11:18 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96CFB8FC27; Thu, 29 Jan 2009 23:11:18 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0TNBIr1067733; Thu, 29 Jan 2009 23:11:18 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0TNBI5Q067732; Thu, 29 Jan 2009 23:11:18 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901292311.n0TNBI5Q067732@svn.freebsd.org> From: Sam Leffler Date: Thu, 29 Jan 2009 23:11:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187898 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 23:11:20 -0000 Author: sam Date: Thu Jan 29 23:11:18 2009 New Revision: 187898 URL: http://svn.freebsd.org/changeset/base/187898 Log: set ni_txparms for static turbo mode Modified: head/sys/net80211/ieee80211_node.c Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Thu Jan 29 23:09:12 2009 (r187897) +++ head/sys/net80211/ieee80211_node.c Thu Jan 29 23:11:18 2009 (r187898) @@ -227,20 +227,25 @@ static void node_setuptxparms(struct ieee80211_node *ni) { struct ieee80211vap *vap = ni->ni_vap; + enum ieee80211_phymode mode; if (ni->ni_flags & IEEE80211_NODE_HT) { if (IEEE80211_IS_CHAN_5GHZ(ni->ni_chan)) - ni->ni_txparms = &vap->iv_txparms[IEEE80211_MODE_11NA]; + mode = IEEE80211_MODE_11NA; else - ni->ni_txparms = &vap->iv_txparms[IEEE80211_MODE_11NG]; + mode = IEEE80211_MODE_11NG; } else { /* legacy rate handling */ - if (IEEE80211_IS_CHAN_A(ni->ni_chan)) - ni->ni_txparms = &vap->iv_txparms[IEEE80211_MODE_11A]; + /* NB: 108A/108G should be handled as 11a/11g respectively */ + if (IEEE80211_IS_CHAN_ST(ni->ni_chan)) + mode = IEEE80211_MODE_STURBO_A; + else if (IEEE80211_IS_CHAN_A(ni->ni_chan)) + mode = IEEE80211_MODE_11A; else if (ni->ni_flags & IEEE80211_NODE_ERP) - ni->ni_txparms = &vap->iv_txparms[IEEE80211_MODE_11G]; + mode = IEEE80211_MODE_11G; else - ni->ni_txparms = &vap->iv_txparms[IEEE80211_MODE_11B]; + mode = IEEE80211_MODE_11B; } + ni->ni_txparms = &vap->iv_txparms[mode]; } /* From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 23:12:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A7D51065718; Thu, 29 Jan 2009 23:12:07 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E0EA18FC0C; Thu, 29 Jan 2009 23:12:06 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0TNC6bf067783; Thu, 29 Jan 2009 23:12:06 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0TNC6So067782; Thu, 29 Jan 2009 23:12:06 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901292312.n0TNC6So067782@svn.freebsd.org> From: Sam Leffler Date: Thu, 29 Jan 2009 23:12:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187899 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 23:12:08 -0000 Author: sam Date: Thu Jan 29 23:12:06 2009 New Revision: 187899 URL: http://svn.freebsd.org/changeset/base/187899 Log: setup default fixed rates for static turbo and 11n; the 11n rates are pure guess Modified: head/sys/net80211/ieee80211_tdma.c Modified: head/sys/net80211/ieee80211_tdma.c ============================================================================== --- head/sys/net80211/ieee80211_tdma.c Thu Jan 29 23:11:18 2009 (r187898) +++ head/sys/net80211/ieee80211_tdma.c Thu Jan 29 23:12:06 2009 (r187899) @@ -79,6 +79,15 @@ __FBSDID("$FreeBSD$"); #ifndef TDMA_TXRATE_11A_DEFAULT #define TDMA_TXRATE_11A_DEFAULT 2*24 #endif +#ifndef TDMA_TXRATE_STURBO_A_DEFAULT +#define TDMA_TXRATE_STURBO_A_DEFAULT 2*24 +#endif +#ifndef TDMA_TXRATE_11NA_DEFAULT +#define TDMA_TXRATE_11NA_DEFAULT (4 | IEEE80211_RATE_MCS) +#endif +#ifndef TDMA_TXRATE_11NG_DEFAULT +#define TDMA_TXRATE_11NG_DEFAULT (4 | IEEE80211_RATE_MCS) +#endif static void tdma_vdetach(struct ieee80211vap *vap); static int tdma_newstate(struct ieee80211vap *, enum ieee80211_state, int); @@ -92,6 +101,13 @@ static int tdma_process_params(struct ie const u_int8_t *ie, u_int32_t rstamp, const struct ieee80211_frame *wh); static void +settxparms(struct ieee80211vap *vap, enum ieee80211_phymode mode, int rate) +{ + vap->iv_txparms[mode].ucastrate = rate; + vap->iv_txparms[mode].mcastrate = rate; +} + +static void setackpolicy(struct ieee80211com *ic, int noack) { struct ieee80211_wme_state *wme = &ic->ic_wme; @@ -126,12 +142,12 @@ ieee80211_tdma_vattach(struct ieee80211v ts->tdma_slot = 1; /* passive operation */ /* setup default fixed rates */ - vap->iv_txparms[IEEE80211_MODE_11B].ucastrate = TDMA_TXRATE_11B_DEFAULT; - vap->iv_txparms[IEEE80211_MODE_11B].mcastrate = TDMA_TXRATE_11B_DEFAULT; - vap->iv_txparms[IEEE80211_MODE_11G].ucastrate = TDMA_TXRATE_11G_DEFAULT; - vap->iv_txparms[IEEE80211_MODE_11G].mcastrate = TDMA_TXRATE_11G_DEFAULT; - vap->iv_txparms[IEEE80211_MODE_11A].ucastrate = TDMA_TXRATE_11A_DEFAULT; - vap->iv_txparms[IEEE80211_MODE_11A].mcastrate = TDMA_TXRATE_11A_DEFAULT; + settxparms(vap, IEEE80211_MODE_11A, TDMA_TXRATE_11A_DEFAULT); + settxparms(vap, IEEE80211_MODE_11B, TDMA_TXRATE_11B_DEFAULT); + settxparms(vap, IEEE80211_MODE_11G, TDMA_TXRATE_11G_DEFAULT); + settxparms(vap, IEEE80211_MODE_STURBO_A, TDMA_TXRATE_STURBO_A_DEFAULT); + settxparms(vap, IEEE80211_MODE_11NA, TDMA_TXRATE_11NA_DEFAULT); + settxparms(vap, IEEE80211_MODE_11NG, TDMA_TXRATE_11NG_DEFAULT); setackpolicy(vap->iv_ic, 1); /* disable ACK's */ From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 23:24:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F885106564A; Thu, 29 Jan 2009 23:24:22 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1BAC48FC0A; Thu, 29 Jan 2009 23:24:22 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0TNOM3E068253; Thu, 29 Jan 2009 23:24:22 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0TNOM2i068251; Thu, 29 Jan 2009 23:24:22 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901292324.n0TNOM2i068251@svn.freebsd.org> From: Sam Leffler Date: Thu, 29 Jan 2009 23:24:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187904 - head/tools/tools/ath/athrd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 23:24:22 -0000 Author: sam Date: Thu Jan 29 23:24:21 2009 New Revision: 187904 URL: http://svn.freebsd.org/changeset/base/187904 Log: update for hal changes Modified: head/tools/tools/ath/athrd/athrd.1 head/tools/tools/ath/athrd/athrd.c Modified: head/tools/tools/ath/athrd/athrd.1 ============================================================================== --- head/tools/tools/ath/athrd/athrd.1 Thu Jan 29 23:22:32 2009 (r187903) +++ head/tools/tools/ath/athrd/athrd.1 Thu Jan 29 23:24:21 2009 (r187904) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd January 15, 2009 +.Dd January 27, 2009 .Dt ATHRD 1 .Os .Sh NAME @@ -36,7 +36,7 @@ .Nd list channels and transmit power for a country/regulatory domain .Sh SYNOPSIS .Nm -.Op Fl aioedlpcfr4ABGT +.Op Fl aedlpcfr4ABGT .Op Fl m Ar mode .Bk .Op Ar country @@ -61,10 +61,6 @@ use as G channels and similary for A and With this option .Nm will list all channels. -.It Fl i -Calculate channels based on indoor use. -.It Fl o -Calculate channels based on outdoor use (default). .It Fl e Calculate channels not assuming extended channel mode. .It Fl d Modified: head/tools/tools/ath/athrd/athrd.c ============================================================================== --- head/tools/tools/ath/athrd/athrd.c Thu Jan 29 23:22:32 2009 (r187903) +++ head/tools/tools/ath/athrd/athrd.c Thu Jan 29 23:24:21 2009 (r187904) @@ -31,6 +31,10 @@ #include "opt_ah.h" #include "ah.h" + +#include +#include + #include "ah_internal.h" #include "ah_eeprom_v3.h" /* XXX */ @@ -40,13 +44,9 @@ #include #include -#define IEEE80211_CHAN_MAX 255 -#define IEEE80211_REGCLASSIDS_MAX 10 - int ath_hal_debug = 0; HAL_CTRY_CODE cc = CTRY_DEFAULT; HAL_REG_DOMAIN rd = 169; /* FCC */ -HAL_BOOL outdoor = AH_TRUE; HAL_BOOL Amode = 1; HAL_BOOL Bmode = 1; HAL_BOOL Gmode = 1; @@ -169,12 +169,12 @@ getChannelEdges(struct ath_hal *ah, u_in struct ath_hal_private *ahp = AH_PRIVATE(ah); HAL_CAPABILITIES *pCap = &ahp->ah_caps; - if (flags & CHANNEL_5GHZ) { + if (flags & IEEE80211_CHAN_5GHZ) { *low = pCap->halLow5GhzChan; *high = pCap->halHigh5GhzChan; return AH_TRUE; } - if (flags & CHANNEL_2GHZ) { + if (flags & IEEE80211_CHAN_2GHZ) { *low = pCap->halLow2GhzChan; *high = pCap->halHigh2GhzChan; return AH_TRUE; @@ -208,158 +208,6 @@ getWirelessModes(struct ath_hal *ah) return mode; } -/* - * Country/Region Codes from MS WINNLS.H - * Numbering from ISO 3166 - */ -enum CountryCode { - CTRY_ALBANIA = 8, /* Albania */ - CTRY_ALGERIA = 12, /* Algeria */ - CTRY_ARGENTINA = 32, /* Argentina */ - CTRY_ARMENIA = 51, /* Armenia */ - CTRY_AUSTRALIA = 36, /* Australia */ - CTRY_AUSTRIA = 40, /* Austria */ - CTRY_AZERBAIJAN = 31, /* Azerbaijan */ - CTRY_BAHRAIN = 48, /* Bahrain */ - CTRY_BELARUS = 112, /* Belarus */ - CTRY_BELGIUM = 56, /* Belgium */ - CTRY_BELIZE = 84, /* Belize */ - CTRY_BOLIVIA = 68, /* Bolivia */ - CTRY_BRAZIL = 76, /* Brazil */ - CTRY_BRUNEI_DARUSSALAM = 96, /* Brunei Darussalam */ - CTRY_BULGARIA = 100, /* Bulgaria */ - CTRY_CANADA = 124, /* Canada */ - CTRY_CHILE = 152, /* Chile */ - CTRY_CHINA = 156, /* People's Republic of China */ - CTRY_COLOMBIA = 170, /* Colombia */ - CTRY_COSTA_RICA = 188, /* Costa Rica */ - CTRY_CROATIA = 191, /* Croatia */ - CTRY_CYPRUS = 196, - CTRY_CZECH = 203, /* Czech Republic */ - CTRY_DENMARK = 208, /* Denmark */ - CTRY_DOMINICAN_REPUBLIC = 214, /* Dominican Republic */ - CTRY_ECUADOR = 218, /* Ecuador */ - CTRY_EGYPT = 818, /* Egypt */ - CTRY_EL_SALVADOR = 222, /* El Salvador */ - CTRY_ESTONIA = 233, /* Estonia */ - CTRY_FAEROE_ISLANDS = 234, /* Faeroe Islands */ - CTRY_FINLAND = 246, /* Finland */ - CTRY_FRANCE = 250, /* France */ - CTRY_FRANCE2 = 255, /* France2 */ - CTRY_GEORGIA = 268, /* Georgia */ - CTRY_GERMANY = 276, /* Germany */ - CTRY_GREECE = 300, /* Greece */ - CTRY_GSM = 843, /* 900MHz/GSM */ - CTRY_GUATEMALA = 320, /* Guatemala */ - CTRY_HONDURAS = 340, /* Honduras */ - CTRY_HONG_KONG = 344, /* Hong Kong S.A.R., P.R.C. */ - CTRY_HUNGARY = 348, /* Hungary */ - CTRY_ICELAND = 352, /* Iceland */ - CTRY_INDIA = 356, /* India */ - CTRY_INDONESIA = 360, /* Indonesia */ - CTRY_IRAN = 364, /* Iran */ - CTRY_IRAQ = 368, /* Iraq */ - CTRY_IRELAND = 372, /* Ireland */ - CTRY_ISRAEL = 376, /* Israel */ - CTRY_ITALY = 380, /* Italy */ - CTRY_JAMAICA = 388, /* Jamaica */ - CTRY_JAPAN = 392, /* Japan */ - CTRY_JAPAN1 = 393, /* Japan (JP1) */ - CTRY_JAPAN2 = 394, /* Japan (JP0) */ - CTRY_JAPAN3 = 395, /* Japan (JP1-1) */ - CTRY_JAPAN4 = 396, /* Japan (JE1) */ - CTRY_JAPAN5 = 397, /* Japan (JE2) */ - CTRY_JAPAN6 = 399, /* Japan (JP6) */ - - CTRY_JAPAN7 = 4007, /* Japan (J7) */ - CTRY_JAPAN8 = 4008, /* Japan (J8) */ - CTRY_JAPAN9 = 4009, /* Japan (J9) */ - - CTRY_JAPAN10 = 4010, /* Japan (J10) */ - CTRY_JAPAN11 = 4011, /* Japan (J11) */ - CTRY_JAPAN12 = 4012, /* Japan (J12) */ - - CTRY_JAPAN13 = 4013, /* Japan (J13) */ - CTRY_JAPAN14 = 4014, /* Japan (J14) */ - CTRY_JAPAN15 = 4015, /* Japan (J15) */ - - CTRY_JAPAN16 = 4016, /* Japan (J16) */ - CTRY_JAPAN17 = 4017, /* Japan (J17) */ - CTRY_JAPAN18 = 4018, /* Japan (J18) */ - - CTRY_JAPAN19 = 4019, /* Japan (J19) */ - CTRY_JAPAN20 = 4020, /* Japan (J20) */ - CTRY_JAPAN21 = 4021, /* Japan (J21) */ - - CTRY_JAPAN22 = 4022, /* Japan (J22) */ - CTRY_JAPAN23 = 4023, /* Japan (J23) */ - CTRY_JAPAN24 = 4024, /* Japan (J24) */ - - CTRY_JORDAN = 400, /* Jordan */ - CTRY_KAZAKHSTAN = 398, /* Kazakhstan */ - CTRY_KENYA = 404, /* Kenya */ - CTRY_KOREA_NORTH = 408, /* North Korea */ - CTRY_KOREA_ROC = 410, /* South Korea */ - CTRY_KOREA_ROC2 = 411, /* South Korea */ - CTRY_KOREA_ROC3 = 412, /* South Korea */ - CTRY_KUWAIT = 414, /* Kuwait */ - CTRY_LATVIA = 428, /* Latvia */ - CTRY_LEBANON = 422, /* Lebanon */ - CTRY_LIBYA = 434, /* Libya */ - CTRY_LIECHTENSTEIN = 438, /* Liechtenstein */ - CTRY_LITHUANIA = 440, /* Lithuania */ - CTRY_LUXEMBOURG = 442, /* Luxembourg */ - CTRY_MACAU = 446, /* Macau */ - CTRY_MACEDONIA = 807, /* the Former Yugoslav Republic of Macedonia */ - CTRY_MALAYSIA = 458, /* Malaysia */ - CTRY_MALTA = 470, /* Malta */ - CTRY_MEXICO = 484, /* Mexico */ - CTRY_MONACO = 492, /* Principality of Monaco */ - CTRY_MOROCCO = 504, /* Morocco */ - CTRY_NETHERLANDS = 528, /* Netherlands */ - CTRY_NEW_ZEALAND = 554, /* New Zealand */ - CTRY_NICARAGUA = 558, /* Nicaragua */ - CTRY_NORWAY = 578, /* Norway */ - CTRY_OMAN = 512, /* Oman */ - CTRY_PAKISTAN = 586, /* Islamic Republic of Pakistan */ - CTRY_PANAMA = 591, /* Panama */ - CTRY_PARAGUAY = 600, /* Paraguay */ - CTRY_PERU = 604, /* Peru */ - CTRY_PHILIPPINES = 608, /* Republic of the Philippines */ - CTRY_POLAND = 616, /* Poland */ - CTRY_PORTUGAL = 620, /* Portugal */ - CTRY_PUERTO_RICO = 630, /* Puerto Rico */ - CTRY_QATAR = 634, /* Qatar */ - CTRY_ROMANIA = 642, /* Romania */ - CTRY_RUSSIA = 643, /* Russia */ - CTRY_SAUDI_ARABIA = 682, /* Saudi Arabia */ - CTRY_SINGAPORE = 702, /* Singapore */ - CTRY_SLOVAKIA = 703, /* Slovak Republic */ - CTRY_SLOVENIA = 705, /* Slovenia */ - CTRY_SOUTH_AFRICA = 710, /* South Africa */ - CTRY_SPAIN = 724, /* Spain */ - CTRY_SWEDEN = 752, /* Sweden */ - CTRY_SWITZERLAND = 756, /* Switzerland */ - CTRY_SYRIA = 760, /* Syria */ - CTRY_TAIWAN = 158, /* Taiwan */ - CTRY_THAILAND = 764, /* Thailand */ - CTRY_TRINIDAD_Y_TOBAGO = 780, /* Trinidad y Tobago */ - CTRY_TUNISIA = 788, /* Tunisia */ - CTRY_TURKEY = 792, /* Turkey */ - CTRY_UAE = 784, /* U.A.E. */ - CTRY_UKRAINE = 804, /* Ukraine */ - CTRY_UNITED_KINGDOM = 826, /* United Kingdom */ - CTRY_UNITED_STATES = 840, /* United States */ - CTRY_UNITED_STATES_FCC49 = 842, /* United States (Public Safety)*/ - CTRY_URUGUAY = 858, /* Uruguay */ - CTRY_UZBEKISTAN = 860, /* Uzbekistan */ - CTRY_VENEZUELA = 862, /* Venezuela */ - CTRY_VIET_NAM = 704, /* Viet Nam */ - CTRY_YEMEN = 887, /* Yemen */ - CTRY_ZIMBABWE = 716 /* Zimbabwe */ -}; - - /* Enumerated Regulatory Domain Information 8 bit values indicate that * the regdomain is really a pair of unitary regdomains. 12 bit values * are the real unitary regdomains and are the only ones which have the @@ -381,7 +229,6 @@ enum EnumRd { NULL1_WORLD = 0x03, /* For 11b-only countries (no 11a allowed) */ NULL1_ETSIB = 0x07, /* Israel */ NULL1_ETSIC = 0x08, - NULL1_GSM = 0x09, /* GSM-only operation */ FCC1_FCCA = 0x10, /* USA */ FCC1_WORLD = 0x11, /* Hong Kong */ FCC4_FCCA = 0x12, /* USA - Public Safety */ @@ -531,7 +378,6 @@ enum EnumRd { NULL1 = 0x0198, WORLD = 0x0199, - GSM = 0x019a, DEBUG_REG_DMN = 0x01ff, }; #define DEF_REGDMN FCC1_FCCA @@ -545,7 +391,6 @@ static struct { D(NULL1_WORLD), /* For 11b-only countries (no 11a allowed) */ D(NULL1_ETSIB), /* Israel */ D(NULL1_ETSIC), - D(NULL1_GSM), /* GSM-only operation */ D(FCC1_FCCA), /* USA */ D(FCC1_WORLD), /* Hong Kong */ D(FCC4_FCCA), /* USA - Public Safety */ @@ -682,7 +527,6 @@ static struct { D(NULL1), D(WORLD), - D(GSM), D(DEBUG_REG_DMN), #undef D }; @@ -734,163 +578,151 @@ typedef struct { HAL_REG_DOMAIN regDmnEnum; const char* isoName; const char* name; - HAL_BOOL allow11g; - HAL_BOOL allow11aTurbo; - HAL_BOOL allow11gTurbo; - u_int16_t outdoorChanStart; } COUNTRY_CODE_TO_ENUM_RD; -#define YES AH_TRUE -#define NO AH_FALSE -/* Index into table to avoid DEBUG and NO COUNTRY SET entries */ -#define CTRY_ONLY_INDEX 2 /* * Country Code Table to Enumerated RD */ - static COUNTRY_CODE_TO_ENUM_RD allCountries[] = { - {CTRY_DEBUG, NO_ENUMRD, "DB", "DEBUG", YES, YES, YES, 7000 }, - {CTRY_DEFAULT, DEF_REGDMN, "NA", "NO_COUNTRY_SET", YES, YES, YES, 7000 }, - {CTRY_ALBANIA, NULL1_WORLD, "AL", "ALBANIA", YES, NO, YES, 7000 }, - {CTRY_ALGERIA, NULL1_WORLD, "DZ", "ALGERIA", YES, NO, YES, 7000 }, - {CTRY_ARGENTINA, APL3_WORLD, "AR", "ARGENTINA", NO, NO, NO, 7000 }, - {CTRY_ARMENIA, ETSI4_WORLD, "AM", "ARMENIA", YES, NO, YES, 7000 }, - {CTRY_AUSTRALIA, FCC2_WORLD, "AU", "AUSTRALIA", YES, YES, YES, 7000 }, - {CTRY_AUSTRIA, ETSI1_WORLD, "AT", "AUSTRIA", YES, NO, YES, 7000 }, - {CTRY_AZERBAIJAN, ETSI4_WORLD, "AZ", "AZERBAIJAN", YES, YES, YES, 7000 }, - {CTRY_BAHRAIN, APL6_WORLD, "BH", "BAHRAIN", YES, NO, YES, 7000 }, - {CTRY_BELARUS, NULL1_WORLD, "BY", "BELARUS", YES, NO, YES, 7000 }, - {CTRY_BELGIUM, ETSI1_WORLD, "BE", "BELGIUM", YES, NO, YES, 7000 }, - {CTRY_BELIZE, APL1_ETSIC, "BZ", "BELIZE", YES, YES, YES, 7000 }, - {CTRY_BOLIVIA, APL1_ETSIC, "BO", "BOLVIA", YES, YES, YES, 7000 }, - {CTRY_BRAZIL, FCC3_WORLD, "BR", "BRAZIL", YES, NO, NO, 7000 }, - {CTRY_BRUNEI_DARUSSALAM,APL1_WORLD,"BN", "BRUNEI DARUSSALAM", YES, YES, YES, 7000 }, - {CTRY_BULGARIA, ETSI6_WORLD, "BG", "BULGARIA", YES, NO, YES, 7000 }, - {CTRY_CANADA, FCC2_FCCA, "CA", "CANADA", YES, YES, YES, 7000 }, - {CTRY_CHILE, APL6_WORLD, "CL", "CHILE", YES, YES, YES, 7000 }, - {CTRY_CHINA, APL1_WORLD, "CN", "CHINA", YES, YES, YES, 7000 }, - {CTRY_COLOMBIA, FCC1_FCCA, "CO", "COLOMBIA", YES, NO, YES, 7000 }, - {CTRY_COSTA_RICA, NULL1_WORLD, "CR", "COSTA RICA", YES, NO, YES, 7000 }, - {CTRY_CROATIA, ETSI3_WORLD, "HR", "CROATIA", YES, NO, YES, 7000 }, - {CTRY_CYPRUS, ETSI1_WORLD, "CY", "CYPRUS", YES, YES, YES, 7000 }, - {CTRY_CZECH, ETSI3_WORLD, "CZ", "CZECH REPUBLIC", YES, NO, YES, 7000 }, - {CTRY_DENMARK, ETSI1_WORLD, "DK", "DENMARK", YES, NO, YES, 7000 }, - {CTRY_DOMINICAN_REPUBLIC,FCC1_FCCA,"DO", "DOMINICAN REPUBLIC", YES, YES, YES, 7000 }, - {CTRY_ECUADOR, NULL1_WORLD, "EC", "ECUADOR", NO, NO, NO, 7000 }, - {CTRY_EGYPT, ETSI3_WORLD, "EG", "EGYPT", YES, NO, YES, 7000 }, - {CTRY_EL_SALVADOR, NULL1_WORLD, "SV", "EL SALVADOR", YES, NO, YES, 7000 }, - {CTRY_ESTONIA, ETSI1_WORLD, "EE", "ESTONIA", YES, NO, YES, 7000 }, - {CTRY_FINLAND, ETSI1_WORLD, "FI", "FINLAND", YES, NO, YES, 7000 }, - {CTRY_FRANCE, ETSI3_WORLD, "FR", "FRANCE", YES, NO, YES, 7000 }, - {CTRY_FRANCE2, ETSI3_WORLD, "F2", "FRANCE_RES", YES, NO, YES, 7000 }, - {CTRY_GEORGIA, ETSI4_WORLD, "GE", "GEORGIA", YES, YES, YES, 7000 }, - {CTRY_GERMANY, ETSI1_WORLD, "DE", "GERMANY", YES, NO, YES, 7000 }, - {CTRY_GREECE, ETSI1_WORLD, "GR", "GREECE", YES, NO, YES, 7000 }, - {CTRY_GSM, NULL1_GSM, "GS", "GSM", YES, NO, NO, 7000 }, - {CTRY_GUATEMALA, FCC1_FCCA, "GT", "GUATEMALA", YES, YES, YES, 7000 }, - {CTRY_HONDURAS, NULL1_WORLD, "HN", "HONDURAS", YES, NO, YES, 7000 }, - {CTRY_HONG_KONG, FCC2_WORLD, "HK", "HONG KONG", YES, YES, YES, 7000 }, - {CTRY_HUNGARY, ETSI1_WORLD, "HU", "HUNGARY", YES, NO, YES, 7000 }, - {CTRY_ICELAND, ETSI1_WORLD, "IS", "ICELAND", YES, NO, YES, 7000 }, - {CTRY_INDIA, APL6_WORLD, "IN", "INDIA", YES, NO, YES, 7000 }, - {CTRY_INDONESIA, APL1_WORLD, "ID", "INDONESIA", YES, NO, YES, 7000 }, - {CTRY_IRAN, APL1_WORLD, "IR", "IRAN", YES, YES, YES, 7000 }, - {CTRY_IRELAND, ETSI1_WORLD, "IE", "IRELAND", YES, NO, YES, 7000 }, - {CTRY_ISRAEL, NULL1_WORLD, "IL", "ISRAEL", YES, NO, YES, 7000 }, - {CTRY_ITALY, ETSI1_WORLD, "IT", "ITALY", YES, NO, YES, 7000 }, - {CTRY_JAPAN, MKK1_MKKA, "JP", "JAPAN", YES, NO, NO, 7000 }, - {CTRY_JAPAN1, MKK1_MKKB, "JP", "JAPAN1", YES, NO, NO, 7000 }, - {CTRY_JAPAN2, MKK1_FCCA, "JP", "JAPAN2", YES, NO, NO, 7000 }, - {CTRY_JAPAN3, MKK2_MKKA, "JP", "JAPAN3", YES, NO, NO, 7000 }, - {CTRY_JAPAN4, MKK1_MKKA1, "JP", "JAPAN4", YES, NO, NO, 7000 }, - {CTRY_JAPAN5, MKK1_MKKA2, "JP", "JAPAN5", YES, NO, NO, 7000 }, - {CTRY_JAPAN6, MKK1_MKKC, "JP", "JAPAN6", YES, NO, NO, 7000 }, - - {CTRY_JAPAN7, MKK3_MKKB, "JP", "JAPAN7", YES, NO, NO, 7000 }, - {CTRY_JAPAN8, MKK3_MKKA2, "JP", "JAPAN8", YES, NO, NO, 7000 }, - {CTRY_JAPAN9, MKK3_MKKC, "JP", "JAPAN9", YES, NO, NO, 7000 }, - - {CTRY_JAPAN10, MKK4_MKKB, "JP", "JAPAN10", YES, NO, NO, 7000 }, - {CTRY_JAPAN11, MKK4_MKKA2, "JP", "JAPAN11", YES, NO, NO, 7000 }, - {CTRY_JAPAN12, MKK4_MKKC, "JP", "JAPAN12", YES, NO, NO, 7000 }, - - {CTRY_JAPAN13, MKK5_MKKB, "JP", "JAPAN13", YES, NO, NO, 7000 }, - {CTRY_JAPAN14, MKK5_MKKA2, "JP", "JAPAN14", YES, NO, NO, 7000 }, - {CTRY_JAPAN15, MKK5_MKKC, "JP", "JAPAN15", YES, NO, NO, 7000 }, - - {CTRY_JAPAN16, MKK6_MKKB, "JP", "JAPAN16", YES, NO, NO, 7000 }, - {CTRY_JAPAN17, MKK6_MKKA2, "JP", "JAPAN17", YES, NO, NO, 7000 }, - {CTRY_JAPAN18, MKK6_MKKC, "JP", "JAPAN18", YES, NO, NO, 7000 }, - - {CTRY_JAPAN19, MKK7_MKKB, "JP", "JAPAN19", YES, NO, NO, 7000 }, - {CTRY_JAPAN20, MKK7_MKKA2, "JP", "JAPAN20", YES, NO, NO, 7000 }, - {CTRY_JAPAN21, MKK7_MKKC, "JP", "JAPAN21", YES, NO, NO, 7000 }, - - {CTRY_JAPAN22, MKK8_MKKB, "JP", "JAPAN22", YES, NO, NO, 7000 }, - {CTRY_JAPAN23, MKK8_MKKA2, "JP", "JAPAN23", YES, NO, NO, 7000 }, - {CTRY_JAPAN24, MKK8_MKKC, "JP", "JAPAN24", YES, NO, NO, 7000 }, - - {CTRY_JORDAN, APL4_WORLD, "JO", "JORDAN", YES, NO, YES, 7000 }, - {CTRY_KAZAKHSTAN, NULL1_WORLD, "KZ", "KAZAKHSTAN", YES, NO, YES, 7000 }, - {CTRY_KOREA_NORTH, APL2_WORLD, "KP", "NORTH KOREA", YES, YES, YES, 7000 }, - {CTRY_KOREA_ROC, APL2_WORLD, "KR", "KOREA REPUBLIC", YES, NO, NO, 7000 }, - {CTRY_KOREA_ROC2, APL2_WORLD, "K2", "KOREA REPUBLIC2",YES, NO, NO, 7000 }, - {CTRY_KOREA_ROC3, APL9_WORLD, "K3", "KOREA REPUBLIC3",YES, NO, NO, 7000 }, - {CTRY_KUWAIT, NULL1_WORLD, "KW", "KUWAIT", YES, NO, YES, 7000 }, - {CTRY_LATVIA, ETSI1_WORLD, "LV", "LATVIA", YES, NO, YES, 7000 }, - {CTRY_LEBANON, NULL1_WORLD, "LB", "LEBANON", YES, NO, YES, 7000 }, - {CTRY_LIECHTENSTEIN,ETSI1_WORLD, "LI", "LIECHTENSTEIN", YES, NO, YES, 7000 }, - {CTRY_LITHUANIA, ETSI1_WORLD, "LT", "LITHUANIA", YES, NO, YES, 7000 }, - {CTRY_LUXEMBOURG, ETSI1_WORLD, "LU", "LUXEMBOURG", YES, NO, YES, 7000 }, - {CTRY_MACAU, FCC2_WORLD, "MO", "MACAU", YES, YES, YES, 7000 }, - {CTRY_MACEDONIA, NULL1_WORLD, "MK", "MACEDONIA", YES, NO, YES, 7000 }, - {CTRY_MALAYSIA, APL8_WORLD, "MY", "MALAYSIA", YES, NO, NO, 7000 }, - {CTRY_MALTA, ETSI1_WORLD, "MT", "MALTA", YES, NO, YES, 7000 }, - {CTRY_MEXICO, FCC1_FCCA, "MX", "MEXICO", YES, YES, YES, 7000 }, - {CTRY_MONACO, ETSI4_WORLD, "MC", "MONACO", YES, YES, YES, 7000 }, - {CTRY_MOROCCO, NULL1_WORLD, "MA", "MOROCCO", YES, NO, YES, 7000 }, - {CTRY_NETHERLANDS, ETSI1_WORLD, "NL", "NETHERLANDS", YES, NO, YES, 7000 }, - {CTRY_NEW_ZEALAND, FCC2_ETSIC, "NZ", "NEW ZEALAND", YES, NO, YES, 7000 }, - {CTRY_NORWAY, ETSI1_WORLD, "NO", "NORWAY", YES, NO, YES, 7000 }, - {CTRY_OMAN, APL6_WORLD, "OM", "OMAN", YES, NO, YES, 7000 }, - {CTRY_PAKISTAN, NULL1_WORLD, "PK", "PAKISTAN", YES, NO, YES, 7000 }, - {CTRY_PANAMA, FCC1_FCCA, "PA", "PANAMA", YES, YES, YES, 7000 }, - {CTRY_PERU, APL1_WORLD, "PE", "PERU", YES, NO, YES, 7000 }, - {CTRY_PHILIPPINES, APL1_WORLD, "PH", "PHILIPPINES", YES, YES, YES, 7000 }, - {CTRY_POLAND, ETSI1_WORLD, "PL", "POLAND", YES, NO, YES, 7000 }, - {CTRY_PORTUGAL, ETSI1_WORLD, "PT", "PORTUGAL", YES, NO, YES, 7000 }, - {CTRY_PUERTO_RICO, FCC1_FCCA, "PR", "PUERTO RICO", YES, YES, YES, 7000 }, - {CTRY_QATAR, NULL1_WORLD, "QA", "QATAR", YES, NO, YES, 7000 }, - {CTRY_ROMANIA, NULL1_WORLD, "RO", "ROMANIA", YES, NO, YES, 7000 }, - {CTRY_RUSSIA, NULL1_WORLD, "RU", "RUSSIA", YES, NO, YES, 7000 }, - {CTRY_SAUDI_ARABIA,NULL1_WORLD, "SA", "SAUDI ARABIA", YES, NO, YES, 7000 }, - {CTRY_SINGAPORE, APL6_WORLD, "SG", "SINGAPORE", YES, YES, YES, 7000 }, - {CTRY_SLOVAKIA, ETSI1_WORLD, "SK", "SLOVAK REPUBLIC",YES, NO, YES, 7000 }, - {CTRY_SLOVENIA, ETSI1_WORLD, "SI", "SLOVENIA", YES, NO, YES, 7000 }, - {CTRY_SOUTH_AFRICA,FCC3_WORLD, "ZA", "SOUTH AFRICA", YES, NO, YES, 7000 }, - {CTRY_SPAIN, ETSI1_WORLD, "ES", "SPAIN", YES, NO, YES, 7000 }, - {CTRY_SWEDEN, ETSI1_WORLD, "SE", "SWEDEN", YES, NO, YES, 7000 }, - {CTRY_SWITZERLAND, ETSI1_WORLD, "CH", "SWITZERLAND", YES, NO, YES, 7000 }, - {CTRY_SYRIA, NULL1_WORLD, "SY", "SYRIA", YES, NO, YES, 7000 }, - {CTRY_TAIWAN, APL3_FCCA, "TW", "TAIWAN", YES, YES, YES, 7000 }, - {CTRY_THAILAND, NULL1_WORLD, "TH", "THAILAND", YES, NO, YES, 7000 }, - {CTRY_TRINIDAD_Y_TOBAGO,ETSI4_WORLD,"TT", "TRINIDAD & TOBAGO", YES, NO, YES, 7000 }, - {CTRY_TUNISIA, ETSI3_WORLD, "TN", "TUNISIA", YES, NO, YES, 7000 }, - {CTRY_TURKEY, ETSI3_WORLD, "TR", "TURKEY", YES, NO, YES, 7000 }, - {CTRY_UKRAINE, NULL1_WORLD, "UA", "UKRAINE", YES, NO, YES, 7000 }, - {CTRY_UAE, NULL1_WORLD, "AE", "UNITED ARAB EMIRATES", YES, NO, YES, 7000 }, - {CTRY_UNITED_KINGDOM, ETSI1_WORLD,"GB", "UNITED KINGDOM", YES, NO, YES, 7000 }, - {CTRY_UNITED_STATES, FCC1_FCCA, "US", "UNITED STATES", YES, YES, YES, 5825 }, - {CTRY_UNITED_STATES_FCC49, FCC4_FCCA, "PS", "UNITED STATES (PUBLIC SAFETY)", YES, YES, YES, 7000 }, - {CTRY_URUGUAY, APL2_WORLD, "UY", "URUGUAY", YES, NO, YES, 7000 }, - {CTRY_UZBEKISTAN, FCC3_FCCA, "UZ", "UZBEKISTAN", YES, YES, YES, 7000 }, - {CTRY_VENEZUELA, APL2_ETSIC, "VE", "VENEZUELA", YES, NO, YES, 7000 }, - {CTRY_VIET_NAM, NULL1_WORLD, "VN", "VIET NAM", YES, NO, YES, 7000 }, - {CTRY_YEMEN, NULL1_WORLD, "YE", "YEMEN", YES, NO, YES, 7000 }, - {CTRY_ZIMBABWE, NULL1_WORLD, "ZW", "ZIMBABWE", YES, NO, YES, 7000 } + {CTRY_DEBUG, NO_ENUMRD, "DB", "DEBUG" }, + {CTRY_DEFAULT, DEF_REGDMN, "NA", "NO_COUNTRY_SET" }, + {CTRY_ALBANIA, NULL1_WORLD, "AL", "ALBANIA" }, + {CTRY_ALGERIA, NULL1_WORLD, "DZ", "ALGERIA" }, + {CTRY_ARGENTINA, APL3_WORLD, "AR", "ARGENTINA" }, + {CTRY_ARMENIA, ETSI4_WORLD, "AM", "ARMENIA" }, + {CTRY_AUSTRALIA, FCC2_WORLD, "AU", "AUSTRALIA" }, + {CTRY_AUSTRIA, ETSI1_WORLD, "AT", "AUSTRIA" }, + {CTRY_AZERBAIJAN, ETSI4_WORLD, "AZ", "AZERBAIJAN" }, + {CTRY_BAHRAIN, APL6_WORLD, "BH", "BAHRAIN" }, + {CTRY_BELARUS, NULL1_WORLD, "BY", "BELARUS" }, + {CTRY_BELGIUM, ETSI1_WORLD, "BE", "BELGIUM" }, + {CTRY_BELIZE, APL1_ETSIC, "BZ", "BELIZE" }, + {CTRY_BOLIVIA, APL1_ETSIC, "BO", "BOLVIA" }, + {CTRY_BRAZIL, FCC3_WORLD, "BR", "BRAZIL" }, + {CTRY_BRUNEI_DARUSSALAM,APL1_WORLD,"BN", "BRUNEI DARUSSALAM" }, + {CTRY_BULGARIA, ETSI6_WORLD, "BG", "BULGARIA" }, + {CTRY_CANADA, FCC2_FCCA, "CA", "CANADA" }, + {CTRY_CHILE, APL6_WORLD, "CL", "CHILE" }, + {CTRY_CHINA, APL1_WORLD, "CN", "CHINA" }, + {CTRY_COLOMBIA, FCC1_FCCA, "CO", "COLOMBIA" }, + {CTRY_COSTA_RICA, NULL1_WORLD, "CR", "COSTA RICA" }, + {CTRY_CROATIA, ETSI3_WORLD, "HR", "CROATIA" }, + {CTRY_CYPRUS, ETSI1_WORLD, "CY", "CYPRUS" }, + {CTRY_CZECH, ETSI3_WORLD, "CZ", "CZECH REPUBLIC" }, + {CTRY_DENMARK, ETSI1_WORLD, "DK", "DENMARK" }, + {CTRY_DOMINICAN_REPUBLIC,FCC1_FCCA,"DO", "DOMINICAN REPUBLIC" }, + {CTRY_ECUADOR, NULL1_WORLD, "EC", "ECUADOR" }, + {CTRY_EGYPT, ETSI3_WORLD, "EG", "EGYPT" }, + {CTRY_EL_SALVADOR, NULL1_WORLD, "SV", "EL SALVADOR" }, + {CTRY_ESTONIA, ETSI1_WORLD, "EE", "ESTONIA" }, + {CTRY_FINLAND, ETSI1_WORLD, "FI", "FINLAND" }, + {CTRY_FRANCE, ETSI3_WORLD, "FR", "FRANCE" }, + {CTRY_FRANCE2, ETSI3_WORLD, "F2", "FRANCE_RES" }, + {CTRY_GEORGIA, ETSI4_WORLD, "GE", "GEORGIA" }, + {CTRY_GERMANY, ETSI1_WORLD, "DE", "GERMANY" }, + {CTRY_GREECE, ETSI1_WORLD, "GR", "GREECE" }, + {CTRY_GUATEMALA, FCC1_FCCA, "GT", "GUATEMALA" }, + {CTRY_HONDURAS, NULL1_WORLD, "HN", "HONDURAS" }, + {CTRY_HONG_KONG, FCC2_WORLD, "HK", "HONG KONG" }, + {CTRY_HUNGARY, ETSI1_WORLD, "HU", "HUNGARY" }, + {CTRY_ICELAND, ETSI1_WORLD, "IS", "ICELAND" }, + {CTRY_INDIA, APL6_WORLD, "IN", "INDIA" }, + {CTRY_INDONESIA, APL1_WORLD, "ID", "INDONESIA" }, + {CTRY_IRAN, APL1_WORLD, "IR", "IRAN" }, + {CTRY_IRELAND, ETSI1_WORLD, "IE", "IRELAND" }, + {CTRY_ISRAEL, NULL1_WORLD, "IL", "ISRAEL" }, + {CTRY_ITALY, ETSI1_WORLD, "IT", "ITALY" }, + {CTRY_JAPAN, MKK1_MKKA, "JP", "JAPAN" }, + {CTRY_JAPAN1, MKK1_MKKB, "JP", "JAPAN1" }, + {CTRY_JAPAN2, MKK1_FCCA, "JP", "JAPAN2" }, + {CTRY_JAPAN3, MKK2_MKKA, "JP", "JAPAN3" }, + {CTRY_JAPAN4, MKK1_MKKA1, "JP", "JAPAN4" }, + {CTRY_JAPAN5, MKK1_MKKA2, "JP", "JAPAN5" }, + {CTRY_JAPAN6, MKK1_MKKC, "JP", "JAPAN6" }, + + {CTRY_JAPAN7, MKK3_MKKB, "JP", "JAPAN7" }, + {CTRY_JAPAN8, MKK3_MKKA2, "JP", "JAPAN8" }, + {CTRY_JAPAN9, MKK3_MKKC, "JP", "JAPAN9" }, + + {CTRY_JAPAN10, MKK4_MKKB, "JP", "JAPAN10" }, + {CTRY_JAPAN11, MKK4_MKKA2, "JP", "JAPAN11" }, + {CTRY_JAPAN12, MKK4_MKKC, "JP", "JAPAN12" }, + + {CTRY_JAPAN13, MKK5_MKKB, "JP", "JAPAN13" }, + {CTRY_JAPAN14, MKK5_MKKA2, "JP", "JAPAN14" }, + {CTRY_JAPAN15, MKK5_MKKC, "JP", "JAPAN15" }, + + {CTRY_JAPAN16, MKK6_MKKB, "JP", "JAPAN16" }, + {CTRY_JAPAN17, MKK6_MKKA2, "JP", "JAPAN17" }, + {CTRY_JAPAN18, MKK6_MKKC, "JP", "JAPAN18" }, + + {CTRY_JAPAN19, MKK7_MKKB, "JP", "JAPAN19" }, + {CTRY_JAPAN20, MKK7_MKKA2, "JP", "JAPAN20" }, + {CTRY_JAPAN21, MKK7_MKKC, "JP", "JAPAN21" }, + + {CTRY_JAPAN22, MKK8_MKKB, "JP", "JAPAN22" }, + {CTRY_JAPAN23, MKK8_MKKA2, "JP", "JAPAN23" }, + {CTRY_JAPAN24, MKK8_MKKC, "JP", "JAPAN24" }, + + {CTRY_JORDAN, APL4_WORLD, "JO", "JORDAN" }, + {CTRY_KAZAKHSTAN, NULL1_WORLD, "KZ", "KAZAKHSTAN" }, + {CTRY_KOREA_NORTH, APL2_WORLD, "KP", "NORTH KOREA" }, + {CTRY_KOREA_ROC, APL2_WORLD, "KR", "KOREA REPUBLIC" }, + {CTRY_KOREA_ROC2, APL2_WORLD, "K2", "KOREA REPUBLIC2" }, + {CTRY_KOREA_ROC3, APL9_WORLD, "K3", "KOREA REPUBLIC3" }, + {CTRY_KUWAIT, NULL1_WORLD, "KW", "KUWAIT" }, + {CTRY_LATVIA, ETSI1_WORLD, "LV", "LATVIA" }, + {CTRY_LEBANON, NULL1_WORLD, "LB", "LEBANON" }, + {CTRY_LIECHTENSTEIN,ETSI1_WORLD, "LI", "LIECHTENSTEIN" }, + {CTRY_LITHUANIA, ETSI1_WORLD, "LT", "LITHUANIA" }, + {CTRY_LUXEMBOURG, ETSI1_WORLD, "LU", "LUXEMBOURG" }, + {CTRY_MACAU, FCC2_WORLD, "MO", "MACAU" }, + {CTRY_MACEDONIA, NULL1_WORLD, "MK", "MACEDONIA" }, + {CTRY_MALAYSIA, APL8_WORLD, "MY", "MALAYSIA" }, + {CTRY_MALTA, ETSI1_WORLD, "MT", "MALTA" }, + {CTRY_MEXICO, FCC1_FCCA, "MX", "MEXICO" }, + {CTRY_MONACO, ETSI4_WORLD, "MC", "MONACO" }, + {CTRY_MOROCCO, NULL1_WORLD, "MA", "MOROCCO" }, + {CTRY_NETHERLANDS, ETSI1_WORLD, "NL", "NETHERLANDS" }, + {CTRY_NEW_ZEALAND, FCC2_ETSIC, "NZ", "NEW ZEALAND" }, + {CTRY_NORWAY, ETSI1_WORLD, "NO", "NORWAY" }, + {CTRY_OMAN, APL6_WORLD, "OM", "OMAN" }, + {CTRY_PAKISTAN, NULL1_WORLD, "PK", "PAKISTAN" }, + {CTRY_PANAMA, FCC1_FCCA, "PA", "PANAMA" }, + {CTRY_PERU, APL1_WORLD, "PE", "PERU" }, + {CTRY_PHILIPPINES, APL1_WORLD, "PH", "PHILIPPINES" }, + {CTRY_POLAND, ETSI1_WORLD, "PL", "POLAND" }, + {CTRY_PORTUGAL, ETSI1_WORLD, "PT", "PORTUGAL" }, + {CTRY_PUERTO_RICO, FCC1_FCCA, "PR", "PUERTO RICO" }, + {CTRY_QATAR, NULL1_WORLD, "QA", "QATAR" }, + {CTRY_ROMANIA, NULL1_WORLD, "RO", "ROMANIA" }, + {CTRY_RUSSIA, NULL1_WORLD, "RU", "RUSSIA" }, + {CTRY_SAUDI_ARABIA,NULL1_WORLD, "SA", "SAUDI ARABIA" }, + {CTRY_SINGAPORE, APL6_WORLD, "SG", "SINGAPORE" }, + {CTRY_SLOVAKIA, ETSI1_WORLD, "SK", "SLOVAK REPUBLIC" }, + {CTRY_SLOVENIA, ETSI1_WORLD, "SI", "SLOVENIA" }, + {CTRY_SOUTH_AFRICA,FCC3_WORLD, "ZA", "SOUTH AFRICA" }, + {CTRY_SPAIN, ETSI1_WORLD, "ES", "SPAIN" }, + {CTRY_SWEDEN, ETSI1_WORLD, "SE", "SWEDEN" }, + {CTRY_SWITZERLAND, ETSI1_WORLD, "CH", "SWITZERLAND" }, + {CTRY_SYRIA, NULL1_WORLD, "SY", "SYRIA" }, + {CTRY_TAIWAN, APL3_FCCA, "TW", "TAIWAN" }, + {CTRY_THAILAND, NULL1_WORLD, "TH", "THAILAND" }, + {CTRY_TRINIDAD_Y_TOBAGO,ETSI4_WORLD,"TT", "TRINIDAD & TOBAGO" }, + {CTRY_TUNISIA, ETSI3_WORLD, "TN", "TUNISIA" }, + {CTRY_TURKEY, ETSI3_WORLD, "TR", "TURKEY" }, + {CTRY_UKRAINE, NULL1_WORLD, "UA", "UKRAINE" }, + {CTRY_UAE, NULL1_WORLD, "AE", "UNITED ARAB EMIRATES" }, + {CTRY_UNITED_KINGDOM, ETSI1_WORLD,"GB", "UNITED KINGDOM" }, + {CTRY_UNITED_STATES, FCC1_FCCA, "US", "UNITED STATES" }, + {CTRY_UNITED_STATES_FCC49, FCC4_FCCA, "PS", "UNITED STATES (PUBLIC SAFETY)" }, + {CTRY_URUGUAY, APL2_WORLD, "UY", "URUGUAY" }, + {CTRY_UZBEKISTAN, FCC3_FCCA, "UZ", "UZBEKISTAN" }, + {CTRY_VENEZUELA, APL2_ETSIC, "VE", "VENEZUELA" }, + {CTRY_VIET_NAM, NULL1_WORLD, "VN", "VIET NAM" }, + {CTRY_YEMEN, NULL1_WORLD, "YE", "YEMEN" }, + {CTRY_ZIMBABWE, NULL1_WORLD, "ZW", "ZIMBABWE" } }; -#undef YES -#undef NO static HAL_BOOL cclookup(const char *name, HAL_REG_DOMAIN *rd, HAL_CTRY_CODE *cc) @@ -952,12 +784,13 @@ cclist() } static HAL_BOOL -setRateTable(struct ath_hal *ah, HAL_CHANNEL *chan, +setRateTable(struct ath_hal *ah, const struct ieee80211_channel *chan, int16_t tpcScaleReduction, int16_t powerLimit, int16_t *pMinPower, int16_t *pMaxPower); static void -calctxpower(struct ath_hal *ah, int nchan, HAL_CHANNEL *chans, +calctxpower(struct ath_hal *ah, + int nchan, const struct ieee80211_channel *chans, int16_t tpcScaleReduction, int16_t powerLimit, int16_t *txpow) { int16_t minpow; @@ -979,12 +812,12 @@ int isdfs = 0; int is4ms = 0; static int -anychan(const HAL_CHANNEL *chans, int nc, int flag) +anychan(const struct ieee80211_channel *chans, int nc, int flag) { int i; for (i = 0; i < nc; i++) - if ((chans[i].privFlags & flag) != 0) + if ((chans[i].ic_flags & flag) != 0) return 1; return 0; } @@ -993,9 +826,9 @@ static __inline int mapgsm(u_int freq, u_int flags) { freq *= 10; - if (flags & CHANNEL_QUARTER) + if (flags & IEEE80211_CHAN_QUARTER) freq += 5; - else if (flags & CHANNEL_HALF) + else if (flags & IEEE80211_CHAN_HALF) freq += 10; else freq += 20; @@ -1014,93 +847,85 @@ mappsb(u_int freq, u_int flags) int ath_hal_mhz2ieee(struct ath_hal *ah, u_int freq, u_int flags) { - if (flags & CHANNEL_2GHZ) { /* 2GHz band */ + if (flags & IEEE80211_CHAN_2GHZ) { /* 2GHz band */ if (freq == 2484) return 14; - if (freq < 2484) { - if (ath_hal_isgsmsku(ah)) - return mapgsm(freq, flags); + if (freq < 2484) return ((int)freq - 2407) / 5; - } else + else return 15 + ((freq - 2512) / 20); - } else if (flags & CHANNEL_5GHZ) {/* 5Ghz band */ - if (ath_hal_ispublicsafetysku(ah) && - IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq)) { + } else if (flags & IEEE80211_CHAN_5GHZ) {/* 5Ghz band */ + if (IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq)) return mappsb(freq, flags); - } else if ((flags & CHANNEL_A) && (freq <= 5000)) { + else if ((flags & IEEE80211_CHAN_A) && (freq <= 5000)) return (freq - 4000) / 5; - } else { + else return (freq - 5000) / 5; - } } else { /* either, guess */ if (freq == 2484) return 14; - if (freq < 2484) { - if (ath_hal_isgsmsku(ah)) - return mapgsm(freq, flags); + if (freq < 2484) return ((int)freq - 2407) / 5; - } if (freq < 5000) { - if (ath_hal_ispublicsafetysku(ah) && - IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq)) { + if (IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq)) return mappsb(freq, flags); - } else if (freq > 4900) { + else if (freq > 4900) return (freq - 4000) / 5; - } else { + else return 15 + ((freq - 2512) / 20); - } } return (freq - 5000) / 5; } } -#define IS_CHAN_DFS(_c) (((_c)->privFlags & CHANNEL_DFS) != 0) -#define IS_CHAN_4MS(_c) (((_c)->privFlags & CHANNEL_4MS_LIMIT) != 0) +#define IEEE80211_IS_CHAN_4MS(_c) \ + (((_c)->ic_flags & IEEE80211_CHAN_4MSXMIT) != 0) static void -dumpchannels(struct ath_hal *ah, int nc, HAL_CHANNEL *chans, int16_t *txpow) +dumpchannels(struct ath_hal *ah, int nc, + const struct ieee80211_channel *chans, int16_t *txpow) { int i; for (i = 0; i < nc; i++) { - HAL_CHANNEL *c = &chans[i]; + const struct ieee80211_channel *c = &chans[i]; int type; if (showchannels) printf("%s%3d", sep, - ath_hal_mhz2ieee(ah, c->channel, c->channelFlags)); + ath_hal_mhz2ieee(ah, c->ic_freq, c->ic_flags)); else - printf("%s%u", sep, c->channel); - if (IS_CHAN_HALF_RATE(c)) + printf("%s%u", sep, c->ic_freq); + if (IEEE80211_IS_CHAN_HALF(c)) type = 'H'; - else if (IS_CHAN_QUARTER_RATE(c)) + else if (IEEE80211_IS_CHAN_QUARTER(c)) type = 'Q'; - else if (IS_CHAN_TURBO(c)) + else if (IEEE80211_IS_CHAN_TURBO(c)) type = 'T'; - else if (IS_CHAN_HT(c)) + else if (IEEE80211_IS_CHAN_HT(c)) type = 'N'; - else if (IS_CHAN_A(c)) + else if (IEEE80211_IS_CHAN_A(c)) type = 'A'; - else if (IS_CHAN_108G(c)) + else if (IEEE80211_IS_CHAN_108G(c)) type = 'T'; - else if (IS_CHAN_G(c)) + else if (IEEE80211_IS_CHAN_G(c)) type = 'G'; else type = 'B'; - if (dopassive && IS_CHAN_PASSIVE(c)) + if (dopassive && IEEE80211_IS_CHAN_PASSIVE(c)) type = tolower(type); if (isdfs && is4ms) printf("%c%c%c %d.%d", type, - IS_CHAN_DFS(c) ? '*' : ' ', - IS_CHAN_4MS(c) ? '4' : ' ', + IEEE80211_IS_CHAN_DFS(c) ? '*' : ' ', + IEEE80211_IS_CHAN_4MS(c) ? '4' : ' ', txpow[i]/2, (txpow[i]%2)*5); else if (isdfs) printf("%c%c %d.%d", type, - IS_CHAN_DFS(c) ? '*' : ' ', + IEEE80211_IS_CHAN_DFS(c) ? '*' : ' ', txpow[i]/2, (txpow[i]%2)*5); else if (is4ms) printf("%c%c %d.%d", type, - IS_CHAN_4MS(c) ? '4' : ' ', + IEEE80211_IS_CHAN_4MS(c) ? '4' : ' ', txpow[i]/2, (txpow[i]%2)*5); else printf("%c %d.%d", type, txpow[i]/2, (txpow[i]%2)*5); @@ -1112,25 +937,12 @@ dumpchannels(struct ath_hal *ah, int nc, } static void -checkchannels(struct ath_hal *ah, HAL_CHANNEL *chans, int nchan) -{ - int i; - - for (i = 0; i < nchan; i++) { - HAL_CHANNEL *c = &chans[i]; - if (!ath_hal_checkchannel(ah, c)) - printf("Channel %u (0x%x) disallowed\n", - c->channel, c->channelFlags); - } -} - -static void -intersect(HAL_CHANNEL *dst, int16_t *dtxpow, int *nd, - const HAL_CHANNEL *src, int16_t *stxpow, int ns) +intersect(struct ieee80211_channel *dst, int16_t *dtxpow, int *nd, + const struct ieee80211_channel *src, int16_t *stxpow, int ns) { int i = 0, j, k, l; while (i < *nd) { - for (j = 0; j < ns && dst[i].channel != src[j].channel; j++) + for (j = 0; j < ns && dst[i].ic_freq != src[j].ic_freq; j++) ; if (j < ns && dtxpow[i] == stxpow[j]) { for (k = i+1, l = i; k < *nd; k++, l++) @@ -1149,7 +961,7 @@ usage(const char *progname) } static HAL_BOOL -getChipPowerLimits(struct ath_hal *ah, HAL_CHANNEL *chans, u_int32_t nchan) +getChipPowerLimits(struct ath_hal *ah, struct ieee80211_channel *chan) { } @@ -1199,25 +1011,23 @@ main(int argc, char *argv[]) static const u_int16_t tpcScaleReductionTable[5] = { 0, 3, 6, 9, MAX_RATE_POWER }; struct ath_hal_private ahp; - HAL_CHANNEL achans[IEEE80211_CHAN_MAX]; + struct ieee80211_channel achans[IEEE80211_CHAN_MAX]; int16_t atxpow[IEEE80211_CHAN_MAX]; - HAL_CHANNEL bchans[IEEE80211_CHAN_MAX]; + struct ieee80211_channel bchans[IEEE80211_CHAN_MAX]; int16_t btxpow[IEEE80211_CHAN_MAX]; - HAL_CHANNEL gchans[IEEE80211_CHAN_MAX]; + struct ieee80211_channel gchans[IEEE80211_CHAN_MAX]; int16_t gtxpow[IEEE80211_CHAN_MAX]; - HAL_CHANNEL tchans[IEEE80211_CHAN_MAX]; + struct ieee80211_channel tchans[IEEE80211_CHAN_MAX]; int16_t ttxpow[IEEE80211_CHAN_MAX]; - HAL_CHANNEL tgchans[IEEE80211_CHAN_MAX]; + struct ieee80211_channel tgchans[IEEE80211_CHAN_MAX]; int16_t tgtxpow[IEEE80211_CHAN_MAX]; - HAL_CHANNEL nchans[IEEE80211_CHAN_MAX]; + struct ieee80211_channel nchans[IEEE80211_CHAN_MAX]; int16_t ntxpow[IEEE80211_CHAN_MAX]; int i, na, nb, ng, nt, ntg, nn; HAL_BOOL showall = AH_FALSE; HAL_BOOL extendedChanMode = AH_TRUE; int modes = 0; int16_t tpcReduction, powerLimit; - int8_t regids[IEEE80211_REGCLASSIDS_MAX]; - int nregids; int showdfs = 0; int show4ms = 0; @@ -1239,7 +1049,7 @@ main(int argc, char *argv[]) tpcReduction = tpcScaleReductionTable[0]; powerLimit = MAX_RATE_POWER; - while ((i = getopt(argc, argv, "acdefoilm:pr4ABGhHNT")) != -1) + while ((i = getopt(argc, argv, "acdeflm:pr4ABGhHNT")) != -1) switch (i) { case 'a': showall = AH_TRUE; @@ -1256,12 +1066,6 @@ main(int argc, char *argv[]) case 'f': showchannels = AH_FALSE; break; - case 'o': - outdoor = AH_TRUE; - break; - case 'i': - outdoor = AH_FALSE; - break; case 'l': cclist(); rdlist(); @@ -1362,93 +1166,76 @@ main(int argc, char *argv[]) printf("\n%s (0x%x, %u)\n", getrdname(rd), rd, rd); - if (modes == 0) + if (modes == 0) { + /* NB: no HAL_MODE_HT */ modes = HAL_MODE_11A | HAL_MODE_11B | - HAL_MODE_11G | HAL_MODE_TURBO | HAL_MODE_108G | - HAL_MODE_HT; + HAL_MODE_11G | HAL_MODE_TURBO | HAL_MODE_108G; + } na = nb = ng = nt = ntg = nn = 0; if (modes & HAL_MODE_11G) { ahp.ah_currentRD = rd; - if (ath_hal_init_channels(&ahp.h, - gchans, IEEE80211_CHAN_MAX, &ng, - regids, IEEE80211_REGCLASSIDS_MAX, &nregids, - cc, HAL_MODE_11G, outdoor, extendedChanMode)) { - checkchannels(&ahp.h, gchans, ng); + if (ath_hal_getchannels(&ahp.h, gchans, IEEE80211_CHAN_MAX, &ng, + HAL_MODE_11G, cc, rd, extendedChanMode) == HAL_OK) { calctxpower(&ahp.h, ng, gchans, tpcReduction, powerLimit, gtxpow); if (showdfs) - isdfs |= anychan(gchans, ng, CHANNEL_DFS); + isdfs |= anychan(gchans, ng, IEEE80211_CHAN_DFS); if (show4ms) - is4ms |= anychan(gchans, ng, CHANNEL_4MS_LIMIT); + is4ms |= anychan(gchans, ng, IEEE80211_CHAN_4MSXMIT); } } if (modes & HAL_MODE_11B) { ahp.ah_currentRD = rd; - if (ath_hal_init_channels(&ahp.h, - bchans, IEEE80211_CHAN_MAX, &nb, - regids, IEEE80211_REGCLASSIDS_MAX, &nregids, - cc, HAL_MODE_11B, outdoor, extendedChanMode)) { - checkchannels(&ahp.h, bchans, nb); + if (ath_hal_getchannels(&ahp.h, bchans, IEEE80211_CHAN_MAX, &nb, + HAL_MODE_11B, cc, rd, extendedChanMode) == HAL_OK) { calctxpower(&ahp.h, nb, bchans, tpcReduction, powerLimit, btxpow); if (showdfs) - isdfs |= anychan(bchans, nb, CHANNEL_DFS); + isdfs |= anychan(bchans, nb, IEEE80211_CHAN_DFS); if (show4ms) - is4ms |= anychan(bchans, nb, CHANNEL_4MS_LIMIT); + is4ms |= anychan(bchans, nb, IEEE80211_CHAN_4MSXMIT); } } if (modes & HAL_MODE_11A) { ahp.ah_currentRD = rd; - if (ath_hal_init_channels(&ahp.h, - achans, IEEE80211_CHAN_MAX, &na, - regids, IEEE80211_REGCLASSIDS_MAX, &nregids, - cc, HAL_MODE_11A, outdoor, extendedChanMode)) { - checkchannels(&ahp.h, achans, na); + if (ath_hal_getchannels(&ahp.h, achans, IEEE80211_CHAN_MAX, &na, + HAL_MODE_11A, cc, rd, extendedChanMode) == HAL_OK) { calctxpower(&ahp.h, na, achans, tpcReduction, powerLimit, atxpow); if (showdfs) - isdfs |= anychan(achans, na, CHANNEL_DFS); + isdfs |= anychan(achans, na, IEEE80211_CHAN_DFS); if (show4ms) - is4ms |= anychan(achans, na, CHANNEL_4MS_LIMIT); + is4ms |= anychan(achans, na, IEEE80211_CHAN_4MSXMIT); } } if (modes & HAL_MODE_TURBO) { ahp.ah_currentRD = rd; - if (ath_hal_init_channels(&ahp.h, - tchans, IEEE80211_CHAN_MAX, &nt, - regids, IEEE80211_REGCLASSIDS_MAX, &nregids, - cc, HAL_MODE_TURBO, outdoor, extendedChanMode)) { - checkchannels(&ahp.h, tchans, nt); + if (ath_hal_getchannels(&ahp.h, tchans, IEEE80211_CHAN_MAX, &nt, + HAL_MODE_TURBO, cc, rd, extendedChanMode) == HAL_OK) { calctxpower(&ahp.h, nt, tchans, tpcReduction, powerLimit, ttxpow); if (showdfs) - isdfs |= anychan(tchans, nt, CHANNEL_DFS); + isdfs |= anychan(tchans, nt, IEEE80211_CHAN_DFS); if (show4ms) - is4ms |= anychan(tchans, nt, CHANNEL_4MS_LIMIT); + is4ms |= anychan(tchans, nt, IEEE80211_CHAN_4MSXMIT); } } if (modes & HAL_MODE_108G) { ahp.ah_currentRD = rd; - if (ath_hal_init_channels(&ahp.h, - tgchans, IEEE80211_CHAN_MAX, &ntg, - regids, IEEE80211_REGCLASSIDS_MAX, &nregids, - cc, HAL_MODE_108G, outdoor, extendedChanMode)) { - checkchannels(&ahp.h, tgchans, ntg); + if (ath_hal_getchannels(&ahp.h, tgchans, IEEE80211_CHAN_MAX, &ntg, + HAL_MODE_108G, cc, rd, extendedChanMode) == HAL_OK) { calctxpower(&ahp.h, ntg, tgchans, tpcReduction, powerLimit, tgtxpow); if (showdfs) - isdfs |= anychan(tgchans, ntg, CHANNEL_DFS); + isdfs |= anychan(tgchans, ntg, IEEE80211_CHAN_DFS); if (show4ms) - is4ms |= anychan(tgchans, ntg, CHANNEL_4MS_LIMIT); + is4ms |= anychan(tgchans, ntg, IEEE80211_CHAN_4MSXMIT); } } if (modes & HAL_MODE_HT) { ahp.ah_currentRD = rd; - if (ath_hal_init_channels(&ahp.h, - nchans, IEEE80211_CHAN_MAX, &nn, - regids, IEEE80211_REGCLASSIDS_MAX, &nregids, - cc, modes & HAL_MODE_HT, outdoor, extendedChanMode)) { - checkchannels(&ahp.h, nchans, nn); + if (ath_hal_getchannels(&ahp.h, nchans, IEEE80211_CHAN_MAX, &nn, + modes & HAL_MODE_HT, cc, rd, extendedChanMode) == HAL_OK) { calctxpower(&ahp.h, nn, nchans, tpcReduction, powerLimit, ntxpow); if (showdfs) - isdfs |= anychan(nchans, nn, CHANNEL_DFS); + isdfs |= anychan(nchans, nn, IEEE80211_CHAN_DFS); if (show4ms) - is4ms |= anychan(nchans, nn, CHANNEL_4MS_LIMIT); + is4ms |= anychan(nchans, nn, IEEE80211_CHAN_4MSXMIT); } } @@ -1623,7 +1410,7 @@ interpolate(u_int16_t target, u_int16_t * channel, and number of channels */ static void -ar5212GetTargetPowers(struct ath_hal *ah, HAL_CHANNEL *chan, +ar5212GetTargetPowers(struct ath_hal *ah, const struct ieee80211_channel *chan, TRGT_POWER_INFO *powInfo, u_int16_t numChannels, TRGT_POWER_INFO *pNewPower) { @@ -1636,7 +1423,7 @@ ar5212GetTargetPowers(struct ath_hal *ah for (i = 0; i < numChannels; i++) tempChannelList[i] = powInfo[i].testChannel; - ar5212GetLowerUpperValues(chan->channel, tempChannelList, + ar5212GetLowerUpperValues(chan->ic_freq, tempChannelList, numChannels, &clo, &chi); /* Get the indices for the channel */ @@ -1655,13 +1442,13 @@ ar5212GetTargetPowers(struct ath_hal *ah * Get the lower and upper channels, target powers, * and interpolate between them. */ - pNewPower->twicePwr6_24 = interpolate(chan->channel, clo, chi, + pNewPower->twicePwr6_24 = interpolate(chan->ic_freq, clo, chi, powInfo[ixlo].twicePwr6_24, powInfo[ixhi].twicePwr6_24); - pNewPower->twicePwr36 = interpolate(chan->channel, clo, chi, + pNewPower->twicePwr36 = interpolate(chan->ic_freq, clo, chi, powInfo[ixlo].twicePwr36, powInfo[ixhi].twicePwr36); - pNewPower->twicePwr48 = interpolate(chan->channel, clo, chi, + pNewPower->twicePwr48 = interpolate(chan->ic_freq, clo, chi, powInfo[ixlo].twicePwr48, powInfo[ixhi].twicePwr48); - pNewPower->twicePwr54 = interpolate(chan->channel, clo, chi, + pNewPower->twicePwr54 = interpolate(chan->ic_freq, clo, chi, powInfo[ixlo].twicePwr54, powInfo[ixhi].twicePwr54); } @@ -1681,7 +1468,7 @@ findEdgePower(struct ath_hal *ah, u_int * operating channel and mode. */ static HAL_BOOL -setRateTable(struct ath_hal *ah, HAL_CHANNEL *chan, +setRateTable(struct ath_hal *ah, const struct ieee80211_channel *chan, int16_t tpcScaleReduction, int16_t powerLimit, int16_t *pMinPower, int16_t *pMaxPower) { @@ -1694,7 +1481,7 @@ setRateTable(struct ath_hal *ah, HAL_CHA int16_t scaledPower; u_int8_t cfgCtl; - twiceMaxRDPower = chan->maxRegTxPower * 2; + twiceMaxRDPower = chan->ic_maxregpower * 2; *pMaxPower = -MAX_RATE_POWER; *pMinPower = MAX_RATE_POWER; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Jan 29 23:29:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 051D11065670; Thu, 29 Jan 2009 23:29:08 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E72648FC0C; Thu, 29 Jan 2009 23:29:07 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0TNT72J068379; Thu, 29 Jan 2009 23:29:07 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0TNT7ft068378; Thu, 29 Jan 2009 23:29:07 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901292329.n0TNT7ft068378@svn.freebsd.org> From: Sam Leffler Date: Thu, 29 Jan 2009 23:29:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187905 - head/tools/tools/ath/athstats X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2009 23:29:09 -0000 Author: sam Date: Thu Jan 29 23:29:07 2009 New Revision: 187905 URL: http://svn.freebsd.org/changeset/base/187905 Log: track hal changes Modified: head/tools/tools/ath/athstats/Makefile Modified: head/tools/tools/ath/athstats/Makefile ============================================================================== --- head/tools/tools/ath/athstats/Makefile Thu Jan 29 23:24:21 2009 (r187904) +++ head/tools/tools/ath/athstats/Makefile Thu Jan 29 23:29:07 2009 (r187905) @@ -23,4 +23,6 @@ athstats.o: opt_ah.h ah_osdep.h opt_ah.h: touch opt_ah.h ah_osdep.h: - touch ah_osdep.h + echo 'typedef void *HAL_SOFTC;' >ah_osdep.h + echo 'typedef int HAL_BUS_TAG;' >>ah_osdep.h + echo 'typedef void *HAL_BUS_HANDLE;' >>ah_osdep.h From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 00:22:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 540011065673; Fri, 30 Jan 2009 00:22:08 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 417808FC18; Fri, 30 Jan 2009 00:22:08 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0U0M8oI069527; Fri, 30 Jan 2009 00:22:08 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0U0M8x7069526; Fri, 30 Jan 2009 00:22:08 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <200901300022.n0U0M8x7069526@svn.freebsd.org> From: "David E. O'Brien" Date: Fri, 30 Jan 2009 00:22:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187907 - head/gnu/usr.bin/grep X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 00:22:08 -0000 Author: obrien Date: Fri Jan 30 00:22:08 2009 New Revision: 187907 URL: http://svn.freebsd.org/changeset/base/187907 Log: For files not named on the command line, only the basename is compared to the exclude pattern. Change this so that "grep --exclude='*/.svn/*' -[Rr] foo *" DWIM. Obtained from: dave+news001@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (Dave Gibson) Obtained from: comp.unix.questions [Thu, 15 Mar 2007 18:54:38 +0000] Obtained from: http://unix.derkeiler.com/Newsgroups/comp.unix.questions/2007-03/msg00046.html Modified: head/gnu/usr.bin/grep/savedir.c Modified: head/gnu/usr.bin/grep/savedir.c ============================================================================== --- head/gnu/usr.bin/grep/savedir.c Thu Jan 29 23:30:17 2009 (r187906) +++ head/gnu/usr.bin/grep/savedir.c Fri Jan 30 00:22:08 2009 (r187907) @@ -17,6 +17,9 @@ /* Written by David MacKenzie . */ +#include +__FBSDID("$FreeBSD$"); + #if HAVE_CONFIG_H # include #endif @@ -137,10 +140,10 @@ savedir (const char *dir, off_t name_siz && !isdir1 (dir, dp->d_name)) { if (included_patterns - && !excluded_filename (included_patterns, dp->d_name, 0)) + && !excluded_filename (included_patterns, path, 0)) continue; if (excluded_patterns - && excluded_filename (excluded_patterns, dp->d_name, 0)) + && excluded_filename (excluded_patterns, path, 0)) continue; } From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 03:41:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B493F106564A; Fri, 30 Jan 2009 03:41:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A30D78FC08; Fri, 30 Jan 2009 03:41:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0U3fjwA078341; Fri, 30 Jan 2009 03:41:45 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0U3fjng078340; Fri, 30 Jan 2009 03:41:45 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200901300341.n0U3fjng078340@svn.freebsd.org> From: Warner Losh Date: Fri, 30 Jan 2009 03:41:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187909 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 03:41:46 -0000 Author: imp Date: Fri Jan 30 03:41:45 2009 New Revision: 187909 URL: http://svn.freebsd.org/changeset/base/187909 Log: Spawn one fewer shells on startup. We don't use dhcp_interfaces at all in this function, and grep shows no other instances of it (besides, this is a function, and in a sub-shell, so all changes are local). Modified: head/etc/rc.d/defaultroute Modified: head/etc/rc.d/defaultroute ============================================================================== --- head/etc/rc.d/defaultroute Fri Jan 30 02:39:08 2009 (r187908) +++ head/etc/rc.d/defaultroute Fri Jan 30 03:41:45 2009 (r187909) @@ -21,7 +21,6 @@ defaultroute_start() # Return without waiting if we don't have dhcp interfaces. # Once we can test that the link is actually up, we should # remove this test and always wait. - dhcp_interfaces=`list_net_interfaces dhcp` [ -z "`list_net_interfaces dhcp`" ] && return # Wait for a default route From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 05:49:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8948A106566B; Fri, 30 Jan 2009 05:49:27 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7776F8FC14; Fri, 30 Jan 2009 05:49:27 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0U5nRYL080566; Fri, 30 Jan 2009 05:49:27 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0U5nRpu080565; Fri, 30 Jan 2009 05:49:27 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200901300549.n0U5nRpu080565@svn.freebsd.org> From: Tim Kientzle Date: Fri, 30 Jan 2009 05:49:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187910 - head/usr.sbin/mtree X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 05:49:27 -0000 Author: kientzle Date: Fri Jan 30 05:49:27 2009 New Revision: 187910 URL: http://svn.freebsd.org/changeset/base/187910 Log: Accept integer times. Previously, the field "time=1233294539" would be rejected as invalid. Modified: head/usr.sbin/mtree/spec.c Modified: head/usr.sbin/mtree/spec.c ============================================================================== --- head/usr.sbin/mtree/spec.c Fri Jan 30 03:41:45 2009 (r187909) +++ head/usr.sbin/mtree/spec.c Fri Jan 30 05:49:27 2009 (r187910) @@ -254,14 +254,15 @@ set(char *t, NODE *ip) break; case F_TIME: ip->st_mtimespec.tv_sec = strtoul(val, &ep, 10); - if (*ep != '.') - errx(1, "line %d: invalid time %s", - lineno, val); - val = ep + 1; - ip->st_mtimespec.tv_nsec = strtoul(val, &ep, 10); + if (*ep == '.') { + val = ep + 1; + ip->st_mtimespec.tv_nsec + = strtoul(val, &ep, 10); + } else + ip->st_mtimespec.tv_nsec = 0; if (*ep) errx(1, "line %d: invalid time %s", - lineno, val); + lineno, val); break; case F_TYPE: switch(*val) { From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 07:01:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17B61106567D; Fri, 30 Jan 2009 07:01:33 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 055128FC17; Fri, 30 Jan 2009 07:01:33 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0U71WIk082176; Fri, 30 Jan 2009 07:01:32 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0U71WvA082175; Fri, 30 Jan 2009 07:01:32 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200901300701.n0U71WvA082175@svn.freebsd.org> From: Andrew Thompson Date: Fri, 30 Jan 2009 07:01:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187911 - head/sys/arm/arm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 07:01:34 -0000 Author: thompsa Date: Fri Jan 30 07:01:32 2009 New Revision: 187911 URL: http://svn.freebsd.org/changeset/base/187911 Log: Increment total_bounced busdma stat as required. Modified: head/sys/arm/arm/busdma_machdep.c Modified: head/sys/arm/arm/busdma_machdep.c ============================================================================== --- head/sys/arm/arm/busdma_machdep.c Fri Jan 30 05:49:27 2009 (r187910) +++ head/sys/arm/arm/busdma_machdep.c Fri Jan 30 07:01:32 2009 (r187911) @@ -1144,6 +1144,7 @@ _bus_dmamap_sync_bp(bus_dma_tag_t dmat, cpu_l2cache_wb_range(bpage->vaddr, bpage->datacount); } + dmat->bounce_zone->total_bounced++; } if (op & BUS_DMASYNC_POSTREAD) { if (bpage->vaddr_nocache == 0) { @@ -1155,6 +1156,7 @@ _bus_dmamap_sync_bp(bus_dma_tag_t dmat, bcopy((void *)(bpage->vaddr_nocache != 0 ? bpage->vaddr_nocache : bpage->vaddr), (void *)bpage->datavaddr, bpage->datacount); + dmat->bounce_zone->total_bounced++; } } } From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 07:24:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 044591065674; Fri, 30 Jan 2009 07:24:53 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from smtp.timeweb.ru (smtp.timeweb.ru [217.170.79.85]) by mx1.freebsd.org (Postfix) with ESMTP id AE5888FC0C; Fri, 30 Jan 2009 07:24:52 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from [213.148.20.85] (helo=hive.panopticon) by smtp.timeweb.ru with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1LSn49-0002Vr-G9; Fri, 30 Jan 2009 09:41:25 +0300 Received: from hades.panopticon (hades.panopticon [192.168.0.32]) by hive.panopticon (Postfix) with ESMTP id 5959612DDE; Fri, 30 Jan 2009 01:54:45 +0300 (MSK) Received: by hades.panopticon (Postfix, from userid 1000) id B5E8B108838; Fri, 30 Jan 2009 01:55:18 +0000 (UTC) Date: Fri, 30 Jan 2009 01:55:18 +0000 From: Dmitry Marakasov To: "David E. O'Brien" Message-ID: <20090130015518.GA20404@hades.panopticon> References: <200901130653.n0D6rrNX092719@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <200901130653.n0D6rrNX092719@svn.freebsd.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 07:24:53 -0000 * David E. O'Brien (obrien@FreeBSD.org) wrote: I think this should be backed out. Those verbose messages: - Are completely unexpected, this violates POLA. - Do break recognizeable make output people are used to - Really uglify make output for some custom makefiles (for example, generated by cmake: --- po/it.gmo --- [ 2%] Generating it.gmo --- po/kn.gmo --- [ 3%] Generating kn.gmo --- po/lv.gmo --- [ 3%] Generating lv.gmo --- po/nb.gmo --- [ 3%] Generating nb.gmo There's golden unix way rule: silence is golden. So please back this out, as this will really annoy many people. > Author: obrien > Date: Tue Jan 13 06:53:53 2009 > New Revision: 187132 > URL: http://svn.freebsd.org/changeset/base/187132 > > Log: > Don't enable -Q by default - I've fixed the rescue build issue. > > Modified: > head/usr.bin/make/job.c > head/usr.bin/make/main.c > > Modified: head/usr.bin/make/job.c > ============================================================================== > --- head/usr.bin/make/job.c Tue Jan 13 06:52:51 2009 (r187131) > +++ head/usr.bin/make/job.c Tue Jan 13 06:53:53 2009 (r187132) > @@ -2362,8 +2362,7 @@ Job_Init(int maxproc) > makeErrors = 0; > > lastNode = NULL; > - > - if ((maxJobs == 1 && fifoFd < 0) || beQuiet || beVerbose == 0) { > + if ((maxJobs == 1 && fifoFd < 0) || is_posix || beQuiet) { > /* > * If only one job can run at a time, there's no need for a > * banner, no is there? > > Modified: head/usr.bin/make/main.c > ============================================================================== > --- head/usr.bin/make/main.c Tue Jan 13 06:52:51 2009 (r187131) > +++ head/usr.bin/make/main.c Tue Jan 13 06:53:53 2009 (r187132) > @@ -126,7 +126,7 @@ Boolean is_posix; /* .POSIX target seen > Boolean mfAutoDeps; /* .MAKEFILEDEPS target seen */ > Boolean beSilent; /* -s flag */ > Boolean beVerbose; /* -v flag */ > -Boolean beQuiet = TRUE; /* -Q flag */ > +Boolean beQuiet; /* -Q flag */ > Boolean compatMake; /* -B argument */ > int debug; /* -d flag */ > Boolean ignoreErrors; /* -i flag */ > @@ -519,6 +519,7 @@ rearg: > break; > case 'Q': > beQuiet = TRUE; > + beVerbose = FALSE; > MFLAGS_append("-Q", NULL); > break; > case 'q': > _______________________________________________ > 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" -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 09:42:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 421501065676; Fri, 30 Jan 2009 09:42:26 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30FDF8FC21; Fri, 30 Jan 2009 09:42:26 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0U9gQK7085118; Fri, 30 Jan 2009 09:42:26 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0U9gQDC085117; Fri, 30 Jan 2009 09:42:26 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <200901300942.n0U9gQDC085117@svn.freebsd.org> From: Maxim Konovalov Date: Fri, 30 Jan 2009 09:42:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187913 - head/libexec/ftpd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 09:42:27 -0000 Author: maxim Date: Fri Jan 30 09:42:25 2009 New Revision: 187913 URL: http://svn.freebsd.org/changeset/base/187913 Log: o Fix typo: indentical -> identical. PR: docs/131149 Submitted by: Patrick Oonk MFC after: 1 week Modified: head/libexec/ftpd/ftpd.8 Modified: head/libexec/ftpd/ftpd.8 ============================================================================== --- head/libexec/ftpd/ftpd.8 Fri Jan 30 07:14:20 2009 (r187912) +++ head/libexec/ftpd/ftpd.8 Fri Jan 30 09:42:25 2009 (r187913) @@ -205,7 +205,7 @@ for more information. Note that option is a virtual no-op in .Fx 5.0 and above; both port -ranges are indentical by default. +ranges are identical by default. .It Fl u The default file creation mode mask is set to .Ar umask , From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 11:34:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89C65106564A; Fri, 30 Jan 2009 11:34:42 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85]) by mx1.freebsd.org (Postfix) with ESMTP id 4E71A8FC0C; Fri, 30 Jan 2009 11:34:42 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1]) by dragon.nuxi.org (8.14.2/8.14.2) with ESMTP id n0UBY30a001819; Fri, 30 Jan 2009 03:34:03 -0800 (PST) (envelope-from obrien@dragon.nuxi.org) Received: (from obrien@localhost) by dragon.nuxi.org (8.14.2/8.14.2/Submit) id n0UBY20H001818; Fri, 30 Jan 2009 03:34:02 -0800 (PST) (envelope-from obrien) Date: Fri, 30 Jan 2009 03:34:02 -0800 From: "David O'Brien" To: Dmitry Marakasov Message-ID: <20090130113402.GB92386@dragon.NUXI.org> References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090130015518.GA20404@hades.panopticon> X-Operating-System: FreeBSD 8.0-CURRENT User-Agent: Mutt/1.5.16 (2007-06-09) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 11:34:43 -0000 On Fri, Jan 30, 2009 at 01:55:18AM +0000, Dmitry Marakasov wrote: > * David E. O'Brien (obrien@FreeBSD.org) wrote: > > I think this should be backed out. Those verbose messages: > - Are completely unexpected, this violates POLA. Dmitry, I'm sorry I disagree. You're complaining about something that is a feature of FreeBSD 1.x, 2.0 - 3.0, 4.4BSD, all NetBSD versions, all OpenBSD versions, Sprite, and the Open Group's Open Development Environment make. Looking at my CSRG archive for usr.bin/make/job.c, all the back to: ---------------------------- revision 5.1 date: 1990/03/11 15:27:28; author: bostic; state: Exp; Initial revision ---------------------------- So I'm not sure how it violates POLA for a BSD user. They are quite valuable when you have to unwind a broken parallel build. There was no justification why the feature was changed in FreeBSD 3.1, other than presumably affordable multi-core/processor machines were not common at the time. > There's golden unix way rule: silence is golden. So please back this > out, as this will really annoy many people. The UNIX way is also not hiding information. For folks reporting build problems, it is valuable to be able to triag their log rather than continuously telling folks to re-run their build non -j. If you want "silence is golden" then all the multitude of lines of compiler invocation must really bug you. Perhaps we should have the quiet out put of the ncftp3 build where every complication takes only 1 line: Compiling DStrCat.so: [OK] Compiling DStrFree.so: [OK] Compiling Dynscpy.so: [OK] Compiling Strncpy.so: [OK] Compiling strtokc.so: [OK] ..snip.. -- -- David (obrien@FreeBSD.org) From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 12:26:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 833F2106564A for ; Fri, 30 Jan 2009 12:26:07 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.186]) by mx1.freebsd.org (Postfix) with ESMTP id 0C6148FC18 for ; Fri, 30 Jan 2009 12:26:06 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by mu-out-0910.google.com with SMTP id i2so381812mue.3 for ; Fri, 30 Jan 2009 04:26:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=+CJBbvus5Vx8myNeBXymRZQ+DXUwi+Tg5/y8NHk66hs=; b=xllqMOmUkunIo2KHs8qICzhc1DcLetDBN6rDGHxZWz/eK0cVFYzR17tjhG9PUVuXDT VhOmiyX3HGJm9hWaHGaVIBn6jOZgVgVobe1rsKEI1se3kItDzt2Te2QvH6lK2BDKRCd9 Qkglt3V5WSB7/v29CY/nBLcrVjtBRY9//r3z8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=SLeoqSiaYHRtUry/4e4mgaf3CohSTn2ldSOkLzhUIyDt1mTRR4BaiBFVxZObJgnuv0 FnLGXypHibT2CLCbk98bIpu3Y3tCuWxgwyIv8F8tpXQS7dIKE+UF7J75pD1vZ6UizsSJ h5+YekHJ1E/AGCmfJ64HQ0mpEBnCU2xzFMYoY= MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.181.5.14 with SMTP id h14mr416619bki.22.1233316935386; Fri, 30 Jan 2009 04:02:15 -0800 (PST) In-Reply-To: <20090130113402.GB92386@dragon.NUXI.org> References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> <20090130113402.GB92386@dragon.NUXI.org> Date: Fri, 30 Jan 2009 13:02:15 +0100 X-Google-Sender-Auth: be104199696cdda4 Message-ID: <9bbcef730901300402q61273d58q76472e585985fc3c@mail.gmail.com> From: Ivan Voras To: obrien@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Dmitry Marakasov , src-committers@freebsd.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 12:26:07 -0000 2009/1/30 David O'Brien : > compiler invocation must really bug you. Perhaps we should have the > quiet out put of the ncftp3 build where every complication takes only > 1 line: > > Compiling DStrCat.so: [OK] > Compiling DStrFree.so: [OK] > Compiling Dynscpy.so: [OK] > Compiling Strncpy.so: [OK] > Compiling strtokc.so: [OK] > ..snip.. I'd vote for that being the default :) It's also the mode used by Linux kernel (note that it's not a pro or a contra argument in itself), e.g. http://www.youtube.com/watch?v=elR7x50XZSI From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 12:52:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E3F310656C9 for ; Fri, 30 Jan 2009 12:52:34 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from ch-smtp02.sth.basefarm.net (ch-smtp02.sth.basefarm.net [80.76.149.213]) by mx1.freebsd.org (Postfix) with ESMTP id E69488FC12 for ; Fri, 30 Jan 2009 12:52:33 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from c83-255-48-78.bredband.comhem.se ([83.255.48.78]:50922 helo=falcon.midgard.homeip.net) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1LSscT-0005tt-7d for svn-src-head@freebsd.org; Fri, 30 Jan 2009 13:37:13 +0100 Received: (qmail 6195 invoked from network); 30 Jan 2009 13:37:11 +0100 Received: from owl.midgard.homeip.net (10.1.5.7) by falcon.midgard.homeip.net with ESMTP; 30 Jan 2009 13:37:11 +0100 Received: (qmail 89973 invoked by uid 1001); 30 Jan 2009 13:37:11 +0100 Date: Fri, 30 Jan 2009 13:37:11 +0100 From: Erik Trulsson To: Ivan Voras Message-ID: <20090130123711.GA89940@owl.midgard.homeip.net> References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> <20090130113402.GB92386@dragon.NUXI.org> <9bbcef730901300402q61273d58q76472e585985fc3c@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9bbcef730901300402q61273d58q76472e585985fc3c@mail.gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-IP: 83.255.48.78 X-Scan-Result: No virus found in message 1LSscT-0005tt-7d. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1LSscT-0005tt-7d 0572e53644b838feacd2ddbb01d34efd Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Dmitry Marakasov , src-committers@freebsd.org, obrien@freebsd.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 12:52:34 -0000 On Fri, Jan 30, 2009 at 01:02:15PM +0100, Ivan Voras wrote: > 2009/1/30 David O'Brien : > > > compiler invocation must really bug you. Perhaps we should have the > > quiet out put of the ncftp3 build where every complication takes only > > 1 line: > > > > Compiling DStrCat.so: [OK] > > Compiling DStrFree.so: [OK] > > Compiling Dynscpy.so: [OK] > > Compiling Strncpy.so: [OK] > > Compiling strtokc.so: [OK] > > ..snip.. > > I'd vote for that being the default :) I would not. In fact I am quite happy that is not the default. > > It's also the mode used by Linux kernel (note that it's not a pro or a > contra argument in itself), e.g. True, and it is a PITA when there is a problem with the compilation, since you need to add extra flags to the verbose output so you can find out what flags the compiler actually was invoked with. -- Erik Trulsson ertr1013@student.uu.se From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 13:21:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B6271065670; Fri, 30 Jan 2009 13:21:58 +0000 (UTC) (envelope-from Hartmut.Brandt@dlr.de) Received: from smtp-1.dlr.de (smtp-1.dlr.de [195.37.61.185]) by mx1.freebsd.org (Postfix) with ESMTP id E09978FC12; Fri, 30 Jan 2009 13:21:57 +0000 (UTC) (envelope-from Hartmut.Brandt@dlr.de) Received: from [129.247.12.11] ([129.247.12.11]) by smtp-1.dlr.de with Microsoft SMTPSVC(6.0.3790.1830); Fri, 30 Jan 2009 14:21:55 +0100 Message-ID: <4982FEF1.2000309@dlr.de> Date: Fri, 30 Jan 2009 14:21:53 +0100 From: Hartmut Brandt Organization: German Aerospace Center User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Erik Trulsson References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> <20090130113402.GB92386@dragon.NUXI.org> <9bbcef730901300402q61273d58q76472e585985fc3c@mail.gmail.com> <20090130123711.GA89940@owl.midgard.homeip.net> In-Reply-To: <20090130123711.GA89940@owl.midgard.homeip.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 30 Jan 2009 13:21:55.0821 (UTC) FILETIME=[B8E5A1D0:01C982DD] Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, obrien@freebsd.org, Dmitry Marakasov , Ivan Voras , svn-src-head@freebsd.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 13:21:59 -0000 Erik Trulsson wrote: > On Fri, Jan 30, 2009 at 01:02:15PM +0100, Ivan Voras wrote: >> 2009/1/30 David O'Brien : >> >>> compiler invocation must really bug you. Perhaps we should have the >>> quiet out put of the ncftp3 build where every complication takes only >>> 1 line: >>> >>> Compiling DStrCat.so: [OK] >>> Compiling DStrFree.so: [OK] >>> Compiling Dynscpy.so: [OK] >>> Compiling Strncpy.so: [OK] >>> Compiling strtokc.so: [OK] >>> ..snip.. >> I'd vote for that being the default :) > > I would not. In fact I am quite happy that is not the default. > >> It's also the mode used by Linux kernel (note that it's not a pro or a >> contra argument in itself), e.g. > > True, and it is a PITA when there is a problem with the compilation, since > you need to add extra flags to the verbose output so you can find out what > flags the compiler actually was invoked with. I took that vote as a joke. It may only be a joke, right? harti From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 14:27:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48954106564A for ; Fri, 30 Jan 2009 14:27:19 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from ch-smtp02.sth.basefarm.net (ch-smtp02.sth.basefarm.net [80.76.149.213]) by mx1.freebsd.org (Postfix) with ESMTP id C34FC8FC13 for ; Fri, 30 Jan 2009 14:27:18 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from c83-255-48-78.bredband.comhem.se ([83.255.48.78]:58434 helo=falcon.midgard.homeip.net) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1LSuKz-000385-7v for svn-src-head@freebsd.org; Fri, 30 Jan 2009 15:27:17 +0100 Received: (qmail 6783 invoked from network); 30 Jan 2009 15:20:35 +0100 Received: from owl.midgard.homeip.net (10.1.5.7) by falcon.midgard.homeip.net with ESMTP; 30 Jan 2009 15:20:35 +0100 Received: (qmail 90501 invoked by uid 1001); 30 Jan 2009 15:20:35 +0100 Date: Fri, 30 Jan 2009 15:20:35 +0100 From: Erik Trulsson To: Hartmut Brandt Message-ID: <20090130142035.GA90484@owl.midgard.homeip.net> References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> <20090130113402.GB92386@dragon.NUXI.org> <9bbcef730901300402q61273d58q76472e585985fc3c@mail.gmail.com> <20090130123711.GA89940@owl.midgard.homeip.net> <4982FEF1.2000309@dlr.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4982FEF1.2000309@dlr.de> User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-IP: 83.255.48.78 X-Scan-Result: No virus found in message 1LSuKz-000385-7v. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1LSuKz-000385-7v 372a829dfcfff6b3b7ad27f3a49586f3 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, obrien@freebsd.org, Dmitry Marakasov , Ivan Voras , svn-src-head@freebsd.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 14:27:19 -0000 On Fri, Jan 30, 2009 at 02:21:53PM +0100, Hartmut Brandt wrote: > Erik Trulsson wrote: > > On Fri, Jan 30, 2009 at 01:02:15PM +0100, Ivan Voras wrote: > >> 2009/1/30 David O'Brien : > >> > >>> compiler invocation must really bug you. Perhaps we should have the > >>> quiet out put of the ncftp3 build where every complication takes only > >>> 1 line: > >>> > >>> Compiling DStrCat.so: [OK] > >>> Compiling DStrFree.so: [OK] > >>> Compiling Dynscpy.so: [OK] > >>> Compiling Strncpy.so: [OK] > >>> Compiling strtokc.so: [OK] > >>> ..snip.. > >> I'd vote for that being the default :) > > > > I would not. In fact I am quite happy that is not the default. > > > >> It's also the mode used by Linux kernel (note that it's not a pro or a > >> contra argument in itself), e.g. > > > > True, and it is a PITA when there is a problem with the compilation, since > > you need to add extra flags to the verbose output so you can find out what > > flags the compiler actually was invoked with. > > I took that vote as a joke. It may only be a joke, right? It might well have been a joke. Probably was in fact, but I am not willing to take any chances on that. -- Erik Trulsson ertr1013@student.uu.se From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 14:28:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05FAA1065672; Fri, 30 Jan 2009 14:28:51 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E7E508FC08; Fri, 30 Jan 2009 14:28:50 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0UESoEa094237; Fri, 30 Jan 2009 14:28:50 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0UESow0094236; Fri, 30 Jan 2009 14:28:50 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200901301428.n0UESow0094236@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Fri, 30 Jan 2009 14:28:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187915 - head/usr.bin/sockstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 14:28:51 -0000 Author: des Date: Fri Jan 30 14:28:50 2009 New Revision: 187915 URL: http://svn.freebsd.org/changeset/base/187915 Log: Make sure the entries don't run into each other when they're longer than the allotted space. PR: bin/129318 Submitted by: Ighighi MFC after: 3 weeks Modified: head/usr.bin/sockstat/sockstat.c Modified: head/usr.bin/sockstat/sockstat.c ============================================================================== --- head/usr.bin/sockstat/sockstat.c Fri Jan 30 13:54:03 2009 (r187914) +++ head/usr.bin/sockstat/sockstat.c Fri Jan 30 14:28:50 2009 (r187915) @@ -596,25 +596,25 @@ display(void) continue; pos = 0; if ((pwd = getpwuid(xf->xf_uid)) == NULL) - pos += xprintf("%lu", (u_long)xf->xf_uid); + pos += xprintf("%lu ", (u_long)xf->xf_uid); else - pos += xprintf("%s", pwd->pw_name); + pos += xprintf("%s ", pwd->pw_name); while (pos < 9) pos += xprintf(" "); pos += xprintf("%.10s", getprocname(xf->xf_pid)); while (pos < 20) pos += xprintf(" "); - pos += xprintf("%lu", (u_long)xf->xf_pid); + pos += xprintf("%lu ", (u_long)xf->xf_pid); while (pos < 26) pos += xprintf(" "); - pos += xprintf("%d", xf->xf_fd); + pos += xprintf("%d ", xf->xf_fd); while (pos < 29) pos += xprintf(" "); pos += xprintf("%s", s->protoname); if (s->vflag & INP_IPV4) - pos += xprintf("4"); + pos += xprintf("4 "); if (s->vflag & INP_IPV6) - pos += xprintf("6"); + pos += xprintf("6 "); while (pos < 36) pos += xprintf(" "); switch (s->family) { From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 14:46:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 412691065672; Fri, 30 Jan 2009 14:46:32 +0000 (UTC) (envelope-from grafan@gmail.com) Received: from mail-fx0-f13.google.com (mail-fx0-f13.google.com [209.85.220.13]) by mx1.freebsd.org (Postfix) with ESMTP id 94FBA8FC08; Fri, 30 Jan 2009 14:46:27 +0000 (UTC) (envelope-from grafan@gmail.com) Received: by fxm6 with SMTP id 6so48435fxm.19 for ; Fri, 30 Jan 2009 06:46:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=tiyupraK+2ozFgHG1rYsDq+ijzNNNTTsPoDLVV/G1nQ=; b=bva9QnL1laSXAC1Ckx4Wr9UiDXtUba4WOECi3o1pT+x6BgVdsC3BB2212AtvL3sbdC 8rXJNpLT43Niuy/21lIGoayoCQFesfwn8RrT2/xj9Rta9Lwfnllz7mXYeYSLuqMJ546u xX5/vKYCGvN1yeBWHDbm6ekg1x184S1SnVDj4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=wq2IPoNXSay63d3b2hLXbRZxL1L8h+wEkO1G1ZaoRjCD+hRlk/5DwwLEQkJ4rj3rip IFGuIxpWmUwg/3cFrVL/9teXZ6vtXUI7FFLOETV3CL4kwVWesJDeHxqhnHYKV67e129z xrmxqSLVL8gnrAfIw2eRWbui1dNHyweiHDCaE= MIME-Version: 1.0 Received: by 10.181.217.2 with SMTP id u2mr453714bkq.153.1233326784406; Fri, 30 Jan 2009 06:46:24 -0800 (PST) In-Reply-To: <87hc3i8via.fsf@kobe.laptop> References: <200901272013.n0RKDOBR095434@svn.freebsd.org> <6eb82e0901272050l6678ea37idc8ea53e948a15e5@mail.gmail.com> <87r62nnb7t.fsf@kobe.laptop> <6eb82e0901282128o1e38724bsc2dd7a44ebb7de1e@mail.gmail.com> <87hc3i8via.fsf@kobe.laptop> Date: Fri, 30 Jan 2009 22:46:24 +0800 Message-ID: <6eb82e0901300646t220480bdj92e4a3c72e4bdced@mail.gmail.com> From: Rong-en Fan To: Giorgos Keramidas Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187782 - in head: etc/rc.d share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 14:46:32 -0000 On Thu, Jan 29, 2009 at 2:41 PM, Giorgos Keramidas wrote: > On Thu, 29 Jan 2009 13:28:39 +0800, Rong-en Fan wrote: >>>> Shouldn't we keep ntp running after the clock is adjusted? >>> >>> This is correct too. The effect of `ntpd_sync_on_start' is supposed to >>> be the same as if we run `ntpdate' before the real ntpd starts, so this >>> option only applies to the first sync-once instance of ntpd. The real >>> ntpd starts later, and finds the clock pre-synced. >> >> Hmm... I think I'm confused. According to rc.d/ntpd, if ntpd_sync_on_start >> is set to yes, it adds '-q -g' to rc_flags. By doing so, ntpd start makes >> ntpd exists immediately after the first sync. Then, who is responsible >> to start the "real ntpd" you said above? > > Oops, testing with ntpd_sync_on_start again I think I broke rc.d/ntpd. > > I thought precmd was run in _addition_ to the start rc command, but it > only runs before it and affects the flags of start too. I think I'll > back out the change until we the sync on start for real. > > The folowing seems to work much better, but it shows a duplicate message > about `Starting ntpd.' so I have reverted the broken change until I've > worked through the patch a bit more: Hmm... I think your patch here is already good enough. As for the duplicate message, it is unavoidable unless we change rc.subr (like adding a rc_silent). Regards, Rong-En Fan From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 14:55:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0ED2106566C; Fri, 30 Jan 2009 14:55:36 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from smtp.timeweb.ru (smtp.timeweb.ru [217.170.79.85]) by mx1.freebsd.org (Postfix) with ESMTP id 35F088FC26; Fri, 30 Jan 2009 14:55:35 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from [213.148.20.85] (helo=hive.panopticon) by smtp.timeweb.ru with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1LSumN-0004c9-I5; Fri, 30 Jan 2009 17:55:35 +0300 Received: from hades.panopticon (hades.panopticon [192.168.0.32]) by hive.panopticon (Postfix) with ESMTP id 83AC16AB8; Fri, 30 Jan 2009 17:55:55 +0300 (MSK) Received: by hades.panopticon (Postfix, from userid 1000) id 4219B108838; Fri, 30 Jan 2009 17:56:27 +0000 (UTC) Date: Fri, 30 Jan 2009 17:56:27 +0000 From: Dmitry Marakasov To: David O'Brien Message-ID: <20090130175627.GA20856@hades.panopticon> References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> <20090130113402.GB92386@dragon.NUXI.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20090130113402.GB92386@dragon.NUXI.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 14:55:37 -0000 * David O'Brien (obrien@freebsd.org) wrote: > I'm sorry I disagree. You're complaining about something that is > a feature of FreeBSD 1.x, 2.0 - 3.0, 4.4BSD, all NetBSD versions, > all OpenBSD versions, Sprite, and the Open Group's Open Development > Environment make. Nice. Well I've been using FreeBSD since 4.7, and I don't believe I've seen this once. > Looking at my CSRG archive for usr.bin/make/job.c, all the back to: > ---------------------------- > revision 5.1 > date: 1990/03/11 15:27:28; author: bostic; state: Exp; > Initial revision > ---------------------------- > > So I'm not sure how it violates POLA for a BSD user. Not `BSD user', but just `user'. We can't take somethink that was used back in FreBSD 3.0 as common and expected thing. By least astonishment I mean: - I do not expect to see difference between plain make and parallel make. - I do not expect extra messages - I do not expect behaviour change compared to previous version Remember, make is not only used in FreeBSD kernel, but also in ports (I know -j is not widely used there, but I believe it will someday) and by users themselves. Common knowledge is that make does echo commands executed by default. Then command's stdout/stderr may follow. But there are NO extra messages by default. > They are quite valuable when you have to unwind a broken parallel build. > > The UNIX way is also not hiding information. For folks reporting > build problems, it is valuable to be able to triag their log rather > than continuously telling folks to re-run their build non -j. > > If you want "silence is golden" then all the multitude of lines of > compiler invocation must really bug you. Perhaps we should have the > quiet out put of the ncftp3 build where every complication takes only > 1 line: > > Compiling DStrCat.so: [OK] > Compiling DStrFree.so: [OK] > Compiling Dynscpy.so: [OK] > Compiling Strncpy.so: [OK] > Compiling strtokc.so: [OK] > ..snip.. Have they modified make to display these? I doubt. I agree that such logs are more readable, but it should be done in a way that - does not affect third parties - still is more customizable and verbose than --- $TARGETNAME --- That is, change sys.mk: .c: ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} .c: .if defined (KERNEL_BUILDING) || defined (WORLD_BUILDING) # or how's that checked @echo "CC ${.TARGET}" .endif ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} so it's only conditional for system compilation. -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 15:14:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42D561065672; Fri, 30 Jan 2009 15:14:59 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 157D58FC08; Fri, 30 Jan 2009 15:14:59 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0UFEwRF095161; Fri, 30 Jan 2009 15:14:58 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0UFEw4S095158; Fri, 30 Jan 2009 15:14:58 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <200901301514.n0UFEw4S095158@svn.freebsd.org> From: Gabor Kovesdan Date: Fri, 30 Jan 2009 15:14:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187916 - in head/share/man: man7 man8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 15:15:00 -0000 Author: gabor (doc,ports committer) Date: Fri Jan 30 15:14:58 2009 New Revision: 187916 URL: http://svn.freebsd.org/changeset/base/187916 Log: - Rename adding_user(8) to adding_user(7). There's no adding_user utility, but the man page describes conceptual information about the process of adding a user, thus it should belong to section 7. - Remove HISTORY and BUGS sections because of the aforementioned reason. PR: docs/130151 Submitted by: Marian Cerny MFC after: 3 days Added: head/share/man/man7/adding_user.7 - copied, changed from r187915, head/share/man/man8/adding_user.8 Deleted: head/share/man/man8/adding_user.8 Modified: head/share/man/man7/Makefile head/share/man/man8/Makefile Modified: head/share/man/man7/Makefile ============================================================================== --- head/share/man/man7/Makefile Fri Jan 30 14:28:50 2009 (r187915) +++ head/share/man/man7/Makefile Fri Jan 30 15:14:58 2009 (r187916) @@ -2,7 +2,8 @@ # $FreeBSD$ #MISSING: eqnchar.7 ms.7 term.7 -MAN= ascii.7 \ +MAN= adding_user.7 \ + ascii.7 \ bsd.snmpmod.mk.7 \ build.7 \ clocks.7 \ Copied and modified: head/share/man/man7/adding_user.7 (from r187915, head/share/man/man8/adding_user.8) ============================================================================== --- head/share/man/man8/adding_user.8 Fri Jan 30 14:28:50 2009 (r187915, copy source) +++ head/share/man/man7/adding_user.7 Fri Jan 30 15:14:58 2009 (r187916) @@ -32,7 +32,7 @@ .\" @(#)adduser.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd June 5, 1993 +.Dd Jan 30, 2009 .Dt ADDING_USER 8 .Os .Sh NAME @@ -108,10 +108,3 @@ skeletal login directory .Xr adduser 8 , .Xr pwd_mkdb 8 , .Xr vipw 8 -.Sh HISTORY -The -.Nm -utility appeared in -.Bx 3.0 . -.Sh BUGS -User information should (and eventually will) be stored elsewhere. Modified: head/share/man/man8/Makefile ============================================================================== --- head/share/man/man8/Makefile Fri Jan 30 14:28:50 2009 (r187915) +++ head/share/man/man8/Makefile Fri Jan 30 15:14:58 2009 (r187916) @@ -1,8 +1,7 @@ # @(#)Makefile 8.1 (Berkeley) 6/5/93 # $FreeBSD$ -MAN= adding_user.8 \ - crash.8 \ +MAN= crash.8 \ diskless.8 \ intro.8 \ MAKEDEV.8 \ From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 15:27:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD3181065673; Fri, 30 Jan 2009 15:27:04 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AAFD28FC14; Fri, 30 Jan 2009 15:27:04 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0UFR44o095459; Fri, 30 Jan 2009 15:27:04 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0UFR4H9095458; Fri, 30 Jan 2009 15:27:04 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <200901301527.n0UFR4H9095458@svn.freebsd.org> From: Gabor Kovesdan Date: Fri, 30 Jan 2009 15:27:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187917 - head/sys/boot/i386/pxeldr X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 15:27:05 -0000 Author: gabor (doc,ports committer) Date: Fri Jan 30 15:27:04 2009 New Revision: 187917 URL: http://svn.freebsd.org/changeset/base/187917 Log: - Remove superfluous comment PR: docs/129400 Submitted by: Gavin Atkinson Modified: head/sys/boot/i386/pxeldr/pxeboot.8 Modified: head/sys/boot/i386/pxeldr/pxeboot.8 ============================================================================== --- head/sys/boot/i386/pxeldr/pxeboot.8 Fri Jan 30 15:14:58 2009 (r187916) +++ head/sys/boot/i386/pxeldr/pxeboot.8 Fri Jan 30 15:27:04 2009 (r187917) @@ -24,8 +24,6 @@ .\" .\" $FreeBSD$ .\" -.\" Note: The date here should be updated whenever a non-trivial -.\" change is made to the manual page. .Dd May 1, 2000 .Dt PXEBOOT 8 .Os From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 15:28:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AAF5106564A; Fri, 30 Jan 2009 15:28:36 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1908E8FC1C; Fri, 30 Jan 2009 15:28:36 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0UFSZ96095526; Fri, 30 Jan 2009 15:28:35 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0UFSZou095525; Fri, 30 Jan 2009 15:28:35 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <200901301528.n0UFSZou095525@svn.freebsd.org> From: Gabor Kovesdan Date: Fri, 30 Jan 2009 15:28:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187918 - head/lib/libc/db/man X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 15:28:36 -0000 Author: gabor (doc,ports committer) Date: Fri Jan 30 15:28:35 2009 New Revision: 187918 URL: http://svn.freebsd.org/changeset/base/187918 Log: - Remove superfluous comment PR: docs/129400 Submitted by: Gavin Atkinson Modified: head/lib/libc/db/man/dbm.3 Modified: head/lib/libc/db/man/dbm.3 ============================================================================== --- head/lib/libc/db/man/dbm.3 Fri Jan 30 15:27:04 2009 (r187917) +++ head/lib/libc/db/man/dbm.3 Fri Jan 30 15:28:35 2009 (r187918) @@ -15,8 +15,6 @@ .\" .\" $FreeBSD$ .\" -.\" Note: The date here should be updated whenever a non-trivial -.\" change is made to the manual page. .Dd April 16, 2006 .Dt DBM 3 .Os From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 15:28:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 773BE106575E; Fri, 30 Jan 2009 15:28:56 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62A6D8FC14; Fri, 30 Jan 2009 15:28:56 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0UFSuqf095570; Fri, 30 Jan 2009 15:28:56 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0UFSuHk095569; Fri, 30 Jan 2009 15:28:56 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <200901301528.n0UFSuHk095569@svn.freebsd.org> From: Gabor Kovesdan Date: Fri, 30 Jan 2009 15:28:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187919 - head/usr.sbin/gssd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 15:28:58 -0000 Author: gabor (doc,ports committer) Date: Fri Jan 30 15:28:56 2009 New Revision: 187919 URL: http://svn.freebsd.org/changeset/base/187919 Log: - Remove superfluous comment PR: docs/129400 Submitted by: Gavin Atkinson Modified: head/usr.sbin/gssd/gssd.8 Modified: head/usr.sbin/gssd/gssd.8 ============================================================================== --- head/usr.sbin/gssd/gssd.8 Fri Jan 30 15:28:35 2009 (r187918) +++ head/usr.sbin/gssd/gssd.8 Fri Jan 30 15:28:56 2009 (r187919) @@ -25,8 +25,6 @@ .\" .\" $FreeBSD$ .\" -.\" Note: The date here should be updated whenever a non-trivial -.\" change is made to the manual page. .Dd November 5, 2008 .Dt GSSD 8 .Os From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 15:43:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C517106568A; Fri, 30 Jan 2009 15:43:55 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A4518FC35; Fri, 30 Jan 2009 15:43:55 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0UFhtlh095877; Fri, 30 Jan 2009 15:43:55 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0UFhtth095876; Fri, 30 Jan 2009 15:43:55 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <200901301543.n0UFhtth095876@svn.freebsd.org> From: Gabor Kovesdan Date: Fri, 30 Jan 2009 15:43:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187920 - head/contrib/opie X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 15:43:56 -0000 Author: gabor (doc,ports committer) Date: Fri Jan 30 15:43:55 2009 New Revision: 187920 URL: http://svn.freebsd.org/changeset/base/187920 Log: - Remove non-existing reference - Fix trailing comma PR: docs/85118 Submitted by: vs MFC after: 3 days Modified: head/contrib/opie/opiekey.1 Modified: head/contrib/opie/opiekey.1 ============================================================================== --- head/contrib/opie/opiekey.1 Fri Jan 30 15:28:56 2009 (r187919) +++ head/contrib/opie/opiekey.1 Fri Jan 30 15:43:55 2009 (r187920) @@ -157,8 +157,7 @@ this mistake. Better checks are needed. .BR opieinfo (1), .BR opiekeys (5), .BR opieaccess (5), -.BR opiegen (1) -.BR su (1), +.BR su (1) .SH AUTHOR Bellcore's S/Key was written by Phil Karn, Neil M. Haller, and John S. Walden From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 15:54:28 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9C431065670; Fri, 30 Jan 2009 15:54:28 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 71EAA8FC1D; Fri, 30 Jan 2009 15:54:28 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n0UFp4WD049530; Fri, 30 Jan 2009 08:51:05 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Fri, 30 Jan 2009 08:51:30 -0700 (MST) Message-Id: <20090130.085130.-4349483.imp@bsdimp.com> To: amdmi3@amdmi3.ru From: "M. Warner Losh" In-Reply-To: <20090130015518.GA20404@hades.panopticon> References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, obrien@FreeBSD.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 15:54:29 -0000 In message: <20090130015518.GA20404@hades.panopticon> Dmitry Marakasov writes: : * David E. O'Brien (obrien@FreeBSD.org) wrote: : : I think this should be backed out. Those verbose messages: : - Are completely unexpected, this violates POLA. : - Do break recognizeable make output people are used to : - Really uglify make output for some custom makefiles (for example, : generated by cmake: : : --- po/it.gmo --- : [ 2%] Generating it.gmo : --- po/kn.gmo --- : [ 3%] Generating kn.gmo : --- po/lv.gmo --- : [ 3%] Generating lv.gmo : --- po/nb.gmo --- : [ 3%] Generating nb.gmo : : There's golden unix way rule: silence is golden. So please back this : out, as this will really annoy many people. This makes at least two requests... I hate them too. really really really hate them. -Q is default in all my trees. The real problem is that it exposes way too many internal target names that are totally baffling, even to me who has a lot of build experience. Also, it isn't clear how to use them. O'Brien says they were disabled in 1994 for no good reason without discussion, so he's turning them back on, without discussion. The project is a very different place than it was then, and doing this sort of thing is anti-social. Warner : > Author: obrien : > Date: Tue Jan 13 06:53:53 2009 : > New Revision: 187132 : > URL: http://svn.freebsd.org/changeset/base/187132 : > : > Log: : > Don't enable -Q by default - I've fixed the rescue build issue. : > : > Modified: : > head/usr.bin/make/job.c : > head/usr.bin/make/main.c : > : > Modified: head/usr.bin/make/job.c : > ============================================================================== : > --- head/usr.bin/make/job.c Tue Jan 13 06:52:51 2009 (r187131) : > +++ head/usr.bin/make/job.c Tue Jan 13 06:53:53 2009 (r187132) : > @@ -2362,8 +2362,7 @@ Job_Init(int maxproc) : > makeErrors = 0; : > : > lastNode = NULL; : > - : > - if ((maxJobs == 1 && fifoFd < 0) || beQuiet || beVerbose == 0) { : > + if ((maxJobs == 1 && fifoFd < 0) || is_posix || beQuiet) { : > /* : > * If only one job can run at a time, there's no need for a : > * banner, no is there? : > : > Modified: head/usr.bin/make/main.c : > ============================================================================== : > --- head/usr.bin/make/main.c Tue Jan 13 06:52:51 2009 (r187131) : > +++ head/usr.bin/make/main.c Tue Jan 13 06:53:53 2009 (r187132) : > @@ -126,7 +126,7 @@ Boolean is_posix; /* .POSIX target seen : > Boolean mfAutoDeps; /* .MAKEFILEDEPS target seen */ : > Boolean beSilent; /* -s flag */ : > Boolean beVerbose; /* -v flag */ : > -Boolean beQuiet = TRUE; /* -Q flag */ : > +Boolean beQuiet; /* -Q flag */ : > Boolean compatMake; /* -B argument */ : > int debug; /* -d flag */ : > Boolean ignoreErrors; /* -i flag */ : > @@ -519,6 +519,7 @@ rearg: : > break; : > case 'Q': : > beQuiet = TRUE; : > + beVerbose = FALSE; : > MFLAGS_append("-Q", NULL); : > break; : > case 'q': : > _______________________________________________ : > 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" : : -- : Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D : amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru : From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 15:57:13 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A19D10656C5; Fri, 30 Jan 2009 15:57:13 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 377358FC0C; Fri, 30 Jan 2009 15:57:13 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n0UFs9TH049554; Fri, 30 Jan 2009 08:54:09 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Fri, 30 Jan 2009 08:54:34 -0700 (MST) Message-Id: <20090130.085434.-1555413082.imp@bsdimp.com> To: obrien@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090130113402.GB92386@dragon.NUXI.org> References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> <20090130113402.GB92386@dragon.NUXI.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, amdmi3@amdmi3.ru, src-committers@FreeBSD.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 15:57:14 -0000 In message: <20090130113402.GB92386@dragon.NUXI.org> "David O'Brien" writes: : On Fri, Jan 30, 2009 at 01:55:18AM +0000, Dmitry Marakasov wrote: : > * David E. O'Brien (obrien@FreeBSD.org) wrote: : > : > I think this should be backed out. Those verbose messages: : > - Are completely unexpected, this violates POLA. : : Dmitry, : I'm sorry I disagree. You're complaining about something that is : a feature of FreeBSD 1.x, 2.0 - 3.0, 4.4BSD, all NetBSD versions, : all OpenBSD versions, Sprite, and the Open Group's Open Development : Environment make. David, I've said this before, and I'll say it again: The project is a very different place than in 1994 when 3.0 was released. You can't just unilaterally make such a large, use-visible feature change without discussion. Your history lesson is interesting, but we've moved beyond BSD in so many different ways. Also, I'm pretty sure that you've misread the NetBSD sources, since I never see that output when I build NetBSD. Warner From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 16:12:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33E2C106567A; Fri, 30 Jan 2009 16:12:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 222C18FC25; Fri, 30 Jan 2009 16:12:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0UGCXgq096491; Fri, 30 Jan 2009 16:12:33 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0UGCXdF096490; Fri, 30 Jan 2009 16:12:33 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200901301612.n0UGCXdF096490@svn.freebsd.org> From: Warner Losh Date: Fri, 30 Jan 2009 16:12:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187921 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 16:12:34 -0000 Author: imp Date: Fri Jan 30 16:12:32 2009 New Revision: 187921 URL: http://svn.freebsd.org/changeset/base/187921 Log: Unbreak make -s. There's about a 10% performance improvement with -s in many environments. The recent --- blah --- reintroduction has killed. That output makes almost no sense when all the other output is silenced. Modified: head/usr.bin/make/main.c Modified: head/usr.bin/make/main.c ============================================================================== --- head/usr.bin/make/main.c Fri Jan 30 15:43:55 2009 (r187920) +++ head/usr.bin/make/main.c Fri Jan 30 16:12:32 2009 (r187921) @@ -532,6 +532,7 @@ rearg: MFLAGS_append("-r", NULL); break; case 's': + beQuiet = TRUE; beSilent = TRUE; MFLAGS_append("-s", NULL); break; From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 16:23:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCEE41065670; Fri, 30 Jan 2009 16:23:57 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A10668FC1A; Fri, 30 Jan 2009 16:23:57 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0UGNv5a096791; Fri, 30 Jan 2009 16:23:57 GMT (envelope-from keramida@svn.freebsd.org) Received: (from keramida@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0UGNvmY096790; Fri, 30 Jan 2009 16:23:57 GMT (envelope-from keramida@svn.freebsd.org) Message-Id: <200901301623.n0UGNvmY096790@svn.freebsd.org> From: Giorgos Keramidas Date: Fri, 30 Jan 2009 16:23:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187922 - head/bin/dd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 16:23:58 -0000 Author: keramida (doc committer) Date: Fri Jan 30 16:23:57 2009 New Revision: 187922 URL: http://svn.freebsd.org/changeset/base/187922 Log: Bump .Dd for r187609 Modified: head/bin/dd/dd.1 Modified: head/bin/dd/dd.1 ============================================================================== --- head/bin/dd/dd.1 Fri Jan 30 16:12:32 2009 (r187921) +++ head/bin/dd/dd.1 Fri Jan 30 16:23:57 2009 (r187922) @@ -32,7 +32,7 @@ .\" @(#)dd.1 8.2 (Berkeley) 1/13/94 .\" $FreeBSD$ .\" -.Dd August 15, 2004 +.Dd January 23, 2009 .Dt DD 1 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 17:36:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71256106564A; Fri, 30 Jan 2009 17:36:03 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-bw0-f13.google.com (mail-bw0-f13.google.com [209.85.218.13]) by mx1.freebsd.org (Postfix) with ESMTP id 1BF718FC17; Fri, 30 Jan 2009 17:36:01 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by bwz6 with SMTP id 6so188945bwz.19 for ; Fri, 30 Jan 2009 09:36:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=yC6KV8jq6oWd7U6tUd58UtOzeVBy2t9D/wJzLLDfB1w=; b=a2abKAWR8+rdr+IL+xMLupjRI58KHJ0UY2WK/s3iQpmC6hmpV8X5WoQ8vPFI5KUTfy uwtyC5S0J87rFw2j7WFd1l5j/9GIyIrYoRKI1XnDcWtGiwGW40/1nwOTkKhA/DMy9pE9 0babHFrdMVoTimXIrz5wRqugFK7T0KdazKMfg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=MaRLFSjGXvGsr9eU3q/3HeF9k58NGnKUGZhvvs5pxwcj7ctY9oGr03I8a3A/iP9Ec4 2eIN8YRGpF9fLoaox07B5RVQ1VXAgvuEtLXxwJKqsKFR2a12O1mteJ3exOEaOBNpH5DG ZIsop+WfslOj78yo+7tk6my9SFtSWFzx+1ZZA= MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.181.141.7 with SMTP id t7mr507486bkn.61.1233336960923; Fri, 30 Jan 2009 09:36:00 -0800 (PST) In-Reply-To: <20090130142035.GA90484@owl.midgard.homeip.net> References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> <20090130113402.GB92386@dragon.NUXI.org> <9bbcef730901300402q61273d58q76472e585985fc3c@mail.gmail.com> <20090130123711.GA89940@owl.midgard.homeip.net> <4982FEF1.2000309@dlr.de> <20090130142035.GA90484@owl.midgard.homeip.net> Date: Fri, 30 Jan 2009 18:36:00 +0100 X-Google-Sender-Auth: 52e8d6cb73c1e6a4 Message-ID: <9bbcef730901300936u57b5ef8cn8b33cdb5efae97eb@mail.gmail.com> From: Ivan Voras To: Erik Trulsson Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, obrien@freebsd.org, Dmitry Marakasov , svn-src-head@freebsd.org, Hartmut Brandt Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 17:36:04 -0000 2009/1/30 Erik Trulsson : > On Fri, Jan 30, 2009 at 02:21:53PM +0100, Hartmut Brandt wrote: >> Erik Trulsson wrote: >> > On Fri, Jan 30, 2009 at 01:02:15PM +0100, Ivan Voras wrote: >> >> 2009/1/30 David O'Brien : >> >> >> >>> compiler invocation must really bug you. Perhaps we should have the >> >>> quiet out put of the ncftp3 build where every complication takes only >> >>> 1 line: >> >>> >> >>> Compiling DStrCat.so: [OK] >> >>> Compiling DStrFree.so: [OK] >> >>> Compiling Dynscpy.so: [OK] >> >>> Compiling Strncpy.so: [OK] >> >>> Compiling strtokc.so: [OK] >> >>> ..snip.. >> >> I'd vote for that being the default :) >> > >> > I would not. In fact I am quite happy that is not the default. >> > >> >> It's also the mode used by Linux kernel (note that it's not a pro or a >> >> contra argument in itself), e.g. >> > >> > True, and it is a PITA when there is a problem with the compilation, since >> > you need to add extra flags to the verbose output so you can find out what >> > flags the compiler actually was invoked with. >> >> I took that vote as a joke. It may only be a joke, right? > > It might well have been a joke. Probably was in fact, but I am not willing > to take any chances on that. I hoped that the over-the-top youtube video soundtrack would be a cue :) I was sure there was a video with parts of the Matrix soundtrack somewhere but I couldn't find it... But still, it's a long distance between what developers want and what users want. In this case, the best thing for non-developer users would be not to compile the system themselves but use bsdupdate for upgrading, so it makes sense to keep the build process tailored for developers. (on-topic: I've used FreeBSD since 4.2, I don't care what was in 4.4BSD). From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 17:40:43 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCF031065673; Fri, 30 Jan 2009 17:40:43 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85]) by mx1.freebsd.org (Postfix) with ESMTP id BC69D8FC12; Fri, 30 Jan 2009 17:40:43 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1]) by dragon.nuxi.org (8.14.2/8.14.2) with ESMTP id n0UHdsUW009715; Fri, 30 Jan 2009 09:39:54 -0800 (PST) (envelope-from obrien@dragon.nuxi.org) Received: (from obrien@localhost) by dragon.nuxi.org (8.14.2/8.14.2/Submit) id n0UHdred009714; Fri, 30 Jan 2009 09:39:53 -0800 (PST) (envelope-from obrien) Date: Fri, 30 Jan 2009 09:39:53 -0800 From: "David O'Brien" To: "M. Warner Losh" Message-ID: <20090130173953.GA9615@dragon.NUXI.org> References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> <20090130113402.GB92386@dragon.NUXI.org> <20090130.085434.-1555413082.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090130.085434.-1555413082.imp@bsdimp.com> X-Operating-System: FreeBSD 8.0-CURRENT User-Agent: Mutt/1.5.16 (2007-06-09) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, amdmi3@amdmi3.ru, src-committers@FreeBSD.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 17:40:44 -0000 On Fri, Jan 30, 2009 at 08:54:34AM -0700, M. Warner Losh wrote: > Also, I'm pretty sure that you've misread the NetBSD sources, since I > never see that output when I build NetBSD. Since I work with one of the NetBSD make maintainers, I'll ask him if there is something I've missed, or something he's adjusted on this. -- -- David (obrien@FreeBSD.org) From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 17:40:44 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41E291065674; Fri, 30 Jan 2009 17:40:44 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85]) by mx1.freebsd.org (Postfix) with ESMTP id 0502B8FC22; Fri, 30 Jan 2009 17:40:43 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1]) by dragon.nuxi.org (8.14.2/8.14.2) with ESMTP id n0UHdvlw009726; Fri, 30 Jan 2009 09:39:57 -0800 (PST) (envelope-from obrien@dragon.nuxi.org) Received: (from obrien@localhost) by dragon.nuxi.org (8.14.2/8.14.2/Submit) id n0UHdusH009725; Fri, 30 Jan 2009 09:39:56 -0800 (PST) (envelope-from obrien) Date: Fri, 30 Jan 2009 09:39:56 -0800 From: "David O'Brien" To: "M. Warner Losh" Message-ID: <20090130173956.GA9119@dragon.NUXI.org> References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> <20090130.085130.-4349483.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090130.085130.-4349483.imp@bsdimp.com> X-Operating-System: FreeBSD 8.0-CURRENT User-Agent: Mutt/1.5.16 (2007-06-09) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, amdmi3@amdmi3.ru, src-committers@FreeBSD.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 17:40:46 -0000 On Fri, Jan 30, 2009 at 08:51:30AM -0700, M. Warner Losh wrote: > In message: <20090130015518.GA20404@hades.panopticon> > Dmitry Marakasov writes: > : * David E. O'Brien (obrien@FreeBSD.org) wrote: > : I think this should be backed out. Those verbose messages: > : - Are completely unexpected, this violates POLA. > : - Do break recognizeable make output people are used to > : - Really uglify make output for some custom makefiles (for example, > : generated by cmake: .. > : There's golden unix way rule: silence is golden. So please back this > : out, as this will really annoy many people. > > This makes at least two requests... I hate them too. really really > really hate them. -Q is default in all my trees. > > The real problem is that it exposes way too many internal target names > that are totally baffling, even to me who has a lot of build > experience. Also, it isn't clear how to use them. > > O'Brien says they were disabled in 1994 for no good reason without > discussion, so he's turning them back on, without discussion. The > project is a very different place than it was then, and doing this > sort of thing is anti-social. s/1994/14-Nov-1998/ 100,000 of things change within FreeBSD without discission that displeases some set of folks. That's nothing new, but I'm restoring compatibility and functionailty, not removing it. I found src/Makefile.inc1 r134903 / rev 1.444 very noisy, but lived with it. I don't care that -s now implies -Q, except that it still leaves so much "noise" like r134903 / rev 1.444 and other output. [Why the log message is about 'Unanimous Consent' and not verbosity?] I wonder what % build speed improvement quieting that behind 'make -s' would give? -- -- David (obrien@FreeBSD.org) From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 17:49:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63DC51065670; Fri, 30 Jan 2009 17:49:25 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id 147058FC13; Fri, 30 Jan 2009 17:49:25 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from trouble.errno.com (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n0UHnOlo047798 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 30 Jan 2009 09:49:24 -0800 (PST) (envelope-from sam@freebsd.org) Message-ID: <49833DA4.3080407@freebsd.org> Date: Fri, 30 Jan 2009 09:49:24 -0800 From: Sam Leffler Organization: FreeBSD Project User-Agent: Thunderbird 2.0.0.18 (X11/20081209) MIME-Version: 1.0 To: obrien@freebsd.org References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> <20090130.085130.-4349483.imp@bsdimp.com> <20090130173956.GA9119@dragon.NUXI.org> In-Reply-To: <20090130173956.GA9119@dragon.NUXI.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DCC-sonic.net-Metrics: ebb.errno.com; whitelist Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 17:49:25 -0000 David O'Brien wrote: > On Fri, Jan 30, 2009 at 08:51:30AM -0700, M. Warner Losh wrote: > >> In message: <20090130015518.GA20404@hades.panopticon> >> Dmitry Marakasov writes: >> : * David E. O'Brien (obrien@FreeBSD.org) wrote: >> : I think this should be backed out. Those verbose messages: >> : - Are completely unexpected, this violates POLA. >> : - Do break recognizeable make output people are used to >> : - Really uglify make output for some custom makefiles (for example, >> : generated by cmake: >> > .. > >> : There's golden unix way rule: silence is golden. So please back this >> : out, as this will really annoy many people. >> >> This makes at least two requests... I hate them too. really really >> really hate them. -Q is default in all my trees. >> >> The real problem is that it exposes way too many internal target names >> that are totally baffling, even to me who has a lot of build >> experience. Also, it isn't clear how to use them. >> >> O'Brien says they were disabled in 1994 for no good reason without >> discussion, so he's turning them back on, without discussion. The >> project is a very different place than it was then, and doing this >> sort of thing is anti-social. >> > > s/1994/14-Nov-1998/ > > 100,000 of things change within FreeBSD without discission that > displeases some set of folks. That's nothing new, but I'm restoring > compatibility and functionailty, not removing it. > > I found src/Makefile.inc1 r134903 / rev 1.444 very noisy, but lived with > it. I don't care that -s now implies -Q, except that it still leaves so > much "noise" like r134903 / rev 1.444 and other output. > [Why the log message is about 'Unanimous Consent' and not verbosity?] > > I wonder what % build speed improvement quieting that behind 'make -s' > would give? > > The point of his message is this is a community-based project and as such consensus is important. I have seen zero support for your change, only complaints. Change is change; you can't hide behind a claim you're restoring 10-year old behaviour. Sam From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 17:50:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0816110656C3; Fri, 30 Jan 2009 17:50:05 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85]) by mx1.freebsd.org (Postfix) with ESMTP id B88788FC1D; Fri, 30 Jan 2009 17:50:04 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1]) by dragon.nuxi.org (8.14.2/8.14.2) with ESMTP id n0UHnRvF009947; Fri, 30 Jan 2009 09:49:27 -0800 (PST) (envelope-from obrien@dragon.nuxi.org) Received: (from obrien@localhost) by dragon.nuxi.org (8.14.2/8.14.2/Submit) id n0UHnR5B009946; Fri, 30 Jan 2009 09:49:27 -0800 (PST) (envelope-from obrien) Date: Fri, 30 Jan 2009 09:49:27 -0800 From: "David O'Brien" To: Dmitry Marakasov Message-ID: <20090130174927.GB9615@dragon.NUXI.org> References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> <20090130113402.GB92386@dragon.NUXI.org> <20090130175627.GA20856@hades.panopticon> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090130175627.GA20856@hades.panopticon> X-Operating-System: FreeBSD 8.0-CURRENT User-Agent: Mutt/1.5.16 (2007-06-09) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 17:50:06 -0000 On Fri, Jan 30, 2009 at 05:56:27PM +0000, Dmitry Marakasov wrote: > * David O'Brien (obrien@freebsd.org) wrote: > > I'm sorry I disagree. You're complaining about something that is > > a feature of FreeBSD 1.x, 2.0 - 3.0, 4.4BSD, all NetBSD versions, > > all OpenBSD versions, Sprite, and the Open Group's Open Development > > Environment make. > > Nice. Well I've been using FreeBSD since 4.7, and I don't believe I've > seen this once. Please note, FreeBSD 4.7 falls outside the FreeBSD versions I listed. > Not `BSD user', but just `user'. We can't take somethink that was > used back in FreBSD 3.0 as common and expected thing. By least > astonishment I mean: > > - I do not expect to see difference between plain make and parallel > make. Why? It is operating differently. Do you expect to see any difference in behavior between a UP or SMP kernel? > - I do not expect extra messages Why doesn't all the extra output of: ===> gnu/usr.bin/gperf (obj,depend,all,install) ===> gnu/usr.bin/gperf/doc (obj) ===> gnu/usr.bin/gperf/doc (depend) ===> gnu/usr.bin/gperf/doc (all) bother you? I expect the "make obj" or "make depend" step to just happen nicely and quietly. But instead its there. > - I do not expect behaviour change compared to previous version Eh? Software has 100,000's of behavior changes between versions. > Remember, make is not only used in FreeBSD kernel, but also in ports > (I know -j is not widely used there, but I believe it will someday) I don't believe it will happen - I've had patches to add -j to ports build for a long time, there has been very minimal interest in them. The answer there has aways to be build multiple ports at the same time. And so many ports aren't tested for '-j' builds it is naive to think the vast majority of ports would build with '-j'. (my patch was an opt-in for large things like gcc) -- -- David (obrien@FreeBSD.org) From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 17:51:43 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFC1B106566B; Fri, 30 Jan 2009 17:51:43 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 913768FC0C; Fri, 30 Jan 2009 17:51:43 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n0UHoZ48051048; Fri, 30 Jan 2009 10:50:35 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Fri, 30 Jan 2009 10:51:00 -0700 (MST) Message-Id: <20090130.105100.1501550635.imp@bsdimp.com> To: obrien@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090130173953.GA9615@dragon.NUXI.org> References: <20090130113402.GB92386@dragon.NUXI.org> <20090130.085434.-1555413082.imp@bsdimp.com> <20090130173953.GA9615@dragon.NUXI.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, amdmi3@amdmi3.ru, src-committers@FreeBSD.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 17:51:44 -0000 In message: <20090130173953.GA9615@dragon.NUXI.org> "David O'Brien" writes: : On Fri, Jan 30, 2009 at 08:54:34AM -0700, M. Warner Losh wrote: : > Also, I'm pretty sure that you've misread the NetBSD sources, since I : > never see that output when I build NetBSD. : : Since I work with one of the NetBSD make maintainers, I'll ask him if : there is something I've missed, or something he's adjusted on this. The format is different, and you can't turn it off... Warner From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 18:00:47 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B870106566B; Fri, 30 Jan 2009 18:00:47 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 9F33B8FC1B; Fri, 30 Jan 2009 18:00:46 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n0UHvLQk051197; Fri, 30 Jan 2009 10:57:21 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Fri, 30 Jan 2009 10:57:46 -0700 (MST) Message-Id: <20090130.105746.-1582160580.imp@bsdimp.com> To: obrien@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090130173956.GA9119@dragon.NUXI.org> References: <20090130015518.GA20404@hades.panopticon> <20090130.085130.-4349483.imp@bsdimp.com> <20090130173956.GA9119@dragon.NUXI.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, amdmi3@amdmi3.ru, src-committers@FreeBSD.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 18:00:47 -0000 In message: <20090130173956.GA9119@dragon.NUXI.org> "David O'Brien" writes: : On Fri, Jan 30, 2009 at 08:51:30AM -0700, M. Warner Losh wrote: : > In message: <20090130015518.GA20404@hades.panopticon> : > Dmitry Marakasov writes: : > : * David E. O'Brien (obrien@FreeBSD.org) wrote: : > : I think this should be backed out. Those verbose messages: : > : - Are completely unexpected, this violates POLA. : > : - Do break recognizeable make output people are used to : > : - Really uglify make output for some custom makefiles (for example, : > : generated by cmake: : .. : > : There's golden unix way rule: silence is golden. So please back this : > : out, as this will really annoy many people. : > : > This makes at least two requests... I hate them too. really really : > really hate them. -Q is default in all my trees. : > : > The real problem is that it exposes way too many internal target names : > that are totally baffling, even to me who has a lot of build : > experience. Also, it isn't clear how to use them. : > : > O'Brien says they were disabled in 1994 for no good reason without : > discussion, so he's turning them back on, without discussion. The : > project is a very different place than it was then, and doing this : > sort of thing is anti-social. : : s/1994/14-Nov-1998/ : : 100,000 of things change within FreeBSD without discission that : displeases some set of folks. That's nothing new, but I'm restoring : compatibility and functionailty, not removing it. Don't you have any ability to judge that this might be a bad thing? So far the voting I solicited is 100% in favor of getting rid of what you did... Usually that implies it is a bad commit... : I found src/Makefile.inc1 r134903 / rev 1.444 very noisy, but lived with : it. I don't care that -s now implies -Q, except that it still leaves so : much "noise" like r134903 / rev 1.444 and other output. : [Why the log message is about 'Unanimous Consent' and not verbosity?] Because I messed up on the commit. I also talked to a lot of people before making the commit, socialized the issue and got buy in from ru@ before making the change. : I wonder what % build speed improvement quieting that behind 'make -s' : would give? I should measure it. I believe that it won't be that much since the output is 1/10th the size of the latest commit... Warner From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 18:04:56 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F870106566B; Fri, 30 Jan 2009 18:04:56 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85]) by mx1.freebsd.org (Postfix) with ESMTP id 4F08E8FC0C; Fri, 30 Jan 2009 18:04:56 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1]) by dragon.nuxi.org (8.14.2/8.14.2) with ESMTP id n0UI4Bos010321; Fri, 30 Jan 2009 10:04:11 -0800 (PST) (envelope-from obrien@dragon.nuxi.org) Received: (from obrien@localhost) by dragon.nuxi.org (8.14.2/8.14.2/Submit) id n0UI4BHY010320; Fri, 30 Jan 2009 10:04:11 -0800 (PST) (envelope-from obrien) Date: Fri, 30 Jan 2009 10:04:10 -0800 From: "David O'Brien" To: "M. Warner Losh" Message-ID: <20090130180410.GD9615@dragon.NUXI.org> References: <20090130113402.GB92386@dragon.NUXI.org> <20090130.085434.-1555413082.imp@bsdimp.com> <20090130173953.GA9615@dragon.NUXI.org> <20090130.105100.1501550635.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090130.105100.1501550635.imp@bsdimp.com> X-Operating-System: FreeBSD 8.0-CURRENT User-Agent: Mutt/1.5.16 (2007-06-09) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, amdmi3@amdmi3.ru, src-committers@FreeBSD.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 18:04:57 -0000 On Fri, Jan 30, 2009 at 10:51:00AM -0700, M. Warner Losh wrote: > In message: <20090130173953.GA9615@dragon.NUXI.org> > "David O'Brien" writes: > : On Fri, Jan 30, 2009 at 08:54:34AM -0700, M. Warner Losh wrote: > : > Also, I'm pretty sure that you've misread the NetBSD sources, since I > : > never see that output when I build NetBSD. > : > : Since I work with one of the NetBSD make maintainers, I'll ask him if > : there is something I've missed, or something he's adjusted on this. > > The format is different, and you can't turn it off... Sorry, I don't understand what you're saying. NetBSD doesn't output these headers (you only refered to "that output"), now you're saying there is output but different? -- -- David (obrien@FreeBSD.org) From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 18:33:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E5D41065672; Fri, 30 Jan 2009 18:33:06 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C0828FC18; Fri, 30 Jan 2009 18:33:06 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0UIX6Hm099935; Fri, 30 Jan 2009 18:33:06 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0UIX58Q099927; Fri, 30 Jan 2009 18:33:05 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <200901301833.n0UIX58Q099927@svn.freebsd.org> From: "David E. O'Brien" Date: Fri, 30 Jan 2009 18:33:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187931 - in head/sbin: fsck fsck_ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 18:33:07 -0000 Author: obrien Date: Fri Jan 30 18:33:05 2009 New Revision: 187931 URL: http://svn.freebsd.org/changeset/base/187931 Log: Add the '-C' "check clean" flag. If the FS is marked clean, skip file system checking. However, if the file system is not clean, perform a full fsck. Reviewed by: delphij Obtained from: Juniper Networks Modified: head/sbin/fsck/fsck.8 head/sbin/fsck/fsck.c head/sbin/fsck/fsutil.h head/sbin/fsck_ffs/fsck.h head/sbin/fsck_ffs/fsck_ffs.8 head/sbin/fsck_ffs/main.c head/sbin/fsck_ffs/setup.c Modified: head/sbin/fsck/fsck.8 ============================================================================== --- head/sbin/fsck/fsck.8 Fri Jan 30 18:07:59 2009 (r187930) +++ head/sbin/fsck/fsck.8 Fri Jan 30 18:33:05 2009 (r187931) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 25, 2001 +.Dd January 25, 2009 .Dt FSCK 8 .Os .Sh NAME @@ -37,7 +37,7 @@ .Nd file system consistency check and interactive repair .Sh SYNOPSIS .Nm -.Op Fl dfnpvy +.Op Fl Cdfnpvy .Op Fl B | F .Op Fl T Ar fstype : Ns Ar fsoptions .Op Fl t Ar fstype @@ -112,6 +112,11 @@ to be the partition and slice designator .Pp The options are as follows: .Bl -tag -width indent +.It Fl C +Check if the +.Dq clean +flag is set in the superblock and skip file system checks if file system was +properly dismounted and marked clean. .It Fl d Debugging mode. Just print the commands without executing them. Modified: head/sbin/fsck/fsck.c ============================================================================== --- head/sbin/fsck/fsck.c Fri Jan 30 18:07:59 2009 (r187930) +++ head/sbin/fsck/fsck.c Fri Jan 30 18:33:05 2009 (r187931) @@ -103,7 +103,7 @@ main(int argc, char *argv[]) TAILQ_INIT(&selhead); TAILQ_INIT(&opthead); - while ((i = getopt(argc, argv, "BdvpfFnyl:t:T:")) != -1) + while ((i = getopt(argc, argv, "BCdvpfFnyl:t:T:")) != -1) switch (i) { case 'B': if (flags & CHECK_BACKGRD) @@ -128,6 +128,9 @@ main(int argc, char *argv[]) case 'p': flags |= CHECK_PREEN; /*FALLTHROUGH*/ + case 'C': + flags |= CHECK_CLEAN; + /*FALLTHROUGH*/ case 'n': case 'y': globopt[1] = i; @@ -566,7 +569,7 @@ static void usage(void) { static const char common[] = - "[-dfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]"; + "[-Cdfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]"; (void)fprintf(stderr, "usage: %s %s [special | node] ...\n", getprogname(), common); Modified: head/sbin/fsck/fsutil.h ============================================================================== --- head/sbin/fsck/fsutil.h Fri Jan 30 18:07:59 2009 (r187930) +++ head/sbin/fsck/fsutil.h Fri Jan 30 18:33:05 2009 (r187931) @@ -48,6 +48,7 @@ char *estrdup(const char *); #define CHECK_DEBUG 0x0004 #define CHECK_BACKGRD 0x0008 #define DO_BACKGRD 0x0010 +#define CHECK_CLEAN 0x0020 struct fstab; int checkfstab(int, int (*)(struct fstab *), Modified: head/sbin/fsck_ffs/fsck.h ============================================================================== --- head/sbin/fsck_ffs/fsck.h Fri Jan 30 18:07:59 2009 (r187930) +++ head/sbin/fsck_ffs/fsck.h Fri Jan 30 18:33:05 2009 (r187931) @@ -271,6 +271,7 @@ int bkgrdflag; /* use a snapshot to run int bflag; /* location of alternate super block */ int debug; /* output debugging info */ char damagedflag; /* run in damaged mode */ +char ckclean; /* only do work if not cleanly unmounted */ int cvtlevel; /* convert to newer file system format */ int bkgrdcheck; /* determine if background check is possible */ int bkgrdsumadj; /* whether the kernel have ability to adjust superblock summary */ Modified: head/sbin/fsck_ffs/fsck_ffs.8 ============================================================================== --- head/sbin/fsck_ffs/fsck_ffs.8 Fri Jan 30 18:07:59 2009 (r187930) +++ head/sbin/fsck_ffs/fsck_ffs.8 Fri Jan 30 18:33:05 2009 (r187931) @@ -29,7 +29,7 @@ .\" @(#)fsck.8 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd January 20, 2009 +.Dd January 25, 2009 .Dt FSCK_FFS 8 .Os .Sh NAME @@ -46,9 +46,9 @@ .Ar ... .Sh DESCRIPTION The specified disk partitions and/or file systems are checked. -In "preen" mode the clean flag of each file system's superblock is examined -and only those file systems that -are not marked clean are checked. +In "preen" or "check clean" mode the clean flag of each file system's +superblock is examined and only those file systems that are not marked clean +are checked. File systems are marked clean when they are unmounted, when they have been mounted read-only, or when .Nm @@ -175,6 +175,14 @@ Use the block specified immediately afte the super block for the file system. An alternate super block is usually located at block 32 for UFS1, and block 160 for UFS2. +.It Fl C +Check if file system was dismouted cleanly. +If so, skip file system checks (like "preen"). +However, if the file system was not cleanly dismounted, do full checks, +is if +.Nm +was invoked without +.Fl C . .It Fl c Convert the file system to the specified level. Note that the level of a file system can only be raised. Modified: head/sbin/fsck_ffs/main.c ============================================================================== --- head/sbin/fsck_ffs/main.c Fri Jan 30 18:07:59 2009 (r187930) +++ head/sbin/fsck_ffs/main.c Fri Jan 30 18:33:05 2009 (r187931) @@ -82,7 +82,7 @@ main(int argc, char *argv[]) sync(); skipclean = 1; damagedflag = 0; - while ((ch = getopt(argc, argv, "b:Bc:dDfFm:npy")) != -1) { + while ((ch = getopt(argc, argv, "b:Bc:CdDfFm:npy")) != -1) { switch (ch) { case 'b': skipclean = 0; @@ -132,6 +132,10 @@ main(int argc, char *argv[]) case 'p': preen++; + /*FALLTHROUGH*/ + + case 'C': + ckclean++; break; case 'y': @@ -151,7 +155,7 @@ main(int argc, char *argv[]) if (signal(SIGINT, SIG_IGN) != SIG_IGN) (void)signal(SIGINT, catch); - if (preen) + if (ckclean) (void)signal(SIGQUIT, catchquit); signal(SIGINFO, infohandler); if (bkgrdflag) { @@ -215,7 +219,7 @@ checkfilesys(char *filesys) errmsg[0] = '\0'; cdevname = filesys; - if (debug && preen) + if (debug && ckclean) pwarn("starting\n"); /* * Make best effort to get the disk name. Check first to see @@ -250,7 +254,7 @@ checkfilesys(char *filesys) exit(7); /* Filesystem clean, report it now */ exit(0); } - if (preen && skipclean) { + if (ckclean && skipclean) { /* * If file system is gjournaled, check it here. */ @@ -301,7 +305,7 @@ checkfilesys(char *filesys) "CANNOT RUN IN BACKGROUND\n"); } if ((sblock.fs_flags & FS_UNCLEAN) == 0 && - skipclean && preen) { + skipclean && ckclean) { /* * file system is clean; * skip snapshot and report it clean Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Fri Jan 30 18:07:59 2009 (r187930) +++ head/sbin/fsck_ffs/setup.c Fri Jan 30 18:33:05 2009 (r187931) @@ -65,7 +65,7 @@ static struct disklabel *getdisklabel(ch /* * Read in a superblock finding an alternate if necessary. * Return 1 if successful, 0 if unsuccessful, -1 if file system - * is already clean (preen mode only). + * is already clean (ckclean and preen mode only). */ int setup(char *dev) @@ -201,7 +201,7 @@ setup(char *dev) pwarn("USING ALTERNATE SUPERBLOCK AT %d\n", bflag); bflag = 0; } - if (skipclean && preen && sblock.fs_clean) { + if (skipclean && ckclean && sblock.fs_clean) { pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n"); return (-1); } From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 18:36:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E547F106566B; Fri, 30 Jan 2009 18:36:00 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from smtp.timeweb.ru (smtp.timeweb.ru [217.170.79.85]) by mx1.freebsd.org (Postfix) with ESMTP id 675EE8FC12; Fri, 30 Jan 2009 18:36:00 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from [213.148.20.85] (helo=hive.panopticon) by smtp.timeweb.ru with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1LSyDi-00083g-6V; Fri, 30 Jan 2009 21:36:02 +0300 Received: from hades.panopticon (hades.panopticon [192.168.0.32]) by hive.panopticon (Postfix) with ESMTP id 780E66D83; Fri, 30 Jan 2009 21:36:20 +0300 (MSK) Received: by hades.panopticon (Postfix, from userid 1000) id 075CF108838; Fri, 30 Jan 2009 21:36:51 +0000 (UTC) Date: Fri, 30 Jan 2009 21:36:51 +0000 From: Dmitry Marakasov To: David O'Brien Message-ID: <20090130213651.GC20856@hades.panopticon> References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> <20090130113402.GB92386@dragon.NUXI.org> <20090130175627.GA20856@hades.panopticon> <20090130174927.GB9615@dragon.NUXI.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20090130174927.GB9615@dragon.NUXI.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 18:36:01 -0000 * David O'Brien (obrien@freebsd.org) wrote: > > > I'm sorry I disagree. You're complaining about something that is > > > a feature of FreeBSD 1.x, 2.0 - 3.0, 4.4BSD, all NetBSD versions, > > > all OpenBSD versions, Sprite, and the Open Group's Open Development > > > Environment make. > > > > Nice. Well I've been using FreeBSD since 4.7, and I don't believe I've > > seen this once. > > Please note, FreeBSD 4.7 falls outside the FreeBSD versions I listed. I understand. I'm saying that you can't really use "it was there 10 years ago" as an argument. I can use "it was NOT there since at least 4.7" however, as _this is what people are used to now :) > > Not `BSD user', but just `user'. We can't take somethink that was > > used back in FreBSD 3.0 as common and expected thing. By least > > astonishment I mean: > > > > - I do not expect to see difference between plain make and parallel > > make. > > Why? It is operating differently. Do you expect to see any difference > in behavior between a UP or SMP kernel? It's only internal difference. I don't observe any changes in behaviour other than `SMP: AP CPU #1 Launched!' in dmesg and increased performance due to multiple cores usage. And sideeffects of SMP of course, like garbled kernel output (kernel: seScyonncdisn)g fdoirs kssy,s tvenmo dperso creesmsa i`nsiynngc.e.r.' to3 stop...0 0 done) :) Which should be of course fixed. > > - I do not expect extra messages > > Why doesn't all the extra output of: > > ===> gnu/usr.bin/gperf (obj,depend,all,install) > ===> gnu/usr.bin/gperf/doc (obj) > ===> gnu/usr.bin/gperf/doc (depend) > ===> gnu/usr.bin/gperf/doc (all) > > bother you? I expect the "make obj" or "make depend" step to just happen > nicely and quietly. But instead its there. Those messages is the part of world building process, you may either remove those or duplicate each 10 times, I won't say a word - those are makefiles tweaked for the most useful output for world/kernel build. But changing make is the very different case, as it affects not only kernel/world but everything and everybody. And, by the way, compare usefullness and readability of the quote above and what your change does to similar output: --- obj --- --- _proginstall --- sh /usr/src/tools/install.sh -s -o root -g wheel -m 555 ctfmerge /usr/obj/usr/src/tmp/legacy/usr/bin ===> games/fortune/strfile (obj,depend,all,install) --- obj --- --- _proginstall --- sh /usr/src/tools/install.sh -s -o root -g wheel -m 555 strfile /usr/obj/usr/src/tmp/legacy/usr/games ===> gnu/usr.bin/gperf (obj,depend,all,install) --- obj --- ===> gnu/usr.bin/gperf/doc (obj) --- obj --- --- depend --- ===> gnu/usr.bin/gperf/doc (depend) --- all --- ===> gnu/usr.bin/gperf/doc (all) > > - I do not expect behaviour change compared to previous version > > Eh? Software has 100,000's of behavior changes between versions. Useful and non-annoying ones, mostly, otherwise there's always arguing. > > Remember, make is not only used in FreeBSD kernel, but also in ports > > (I know -j is not widely used there, but I believe it will someday) > > I don't believe it will happen - I've had patches to add -j to ports > build for a long time, there has been very minimal interest in them. > The answer there has aways to be build multiple ports at the same time. > And so many ports aren't tested for '-j' builds it is naive to think the > vast majority of ports would build with '-j'. (my patch was an opt-in > for large things like gcc) Building multiple ports in parallel is indeed more effective, but as far as I know we don't have proper support for those as well (parallel writes to pkgdb will trash it). Also, ability to building multiple ports won't help as long as you only need to build one large port. Actually, what we need is standartize some basic knobs for -j support in ports, like: # add WITHOUT_JOBS to make.conf to disallow parallel builds # add ALLOW_JOBS to the port to allow building it in parallel MAKE_JOBS?= `sysctl -n kern.smp.cpus` .if !defined(WITHOUT_JOBS) && defined(ALLOW_JOBS) MAKE_ARGS+= -j MAKE_JOBS .endif I believe after that mailtainers will start to add ALLOW_JOBS to the ports which build successfully. Also, this may be added by default in say, cmake.mk, as it always generates safe makefiles. -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 18:37:20 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6752E106566C; Fri, 30 Jan 2009 18:37:20 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 248C38FC1B; Fri, 30 Jan 2009 18:37:20 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n0UIYPeY051595; Fri, 30 Jan 2009 11:34:25 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Fri, 30 Jan 2009 11:34:50 -0700 (MST) Message-Id: <20090130.113450.1075293451.imp@bsdimp.com> To: obrien@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090130180410.GD9615@dragon.NUXI.org> References: <20090130173953.GA9615@dragon.NUXI.org> <20090130.105100.1501550635.imp@bsdimp.com> <20090130180410.GD9615@dragon.NUXI.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, amdmi3@amdmi3.ru, src-committers@FreeBSD.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 18:37:21 -0000 In message: <20090130180410.GD9615@dragon.NUXI.org> "David O'Brien" writes: : On Fri, Jan 30, 2009 at 10:51:00AM -0700, M. Warner Losh wrote: : > In message: <20090130173953.GA9615@dragon.NUXI.org> : > "David O'Brien" writes: : > : On Fri, Jan 30, 2009 at 08:54:34AM -0700, M. Warner Losh wrote: : > : > Also, I'm pretty sure that you've misread the NetBSD sources, since I : > : > never see that output when I build NetBSD. : > : : > : Since I work with one of the NetBSD make maintainers, I'll ask him if : > : there is something I've missed, or something he's adjusted on this. : > : > The format is different, and you can't turn it off... : : Sorry, I don't understand what you're saying. NetBSD doesn't output : these headers (you only refered to "that output"), now you're saying : there is output but different? NetBSD produces different output, so I assumed that it wasn't the same thing. Warner From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 19:01:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2295106566C; Fri, 30 Jan 2009 19:01:15 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85]) by mx1.freebsd.org (Postfix) with ESMTP id A0D008FC16; Fri, 30 Jan 2009 19:01:15 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1]) by dragon.nuxi.org (8.14.2/8.14.2) with ESMTP id n0UJ0b6F011828; Fri, 30 Jan 2009 11:00:37 -0800 (PST) (envelope-from obrien@dragon.nuxi.org) Received: (from obrien@localhost) by dragon.nuxi.org (8.14.2/8.14.2/Submit) id n0UJ0aKW011827; Fri, 30 Jan 2009 11:00:36 -0800 (PST) (envelope-from obrien) Date: Fri, 30 Jan 2009 11:00:36 -0800 From: "David O'Brien" To: Dmitry Marakasov Message-ID: <20090130190036.GE9119@dragon.NUXI.org> References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> <20090130113402.GB92386@dragon.NUXI.org> <20090130175627.GA20856@hades.panopticon> <20090130174927.GB9615@dragon.NUXI.org> <20090130213651.GC20856@hades.panopticon> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090130213651.GC20856@hades.panopticon> X-Operating-System: FreeBSD 8.0-CURRENT User-Agent: Mutt/1.5.16 (2007-06-09) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 19:01:16 -0000 On Fri, Jan 30, 2009 at 09:36:51PM +0000, Dmitry Marakasov wrote: > due to multiple cores usage. And sideeffects of SMP of course, like > garbled kernel output (kernel: seScyonncdisn)g fdoirs kssy,s tvenmo > dperso > creesmsa i`nsiynngc.e.r.' to3 stop...0 0 done) :) > Which should be of course fixed. YES and we've lived with that for over a year. Who do I complain to about the bad issue that I often cannot see console messages due to them being garbled?!? What commit can we vote on to back out to get back the real functionality of fully usable console output? > Actually, what we need is standartize some basic knobs for -j support > in ports, like: After discussing it on and off with Kris Kennaway and Mark Linimon since 2005. I finally submitted http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/122120 Hoping that would get more traction, as only portmgr can really make this happen. But doesn't seem to have. There is also http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/113132 -- -- David (obrien@FreeBSD.org) From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 19:33:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2122110656D6; Fri, 30 Jan 2009 19:33:05 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E9A78FC2D; Fri, 30 Jan 2009 19:33:05 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0UJX4t9001283; Fri, 30 Jan 2009 19:33:04 GMT (envelope-from keramida@svn.freebsd.org) Received: (from keramida@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0UJX4wC001282; Fri, 30 Jan 2009 19:33:04 GMT (envelope-from keramida@svn.freebsd.org) Message-Id: <200901301933.n0UJX4wC001282@svn.freebsd.org> From: Giorgos Keramidas Date: Fri, 30 Jan 2009 19:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187935 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 19:33:06 -0000 Author: keramida (doc committer) Date: Fri Jan 30 19:33:04 2009 New Revision: 187935 URL: http://svn.freebsd.org/changeset/base/187935 Log: Sometimes, depending on the bpf filter rules used in $PATTERN, the example script of the manpage feeds awk(1) with values larger than UINT32_MAX. Then awk prints a negative value, and this messes up $BPFPROG. Trying to load the resulting bpf byte codes with ngctl then fails. For example, the output for PATTERN="udp and dst net 255.255.0.0/16" should be (all in one line): bpf_prog_len=10 bpf_prog=[ { code=40 jt=0 jf=0 k=12 } { code=21 jt=7 jf=0 k=34525 } { code=21 jt=0 jf=6 k=2048 } { code=48 jt=0 jf=0 k=23 } { code=21 jt=0 jf=4 k=17 } { code=32 jt=0 jf=0 k=30 } { code=84 jt=0 jf=0 k=4294901760 } { code=21 jt=0 jf=1 k=4294901760 } { code=6 jt=0 jf=0 k=8192 } { code=6 jt=0 jf=0 k=0 } ] The two k=4294901760 values are displayed as k=-2147483648 by awk. Replace the awk script of the manpage example with a slower but safer version, that doesn't really attempt to convert the byte code printed by tcpdump from string to number and back. PR: docs/123255 Submitted by: Eugenio Maffione, eugenio.maffione at telecomitalia.it MFC after: 3 days Modified: head/share/man/man4/ng_bpf.4 Modified: head/share/man/man4/ng_bpf.4 ============================================================================== --- head/share/man/man4/ng_bpf.4 Fri Jan 30 18:34:54 2009 (r187934) +++ head/share/man/man4/ng_bpf.4 Fri Jan 30 19:33:04 2009 (r187935) @@ -156,21 +156,14 @@ INHOOK="hook1" MATCHHOOK="hook2" NOTMATCHHOOK="hook3" -cat > /tmp/bpf.awk << xxENDxx -{ - if (!init) { - printf "bpf_prog_len=%d bpf_prog=[", \\$1; - init=1; - } else { - printf " { code=%d jt=%d jf=%d k=%d }", \\$1, \\$2, \\$3, \\$4; - } -} -END { - print " ]" -} -xxENDxx - -BPFPROG=`tcpdump -s 8192 -ddd ${PATTERN} | awk -f /tmp/bpf.awk` +BPFPROG=$( tcpdump -s 8192 -ddd ${PATTERN} | \\ + ( read len ; \\ + echo -n "bpf_prog_len=$len" ; \\ + echo -n "bpf_prog=[" ; \\ + while read code jt jf k ; do \\ + echo -n " { code=$code jt=$jt jf=$jf k=$k }" ; \\ + done ; \\ + echo " ]" ) ) ngctl msg ${NODEPATH} setprogram { thisHook=\\"${INHOOK}\\" \\ ifMatch=\\"${MATCHHOOK}\\" \\ From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 20:17:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11537106564A; Fri, 30 Jan 2009 20:17:09 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F42368FC0A; Fri, 30 Jan 2009 20:17:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0UKH8II002126; Fri, 30 Jan 2009 20:17:08 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0UKH8tv002125; Fri, 30 Jan 2009 20:17:08 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200901302017.n0UKH8tv002125@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Fri, 30 Jan 2009 20:17:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187936 - head/sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 20:17:09 -0000 Author: bz Date: Fri Jan 30 20:17:08 2009 New Revision: 187936 URL: http://svn.freebsd.org/changeset/base/187936 Log: Use NULL rather than 0 when comparing pointers. MFC after: 2 weeks Modified: head/sys/netipsec/ipsec_output.c Modified: head/sys/netipsec/ipsec_output.c ============================================================================== --- head/sys/netipsec/ipsec_output.c Fri Jan 30 19:33:04 2009 (r187935) +++ head/sys/netipsec/ipsec_output.c Fri Jan 30 20:17:08 2009 (r187936) @@ -791,14 +791,14 @@ ipsec6_output_tunnel(struct ipsec_output RTFREE(state->ro->ro_rt); state->ro->ro_rt = NULL; } - if (state->ro->ro_rt == 0) { + if (state->ro->ro_rt == NULL) { bzero(dst6, sizeof(*dst6)); dst6->sin6_family = AF_INET6; dst6->sin6_len = sizeof(*dst6); dst6->sin6_addr = ip6->ip6_dst; rtalloc(state->ro); } - if (state->ro->ro_rt == 0) { + if (state->ro->ro_rt == NULL) { V_ip6stat.ip6s_noroute++; V_ipsec6stat.ips_out_noroute++; error = EHOSTUNREACH; From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 22:00:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 837BE1065673; Fri, 30 Jan 2009 22:00:32 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 71C468FC1F; Fri, 30 Jan 2009 22:00:32 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0UM0Woe004420; Fri, 30 Jan 2009 22:00:32 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0UM0W6U004419; Fri, 30 Jan 2009 22:00:32 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200901302200.n0UM0W6U004419@svn.freebsd.org> From: Jamie Gritton Date: Fri, 30 Jan 2009 22:00:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187937 - head/share/misc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 22:00:33 -0000 Author: jamie Date: Fri Jan 30 22:00:31 2009 New Revision: 187937 URL: http://svn.freebsd.org/changeset/base/187937 Log: Committo ergo sum. Approved by: bz Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Fri Jan 30 20:17:08 2009 (r187936) +++ head/share/misc/committers-src.dot Fri Jan 30 22:00:31 2009 (r187937) @@ -102,6 +102,7 @@ iedowse [label="Ian Dowse\niedowse@FreeB imp [label="Warner Losh\nimp@FreeBSD.org\n1996/09/20"] ivoras [label="Ivan Voras\nivoras@FreeBSD.org\n2008/06/10"] jake [label="Jake Burkholder\njake@FreeBSD.org\n2000/05/16"] +jamie [label="Jamie Gritton\njamie@FreeBSD.org\n2009/01/28"] jayanth [label="Jayanth Vijayaraghavan\njayanth@FreeBSD.org\n2000/05/08"] jinmei [label="JINMEI Tatuya\njinmei@FreeBSD.org\n2007/03/17"] jdp [label="John Polstra\njdp@FreeBSD.org\n????/??/??"] @@ -219,7 +220,9 @@ bms -> thompsa brian -> joe brooks -> bushman +brooks -> jamie +bz -> jamie bz -> syrinx cperciva -> flz From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 22:23:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1551B106564A; Fri, 30 Jan 2009 22:23:22 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F1AF68FC19; Fri, 30 Jan 2009 22:23:21 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0UMNLCi004961; Fri, 30 Jan 2009 22:23:21 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0UMNLIC004956; Fri, 30 Jan 2009 22:23:21 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200901302223.n0UMNLIC004956@svn.freebsd.org> From: Maksim Yevmenkin Date: Fri, 30 Jan 2009 22:23:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187938 - head/usr.sbin/bluetooth/btpand X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 22:23:22 -0000 Author: emax Date: Fri Jan 30 22:23:21 2009 New Revision: 187938 URL: http://svn.freebsd.org/changeset/base/187938 Log: Add btpand(8) daemon from NetBSD. This daemon provides support for Bluetooth Network Access Point (NAP), Group Ad-hoc Network (GN) and Personal Area Network User (PANU) profiles. Obtained from: NetBSD MFC after: 1 month Added: head/usr.sbin/bluetooth/btpand/ head/usr.sbin/bluetooth/btpand/Makefile (contents, props changed) head/usr.sbin/bluetooth/btpand/bnep.c (contents, props changed) head/usr.sbin/bluetooth/btpand/bnep.h (contents, props changed) head/usr.sbin/bluetooth/btpand/btpand.8 (contents, props changed) head/usr.sbin/bluetooth/btpand/btpand.c (contents, props changed) head/usr.sbin/bluetooth/btpand/btpand.h (contents, props changed) head/usr.sbin/bluetooth/btpand/channel.c (contents, props changed) head/usr.sbin/bluetooth/btpand/client.c (contents, props changed) head/usr.sbin/bluetooth/btpand/event.c (contents, props changed) head/usr.sbin/bluetooth/btpand/event.h (contents, props changed) head/usr.sbin/bluetooth/btpand/packet.c (contents, props changed) head/usr.sbin/bluetooth/btpand/sdp.c (contents, props changed) head/usr.sbin/bluetooth/btpand/sdp.h (contents, props changed) head/usr.sbin/bluetooth/btpand/server.c (contents, props changed) head/usr.sbin/bluetooth/btpand/tap.c (contents, props changed) Added: head/usr.sbin/bluetooth/btpand/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bluetooth/btpand/Makefile Fri Jan 30 22:23:21 2009 (r187938) @@ -0,0 +1,13 @@ +# $NetBSD: Makefile,v 1.2 2008/08/18 08:25:32 plunky Exp $ +# $FreeBSD$ + +PROG= btpand +MAN= btpand.8 +SRCS= btpand.c bnep.c channel.c client.c event.c packet.c server.c sdp.c tap.c + +WARNS?= 3 + +DPADD+= ${LIBBLUETOOTH} ${LIBSDP} ${LIBUTIL} +LDADD+= -lbluetooth -lsdp -lutil + +.include Added: head/usr.sbin/bluetooth/btpand/bnep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bluetooth/btpand/bnep.c Fri Jan 30 22:23:21 2009 (r187938) @@ -0,0 +1,755 @@ +/* $NetBSD: bnep.c,v 1.1 2008/08/17 13:20:57 plunky Exp $ */ + +/*- + * Copyright (c) 2008 Iain Hibbert + * 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 ``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$ */ + +#include +__RCSID("$NetBSD: bnep.c,v 1.1 2008/08/17 13:20:57 plunky Exp $"); + +#include +#include +#include +#include +#include +#include + +#include "btpand.h" +#include "bnep.h" + +static bool bnep_recv_extension(packet_t *); +static size_t bnep_recv_control(channel_t *, uint8_t *, size_t, bool); +static size_t bnep_recv_control_command_not_understood(channel_t *, uint8_t *, size_t); +static size_t bnep_recv_setup_connection_req(channel_t *, uint8_t *, size_t); +static size_t bnep_recv_setup_connection_rsp(channel_t *, uint8_t *, size_t); +static size_t bnep_recv_filter_net_type_set(channel_t *, uint8_t *, size_t); +static size_t bnep_recv_filter_net_type_rsp(channel_t *, uint8_t *, size_t); +static size_t bnep_recv_filter_multi_addr_set(channel_t *, uint8_t *, size_t); +static size_t bnep_recv_filter_multi_addr_rsp(channel_t *, uint8_t *, size_t); + +static bool bnep_pfilter(channel_t *, packet_t *); +static bool bnep_mfilter(channel_t *, packet_t *); + +static uint8_t NAP_UUID[] = { + 0x00, 0x00, 0x11, 0x16, + 0x00, 0x00, + 0x10, 0x00, + 0x80, 0x00, + 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb +}; + +static uint8_t GN_UUID[] = { + 0x00, 0x00, 0x11, 0x17, + 0x00, 0x00, + 0x10, 0x00, + 0x80, 0x00, + 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb, +}; + +static uint8_t PANU_UUID[] = { + 0x00, 0x00, 0x11, 0x15, + 0x00, 0x00, + 0x10, 0x00, + 0x80, 0x00, + 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb +}; + +/* + * receive BNEP packet + * return true if packet is to be forwarded + */ +bool +bnep_recv(packet_t *pkt) +{ + size_t len; + uint8_t type; + + if (pkt->len < 1) + return false; + + type = pkt->ptr[0]; + packet_adj(pkt, 1); + + switch (BNEP_TYPE(type)) { + case BNEP_GENERAL_ETHERNET: + if (pkt->len < (ETHER_ADDR_LEN * 2) + ETHER_TYPE_LEN) { + log_debug("dropped short packet (type 0x%2.2x)", type); + return false; + } + + pkt->dst = pkt->ptr; + packet_adj(pkt, ETHER_ADDR_LEN); + pkt->src = pkt->ptr; + packet_adj(pkt, ETHER_ADDR_LEN); + pkt->type = pkt->ptr; + packet_adj(pkt, ETHER_TYPE_LEN); + break; + + case BNEP_CONTROL: + len = bnep_recv_control(pkt->chan, pkt->ptr, pkt->len, false); + if (len == 0) + return false; + + packet_adj(pkt, len); + break; + + case BNEP_COMPRESSED_ETHERNET: + if (pkt->len < ETHER_TYPE_LEN) { + log_debug("dropped short packet (type 0x%2.2x)", type); + return false; + } + + pkt->dst = pkt->chan->laddr; + pkt->src = pkt->chan->raddr; + pkt->type = pkt->ptr; + packet_adj(pkt, ETHER_TYPE_LEN); + break; + + case BNEP_COMPRESSED_ETHERNET_SRC_ONLY: + if (pkt->len < ETHER_ADDR_LEN + ETHER_TYPE_LEN) { + log_debug("dropped short packet (type 0x%2.2x)", type); + return false; + } + + pkt->dst = pkt->chan->laddr; + pkt->src = pkt->ptr; + packet_adj(pkt, ETHER_ADDR_LEN); + pkt->type = pkt->ptr; + packet_adj(pkt, ETHER_TYPE_LEN); + break; + + case BNEP_COMPRESSED_ETHERNET_DST_ONLY: + if (pkt->len < ETHER_ADDR_LEN + ETHER_TYPE_LEN) { + log_debug("dropped short packet (type 0x%2.2x)", type); + return false; + } + + pkt->dst = pkt->ptr; + packet_adj(pkt, ETHER_ADDR_LEN); + pkt->src = pkt->chan->raddr; + pkt->type = pkt->ptr; + packet_adj(pkt, ETHER_TYPE_LEN); + break; + + default: + /* + * Any packet containing a reserved BNEP + * header packet type SHALL be dropped. + */ + + log_debug("dropped packet with reserved type 0x%2.2x", type); + return false; + } + + if (BNEP_TYPE_EXT(type) + && !bnep_recv_extension(pkt)) + return false; /* invalid extensions */ + + if (BNEP_TYPE(type) == BNEP_CONTROL + || pkt->chan->state != CHANNEL_OPEN) + return false; /* no forwarding */ + + return true; +} + +static bool +bnep_recv_extension(packet_t *pkt) +{ + exthdr_t *eh; + size_t len, size; + uint8_t type; + + do { + if (pkt->len < 2) + return false; + + type = pkt->ptr[0]; + size = pkt->ptr[1]; + + if (pkt->len < size + 2) + return false; + + switch (type) { + case BNEP_EXTENSION_CONTROL: + len = bnep_recv_control(pkt->chan, pkt->ptr + 2, size, true); + if (len != size) + log_err("ignored spurious data in exthdr"); + + break; + + default: + /* Unknown extension headers in data packets */ + /* SHALL be forwarded irrespective of any */ + /* network protocol or multicast filter settings */ + /* and any local filtering policy. */ + + eh = malloc(sizeof(exthdr_t)); + if (eh == NULL) { + log_err("exthdr malloc() failed: %m"); + break; + } + + eh->ptr = pkt->ptr; + eh->len = size; + STAILQ_INSERT_TAIL(&pkt->extlist, eh, next); + break; + } + + packet_adj(pkt, size + 2); + } while (BNEP_TYPE_EXT(type)); + + return true; +} + +static size_t +bnep_recv_control(channel_t *chan, uint8_t *ptr, size_t size, bool isext) +{ + uint8_t type; + size_t len; + + if (size-- < 1) + return 0; + + type = *ptr++; + + switch (type) { + case BNEP_CONTROL_COMMAND_NOT_UNDERSTOOD: + len = bnep_recv_control_command_not_understood(chan, ptr, size); + break; + + case BNEP_SETUP_CONNECTION_REQUEST: + if (isext) + return 0; /* not allowed in extension headers */ + + len = bnep_recv_setup_connection_req(chan, ptr, size); + break; + + case BNEP_SETUP_CONNECTION_RESPONSE: + if (isext) + return 0; /* not allowed in extension headers */ + + len = bnep_recv_setup_connection_rsp(chan, ptr, size); + break; + + case BNEP_FILTER_NET_TYPE_SET: + len = bnep_recv_filter_net_type_set(chan, ptr, size); + break; + + case BNEP_FILTER_NET_TYPE_RESPONSE: + len = bnep_recv_filter_net_type_rsp(chan, ptr, size); + break; + + case BNEP_FILTER_MULTI_ADDR_SET: + len = bnep_recv_filter_multi_addr_set(chan, ptr, size); + break; + + case BNEP_FILTER_MULTI_ADDR_RESPONSE: + len = bnep_recv_filter_multi_addr_rsp(chan, ptr, size); + break; + + default: + len = 0; + break; + } + + if (len == 0) + bnep_send_control(chan, BNEP_CONTROL_COMMAND_NOT_UNDERSTOOD, type); + + return len; +} + +static size_t +bnep_recv_control_command_not_understood(channel_t *chan, uint8_t *ptr, size_t size) +{ + uint8_t type; + + if (size < 1) + return 0; + + type = *ptr++; + log_err("received Control Command Not Understood (0x%2.2x)", type); + + /* we didn't send any reserved commands, just cut them off */ + channel_close(chan); + + return 1; +} + +static size_t +bnep_recv_setup_connection_req(channel_t *chan, uint8_t *ptr, size_t size) +{ + uint8_t off; + int src, dst, rsp; + size_t len; + + if (size < 1) + return 0; + + len = *ptr++; + if (size < (len * 2 + 1)) + return 0; + + if (chan->state != CHANNEL_WAIT_CONNECT_REQ + && chan->state != CHANNEL_OPEN) { + log_debug("ignored"); + return (len * 2 + 1); + } + + if (len == 2) + off = 2; + else if (len == 4) + off = 0; + else if (len == 16) + off = 0; + else { + rsp = BNEP_SETUP_INVALID_UUID_SIZE; + goto done; + } + + if (memcmp(ptr, NAP_UUID + off, len) == 0) + dst = SDP_SERVICE_CLASS_NAP; + else if (memcmp(ptr, GN_UUID + off, len) == 0) + dst = SDP_SERVICE_CLASS_GN; + else if (memcmp(ptr, PANU_UUID + off, len) == 0) + dst = SDP_SERVICE_CLASS_PANU; + else + dst = 0; + + if (dst != service_class) { + rsp = BNEP_SETUP_INVALID_DST_UUID; + goto done; + } + + ptr += len; + + if (memcmp(ptr, NAP_UUID + off, len) == 0) + src = SDP_SERVICE_CLASS_NAP; + else if (memcmp(ptr, GN_UUID + off, len) == 0) + src = SDP_SERVICE_CLASS_GN; + else if (memcmp(ptr, PANU_UUID + off, len) == 0) + src = SDP_SERVICE_CLASS_PANU; + else + src = 0; + + if ((dst != SDP_SERVICE_CLASS_PANU && src != SDP_SERVICE_CLASS_PANU) + || src == 0) { + rsp = BNEP_SETUP_INVALID_SRC_UUID; + goto done; + } + + rsp = BNEP_SETUP_SUCCESS; + chan->state = CHANNEL_OPEN; + channel_timeout(chan, 0); + +done: + log_debug("addr %s response 0x%2.2x", + ether_ntoa((struct ether_addr *)chan->raddr), rsp); + + bnep_send_control(chan, BNEP_SETUP_CONNECTION_RESPONSE, rsp); + return (len * 2 + 1); +} + +static size_t +bnep_recv_setup_connection_rsp(channel_t *chan, uint8_t *ptr, size_t size) +{ + int rsp; + + if (size < 2) + return 0; + + rsp = be16dec(ptr); + + if (chan->state != CHANNEL_WAIT_CONNECT_RSP) { + log_debug("ignored"); + return 2; + } + + log_debug("addr %s response 0x%2.2x", + ether_ntoa((struct ether_addr *)chan->raddr), rsp); + + if (rsp == BNEP_SETUP_SUCCESS) { + chan->state = CHANNEL_OPEN; + channel_timeout(chan, 0); + } else { + channel_close(chan); + } + + return 2; +} + +static size_t +bnep_recv_filter_net_type_set(channel_t *chan, uint8_t *ptr, size_t size) +{ + pfilter_t *pf; + int i, nf, rsp; + size_t len; + + if (size < 2) + return 0; + + len = be16dec(ptr); + ptr += 2; + + if (size < (len + 2)) + return 0; + + if (chan->state != CHANNEL_OPEN) { + log_debug("ignored"); + return (len + 2); + } + + nf = len / 4; + pf = malloc(nf * sizeof(pfilter_t)); + if (pf == NULL) { + rsp = BNEP_FILTER_TOO_MANY_FILTERS; + goto done; + } + + log_debug("nf = %d", nf); + + for (i = 0; i < nf; i++) { + pf[i].start = be16dec(ptr); + ptr += 2; + pf[i].end = be16dec(ptr); + ptr += 2; + + if (pf[i].start > pf[i].end) { + free(pf); + rsp = BNEP_FILTER_INVALID_RANGE; + goto done; + } + + log_debug("pf[%d] = %#4.4x, %#4.4x", i, pf[i].start, pf[i].end); + } + + if (chan->pfilter) + free(chan->pfilter); + + chan->pfilter = pf; + chan->npfilter = nf; + + rsp = BNEP_FILTER_SUCCESS; + +done: + log_debug("addr %s response 0x%2.2x", + ether_ntoa((struct ether_addr *)chan->raddr), rsp); + + bnep_send_control(chan, BNEP_FILTER_NET_TYPE_RESPONSE, rsp); + return (len + 2); +} + +static size_t +bnep_recv_filter_net_type_rsp(channel_t *chan, uint8_t *ptr, size_t size) +{ + int rsp; + + if (size < 2) + return 0; + + if (chan->state != CHANNEL_OPEN) { + log_debug("ignored"); + return 2; + } + + rsp = be16dec(ptr); + + log_debug("addr %s response 0x%2.2x", + ether_ntoa((struct ether_addr *)chan->raddr), rsp); + + /* we did not send any filter_net_type_set message */ + return 2; +} + +static size_t +bnep_recv_filter_multi_addr_set(channel_t *chan, uint8_t *ptr, size_t size) +{ + mfilter_t *mf; + int i, nf, rsp; + size_t len; + + if (size < 2) + return 0; + + len = be16dec(ptr); + ptr += 2; + + if (size < (len + 2)) + return 0; + + if (chan->state != CHANNEL_OPEN) { + log_debug("ignored"); + return (len + 2); + } + + nf = len / (ETHER_ADDR_LEN * 2); + mf = malloc(nf * sizeof(mfilter_t)); + if (mf == NULL) { + rsp = BNEP_FILTER_TOO_MANY_FILTERS; + goto done; + } + + log_debug("nf = %d", nf); + + for (i = 0; i < nf; i++) { + memcpy(mf[i].start, ptr, ETHER_ADDR_LEN); + ptr += ETHER_ADDR_LEN; + + memcpy(mf[i].end, ptr, ETHER_ADDR_LEN); + ptr += ETHER_ADDR_LEN; + + if (memcmp(mf[i].start, mf[i].end, ETHER_ADDR_LEN) > 0) { + free(mf); + rsp = BNEP_FILTER_INVALID_RANGE; + goto done; + } + + log_debug("pf[%d] = " + "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x, " + "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x", i, + mf[i].start[0], mf[i].start[1], mf[i].start[2], + mf[i].start[3], mf[i].start[4], mf[i].start[5], + mf[i].end[0], mf[i].end[1], mf[i].end[2], + mf[i].end[3], mf[i].end[4], mf[i].end[5]); + } + + if (chan->mfilter) + free(chan->mfilter); + + chan->mfilter = mf; + chan->nmfilter = nf; + + rsp = BNEP_FILTER_SUCCESS; + +done: + log_debug("addr %s response 0x%2.2x", + ether_ntoa((struct ether_addr *)chan->raddr), rsp); + + bnep_send_control(chan, BNEP_FILTER_MULTI_ADDR_RESPONSE, rsp); + return (len + 2); +} + +static size_t +bnep_recv_filter_multi_addr_rsp(channel_t *chan, uint8_t *ptr, size_t size) +{ + int rsp; + + if (size < 2) + return false; + + if (chan->state != CHANNEL_OPEN) { + log_debug("ignored"); + return 2; + } + + rsp = be16dec(ptr); + log_debug("addr %s response 0x%2.2x", + ether_ntoa((struct ether_addr *)chan->raddr), rsp); + + /* we did not send any filter_multi_addr_set message */ + return 2; +} + +void +bnep_send_control(channel_t *chan, uint8_t type, ...) +{ + packet_t *pkt; + uint8_t *p; + va_list ap; + + assert(chan->state != CHANNEL_CLOSED); + + pkt = packet_alloc(chan); + if (pkt == NULL) + return; + + p = pkt->ptr; + va_start(ap, type); + + *p++ = BNEP_CONTROL; + *p++ = type; + + switch(type) { + case BNEP_CONTROL_COMMAND_NOT_UNDERSTOOD: + *p++ = va_arg(ap, int); + break; + + case BNEP_SETUP_CONNECTION_REQUEST: + *p++ = va_arg(ap, int); + be16enc(p, va_arg(ap, int)); + p += 2; + be16enc(p, va_arg(ap, int)); + p += 2; + break; + + case BNEP_SETUP_CONNECTION_RESPONSE: + case BNEP_FILTER_NET_TYPE_RESPONSE: + case BNEP_FILTER_MULTI_ADDR_RESPONSE: + be16enc(p, va_arg(ap, int)); + p += 2; + break; + + case BNEP_FILTER_NET_TYPE_SET: /* TODO */ + case BNEP_FILTER_MULTI_ADDR_SET: /* TODO */ + default: + log_err("Can't send control type 0x%2.2x", type); + break; + } + + va_end(ap); + pkt->len = p - pkt->ptr; + + channel_put(chan, pkt); + packet_free(pkt); +} + +/* + * BNEP send packet routine + * return true if packet can be removed from queue + */ +bool +bnep_send(channel_t *chan, packet_t *pkt) +{ + struct iovec iov[2]; + uint8_t *p, *type, *proto; + exthdr_t *eh; + bool src, dst; + size_t nw; + + if (pkt->type == NULL) { + iov[0].iov_base = pkt->ptr; + iov[0].iov_len = pkt->len; + iov[1].iov_base = NULL; + iov[1].iov_len = 0; + } else { + p = chan->sendbuf; + + dst = (memcmp(pkt->dst, chan->raddr, ETHER_ADDR_LEN) != 0); + src = (memcmp(pkt->src, chan->laddr, ETHER_ADDR_LEN) != 0); + + type = p; + p += 1; + + if (dst && src) + *type = BNEP_GENERAL_ETHERNET; + else if (dst && !src) + *type = BNEP_COMPRESSED_ETHERNET_DST_ONLY; + else if (!dst && src) + *type = BNEP_COMPRESSED_ETHERNET_SRC_ONLY; + else /* (!dst && !src) */ + *type = BNEP_COMPRESSED_ETHERNET; + + if (dst) { + memcpy(p, pkt->dst, ETHER_ADDR_LEN); + p += ETHER_ADDR_LEN; + } + + if (src) { + memcpy(p, pkt->src, ETHER_ADDR_LEN); + p += ETHER_ADDR_LEN; + } + + proto = p; + memcpy(p, pkt->type, ETHER_TYPE_LEN); + p += ETHER_TYPE_LEN; + + STAILQ_FOREACH(eh, &pkt->extlist, next) { + if (p + eh->len > chan->sendbuf + chan->mtu) + break; + + *type |= BNEP_EXT; + type = p; + + memcpy(p, eh->ptr, eh->len); + p += eh->len; + } + + *type &= ~BNEP_EXT; + + iov[0].iov_base = chan->sendbuf; + iov[0].iov_len = (p - chan->sendbuf); + + if ((chan->npfilter == 0 || bnep_pfilter(chan, pkt)) + && (chan->nmfilter == 0 || bnep_mfilter(chan, pkt))) { + iov[1].iov_base = pkt->ptr; + iov[1].iov_len = pkt->len; + } else if (be16dec(proto) == ETHERTYPE_VLAN + && pkt->len >= ETHER_VLAN_ENCAP_LEN) { + iov[1].iov_base = pkt->ptr; + iov[1].iov_len = ETHER_VLAN_ENCAP_LEN; + } else { + iov[1].iov_base = NULL; + iov[1].iov_len = 0; + memset(proto, 0, ETHER_TYPE_LEN); + } + } + + if (iov[0].iov_len + iov[1].iov_len > chan->mtu) { + log_err("packet exceeded MTU (dropped)"); + return false; + } + + nw = writev(chan->fd, iov, __arraycount(iov)); + return (nw > 0); +} + +static bool +bnep_pfilter(channel_t *chan, packet_t *pkt) +{ + int proto, i; + + proto = be16dec(pkt->type); + if (proto == ETHERTYPE_VLAN) { /* IEEE 802.1Q tag header */ + if (pkt->len < 4) + return false; + + proto = be16dec(pkt->ptr + 2); + } + + for (i = 0; i < chan->npfilter; i++) { + if (chan->pfilter[i].start <= proto + && chan->pfilter[i].end >=proto) + return true; + } + + return false; +} + +static bool +bnep_mfilter(channel_t *chan, packet_t *pkt) +{ + int i; + + if (!ETHER_IS_MULTICAST(pkt->dst)) + return true; + + for (i = 0; i < chan->nmfilter; i++) { + if (memcmp(pkt->dst, chan->mfilter[i].start, ETHER_ADDR_LEN) >= 0 + && memcmp(pkt->dst, chan->mfilter[i].end, ETHER_ADDR_LEN) <= 0) + return true; + } + + return false; +} Added: head/usr.sbin/bluetooth/btpand/bnep.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bluetooth/btpand/bnep.h Fri Jan 30 22:23:21 2009 (r187938) @@ -0,0 +1,72 @@ +/* $NetBSD: bnep.h,v 1.1 2008/08/17 13:20:57 plunky Exp $ */ + +/*- + * Copyright (c) 2008 Iain Hibbert + * 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 ``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$ */ + +/* + * Constants defined in the Bluetooth Network Encapsulation + * Protocol (BNEP) specification v1.0 + */ + +#define BNEP_MTU_MIN 1691 + +#define BNEP_EXT 0x80 +#define BNEP_TYPE(x) ((x) & 0x7f) +#define BNEP_TYPE_EXT(x) (((x) & BNEP_EXT) == BNEP_EXT) + +/* BNEP packet types */ +#define BNEP_GENERAL_ETHERNET 0x00 +#define BNEP_CONTROL 0x01 +#define BNEP_COMPRESSED_ETHERNET 0x02 +#define BNEP_COMPRESSED_ETHERNET_SRC_ONLY 0x03 +#define BNEP_COMPRESSED_ETHERNET_DST_ONLY 0x04 + +/* BNEP extension header types */ +#define BNEP_EXTENSION_CONTROL 0x00 + +/* BNEP control types */ +#define BNEP_CONTROL_COMMAND_NOT_UNDERSTOOD 0x00 +#define BNEP_SETUP_CONNECTION_REQUEST 0x01 +#define BNEP_SETUP_CONNECTION_RESPONSE 0x02 +#define BNEP_FILTER_NET_TYPE_SET 0x03 +#define BNEP_FILTER_NET_TYPE_RESPONSE 0x04 +#define BNEP_FILTER_MULTI_ADDR_SET 0x05 +#define BNEP_FILTER_MULTI_ADDR_RESPONSE 0x06 + +/* BNEP setup response codes */ +#define BNEP_SETUP_SUCCESS 0x0000 +#define BNEP_SETUP_INVALID_SRC_UUID 0x0001 +#define BNEP_SETUP_INVALID_DST_UUID 0x0002 +#define BNEP_SETUP_INVALID_UUID_SIZE 0x0003 +#define BNEP_SETUP_NOT_ALLOWED 0x0004 + +/* BNEP filter return codes */ +#define BNEP_FILTER_SUCCESS 0x0000 +#define BNEP_FILTER_UNSUPPORTED_REQUEST 0x0001 +#define BNEP_FILTER_INVALID_RANGE 0x0002 +#define BNEP_FILTER_TOO_MANY_FILTERS 0x0003 +#define BNEP_FILTER_SECURITY_FAILURE 0x0004 Added: head/usr.sbin/bluetooth/btpand/btpand.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bluetooth/btpand/btpand.8 Fri Jan 30 22:23:21 2009 (r187938) @@ -0,0 +1,241 @@ +.\" $NetBSD: btpand.8,v 1.3 2008/08/17 14:43:07 plunky Exp $ +.\" $FreeBSD$ +.\" +.\" Copyright (c) 2008 Iain Hibbert +.\" 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 ``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. +.\" +.Dd August 17, 2008 +.Dt BTPAND 8 +.Os +.Sh NAME +.Nm btpand +.Nd Bluetooth PAN daemon +.Sh SYNOPSIS +.Nm +.Op Fl i Ar ifname +.Op Fl m Ar mode +.Fl a Ar addr +.Fl d Ar device +.Brq Fl s Ar service | Fl S Ar service Op Fl p Ar psm +.Nm +.Op Fl c Ar path +.Op Fl i Ar ifname +.Op Fl l Ar limit +.Op Fl m Ar mode +.Op Fl p Ar psm +.Fl d Ar device +.Brq Fl s Ar service | Fl S Ar service +.Sh DESCRIPTION +The +.Nm +daemon handles Bluetooth Personal Area Networking services +in the system. +It can operate in client mode as a Personal Area Networking User +.Pq PANU +or in server mode as Network Access Point +.Pq NAP , +Group ad-hoc Network +.Pq GN +or PANU host. +.Nm +connects to the system via a +.Xr tap 4 +virtual Ethernet device and forwards Ethernet packets to +remote Bluetooth devices using the Bluetooth Network Encapsulation +Protocol +.Pq BNEP . +.Pp +The PANU client is the device that uses either the NAP or GN +service, or can talk directly to a PANU host in a crossover +cable fashion. +.Pp +A GN host forwards Ethernet packets to each of the connected PAN +users as needed but does not provide access to any additional networks. +.Pp +The NAP service provides some of the features of an Ethernet bridge, +with the NAP host forwarding Ethernet packets between each of the +connected PAN users, and a different network +media. +.Pp +Note, the only differences between NAP and GN services as implemented by +.Nm +are in the SDP service record. +The bridging of packets by the NAP must be configured separately. +.Pp +The options are as follows: +.Bl -tag -width ".Fl a Ar address" +.It Fl a Ar address +In client mode, address of remote server. +May be given as BDADDR or name, in which case +.Nm +will attempt to resolve the address via the +.Xr bt_gethostbyname 3 +call. +.It Fl c Ar path +In server mode, specify +.Ar path +to the +.Xr sdpd 8 +control socket. +The default path is +.Pa /var/run/sdp . +.It Fl d Ar device +Restrict connections to the local +.Ar device . +May be given as BDADDR or name, in which case +.Nm +will attempt to resolve the address via the +.Xr bt_devaddr 3 +call. +.Nm +will set the +.Xr tap 4 +interface physical address to the BDADDR +of the Bluetooth radio. +.It Fl i Ar ifname +.Nm +uses the +.Xr tap 4 +driver to create a new network interface for use. +Use this option to select a specific +.Xr tap 4 +device interface which must already be created. +.It Fl l Ar limit +In server mode, limit the number of simultaneous connections. +The default limit is 7 for NAP and GN servers, +and 1 for a PANU server. +.It Fl m Ar mode +Set L2CAP connection link mode. +Supported modes are: +.Pp +.Bl -tag -compact +.It auth +require devices to be paired. +.It encrypt +auth, plus enable encryption. +.It secure +encryption, plus change of link key. +.El +.Pp +NOT YET SUPPORTED. +Use global device settings to set authentication and encryption. +.It Fl p Ar psm +Use an alternative L2CAP Protocol/Service Multiplexer +.Pq PSM +for server mode or client mode +.Pq when not using Service Discovery . +The default PSM for BNEP is 15 +.Pq 0x000f . *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 22:43:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B161E106566C; Fri, 30 Jan 2009 22:43:02 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out5.smtp.messagingengine.com (out5.smtp.messagingengine.com [66.111.4.29]) by mx1.freebsd.org (Postfix) with ESMTP id 7F0F38FC12; Fri, 30 Jan 2009 22:43:02 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id 9F83526587C; Fri, 30 Jan 2009 17:43:01 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute2.internal (MEProxy); Fri, 30 Jan 2009 17:43:01 -0500 X-Sasl-enc: y//wyLBhS7HQBOUo8DCeyVEQwPimhAWJ1H7Vk3MQuPZG 1233355381 Received: from empiric.lon.incunabulum.net (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id A854E13F3A; Fri, 30 Jan 2009 17:43:00 -0500 (EST) Message-ID: <49838272.3090806@FreeBSD.org> Date: Fri, 30 Jan 2009 22:42:58 +0000 From: "Bruce M. Simpson" User-Agent: Thunderbird 2.0.0.19 (X11/20090126) MIME-Version: 1.0 To: David O'Brien References: <200901130653.n0D6rrNX092719@svn.freebsd.org> <20090130015518.GA20404@hades.panopticon> <20090130113402.GB92386@dragon.NUXI.org> <20090130175627.GA20856@hades.panopticon> <20090130174927.GB9615@dragon.NUXI.org> <20090130213651.GC20856@hades.panopticon> In-Reply-To: <20090130213651.GC20856@hades.panopticon> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Dmitry Marakasov , src-committers@freebsd.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 22:43:03 -0000 Dmitry Marakasov wrote: > ... > --- obj --- > --- _proginstall --- > sh /usr/src/tools/install.sh -s -o root -g wheel -m 555 ctfmerge > /usr/obj/usr/src/tmp/legacy/usr/bin > ===> games/fortune/strfile (obj,depend,all,install) > etc. I wondered what that weird crap was in my buildworld the other day. Can we leave that turned off please? It's confusing and makes things unreadable. thanks, BMS From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 22:49:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA6701065740; Fri, 30 Jan 2009 22:49:30 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out5.smtp.messagingengine.com (out5.smtp.messagingengine.com [66.111.4.29]) by mx1.freebsd.org (Postfix) with ESMTP id AB1358FC20; Fri, 30 Jan 2009 22:49:30 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 49C8A26600A; Fri, 30 Jan 2009 17:49:30 -0500 (EST) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Fri, 30 Jan 2009 17:49:30 -0500 X-Sasl-enc: bZ8ln59BPjzXaRTKEs0CWaow5V0y0kOpPXL25QfLrLTV 1233355769 Received: from empiric.lon.incunabulum.net (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id F2FE129145; Fri, 30 Jan 2009 17:49:28 -0500 (EST) Message-ID: <498383F7.2090206@FreeBSD.org> Date: Fri, 30 Jan 2009 22:49:27 +0000 From: "Bruce M. Simpson" User-Agent: Thunderbird 2.0.0.19 (X11/20090126) MIME-Version: 1.0 To: Maksim Yevmenkin References: <200901302223.n0UMNLIC004956@svn.freebsd.org> In-Reply-To: <200901302223.n0UMNLIC004956@svn.freebsd.org> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187938 - head/usr.sbin/bluetooth/btpand X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 22:49:31 -0000 Maksim Yevmenkin wrote: > Log: > Add btpand(8) daemon from NetBSD. This daemon provides support for > Bluetooth Network Access Point (NAP), Group Ad-hoc Network (GN) and > Personal Area Network User (PANU) profiles. > This looks really, really cool. Bluetooth radios are cheap and plentiful, phones which will do BNEP instead of this silly PPP-to-PPP-at-the-GPRS_UMTS-controller stuff get the thumbs up. Thanks for bringing it in! From owner-svn-src-head@FreeBSD.ORG Fri Jan 30 23:40:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D3AB1065675; Fri, 30 Jan 2009 23:40:24 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B5B68FC1C; Fri, 30 Jan 2009 23:40:24 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0UNeO2K006343; Fri, 30 Jan 2009 23:40:24 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0UNeOmX006340; Fri, 30 Jan 2009 23:40:24 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200901302340.n0UNeOmX006340@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Fri, 30 Jan 2009 23:40:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187939 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 23:40:25 -0000 Author: bz Date: Fri Jan 30 23:40:24 2009 New Revision: 187939 URL: http://svn.freebsd.org/changeset/base/187939 Log: Remove 4 entirely unsued ip6 variables. Leave then in struct vinet6 to not break the ABI with kernel modules but mark them for removal so we can do it in one batch when the time is right. MFC after: 1 month Modified: head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_var.h head/sys/netinet6/vinet6.h Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Fri Jan 30 22:23:21 2009 (r187938) +++ head/sys/netinet6/ip6_input.c Fri Jan 30 23:40:24 2009 (r187939) @@ -145,11 +145,6 @@ extern int udp6_sendspace; extern int udp6_recvspace; extern struct route_in6 ip6_forward_rt; - -int ip6_forward_srcrt; /* XXX */ -int ip6_sourcecheck; /* XXX */ -int ip6_sourcecheck_interval; /* XXX */ -int ip6_ours_check_algorithm; #endif struct pfil_head inet6_pfil_hook; Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Fri Jan 30 22:23:21 2009 (r187938) +++ head/sys/netinet6/ip6_var.h Fri Jan 30 23:40:24 2009 (r187939) @@ -284,7 +284,6 @@ extern struct ip6stat ip6stat; /* statis extern int ip6_defhlim; /* default hop limit */ extern int ip6_defmcasthlim; /* default multicast hop limit */ extern int ip6_forwarding; /* act as router? */ -extern int ip6_forward_srcrt; /* forward src-routed? */ extern int ip6_gif_hlim; /* Hop limit for gif encap packet */ extern int ip6_use_deprecated; /* allow deprecated addr as source */ extern int ip6_rr_prune; /* router renumbering prefix @@ -298,8 +297,6 @@ extern struct socket *ip6_mrouter; /* mu extern int ip6_sendredirects; /* send IP redirects when forwarding? */ extern int ip6_maxfragpackets; /* Maximum packets in reassembly queue */ extern int ip6_maxfrags; /* Maximum fragments in reassembly queue */ -extern int ip6_sourcecheck; /* Verify source interface */ -extern int ip6_sourcecheck_interval; /* Interval between log messages */ extern int ip6_accept_rtadv; /* Acts as a host not a router */ extern int ip6_keepfaith; /* Firewall Aided Internet Translator */ extern int ip6_log_interval; Modified: head/sys/netinet6/vinet6.h ============================================================================== --- head/sys/netinet6/vinet6.h Fri Jan 30 22:23:21 2009 (r187938) +++ head/sys/netinet6/vinet6.h Fri Jan 30 23:40:24 2009 (r187939) @@ -122,10 +122,10 @@ struct vnet_inet6 { int _udp6_recvspace; int _ip6qmaxlen; int _ip6_prefer_tempaddr; - int _ip6_forward_srcrt; - int _ip6_sourcecheck; - int _ip6_sourcecheck_interval; - int _ip6_ours_check_algorithm; + int _ip6_forward_srcrt; /* XXX remove */ + int _ip6_sourcecheck; /* XXX remove */ + int _ip6_sourcecheck_interval; /* XXX remove */ + int _ip6_ours_check_algorithm; /* XXX remove */ int _nd6_prune; int _nd6_delay; @@ -195,7 +195,6 @@ extern struct vnet_inet6 vnet_inet6_0; #define V_ip6_defmcasthlim VNET_INET6(ip6_defmcasthlim) #define V_ip6_desync_factor VNET_INET6(ip6_desync_factor) #define V_ip6_forward_rt VNET_INET6(ip6_forward_rt) -#define V_ip6_forward_srcrt VNET_INET6(ip6_forward_srcrt) #define V_ip6_forwarding VNET_INET6(ip6_forwarding) #define V_ip6_hdrnestlimit VNET_INET6(ip6_hdrnestlimit) #define V_ip6_keepfaith VNET_INET6(ip6_keepfaith) @@ -206,12 +205,9 @@ extern struct vnet_inet6 vnet_inet6_0; #define V_ip6_mcast_pmtu VNET_INET6(ip6_mcast_pmtu) #define V_ip6_mrouter_ver VNET_INET6(ip6_mrouter_ver) #define V_ip6_opts VNET_INET6(ip6_opts) -#define V_ip6_ours_check_algorithm VNET_INET6(ip6_ours_check_algorithm) #define V_ip6_prefer_tempaddr VNET_INET6(ip6_prefer_tempaddr) #define V_ip6_rr_prune VNET_INET6(ip6_rr_prune) #define V_ip6_sendredirects VNET_INET6(ip6_sendredirects) -#define V_ip6_sourcecheck VNET_INET6(ip6_sourcecheck) -#define V_ip6_sourcecheck_interval VNET_INET6(ip6_sourcecheck_interval) #define V_ip6_temp_preferred_lifetime VNET_INET6(ip6_temp_preferred_lifetime) #define V_ip6_temp_regen_advance VNET_INET6(ip6_temp_regen_advance) #define V_ip6_temp_valid_lifetime VNET_INET6(ip6_temp_valid_lifetime) From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 01:10:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA5F8106566B; Sat, 31 Jan 2009 01:10:54 +0000 (UTC) (envelope-from prvs=julian=275d3c2d1@elischer.org) Received: from smtp-outbound.ironport.com (smtp-outbound.ironport.com [63.251.108.112]) by mx1.freebsd.org (Postfix) with ESMTP id 9CD768FC24; Sat, 31 Jan 2009 01:10:54 +0000 (UTC) (envelope-from prvs=julian=275d3c2d1@elischer.org) Received: from unknown (HELO julian-mac.elischer.org) ([10.251.60.10]) by smtp-outbound.ironport.com with ESMTP; 30 Jan 2009 15:45:37 -0800 Message-ID: <4983911E.8030601@elischer.org> Date: Fri, 30 Jan 2009 15:45:34 -0800 From: Julian Elischer User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209) MIME-Version: 1.0 To: "Bjoern A. Zeeb" References: <200901302340.n0UNeOmX006340@svn.freebsd.org> In-Reply-To: <200901302340.n0UNeOmX006340@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187939 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 01:10:55 -0000 Bjoern A. Zeeb wrote: > Author: bz > Date: Fri Jan 30 23:40:24 2009 > New Revision: 187939 > URL: http://svn.freebsd.org/changeset/base/187939 > > Log: > Remove 4 entirely unsued ip6 variables. > Leave then in struct vinet6 to not break the ABI with kernel modules > but mark them for removal so we can do it in one batch when the time > is right. maybe just rename them to "unused1" etc. > > MFC after: 1 month > > Modified: > head/sys/netinet6/ip6_input.c > head/sys/netinet6/ip6_var.h > head/sys/netinet6/vinet6.h > > Modified: head/sys/netinet6/ip6_input.c > ============================================================================== > --- head/sys/netinet6/ip6_input.c Fri Jan 30 22:23:21 2009 (r187938) > +++ head/sys/netinet6/ip6_input.c Fri Jan 30 23:40:24 2009 (r187939) > @@ -145,11 +145,6 @@ extern int udp6_sendspace; > extern int udp6_recvspace; > > extern struct route_in6 ip6_forward_rt; > - > -int ip6_forward_srcrt; /* XXX */ > -int ip6_sourcecheck; /* XXX */ > -int ip6_sourcecheck_interval; /* XXX */ > -int ip6_ours_check_algorithm; > #endif > > struct pfil_head inet6_pfil_hook; > > Modified: head/sys/netinet6/ip6_var.h > ============================================================================== > --- head/sys/netinet6/ip6_var.h Fri Jan 30 22:23:21 2009 (r187938) > +++ head/sys/netinet6/ip6_var.h Fri Jan 30 23:40:24 2009 (r187939) > @@ -284,7 +284,6 @@ extern struct ip6stat ip6stat; /* statis > extern int ip6_defhlim; /* default hop limit */ > extern int ip6_defmcasthlim; /* default multicast hop limit */ > extern int ip6_forwarding; /* act as router? */ > -extern int ip6_forward_srcrt; /* forward src-routed? */ > extern int ip6_gif_hlim; /* Hop limit for gif encap packet */ > extern int ip6_use_deprecated; /* allow deprecated addr as source */ > extern int ip6_rr_prune; /* router renumbering prefix > @@ -298,8 +297,6 @@ extern struct socket *ip6_mrouter; /* mu > extern int ip6_sendredirects; /* send IP redirects when forwarding? */ > extern int ip6_maxfragpackets; /* Maximum packets in reassembly queue */ > extern int ip6_maxfrags; /* Maximum fragments in reassembly queue */ > -extern int ip6_sourcecheck; /* Verify source interface */ > -extern int ip6_sourcecheck_interval; /* Interval between log messages */ > extern int ip6_accept_rtadv; /* Acts as a host not a router */ > extern int ip6_keepfaith; /* Firewall Aided Internet Translator */ > extern int ip6_log_interval; > > Modified: head/sys/netinet6/vinet6.h > ============================================================================== > --- head/sys/netinet6/vinet6.h Fri Jan 30 22:23:21 2009 (r187938) > +++ head/sys/netinet6/vinet6.h Fri Jan 30 23:40:24 2009 (r187939) > @@ -122,10 +122,10 @@ struct vnet_inet6 { > int _udp6_recvspace; > int _ip6qmaxlen; > int _ip6_prefer_tempaddr; > - int _ip6_forward_srcrt; > - int _ip6_sourcecheck; > - int _ip6_sourcecheck_interval; > - int _ip6_ours_check_algorithm; > + int _ip6_forward_srcrt; /* XXX remove */ > + int _ip6_sourcecheck; /* XXX remove */ > + int _ip6_sourcecheck_interval; /* XXX remove */ > + int _ip6_ours_check_algorithm; /* XXX remove */ > > int _nd6_prune; > int _nd6_delay; > @@ -195,7 +195,6 @@ extern struct vnet_inet6 vnet_inet6_0; > #define V_ip6_defmcasthlim VNET_INET6(ip6_defmcasthlim) > #define V_ip6_desync_factor VNET_INET6(ip6_desync_factor) > #define V_ip6_forward_rt VNET_INET6(ip6_forward_rt) > -#define V_ip6_forward_srcrt VNET_INET6(ip6_forward_srcrt) > #define V_ip6_forwarding VNET_INET6(ip6_forwarding) > #define V_ip6_hdrnestlimit VNET_INET6(ip6_hdrnestlimit) > #define V_ip6_keepfaith VNET_INET6(ip6_keepfaith) > @@ -206,12 +205,9 @@ extern struct vnet_inet6 vnet_inet6_0; > #define V_ip6_mcast_pmtu VNET_INET6(ip6_mcast_pmtu) > #define V_ip6_mrouter_ver VNET_INET6(ip6_mrouter_ver) > #define V_ip6_opts VNET_INET6(ip6_opts) > -#define V_ip6_ours_check_algorithm VNET_INET6(ip6_ours_check_algorithm) > #define V_ip6_prefer_tempaddr VNET_INET6(ip6_prefer_tempaddr) > #define V_ip6_rr_prune VNET_INET6(ip6_rr_prune) > #define V_ip6_sendredirects VNET_INET6(ip6_sendredirects) > -#define V_ip6_sourcecheck VNET_INET6(ip6_sourcecheck) > -#define V_ip6_sourcecheck_interval VNET_INET6(ip6_sourcecheck_interval) > #define V_ip6_temp_preferred_lifetime VNET_INET6(ip6_temp_preferred_lifetime) > #define V_ip6_temp_regen_advance VNET_INET6(ip6_temp_regen_advance) > #define V_ip6_temp_valid_lifetime VNET_INET6(ip6_temp_valid_lifetime) From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 03:39:36 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FB18106566C; Sat, 31 Jan 2009 03:39:36 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from smtp6.server.rpi.edu (smtp6.server.rpi.edu [128.113.2.226]) by mx1.freebsd.org (Postfix) with ESMTP id C14D08FC12; Sat, 31 Jan 2009 03:39:35 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp6.server.rpi.edu (8.13.1/8.13.1) with ESMTP id n0V2QdEW003603; Fri, 30 Jan 2009 21:26:41 -0500 Mime-Version: 1.0 Message-Id: In-Reply-To: <20090130.105746.-1582160580.imp@bsdimp.com> References: <20090130015518.GA20404@hades.panopticon> <20090130.085130.-4349483.imp@bsdimp.com> <20090130173956.GA9119@dragon.NUXI.org> <20090130.105746.-1582160580.imp@bsdimp.com> Date: Fri, 30 Jan 2009 21:26:38 -0500 To: "M. Warner Losh" , obrien@FreeBSD.org From: Garance A Drosehn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Bayes-Prob: 0.0001 (Score 0) X-RPI-SA-Score: 0.10 () [Hold at 20.00] COMBINED_FROM X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.226 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r187132 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 03:39:36 -0000 At 10:57 AM -0700 1/30/09, M. Warner Losh wrote: >In message: <20090130173956.GA9119@dragon.NUXI.org> > "David O'Brien" writes: >: >: 100,000 of things change within FreeBSD without discission that >: displeases some set of folks. That's nothing new, but I'm >: restoring compatibility and functionailty, not removing it. > >Don't you have any ability to judge that this might be a bad thing? >So far the voting I solicited is 100% in favor of getting rid of what >you did... Usually that implies it is a bad commit... In case someone is collecting votes, I'd also vote against the extra output. The sad thing is that somewhere I have changes to 'make' which added debugging option that helped a lot with parallel builds. One big difference was that it was an option, which could be turned on via some environment variable or something. I haven't the faintest idea what I did with that change though. -- Garance Alistair Drosehn = drosehn@rpi.edu Senior Systems Programmer or gad@FreeBSD.org Rensselaer Polytechnic Institute; Troy, NY; USA From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 05:17:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA098106564A; Sat, 31 Jan 2009 05:17:28 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EA658FC14; Sat, 31 Jan 2009 05:17:28 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0V5HSV0012763; Sat, 31 Jan 2009 05:17:28 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0V5HSpp012759; Sat, 31 Jan 2009 05:17:28 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200901310517.n0V5HSpp012759@svn.freebsd.org> From: Tim Kientzle Date: Sat, 31 Jan 2009 05:17:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187940 - head/usr.sbin/mtree X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 05:17:29 -0000 Author: kientzle Date: Sat Jan 31 05:17:28 2009 New Revision: 187940 URL: http://svn.freebsd.org/changeset/base/187940 Log: Write timestamps with exactly 9 digits after the period. This ensures that the value written is both compatible with older mtree versions (which expect the value after the period to be an integer count of nanoseconds after the whole second) and is a correct floating-point value. Leave the parsing code unchanged so it will continue to read older files. Modified: head/usr.sbin/mtree/create.c head/usr.sbin/mtree/mtree.5 head/usr.sbin/mtree/mtree.8 head/usr.sbin/mtree/spec.c Modified: head/usr.sbin/mtree/create.c ============================================================================== --- head/usr.sbin/mtree/create.c Fri Jan 30 23:40:24 2009 (r187939) +++ head/usr.sbin/mtree/create.c Sat Jan 31 05:17:28 2009 (r187940) @@ -212,7 +212,7 @@ statf(int indent, FTSENT *p) output(indent, &offset, "size=%jd", (intmax_t)p->fts_statp->st_size); if (keys & F_TIME) - output(indent, &offset, "time=%ld.%ld", + output(indent, &offset, "time=%ld.%09ld", (long)p->fts_statp->st_mtimespec.tv_sec, p->fts_statp->st_mtimespec.tv_nsec); if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) { Modified: head/usr.sbin/mtree/mtree.5 ============================================================================== --- head/usr.sbin/mtree/mtree.5 Fri Jan 30 23:40:24 2009 (r187939) +++ head/usr.sbin/mtree/mtree.5 Sat Jan 31 05:17:28 2009 (r187940) @@ -200,7 +200,9 @@ The size, in bytes, of the file. .It Cm link The file the symbolic link is expected to reference. .It Cm time -The last modification time of the file. +The last modification time of the file, in seconds and nanoseconds. +The value should include a period character and exactly nine digits +after the period. .It Cm type The type of the file; may be set to any one of the following: .Pp Modified: head/usr.sbin/mtree/mtree.8 ============================================================================== --- head/usr.sbin/mtree/mtree.8 Fri Jan 30 23:40:24 2009 (r187939) +++ head/usr.sbin/mtree/mtree.8 Sat Jan 31 05:17:28 2009 (r187940) @@ -233,7 +233,9 @@ The size, in bytes, of the file. .It Cm link The file the symbolic link is expected to reference. .It Cm time -The last modification time of the file. +The last modification time of the file, in seconds and nanoseconds. +The value should include a period character and exactly nine digits +after the period. .It Cm type The type of the file; may be set to any one of the following: .Pp Modified: head/usr.sbin/mtree/spec.c ============================================================================== --- head/usr.sbin/mtree/spec.c Fri Jan 30 23:40:24 2009 (r187939) +++ head/usr.sbin/mtree/spec.c Sat Jan 31 05:17:28 2009 (r187940) @@ -255,6 +255,8 @@ set(char *t, NODE *ip) case F_TIME: ip->st_mtimespec.tv_sec = strtoul(val, &ep, 10); if (*ep == '.') { + /* Note: we require exactly nine + * digits after the decimal point. */ val = ep + 1; ip->st_mtimespec.tv_nsec = strtoul(val, &ep, 10); From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 07:03:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABB1C106564A; Sat, 31 Jan 2009 07:03:36 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A20E8FC0A; Sat, 31 Jan 2009 07:03:36 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0V73aja014759; Sat, 31 Jan 2009 07:03:36 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0V73aG3014758; Sat, 31 Jan 2009 07:03:36 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <200901310703.n0V73aG3014758@svn.freebsd.org> From: "David E. O'Brien" Date: Sat, 31 Jan 2009 07:03:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187943 - head/usr.sbin/crunch/crunchgen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 07:03:37 -0000 Author: obrien Date: Sat Jan 31 07:03:36 2009 New Revision: 187943 URL: http://svn.freebsd.org/changeset/base/187943 Log: Run with -B and just .POSIX. Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c ============================================================================== --- head/usr.sbin/crunch/crunchgen/crunchgen.c Sat Jan 31 05:25:14 2009 (r187942) +++ head/usr.sbin/crunch/crunchgen/crunchgen.c Sat Jan 31 07:03:36 2009 (r187943) @@ -709,7 +709,7 @@ void fillin_program_objs(prog_t *p, char if (outhdrname[0] != '\0') fprintf(f, ".include \"%s\"\n", outhdrname); fprintf(f, ".include \"%s\"\n", path); - fprintf(f, ".NOTPARALLEL:\n.NO_PARALLEL:\n.POSIX:\n"); + fprintf(f, ".POSIX:\n"); if (buildopts) { fprintf(f, "BUILDOPTS+="); output_strlst(f, buildopts); @@ -728,7 +728,7 @@ void fillin_program_objs(prog_t *p, char fclose(f); - snprintf(line, MAXLINELEN, "cd %s && make -f %s -Q crunchgen_objs", + snprintf(line, MAXLINELEN, "cd %s && make -f %s -B crunchgen_objs", p->srcdir, tempfname); if ((f = popen(line, "r")) == NULL) { warn("submake pipe"); From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 08:24:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AE931065728; Sat, 31 Jan 2009 08:24:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 494388FC23; Sat, 31 Jan 2009 08:24:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0V8O9q0016203; Sat, 31 Jan 2009 08:24:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0V8O9qS016202; Sat, 31 Jan 2009 08:24:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200901310824.n0V8O9qS016202@svn.freebsd.org> From: Alexander Motin Date: Sat, 31 Jan 2009 08:24:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187944 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 08:24:10 -0000 Author: mav Date: Sat Jan 31 08:24:09 2009 New Revision: 187944 URL: http://svn.freebsd.org/changeset/base/187944 Log: Fix bug in hint.hdac.X.config parsing. Modified: head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Sat Jan 31 07:03:36 2009 (r187943) +++ head/sys/dev/sound/pci/hda/hdac.c Sat Jan 31 08:24:09 2009 (r187944) @@ -83,7 +83,7 @@ #include "mixer_if.h" -#define HDA_DRV_TEST_REV "20090126_0126" +#define HDA_DRV_TEST_REV "20090131_0127" SND_DECLARE_FILE("$FreeBSD$"); @@ -7106,7 +7106,7 @@ hdac_config_fetch(struct hdac_softc *sc, hdac_quirks_tab[k].key, len - inv) != 0) continue; if (len - inv != strlen(hdac_quirks_tab[k].key)) - break; + continue; HDA_BOOTVERBOSE( printf(" %s%s", (inv != 0) ? "no" : "", hdac_quirks_tab[k].key); From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 10:04:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AFBB106566C; Sat, 31 Jan 2009 10:04:36 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 899398FC1C; Sat, 31 Jan 2009 10:04:36 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VA4ano018047; Sat, 31 Jan 2009 10:04:36 GMT (envelope-from trhodes@svn.freebsd.org) Received: (from trhodes@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VA4arh018046; Sat, 31 Jan 2009 10:04:36 GMT (envelope-from trhodes@svn.freebsd.org) Message-Id: <200901311004.n0VA4arh018046@svn.freebsd.org> From: Tom Rhodes Date: Sat, 31 Jan 2009 10:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187945 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 10:04:37 -0000 Author: trhodes Date: Sat Jan 31 10:04:36 2009 New Revision: 187945 URL: http://svn.freebsd.org/changeset/base/187945 Log: Fix a typo in a comment. Modified: head/sys/sys/unistd.h Modified: head/sys/sys/unistd.h ============================================================================== --- head/sys/sys/unistd.h Sat Jan 31 08:24:09 2009 (r187944) +++ head/sys/sys/unistd.h Sat Jan 31 10:04:36 2009 (r187945) @@ -178,7 +178,7 @@ #define RFSIGSHARE (1<<14) /* share signal handlers */ #define RFLINUXTHPN (1<<16) /* do linux clone exit parent notification */ #define RFSTOPPED (1<<17) /* leave child in a stopped state */ -#define RFHIGHPID (1<<18) /* use a pid higher then 10 (idleproc) */ +#define RFHIGHPID (1<<18) /* use a pid higher than 10 (idleproc) */ #define RFPPWAIT (1<<31) /* parent sleeps until child exits (vfork) */ #define RFKERNELONLY (RFSTOPPED | RFHIGHPID | RFPPWAIT) From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 10:48:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6D411065700; Sat, 31 Jan 2009 10:48:02 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A46928FC18; Sat, 31 Jan 2009 10:48:02 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VAm2eZ018900; Sat, 31 Jan 2009 10:48:02 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VAm2Je018895; Sat, 31 Jan 2009 10:48:02 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200901311048.n0VAm2Je018895@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 31 Jan 2009 10:48:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187946 - in head/sys: net netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 10:48:03 -0000 Author: bz Date: Sat Jan 31 10:48:02 2009 New Revision: 187946 URL: http://svn.freebsd.org/changeset/base/187946 Log: Like with r185713 make sure to not leak a lock as rtalloc1(9) returns a locked route. Thus we have to use RTFREE_LOCKED(9) to get it unlocked and rtfree(9)d rather than just rtfree(9)d. Since the PR was filed, new places with the same problem were added with new code. Also check that the rt is valid before freeing it either way there. PR: kern/129793 Submitted by: Dheeraj Reddy MFC after: 2 weeks Committed from: Bugathon #6 Modified: head/sys/net/if_llatbl.c head/sys/netinet6/in6.c head/sys/netinet6/in6_gif.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/nd6_nbr.c Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Sat Jan 31 10:04:36 2009 (r187945) +++ head/sys/net/if_llatbl.c Sat Jan 31 10:48:02 2009 (r187946) @@ -219,10 +219,11 @@ lla_rt_output(struct rt_msghdr *rtm, str log(LOG_INFO, "%s: RTM_ADD publish " "(proxy only) is invalid\n", __func__); - RTFREE(rt); + if (rt) + RTFREE_LOCKED(rt); return EINVAL; } - RTFREE(rt); + RTFREE_LOCKED(rt); flags |= LLE_PROXY; } Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sat Jan 31 10:04:36 2009 (r187945) +++ head/sys/netinet6/in6.c Sat Jan 31 10:48:02 2009 (r187946) @@ -2122,16 +2122,16 @@ in6_lltable_rtcheck(struct ifnet *ifp, c ifa = ifaof_ifpforaddr(__DECONST(struct sockaddr *, l3addr), ifp); if (ifa != NULL) { if (rt != NULL) - rtfree(rt); + RTFREE_LOCKED(rt); return 0; } log(LOG_INFO, "IPv6 address: \"%s\" is not on the network\n", ip6_sprintf(ip6buf, &((const struct sockaddr_in6 *)l3addr)->sin6_addr)); if (rt != NULL) - rtfree(rt); + RTFREE_LOCKED(rt); return EINVAL; } - rtfree(rt); + RTFREE_LOCKED(rt); return 0; } Modified: head/sys/netinet6/in6_gif.c ============================================================================== --- head/sys/netinet6/in6_gif.c Sat Jan 31 10:04:36 2009 (r187945) +++ head/sys/netinet6/in6_gif.c Sat Jan 31 10:48:02 2009 (r187946) @@ -378,10 +378,10 @@ gif_validate6(const struct ip6_hdr *ip6, ip6_sprintf(ip6buf, &sin6.sin6_addr)); #endif if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); return 0; } - rtfree(rt); + RTFREE_LOCKED(rt); } return 128 * 2; Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Sat Jan 31 10:04:36 2009 (r187945) +++ head/sys/netinet6/in6_ifattach.c Sat Jan 31 10:48:02 2009 (r187946) @@ -778,7 +778,7 @@ in6_ifdetach(struct ifnet *ifp) if ((ia->ia_flags & IFA_ROUTE) && (rt = rtalloc1((struct sockaddr *)&ia->ia_addr, 0, 0UL))) { rtflags = rt->rt_flags; - rtfree(rt); + RTFREE_LOCKED(rt); rtrequest(RTM_DELETE, (struct sockaddr *)&ia->ia_addr, (struct sockaddr *)&ia->ia_addr, (struct sockaddr *)&ia->ia_prefixmask, Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Sat Jan 31 10:04:36 2009 (r187945) +++ head/sys/netinet6/nd6_nbr.c Sat Jan 31 10:48:02 2009 (r187946) @@ -259,7 +259,7 @@ nd6_ns_input(struct mbuf *m, int off, in need_proxy = (rt && (rt->rt_flags & RTF_ANNOUNCE) != 0 && rt->rt_gateway->sa_family == AF_LINK); if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); if (need_proxy) { /* * proxy NDP for single entry From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 11:19:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B232010656ED; Sat, 31 Jan 2009 11:19:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A0BA58FC18; Sat, 31 Jan 2009 11:19:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VBJKbX022911; Sat, 31 Jan 2009 11:19:20 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VBJKkD022910; Sat, 31 Jan 2009 11:19:20 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200901311119.n0VBJKkD022910@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 31 Jan 2009 11:19:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187947 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 11:19:21 -0000 Author: bz Date: Sat Jan 31 11:19:20 2009 New Revision: 187947 URL: http://svn.freebsd.org/changeset/base/187947 Log: Remove dead code from #if 0: we do not have an ipsrcchk_rt anywhere else. MFC after: 2 weeks Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Sat Jan 31 10:48:02 2009 (r187946) +++ head/sys/netinet6/frag6.c Sat Jan 31 11:19:20 2009 (r187947) @@ -762,10 +762,6 @@ frag6_slowtimo(void) RTFREE(V_ip6_forward_rt.ro_rt); V_ip6_forward_rt.ro_rt = 0; } - if (ipsrcchk_rt.ro_rt) { - RTFREE(ipsrcchk_rt.ro_rt); - ipsrcchk_rt.ro_rt = 0; - } #endif } From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 11:37:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C20A7106564A; Sat, 31 Jan 2009 11:37:21 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD52F8FC17; Sat, 31 Jan 2009 11:37:21 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VBbL9J023266; Sat, 31 Jan 2009 11:37:21 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VBbLxt023254; Sat, 31 Jan 2009 11:37:21 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <200901311137.n0VBbLxt023254@svn.freebsd.org> From: "David E. O'Brien" Date: Sat, 31 Jan 2009 11:37:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187948 - in head/sys: amd64/amd64 amd64/ia32 amd64/include amd64/linux32 compat/ndis i386/i386 i386/include i386/linux i386/svr4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 11:37:22 -0000 Author: obrien Date: Sat Jan 31 11:37:21 2009 New Revision: 187948 URL: http://svn.freebsd.org/changeset/base/187948 Log: Change some movl's to mov's. Newer GAS no longer accept 'movl' instructions for moving between a segment register and a 32-bit memory location. Looked at by: jhb Modified: head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/ia32/ia32_signal.c head/sys/amd64/ia32/ia32_sigtramp.S head/sys/amd64/include/cpufunc.h head/sys/amd64/linux32/linux32_locore.s head/sys/amd64/linux32/linux32_sysvec.c head/sys/compat/ndis/winx32_wrap.S head/sys/i386/i386/locore.s head/sys/i386/i386/swtch.s head/sys/i386/include/cpufunc.h head/sys/i386/linux/linux_locore.s head/sys/i386/svr4/svr4_locore.s Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Sat Jan 31 11:19:20 2009 (r187947) +++ head/sys/amd64/amd64/cpu_switch.S Sat Jan 31 11:37:21 2009 (r187948) @@ -260,12 +260,12 @@ do_kthread: jmp do_tss store_seg: - movl %gs,PCB_GS(%r8) + mov %gs,PCB_GS(%r8) testl $PCB_GS32BIT,PCB_FLAGS(%r8) jnz 2f -1: movl %ds,PCB_DS(%r8) - movl %es,PCB_ES(%r8) - movl %fs,PCB_FS(%r8) +1: mov %ds,PCB_DS(%r8) + mov %es,PCB_ES(%r8) + mov %fs,PCB_FS(%r8) jmp done_store_seg 2: movq PCPU(GS32P),%rax movq (%rax),%rax @@ -277,11 +277,11 @@ load_seg: jnz 2f 1: movl $MSR_GSBASE,%ecx rdmsr - movl PCB_GS(%r8),%gs + mov PCB_GS(%r8),%gs wrmsr - movl PCB_DS(%r8),%ds - movl PCB_ES(%r8),%es - movl PCB_FS(%r8),%fs + mov PCB_DS(%r8),%ds + mov PCB_ES(%r8),%es + mov PCB_FS(%r8),%fs jmp restore_fsbase /* Restore userland %gs while preserving kernel gsbase */ 2: movq PCPU(GS32P),%rax Modified: head/sys/amd64/ia32/ia32_signal.c ============================================================================== --- head/sys/amd64/ia32/ia32_signal.c Sat Jan 31 11:19:20 2009 (r187947) +++ head/sys/amd64/ia32/ia32_signal.c Sat Jan 31 11:37:21 2009 (r187948) @@ -328,8 +328,8 @@ freebsd4_ia32_sendsig(sig_t catcher, ksi sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; sf.sf_uc.uc_mcontext.mc_gs = rgs(); sf.sf_uc.uc_mcontext.mc_fs = rfs(); - __asm __volatile("movl %%es,%0" : "=rm" (sf.sf_uc.uc_mcontext.mc_es)); - __asm __volatile("movl %%ds,%0" : "=rm" (sf.sf_uc.uc_mcontext.mc_ds)); + __asm __volatile("mov %%es,%0" : "=rm" (sf.sf_uc.uc_mcontext.mc_es)); + __asm __volatile("mov %%ds,%0" : "=rm" (sf.sf_uc.uc_mcontext.mc_ds)); sf.sf_uc.uc_mcontext.mc_edi = regs->tf_rdi; sf.sf_uc.uc_mcontext.mc_esi = regs->tf_rsi; sf.sf_uc.uc_mcontext.mc_ebp = regs->tf_rbp; @@ -443,8 +443,8 @@ ia32_sendsig(sig_t catcher, ksiginfo_t * sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; sf.sf_uc.uc_mcontext.mc_gs = rgs(); sf.sf_uc.uc_mcontext.mc_fs = rfs(); - __asm __volatile("movl %%es,%0" : "=rm" (sf.sf_uc.uc_mcontext.mc_es)); - __asm __volatile("movl %%ds,%0" : "=rm" (sf.sf_uc.uc_mcontext.mc_ds)); + __asm __volatile("mov %%es,%0" : "=rm" (sf.sf_uc.uc_mcontext.mc_es)); + __asm __volatile("mov %%ds,%0" : "=rm" (sf.sf_uc.uc_mcontext.mc_ds)); sf.sf_uc.uc_mcontext.mc_edi = regs->tf_rdi; sf.sf_uc.uc_mcontext.mc_esi = regs->tf_rsi; sf.sf_uc.uc_mcontext.mc_ebp = regs->tf_rbp; Modified: head/sys/amd64/ia32/ia32_sigtramp.S ============================================================================== --- head/sys/amd64/ia32/ia32_sigtramp.S Sat Jan 31 11:19:20 2009 (r187947) +++ head/sys/amd64/ia32/ia32_sigtramp.S Sat Jan 31 11:37:21 2009 (r187948) @@ -45,8 +45,8 @@ ia32_sigcode: calll *IA32_SIGF_HANDLER(%esp) leal IA32_SIGF_UC(%esp),%eax /* get ucontext */ pushl %eax - movl IA32_UC_ES(%eax),%es /* restore %es */ - movl IA32_UC_DS(%eax),%ds /* restore %ds */ + mov IA32_UC_ES(%eax),%es /* restore %es */ + mov IA32_UC_DS(%eax),%ds /* restore %ds */ movl $SYS_sigreturn,%eax pushl %eax /* junk to fake return addr. */ int $0x80 /* enter kernel with args */ @@ -60,8 +60,8 @@ freebsd4_ia32_sigcode: calll *IA32_SIGF_HANDLER(%esp) leal IA32_SIGF_UC4(%esp),%eax/* get ucontext */ pushl %eax - movl IA32_UC4_ES(%eax),%es /* restore %es */ - movl IA32_UC4_DS(%eax),%ds /* restore %ds */ + mov IA32_UC4_ES(%eax),%es /* restore %es */ + mov IA32_UC4_DS(%eax),%ds /* restore %ds */ movl $344,%eax /* 4.x SYS_sigreturn */ pushl %eax /* junk to fake return addr. */ int $0x80 /* enter kernel with args */ Modified: head/sys/amd64/include/cpufunc.h ============================================================================== --- head/sys/amd64/include/cpufunc.h Sat Jan 31 11:19:20 2009 (r187947) +++ head/sys/amd64/include/cpufunc.h Sat Jan 31 11:37:21 2009 (r187948) @@ -482,7 +482,7 @@ static __inline u_int rfs(void) { u_int sel; - __asm __volatile("movl %%fs,%0" : "=rm" (sel)); + __asm __volatile("mov %%fs,%0" : "=rm" (sel)); return (sel); } @@ -490,7 +490,7 @@ static __inline u_int rgs(void) { u_int sel; - __asm __volatile("movl %%gs,%0" : "=rm" (sel)); + __asm __volatile("mov %%gs,%0" : "=rm" (sel)); return (sel); } @@ -498,20 +498,20 @@ static __inline u_int rss(void) { u_int sel; - __asm __volatile("movl %%ss,%0" : "=rm" (sel)); + __asm __volatile("mov %%ss,%0" : "=rm" (sel)); return (sel); } static __inline void load_ds(u_int sel) { - __asm __volatile("movl %0,%%ds" : : "rm" (sel)); + __asm __volatile("mov %0,%%ds" : : "rm" (sel)); } static __inline void load_es(u_int sel) { - __asm __volatile("movl %0,%%es" : : "rm" (sel)); + __asm __volatile("mov %0,%%es" : : "rm" (sel)); } static inline void @@ -539,7 +539,7 @@ load_fs(u_int sel) /* Preserve the fsbase value across the selector load */ fsbase = MSR_FSBASE; - __asm __volatile("rdmsr; movl %0,%%fs; wrmsr" + __asm __volatile("rdmsr; mov %0,%%fs; wrmsr" : : "rm" (sel), "c" (fsbase) : "eax", "edx"); } @@ -557,7 +557,7 @@ load_gs(u_int sel) * being trashed happens to be the kernel gsbase at the time. */ gsbase = MSR_GSBASE; - __asm __volatile("pushfq; cli; rdmsr; movl %0,%%gs; wrmsr; popfq" + __asm __volatile("pushfq; cli; rdmsr; mov %0,%%gs; wrmsr; popfq" : : "rm" (sel), "c" (gsbase) : "eax", "edx"); } #else @@ -565,13 +565,13 @@ load_gs(u_int sel) static __inline void load_fs(u_int sel) { - __asm __volatile("movl %0,%%fs" : : "rm" (sel)); + __asm __volatile("mov %0,%%fs" : : "rm" (sel)); } static __inline void load_gs(u_int sel) { - __asm __volatile("movl %0,%%gs" : : "rm" (sel)); + __asm __volatile("mov %0,%%gs" : : "rm" (sel)); } #endif Modified: head/sys/amd64/linux32/linux32_locore.s ============================================================================== --- head/sys/amd64/linux32/linux32_locore.s Sat Jan 31 11:19:20 2009 (r187947) +++ head/sys/amd64/linux32/linux32_locore.s Sat Jan 31 11:37:21 2009 (r187948) @@ -11,8 +11,8 @@ NON_GPROF_ENTRY(linux_sigcode) call *LINUX_SIGF_HANDLER(%esp) leal LINUX_SIGF_SC(%esp),%ebx /* linux scp */ - movl LINUX_SC_ES(%ebx),%es - movl LINUX_SC_DS(%ebx),%ds + mov LINUX_SC_ES(%ebx),%es + mov LINUX_SC_DS(%ebx),%ds movl %esp, %ebx /* pass sigframe */ push %eax /* fake ret addr */ movl $LINUX_SYS_linux_sigreturn,%eax /* linux_sigreturn() */ @@ -24,8 +24,8 @@ linux_rt_sigcode: call *LINUX_RT_SIGF_HANDLER(%esp) leal LINUX_RT_SIGF_UC(%esp),%ebx /* linux ucp */ leal LINUX_RT_SIGF_SC(%ebx),%ecx /* linux sigcontext */ - movl LINUX_SC_ES(%ecx),%es - movl LINUX_SC_DS(%ecx),%ds + mov LINUX_SC_ES(%ecx),%es + mov LINUX_SC_DS(%ecx),%ds push %eax /* fake ret addr */ movl $LINUX_SYS_linux_rt_sigreturn,%eax /* linux_rt_sigreturn() */ int $0x80 /* enter kernel with args */ Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Sat Jan 31 11:19:20 2009 (r187947) +++ head/sys/amd64/linux32/linux32_sysvec.c Sat Jan 31 11:37:21 2009 (r187948) @@ -351,9 +351,9 @@ linux_rt_sendsig(sig_t catcher, ksiginfo frame.sf_sc.uc_mcontext.sc_mask = frame.sf_sc.uc_sigmask.__bits[0]; frame.sf_sc.uc_mcontext.sc_gs = rgs(); frame.sf_sc.uc_mcontext.sc_fs = rfs(); - __asm __volatile("movl %%es,%0" : + __asm __volatile("mov %%es,%0" : "=rm" (frame.sf_sc.uc_mcontext.sc_es)); - __asm __volatile("movl %%ds,%0" : + __asm __volatile("mov %%ds,%0" : "=rm" (frame.sf_sc.uc_mcontext.sc_ds)); frame.sf_sc.uc_mcontext.sc_edi = regs->tf_rdi; frame.sf_sc.uc_mcontext.sc_esi = regs->tf_rsi; @@ -485,8 +485,8 @@ linux_sendsig(sig_t catcher, ksiginfo_t frame.sf_sc.sc_mask = lmask.__bits[0]; frame.sf_sc.sc_gs = rgs(); frame.sf_sc.sc_fs = rfs(); - __asm __volatile("movl %%es,%0" : "=rm" (frame.sf_sc.sc_es)); - __asm __volatile("movl %%ds,%0" : "=rm" (frame.sf_sc.sc_ds)); + __asm __volatile("mov %%es,%0" : "=rm" (frame.sf_sc.sc_es)); + __asm __volatile("mov %%ds,%0" : "=rm" (frame.sf_sc.sc_ds)); frame.sf_sc.sc_edi = regs->tf_rdi; frame.sf_sc.sc_esi = regs->tf_rsi; frame.sf_sc.sc_ebp = regs->tf_rbp; Modified: head/sys/compat/ndis/winx32_wrap.S ============================================================================== --- head/sys/compat/ndis/winx32_wrap.S Sat Jan 31 11:19:20 2009 (r187947) +++ head/sys/compat/ndis/winx32_wrap.S Sat Jan 31 11:37:21 2009 (r187948) @@ -369,7 +369,7 @@ ENTRY(x86_getfs) ret ENTRY(x86_setfs) - movl 4(%esp),%fs + mov 4(%esp),%fs ret ENTRY(x86_gettid) Modified: head/sys/i386/i386/locore.s ============================================================================== --- head/sys/i386/i386/locore.s Sat Jan 31 11:19:20 2009 (r187947) +++ head/sys/i386/i386/locore.s Sat Jan 31 11:37:21 2009 (r187948) @@ -338,7 +338,7 @@ NON_GPROF_ENTRY(sigcode) pushl %eax testl $PSL_VM,UC_EFLAGS(%eax) jne 1f - movl UC_GS(%eax),%gs /* restore %gs */ + mov UC_GS(%eax),%gs /* restore %gs */ 1: movl $SYS_sigreturn,%eax pushl %eax /* junk to fake return addr. */ @@ -355,7 +355,7 @@ freebsd4_sigcode: pushl %eax testl $PSL_VM,UC4_EFLAGS(%eax) jne 1f - movl UC4_GS(%eax),%gs /* restore %gs */ + mov UC4_GS(%eax),%gs /* restore %gs */ 1: movl $344,%eax /* 4.x SYS_sigreturn */ pushl %eax /* junk to fake return addr. */ @@ -373,7 +373,7 @@ osigcode: pushl %eax testl $PSL_VM,SC_PS(%eax) jne 9f - movl SC_GS(%eax),%gs /* restore %gs */ + mov SC_GS(%eax),%gs /* restore %gs */ 9: movl $103,%eax /* 3.x SYS_sigreturn */ pushl %eax /* junk to fake return addr. */ Modified: head/sys/i386/i386/swtch.s ============================================================================== --- head/sys/i386/i386/swtch.s Sat Jan 31 11:19:20 2009 (r187947) +++ head/sys/i386/i386/swtch.s Sat Jan 31 11:37:21 2009 (r187948) @@ -130,7 +130,7 @@ ENTRY(cpu_switch) movl %ebp,PCB_EBP(%edx) movl %esi,PCB_ESI(%edx) movl %edi,PCB_EDI(%edx) - movl %gs,PCB_GS(%edx) + mov %gs,PCB_GS(%edx) pushfl /* PSL */ popl PCB_PSL(%edx) /* Test if debug registers should be saved. */ @@ -313,7 +313,7 @@ sw1: /* This must be done after loading the user LDT. */ .globl cpu_switch_load_gs cpu_switch_load_gs: - movl PCB_GS(%edx),%gs + mov PCB_GS(%edx),%gs /* Test if debug registers should be restored. */ testl $PCB_DBREGS,PCB_FLAGS(%edx) @@ -383,7 +383,7 @@ ENTRY(savectx) movl %ebp,PCB_EBP(%ecx) movl %esi,PCB_ESI(%ecx) movl %edi,PCB_EDI(%ecx) - movl %gs,PCB_GS(%ecx) + mov %gs,PCB_GS(%ecx) pushfl popl PCB_PSL(%ecx) Modified: head/sys/i386/include/cpufunc.h ============================================================================== --- head/sys/i386/include/cpufunc.h Sat Jan 31 11:19:20 2009 (r187947) +++ head/sys/i386/include/cpufunc.h Sat Jan 31 11:37:21 2009 (r187948) @@ -497,7 +497,7 @@ static __inline u_int rfs(void) { u_int sel; - __asm __volatile("movl %%fs,%0" : "=rm" (sel)); + __asm __volatile("mov %%fs,%0" : "=rm" (sel)); return (sel); } @@ -513,7 +513,7 @@ static __inline u_int rgs(void) { u_int sel; - __asm __volatile("movl %%gs,%0" : "=rm" (sel)); + __asm __volatile("mov %%gs,%0" : "=rm" (sel)); return (sel); } @@ -537,7 +537,7 @@ static __inline u_int rss(void) { u_int sel; - __asm __volatile("movl %%ss,%0" : "=rm" (sel)); + __asm __volatile("mov %%ss,%0" : "=rm" (sel)); return (sel); } @@ -552,13 +552,13 @@ rtr(void) static __inline void load_fs(u_int sel) { - __asm __volatile("movl %0,%%fs" : : "rm" (sel)); + __asm __volatile("mov %0,%%fs" : : "rm" (sel)); } static __inline void load_gs(u_int sel) { - __asm __volatile("movl %0,%%gs" : : "rm" (sel)); + __asm __volatile("mov %0,%%gs" : : "rm" (sel)); } static __inline void Modified: head/sys/i386/linux/linux_locore.s ============================================================================== --- head/sys/i386/linux/linux_locore.s Sat Jan 31 11:19:20 2009 (r187947) +++ head/sys/i386/linux/linux_locore.s Sat Jan 31 11:37:21 2009 (r187948) @@ -8,7 +8,7 @@ NON_GPROF_ENTRY(linux_sigcode) call *LINUX_SIGF_HANDLER(%esp) leal LINUX_SIGF_SC(%esp),%ebx /* linux scp */ - movl LINUX_SC_GS(%ebx),%gs + mov LINUX_SC_GS(%ebx),%gs movl %esp, %ebx /* pass sigframe */ push %eax /* fake ret addr */ movl $LINUX_SYS_linux_sigreturn,%eax /* linux_sigreturn() */ @@ -20,7 +20,7 @@ linux_rt_sigcode: call *LINUX_RT_SIGF_HANDLER(%esp) leal LINUX_RT_SIGF_UC(%esp),%ebx /* linux ucp */ leal LINUX_RT_SIGF_SC(%ebx),%ecx /* linux sigcontext */ - movl LINUX_SC_GS(%ecx),%gs + mov LINUX_SC_GS(%ecx),%gs push %eax /* fake ret addr */ movl $LINUX_SYS_linux_rt_sigreturn,%eax /* linux_rt_sigreturn() */ int $0x80 /* enter kernel with args */ Modified: head/sys/i386/svr4/svr4_locore.s ============================================================================== --- head/sys/i386/svr4/svr4_locore.s Sat Jan 31 11:19:20 2009 (r187947) +++ head/sys/i386/svr4/svr4_locore.s Sat Jan 31 11:37:21 2009 (r187948) @@ -14,7 +14,7 @@ NON_GPROF_ENTRY(svr4_sigcode) testl $PSL_VM,SVR4_UC_EFLAGS(%eax) jnz 1f #endif - movl SVR4_UC_GS(%eax),%gs + mov SVR4_UC_GS(%eax),%gs 1: pushl %eax # pointer to ucontext pushl $1 # set context movl $svr4_sys_context,%eax From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 11:41:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FF06106566B; Sat, 31 Jan 2009 11:41:13 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85]) by mx1.freebsd.org (Postfix) with ESMTP id 3F43F8FC18; Sat, 31 Jan 2009 11:41:12 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1]) by dragon.nuxi.org (8.14.2/8.14.2) with ESMTP id n0VBfCAp068229; Sat, 31 Jan 2009 03:41:12 -0800 (PST) (envelope-from obrien@dragon.nuxi.org) Received: (from obrien@localhost) by dragon.nuxi.org (8.14.2/8.14.2/Submit) id n0VBfCmj068228; Sat, 31 Jan 2009 03:41:12 -0800 (PST) (envelope-from obrien) Date: Sat, 31 Jan 2009 03:41:12 -0800 From: "David O'Brien" To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <20090131114112.GA13698@dragon.NUXI.org> References: <200901311137.n0VBbLxt023254@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200901311137.n0VBbLxt023254@svn.freebsd.org> X-Operating-System: FreeBSD 8.0-CURRENT User-Agent: Mutt/1.5.16 (2007-06-09) Cc: Subject: Re: svn commit: r187948 - in head/sys: amd64/amd64 amd64/ia32 amd64/include amd64/linux32 compat/ndis i386/i386 i386/include i386/linux i386/svr4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 11:41:13 -0000 On Sat, Jan 31, 2009 at 11:37:21AM +0000, David O'Brien (@FreeBSD) wrote: > Author: obrien > Date: Sat Jan 31 11:37:21 2009 > New Revision: 187948 > URL: http://svn.freebsd.org/changeset/base/187948 > > Log: > Change some movl's to mov's. Newer GAS no longer accept 'movl' instructions > for moving between a segment register and a 32-bit memory location. I've built both the GENERIC and LINT kernels for i386 and amd64 with this change, and booted GENERIC for both (along with put the machines under a build work load). So I don't expect there to be any problems, but please do let me know if for some reason you have some build or upgrade problem. -- David From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 12:24:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D559F106568C; Sat, 31 Jan 2009 12:24:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3D2E8FC08; Sat, 31 Jan 2009 12:24:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VCOra9024238; Sat, 31 Jan 2009 12:24:53 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VCOr9V024237; Sat, 31 Jan 2009 12:24:53 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200901311224.n0VCOr9V024237@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 31 Jan 2009 12:24:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187949 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 12:24:54 -0000 Author: bz Date: Sat Jan 31 12:24:53 2009 New Revision: 187949 URL: http://svn.freebsd.org/changeset/base/187949 Log: Coalesce two consecutive #ifdef IPSEC blocks. Move the skip_ipsec: label below the goto as we can never have ipsecrt set if we get to that label so there is no need to check. MFC after: 2 weeks Modified: head/sys/netinet6/ip6_forward.c Modified: head/sys/netinet6/ip6_forward.c ============================================================================== --- head/sys/netinet6/ip6_forward.c Sat Jan 31 11:37:21 2009 (r187948) +++ head/sys/netinet6/ip6_forward.c Sat Jan 31 12:24:53 2009 (r187949) @@ -350,12 +350,9 @@ ip6_forward(struct mbuf *m, int srcrt) if (dst != NULL && rt != NULL) ipsecrt = 1; } - skip_ipsec: -#endif /* IPSEC */ - -#ifdef IPSEC if (ipsecrt) goto skip_routing; +skip_ipsec: #endif dst = (struct sockaddr_in6 *)&V_ip6_forward_rt.ro_dst; From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 13:48:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07E761065737; Sat, 31 Jan 2009 13:48:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EA6928FC0C; Sat, 31 Jan 2009 13:48:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VDmFYM026156; Sat, 31 Jan 2009 13:48:15 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VDmF4g026155; Sat, 31 Jan 2009 13:48:15 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200901311348.n0VDmF4g026155@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 31 Jan 2009 13:48:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187956 - head/sbin/reboot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 13:48:16 -0000 Author: bz Date: Sat Jan 31 13:48:15 2009 New Revision: 187956 URL: http://svn.freebsd.org/changeset/base/187956 Log: Remove and unused variable. Submitted by: Christoph Mallon christoph.mallon@gmx.de MFC after: 2 weeks Modified: head/sbin/reboot/reboot.c Modified: head/sbin/reboot/reboot.c ============================================================================== --- head/sbin/reboot/reboot.c Sat Jan 31 12:48:09 2009 (r187955) +++ head/sbin/reboot/reboot.c Sat Jan 31 13:48:15 2009 (r187956) @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) { const struct passwd *pw; - int ch, howto, i, fd, lflag, nflag, qflag, pflag, sverrno; + int ch, howto, i, fd, lflag, nflag, qflag, sverrno; u_int pageins; const char *p, *user, *kernel = NULL; @@ -91,7 +91,6 @@ main(int argc, char *argv[]) howto |= RB_NOSYNC; break; case 'p': - pflag = 1; howto |= RB_POWEROFF; break; case 'q': From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 17:34:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4ADA1065721; Sat, 31 Jan 2009 17:34:55 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2C078FC3C; Sat, 31 Jan 2009 17:34:55 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VHYtKi030076; Sat, 31 Jan 2009 17:34:55 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VHYt0o030075; Sat, 31 Jan 2009 17:34:55 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200901311734.n0VHYt0o030075@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 31 Jan 2009 17:34:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187957 - head/sys/cam/scsi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 17:34:56 -0000 Author: bz Date: Sat Jan 31 17:34:55 2009 New Revision: 187957 URL: http://svn.freebsd.org/changeset/base/187957 Log: There is no need to initialize the variable here. Submitted by: Christoph Mallon christoph.mallon@gmx.de Reviewed by: kib (as part of a larger patch) MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_pass.c Modified: head/sys/cam/scsi/scsi_pass.c ============================================================================== --- head/sys/cam/scsi/scsi_pass.c Sat Jan 31 13:48:15 2009 (r187956) +++ head/sys/cam/scsi/scsi_pass.c Sat Jan 31 17:34:55 2009 (r187957) @@ -298,8 +298,6 @@ passopen(struct cdev *dev, int flags, in struct pass_softc *softc; int error; - error = 0; /* default to no error */ - periph = (struct cam_periph *)dev->si_drv1; if (cam_periph_acquire(periph) != CAM_REQ_CMP) return (ENXIO); From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 17:35:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41F6510656E3; Sat, 31 Jan 2009 17:35:45 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 304408FC08; Sat, 31 Jan 2009 17:35:45 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VHZjkJ030133; Sat, 31 Jan 2009 17:35:45 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VHZjkA030131; Sat, 31 Jan 2009 17:35:45 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200901311735.n0VHZjkA030131@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 31 Jan 2009 17:35:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187958 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 17:35:45 -0000 Author: bz Date: Sat Jan 31 17:35:44 2009 New Revision: 187958 URL: http://svn.freebsd.org/changeset/base/187958 Log: Remove unused local MACROs. Submitted by: Christoph Mallon christoph.mallon@gmx.de MFC after: 2 weeks Modified: head/sys/netinet6/nd6.c head/sys/netinet6/nd6_rtr.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Sat Jan 31 17:34:55 2009 (r187957) +++ head/sys/netinet6/nd6.c Sat Jan 31 17:35:44 2009 (r187958) @@ -83,7 +83,6 @@ __FBSDID("$FreeBSD$"); #define ND6_RECALC_REACHTM_INTERVAL (60 * 120) /* 2 hours */ #define SIN6(s) ((struct sockaddr_in6 *)s) -#define SDL(s) ((struct sockaddr_dl *)s) #ifdef VIMAGE_GLOBALS int nd6_prune; Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Sat Jan 31 17:34:55 2009 (r187957) +++ head/sys/netinet6/nd6_rtr.c Sat Jan 31 17:35:44 2009 (r187958) @@ -68,8 +68,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define SDL(s) ((struct sockaddr_dl *)s) - static int rtpref(struct nd_defrouter *); static struct nd_defrouter *defrtrlist_update(struct nd_defrouter *); static int prelist_update __P((struct nd_prefixctl *, struct nd_defrouter *, From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 17:36:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03C53106570E; Sat, 31 Jan 2009 17:36:23 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA6328FC0C; Sat, 31 Jan 2009 17:36:22 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VHaMP5030188; Sat, 31 Jan 2009 17:36:22 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VHaMOR030180; Sat, 31 Jan 2009 17:36:22 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200901311736.n0VHaMOR030180@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 31 Jan 2009 17:36:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187959 - in head/sys/fs: coda devfs hpfs nullfs nwfs tmpfs udf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 17:36:23 -0000 Author: bz Date: Sat Jan 31 17:36:22 2009 New Revision: 187959 URL: http://svn.freebsd.org/changeset/base/187959 Log: Remove unused local variables. Submitted by: Christoph Mallon christoph.mallon@gmx.de Reviewed by: kib MFC after: 2 weeks Modified: head/sys/fs/coda/coda_vfsops.c head/sys/fs/devfs/devfs_vnops.c head/sys/fs/hpfs/hpfs_vfsops.c head/sys/fs/nullfs/null_vnops.c head/sys/fs/nwfs/nwfs_subr.c head/sys/fs/nwfs/nwfs_vnops.c head/sys/fs/tmpfs/tmpfs_subr.c head/sys/fs/udf/udf_vnops.c Modified: head/sys/fs/coda/coda_vfsops.c ============================================================================== --- head/sys/fs/coda/coda_vfsops.c Sat Jan 31 17:35:44 2009 (r187958) +++ head/sys/fs/coda/coda_vfsops.c Sat Jan 31 17:36:22 2009 (r187959) @@ -266,7 +266,6 @@ coda_root(struct mount *vfsp, int flags, struct thread *td) { struct coda_mntinfo *mi = vftomi(vfsp); - struct vnode **result; int error; struct proc *p = td->td_proc; CodaFid VFid; @@ -274,7 +273,6 @@ coda_root(struct mount *vfsp, int flags, ENTRY; MARK_ENTRY(CODA_ROOT_STATS); - result = NULL; if (vfsp == mi->mi_vfsp) { /* * Cache the root across calls. We only need to pass the Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Sat Jan 31 17:35:44 2009 (r187958) +++ head/sys/fs/devfs/devfs_vnops.c Sat Jan 31 17:36:22 2009 (r187959) @@ -1074,7 +1074,7 @@ devfs_readdir(struct vop_readdir_args *a struct devfs_dirent *dd; struct devfs_dirent *de; struct devfs_mount *dmp; - off_t off, oldoff; + off_t off; int *tmp_ncookies = NULL; if (ap->a_vp->v_type != VDIR) @@ -1113,7 +1113,6 @@ devfs_readdir(struct vop_readdir_args *a error = 0; de = ap->a_vp->v_data; off = 0; - oldoff = uio->uio_offset; TAILQ_FOREACH(dd, &de->de_dlist, de_list) { KASSERT(dd->de_cdp != (void *)0xdeadc0de, ("%s %d\n", __func__, __LINE__)); if (dd->de_flags & DE_WHITEOUT) Modified: head/sys/fs/hpfs/hpfs_vfsops.c ============================================================================== --- head/sys/fs/hpfs/hpfs_vfsops.c Sat Jan 31 17:35:44 2009 (r187958) +++ head/sys/fs/hpfs/hpfs_vfsops.c Sat Jan 31 17:36:22 2009 (r187959) @@ -109,7 +109,6 @@ hpfs_mount ( { int err = 0, error; struct vnode *devvp; - struct hpfsmount *hpmp = 0; struct nameidata ndp; struct export_args export; char *from; @@ -134,8 +133,6 @@ hpfs_mount ( if (mp->mnt_flag & MNT_UPDATE) { dprintf(("hpfs_omount: MNT_UPDATE: ")); - hpmp = VFSTOHPFS(mp); - if (from == NULL) { error = vfs_copyopt(mp->mnt_optnew, "export", &export, sizeof export); @@ -337,13 +334,11 @@ hpfs_unmount( int mntflags, struct thread *td) { - int error, flags, ronly; + int error, flags; register struct hpfsmount *hpmp = VFSTOHPFS(mp); dprintf(("hpfs_unmount():\n")); - ronly = (mp->mnt_flag & MNT_RDONLY) != 0; - flags = 0; if(mntflags & MNT_FORCE) flags |= FORCECLOSE; Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Sat Jan 31 17:35:44 2009 (r187958) +++ head/sys/fs/nullfs/null_vnops.c Sat Jan 31 17:36:22 2009 (r187959) @@ -658,7 +658,6 @@ null_reclaim(struct vop_reclaim_args *ap struct vnode *vp = ap->a_vp; struct null_node *xp = VTONULL(vp); struct vnode *lowervp = xp->null_lowervp; - struct lock *vnlock; if (lowervp) null_hashrem(xp); @@ -669,7 +668,6 @@ null_reclaim(struct vop_reclaim_args *ap VI_LOCK(vp); vp->v_data = NULL; vp->v_object = NULL; - vnlock = vp->v_vnlock; vp->v_vnlock = &vp->v_lock; if (lowervp) { lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_INTERLOCK, VI_MTX(vp)); Modified: head/sys/fs/nwfs/nwfs_subr.c ============================================================================== --- head/sys/fs/nwfs/nwfs_subr.c Sat Jan 31 17:35:44 2009 (r187958) +++ head/sys/fs/nwfs/nwfs_subr.c Sat Jan 31 17:36:22 2009 (r187959) @@ -179,7 +179,6 @@ ncp_lookup(struct vnode *dvp, int len, c { struct nwmount *nmp; struct nwnode *dnp; - struct ncp_conn *conn; int error; if (!dvp || dvp->v_type != VDIR) { @@ -188,7 +187,6 @@ ncp_lookup(struct vnode *dvp, int len, c } dnp = VTONW(dvp); nmp = VTONWFS(dvp); - conn = NWFSTOCONN(nmp); if (len == 1 && name[0] == '.') { if (dnp->n_flag & NVOLUME) { Modified: head/sys/fs/nwfs/nwfs_vnops.c ============================================================================== --- head/sys/fs/nwfs/nwfs_vnops.c Sat Jan 31 17:35:44 2009 (r187958) +++ head/sys/fs/nwfs/nwfs_vnops.c Sat Jan 31 17:36:22 2009 (r187959) @@ -627,7 +627,6 @@ nwfs_mkdir(ap) struct componentname *cnp = ap->a_cnp; int len=cnp->cn_namelen; struct ncp_open_info no; - struct nwnode *np; struct vnode *newvp = (struct vnode *)0; ncpfid fid; int error = 0; @@ -651,7 +650,6 @@ nwfs_mkdir(ap) fid.f_id = no.fattr.dirEntNum; error = nwfs_nget(VTOVFS(dvp), fid, &no.fattr, dvp, &newvp); if (!error) { - np = VTONW(newvp); newvp->v_type = VDIR; *ap->a_vpp = newvp; } Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Sat Jan 31 17:35:44 2009 (r187958) +++ head/sys/fs/tmpfs/tmpfs_subr.c Sat Jan 31 17:36:22 2009 (r187959) @@ -1259,12 +1259,10 @@ tmpfs_update(struct vnode *vp) int tmpfs_truncate(struct vnode *vp, off_t length) { - boolean_t extended; int error; struct tmpfs_node *node; node = VP_TO_TMPFS_NODE(vp); - extended = length > node->tn_size; if (length < 0) { error = EINVAL; Modified: head/sys/fs/udf/udf_vnops.c ============================================================================== --- head/sys/fs/udf/udf_vnops.c Sat Jan 31 17:35:44 2009 (r187958) +++ head/sys/fs/udf/udf_vnops.c Sat Jan 31 17:36:22 2009 (r187959) @@ -892,7 +892,6 @@ udf_lookup(struct vop_cachedlookup_args struct udf_mnt *udfmp; struct fileid_desc *fid = NULL; struct udf_dirstream *ds; - struct thread *td; u_long nameiop; u_long flags; char *nameptr; @@ -909,7 +908,6 @@ udf_lookup(struct vop_cachedlookup_args nameptr = a->a_cnp->cn_nameptr; namelen = a->a_cnp->cn_namelen; fsize = le64toh(node->fentry->inf_len); - td = a->a_cnp->cn_thread; /* * If this is a LOOKUP and we've already partially searched through From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 18:06:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D20310656BC; Sat, 31 Jan 2009 18:06:34 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6AB128FC08; Sat, 31 Jan 2009 18:06:34 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VI6YQH030779; Sat, 31 Jan 2009 18:06:34 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VI6Yh9030777; Sat, 31 Jan 2009 18:06:34 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200901311806.n0VI6Yh9030777@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 31 Jan 2009 18:06:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187960 - in head/sys/fs: nwfs smbfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 18:06:34 -0000 Author: bz Date: Sat Jan 31 18:06:34 2009 New Revision: 187960 URL: http://svn.freebsd.org/changeset/base/187960 Log: After r186194 the *fs_strategy() functions always return 0. So we are no longer interested in the error returned from the *fs_doio() functions. With that we can remove the error variable as its value is unused now. Submitted by: Christoph Mallon christoph.mallon@gmx.de Modified: head/sys/fs/nwfs/nwfs_vnops.c head/sys/fs/smbfs/smbfs_vnops.c Modified: head/sys/fs/nwfs/nwfs_vnops.c ============================================================================== --- head/sys/fs/nwfs/nwfs_vnops.c Sat Jan 31 17:36:22 2009 (r187959) +++ head/sys/fs/nwfs/nwfs_vnops.c Sat Jan 31 18:06:34 2009 (r187960) @@ -784,7 +784,6 @@ static int nwfs_strategy (ap) struct buf *bp=ap->a_bp; struct ucred *cr; struct thread *td; - int error = 0; NCPVNDEBUG("\n"); if (bp->b_flags & B_ASYNC) @@ -801,7 +800,7 @@ static int nwfs_strategy (ap) * otherwise just do it ourselves. */ if ((bp->b_flags & B_ASYNC) == 0 ) - error = nwfs_doio(ap->a_vp, bp, cr, td); + (void)nwfs_doio(ap->a_vp, bp, cr, td); return (0); } Modified: head/sys/fs/smbfs/smbfs_vnops.c ============================================================================== --- head/sys/fs/smbfs/smbfs_vnops.c Sat Jan 31 17:36:22 2009 (r187959) +++ head/sys/fs/smbfs/smbfs_vnops.c Sat Jan 31 18:06:34 2009 (r187960) @@ -850,7 +850,6 @@ smbfs_strategy (ap) struct buf *bp=ap->a_bp; struct ucred *cr; struct thread *td; - int error = 0; SMBVDEBUG("\n"); if (bp->b_flags & B_ASYNC) @@ -863,7 +862,7 @@ smbfs_strategy (ap) cr = bp->b_wcred; if ((bp->b_flags & B_ASYNC) == 0 ) - error = smbfs_doio(ap->a_vp, bp, cr, td); + (void)smbfs_doio(ap->a_vp, bp, cr, td); return (0); } From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 18:27:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25A461065691; Sat, 31 Jan 2009 18:27:03 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 089578FC1E; Sat, 31 Jan 2009 18:27:03 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VIR2dC031223; Sat, 31 Jan 2009 18:27:02 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VIR2WF031218; Sat, 31 Jan 2009 18:27:02 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200901311827.n0VIR2WF031218@svn.freebsd.org> From: David Schultz Date: Sat, 31 Jan 2009 18:27:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187961 - in head: include sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 18:27:03 -0000 Author: das Date: Sat Jan 31 18:27:02 2009 New Revision: 187961 URL: http://svn.freebsd.org/changeset/base/187961 Log: Add a function attribute called `__malloc_like', which informs gcc that the annotated function returns a pointer that doesn't alias any extant pointer. This results in a 50%+ speedup in microbenchmarks such as the following: char *cp = malloc(1), *buf = malloc(BUF); for (i = 0; i < BUF; i++) buf[i] = *cp; In real programs, your mileage will vary. Note that gcc already performs this optimization automatically for any function called `malloc', `calloc', `strdup', or `strndup' unless -fno-builtins is used. Modified: head/include/stdlib.h head/include/string.h head/include/wchar.h head/sys/sys/cdefs.h head/sys/sys/malloc.h Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Sat Jan 31 18:06:34 2009 (r187960) +++ head/include/stdlib.h Sat Jan 31 18:27:02 2009 (r187961) @@ -88,14 +88,14 @@ int atoi(const char *); long atol(const char *); void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); -void *calloc(size_t, size_t); +void *calloc(size_t, size_t) __malloc_like; div_t div(int, int) __pure2; void exit(int) __dead2; void free(void *); char *getenv(const char *); long labs(long) __pure2; ldiv_t ldiv(long, long) __pure2; -void *malloc(size_t); +void *malloc(size_t) __malloc_like; int mblen(const char *, size_t); size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); Modified: head/include/string.h ============================================================================== --- head/include/string.h Sat Jan 31 18:06:34 2009 (r187960) +++ head/include/string.h Sat Jan 31 18:27:02 2009 (r187961) @@ -78,7 +78,7 @@ int strcoll(const char *, const char *) char *strcpy(char * __restrict, const char * __restrict); size_t strcspn(const char *, const char *) __pure; #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE -char *strdup(const char *); +char *strdup(const char *) __malloc_like; #endif char *strerror(int); #if __POSIX_VISIBLE >= 200112 @@ -96,7 +96,7 @@ char *strncat(char * __restrict, const c int strncmp(const char *, const char *, size_t) __pure; char *strncpy(char * __restrict, const char * __restrict, size_t); #if __BSD_VISIBLE -char *strndup(const char *, size_t); +char *strndup(const char *, size_t) __malloc_like; char *strnstr(const char *, const char *, size_t) __pure; #endif char *strpbrk(const char *, const char *) __pure; Modified: head/include/wchar.h ============================================================================== --- head/include/wchar.h Sat Jan 31 18:06:34 2009 (r187960) +++ head/include/wchar.h Sat Jan 31 18:27:02 2009 (r187961) @@ -214,7 +214,7 @@ int wcwidth(wchar_t); wchar_t *fgetwln(struct __sFILE * __restrict, size_t * __restrict); size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, size_t, mbstate_t * __restrict); -wchar_t *wcsdup(const wchar_t *); +wchar_t *wcsdup(const wchar_t *) __malloc_like; size_t wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t, size_t, mbstate_t * __restrict); size_t wcslcat(wchar_t *, const wchar_t *, size_t); Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Sat Jan 31 18:06:34 2009 (r187960) +++ head/sys/sys/cdefs.h Sat Jan 31 18:27:02 2009 (r187961) @@ -221,8 +221,10 @@ #endif #if __GNUC_PREREQ__(2, 96) +#define __malloc_like __attribute__((__malloc__)) #define __pure __attribute__((__pure__)) #else +#define __malloc_like #define __pure #endif Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Sat Jan 31 18:06:34 2009 (r187960) +++ head/sys/sys/malloc.h Sat Jan 31 18:27:02 2009 (r187961) @@ -190,9 +190,9 @@ typedef void malloc_type_list_func_t(str void contigfree(void *addr, unsigned long size, struct malloc_type *type); void *contigmalloc(unsigned long size, struct malloc_type *type, int flags, vm_paddr_t low, vm_paddr_t high, unsigned long alignment, - unsigned long boundary); + unsigned long boundary) __malloc_like; void free(void *addr, struct malloc_type *type); -void *malloc(unsigned long size, struct malloc_type *type, int flags); +void *malloc(unsigned long size, struct malloc_type *type, int flags) __malloc_like; void malloc_init(void *); int malloc_last_fail(void); void malloc_type_allocated(struct malloc_type *type, unsigned long size); From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 18:28:01 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD80710656BC; Sat, 31 Jan 2009 18:28:01 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 61D3C8FC21; Sat, 31 Jan 2009 18:28:01 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n0VISJZe015142; Sat, 31 Jan 2009 13:28:19 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n0VISJua015141; Sat, 31 Jan 2009 13:28:19 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Sat, 31 Jan 2009 13:28:19 -0500 From: David Schultz To: src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG Message-ID: <20090131182819.GA15117@zim.MIT.EDU> Mail-Followup-To: src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <200901311827.n0VIR2WF031218@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200901311827.n0VIR2WF031218@svn.freebsd.org> Cc: Subject: Re: svn commit: r187961 - in head: include sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 18:28:02 -0000 On Sat, Jan 31, 2009, David Schultz wrote: > Add a function attribute called `__malloc_like', which informs gcc > that the annotated function returns a pointer that doesn't alias any > extant pointer. It wouldn't hurt if a networking guru added this annotation to the mbuf allocator as well, but it probably wouldn't help much either. I deliberately didn't add it to uma(9) because ctors might create aliases to the memory regions returned by uma_zalloc(). From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 18:31:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 584311065714; Sat, 31 Jan 2009 18:31:58 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 457078FC1D; Sat, 31 Jan 2009 18:31:58 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VIVwKF031337; Sat, 31 Jan 2009 18:31:58 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VIVw2i031334; Sat, 31 Jan 2009 18:31:58 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200901311831.n0VIVw2i031334@svn.freebsd.org> From: David Schultz Date: Sat, 31 Jan 2009 18:31:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187962 - head/tools/regression/lib/msun X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 18:31:58 -0000 Author: das Date: Sat Jan 31 18:31:57 2009 New Revision: 187962 URL: http://svn.freebsd.org/changeset/base/187962 Log: Add tests for conj{,f,l}() that I wrote some time ago. These test the versions in libm, not the gcc builtins. Added: head/tools/regression/lib/msun/test-conj.c (contents, props changed) head/tools/regression/lib/msun/test-conj.t (props changed) - copied unchanged from r181102, head/tools/regression/lib/msun/test-csqrt.t Modified: head/tools/regression/lib/msun/Makefile Modified: head/tools/regression/lib/msun/Makefile ============================================================================== --- head/tools/regression/lib/msun/Makefile Sat Jan 31 18:27:02 2009 (r187961) +++ head/tools/regression/lib/msun/Makefile Sat Jan 31 18:31:57 2009 (r187962) @@ -1,6 +1,6 @@ # $FreeBSD$ -TESTS= test-csqrt test-exponential test-fenv test-fma \ +TESTS= test-conj test-csqrt test-exponential test-fenv test-fma \ test-fmaxmin test-ilogb test-invtrig test-lrint \ test-lround test-nan test-next test-rem test-trig CFLAGS+= -O0 -lm Added: head/tools/regression/lib/msun/test-conj.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/lib/msun/test-conj.c Sat Jan 31 18:31:57 2009 (r187962) @@ -0,0 +1,158 @@ +/*- + * Copyright (c) 2008 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. + */ + +/* + * Tests for conj{,f,l}() + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#pragma STDC CX_LIMITED_RANGE off + +/* Make sure gcc doesn't use builtin versions of these or honor __pure2. */ +static float complex (*libconjf)(float complex) = conjf; +static double complex (*libconj)(double complex) = conj; +static long double complex (*libconjl)(long double complex) = conjl; +static float (*libcrealf)(float complex) = crealf; +static double (*libcreal)(double complex) = creal; +static long double (*libcreall)(long double complex) = creall; +static float (*libcimagf)(float complex) = cimagf; +static double (*libcimag)(double complex) = cimag; +static long double (*libcimagl)(long double complex) = cimagl; + +/* + * Compare d1 and d2 using special rules: NaN == NaN and +0 != -0. + * Fail an assertion if they differ. + */ +static int +fpequal(long double d1, long double d2) +{ + + if (d1 != d2) + return (isnan(d1) && isnan(d2)); + return (copysignl(1.0, d1) == copysignl(1.0, d2)); +} + +static int +cfpequal(long double complex d1, long double complex d2) +{ + + return (fpequal(creall(d1), creall(d2)) && + fpequal(cimagl(d1), cimagl(d2))); +} + +static const double tests[] = { + /* a + bI */ + 0.0, 0.0, + 0.0, 1.0, + 1.0, 0.0, + -1.0, 0.0, + 1.0, -0.0, + 0.0, -1.0, + 2.0, 4.0, + 0.0, INFINITY, + 0.0, -INFINITY, + INFINITY, 0.0, + NAN, 1.0, + 1.0, NAN, + NAN, NAN, + -INFINITY, INFINITY, +}; + +int +main(int argc, char *argv[]) +{ + static const int ntests = sizeof(tests) / sizeof(tests[0]) / 2; + complex float in; + complex long double expected; + int i; + + printf("1..%d\n", ntests * 3); + + for (i = 0; i < ntests; i++) { + __real__ expected = __real__ in = tests[2 * i]; + __imag__ in = tests[2 * i + 1]; + __imag__ expected = -cimag(in); + + assert(fpequal(libcrealf(in), __real__ in)); + assert(fpequal(libcreal(in), __real__ in)); + assert(fpequal(libcreall(in), __real__ in)); + assert(fpequal(libcimagf(in), __imag__ in)); + assert(fpequal(libcimag(in), __imag__ in)); + assert(fpequal(libcimagl(in), __imag__ in)); + + feclearexcept(FE_ALL_EXCEPT); + if (!cfpequal(libconjf(in), expected)) { + printf("not ok %d\t# conjf(%#.2g + %#.2gI): " + "wrong value\n", + 3 * i + 1, creal(in), cimag(in)); + } else if (fetestexcept(FE_ALL_EXCEPT)) { + printf("not ok %d\t# conjf(%#.2g + %#.2gI): " + "threw an exception\n", + 3 * i + 1, creal(in), cimag(in)); + } else { + printf("ok %d\t\t# conjf(%#.2g + %#.2gI)\n", + 3 * i + 1, creal(in), cimag(in)); + } + + feclearexcept(FE_ALL_EXCEPT); + if (!cfpequal(libconj(in), expected)) { + printf("not ok %d\t# conj(%#.2g + %#.2gI): " + "wrong value\n", + 3 * i + 2, creal(in), cimag(in)); + } else if (fetestexcept(FE_ALL_EXCEPT)) { + printf("not ok %d\t# conj(%#.2g + %#.2gI): " + "threw an exception\n", + 3 * i + 2, creal(in), cimag(in)); + } else { + printf("ok %d\t\t# conj(%#.2g + %#.2gI)\n", + 3 * i + 2, creal(in), cimag(in)); + } + + feclearexcept(FE_ALL_EXCEPT); + if (!cfpequal(libconjl(in), expected)) { + printf("not ok %d\t# conjl(%#.2g + %#.2gI): " + "wrong value\n", + 3 * i + 3, creal(in), cimag(in)); + } else if (fetestexcept(FE_ALL_EXCEPT)) { + printf("not ok %d\t# conjl(%#.2g + %#.2gI): " + "threw an exception\n", + 3 * i + 3, creal(in), cimag(in)); + } else { + printf("ok %d\t\t# conjl(%#.2g + %#.2gI)\n", + 3 * i + 3, creal(in), cimag(in)); + } + } + + return (0); +} Copied: head/tools/regression/lib/msun/test-conj.t (from r181102, head/tools/regression/lib/msun/test-csqrt.t) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/lib/msun/test-conj.t Sat Jan 31 18:31:57 2009 (r187962, copy of r181102, head/tools/regression/lib/msun/test-csqrt.t) @@ -0,0 +1,10 @@ +#!/bin/sh +# $FreeBSD$ + +cd `dirname $0` + +executable=`basename $0 .t` + +make $executable 2>&1 > /dev/null + +exec ./$executable From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 18:32:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF9A810656D7; Sat, 31 Jan 2009 18:32:39 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62FA68FC1C; Sat, 31 Jan 2009 18:32:39 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VIWdUR031389; Sat, 31 Jan 2009 18:32:39 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VIWdst031388; Sat, 31 Jan 2009 18:32:39 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200901311832.n0VIWdst031388@svn.freebsd.org> From: David Schultz Date: Sat, 31 Jan 2009 18:32:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187963 - head/tools/regression/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 18:32:40 -0000 Author: das Date: Sat Jan 31 18:32:39 2009 New Revision: 187963 URL: http://svn.freebsd.org/changeset/base/187963 Log: Test wprintf() in addition to printf(). Modified: head/tools/regression/lib/libc/stdio/test-printfloat.c Modified: head/tools/regression/lib/libc/stdio/test-printfloat.c ============================================================================== --- head/tools/regression/lib/libc/stdio/test-printfloat.c Sat Jan 31 18:31:57 2009 (r187962) +++ head/tools/regression/lib/libc/stdio/test-printfloat.c Sat Jan 31 18:32:39 2009 (r187963) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2002, 2005 David Schultz + * Copyright (c) 2002-2009 David Schultz * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define testfmt(result, fmt, ...) \ _testfmt((result), __LINE__, #__VA_ARGS__, fmt, __VA_ARGS__) @@ -326,10 +327,13 @@ smash_stack(void) void _testfmt(const char *result, int line, const char *argstr, const char *fmt,...) { - char s[100]; - va_list ap; +#define BUF 100 + wchar_t ws[BUF], wfmt[BUF], wresult[BUF]; + char s[BUF]; + va_list ap, ap2; va_start(ap, fmt); + va_copy(ap2, ap); smash_stack(); vsnprintf(s, sizeof(s), fmt, ap); if (strcmp(result, s) != 0) { @@ -338,4 +342,16 @@ _testfmt(const char *result, int line, c line, fmt, argstr, s, result); abort(); } + + smash_stack(); + mbstowcs(ws, s, BUF - 1); + mbstowcs(wfmt, fmt, BUF - 1); + mbstowcs(wresult, result, BUF - 1); + vswprintf(ws, sizeof(ws) / sizeof(ws[0]), wfmt, ap2); + if (wcscmp(wresult, ws) != 0) { + fprintf(stderr, + "%d: wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]\n", + line, wfmt, argstr, ws, wresult); + abort(); + } } From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 20:46:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D77CB1065722; Sat, 31 Jan 2009 20:46:01 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B96038FC1B; Sat, 31 Jan 2009 20:46:01 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VKk1Fi033661; Sat, 31 Jan 2009 20:46:01 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VKk1LV033660; Sat, 31 Jan 2009 20:46:01 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <200901312046.n0VKk1LV033660@svn.freebsd.org> From: "David E. O'Brien" Date: Sat, 31 Jan 2009 20:46:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187964 - head/sys/amd64/linux32 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 20:46:02 -0000 Author: obrien Date: Sat Jan 31 20:46:01 2009 New Revision: 187964 URL: http://svn.freebsd.org/changeset/base/187964 Log: Fix the inconsistent tabbing. Noticed by: bde Modified: head/sys/amd64/linux32/linux32_sysvec.c Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Sat Jan 31 18:32:39 2009 (r187963) +++ head/sys/amd64/linux32/linux32_sysvec.c Sat Jan 31 20:46:01 2009 (r187964) @@ -348,12 +348,12 @@ linux_rt_sendsig(sig_t catcher, ksiginfo bsd_to_linux_sigset(mask, &frame.sf_sc.uc_sigmask); - frame.sf_sc.uc_mcontext.sc_mask = frame.sf_sc.uc_sigmask.__bits[0]; - frame.sf_sc.uc_mcontext.sc_gs = rgs(); - frame.sf_sc.uc_mcontext.sc_fs = rfs(); - __asm __volatile("mov %%es,%0" : + frame.sf_sc.uc_mcontext.sc_mask = frame.sf_sc.uc_sigmask.__bits[0]; + frame.sf_sc.uc_mcontext.sc_gs = rgs(); + frame.sf_sc.uc_mcontext.sc_fs = rfs(); + __asm __volatile("mov %%es,%0" : "=rm" (frame.sf_sc.uc_mcontext.sc_es)); - __asm __volatile("mov %%ds,%0" : + __asm __volatile("mov %%ds,%0" : "=rm" (frame.sf_sc.uc_mcontext.sc_ds)); frame.sf_sc.uc_mcontext.sc_edi = regs->tf_rdi; frame.sf_sc.uc_mcontext.sc_esi = regs->tf_rsi; @@ -483,10 +483,10 @@ linux_sendsig(sig_t catcher, ksiginfo_t * Build the signal context to be used by sigreturn. */ frame.sf_sc.sc_mask = lmask.__bits[0]; - frame.sf_sc.sc_gs = rgs(); - frame.sf_sc.sc_fs = rfs(); - __asm __volatile("mov %%es,%0" : "=rm" (frame.sf_sc.sc_es)); - __asm __volatile("mov %%ds,%0" : "=rm" (frame.sf_sc.sc_ds)); + frame.sf_sc.sc_gs = rgs(); + frame.sf_sc.sc_fs = rfs(); + __asm __volatile("mov %%es,%0" : "=rm" (frame.sf_sc.sc_es)); + __asm __volatile("mov %%ds,%0" : "=rm" (frame.sf_sc.sc_ds)); frame.sf_sc.sc_edi = regs->tf_rdi; frame.sf_sc.sc_esi = regs->tf_rsi; frame.sf_sc.sc_ebp = regs->tf_rbp; @@ -768,35 +768,37 @@ static int exec_linux_imgact_try(struct static int exec_linux_imgact_try(struct image_params *imgp) { - const char *head = (const char *)imgp->image_header; - char *rpath; - int error = -1, len; - - /* - * The interpreter for shell scripts run from a linux binary needs - * to be located in /compat/linux if possible in order to recursively - * maintain linux path emulation. - */ - if (((const short *)head)[0] == SHELLMAGIC) { - /* - * Run our normal shell image activator. If it succeeds attempt - * to use the alternate path for the interpreter. If an alternate - * path is found, use our stringspace to store it. - */ - if ((error = exec_shell_imgact(imgp)) == 0) { - linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), - imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, AT_FDCWD); - if (rpath != NULL) { - len = strlen(rpath) + 1; - - if (len <= MAXSHELLCMDLEN) { - memcpy(imgp->interpreter_name, rpath, len); - } - free(rpath, M_TEMP); - } - } - } - return(error); + const char *head = (const char *)imgp->image_header; + char *rpath; + int error = -1, len; + + /* + * The interpreter for shell scripts run from a linux binary needs + * to be located in /compat/linux if possible in order to recursively + * maintain linux path emulation. + */ + if (((const short *)head)[0] == SHELLMAGIC) { + /* + * Run our normal shell image activator. If it succeeds attempt + * to use the alternate path for the interpreter. If an + * alternate * path is found, use our stringspace to store it. + */ + if ((error = exec_shell_imgact(imgp)) == 0) { + linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), + imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, + AT_FDCWD); + if (rpath != NULL) { + len = strlen(rpath) + 1; + + if (len <= MAXSHELLCMDLEN) { + memcpy(imgp->interpreter_name, rpath, + len); + } + free(rpath, M_TEMP); + } + } + } + return(error); } /* @@ -864,7 +866,7 @@ linux_copyout_strings(struct image_param 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 *)); + roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); /* * install sigcode @@ -882,23 +884,24 @@ linux_copyout_strings(struct image_param * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for * lower compatibility. */ - imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size - : (AT_COUNT * 2); + imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size : + (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 = (u_int32_t *) (destp - (imgp->args->argc + imgp->args->envc + 2 + - imgp->auxarg_size) * sizeof(u_int32_t)); + vectp = (u_int32_t *) (destp - (imgp->args->argc + + imgp->args->envc + 2 + imgp->auxarg_size) * + sizeof(u_int32_t)); } else /* * The '+ 2' is for the null pointers at the end of each of * the arg and env vector sets */ - vectp = (u_int32_t *) - (destp - (imgp->args->argc + imgp->args->envc + 2) * sizeof(u_int32_t)); + vectp = (u_int32_t *)(destp - (imgp->args->argc + + imgp->args->envc + 2) * sizeof(u_int32_t)); /* * vectp also becomes our initial stack base @@ -970,7 +973,7 @@ linux32_fixlimit(struct rlimit *rl, int switch (which) { case RLIMIT_DATA: - if (linux32_maxdsiz != 0) { + if (linux32_maxdsiz != 0) { if (rl->rlim_cur > linux32_maxdsiz) rl->rlim_cur = linux32_maxdsiz; if (rl->rlim_max > linux32_maxdsiz) @@ -1080,12 +1083,12 @@ linux_elf_modevent(module_t mod, int typ sx_init(&emul_shared_lock, "emuldata->shared lock"); LIST_INIT(&futex_list); sx_init(&futex_sx, "futex protection lock"); - linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit, - NULL, 1000); - linux_schedtail_tag = EVENTHANDLER_REGISTER(schedtail, linux_schedtail, - NULL, 1000); - linux_exec_tag = EVENTHANDLER_REGISTER(process_exec, linux_proc_exec, - NULL, 1000); + linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, + linux_proc_exit, NULL, 1000); + linux_schedtail_tag = EVENTHANDLER_REGISTER(schedtail, + linux_schedtail, NULL, 1000); + linux_exec_tag = EVENTHANDLER_REGISTER(process_exec, + linux_proc_exec, NULL, 1000); if (bootverbose) printf("Linux ELF exec handler installed\n"); } else From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 21:40:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB69310656FF; Sat, 31 Jan 2009 21:40:27 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA5DA8FC24; Sat, 31 Jan 2009 21:40:27 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VLeRId034763; Sat, 31 Jan 2009 21:40:27 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VLeRwl034762; Sat, 31 Jan 2009 21:40:27 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200901312140.n0VLeRwl034762@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 31 Jan 2009 21:40:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187966 - head/sys/i386/xen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 21:40:28 -0000 Author: bz Date: Sat Jan 31 21:40:27 2009 New Revision: 187966 URL: http://svn.freebsd.org/changeset/base/187966 Log: Bring over the code from sys/i386/i386/mp_machdep.c, r187880 to make XEN config compile again: - Allocate apic vectors on a per-cpu basis. Modified: head/sys/i386/xen/mp_machdep.c Modified: head/sys/i386/xen/mp_machdep.c ============================================================================== --- head/sys/i386/xen/mp_machdep.c Sat Jan 31 20:47:27 2009 (r187965) +++ head/sys/i386/xen/mp_machdep.c Sat Jan 31 21:40:27 2009 (r187966) @@ -137,6 +137,7 @@ struct cpu_info { int cpu_disabled:1; } static cpu_info[MAX_APIC_ID + 1]; int cpu_apic_ids[MAXCPU]; +int apic_cpuids[MAX_APIC_ID + 1]; /* Holds pending bitmap based IPIs per CPU */ static volatile u_int cpu_ipi_pending[MAXCPU]; @@ -284,6 +285,7 @@ cpu_mp_start(void) KASSERT(boot_cpu_id == PCPU_GET(apic_id), ("BSP's APIC ID doesn't match boot_cpu_id")); cpu_apic_ids[0] = boot_cpu_id; + apic_cpuids[boot_cpu_id] = 0; assign_cpu_ids(); @@ -707,6 +709,7 @@ assign_cpu_ids(void) if (mp_ncpus < MAXCPU) { cpu_apic_ids[mp_ncpus] = i; + apic_cpuids[i] = mp_ncpus; mp_ncpus++; } else cpu_info[i].cpu_disabled = 1; From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 23:17:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B103106572F; Sat, 31 Jan 2009 23:17:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FF648FC1C; Sat, 31 Jan 2009 23:17:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0VNHXoL036580; Sat, 31 Jan 2009 23:17:33 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0VNHX3J036579; Sat, 31 Jan 2009 23:17:33 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200901312317.n0VNHX3J036579@svn.freebsd.org> From: Warner Losh Date: Sat, 31 Jan 2009 23:17:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187968 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 23:17:34 -0000 Author: imp Date: Sat Jan 31 23:17:33 2009 New Revision: 187968 URL: http://svn.freebsd.org/changeset/base/187968 Log: David doesn't consider the prior -s behavior a bug. Back out this change. Modified: head/usr.bin/make/main.c Modified: head/usr.bin/make/main.c ============================================================================== --- head/usr.bin/make/main.c Sat Jan 31 22:39:03 2009 (r187967) +++ head/usr.bin/make/main.c Sat Jan 31 23:17:33 2009 (r187968) @@ -532,7 +532,6 @@ rearg: MFLAGS_append("-r", NULL); break; case 's': - beQuiet = TRUE; beSilent = TRUE; MFLAGS_append("-s", NULL); break;