From owner-p4-projects Mon Mar 17 14:46:33 2003 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 19D6237B404; Mon, 17 Mar 2003 14:46:08 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9DCB937B401 for ; Mon, 17 Mar 2003 14:46:07 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9677543F75 for ; Mon, 17 Mar 2003 14:46:06 -0800 (PST) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h2HMk60U011767 for ; Mon, 17 Mar 2003 14:46:06 -0800 (PST) (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h2HMk5TJ011764 for perforce@freebsd.org; Mon, 17 Mar 2003 14:46:05 -0800 (PST) Date: Mon, 17 Mar 2003 14:46:05 -0800 (PST) Message-Id: <200303172246.h2HMk5TJ011764@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 27034 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://perforce.freebsd.org/chv.cgi?CH=27034 Change 27034 by jhb@jhb_laptop on 2003/03/17 14:45:41 IFC @27026. Affected files ... .. //depot/projects/smpng/sys/alpha/alpha/busdma_machdep.c#11 integrate .. //depot/projects/smpng/sys/alpha/include/pmap.h#13 integrate .. //depot/projects/smpng/sys/cam/cam_periph.c#8 integrate .. //depot/projects/smpng/sys/cam/scsi/scsi_cd.c#15 integrate .. //depot/projects/smpng/sys/cam/scsi/scsi_da.c#34 integrate .. //depot/projects/smpng/sys/cam/scsi/scsi_pt.c#6 integrate .. //depot/projects/smpng/sys/cam/scsi/scsi_sa.c#12 integrate .. //depot/projects/smpng/sys/compat/linux/linux_getcwd.c#10 integrate .. //depot/projects/smpng/sys/contrib/dev/oltr/if_oltr.c#4 integrate .. //depot/projects/smpng/sys/dev/aac/aac.c#23 integrate .. //depot/projects/smpng/sys/dev/ata/ata-chipset.c#5 integrate .. //depot/projects/smpng/sys/dev/ata/atapi-cd.c#33 integrate .. //depot/projects/smpng/sys/dev/ata/atapi-tape.c#16 integrate .. //depot/projects/smpng/sys/dev/pdq/pdq_freebsd.h#4 integrate .. //depot/projects/smpng/sys/dev/pdq/pdq_ifsubr.c#8 integrate .. //depot/projects/smpng/sys/dev/puc/puc.c#11 integrate .. //depot/projects/smpng/sys/dev/puc/pucdata.c#10 integrate .. //depot/projects/smpng/sys/dev/puc/pucvar.h#8 integrate .. //depot/projects/smpng/sys/dev/sio/sio.c#26 integrate .. //depot/projects/smpng/sys/dev/twe/twe_compat.h#5 integrate .. //depot/projects/smpng/sys/dev/twe/twe_freebsd.c#13 integrate .. //depot/projects/smpng/sys/dev/usb/udbp.c#7 integrate .. //depot/projects/smpng/sys/dev/wi/if_wi.c#45 integrate .. //depot/projects/smpng/sys/fs/udf/udf_vnops.c#10 integrate .. //depot/projects/smpng/sys/geom/geom_disk.c#18 integrate .. //depot/projects/smpng/sys/geom/geom_event.c#12 integrate .. //depot/projects/smpng/sys/i386/i386/busdma_machdep.c#11 integrate .. //depot/projects/smpng/sys/i386/include/apic.h#7 integrate .. //depot/projects/smpng/sys/i386/include/pmap.h#12 integrate .. //depot/projects/smpng/sys/ia64/ia64/busdma_machdep.c#11 integrate .. //depot/projects/smpng/sys/ia64/include/pmap.h#11 integrate .. //depot/projects/smpng/sys/isa/fd.c#19 integrate .. //depot/projects/smpng/sys/kern/kern_acct.c#25 integrate .. //depot/projects/smpng/sys/kern/kern_thread.c#19 integrate .. //depot/projects/smpng/sys/kern/subr_devstat.c#6 integrate .. //depot/projects/smpng/sys/kern/uipc_cow.c#7 integrate .. //depot/projects/smpng/sys/kern/uipc_syscalls.c#31 integrate .. //depot/projects/smpng/sys/kern/vfs_cache.c#17 integrate .. //depot/projects/smpng/sys/kern/vfs_cluster.c#20 integrate .. //depot/projects/smpng/sys/modules/oltr/Makefile#4 integrate .. //depot/projects/smpng/sys/net/if_ethersubr.c#28 integrate .. //depot/projects/smpng/sys/net/if_fddisubr.c#13 integrate .. //depot/projects/smpng/sys/net/if_iso88025subr.c#12 integrate .. //depot/projects/smpng/sys/net/iso88025.h#4 integrate .. //depot/projects/smpng/sys/netinet/ip_fw.h#12 integrate .. //depot/projects/smpng/sys/netinet/ip_fw2.c#11 integrate .. //depot/projects/smpng/sys/nfsclient/nfs_vnops.c#24 integrate .. //depot/projects/smpng/sys/pc98/pc98/fd.c#21 integrate .. //depot/projects/smpng/sys/powerpc/include/pmap.h#9 integrate .. //depot/projects/smpng/sys/sparc64/include/pmap.h#20 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/bus_machdep.c#12 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/mem.c#5 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/pmap.c#34 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/vm_machdep.c#28 integrate .. //depot/projects/smpng/sys/sys/devicestat.h#5 integrate .. //depot/projects/smpng/sys/sys/param.h#35 integrate .. //depot/projects/smpng/sys/sys/stat.h#11 integrate .. //depot/projects/smpng/sys/vm/pmap.h#14 integrate .. //depot/projects/smpng/sys/vm/vm_page.c#30 integrate Differences ... ==== //depot/projects/smpng/sys/alpha/alpha/busdma_machdep.c#11 (text+ko) ==== @@ -23,13 +23,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/alpha/alpha/busdma_machdep.c,v 1.31 2003/03/13 17:17:30 mux Exp $ + * $FreeBSD: src/sys/alpha/alpha/busdma_machdep.c,v 1.32 2003/03/17 17:26:39 mux Exp $ */ #include #include #include #include +#include #include #include #include @@ -99,6 +100,7 @@ static STAILQ_HEAD(, bus_dmamap) bounce_map_callbacklist; static struct bus_dmamap nobounce_dmamap; +static void init_bounce_pages(void *dummy); static int alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages); static int reserve_bounce_pages(bus_dma_tag_t dmat, bus_dmamap_t map); static vm_offset_t add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, @@ -489,9 +491,7 @@ /* Reserve Necessary Bounce Pages */ if (map->pagesneeded != 0) { - int s; - - s = splhigh(); + mtx_lock(&bounce_lock); if (reserve_bounce_pages(dmat, map) != 0) { /* Queue us for resources */ @@ -502,11 +502,10 @@ map->callback_arg = callback_arg; STAILQ_INSERT_TAIL(&bounce_map_waitinglist, map, links); - splx(s); - + mtx_unlock(&bounce_lock); return (EINPROGRESS); } - splx(s); + mtx_unlock(&bounce_lock); } vaddr = (vm_offset_t)buf; @@ -826,19 +825,27 @@ } } +static void +init_bounce_pages(void *dummy __unused) +{ + + free_bpages = 0; + reserved_bpages = 0; + active_bpages = 0; + total_bpages = 0; + STAILQ_INIT(&bounce_page_list); + STAILQ_INIT(&bounce_map_waitinglist); + STAILQ_INIT(&bounce_map_callbacklist); + mtx_init(&bounce_lock, "bounce pages lock", NULL, MTX_DEF); +} +SYSINIT(bpages, SI_SUB_LOCK, SI_ORDER_ANY, init_bounce_pages, NULL); + static int alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages) { int count; count = 0; - if (total_bpages == 0) { - mtx_init(&bounce_lock, "BouncePage", NULL, MTX_DEF); - STAILQ_INIT(&bounce_page_list); - STAILQ_INIT(&bounce_map_waitinglist); - STAILQ_INIT(&bounce_map_callbacklist); - } - while (numpages > 0) { struct bounce_page *bpage; @@ -875,6 +882,7 @@ { int pages; + mtx_assert(&bounce_lock, MA_OWNED); pages = MIN(free_bpages, map->pagesneeded - map->pagesreserved); free_bpages -= pages; reserved_bpages += pages; ==== //depot/projects/smpng/sys/alpha/include/pmap.h#13 (text+ko) ==== @@ -43,7 +43,7 @@ * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 * from: i386 pmap.h,v 1.54 1997/11/20 19:30:35 bde Exp - * $FreeBSD: src/sys/alpha/include/pmap.h,v 1.20 2003/03/01 10:02:10 alc Exp $ + * $FreeBSD: src/sys/alpha/include/pmap.h,v 1.21 2003/03/16 04:16:02 jake Exp $ */ #ifndef _MACHINE_PMAP_H_ @@ -223,6 +223,8 @@ vm_offset_t pmap_steal_memory(vm_size_t); void pmap_bootstrap(vm_offset_t, u_int); +void pmap_kenter(vm_offset_t va, vm_offset_t pa); +void pmap_kremove(vm_offset_t); void pmap_setdevram(unsigned long long basea, vm_offset_t sizea); int pmap_uses_prom_console(void); void *pmap_mapdev(vm_offset_t, vm_size_t); ==== //depot/projects/smpng/sys/cam/cam_periph.c#8 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/cam/cam_periph.c,v 1.46 2003/02/19 05:46:56 imp Exp $ + * $FreeBSD: src/sys/cam/cam_periph.c,v 1.47 2003/03/15 21:59:05 phk Exp $ */ #include @@ -866,7 +866,7 @@ * this particular type of ccb, record the transaction start. */ if ((ds != NULL) && (ccb->ccb_h.func_code == XPT_SCSI_IO)) - devstat_start_transaction(ds); + devstat_start_transaction(ds, NULL); xpt_action(ccb); @@ -896,7 +896,7 @@ CAM_DIR_NONE) ? DEVSTAT_NO_DATA : (ccb->ccb_h.flags & CAM_DIR_OUT) ? DEVSTAT_WRITE : - DEVSTAT_READ); + DEVSTAT_READ, NULL, NULL); return(error); } ==== //depot/projects/smpng/sys/cam/scsi/scsi_cd.c#15 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/cam/scsi/scsi_cd.c,v 1.74 2003/03/08 21:40:13 phk Exp $ + * $FreeBSD: src/sys/cam/scsi/scsi_cd.c,v 1.76 2003/03/15 11:00:56 phk Exp $ */ /* * Portions of this driver taken from the original FreeBSD cd driver. @@ -151,6 +151,7 @@ dev_t dev; eventhandler_tag clonetag; int minimum_command_size; + int outstanding_cmds; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; STAILQ_HEAD(, cd_mode_params) mode_queue; @@ -1088,7 +1089,7 @@ * this device. If not, move it out of the active slot. */ if ((bioq_first(&changer->cur_device->bio_queue) == NULL) - && (changer->cur_device->device_stats->busy_count == 0)) { + && (changer->cur_device->outstanding_cmds == 0)) { changer->flags |= CHANGER_MANUAL_CALL; cdrunchangerqueue(changer); } @@ -1187,10 +1188,10 @@ */ if (changer->devq.qfrozen_cnt > 0) { - if (changer->cur_device->device_stats->busy_count > 0) { + if (changer->cur_device->outstanding_cmds > 0) { changer->cur_device->flags |= CD_FLAG_SCHED_ON_COMP; changer->cur_device->bufs_left = - changer->cur_device->device_stats->busy_count; + changer->cur_device->outstanding_cmds; if (called_from_timeout) { changer->long_handle = timeout(cdrunchangerqueue, changer, @@ -1297,7 +1298,7 @@ cdrunchangerqueue(softc->changer); } } else if ((bioq_first(&softc->bio_queue) == NULL) - && (softc->device_stats->busy_count == 0)) { + && (softc->outstanding_cmds == 0)) { softc->changer->flags |= CHANGER_MANUAL_CALL; cdrunchangerqueue(softc->changer); } @@ -1507,7 +1508,7 @@ } else { bioq_remove(&softc->bio_queue, bp); - devstat_start_transaction(softc->device_stats); + devstat_start_transaction_bio(softc->device_stats, bp); scsi_read_write(&start_ccb->csio, /*retries*/4, @@ -1533,6 +1534,7 @@ oldspl = splcam(); LIST_INSERT_HEAD(&softc->pending_ccbs, &start_ccb->ccb_h, periph_links.le); + softc->outstanding_cmds++; splx(oldspl); /* We expect a unit attention from this device */ @@ -1661,6 +1663,7 @@ */ oldspl = splcam(); LIST_REMOVE(&done_ccb->ccb_h, periph_links.le); + softc->outstanding_cmds--; splx(oldspl); if (softc->flags & CD_FLAG_CHANGER) ==== //depot/projects/smpng/sys/cam/scsi/scsi_da.c#34 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.133 2003/03/11 02:07:17 njl Exp $ + * $FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.134 2003/03/15 11:00:56 phk Exp $ */ #ifdef _KERNEL @@ -123,6 +123,7 @@ da_quirks quirks; int minimum_cmd_size; int ordered_tag_count; + int outstanding_cmds; struct disk_params params; struct disk disk; union ccb saved_ccb; @@ -1298,6 +1299,7 @@ oldspl = splcam(); LIST_INSERT_HEAD(&softc->pending_ccbs, &start_ccb->ccb_h, periph_links.le); + softc->outstanding_cmds++; splx(oldspl); /* We expect a unit attention from this device */ @@ -1499,11 +1501,11 @@ */ oldspl = splcam(); LIST_REMOVE(&done_ccb->ccb_h, periph_links.le); + softc->outstanding_cmds--; + if (softc->outstanding_cmds == 0) + softc->flags |= DA_FLAG_WENT_IDLE; splx(oldspl); - if (softc->disk.d_devstat->busy_count == 0) - softc->flags |= DA_FLAG_WENT_IDLE; - biodone(bp); break; } @@ -1781,7 +1783,7 @@ && ((softc->flags & DA_FLAG_WENT_IDLE) == 0)) { softc->flags |= DA_FLAG_NEED_OTAG; } - if (softc->disk.d_devstat->busy_count > 0) + if (softc->outstanding_cmds > 0) softc->flags &= ~DA_FLAG_WENT_IDLE; softc->ordered_tag_count = 0; ==== //depot/projects/smpng/sys/cam/scsi/scsi_pt.c#6 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/cam/scsi/scsi_pt.c,v 1.35 2003/03/08 21:44:31 phk Exp $ + * $FreeBSD: src/sys/cam/scsi/scsi_pt.c,v 1.36 2003/03/15 10:50:42 phk Exp $ */ #include @@ -502,7 +502,7 @@ bioq_remove(&softc->bio_queue, bp); - devstat_start_transaction(softc->device_stats); + devstat_start_transaction_bio(softc->device_stats, bp); scsi_send_receive(&start_ccb->csio, /*retries*/4, ==== //depot/projects/smpng/sys/cam/scsi/scsi_sa.c#12 (text+ko) ==== @@ -1,5 +1,5 @@ /* - * $FreeBSD: src/sys/cam/scsi/scsi_sa.c,v 1.90 2003/03/08 21:44:46 phk Exp $ + * $FreeBSD: src/sys/cam/scsi/scsi_sa.c,v 1.91 2003/03/15 10:50:42 phk Exp $ * * Implementation of SCSI Sequential Access Peripheral driver for CAM. * @@ -1620,7 +1620,7 @@ CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_INFO, ("Variable Record Count is %d\n", length)); } - devstat_start_transaction(softc->device_stats); + devstat_start_transaction_bio(softc->device_stats, bp); /* * Some people have theorized that we should * suppress illegal length indication if we are ==== //depot/projects/smpng/sys/compat/linux/linux_getcwd.c#10 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/compat/linux/linux_getcwd.c,v 1.10 2003/02/19 05:46:58 imp Exp $ */ +/* $FreeBSD: src/sys/compat/linux/linux_getcwd.c,v 1.11 2003/03/17 12:21:08 phk Exp $ */ /* $OpenBSD: linux_getcwd.c,v 1.2 2001/05/16 12:50:21 ho Exp $ */ /* $NetBSD: vfs_getcwd.c,v 1.3.2.3 1999/07/11 10:24:09 sommerfeld Exp $ */ @@ -37,432 +37,25 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#include "opt_compat.h" -#include "opt_mac.h" #include #include -#include -#include -#include -#include -#include #include -#include -#include #include -#include -#include -#include -#include -#include /* XXX only for DIRBLKSIZ */ #include #include -#include - -static int -linux_getcwd_scandir(struct vnode **, struct vnode **, - char **, char *, struct thread *); -static int -linux_getcwd_common(struct vnode *, struct vnode *, - char **, char *, int, int, struct thread *); - -#define DIRENT_MINSIZE (sizeof(struct dirent) - (MAXNAMLEN+1) + 4) /* - * Vnode variable naming conventions in this file: - * - * rvp: the current root we're aiming towards. - * lvp, *lvpp: the "lower" vnode - * uvp, *uvpp: the "upper" vnode. - * - * Since all the vnodes we're dealing with are directories, and the - * lookups are going *up* in the filesystem rather than *down*, the - * usual "pvp" (parent) or "dvp" (directory) naming conventions are - * too confusing. - */ - -/* - * XXX Will infinite loop in certain cases if a directory read reliably - * returns EINVAL on last block. - * XXX is EINVAL the right thing to return if a directory is malformed? - */ - -/* - * XXX Untested vs. mount -o union; probably does the wrong thing. - */ - -/* - * Find parent vnode of *lvpp, return in *uvpp - * - * If we care about the name, scan it looking for name of directory - * entry pointing at lvp. - * - * Place the name in the buffer which starts at bufp, immediately - * before *bpp, and move bpp backwards to point at the start of it. - * - * On entry, *lvpp is a locked vnode reference; on exit, it is vput and NULL'ed - * On exit, *uvpp is either NULL or is a locked vnode reference. - */ -static int -linux_getcwd_scandir(lvpp, uvpp, bpp, bufp, td) - struct vnode **lvpp; - struct vnode **uvpp; - char **bpp; - char *bufp; - struct thread *td; -{ - int error = 0; - int eofflag; - off_t off; - int tries; - struct uio uio; - struct iovec iov; - char *dirbuf = NULL; - int dirbuflen; - ino_t fileno; - struct vattr va; - struct vnode *uvp = NULL; - struct vnode *lvp = *lvpp; - struct componentname cn; - int len, reclen; - tries = 0; - - /* - * If we want the filename, get some info we need while the - * current directory is still locked. - */ - if (bufp != NULL) { - error = VOP_GETATTR(lvp, &va, td->td_ucred, td); - if (error) { - vput(lvp); - *lvpp = NULL; - *uvpp = NULL; - return error; - } - } - - /* - * Ok, we have to do it the hard way.. - * Next, get parent vnode using lookup of .. - */ - cn.cn_nameiop = LOOKUP; - cn.cn_flags = ISLASTCN | ISDOTDOT | RDONLY; - cn.cn_thread = td; - cn.cn_cred = td->td_ucred; - cn.cn_pnbuf = NULL; - cn.cn_nameptr = ".."; - cn.cn_namelen = 2; - cn.cn_consume = 0; - - /* - * At this point, lvp is locked and will be unlocked by the lookup. - * On successful return, *uvpp will be locked - */ - error = VOP_LOOKUP(lvp, uvpp, &cn); - if (error) { - vput(lvp); - *lvpp = NULL; - *uvpp = NULL; - return error; - } - uvp = *uvpp; - - /* If we don't care about the pathname, we're done */ - if (bufp == NULL) { - vrele(lvp); - *lvpp = NULL; - return 0; - } - - fileno = va.va_fileid; - - dirbuflen = DIRBLKSIZ; - if (dirbuflen < va.va_blocksize) - dirbuflen = va.va_blocksize; - dirbuf = (char *)malloc(dirbuflen, M_TEMP, M_WAITOK); - -#if 0 -unionread: -#endif - off = 0; - do { - /* call VOP_READDIR of parent */ - iov.iov_base = dirbuf; - iov.iov_len = dirbuflen; - - uio.uio_iov = &iov; - uio.uio_iovcnt = 1; - uio.uio_offset = off; - uio.uio_resid = dirbuflen; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_rw = UIO_READ; - uio.uio_td = td; - - eofflag = 0; - -#ifdef MAC - error = mac_check_vnode_readdir(td->td_ucred, uvp); - if (error == 0) -#endif /* MAC */ - error = VOP_READDIR(uvp, &uio, td->td_ucred, &eofflag, - 0, 0); - - off = uio.uio_offset; - - /* - * Try again if NFS tosses its cookies. - * XXX this can still loop forever if the directory is busted - * such that the second or subsequent page of it always - * returns EINVAL - */ - if ((error == EINVAL) && (tries < 3)) { - off = 0; - tries++; - continue; /* once more, with feeling */ - } - - if (!error) { - char *cpos; - struct dirent *dp; - - cpos = dirbuf; - tries = 0; - - /* scan directory page looking for matching vnode */ - for (len = (dirbuflen - uio.uio_resid); len > 0; len -= reclen) { - dp = (struct dirent *) cpos; - reclen = dp->d_reclen; - - /* check for malformed directory.. */ - if (reclen < DIRENT_MINSIZE) { - error = EINVAL; - goto out; - } - /* - * XXX should perhaps do VOP_LOOKUP to - * check that we got back to the right place, - * but getting the locking games for that - * right would be heinous. - */ - if ((dp->d_type != DT_WHT) && - (dp->d_fileno == fileno)) { - char *bp = *bpp; - bp -= dp->d_namlen; - - if (bp <= bufp) { - error = ERANGE; - goto out; - } - bcopy(dp->d_name, bp, dp->d_namlen); - error = 0; - *bpp = bp; - goto out; - } - cpos += reclen; - } - } - } while (!eofflag); - error = ENOENT; - -out: - vrele(lvp); - *lvpp = NULL; - free(dirbuf, M_TEMP); - return error; -} - - -/* - * common routine shared by sys___getcwd() and linux_vn_isunder() - */ - -#define GETCWD_CHECK_ACCESS 0x0001 - -static int -linux_getcwd_common (lvp, rvp, bpp, bufp, limit, flags, td) - struct vnode *lvp; - struct vnode *rvp; - char **bpp; - char *bufp; - int limit; - int flags; - struct thread *td; -{ - struct filedesc *fdp = td->td_proc->p_fd; - struct vnode *uvp = NULL; - char *bp = NULL; - int error; - int perms = VEXEC; - - if (rvp == NULL) { - rvp = fdp->fd_rdir; - if (rvp == NULL) - rvp = rootvnode; - } - - VREF(rvp); - VREF(lvp); - - /* - * Error handling invariant: - * Before a `goto out': - * lvp is either NULL, or locked and held. - * uvp is either NULL, or locked and held. - */ - - error = vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY, td); - if (error) { - vrele(lvp); - lvp = NULL; - goto out; - } - if (bufp) - bp = *bpp; - /* - * this loop will terminate when one of the following happens: - * - we hit the root - * - getdirentries or lookup fails - * - we run out of space in the buffer. - */ - if (lvp == rvp) { - if (bp) - *(--bp) = '/'; - goto out; - } - do { - if (lvp->v_type != VDIR) { - error = ENOTDIR; - goto out; - } - - /* - * access check here is optional, depending on - * whether or not caller cares. - */ - if (flags & GETCWD_CHECK_ACCESS) { - error = VOP_ACCESS(lvp, perms, td->td_ucred, td); - if (error) - goto out; - perms = VEXEC|VREAD; - } - - /* - * step up if we're a covered vnode.. - */ - while (lvp->v_vflag & VV_ROOT) { - struct vnode *tvp; - - if (lvp == rvp) - goto out; - - tvp = lvp; - lvp = lvp->v_mount->mnt_vnodecovered; - vput(tvp); - /* - * hodie natus est radici frater - */ - if (lvp == NULL) { - error = ENOENT; - goto out; - } - VREF(lvp); - error = vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY, td); - if (error != 0) { - vrele(lvp); - lvp = NULL; - goto out; - } - } - error = linux_getcwd_scandir(&lvp, &uvp, &bp, bufp, td); - if (error) - goto out; -#if DIAGNOSTIC - if (lvp != NULL) - panic("getcwd: oops, forgot to null lvp"); - if (bufp && (bp <= bufp)) { - panic("getcwd: oops, went back too far"); - } -#endif - if (bp) - *(--bp) = '/'; - lvp = uvp; - uvp = NULL; - limit--; - } while ((lvp != rvp) && (limit > 0)); - -out: - if (bpp) - *bpp = bp; - if (uvp) - vput(uvp); - if (lvp) - vput(lvp); - vrele(rvp); - return error; -} - - -/* * Find pathname of process's current directory. * * Use vfs vnode-to-name reverse cache; if that fails, fall back - * to reading directory contents. + * to reading directory contents. Use the common routines in vfs_cache.c. */ int linux_getcwd(struct thread *td, struct linux_getcwd_args *args) { - caddr_t bp, bend, path; - int error, len, lenused; - -#ifdef DEBUG - printf("Linux-emul(%ld): getcwd(%p, %ld)\n", (long)td->td_proc->p_pid, - args->buf, (long)args->bufsize); -#endif - - len = args->bufsize; - - if (len > MAXPATHLEN*4) - len = MAXPATHLEN*4; - else if (len < 2) - return ERANGE; - - path = (char *)malloc(len, M_TEMP, M_WAITOK); - - error = kern___getcwd(td, path, UIO_SYSSPACE, len); - if (!error) { - lenused = strlen(path) + 1; - if (lenused <= args->bufsize) { - td->td_retval[0] = lenused; - error = copyout(path, args->buf, lenused); - } - else - error = ERANGE; - } else { - bp = &path[len]; - bend = bp; - *(--bp) = '\0'; - - /* - * 5th argument here is "max number of vnodes to traverse". - * Since each entry takes up at least 2 bytes in the output buffer, - * limit it to N/2 vnodes for an N byte buffer. - */ - - error = linux_getcwd_common (td->td_proc->p_fd->fd_cdir, NULL, - &bp, path, len/2, GETCWD_CHECK_ACCESS, td); - - if (error) - goto out; - lenused = bend - bp; - td->td_retval[0] = lenused; - /* put the result into user buffer */ - error = copyout(bp, args->buf, lenused); - } -out: - free(path, M_TEMP); - return (error); + return (kern___getcwd (td, args->buf, UIO_USERSPACE, args->bufsize)); } ==== //depot/projects/smpng/sys/contrib/dev/oltr/if_oltr.c#4 (text+ko) ==== @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/contrib/dev/oltr/if_oltr.c,v 1.24 2003/02/19 05:46:59 imp Exp $ + * $FreeBSD: src/sys/contrib/dev/oltr/if_oltr.c,v 1.28 2003/03/16 00:24:18 mdodd Exp $ */ #include @@ -257,6 +257,8 @@ static devclass_t oltr_devclass; DRIVER_MODULE(oltr, pci, oltr_driver, oltr_devclass, 0, 0); +MODULE_DEPEND(oltr, pci, 1, 1, 1); +MODULE_DEPEND(oltr, iso88025, 1, 1, 1); static int oltr_pci_probe(device_t dev) @@ -389,11 +391,11 @@ ifp->if_softc = sc; ifp->if_unit = device_get_unit(dev); ifp->if_name = "oltr"; - ifp->if_output = iso88025_output; ifp->if_init = oltr_init; ifp->if_start = oltr_start; ifp->if_ioctl = oltr_ioctl; ifp->if_flags = IFF_BROADCAST; + ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; bcopy(sc->config.macaddress, sc->arpcom.ac_enaddr, sizeof(sc->config.macaddress)); /* @@ -423,14 +425,8 @@ /* * Attach the interface */ - if_attach(ifp); - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; - iso88025_ifattach(ifp); + iso88025_ifattach(ifp, ISO88025_BPF_SUPPORTED); -#if (NBPFILTER > 0) || (__FreeBSD_version > 400000) - bpfattach(ifp, DLT_IEEE802, sizeof(struct iso88025_header)); -#endif - splx(s); return(0); @@ -451,7 +447,7 @@ s = splimp(); - if_detach(ifp); + iso88025_ifdetach(ifp, ISO88025_BPF_SUPPORTED); if (sc->state > OL_CLOSED) oltr_stop(sc); @@ -670,10 +666,6 @@ ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; iso88025_ifattach(ifp); -#if (NBPFILTER > 0) || (__FreeBSD_version > 400000) - bpfattach(ifp, DLT_IEEE802, sizeof(struct iso88025_header)); -#endif - splx(s); return; @@ -1397,8 +1389,7 @@ struct oltr_softc *sc = (struct oltr_softc *)DriverHandle; struct ifnet *ifp = (struct ifnet *)&sc->arpcom.ac_if; struct mbuf *m0, *m1, *m; - struct iso88025_header *th; - int frame_len = ByteCount, hdr_len, i = (int)FragmentHandle, rc, s; + int frame_len = ByteCount, i = (int)FragmentHandle, rc, s; int mbuf_offset, mbuf_size, frag_offset, copy_length; char *fragment = sc->rx_ring[RING_BUFFER(i)].data; @@ -1423,8 +1414,6 @@ m0->m_pkthdr.len = ByteCount; m0->m_len = 0; m0->m_data += 2; - th = mtod(m0, struct iso88025_header *); - m0->m_pkthdr.header = (void *)th; m = m0; mbuf_offset = 0; @@ -1469,32 +1458,9 @@ m->m_len = 0; } } -#if (NBPFILTER > 0) || (__FreeBSD_version > 400000) - BPF_MTAP(ifp, m0); -#endif - - /*if (ifp->if_flags & IFF_PROMISC) {*/ - if (bcmp(th->iso88025_dhost, etherbroadcastaddr - , sizeof(th->iso88025_dhost))) { - if ((bcmp(th->iso88025_dhost + 1, sc->arpcom.ac_enaddr + 1, ISO88025_ADDR_LEN - 1)) || - ((th->iso88025_dhost[0] & 0x7f) != sc->arpcom.ac_enaddr[0])) { - m_freem(m0); - goto dropped; - } - } - /*}*/ ifp->if_ipackets++; - hdr_len = ISO88025_HDR_LEN; - if (th->iso88025_shost[0] & 0x80) - hdr_len += (ntohs(th->rcf) & 0x1f00) >> 8; - - m0->m_pkthdr.len -= hdr_len; - m0->m_len -= hdr_len; - m0->m_data += hdr_len; - - iso88025_input(ifp, th, m0); - + iso88025_input(ifp, m0); } else { /* Receiver error */ if (ReceiveStatus != TRLLD_RCV_NO_DATA) { printf("oltr%d: receive error %d\n", sc->unit, ==== //depot/projects/smpng/sys/dev/aac/aac.c#23 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/aac/aac.c,v 1.63 2003/03/08 08:01:27 phk Exp $ + * $FreeBSD: src/sys/dev/aac/aac.c,v 1.64 2003/03/13 22:56:11 scottl Exp $ */ /* @@ -751,12 +751,10 @@ /* See if any FIBs need to be allocated */ if ((sc->aifflags & AAC_AIFFLAGS_ALLOCFIBS) != 0) { - mtx_lock(&Giant); AAC_LOCK_ACQUIRE(&sc->aac_io_lock); aac_alloc_commands(sc); sc->aifflags &= ~AAC_AIFFLAGS_ALLOCFIBS; AAC_LOCK_RELEASE(&sc->aac_io_lock); - mtx_unlock(&Giant); } /* While we're here, check to see if any commands are stuck */ ==== //depot/projects/smpng/sys/dev/ata/ata-chipset.c#5 (text+ko) ==== @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.14 2003/03/12 15:45:52 sos Exp $ + * $FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.15 2003/03/16 16:26:51 sos Exp $ */ #include "opt_ata.h" #include @@ -95,8 +95,8 @@ static void ata_sis_setmode(struct ata_device *, int); static int ata_mode2idx(int); static int ata_check_80pin(struct ata_device *, int); -static int ata_find_dev(device_t, u_int32_t, u_int32_t); -static struct ata_chip_id *ata_match_chip(device_t, struct ata_chip_id *); +static int ata_find_dev(device_t, u_int32_t, u_int32_t, int); +static struct ata_chip_id *ata_match_chip(device_t, struct ata_chip_id *, int); static int ata_default_interrupt(device_t); static void ata_pci_serialize(struct ata_channel *, int); @@ -171,7 +171,7 @@ { 0, 0, 0, 0, 0, 0}}; char buffer[64]; >>> TRUNCATED FOR MAIL (1000 lines) <<< To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message