Index: head/sys/conf/options =================================================================== --- head/sys/conf/options (revision 32750) +++ head/sys/conf/options (revision 32751) @@ -1,137 +1,138 @@ -# $Id: options,v 1.46 1998/01/24 02:54:04 eivind Exp $ +# $Id: options,v 1.47 1998/01/25 03:34:17 eivind Exp $ # Format: # Option name filename # Miscellaneous options. BOUNCE_BUFFERS opt_bounce.h +COMPAT_43 opt_compat.h +COMPAT_SUNOS opt_compat.h DDB DDB_UNATTENDED opt_ddb.h GDB_REMOTE_CHAT opt_ddb.h DEVFS DEVFS_ROOT opt_devfs.h -SUIDDIR opt_suiddir.h KTRACE MD5 MFS_AUTOLOAD opt_mfs.h MFS_ROOT opt_mfs.h +NSWAPDEV opt_swap.h QUOTA +SUIDDIR opt_suiddir.h SYSVMSG opt_sysvipc.h SYSVSEM opt_sysvipc.h SYSVSHM opt_sysvipc.h UCONSOLE -COMPAT_43 opt_compat.h -COMPAT_SUNOS opt_compat.h # Do we want the config file compiled into the kernel? INCLUDE_CONFIG_FILE opt_config.h # Options for static file systems. These should only be used at config # time, since the corresponding lkms cannot work if there are any static # dependencies. Unusability is enforced by hiding the defines for the # options in a never-included header. EXT2FS opt_dontuse.h FDESC opt_dontuse.h KERNFS opt_dontuse.h MFS opt_dontuse.h MSDOSFS opt_dontuse.h NULLFS opt_dontuse.h PORTAL opt_dontuse.h PROCFS opt_dontuse.h UMAPFS opt_dontuse.h # These static filesystems has one slightly bogus static dependency in # sys/i386/i386/autoconf.c. If any of these filesystems are # statically compiled into the kernel, code for mounting them as root # filesystems will be enabled - but look below. Boot-code is purposely # unavailable for the LKM-based versions. CD9660 FFS LFS NFS # The above static dependencies are planned removed, with a # _ROOT option to control if it usable as root. This list # allows these options to be present in config files already (though # they won't make any difference yet). CD9660_ROOT opt_cd9660.h FFS_ROOT opt_ffs.h LFS_ROOT opt_lfs.h NFS_ROOT opt_nfs.h # Multi-session CD-Rs might require a huge amount of time in order to # "settle". If we are about mounting them as the root f/s, we gotta # wait a little. CD9660_ROOTDELAY opt_cd9660.h # The union static file system has bogus static dependencies, so it isn't # hidden yet. UNION # Options used only in param.c. EXTRAVNODES opt_defunct.h MSGMNB opt_param.h MSGMNI opt_param.h MSGSEG opt_param.h MSGSSZ opt_param.h MSGTQL opt_param.h NBUF opt_param.h NMBCLUSTERS opt_param.h SEMMAP opt_param.h SEMMNI opt_param.h SEMMNS opt_param.h SEMMNU opt_param.h SEMMSL opt_param.h SEMOPM opt_param.h SEMUME opt_param.h SHMALL opt_param.h SHMMAX opt_param.h SHMMAXPGS opt_param.h SHMMIN opt_param.h SHMMNI opt_param.h SHMSEG opt_param.h # Generic SCSI options. SCSIDEBUG opt_scsi.h SCSI_DELAY opt_scsi.h SCSI_REPORT_GEOMETRY opt_scsi.h # Options used only in scsi/od.c. OD_AUTO_TURNOFF opt_od.h OD_BOGUS_NOT_READY opt_od.h # Options used only in pci/ncr.c SCSI_NCR_DEBUG opt_ncr.h SCSI_NCR_DFLT_TAGS opt_ncr.h SCSI_NCR_MAX_SYNC opt_ncr.h SCSI_NCR_MAX_WIDE opt_ncr.h SCSI_NCR_MYADDR opt_ncr.h # Resource limits. CHILD_MAX opt_defunct.h DFLDSIZ opt_rlimit.h MAXDSIZ opt_rlimit.h OPEN_MAX opt_defunct.h # Net stuff. ARP_PROXYALL opt_defunct.h BOOTP opt_bootp.h BOOTP_COMPAT opt_bootp.h BOOTP_NFSROOT opt_bootp.h BOOTP_NFSV3 opt_bootp.h GATEWAY opt_defunct.h MROUTING opt_mrouting.h INET opt_inet.h IPDIVERT IPFIREWALL opt_ipfw.h IPFIREWALL_VERBOSE opt_ipfw.h IPFIREWALL_VERBOSE_LIMIT opt_ipfw.h IPFIREWALL_DEFAULT_TO_ACCEPT opt_ipfw.h IPX opt_ipx.h IPXIP opt_ipx.h IPTUNNEL opt_ipx.h NETATALK opt_atalk.h PPP_BSDCOMP opt_ppp.h PPP_DEFLATE opt_ppp.h PPP_FILTER opt_ppp.h TCPDEBUG Index: head/sys/vm/vm_swap.c =================================================================== --- head/sys/vm/vm_swap.c (revision 32750) +++ head/sys/vm/vm_swap.c (revision 32751) @@ -1,329 +1,330 @@ /* * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)vm_swap.c 8.5 (Berkeley) 2/17/94 - * $Id: vm_swap.c,v 1.49 1997/11/07 09:21:01 phk Exp $ + * $Id: vm_swap.c,v 1.50 1998/01/24 02:54:56 eivind Exp $ */ #include "opt_devfs.h" +#include "opt_swap.h" #include #include #include #include #include #ifdef DEVFS #include #endif #include #include #include /* XXX */ #include #include #include #include #include #include #include #include /* * "sw" is a fake device implemented * in vm_swap.c and used only internally to get to swstrategy. * It cannot be provided to the users, because the * swstrategy routine munches the b_dev and b_blkno entries * before calling the appropriate driver. This would horribly * confuse, e.g. the hashing routines. Instead, /dev/drum is * provided as a character (raw) device. */ static void swstrategy __P((struct buf *)); #define CDEV_MAJOR 4 #define BDEV_MAJOR 1 extern struct cdevsw sw_cdevsw ; static struct bdevsw sw_bdevsw = { noopen, noclose, swstrategy, noioc, /*1*/ nodump, nopsize, 0, "sw", &sw_cdevsw, -1 }; static struct cdevsw sw_cdevsw = { nullopen, nullclose, rawread, rawwrite, /*4*/ noioc, nostop, noreset, nodevtotty,/* swap */ seltrue, nommap, swstrategy, "sw", &sw_bdevsw, -1 }; static dev_t swapdev = makedev(BDEV_MAJOR, 0); /* * Indirect driver for multi-controller paging. */ #ifndef NSWAPDEV #define NSWAPDEV 4 #endif static struct swdevt should_be_malloced[NSWAPDEV]; static struct swdevt *swdevt = should_be_malloced; struct vnode *swapdev_vp; /* XXX swapinfo(8) needs this one I belive */ int nswap; /* first block after the interleaved devs */ static int nswdev = NSWAPDEV; int vm_swap_size; static void swstrategy(bp) register struct buf *bp; { int sz, off, seg, index; register struct swdevt *sp; struct vnode *vp; sz = howmany(bp->b_bcount, DEV_BSIZE); if (nswdev > 1) { off = bp->b_blkno % dmmax; if (off + sz > dmmax) { bp->b_error = EINVAL; bp->b_flags |= B_ERROR; biodone(bp); return; } seg = bp->b_blkno / dmmax; index = seg % nswdev; seg /= nswdev; bp->b_blkno = seg * dmmax + off; } else index = 0; sp = &swdevt[index]; if (bp->b_blkno + sz > sp->sw_nblks) { bp->b_error = EINVAL; bp->b_flags |= B_ERROR; biodone(bp); return; } bp->b_dev = sp->sw_dev; if (sp->sw_vp == NULL) { bp->b_error = ENODEV; bp->b_flags |= B_ERROR; biodone(bp); return; } vhold(sp->sw_vp); if ((bp->b_flags & B_READ) == 0) { vp = bp->b_vp; if (vp) { vp->v_numoutput--; if ((vp->v_flag & VBWAIT) && vp->v_numoutput <= 0) { vp->v_flag &= ~VBWAIT; wakeup(&vp->v_numoutput); } } sp->sw_vp->v_numoutput++; } if (bp->b_vp != NULL) pbrelvp(bp); bp->b_vp = sp->sw_vp; VOP_STRATEGY(bp); } /* * System call swapon(name) enables swapping on device name, * which must be in the swdevsw. Return EBUSY * if already swapping on this device. */ #ifndef _SYS_SYSPROTO_H_ struct swapon_args { char *name; }; #endif /* ARGSUSED */ int swapon(p, uap) struct proc *p; struct swapon_args *uap; { register struct vnode *vp; dev_t dev; struct nameidata nd; int error; error = suser(p->p_ucred, &p->p_acflag); if (error) return (error); NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->name, p); error = namei(&nd); if (error) return (error); vp = nd.ni_vp; switch (vp->v_type) { case VBLK: dev = (dev_t) vp->v_rdev; if (major(dev) >= nblkdev) { error = ENXIO; break; } error = swaponvp(p, vp, dev, 0); break; case VCHR: /* * For now, we disallow swapping to regular files. * It requires logical->physcal block translation * support in the swap pager before it will work. */ error = ENOTBLK; break; #if 0 error = VOP_GETATTR(vp, &attr, p->p_ucred, p); if (!error) error = swaponvp(p, vp, NODEV, attr.va_size / DEV_BSIZE); break; #endif default: error = EINVAL; break; } if (error) vrele(vp); return (error); } /* * Swfree(index) frees the index'th portion of the swap map. * Each of the nswdev devices provides 1/nswdev'th of the swap * space, which is laid out with blocks of dmmax pages circularly * among the devices. */ int swaponvp(p, vp, dev, nblks) struct proc *p; struct vnode *vp; dev_t dev; u_long nblks; { int index; register struct swdevt *sp; register swblk_t vsbase; register long blk; swblk_t dvbase; int error; for (sp = swdevt, index = 0 ; index < nswdev; index++, sp++) { if (sp->sw_vp == vp) return EBUSY; if (!sp->sw_vp) goto found; } return EINVAL; found: if (dev != NODEV && (major(dev) >= nblkdev)) return (ENXIO); error = VOP_OPEN(vp, FREAD | FWRITE, p->p_ucred, p); if (error) return (error); if (nblks == 0 && (bdevsw[major(dev)]->d_psize == 0 || (nblks = (*bdevsw[major(dev)]->d_psize) (dev)) == -1)) { (void) VOP_CLOSE(vp, FREAD | FWRITE, p->p_ucred, p); return (ENXIO); } if (nblks == 0) { (void) VOP_CLOSE(vp, FREAD | FWRITE, p->p_ucred, p); return (ENXIO); } sp->sw_vp = vp; sp->sw_dev = dev; sp->sw_flags |= SW_FREED; sp->sw_nblks = nblks; if (nblks * nswdev > nswap) nswap = (nblks+1) * nswdev; for (dvbase = dmmax; dvbase < nblks; dvbase += dmmax) { blk = min(nblks - dvbase,dmmax); vsbase = index * dmmax + dvbase * nswdev; rlist_free(&swaplist, vsbase, vsbase + blk - 1); vm_swap_size += blk; } if (!swapdev_vp) { struct vnode *vp1; struct vnode *nvp; error = getnewvnode(VT_NON, (struct mount *) 0, spec_vnodeop_p, &nvp); if (error) panic("Cannot get vnode for swapdev"); vp1 = nvp; vp1->v_type = VBLK; if ((nvp = checkalias(vp1, swapdev, (struct mount *) 0))) { vput(vp1); vp1 = nvp; } swapdev_vp = vp1; } return (0); } static sw_devsw_installed = 0; #ifdef DEVFS static void *drum_devfs_token; #endif static void sw_drvinit(void *unused) { dev_t dev; if( ! sw_devsw_installed ) { dev = makedev(CDEV_MAJOR,0); cdevsw_add(&dev,&sw_cdevsw,NULL); dev = makedev(BDEV_MAJOR,0); bdevsw_add(&dev,&sw_bdevsw,NULL); sw_devsw_installed = 1; #ifdef DEVFS drum_devfs_token = devfs_add_devswf(&sw_cdevsw, 0, DV_CHR, UID_ROOT, GID_KMEM, 0640, "drum"); #endif } } SYSINIT(swdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,sw_drvinit,NULL)