From c2f46557264110fb353a0f512292db9330c09dc4 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Mon, 11 Mar 1996 19:17:01 +0000 Subject: [PATCH] Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all files are off the vendor branch, so this should not change anything. A "U" marker generally means that the file was not changed in between the 4.4Lite and Lite-2 releases, and does not need a merge. "C" generally means that there was a change. --- sys/conf/files | 274 +++++++++++++++++++++ sys/conf/files.newconf | 274 +++++++++++++++++++++ sys/conf/param.c | 120 +++++++++ sys/dev/vn/vn.c | 548 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1216 insertions(+) create mode 100644 sys/conf/files create mode 100644 sys/conf/files.newconf create mode 100644 sys/conf/param.c create mode 100644 sys/dev/vn/vn.c diff --git a/sys/conf/files b/sys/conf/files new file mode 100644 index 000000000000..09f2a4781545 --- /dev/null +++ b/sys/conf/files @@ -0,0 +1,274 @@ +isofs/cd9660/cd9660_bmap.c optional cd9660 +isofs/cd9660/cd9660_lookup.c optional cd9660 +isofs/cd9660/cd9660_node.c optional cd9660 +isofs/cd9660/cd9660_rrip.c optional cd9660 +isofs/cd9660/cd9660_util.c optional cd9660 +isofs/cd9660/cd9660_vfsops.c optional cd9660 +isofs/cd9660/cd9660_vnops.c optional cd9660 +kdb/kdb_access.c optional kadb +kdb/kdb_command.c optional kadb +kdb/kdb_ctype.c optional kadb +kdb/kdb_expr.c optional kadb +kdb/kdb_format.c optional kadb +kdb/kdb_input.c optional kadb +kdb/kdb_message.c optional kadb +kdb/kdb_output.c optional kadb +kdb/kdb_pcs.c optional kadb +kdb/kdb_print.c optional kadb +kdb/kdb_runpcs.c optional kadb +kdb/kdb_sym.c optional kadb +kdb/kdb_trap.c optional kadb +kern/init_main.c standard +kern/init_sysent.c standard +kern/kern_acct.c standard +kern/kern_clock.c standard +kern/kern_descrip.c standard +kern/kern_exec.c standard +kern/kern_exit.c standard +kern/kern_fork.c standard +kern/kern_ktrace.c standard +kern/kern_malloc.c standard +kern/kern_physio.c standard +kern/kern_proc.c standard +kern/kern_prot.c standard +kern/kern_resource.c standard +kern/kern_sig.c standard +kern/kern_subr.c standard +kern/kern_synch.c standard +kern/kern_sysctl.c standard +kern/kern_time.c standard +kern/kern_xxx.c standard +kern/kern_lock.c standard +kern/subr_log.c standard +kern/subr_prf.c standard +kern/subr_prof.c standard +kern/subr_rmap.c standard +kern/subr_xxx.c standard +kern/sys_generic.c standard +kern/sys_process.c standard +kern/sys_socket.c standard +kern/sysv_shm.c optional sysvshm +kern/tty.c standard +kern/tty_compat.c standard +kern/tty_conf.c standard +kern/tty_pty.c optional pty +kern/tty_subr.c standard +kern/tty_tb.c optional tb +kern/tty_tty.c standard +kern/uipc_domain.c standard +kern/uipc_mbuf.c standard +kern/uipc_proto.c standard +kern/uipc_socket.c standard +kern/uipc_socket2.c standard +kern/uipc_syscalls.c standard +kern/uipc_usrreq.c standard +kern/vfs_bio.c standard +kern/vfs_cache.c standard +kern/vfs_cluster.c standard +kern/vfs_conf.c standard +kern/vfs_init.c standard +kern/vfs_lookup.c standard +kern/vfs_subr.c standard +kern/vfs_syscalls.c standard +kern/vfs_vnops.c standard +miscfs/deadfs/dead_vnops.c standard +miscfs/fdesc/fdesc_vfsops.c optional fdesc +miscfs/fdesc/fdesc_vnops.c optional fdesc +miscfs/fifofs/fifo_vnops.c optional fifo +miscfs/kernfs/kernfs_vfsops.c optional kernfs +miscfs/kernfs/kernfs_vnops.c optional kernfs +miscfs/nullfs/null_subr.c optional nullfs +miscfs/nullfs/null_vfsops.c optional nullfs +miscfs/nullfs/null_vnops.c optional nullfs +miscfs/portal/portal_vfsops.c optional portal +miscfs/portal/portal_vnops.c optional portal +miscfs/procfs/procfs_subr.c optional procfs +miscfs/procfs/procfs_vnops.c optional procfs +miscfs/procfs/procfs_vfsops.c optional procfs +miscfs/procfs/procfs_note.c optional procfs +miscfs/procfs/procfs_mem.c optional procfs +miscfs/procfs/procfs_ctl.c optional procfs +miscfs/procfs/procfs_status.c optional procfs +miscfs/procfs/procfs_regs.c optional procfs +miscfs/procfs/procfs_fpregs.c optional procfs +miscfs/specfs/spec_vnops.c standard +miscfs/umapfs/umap_subr.c optional umapfs +miscfs/umapfs/umap_vfsops.c optional umapfs +miscfs/umapfs/umap_vnops.c optional umapfs +miscfs/union/union_subr.c optional union +miscfs/union/union_vfsops.c optional union +miscfs/union/union_vnops.c optional union +net/bpf.c optional bpfilter +net/bpf_filter.c optional bpfilter +net/if.c standard +net/if_ethersubr.c optional ether +net/if_loop.c optional loop +net/if_sl.c optional sl +net/radix.c standard +net/raw_cb.c standard +net/raw_usrreq.c standard +net/route.c standard +net/rtsock.c standard +net/slcompress.c optional sl +netccitt/ccitt_proto.c optional ccitt +netccitt/llc_input.c optional llc +netccitt/llc_output.c optional llc +netccitt/llc_subr.c optional llc +netccitt/llc_timer.c optional llc +netccitt/pk_llcsubr.c optional llc +netccitt/pk_llcsubr.c optional hdlc +netccitt/hd_debug.c optional hdlc +netccitt/hd_input.c optional hdlc +netccitt/hd_output.c optional hdlc +netccitt/hd_subr.c optional hdlc +netccitt/hd_timer.c optional hdlc +netccitt/if_x25subr.c optional ccitt +netccitt/pk_acct.c optional ccitt +netccitt/pk_debug.c optional ccitt +netccitt/pk_input.c optional ccitt +netccitt/pk_output.c optional ccitt +netccitt/pk_subr.c optional ccitt +netccitt/pk_timer.c optional ccitt +netccitt/pk_usrreq.c optional ccitt +netimp/if_imp.c optional imp +netimp/if_imphost.c optional imp +netimp/raw_imp.c optional imp +netinet/if_ether.c optional ether +netinet/igmp.c optional inet +netinet/in.c optional inet +netinet/in_pcb.c optional inet +netinet/in_proto.c optional inet +netinet/ip_icmp.c optional inet +netinet/ip_input.c optional inet +netinet/ip_mroute.c optional inet mrouting +netinet/ip_output.c optional inet +netinet/raw_ip.c optional inet +netinet/tcp_debug.c optional inet +netinet/tcp_input.c optional inet +netinet/tcp_output.c optional inet +netinet/tcp_subr.c optional inet +netinet/tcp_timer.c optional inet +netinet/tcp_usrreq.c optional inet +netinet/udp_usrreq.c optional inet +netiso/clnp_debug.c optional iso +netiso/clnp_er.c optional iso +netiso/clnp_frag.c optional iso +netiso/clnp_input.c optional iso +netiso/clnp_options.c optional iso +netiso/clnp_output.c optional iso +netiso/clnp_raw.c optional iso +netiso/clnp_subr.c optional iso +netiso/clnp_timer.c optional iso +netiso/cltp_usrreq.c optional iso +netiso/esis.c optional iso +netiso/idrp_usrreq.c optional iso +netiso/if_eon.c optional eon +netiso/iso.c optional iso +netiso/iso_chksum.c optional iso +netiso/iso_pcb.c optional iso +netiso/iso_proto.c optional iso +netiso/iso_snpac.c optional iso +netiso/tp_astring.c optional iso +netiso/tp_astring.c optional tpip +netiso/tp_cons.c optional iso +netiso/tp_driver.c optional iso +netiso/tp_driver.c optional tpip +netiso/tp_emit.c optional iso +netiso/tp_emit.c optional tpip +netiso/tp_inet.c optional iso +netiso/tp_inet.c optional tpip +netiso/tp_input.c optional iso +netiso/tp_input.c optional tpip +netiso/tp_iso.c optional iso +netiso/tp_meas.c optional iso +netiso/tp_meas.c optional tpip +netiso/tp_output.c optional iso +netiso/tp_output.c optional tpip +netiso/tp_pcb.c optional iso +netiso/tp_pcb.c optional tpip +netiso/tp_subr.c optional iso +netiso/tp_subr.c optional tpip +netiso/tp_subr2.c optional iso +netiso/tp_subr2.c optional tpip +netiso/tp_timer.c optional iso +netiso/tp_timer.c optional tpip +netiso/tp_trace.c optional iso +netiso/tp_trace.c optional tpip +netiso/tp_usrreq.c optional iso +netiso/tp_usrreq.c optional tpip +netiso/tuba_subr.c optional iso tuba +netiso/tuba_table.c optional iso tuba +netiso/tuba_usrreq.c optional iso tuba +netns/idp_usrreq.c optional ns +netns/ns.c optional ns +netns/ns_error.c optional ns +netns/ns_input.c optional ns +netns/ns_ip.c optional ns +netns/ns_output.c optional ns +netns/ns_pcb.c optional ns +netns/ns_proto.c optional ns +netns/spp_debug.c optional ns +netns/spp_usrreq.c optional ns +nfs/nfs_bio.c optional nfs +nfs/nfs_node.c optional nfs +nfs/nfs_nqlease.c optional nfs +nfs/nfs_serv.c optional nfs +nfs/nfs_socket.c optional nfs +nfs/nfs_srvcache.c optional nfs +nfs/nfs_subs.c optional nfs +nfs/nfs_syscalls.c optional nfs +nfs/nfs_vfsops.c optional nfs +nfs/nfs_vnops.c optional nfs +ufs/ffs/ffs_alloc.c optional ffs +ufs/ffs/ffs_alloc.c optional mfs +ufs/ffs/ffs_balloc.c optional ffs +ufs/ffs/ffs_balloc.c optional mfs +ufs/ffs/ffs_inode.c optional ffs +ufs/ffs/ffs_inode.c optional mfs +ufs/ffs/ffs_subr.c optional ffs +ufs/ffs/ffs_subr.c optional mfs +ufs/ffs/ffs_tables.c optional ffs +ufs/ffs/ffs_tables.c optional mfs +ufs/ffs/ffs_vfsops.c optional ffs +ufs/ffs/ffs_vfsops.c optional mfs +ufs/ffs/ffs_vnops.c optional ffs +ufs/ffs/ffs_vnops.c optional mfs +ufs/lfs/lfs_alloc.c optional lfs +ufs/lfs/lfs_bio.c optional lfs +ufs/lfs/lfs_balloc.c optional lfs +ufs/lfs/lfs_cksum.c optional lfs +ufs/lfs/lfs_debug.c optional lfs +ufs/lfs/lfs_inode.c optional lfs +ufs/lfs/lfs_segment.c optional lfs +ufs/lfs/lfs_subr.c optional lfs +ufs/lfs/lfs_syscalls.c optional lfs +ufs/lfs/lfs_vfsops.c optional lfs +ufs/lfs/lfs_vnops.c optional lfs +ufs/mfs/mfs_vfsops.c optional mfs +ufs/mfs/mfs_vnops.c optional mfs +ufs/ufs/ufs_bmap.c standard +ufs/ufs/ufs_disksubr.c standard +ufs/ufs/ufs_ihash.c standard +ufs/ufs/ufs_inode.c standard +ufs/ufs/ufs_lockf.c standard +ufs/ufs/ufs_lookup.c standard +ufs/ufs/ufs_quota.c standard +ufs/ufs/ufs_vfsops.c standard +ufs/ufs/ufs_vnops.c standard +vm/device_pager.c optional devpager +vm/swap_pager.c optional swappager +vm/vm_fault.c standard +vm/vm_glue.c standard +vm/vm_init.c standard +vm/vm_kern.c standard +vm/vm_map.c standard +vm/vm_meter.c standard +vm/vm_mmap.c standard +vm/vm_object.c standard +vm/vm_page.c standard +vm/vm_pageout.c standard +vm/vm_pager.c standard +vm/vm_swap.c standard +vm/vm_unix.c standard +vm/vm_user.c standard +vm/vnode_pager.c optional vnodepager diff --git a/sys/conf/files.newconf b/sys/conf/files.newconf new file mode 100644 index 000000000000..e3c98a52f1b6 --- /dev/null +++ b/sys/conf/files.newconf @@ -0,0 +1,274 @@ +# @(#)files.newconf 8.10 (Berkeley) 5/1/94 + +# generic attributes +define disk +define tape +define ifnet +define tty + +# net device attributes - we have generic code for ether. +# we should have imp but right now it is a pseudo-device. +define ether +# define imp +pseudo-device imp + +# scsi driver and associated stuff +define scsi { target = -1 } +device tg at scsi { drive = -1 } +file dev/scsi/scsi_subr.c scsi + +device sd at tg: disk +file dev/scsi/sd.c sd needs-flag + +# device st at tg: tape -- not yet + +# legitimate pseudo-devices +pseudo-device bpfilter +pseudo-device cd: disk +pseudo-device loop +pseudo-device pty: tty +pseudo-device sl +pseudo-device vn: disk + +# kernel sources +file isofs/cd9660/cd9660_bmap.c cd9660 +file isofs/cd9660/cd9660_lookup.c cd9660 +file isofs/cd9660/cd9660_node.c cd9660 +file isofs/cd9660/cd9660_rrip.c cd9660 +file isofs/cd9660/cd9660_util.c cd9660 +file isofs/cd9660/cd9660_vfsops.c cd9660 +file isofs/cd9660/cd9660_vnops.c cd9660 +file kern/init_main.c +file kern/init_sysent.c +file kern/kern_acct.c +file kern/kern_clock.c +file kern/kern_descrip.c +file kern/kern_exec.c +file kern/kern_exit.c +file kern/kern_fork.c +file kern/kern_ktrace.c ktrace +file kern/kern_malloc.c +file kern/kern_physio.c +file kern/kern_proc.c +file kern/kern_prot.c +file kern/kern_resource.c +file kern/kern_sig.c +file kern/kern_subr.c +file kern/kern_synch.c +file kern/kern_sysctl.c +file kern/kern_time.c +file kern/kern_xxx.c +file kern/subr_autoconf.c +file kern/subr_log.c +file kern/subr_prf.c +file kern/subr_prof.c +file kern/subr_rmap.c +file kern/subr_xxx.c +file kern/sys_generic.c +file kern/sys_process.c +file kern/sys_socket.c +file kern/sysv_shm.c sysvshm +file kern/tty.c +file kern/tty_compat.c +file kern/tty_conf.c +file kern/tty_pty.c pty needs-count +file kern/tty_subr.c +file kern/tty_tb.c tb needs-flag +file kern/tty_tty.c +file kern/uipc_domain.c +file kern/uipc_mbuf.c +file kern/uipc_proto.c +file kern/uipc_socket.c +file kern/uipc_socket2.c +file kern/uipc_syscalls.c +file kern/uipc_usrreq.c +file kern/vfs_bio.c +file kern/vfs_cache.c +file kern/vfs_cluster.c +file kern/vfs_conf.c +file kern/vfs_init.c +file kern/vfs_lookup.c +file kern/vfs_subr.c +file kern/vfs_syscalls.c +file kern/vfs_vnops.c +file miscfs/deadfs/dead_vnops.c +file miscfs/fdesc/fdesc_vfsops.c fdesc +file miscfs/fdesc/fdesc_vnops.c fdesc +file miscfs/fifofs/fifo_vnops.c fifo +file miscfs/kernfs/kernfs_vfsops.c kernfs +file miscfs/kernfs/kernfs_vnops.c kernfs +file miscfs/nullfs/null_subr.c nullfs +file miscfs/nullfs/null_vfsops.c nullfs +file miscfs/nullfs/null_vnops.c nullfs +file miscfs/portal/portal_vfsops.c portal +file miscfs/portal/portal_vnops.c portal +file miscfs/procfs/procfs_subr.c procfs +file miscfs/procfs/procfs_vnops.c procfs +file miscfs/procfs/procfs_vfsops.c procfs +file miscfs/procfs/procfs_note.c procfs +file miscfs/procfs/procfs_mem.c procfs +file miscfs/procfs/procfs_ctl.c procfs +file miscfs/procfs/procfs_status.c procfs +file miscfs/procfs/procfs_regs.c procfs +file miscfs/procfs/procfs_fpregs.c procfs +file miscfs/specfs/spec_vnops.c +file miscfs/umapfs/umap_subr.c umapfs +file miscfs/umapfs/umap_vfsops.c umapfs +file miscfs/umapfs/umap_vnops.c umapfs +file miscfs/union/union_subr.c union +file miscfs/union/union_vfsops.c union +file miscfs/union/union_vnops.c union +file net/bpf.c bpfilter needs-count +file net/bpf_filter.c bpfilter needs-count +file net/if.c +file net/if_ethersubr.c ether needs-flag +file net/if_loop.c loop needs-count +file net/if_sl.c sl needs-count +file net/radix.c +file net/raw_cb.c +file net/raw_usrreq.c +file net/route.c +file net/rtsock.c +file net/slcompress.c sl +file netccitt/ccitt_proto.c ccitt +file netccitt/llc_input.c llc +file netccitt/llc_output.c llc +file netccitt/llc_subr.c llc +file netccitt/llc_timer.c llc +file netccitt/hd_debug.c hdlc +file netccitt/hd_input.c hdlc +file netccitt/hd_output.c hdlc +file netccitt/hd_subr.c hdlc +file netccitt/hd_timer.c hdlc +file netccitt/if_x25subr.c ccitt +file netccitt/pk_acct.c ccitt +file netccitt/pk_debug.c ccitt +file netccitt/pk_input.c ccitt +file netccitt/pk_llcsubr.c llc hdlc +file netccitt/pk_output.c ccitt +file netccitt/pk_subr.c ccitt +file netccitt/pk_timer.c ccitt +file netccitt/pk_usrreq.c ccitt +file netimp/if_imp.c imp needs-count +file netimp/if_imphost.c imp needs-count +file netimp/raw_imp.c imp +file netinet/if_ether.c ether +file netinet/igmp.c inet +file netinet/in.c inet +file netinet/in_pcb.c inet +file netinet/in_proto.c inet +file netinet/ip_icmp.c inet +file netinet/ip_input.c inet +file netinet/ip_mroute.c inet +file netinet/ip_output.c inet +file netinet/raw_ip.c inet +file netinet/tcp_debug.c inet +file netinet/tcp_input.c inet +file netinet/tcp_output.c inet +file netinet/tcp_subr.c inet +file netinet/tcp_timer.c inet +file netinet/tcp_usrreq.c inet +file netinet/udp_usrreq.c inet +file netiso/clnp_debug.c iso +file netiso/clnp_er.c iso +file netiso/clnp_frag.c iso +file netiso/clnp_input.c iso +file netiso/clnp_options.c iso +file netiso/clnp_output.c iso +file netiso/clnp_raw.c iso +file netiso/clnp_subr.c iso +file netiso/clnp_timer.c iso +file netiso/cltp_usrreq.c iso +file netiso/esis.c iso +file netiso/if_eon.c eon +file netiso/idrp_usrreq.c iso +file netiso/iso.c iso +file netiso/iso_chksum.c iso +file netiso/iso_pcb.c iso +file netiso/iso_proto.c iso +file netiso/iso_snpac.c iso +file netiso/tp_astring.c iso tpip +file netiso/tp_cons.c iso +file netiso/tp_driver.c iso tpip +file netiso/tp_emit.c iso tpip +file netiso/tp_inet.c iso tpip +file netiso/tp_input.c iso tpip +file netiso/tp_iso.c iso +file netiso/tp_meas.c iso tpip +file netiso/tp_output.c iso tpip +file netiso/tp_pcb.c iso tpip +file netiso/tp_subr.c iso tpip +file netiso/tp_subr2.c iso tpip +file netiso/tp_timer.c iso tpip +file netiso/tp_trace.c iso tpip +file netiso/tp_usrreq.c iso tpip +file netiso/tuba_subr.c iso tuba +file netiso/tuba_table.c iso tuba +file netiso/tuba_usrreq.c iso tuba +file netns/idp_usrreq.c ns +file netns/ns.c ns +file netns/ns_error.c ns +file netns/ns_input.c ns +file netns/ns_ip.c ns +file netns/ns_output.c ns +file netns/ns_pcb.c ns +file netns/ns_proto.c ns +file netns/spp_debug.c ns +file netns/spp_usrreq.c ns +file nfs/nfs_bio.c nfs +file nfs/nfs_node.c nfs +file nfs/nfs_nqlease.c nfs +file nfs/nfs_serv.c nfs +file nfs/nfs_socket.c nfs +file nfs/nfs_srvcache.c nfs +file nfs/nfs_subs.c nfs +file nfs/nfs_syscalls.c nfs +file nfs/nfs_vfsops.c nfs +file nfs/nfs_vnops.c nfs +file ufs/ffs/ffs_alloc.c ffs mfs +file ufs/ffs/ffs_balloc.c ffs mfs +file ufs/ffs/ffs_inode.c ffs mfs +file ufs/ffs/ffs_subr.c ffs mfs +file ufs/ffs/ffs_tables.c ffs mfs +file ufs/ffs/ffs_vfsops.c ffs mfs +file ufs/ffs/ffs_vnops.c ffs mfs +file ufs/lfs/lfs_alloc.c lfs +file ufs/lfs/lfs_bio.c lfs +file ufs/lfs/lfs_balloc.c lfs +file ufs/lfs/lfs_cksum.c lfs +file ufs/lfs/lfs_debug.c lfs +file ufs/lfs/lfs_inode.c lfs +file ufs/lfs/lfs_segment.c lfs +file ufs/lfs/lfs_subr.c lfs +file ufs/lfs/lfs_syscalls.c lfs +file ufs/lfs/lfs_vfsops.c lfs +file ufs/lfs/lfs_vnops.c lfs +file ufs/mfs/mfs_vfsops.c mfs +file ufs/mfs/mfs_vnops.c mfs +file ufs/ufs/ufs_bmap.c ffs lfs mfs +file ufs/ufs/ufs_disksubr.c ffs lfs mfs +file ufs/ufs/ufs_ihash.c ffs lfs mfs +file ufs/ufs/ufs_inode.c ffs lfs mfs +file ufs/ufs/ufs_lockf.c ffs lfs mfs +file ufs/ufs/ufs_lookup.c ffs lfs mfs +file ufs/ufs/ufs_quota.c ffs lfs mfs +file ufs/ufs/ufs_vfsops.c ffs lfs mfs +file ufs/ufs/ufs_vnops.c ffs lfs mfs +file vm/device_pager.c devpager +file vm/kern_lock.c +file vm/swap_pager.c swappager +file vm/vm_fault.c +file vm/vm_glue.c +file vm/vm_init.c +file vm/vm_kern.c +file vm/vm_map.c +file vm/vm_meter.c +file vm/vm_mmap.c +file vm/vm_object.c +file vm/vm_page.c +file vm/vm_pageout.c +file vm/vm_pager.c +file vm/vm_swap.c +file vm/vm_unix.c +file vm/vm_user.c +file vm/vnode_pager.c vnodepager diff --git a/sys/conf/param.c b/sys/conf/param.c new file mode 100644 index 000000000000..efa8070372e8 --- /dev/null +++ b/sys/conf/param.c @@ -0,0 +1,120 @@ +/* + * Copyright (c) 1980, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * 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. + * + * @(#)param.c 8.3 (Berkeley) 8/20/94 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#ifdef SYSVSHM +#include +#include +#endif + +/* + * System parameter formulae. + * + * This file is copied into each directory where we compile + * the kernel; it should be modified there to suit local taste + * if necessary. + * + * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx + */ + +#ifndef HZ +#define HZ 100 +#endif +int hz = HZ; +int tick = 1000000 / HZ; +int tickadj = 30000 / (60 * HZ); /* can adjust 30ms in 60s */ +struct timezone tz = { TIMEZONE, DST }; +#define NPROC (20 + 16 * MAXUSERS) +int maxproc = NPROC; +#define NTEXT (80 + NPROC / 8) /* actually the object cache */ +#define NVNODE (NPROC + NTEXT + 100) +int desiredvnodes = NVNODE; +int maxfiles = 3 * (NPROC + MAXUSERS) + 80; +int ncallout = 16 + NPROC; +int nclist = 60 + 12 * MAXUSERS; +int nmbclusters = NMBCLUSTERS; +int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */ + +/* + * Values in support of System V compatible shared memory. XXX + */ +#ifdef SYSVSHM +#define SHMMAX (SHMMAXPGS*NBPG) +#define SHMMIN 1 +#define SHMMNI 32 /* <= SHMMMNI in shm.h */ +#define SHMSEG 8 +#define SHMALL (SHMMAXPGS/CLSIZE) + +struct shminfo shminfo = { + SHMMAX, + SHMMIN, + SHMMNI, + SHMSEG, + SHMALL +}; +#endif + +/* + * These are initialized at bootstrap time + * to values dependent on memory size + */ +int nbuf, nswbuf; + +/* + * These have to be allocated somewhere; allocating + * them here forces loader errors if this file is omitted + * (if they've been externed everywhere else; hah!). + */ +struct callout *callout; +struct cblock *cfree; +struct buf *buf, *swbuf; +char *buffers; diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c new file mode 100644 index 000000000000..d061e57bb16d --- /dev/null +++ b/sys/dev/vn/vn.c @@ -0,0 +1,548 @@ +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * 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. + * + * from: Utah $Hdr: vn.c 1.13 94/04/02$ + * + * @(#)vn.c 8.9 (Berkeley) 5/14/95 + */ + +/* + * Vnode disk driver. + * + * Block/character interface to a vnode. Allows one to treat a file + * as a disk (e.g. build a filesystem in it, mount it, etc.). + * + * NOTE 1: This uses the VOP_BMAP/VOP_STRATEGY interface to the vnode + * instead of a simple VOP_RDWR. We do this to avoid distorting the + * local buffer cache. + * + * NOTE 2: There is a security issue involved with this driver. + * Once mounted all access to the contents of the "mapped" file via + * the special file is controlled by the permissions on the special + * file, the protection of the mapped file is ignored (effectively, + * by using root credentials in all transactions). + * + * NOTE 3: Doesn't interact with leases, should it? + */ +#include "vn.h" +#if NVN > 0 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#ifdef DEBUG +int dovncluster = 1; +int vndebug = 0x00; +#define VDB_FOLLOW 0x01 +#define VDB_INIT 0x02 +#define VDB_IO 0x04 +#endif + +#define b_cylin b_resid + +#define vnunit(x) ((minor(x) >> 3) & 0x7) /* for consistency */ + +#define getvnbuf() \ + ((struct buf *)malloc(sizeof(struct buf), M_DEVBUF, M_WAITOK)) +#define putvnbuf(bp) \ + free((caddr_t)(bp), M_DEVBUF) + +struct vn_softc { + int sc_flags; /* flags */ + size_t sc_size; /* size of vn */ + struct vnode *sc_vp; /* vnode */ + struct ucred *sc_cred; /* credentials */ + int sc_maxactive; /* max # of active requests */ + struct buf sc_tab; /* transfer queue */ +}; + +/* sc_flags */ +#define VNF_ALIVE 0x01 +#define VNF_INITED 0x02 + +#if 0 /* if you need static allocation */ +struct vn_softc vn_softc[NVN]; +int numvnd = NVN; +#else +struct vn_softc *vn_softc; +int numvnd; +#endif + +void +vnattach(num) + int num; +{ + char *mem; + register u_long size; + + if (num <= 0) + return; + size = num * sizeof(struct vn_softc); + mem = malloc(size, M_DEVBUF, M_NOWAIT); + if (mem == NULL) { + printf("WARNING: no memory for vnode disks\n"); + return; + } + bzero(mem, size); + vn_softc = (struct vn_softc *)mem; + numvnd = num; +} + +int +vnopen(dev, flags, mode, p) + dev_t dev; + int flags, mode; + struct proc *p; +{ + int unit = vnunit(dev); + +#ifdef DEBUG + if (vndebug & VDB_FOLLOW) + printf("vnopen(%x, %x, %x, %x)\n", dev, flags, mode, p); +#endif + if (unit >= numvnd) + return(ENXIO); + return(0); +} + +/* + * Break the request into bsize pieces and submit using VOP_BMAP/VOP_STRATEGY. + * Note that this driver can only be used for swapping over NFS on the hp + * since nfs_strategy on the vax cannot handle u-areas and page tables. + */ +void +vnstrategy(bp) + register struct buf *bp; +{ + int unit = vnunit(bp->b_dev); + register struct vn_softc *vn = &vn_softc[unit]; + register struct buf *nbp; + register int bn, bsize, resid; + register caddr_t addr; + int sz, flags, error; + extern void vniodone(); + +#ifdef DEBUG + if (vndebug & VDB_FOLLOW) + printf("vnstrategy(%x): unit %d\n", bp, unit); +#endif + if ((vn->sc_flags & VNF_INITED) == 0) { + bp->b_error = ENXIO; + bp->b_flags |= B_ERROR; + biodone(bp); + return; + } + bn = bp->b_blkno; + sz = howmany(bp->b_bcount, DEV_BSIZE); + bp->b_resid = bp->b_bcount; + if (bn < 0 || bn + sz > vn->sc_size) { + if (bn != vn->sc_size) { + bp->b_error = EINVAL; + bp->b_flags |= B_ERROR; + } + biodone(bp); + return; + } + bn = dbtob(bn); + bsize = vn->sc_vp->v_mount->mnt_stat.f_iosize; + addr = bp->b_data; + flags = bp->b_flags | B_CALL; + for (resid = bp->b_resid; resid; resid -= sz) { + struct vnode *vp; + daddr_t nbn; + int off, s, nra; + + nra = 0; + error = VOP_BMAP(vn->sc_vp, bn / bsize, &vp, &nbn, &nra); + if (error == 0 && (long)nbn == -1) + error = EIO; +#ifdef DEBUG + if (!dovncluster) + nra = 0; +#endif + + if (off = bn % bsize) + sz = bsize - off; + else + sz = (1 + nra) * bsize; + if (resid < sz) + sz = resid; +#ifdef DEBUG + if (vndebug & VDB_IO) + printf("vnstrategy: vp %x/%x bn %x/%x sz %x\n", + vn->sc_vp, vp, bn, nbn, sz); +#endif + + nbp = getvnbuf(); + nbp->b_flags = flags; + nbp->b_bcount = sz; + nbp->b_bufsize = bp->b_bufsize; + nbp->b_error = 0; + if (vp->v_type == VBLK || vp->v_type == VCHR) + nbp->b_dev = vp->v_rdev; + else + nbp->b_dev = NODEV; + nbp->b_data = addr; + nbp->b_blkno = nbn + btodb(off); + nbp->b_proc = bp->b_proc; + nbp->b_iodone = vniodone; + nbp->b_vp = vp; + nbp->b_pfcent = (int) bp; /* XXX */ + nbp->b_rcred = vn->sc_cred; /* XXX crdup? */ + nbp->b_wcred = vn->sc_cred; /* XXX crdup? */ + nbp->b_dirtyoff = bp->b_dirtyoff; + nbp->b_dirtyend = bp->b_dirtyend; + nbp->b_validoff = bp->b_validoff; + nbp->b_validend = bp->b_validend; + /* + * If there was an error or a hole in the file...punt. + * Note that we deal with this after the nbp allocation. + * This ensures that we properly clean up any operations + * that we have already fired off. + * + * XXX we could deal with holes here but it would be + * a hassle (in the write case). + */ + if (error) { + nbp->b_error = error; + nbp->b_flags |= B_ERROR; + bp->b_resid -= (resid - sz); + biodone(nbp); + return; + } + /* + * Just sort by block number + */ + nbp->b_cylin = nbp->b_blkno; + s = splbio(); + disksort(&vn->sc_tab, nbp); + if (vn->sc_tab.b_active < vn->sc_maxactive) { + vn->sc_tab.b_active++; + vnstart(vn); + } + splx(s); + bn += sz; + addr += sz; + } +} + +/* + * Feed requests sequentially. + * We do it this way to keep from flooding NFS servers if we are connected + * to an NFS file. This places the burden on the client rather than the + * server. + */ +vnstart(vn) + register struct vn_softc *vn; +{ + register struct buf *bp; + + /* + * Dequeue now since lower level strategy routine might + * queue using same links + */ + bp = vn->sc_tab.b_actf; + vn->sc_tab.b_actf = bp->b_actf; +#ifdef DEBUG + if (vndebug & VDB_IO) + printf("vnstart(%d): bp %x vp %x blkno %x addr %x cnt %x\n", + vn-vn_softc, bp, bp->b_vp, bp->b_blkno, bp->b_data, + bp->b_bcount); +#endif + if ((bp->b_flags & B_READ) == 0) + bp->b_vp->v_numoutput++; + VOP_STRATEGY(bp); +} + +void +vniodone(bp) + register struct buf *bp; +{ + register struct buf *pbp = (struct buf *)bp->b_pfcent; /* XXX */ + register struct vn_softc *vn = &vn_softc[vnunit(pbp->b_dev)]; + int s; + + s = splbio(); +#ifdef DEBUG + if (vndebug & VDB_IO) + printf("vniodone(%d): bp %x vp %x blkno %x addr %x cnt %x\n", + vn-vn_softc, bp, bp->b_vp, bp->b_blkno, bp->b_data, + bp->b_bcount); +#endif + if (bp->b_error) { +#ifdef DEBUG + if (vndebug & VDB_IO) + printf("vniodone: bp %x error %d\n", bp, bp->b_error); +#endif + pbp->b_flags |= B_ERROR; + pbp->b_error = biowait(bp); + } + pbp->b_resid -= bp->b_bcount; + putvnbuf(bp); + if (pbp->b_resid == 0) { +#ifdef DEBUG + if (vndebug & VDB_IO) + printf("vniodone: pbp %x iodone\n", pbp); +#endif + biodone(pbp); + } + if (vn->sc_tab.b_actf) + vnstart(vn); + else + vn->sc_tab.b_active--; + splx(s); +} + +vnread(dev, uio, flags, p) + dev_t dev; + struct uio *uio; + int flags; + struct proc *p; +{ + +#ifdef DEBUG + if (vndebug & VDB_FOLLOW) + printf("vnread(%x, %x, %x, %x)\n", dev, uio, flags, p); +#endif + return(physio(vnstrategy, NULL, dev, B_READ, minphys, uio)); +} + +vnwrite(dev, uio, flags, p) + dev_t dev; + struct uio *uio; + int flags; + struct proc *p; +{ + +#ifdef DEBUG + if (vndebug & VDB_FOLLOW) + printf("vnwrite(%x, %x, %x, %x)\n", dev, uio, flags, p); +#endif + return(physio(vnstrategy, NULL, dev, B_WRITE, minphys, uio)); +} + +/* ARGSUSED */ +vnioctl(dev, cmd, data, flag, p) + dev_t dev; + u_long cmd; + caddr_t data; + int flag; + struct proc *p; +{ + int unit = vnunit(dev); + register struct vn_softc *vn; + struct vn_ioctl *vio; + struct vattr vattr; + struct nameidata nd; + int error; + +#ifdef DEBUG + if (vndebug & VDB_FOLLOW) + printf("vnioctl(%x, %x, %x, %x, %x): unit %d\n", + dev, cmd, data, flag, p, unit); +#endif + error = suser(p->p_ucred, &p->p_acflag); + if (error) + return (error); + if (unit >= numvnd) + return (ENXIO); + + vn = &vn_softc[unit]; + vio = (struct vn_ioctl *)data; + switch (cmd) { + + case VNIOCSET: + if (vn->sc_flags & VNF_INITED) + return(EBUSY); + /* + * Always open for read and write. + * This is probably bogus, but it lets vn_open() + * weed out directories, sockets, etc. so we don't + * have to worry about them. + */ + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, vio->vn_file, p); + if (error = vn_open(&nd, FREAD|FWRITE, 0)) + return(error); + if (error = VOP_GETATTR(nd.ni_vp, &vattr, p->p_ucred, p)) { + VOP_UNLOCK(nd.ni_vp, 0, p); + (void) vn_close(nd.ni_vp, FREAD|FWRITE, p->p_ucred, p); + return(error); + } + VOP_UNLOCK(nd.ni_vp, 0, p); + vn->sc_vp = nd.ni_vp; + vn->sc_size = btodb(vattr.va_size); /* note truncation */ + if (error = vnsetcred(vn, p->p_ucred)) { + (void) vn_close(nd.ni_vp, FREAD|FWRITE, p->p_ucred, p); + return(error); + } + vnthrottle(vn, vn->sc_vp); + vio->vn_size = dbtob(vn->sc_size); + vn->sc_flags |= VNF_INITED; +#ifdef DEBUG + if (vndebug & VDB_INIT) + printf("vnioctl: SET vp %x size %x\n", + vn->sc_vp, vn->sc_size); +#endif + break; + + case VNIOCCLR: + if ((vn->sc_flags & VNF_INITED) == 0) + return(ENXIO); + vnclear(vn); +#ifdef DEBUG + if (vndebug & VDB_INIT) + printf("vnioctl: CLRed\n"); +#endif + break; + + default: + return(ENOTTY); + } + return(0); +} + +/* + * Duplicate the current processes' credentials. Since we are called only + * as the result of a SET ioctl and only root can do that, any future access + * to this "disk" is essentially as root. Note that credentials may change + * if some other uid can write directly to the mapped file (NFS). + */ +vnsetcred(vn, cred) + register struct vn_softc *vn; + struct ucred *cred; +{ + struct uio auio; + struct iovec aiov; + char *tmpbuf; + int error; + + vn->sc_cred = crdup(cred); + tmpbuf = malloc(DEV_BSIZE, M_TEMP, M_WAITOK); + + /* XXX: Horrible kludge to establish credentials for NFS */ + aiov.iov_base = tmpbuf; + aiov.iov_len = min(DEV_BSIZE, dbtob(vn->sc_size)); + auio.uio_iov = &aiov; + auio.uio_iovcnt = 1; + auio.uio_offset = 0; + auio.uio_rw = UIO_READ; + auio.uio_segflg = UIO_SYSSPACE; + auio.uio_resid = aiov.iov_len; + error = VOP_READ(vn->sc_vp, &auio, 0, vn->sc_cred); + + free(tmpbuf, M_TEMP); + return (error); +} + +/* + * Set maxactive based on FS type + */ +vnthrottle(vn, vp) + register struct vn_softc *vn; + struct vnode *vp; +{ + extern int (**nfsv2_vnodeop_p)(); + + if (vp->v_op == nfsv2_vnodeop_p) + vn->sc_maxactive = 2; + else + vn->sc_maxactive = 8; + + if (vn->sc_maxactive < 1) + vn->sc_maxactive = 1; +} + +vnshutdown() +{ + register struct vn_softc *vn; + + for (vn = &vn_softc[0]; vn < &vn_softc[numvnd]; vn++) + if (vn->sc_flags & VNF_INITED) + vnclear(vn); +} + +vnclear(vn) + register struct vn_softc *vn; +{ + register struct vnode *vp = vn->sc_vp; + struct proc *p = curproc; /* XXX */ + +#ifdef DEBUG + if (vndebug & VDB_FOLLOW) + printf("vnclear(%x): vp %x\n", vp); +#endif + vn->sc_flags &= ~VNF_INITED; + if (vp == (struct vnode *)0) + panic("vnioctl: null vp"); + (void) vn_close(vp, FREAD|FWRITE, vn->sc_cred, p); + crfree(vn->sc_cred); + vn->sc_vp = (struct vnode *)0; + vn->sc_cred = (struct ucred *)0; + vn->sc_size = 0; +} + +vnsize(dev) + dev_t dev; +{ + int unit = vnunit(dev); + register struct vn_softc *vn = &vn_softc[unit]; + + if (unit >= numvnd || (vn->sc_flags & VNF_INITED) == 0) + return(-1); + return(vn->sc_size); +} + +vndump(dev) +{ + return(ENXIO); +} +#endif