From fde1aeb2eee5a780dd6f91f3f55568543873e719 Mon Sep 17 00:00:00 2001 From: Garrett Wollman Date: Sun, 19 Dec 1993 00:56:17 +0000 Subject: [PATCH] Make everything compile with -Wtraditional. Make it easier to distribute a binary link-kit. Make all non-optional options (pagers, procfs) standard, and update LINT to reflect new symtab requirements. NB: -Wtraditional will henceforth be forgotten. This editing pass was primarily intended to detect any constructions where the old code might have been relying on traditional C semantics or syntax. These were all fixed, and the result of fixing some of them means that -Wall is now a realistic possibility within a few weeks. --- sys/conf/files | 15 ++- sys/ddb/db_access.c | 5 +- sys/ddb/db_examine.c | 13 +- sys/ddb/db_input.c | 5 +- sys/ddb/db_output.c | 5 +- sys/i386/conf/GENERICAH | 4 +- sys/i386/conf/GENERICBT | 4 +- sys/i386/conf/LINT | 6 +- sys/i386/conf/Makefile.i386 | 4 +- sys/i386/i386/autoconf.c | 3 +- sys/i386/i386/db_disasm.c | 5 +- sys/i386/i386/db_interface.c | 5 +- sys/i386/i386/db_trace.c | 5 +- sys/i386/i386/dkbad.c | 3 +- sys/i386/i386/in_cksum.c | 3 +- sys/i386/i386/machdep.c | 32 +++-- sys/i386/i386/math_emulate.c | 28 ++-- sys/i386/i386/mem.c | 9 +- sys/i386/i386/ns_cksum.c | 3 +- sys/i386/i386/pmap.c | 7 +- sys/i386/i386/trap.c | 23 ++-- sys/i386/i386/vm_machdep.c | 10 +- sys/i386/include/cpufunc.h | 53 ++++++-- sys/i386/include/frame.h | 4 +- sys/i386/include/param.h | 6 +- sys/i386/include/pmap.h | 28 +++- sys/i386/include/vmparam.h | 32 ++--- sys/i386/isa/aha1542.c | 17 +-- sys/i386/isa/aha1742.c | 13 +- sys/i386/isa/bt742a.c | 18 +-- sys/i386/isa/clock.c | 4 +- sys/i386/isa/com.c | 5 +- sys/i386/isa/fd.c | 14 +- sys/i386/isa/icu.s | 6 +- sys/i386/isa/if_ed.c | 4 +- sys/i386/isa/if_is.c | 2 +- sys/i386/isa/isa.c | 11 +- sys/i386/isa/isa_device.h | 8 +- sys/i386/isa/mcd.c | 21 +-- sys/i386/isa/pccons.c | 32 +++-- sys/i386/isa/sound/dmabuf.c | 8 +- sys/i386/isa/sound/os.h | 13 +- sys/i386/isa/sound/soundcard.c | 8 +- sys/i386/isa/ultra14f.c | 15 +-- sys/i386/isa/wd.c | 12 +- sys/i386/isa/wt.c | 37 +++-- sys/isofs/iso.h | 14 +- sys/isofs/isofs_bmap.c | 3 +- sys/isofs/isofs_node.h | 15 ++- sys/isofs/isofs_rrip.c | 8 +- sys/isofs/isofs_util.c | 8 +- sys/isofs/isofs_vfsops.c | 6 +- sys/isofs/isofs_vnops.c | 41 +++--- sys/kern/aout_imgact.c | 6 +- sys/kern/dead_vnops.c | 6 +- sys/kern/init_main.c | 6 +- sys/kern/kern__physio.c | 25 ++-- sys/kern/kern_clock.c | 4 +- sys/kern/kern_descrip.c | 4 +- sys/kern/kern_execve.c | 44 +++--- sys/kern/kern_exit.c | 42 +++--- sys/kern/kern_fork.c | 6 +- sys/kern/kern_kinfo.c | 7 +- sys/kern/kern_ktrace.c | 13 +- sys/kern/kern_proc.c | 12 +- sys/kern/kern_prot.c | 4 +- sys/kern/kern_sig.c | 5 +- sys/kern/kern_subr.c | 27 ++-- sys/kern/subr_prf.c | 13 +- sys/kern/subr_rlist.c | 8 +- sys/kern/sys_generic.c | 3 +- sys/kern/sys_process.c | 8 +- sys/kern/sys_socket.c | 7 +- sys/kern/sysv_shm.c | 20 ++- sys/kern/tty.c | 3 +- sys/kern/tty_compat.c | 10 +- sys/kern/tty_pty.c | 3 +- sys/kern/tty_ring.c | 7 +- sys/kern/uipc_domain.c | 4 +- sys/kern/uipc_mbuf.c | 174 +++++++++++++++++++++++- sys/kern/uipc_proto.c | 6 +- sys/kern/uipc_socket.c | 36 +++-- sys/kern/uipc_socket2.c | 5 +- sys/kern/uipc_syscalls.c | 86 +++++++----- sys/kern/vfs_conf.c | 9 +- sys/kern/vfs_syscalls.c | 11 +- sys/net/bpf.c | 37 +---- sys/net/bpf_filter.c | 5 +- sys/net/if.c | 39 +++++- sys/net/if.h | 7 +- sys/net/if_ppp.c | 4 +- sys/net/raw_cb.h | 11 +- sys/net/raw_usrreq.c | 5 +- sys/net/route.c | 5 +- sys/net/route.h | 21 ++- sys/net/rtsock.c | 5 +- sys/netccitt/ccitt_proto.c | 18 ++- sys/netccitt/if_x25subr.c | 4 +- sys/netccitt/pk_debug.c | 8 +- sys/netccitt/pk_input.c | 27 ++-- sys/netccitt/pk_output.c | 23 ++-- sys/netccitt/pk_subr.c | 74 +--------- sys/netccitt/pk_timer.c | 4 +- sys/netccitt/pk_usrreq.c | 7 +- sys/netccitt/pk_var.h | 65 +++++++-- sys/netinet/icmp_var.h | 6 +- sys/netinet/in.c | 11 +- sys/netinet/in.h | 48 ++++--- sys/netinet/in_mtudisc.c | 20 +-- sys/netinet/in_pcb.c | 4 +- sys/netinet/in_proto.c | 80 ++++++++--- sys/netinet/in_var.h | 62 +++++++-- sys/netinet/ip_icmp.c | 23 +--- sys/netinet/ip_input.c | 92 +------------ sys/netinet/ip_output.c | 3 +- sys/netinet/raw_ip.c | 10 +- sys/netinet/tcp_debug.c | 10 +- sys/netinet/tcp_input.c | 3 +- sys/netinet/tcp_subr.c | 14 +- sys/netinet/tcp_timer.c | 8 +- sys/netinet/tcp_usrreq.c | 14 +- sys/netinet/tcp_var.h | 57 +++++++- sys/netinet/udp_usrreq.c | 23 +--- sys/netinet/udp_var.h | 11 +- sys/netiso/clnp.h | 17 ++- sys/netiso/clnp_debug.c | 4 +- sys/netiso/clnp_er.c | 3 +- sys/netiso/clnp_frag.c | 96 ++++++------- sys/netiso/clnp_input.c | 6 +- sys/netiso/clnp_options.c | 5 +- sys/netiso/clnp_output.c | 3 +- sys/netiso/clnp_raw.c | 5 +- sys/netiso/clnp_subr.c | 64 ++++----- sys/netiso/clnp_timer.c | 3 +- sys/netiso/esis.c | 7 +- sys/netiso/esis.h | 9 +- sys/netiso/if_eon.c | 4 +- sys/netiso/iso.c | 34 ++--- sys/netiso/iso_chksum.c | 136 +------------------ sys/netiso/iso_proto.c | 34 +++-- sys/netiso/iso_snpac.c | 55 ++++---- sys/netiso/iso_snpac.h | 20 ++- sys/netiso/iso_var.h | 18 ++- sys/netiso/tp_astring.c | 4 +- sys/netiso/tp_cons.c | 7 +- sys/netiso/tp_driver.c | 4 +- sys/netiso/tp_emit.c | 9 +- sys/netiso/tp_inet.c | 5 +- sys/netiso/tp_input.c | 16 +-- sys/netiso/tp_iso.c | 14 +- sys/netiso/tp_meas.c | 6 +- sys/netiso/tp_output.c | 4 +- sys/netiso/tp_param.h | 8 +- sys/netiso/tp_pcb.c | 4 +- sys/netiso/tp_pcb.h | 31 ++++- sys/netiso/tp_subr2.c | 10 +- sys/netiso/tp_timer.c | 3 +- sys/netiso/tp_usrreq.c | 6 +- sys/netns/idp_usrreq.c | 23 ++-- sys/netns/idp_var.h | 16 ++- sys/netns/ns.c | 3 +- sys/netns/ns.h | 43 +++++- sys/netns/ns_input.c | 8 +- sys/netns/ns_ip.c | 33 +++-- sys/netns/ns_output.c | 3 +- sys/netns/ns_pcb.c | 7 +- sys/netns/ns_pcb.h | 15 ++- sys/netns/ns_proto.c | 30 +++-- sys/netns/spp_debug.c | 8 +- sys/netns/spp_usrreq.c | 38 +++--- sys/netns/spp_var.h | 34 ++++- sys/netrmp/rmp.c | 3 +- sys/netrmp/rmp_proto.c | 3 +- sys/nfs/nfs_serv.c | 5 +- sys/nfs/nfs_socket.c | 6 +- sys/nfs/nfs_subs.c | 6 +- sys/nfs/nfs_syscalls.c | 5 +- sys/nfs/nfs_vfsops.c | 8 +- sys/nfs/nfs_vnops.c | 4 +- sys/nfs/nfsm_subs.h | 36 ++++- sys/nfs/nfsnode.h | 34 ++++- sys/nfs/nfsrvcache.h | 9 +- sys/pcfs/denode.h | 33 ++++- sys/pcfs/pcfs_conv.c | 3 +- sys/pcfs/pcfs_denode.c | 10 +- sys/pcfs/pcfs_lookup.c | 5 +- sys/pcfs/pcfs_vnops.c | 9 +- sys/procfs/procfs_subr.c | 5 +- sys/procfs/procfs_vnops.c | 6 +- sys/scsi/cd.c | 31 +++-- sys/scsi/ch.c | 10 +- sys/scsi/scsi_base.c | 39 +++--- sys/scsi/scsi_ioctl.c | 10 +- sys/scsi/scsiconf.c | 6 +- sys/scsi/scsiconf.h | 4 +- sys/scsi/sd.c | 9 +- sys/scsi/st.c | 18 +-- sys/scsi/uk.c | 5 +- sys/sys/buf.h | 4 +- sys/sys/disklabel.h | 4 +- sys/sys/file.h | 6 +- sys/sys/filedesc.h | 6 +- sys/sys/ioctl.h | 10 +- sys/sys/ioctl_compat.h | 14 +- sys/sys/kernel.h | 31 ++++- sys/sys/ktrace.h | 39 ++++-- sys/sys/mbuf.h | 31 ++++- sys/sys/proc.h | 20 ++- sys/sys/protosw.h | 37 +++-- sys/sys/reboot.h | 6 +- sys/sys/resource.h | 8 +- sys/sys/sysent.h | 51 +++++++ sys/sys/systm.h | 237 +++++++++++++++++++-------------- sys/sys/termios.h | 38 +++--- sys/sys/time.h | 4 +- sys/sys/tty.h | 62 +++++---- sys/sys/ucred.h | 12 +- sys/sys/uio.h | 19 ++- sys/sys/vnode.h | 11 +- sys/ufs/fs.h | 8 +- sys/ufs/inode.h | 37 ++++- sys/ufs/lockf.h | 12 +- sys/ufs/mfs_vfsops.c | 3 +- sys/ufs/ufs_alloc.c | 3 +- sys/ufs/ufs_disksubr.c | 6 +- sys/ufs/ufs_lockf.c | 4 +- sys/ufs/ufs_subr.c | 3 +- sys/ufs/ufs_tables.c | 3 +- sys/ufs/ufs_vfsops.c | 4 +- sys/ufs/ufs_vnops.c | 11 +- sys/vm/kern_lock.c | 5 +- sys/vm/swap_pager.c | 7 +- sys/vm/vm.h | 7 +- sys/vm/vm_fault.c | 5 +- sys/vm/vm_glue.c | 12 +- sys/vm/vm_kern.c | 4 +- sys/vm/vm_kern.h | 3 +- sys/vm/vm_map.c | 5 +- sys/vm/vm_map.h | 60 ++++++--- sys/vm/vm_mmap.c | 8 +- sys/vm/vm_object.c | 7 +- sys/vm/vm_object.h | 3 +- sys/vm/vm_page.c | 3 +- sys/vm/vm_page.h | 22 ++- sys/vm/vm_pageout.c | 3 +- sys/vm/vm_pager.c | 3 +- sys/vm/vm_pager.h | 23 ++-- sys/vm/vm_swap.c | 7 +- sys/vm/vm_user.h | 50 +++++-- sys/vm/vnode_pager.c | 9 +- 250 files changed, 2664 insertions(+), 1718 deletions(-) create mode 100644 sys/sys/sysent.h diff --git a/sys/conf/files b/sys/conf/files index 51e4912443..0df3b79e24 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $Id: files,v 1.11 1993/11/18 05:01:34 rgrimes Exp $ +# $Id: files,v 1.12 1993/12/12 12:21:57 davidg Exp $ # ddb/db_access.c optional ddb ddb/db_aout.c optional ddb @@ -115,6 +115,7 @@ netinet/in.c optional inet netinet/in_pcb.c optional inet netinet/in_proto.c optional inet netinet/in_mtudisc.c optional mtudisc +netinet/in_var.c optional inet netinet/ip_icmp.c optional inet netinet/ip_input.c optional inet netinet/ip_output.c optional inet @@ -198,9 +199,9 @@ pcfs/pcfs_fat.c optional pcfs pcfs/pcfs_lookup.c optional pcfs pcfs/pcfs_vfsops.c optional pcfs pcfs/pcfs_vnops.c optional pcfs -procfs/procfs_vnops.c optional procfs -procfs/procfs_vfsops.c optional procfs -procfs/procfs_subr.c optional procfs +procfs/procfs_vnops.c standard +procfs/procfs_vfsops.c standard +procfs/procfs_subr.c standard scsi/cd.c optional cd scsi/ch.c optional ch scsi/scsiconf.c optional scbus @@ -223,9 +224,9 @@ ufs/ufs_subr.c standard ufs/ufs_tables.c standard ufs/ufs_vfsops.c standard ufs/ufs_vnops.c standard -vm/device_pager.c optional devpager +vm/device_pager.c standard vm/kern_lock.c standard -vm/swap_pager.c optional swappager +vm/swap_pager.c standard vm/vm_fault.c standard vm/vm_glue.c standard vm/vm_init.c standard @@ -240,4 +241,4 @@ 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 +vm/vnode_pager.c standard diff --git a/sys/ddb/db_access.c b/sys/ddb/db_access.c index b519e2853d..9c8a00b295 100644 --- a/sys/ddb/db_access.c +++ b/sys/ddb/db_access.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_access.c,v 1.2 1993/10/16 16:47:04 rgrimes Exp $ + * $Id: db_access.c,v 1.3 1993/11/25 01:30:01 wollman Exp $ */ /* @@ -31,8 +31,9 @@ * Date: 7/90 */ #include "param.h" +#include "systm.h" #include "proc.h" -#include /* type definitions */ +#include "ddb/ddb.h" /* * Access unaligned data items on aligned (longword) diff --git a/sys/ddb/db_examine.c b/sys/ddb/db_examine.c index bf9a4c76e7..f4f7ba1f01 100644 --- a/sys/ddb/db_examine.c +++ b/sys/ddb/db_examine.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_examine.c,v 1.2 1993/10/16 16:47:13 rgrimes Exp $ + * $Id: db_examine.c,v 1.3 1993/11/25 01:30:05 wollman Exp $ */ /* @@ -36,10 +36,11 @@ #include "ddb/ddb.h" -#include -#include -#include -#include +#include "ddb/db_lex.h" +#include "ddb/db_output.h" +#include "ddb/db_command.h" +#include "ddb/db_sym.h" +#include "ddb/db_access.h" char db_examine_format[TOK_STRING_SIZE] = "x"; @@ -302,7 +303,7 @@ db_search_cmd(db_expr_t dummy1, int dummy2, db_expr_t dummy3, char *dummy4) } if (!db_expression(&mask)) - mask = 0xffffffff; + mask = 0xffffffffUL; t = db_read_token(); if (t == tCOMMA) { diff --git a/sys/ddb/db_input.c b/sys/ddb/db_input.c index 3f18cd8bea..94bab946c3 100644 --- a/sys/ddb/db_input.c +++ b/sys/ddb/db_input.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_input.c,v 1.2 1993/10/16 16:47:16 rgrimes Exp $ + * $Id: db_input.c,v 1.3 1993/11/25 01:30:06 wollman Exp $ */ /* @@ -35,7 +35,8 @@ #include "systm.h" #include "proc.h" #include "ddb/ddb.h" -#include +#include "ddb/db_output.h" +#include "machine/cons.h" /* * Character input and editing. diff --git a/sys/ddb/db_output.c b/sys/ddb/db_output.c index 440f486746..fc1bb1450b 100644 --- a/sys/ddb/db_output.c +++ b/sys/ddb/db_output.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_output.c,v 1.4 1993/10/16 16:47:20 rgrimes Exp $ + * $Id: db_output.c,v 1.5 1993/11/25 01:30:08 wollman Exp $ */ /* @@ -37,8 +37,9 @@ #include "param.h" #include "systm.h" -#include +#include "machine/stdarg.h" #include "ddb/ddb.h" +#include "machine/cons.h" /* * Character output - tracks position in line. diff --git a/sys/i386/conf/GENERICAH b/sys/i386/conf/GENERICAH index 2a6cce251d..cc9e8d9f5f 100644 --- a/sys/i386/conf/GENERICAH +++ b/sys/i386/conf/GENERICAH @@ -1,7 +1,7 @@ # # GENERICAH -- Generic machine with WD/AHx family disks # -# $Id: GENERICAH,v 1.17 1993/11/03 20:02:20 ats Exp $ +# $Id: GENERICAH,v 1.18 1993/12/12 12:22:25 davidg Exp $ # machine "i386" @@ -16,7 +16,7 @@ options INET #InterNETworking options ISOFS #ISO File System options NFS #Network File System options PCFS #MSDOS File System -options PROCFS #Proc File System +#options PROCFS #Proc File System options "COMPAT_43" #Compatible with BSD 4.3 options "TCP_COMPAT_42" #TCP/IP compatible with 4.2 options XSERVER #Xserver diff --git a/sys/i386/conf/GENERICBT b/sys/i386/conf/GENERICBT index 5047fad4ff..d82a59c14d 100644 --- a/sys/i386/conf/GENERICBT +++ b/sys/i386/conf/GENERICBT @@ -1,7 +1,7 @@ # # GENERICBT -- Generic machine with WD/BTx family disks # -# $Id: GENERICBT,v 1.16 1993/11/03 20:02:21 ats Exp $ +# $Id: GENERICBT,v 1.17 1993/12/12 12:22:26 davidg Exp $ # machine "i386" @@ -16,7 +16,7 @@ options INET #InterNETworking options ISOFS #ISO File System options NFS #Network File System options PCFS #MSDOS File System -options PROCFS #Proc File System +#options PROCFS #Proc File System options "COMPAT_43" #Compatible with BSD 4.3 options "TCP_COMPAT_42" #TCP/IP compatible with 4.2 options XSERVER #Xserver diff --git a/sys/i386/conf/LINT b/sys/i386/conf/LINT index 1bf083acc8..cc31430c96 100644 --- a/sys/i386/conf/LINT +++ b/sys/i386/conf/LINT @@ -4,7 +4,7 @@ # # This kernel is NOT MEANT to be runnable! # -# $Id: LINT,v 1.31 1993/12/06 01:57:16 wollman Exp $ +# $Id: LINT,v 1.32 1993/12/12 12:22:27 davidg Exp $ # machine "i386" @@ -24,7 +24,7 @@ config "386bsd" at 0xFE100000 root on wd0 swap on wd0 and sd0 options "COM_BIDIR" #Bidirectional support in sys/isa/sio.c options "COM_MULTIPORT" #Multiport support in sys/isa/sio.c options "COMPAT_43" #compatible with BSD 4.3 -options "SYMTAB_SPACE=103365" #This kernel needs LOTS of symtable +options "SYMTAB_SPACE=103939" #This kernel needs LOTS of symtable options GATEWAY #internetwork gateway options KTRACE #kernel tracing options "NCONS=8" #number of syscons virtual consoles @@ -70,7 +70,7 @@ options NFS #Network File System options NS #Xerox NS communications protocols options NSIP #XNS over IP options PCFS #PC (MSDOS) File System -options PROCFS #Proc File System +#options PROCFS #Proc File System pseudo-device ppp 2 pseudo-device pty 4 options QUOTA #enable disk quotas diff --git a/sys/i386/conf/Makefile.i386 b/sys/i386/conf/Makefile.i386 index eb2e36cc61..eae9500185 100644 --- a/sys/i386/conf/Makefile.i386 +++ b/sys/i386/conf/Makefile.i386 @@ -1,6 +1,6 @@ # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $Id: Makefile.i386,v 1.16 1993/11/25 01:30:38 wollman Exp $ +# $Id: Makefile.i386,v 1.17 1993/12/12 12:22:28 davidg Exp $ # # Makefile for FreeBSD # @@ -33,7 +33,7 @@ I386= ../../i386 CWARNFLAGS=-W -Wreturn-type -Wcomment # # The following flags are next up for working on: -# -Wtraditional -Wredundant-decls -Wnested-externs +# -Wredundant-decls -Wnested-externs # # When working on removing warnings from code, the `-Werror' flag should be # of material assistance. diff --git a/sys/i386/i386/autoconf.c b/sys/i386/i386/autoconf.c index 372dd26832..917137c30a 100644 --- a/sys/i386/i386/autoconf.c +++ b/sys/i386/i386/autoconf.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 - * $Id: autoconf.c,v 1.4 1993/10/16 14:14:48 rgrimes Exp $ + * $Id: autoconf.c,v 1.5 1993/11/25 01:30:46 wollman Exp $ */ /* @@ -52,6 +52,7 @@ #include "conf.h" #include "dmap.h" #include "reboot.h" +#include "kernel.h" #include "machine/pte.h" diff --git a/sys/i386/i386/db_disasm.c b/sys/i386/i386/db_disasm.c index 4793e401f8..98e251b684 100644 --- a/sys/i386/i386/db_disasm.c +++ b/sys/i386/i386/db_disasm.c @@ -23,15 +23,16 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_disasm.c,v 1.3 1993/10/16 14:14:52 rgrimes Exp $ + * $Id: db_disasm.c,v 1.4 1993/11/25 01:30:51 wollman Exp $ */ /* * Instruction disassembler. */ #include "param.h" +#include "systm.h" #include "proc.h" -#include +#include "ddb/ddb.h" #include #include diff --git a/sys/i386/i386/db_interface.c b/sys/i386/i386/db_interface.c index 9f504d4e41..e7e0ced2ab 100644 --- a/sys/i386/i386/db_interface.c +++ b/sys/i386/i386/db_interface.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_interface.c,v 1.3 1993/11/07 17:41:34 wollman Exp $ + * $Id: db_interface.c,v 1.4 1993/11/25 01:30:52 wollman Exp $ */ /* @@ -31,6 +31,7 @@ */ #include "param.h" #include "systm.h" +#include "kernel.h" #include "proc.h" #include "ddb/ddb.h" @@ -235,7 +236,7 @@ db_write_bytes(addr, size, data) void Debugger (msg) - char *msg; + const char *msg; { asm ("int $3"); } diff --git a/sys/i386/i386/db_trace.c b/sys/i386/i386/db_trace.c index ffed283014..9e300cf2ec 100644 --- a/sys/i386/i386/db_trace.c +++ b/sys/i386/i386/db_trace.c @@ -23,12 +23,13 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id$ + * $Id: db_trace.c,v 1.2 1993/10/16 14:14:56 rgrimes Exp $ */ #include "param.h" +#include "systm.h" #include "proc.h" -#include +#include "ddb/ddb.h" #include #include diff --git a/sys/i386/i386/dkbad.c b/sys/i386/i386/dkbad.c index 0e9aca3c69..2ebf05cac9 100644 --- a/sys/i386/i386/dkbad.c +++ b/sys/i386/i386/dkbad.c @@ -34,12 +34,13 @@ * SUCH DAMAGE. * * from: @(#)dkbad.c 5.4 (Berkeley) 1/19/91 - * $Id$ + * $Id: dkbad.c,v 1.2 1993/10/16 14:14:59 rgrimes Exp $ */ #ifndef NOBADSECT #include "sys/param.h" +#include "systm.h" #include "sys/buf.h" #include "sys/dkbad.h" diff --git a/sys/i386/i386/in_cksum.c b/sys/i386/i386/in_cksum.c index 75a74f562b..c6a2d7e739 100644 --- a/sys/i386/i386/in_cksum.c +++ b/sys/i386/i386/in_cksum.c @@ -32,10 +32,11 @@ * * from tahoe: in_cksum.c 1.2 86/01/05 * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 - * $Id: in_cksum.c,v 1.2 1993/10/16 14:15:00 rgrimes Exp $ + * $Id: in_cksum.c,v 1.3 1993/11/25 01:30:53 wollman Exp $ */ #include "param.h" +#include "systm.h" #include "sys/mbuf.h" /* diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 7e588e4389..4fecac1821 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.20 1993/12/03 05:07:43 alm Exp $ + * $Id: machdep.c,v 1.21 1993/12/12 12:22:56 davidg Exp $ */ #include "npx.h" @@ -85,6 +85,7 @@ static unsigned int avail_remaining; #include "machine/psl.h" #include "machine/specialreg.h" #include "machine/sysarch.h" +#include "machine/cons.h" #include "i386/isa/isa.h" #include "i386/isa/rtc.h" @@ -156,10 +157,11 @@ cpu_startup() /* avail_end was pre-decremented in pmap_bootstrap to compensate */ for (i = 0; i < btoc(sizeof (struct msgbuf)); i++) #ifndef MACHINE_NONCONTIG - pmap_enter(pmap_kernel(), msgbufp, avail_end + i * NBPG, + pmap_enter(pmap_kernel(), (vm_offset_t)msgbufp, + avail_end + i * NBPG, VM_PROT_ALL, TRUE); #else - pmap_enter(pmap_kernel(), (caddr_t)msgbufp + i * NBPG, + pmap_enter(pmap_kernel(), (vm_offset_t)msgbufp + i * NBPG, avail_end + i * NBPG, VM_PROT_ALL, TRUE); #endif msgbufmapped = 1; @@ -664,7 +666,7 @@ die: /*NOTREACHED*/ } -unsigned dumpmag = 0x8fca0101; /* magic number for savecore */ +unsigned long dumpmag = 0x8fca0101UL; /* magic number for savecore */ int dumpsize = 0; /* also for savecore */ /* * Doadump comes here after turning off memory management and @@ -929,7 +931,7 @@ struct soft_segment_descriptor ldt_segs[] = { void setidt(idx, func, typ, dpl) int idx; - caddr_t func; + void (*func)(); int typ; int dpl; { @@ -946,7 +948,10 @@ setidt(idx, func, typ, dpl) } #define IDTVEC(name) __CONCAT(X, name) -extern IDTVEC(div), IDTVEC(dbg), IDTVEC(nmi), IDTVEC(bpt), IDTVEC(ofl), +typedef void idtvec_t(); + +extern idtvec_t + IDTVEC(div), IDTVEC(dbg), IDTVEC(nmi), IDTVEC(bpt), IDTVEC(ofl), IDTVEC(bnd), IDTVEC(ill), IDTVEC(dna), IDTVEC(dble), IDTVEC(fpusegm), IDTVEC(tss), IDTVEC(missing), IDTVEC(stk), IDTVEC(prot), IDTVEC(page), IDTVEC(rsvd), IDTVEC(fpu), IDTVEC(rsvd0), @@ -955,7 +960,6 @@ extern IDTVEC(div), IDTVEC(dbg), IDTVEC(nmi), IDTVEC(bpt), IDTVEC(ofl), IDTVEC(rsvd9), IDTVEC(rsvd10), IDTVEC(rsvd11), IDTVEC(rsvd12), IDTVEC(rsvd13), IDTVEC(rsvd14), IDTVEC(rsvd14), IDTVEC(syscall); -int lcr0(), lcr3(), rcr0(), rcr2(); int _gsel_tss; void @@ -986,7 +990,7 @@ init386(first) * the address space */ gdt_segs[GCODE_SEL].ssd_limit = i386_btop(i386_round_page(&etext)) - 1; - gdt_segs[GDATA_SEL].ssd_limit = 0xffffffff; /* XXX constant? */ + gdt_segs[GDATA_SEL].ssd_limit = 0xffffffffUL; /* XXX constant? */ for (x=0; x < NGDT; x++) ssdtosd(gdt_segs+x, gdt+x); /* make ldt memory segments */ /* @@ -1065,7 +1069,7 @@ init386(first) #if NDDB > 0 kdb_init(); if (boothowto & RB_KDB) - Debugger(); + Debugger("Boot flags requested debugger"); #endif /* Use BIOS values stored in RTC CMOS RAM, since probing @@ -1485,4 +1489,14 @@ copystr(fromaddr, toaddr, maxlength, lencopied) u_int *lencopied, maxlength; if(lencopied) *lencopied = tally; return(ENAMETOOLONG); } + #endif + +#include "ddb.h" +#if NDDB <= 0 +void +Debugger(const char *msg) +{ + printf("Debugger(\"%s\") called.", msg); +} +#endif /* no DDB */ diff --git a/sys/i386/i386/math_emulate.c b/sys/i386/i386/math_emulate.c index fad36b9752..756bd35ac4 100644 --- a/sys/i386/i386/math_emulate.c +++ b/sys/i386/i386/math_emulate.c @@ -6,7 +6,7 @@ * [expediant "port" of linux 8087 emulator to 386BSD, with apologies -wfj] * * from: 386BSD 0.1 - * $Id: math_emulate.c,v 1.4 1993/10/16 14:15:04 rgrimes Exp $ + * $Id: math_emulate.c,v 1.5 1993/11/25 01:30:57 wollman Exp $ */ /* @@ -522,7 +522,7 @@ static void fpop(void) { unsigned long tmp; - tmp = I387.swd & 0xffffc7ff; + tmp = I387.swd & 0xffffc7ffUL; I387.swd += 0x00000800; I387.swd &= 0x00003800; I387.swd |= tmp; @@ -532,7 +532,7 @@ static void fpush(void) { unsigned long tmp; - tmp = I387.swd & 0xffffc7ff; + tmp = I387.swd & 0xffffc7ffUL; I387.swd += 0x00003800; I387.swd &= 0x00003800; I387.swd |= tmp; @@ -993,7 +993,7 @@ static void div64(int * a, int * b, int * c) for (i = 0 ; i<64 ; i++) { if (!(mask >>= 1)) { c--; - mask = 0x80000000; + mask = 0x80000000UL; } tmp[0] = a[0]; tmp[1] = a[1]; tmp[2] = a[2]; tmp[3] = a[3]; @@ -1237,7 +1237,7 @@ void short_to_temp(const short_real * a, temp_real * b) b->exponent = ((*a>>23) & 0xff)-127+16383; if (*a<0) b->exponent |= 0x8000; - b->b = (*a<<8) | 0x80000000; + b->b = (*a<<8) | 0x80000000UL; b->a = 0; } @@ -1254,21 +1254,21 @@ void long_to_temp(const long_real * a, temp_real * b) b->exponent = ((a->b >> 20) & 0x7ff)-1023+16383; if (a->b<0) b->exponent |= 0x8000; - b->b = 0x80000000 | (a->b<<11) | (((unsigned long)a->a)>>21); + b->b = 0x80000000UL | (a->b<<11) | (((unsigned long)a->a)>>21); b->a = a->a<<11; } void temp_to_short(const temp_real * a, short_real * b) { if (!(a->exponent & 0x7fff)) { - *b = (a->exponent)?0x80000000:0; + *b = (a->exponent)?0x80000000UL:0; return; } *b = ((((long) a->exponent)-16383+127) << 23) & 0x7f800000; if (a->exponent < 0) - *b |= 0x80000000; + *b |= 0x80000000UL; *b |= (a->b >> 8) & 0x007fffff; - switch (ROUNDING) { + switch ((int)ROUNDING) { case ROUND_NEAREST: if ((a->b & 0xff) > 0x80) ++*b; @@ -1288,16 +1288,16 @@ void temp_to_long(const temp_real * a, long_real * b) { if (!(a->exponent & 0x7fff)) { b->a = 0; - b->b = (a->exponent)?0x80000000:0; + b->b = (a->exponent)?0x80000000UL:0; return; } b->b = (((0x7fff & (long) a->exponent)-16383+1023) << 20) & 0x7ff00000; if (a->exponent < 0) - b->b |= 0x80000000; + b->b |= 0x80000000UL; b->b |= (a->b >> 11) & 0x000fffff; b->a = a->b << 21; b->a |= (a->a >> 11) & 0x001fffff; - switch (ROUNDING) { + switch ((int)ROUNDING) { case ROUND_NEAREST: if ((a->a & 0x7ff) > 0x400) __asm__("addl $1,%0 ; adcl $0,%1" @@ -1354,7 +1354,7 @@ void frndint(const temp_real * a, temp_real * b) __asm__("shrl %1,%0" :"=r" (b->b) :"c" ((char) shift),"0" (b->b)); - switch (ROUNDING) { + switch ((int)ROUNDING) { case ROUND_NEAREST: __asm__("addl %4,%5 ; adcl $0,%0 ; adcl $0,%1" :"=r" (b->a),"=r" (b->b) @@ -1434,7 +1434,7 @@ void real_to_int(const temp_real * a, temp_int * b) __asm__("shrl %1,%0" :"=r" (b->b) :"c" ((char) shift),"0" (b->b)); - switch (ROUNDING) { + switch ((int)ROUNDING) { case ROUND_NEAREST: __asm__("addl %4,%5 ; adcl $0,%0 ; adcl $0,%1" :"=r" (b->a),"=r" (b->b) diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index 1113eb222f..b9a912aa47 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -38,7 +38,7 @@ * * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - * $Id: mem.c,v 1.4 1993/11/22 09:46:45 davidg Exp $ + * $Id: mem.c,v 1.5 1993/11/25 01:30:59 wollman Exp $ */ /* @@ -59,8 +59,8 @@ #include "vm/vm_param.h" #include "vm/lock.h" #include "vm/vm_statistics.h" -#include "vm/pmap.h" #include "vm/vm_prot.h" +#include "vm/pmap.h" extern char *vmmap; /* poor name! */ /*ARGSUSED*/ @@ -128,7 +128,7 @@ mmrw(dev, uio, flags) /* minor device 0 is physical memory */ case 0: v = uio->uio_offset; - pmap_enter(pmap_kernel(), vmmap, v, + pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, v, uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE, TRUE); o = (int)uio->uio_offset & PGOFSET; @@ -136,7 +136,8 @@ mmrw(dev, uio, flags) c = MIN(c, (u_int)(NBPG - o)); c = MIN(c, (u_int)iov->iov_len); error = uiomove((caddr_t)&vmmap[o], (int)c, uio); - pmap_remove(pmap_kernel(), vmmap, &vmmap[NBPG]); + pmap_remove(pmap_kernel(), (vm_offset_t)vmmap, + (vm_offset_t)&vmmap[NBPG]); continue; /* minor device 1 is kernel memory */ diff --git a/sys/i386/i386/ns_cksum.c b/sys/i386/i386/ns_cksum.c index 1473f85550..6b56172fb0 100644 --- a/sys/i386/i386/ns_cksum.c +++ b/sys/i386/i386/ns_cksum.c @@ -32,10 +32,11 @@ * * from: @(#)ns_cksum.c 7.7 (Berkeley) 4/29/91 * from NetBSD: ns_cksum.c,v 1.2 1993/05/22 07:59:55 cgd Exp - * $Id$ + * $Id: ns_cksum.c,v 1.1 1993/09/06 12:12:24 rgrimes Exp $ */ #include "sys/param.h" +#include "systm.h" #include "sys/mbuf.h" /* diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 845c75b6cb..1223f60dae 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 - * $Id: pmap.c,v 1.9 1993/11/25 01:31:00 wollman Exp $ + * $Id: pmap.c,v 1.10 1993/12/13 07:02:27 davidg Exp $ */ /* @@ -80,6 +80,7 @@ #include "param.h" #include "systm.h" +#include "kernel.h" #include "proc.h" #include "malloc.h" #include "user.h" @@ -92,7 +93,6 @@ #include "i386/isa/isa.h" static void i386_protection_init(void); -static void pmap_changebit(vm_offset_t, int, boolean_t); /* * Allocate various and sundry SYSMAPs used in the days of old VM @@ -459,7 +459,8 @@ pmap_pinit(pmap) /* install self-referential address mapping entry */ *(int *)(pmap->pm_pdir+PTDPTDI) = - (int)pmap_extract(kernel_pmap, pmap->pm_pdir) | PG_V | PG_KW; + (int)pmap_extract(kernel_pmap, (vm_offset_t)pmap->pm_pdir) + | PG_V | PG_KW; pmap->pm_count = 1; simple_lock_init(&pmap->pm_lock); diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 0aa22966f8..41370cc466 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.10 1993/12/03 05:07:45 alm Exp $ + * $Id: trap.c,v 1.11 1993/12/12 12:22:57 davidg Exp $ */ /* @@ -59,6 +59,7 @@ #include "vm/vm_param.h" #include "vm/pmap.h" #include "vm/vm_map.h" +#include "vm/vm_user.h" #include "sys/vmmeter.h" #include "machine/trap.h" @@ -70,7 +71,7 @@ * we omit the size from the mov instruction to avoid nonfatal bugs in gas. */ #define read_gs() ({ u_short gs; __asm("mov %%gs,%0" : "=r" (gs)); gs; }) -#define write_gs(gs) __asm("mov %0,%%gs" : : "r" ((u_short) gs)) +#define write_gs(newgs) __asm("mov %0,%%gs" : : "r" ((u_short) newgs)) #else /* not __GNUC__ */ @@ -81,7 +82,6 @@ void write_gs __P((/* promoted u_short */ int gs)); struct sysent sysent[]; int nsysent; -unsigned rcr2(); extern short cpl; #define MAX_TRAP_MSG 27 @@ -353,7 +353,8 @@ copyfault: v = vm->vm_maxsaddr; grow_amount = MAXSSIZ - (vm->vm_ssize << PGSHIFT); } - if (vm_allocate(&vm->vm_map, &v, grow_amount, FALSE) != + if (vm_allocate(&vm->vm_map, (vm_offset_t *)&v, + grow_amount, FALSE) != KERN_SUCCESS) { goto nogo; } @@ -363,10 +364,11 @@ copyfault: /* check if page table is mapped, if not, fault it first */ if (!pde_v(va)) { v = (char *)trunc_page(vtopte(va)); - rv = vm_fault(map, v, ftype, FALSE); + rv = vm_fault(map, (vm_offset_t)v, ftype, FALSE); if (rv != KERN_SUCCESS) goto nogo; /* check if page table fault, increment wiring */ - vm_map_pageable(map, v, round_page(v+1), FALSE); + vm_map_pageable(map, (vm_offset_t)v, + round_page(v+1), FALSE); } else v=0; rv = vm_fault(map, va, ftype, FALSE); if (rv == KERN_SUCCESS) { @@ -543,8 +545,9 @@ int trapwrite(addr) v = vm->vm_maxsaddr; grow_amount = MAXSSIZ - (vm->vm_ssize << PGSHIFT); } - if (vm_allocate(&vm->vm_map, &v, grow_amount, FALSE) != - KERN_SUCCESS) { + if (vm_allocate(&vm->vm_map, (vm_offset_t *)&v, + grow_amount, FALSE) + != KERN_SUCCESS) { return(1); } } @@ -613,13 +616,13 @@ syscall(frame) frame.sf_eflags |= PSL_C; /* carry bit */ #ifdef KTRACE if (KTRPOINT(p, KTR_SYSCALL)) - ktrsyscall(p->p_tracep, code, callp->sy_narg, &args); + ktrsyscall(p->p_tracep, code, callp->sy_narg, args); #endif goto done; } #ifdef KTRACE if (KTRPOINT(p, KTR_SYSCALL)) - ktrsyscall(p->p_tracep, code, callp->sy_narg, &args); + ktrsyscall(p->p_tracep, code, callp->sy_narg, args); #endif rval[0] = 0; rval[1] = frame.sf_edx; diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 773cf21649..4bfaddf62e 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -37,7 +37,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.6 1993/10/15 10:34:29 rgrimes Exp $ + * $Id: vm_machdep.c,v 1.7 1993/11/25 01:31:02 wollman Exp $ */ #include "npx.h" @@ -95,7 +95,7 @@ cpu_fork(p1, p2) addr = trunc_page((u_int)vtopte(kstack)); vm_map_pageable(&p2->p_vmspace->vm_map, addr, addr+NBPG, FALSE); for (i=0; i < UPAGES; i++) - pmap_enter(&p2->p_vmspace->vm_pmap, kstack+i*NBPG, + pmap_enter(&p2->p_vmspace->vm_pmap, (vm_offset_t)kstack+i*NBPG, pmap_extract(kernel_pmap, ((int)p2->p_addr)+i*NBPG), /* * The user area has to be mapped writable because @@ -236,16 +236,16 @@ pagemove(from, to, size) /* * Convert kernel VA to physical address */ -int +u_long kvtop(addr) - register caddr_t addr; + register void *addr; { vm_offset_t va; va = pmap_extract(kernel_pmap, (vm_offset_t)addr); if (va == 0) panic("kvtop: zero page frame"); - return((int)va); + return((u_long)va); } #ifdef notdef diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h index adaa70cc91..2c2b307549 100644 --- a/sys/i386/include/cpufunc.h +++ b/sys/i386/include/cpufunc.h @@ -2,7 +2,7 @@ * Functions to provide access to special i386 instructions. * XXX - bezillions more are defined in locore.s but are not declared anywhere. * - * $Id: cpufunc.h,v 1.4 1993/11/07 17:42:47 wollman Exp $ + * $Id: cpufunc.h,v 1.5 1993/11/25 01:31:07 wollman Exp $ */ #ifndef _MACHINE_CPUFUNC_H_ @@ -177,7 +177,34 @@ strlen(s1) return (len); } +struct quehead { + struct quehead *qh_link; + struct quehead *qh_rlink; +}; + +static inline void +insque(void *a, void *b) +{ + register struct quehead *element = a, *head = b; + element->qh_link = head->qh_link; + head->qh_link = (struct quehead *)element; + element->qh_rlink = (struct quehead *)head; + ((struct quehead *)(element->qh_link))->qh_rlink + = (struct quehead *)element; +} + +static inline void +remque(void *a) +{ + register struct quehead *element = a; + ((struct quehead *)(element->qh_link))->qh_rlink = element->qh_rlink; + ((struct quehead *)(element->qh_rlink))->qh_link = element->qh_link; + element->qh_rlink = 0; +} + #else /* not __GNUC__ */ +extern void insque __P((void *, void *)); +extern void remque __P((void *)); int bdb __P((void)); void disable_intr __P((void)); @@ -187,17 +214,19 @@ void outb __P((u_int port, u_int data)); /* XXX - incompat */ #endif /* __GNUC__ */ -#define really_u_int int /* XXX */ -#define really_void int /* XXX */ - void load_cr0 __P((u_int cr0)); -really_u_int rcr0 __P((void)); - -#ifdef notyet -really_void setidt __P((int idx, /*XXX*/caddr_t func, int typ, int dpl)); -#endif - -#undef really_u_int -#undef really_void +u_int rcr0 __P((void)); +void load_cr3(u_long); +u_long rcr3(void); +u_long rcr2(void); + +void setidt __P((int, void (*)(), int, int)); +extern u_long kvtop(void *); +extern void tlbflush(void); +extern void outw(int /*u_short*/, int /*u_short*/); /* XXX inline!*/ +extern void outsb(int /*u_short*/, caddr_t, size_t); +extern void outsw(int /*u_short*/, caddr_t, size_t); +extern void insw(int /*u_short*/, caddr_t, size_t); +extern void fillw(int /*u_short*/, caddr_t, size_t); #endif /* _MACHINE_CPUFUNC_H_ */ diff --git a/sys/i386/include/frame.h b/sys/i386/include/frame.h index a7455b6f99..c61d17901d 100644 --- a/sys/i386/include/frame.h +++ b/sys/i386/include/frame.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)frame.h 5.2 (Berkeley) 1/18/91 - * $Id: frame.h,v 1.4 1993/11/17 23:25:03 wollman Exp $ + * $Id: frame.h,v 1.5 1993/12/03 05:10:00 alm Exp $ */ #ifndef _MACHINE_FRAME_H_ @@ -72,6 +72,8 @@ struct trapframe { int tf_ss; }; +extern int kdb_trap(int, int, struct trapframe *); + /* Interrupt stack frame */ struct intrframe { diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h index 8f46b47206..e5beba34bc 100644 --- a/sys/i386/include/param.h +++ b/sys/i386/include/param.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)param.h 5.8 (Berkeley) 6/28/91 - * $Id: param.h,v 1.9 1993/11/13 02:25:14 davidg Exp $ + * $Id: param.h,v 1.10 1993/11/18 05:02:05 rgrimes Exp $ */ #ifndef _MACHINE_PARAM_H_ @@ -71,8 +71,8 @@ * defined in pmap.h which is included after this we can't do that * (YET!) */ -#define KERNBASE 0xFE000000 /* start of kernel virtual */ -#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) +#define KERNBASE 0xFE000000UL /* start of kernel virtual */ +#define BTOPKERNBASE (KERNBASE >> PGSHIFT) #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ #define DEV_BSIZE (1 << DEV_BSHIFT) diff --git a/sys/i386/include/pmap.h b/sys/i386/include/pmap.h index 9feb23cce3..f71c276cb5 100644 --- a/sys/i386/include/pmap.h +++ b/sys/i386/include/pmap.h @@ -42,7 +42,7 @@ * * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 - * $Id: pmap.h,v 1.5 1993/11/07 17:43:02 wollman Exp $ + * $Id: pmap.h,v 1.6 1993/11/13 02:25:16 davidg Exp $ */ #ifndef _PMAP_MACHINE_ @@ -65,8 +65,8 @@ unsigned int pd_pfnum:20; /* physical page frame number of pte's*/ }; -#define PD_MASK 0xffc00000 /* page directory address bits */ -#define PT_MASK 0x003ff000 /* page table address bits */ +#define PD_MASK 0xffc00000UL /* page directory address bits */ +#define PT_MASK 0x003ff000UL /* page table address bits */ #define PD_SHIFT 22 /* page directory address shift */ #define PG_SHIFT 12 /* page table address shift */ @@ -94,7 +94,7 @@ unsigned int #define PG_N 0x00000800 /* Non-cacheable */ #define PG_M 0x00000040 #define PG_U 0x00000020 -#define PG_FRAME 0xfffff000 +#define PG_FRAME 0xfffff000UL #define PG_NOACC 0 #define PG_KR 0x00000000 @@ -199,7 +199,7 @@ extern pmap_t kernel_pmap; #define PMAP_ACTIVATE(pmapp, pcbp) \ if ((pmapp) != NULL /*&& (pmapp)->pm_pdchanged */) { \ (pcbp)->pcb_cr3 = \ - pmap_extract(kernel_pmap, (pmapp)->pm_pdir); \ + pmap_extract(kernel_pmap, (vm_offset_t)(pmapp)->pm_pdir); \ if ((pmapp) == &curproc->p_vmspace->vm_pmap) \ load_cr3((pcbp)->pcb_cr3); \ (pmapp)->pm_pdchanged = FALSE; \ @@ -232,6 +232,24 @@ pv_entry_t pv_table; /* array of entries, one per page */ #define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) +extern pmap_t pmap_create(vm_size_t); +extern void pmap_pinit(struct pmap *); +extern void pmap_destroy(pmap_t); +extern void pmap_release(struct pmap *); +extern void pmap_reference(pmap_t); +extern void pmap_remove(struct pmap *, vm_offset_t, vm_offset_t); +extern void pmap_protect(struct pmap *, vm_offset_t, vm_offset_t, vm_prot_t); +extern void pmap_enter(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t, boolean_t); +extern void pmap_change_wiring(pmap_t, vm_offset_t, boolean_t); +extern struct pte *pmap_pte(pmap_t, vm_offset_t); +extern vm_offset_t pmap_extract(pmap_t, vm_offset_t); +extern void pmap_copy(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t); +extern void pmap_collect(pmap_t); +struct pcb; extern void pmap_activate(pmap_t, struct pcb *); +extern pmap_t pmap_kernel(void); +extern void pmap_pageable(pmap_t, vm_offset_t, vm_offset_t, boolean_t); + + #endif /* KERNEL */ #endif /* _PMAP_MACHINE_ */ diff --git a/sys/i386/include/vmparam.h b/sys/i386/include/vmparam.h index a43615da88..b7a3561fff 100644 --- a/sys/i386/include/vmparam.h +++ b/sys/i386/include/vmparam.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 - * $Id: vmparam.h,v 1.7 1993/10/15 10:07:45 rgrimes Exp $ + * $Id: vmparam.h,v 1.8 1993/11/07 17:43:17 wollman Exp $ */ @@ -56,27 +56,27 @@ * Immediately after the user structure is the page table map, and then * kernal address space. */ -#define USRTEXT 0 -#define USRSTACK 0xFDBFE000 +#define USRTEXT 0UL +#define USRSTACK 0xFDBFE000UL #define BTOPUSRSTACK (0xFDC00-(UPAGES)) /* btop(USRSTACK) */ -#define LOWPAGES 0 +#define LOWPAGES 0UL #define HIGHPAGES UPAGES /* * Virtual memory related constants, all in bytes */ -#define MAXTSIZ (6*1024*1024) /* max text size */ +#define MAXTSIZ (6UL*1024*1024) /* max text size */ #ifndef DFLDSIZ -#define DFLDSIZ (16*1024*1024) /* initial data size limit */ +#define DFLDSIZ (16UL*1024*1024) /* initial data size limit */ #endif #ifndef MAXDSIZ -#define MAXDSIZ (32*1024*1024) /* max data size */ +#define MAXDSIZ (32UL*1024*1024) /* max data size */ #endif #ifndef DFLSSIZ -#define DFLSSIZ (512*1024) /* initial stack size limit */ +#define DFLSSIZ (512UL*1024) /* initial stack size limit */ #endif #ifndef MAXSSIZ -#define MAXSSIZ (8*1024*1024) /* max stack size */ +#define MAXSSIZ (8UL*1024*1024) /* max stack size */ #endif /* @@ -211,15 +211,15 @@ /* user/kernel map constants */ #define VM_MIN_ADDRESS ((vm_offset_t)0) -#define VM_MAXUSER_ADDRESS ((vm_offset_t)0xFDBFE000) -#define UPT_MIN_ADDRESS ((vm_offset_t)0xFDC00000) -#define UPT_MAX_ADDRESS ((vm_offset_t)0xFDFF7000) +#define VM_MAXUSER_ADDRESS ((vm_offset_t)0xFDBFE000UL) +#define UPT_MIN_ADDRESS ((vm_offset_t)0xFDC00000UL) +#define UPT_MAX_ADDRESS ((vm_offset_t)0xFDFF7000UL) #define VM_MAX_ADDRESS UPT_MAX_ADDRESS -#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xFDFF7000) +#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xFDFF7000UL) #define UPDT VM_MIN_KERNEL_ADDRESS -#define KPT_MIN_ADDRESS ((vm_offset_t)0xFDFF8000) -#define KPT_MAX_ADDRESS ((vm_offset_t)0xFDFFF000) -#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xFF7FF000) +#define KPT_MIN_ADDRESS ((vm_offset_t)0xFDFF8000UL) +#define KPT_MAX_ADDRESS ((vm_offset_t)0xFDFFF000UL) +#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xFF7FF000UL) /* virtual sizes (bytes) for various kernel submaps */ #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) diff --git a/sys/i386/isa/aha1542.c b/sys/i386/isa/aha1542.c index 10cb47c041..c0e50ebe45 100644 --- a/sys/i386/isa/aha1542.c +++ b/sys/i386/isa/aha1542.c @@ -12,7 +12,7 @@ * on the understanding that TFS is not responsible for the correct * functioning of this software in any circumstances. * - * $Id: aha1542.c,v 1.15 1993/11/18 05:02:12 rgrimes Exp $ + * $Id: aha1542.c,v 1.16 1993/11/25 01:31:22 wollman Exp $ */ /* @@ -38,12 +38,7 @@ #ifdef KERNEL #include "ddb.h" -#if NDDB > 0 -int Debugger(); -#else /* NDDB */ -#define Debugger() panic("should call debugger here (adaptec.c)") -#endif /* NDDB */ -extern int hz; +#include "kernel.h" #else /*KERNEL */ #define NAHA 1 #endif /*KERNEL */ @@ -686,7 +681,7 @@ ahaintr(unit) #endif /*AHADEBUG */ } if (ccb) { - untimeout(aha_timeout, ccb); + untimeout(aha_timeout, (caddr_t)ccb); aha_done(unit, ccb); } aha->aha_mbx.mbi[i].stat = AHA_MBI_FREE; @@ -776,7 +771,7 @@ aha_done(unit, ccb) */ if (!(xs->flags & INUSE)) { printf("aha%d: exiting but not in use!\n", unit); - Debugger(); + Debugger("aha1542"); } if (((ccb->host_stat != AHA_OK) || (ccb->target_stat != SCSI_OK)) && ((xs->flags & SCSI_ERR_OK) == 0)) { @@ -1252,7 +1247,7 @@ aha_poll(unit, xs, ccb) * because we are polling, * take out the timeout entry aha_timeout made */ - untimeout(aha_timeout, ccb); + untimeout(aha_timeout, (caddr_t)ccb); count = 2000; while (count) { /* @@ -1428,7 +1423,7 @@ aha_timeout(caddr_t arg1, int arg2) */ if (ccb->mbx->cmd != AHA_MBO_FREE) { printf("\nadapter not taking commands.. frozen?!\n"); - Debugger(); + Debugger("aha1542"); } /* * If it has been through before, then diff --git a/sys/i386/isa/aha1742.c b/sys/i386/isa/aha1742.c index a1457db31d..991f5809b3 100644 --- a/sys/i386/isa/aha1742.c +++ b/sys/i386/isa/aha1742.c @@ -14,7 +14,7 @@ * * commenced: Sun Sep 27 18:14:01 PDT 1992 * - * $Id: aha1742.c,v 1.11 1993/11/18 05:02:15 rgrimes Exp $ + * $Id: aha1742.c,v 1.12 1993/11/25 01:31:25 wollman Exp $ */ #include @@ -46,11 +46,6 @@ int Debugger(); # endif /* DDB */ # else #include "ddb.h" -#if NDDB > 0 -int Debugger(); -#else /* NDDB */ -#define Debugger() panic("should call debugger here (adaptec.c)") -#endif /* NDDB */ #endif /* netbsd */ #else /* KERNEL */ #define NAHB 1 @@ -61,7 +56,7 @@ typedef timeout_func_t timeout_t; #endif typedef unsigned long int physaddr; -extern int hz; +#include "kernel.h" #define KVTOPHYS(x) vtophys(x) @@ -360,7 +355,7 @@ ahb_send_mbox(int unit, int opcode, int target, struct ecb *ecb) } if (wait == 0) { printf("ahb%d: board not responding\n", unit); - Debugger(); + Debugger("aha1742"); } outl(port + MBOXOUT0, KVTOPHYS(ecb)); /* don't know this will work */ outb(port + ATTN, opcode | target); @@ -416,7 +411,7 @@ ahb_send_immed(int unit, int target, u_long cmd) DELAY(10); } if (wait == 0) { printf("ahb%d: board not responding\n", unit); - Debugger(); + Debugger("aha1742"); } outl(port + MBOXOUT0, cmd); /* don't know this will work */ outb(port + G2CNTRL, G2CNTRL_SET_HOST_READY); diff --git a/sys/i386/isa/bt742a.c b/sys/i386/isa/bt742a.c index 4d9947b5ac..5062f1bb43 100644 --- a/sys/i386/isa/bt742a.c +++ b/sys/i386/isa/bt742a.c @@ -12,7 +12,7 @@ * on the understanding that TFS is not responsible for the correct * functioning of this software in any circumstances. * - * $Id: bt742a.c,v 1.10 1993/11/18 05:02:17 rgrimes Exp $ + * $Id: bt742a.c,v 1.11 1993/11/25 01:31:27 wollman Exp $ */ /* @@ -39,16 +39,11 @@ #ifdef KERNEL #include "ddb.h" -#if NDDB > 0 -int Debugger(); -#else /* NDDB */ -#define Debugger() panic("should call debugger here (bt742a.c)") -#endif /* NDDB */ +#include "kernel.h" #else /*KERNEL */ #define NBT 1 #endif /*KERNEL */ -extern int hz; typedef unsigned long int physaddr; /* @@ -721,7 +716,7 @@ btintr(unit) } wmbi->stat = BT_MBI_FREE; if (ccb) { - untimeout(bt_timeout, ccb); + untimeout(bt_timeout, (caddr_t)ccb); bt_done(unit, ccb); } /* Set the IN mail Box pointer for next */ bt_nextmbx(wmbi, wmbx, mbi); @@ -900,7 +895,8 @@ bt_send_mbo(int unit, int flags, int cmd, struct bt_ccb *ccb) return ((BT_MBO *) 0); } outb(BT_CMD_DATA_PORT, 0x01); /* Enable */ - sleep(wmbx, PRIBIO); /*XXX *//*can't do this! */ + tsleep((caddr_t)wmbx, PRIBIO, "btsend", 0); + /* XXX */ /*can't do this! */ /* May be servicing an int */ } /* Link CCB to the Mail Box */ @@ -1401,7 +1397,7 @@ bt_poll(unit, xs, ccb) * because we are polling, take out the timeout entry * bt_timeout made */ - untimeout(bt_timeout, ccb); + untimeout(bt_timeout, (caddr_t)ccb); count = 2000; while (count) { /* @@ -1456,7 +1452,7 @@ bt_timeout(caddr_t arg1, int arg2) if (bt_ccb_phys_kv(bt, ccb->mbx->ccb_addr) == ccb && ccb->mbx->cmd != BT_MBO_FREE) { printf("bt%d: not taking commands!\n", unit); - Debugger(); + Debugger("bt742a"); } /* * If it has been through before, then diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index 836bff01c9..cc26d186f0 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.3 1993/11/04 01:56:31 ache Exp $ + * $Id: clock.c,v 1.4 1993/11/25 01:31:29 wollman Exp $ */ /* @@ -233,7 +233,7 @@ resettodr() * Wire clock interrupt in. */ #define V(s) __CONCAT(V, s) -extern V(clk)(); +extern void V(clk)(); void enablertclock() diff --git a/sys/i386/isa/com.c b/sys/i386/isa/com.c index f745e07880..408004e8e0 100644 --- a/sys/i386/isa/com.c +++ b/sys/i386/isa/com.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: com.c,v 1.5 1993/10/16 13:45:46 rgrimes Exp $ + * $Id: com.c,v 1.6 1993/11/25 01:31:30 wollman Exp $ */ #include "com.h" @@ -58,6 +58,7 @@ #include "i386/isa/ic/ns16550.h" #define cominor(d) +static int commctl(int /*dev_t*/, int, int); static int comprobe(); static int comattach(); void comintr(int); @@ -588,7 +589,7 @@ comstop(tp, flag) splx(s); } -int +static int commctl(dev, bits, how) dev_t dev; int bits, how; diff --git a/sys/i386/isa/fd.c b/sys/i386/isa/fd.c index 9dcc2cb65b..ef24eb0adf 100644 --- a/sys/i386/isa/fd.c +++ b/sys/i386/isa/fd.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.14 1993/12/16 19:47:42 ache Exp $ + * $Id: fd.c,v 1.16 1993/12/19 00:40:49 ache Exp $ * */ @@ -165,6 +165,8 @@ typedef int fdsu_t; typedef struct fd_data *fd_p; typedef struct fdc_data *fdc_p; +static int retrier(fdcu_t); + #define DEVIDLE 0 #define FINDWORK 1 #define DOSEEK 2 @@ -391,7 +393,7 @@ void fdstrategy(struct buf *bp) dp = &(fdc->head); s = splbio(); disksort(dp, bp); - untimeout(fd_turnoff,fdu); /* a good idea */ + untimeout(fd_turnoff, (caddr_t)fdu); /* a good idea */ fdstart(fdcu); splx(s); return; @@ -762,7 +764,7 @@ fdstate(fdcu, fdc) TRACE1("fd%d",fdu); TRACE1("[%s]",fdstates[fdc->state]); TRACE1("(0x%x)",fd->flags); - untimeout(fd_turnoff, fdu); + untimeout(fd_turnoff, (caddr_t)fdu); timeout(fd_turnoff, (caddr_t)fdu, 4 * hz); switch (fdc->state) { @@ -810,7 +812,7 @@ fdstate(fdcu, fdc) timeout(fd_timeout, (caddr_t)fdcu, 2 * hz); return(0); /* will return later */ case SEEKWAIT: - untimeout(fd_timeout,fdcu); + untimeout(fd_timeout, (caddr_t)fdcu); /* allow heads to settle */ timeout(fd_pseudointr, (caddr_t)fdcu, hz / 50); fdc->state = SEEKCOMPLETE; @@ -883,7 +885,7 @@ fdstate(fdcu, fdc) timeout(fd_timeout, (caddr_t)fdcu, 2 * hz); return(0); /* will return later */ case IOCOMPLETE: /* IO DONE, post-analyze */ - untimeout(fd_timeout,fdcu); + untimeout(fd_timeout, (caddr_t)fdcu); for(i=0;i<7;i++) { fdc->status[i] = in_fdc(fdcu); @@ -994,7 +996,7 @@ fdstate(fdcu, fdc) return(1); /* Come back immediatly to new state */ } -int +static int retrier(fdcu) fdcu_t fdcu; { diff --git a/sys/i386/isa/icu.s b/sys/i386/isa/icu.s index 1a71eadfa0..fd4f523712 100644 --- a/sys/i386/isa/icu.s +++ b/sys/i386/isa/icu.s @@ -36,7 +36,7 @@ * * @(#)icu.s 7.2 (Berkeley) 5/21/91 * - * $Id: icu.s,v 1.4 1993/11/13 02:25:21 davidg Exp $ + * $Id: icu.s,v 1.5 1993/11/25 01:31:33 wollman Exp $ */ /* @@ -211,6 +211,10 @@ none_to_unpend: DONET(NETISR_ISO, _clnlintr, 9) #endif /* ISO */ +#ifdef CCITT + DONET(NETISR_CCITT, _pkintr, 29) +#endif /* CCITT */ + FASTSPL($0) test_ASTs: btrl $NETISR_SCLK,_netisr diff --git a/sys/i386/isa/if_ed.c b/sys/i386/isa/if_ed.c index 30d37e602a..5ab5507e3b 100644 --- a/sys/i386/isa/if_ed.c +++ b/sys/i386/isa/if_ed.c @@ -20,7 +20,7 @@ */ /* - * $Id: if_ed.c,v 2.16 1993/11/29 16:55:56 davidg Exp davidg $ + * $Id: if_ed.c,v 1.25 1993/11/29 17:07:26 davidg Exp $ */ /* @@ -1596,7 +1596,7 @@ outloop: /* copy trailer_header into a data structure */ m_copydata(m0, off, sizeof(struct trailer_header), - &trailer_header.ether_type); + (caddr_t)&trailer_header.ether_type); /* copy residual data */ m_copydata(m0, off+sizeof(struct trailer_header), diff --git a/sys/i386/isa/if_is.c b/sys/i386/isa/if_is.c index 2216604103..318c5b1bc6 100644 --- a/sys/i386/isa/if_is.c +++ b/sys/i386/isa/if_is.c @@ -502,7 +502,7 @@ is_start(ifp) /* copy trailer_header into a data structure */ m_copydata(m0, off, sizeof(struct trailer_header), - &trailer_header.ether_type); + (caddr_t)&trailer_header.ether_type); /* copy residual data */ resid = trailer_header.ether_residual - diff --git a/sys/i386/isa/isa.c b/sys/i386/isa/isa.c index b40ce6ec2e..c689200980 100644 --- a/sys/i386/isa/isa.c +++ b/sys/i386/isa/isa.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: isa.c,v 1.9 1993/11/17 00:21:03 ache Exp $ + * $Id: isa.c,v 1.10 1993/11/25 01:31:39 wollman Exp $ */ /* @@ -322,19 +322,22 @@ config_isadev(isdp, mp) #define IDTVEC(name) __CONCAT(X,name) /* default interrupt vector table entries */ -extern IDTVEC(intr0), IDTVEC(intr1), IDTVEC(intr2), IDTVEC(intr3), +typedef void inthand_t(); +typedef void (*inthand_func_t)(); +extern inthand_t + IDTVEC(intr0), IDTVEC(intr1), IDTVEC(intr2), IDTVEC(intr3), IDTVEC(intr4), IDTVEC(intr5), IDTVEC(intr6), IDTVEC(intr7), IDTVEC(intr8), IDTVEC(intr9), IDTVEC(intr10), IDTVEC(intr11), IDTVEC(intr12), IDTVEC(intr13), IDTVEC(intr14), IDTVEC(intr15); -static *defvec[16] = { +static inthand_func_t defvec[16] = { &IDTVEC(intr0), &IDTVEC(intr1), &IDTVEC(intr2), &IDTVEC(intr3), &IDTVEC(intr4), &IDTVEC(intr5), &IDTVEC(intr6), &IDTVEC(intr7), &IDTVEC(intr8), &IDTVEC(intr9), &IDTVEC(intr10), &IDTVEC(intr11), &IDTVEC(intr12), &IDTVEC(intr13), &IDTVEC(intr14), &IDTVEC(intr15) }; /* out of range default interrupt vector gate entry */ -extern IDTVEC(intrdefault); +extern inthand_t IDTVEC(intrdefault); /* * Fill in default interrupt table (in case of spuruious interrupt diff --git a/sys/i386/isa/isa_device.h b/sys/i386/isa/isa_device.h index d11f8b470f..f119df41c2 100644 --- a/sys/i386/isa/isa_device.h +++ b/sys/i386/isa/isa_device.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)isa_device.h 7.1 (Berkeley) 5/9/91 - * $Id: isa_device.h,v 1.2 1993/10/16 13:45:59 rgrimes Exp $ + * $Id: isa_device.h,v 1.3 1993/11/07 17:44:32 wollman Exp $ */ #ifndef _I386_ISA_ISA_DEVICE_H_ @@ -51,7 +51,7 @@ struct isa_device { short id_drq; /* DMA request */ caddr_t id_maddr; /* physical i/o memory address on bus (if any)*/ int id_msize; /* size of i/o memory */ - int (*id_intr)(); /* interrupt interface routine */ + void (*id_intr)(); /* interrupt interface routine */ int id_unit; /* unit number */ int id_flags; /* flags */ int id_scsiid; /* scsi id if needed */ @@ -75,4 +75,8 @@ extern struct isa_device isa_devtab_bio[], isa_devtab_tty[], isa_devtab_net[], isa_devtab_null[]; extern struct isa_device *find_isadev(/* table, driver, unit*/); + +extern void isa_dmastart(int, caddr_t, unsigned, unsigned); +extern void isa_dmadone(int, caddr_t, int, int); + #endif /* _I386_ISA_ISA_DEVICE_H_ */ diff --git a/sys/i386/isa/mcd.c b/sys/i386/isa/mcd.c index 97b3f51d99..f4802bcc44 100644 --- a/sys/i386/isa/mcd.c +++ b/sys/i386/isa/mcd.c @@ -34,7 +34,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: mcd.c,v 1.2 1993/10/16 13:46:13 rgrimes Exp $ + * $Id: mcd.c,v 1.3 1993/11/25 01:31:43 wollman Exp $ */ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; @@ -68,7 +68,7 @@ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; #undef MCD_TO_WARNING_ON #endif #else -#define MCD_TRACE(fmt,a,b,c,d) {if (mcd_data[unit].debug) {printf("mcd%d st=%02x: ",unit,mcd_data[unit].status); printf(fmt,a,b,c,d);}} +#define MCD_TRACE(fmt,a,b,c,xd) {if (mcd_data[unit].debug) {printf("mcd%d st=%02x: ",unit,mcd_data[unit].status); printf(fmt,a,b,c,xd);}} #endif #define mcd_part(dev) ((minor(dev)) & 7) @@ -158,7 +158,7 @@ static void hsg2msf(int hsg, bcd_t *msf); static int msf2hsg(bcd_t *msf); static int mcd_volinfo(int unit); static int mcd_waitrdy(int port,int dly); -static void mcd_doread(int state, struct mcd_mbx *mbxin); +static void mcd_doread(caddr_t, int); #ifndef MCDMINI static int mcd_setmode(int unit, int mode); static int mcd_getqchan(int unit, struct mcd_qchninfo *q); @@ -397,7 +397,7 @@ static void mcd_start(int unit) cd->mbx.p_offset = p->p_offset; /* calling the read routine */ - mcd_doread(MCD_S_BEGIN,&(cd->mbx)); + mcd_doread((caddr_t)MCD_S_BEGIN, (int)&(cd->mbx)); /* triggers mcd_start, when successful finished */ return; } @@ -811,8 +811,13 @@ mcdintr(unit) */ static struct mcd_mbx *mbxsave; -static void mcd_doread(int state, struct mcd_mbx *mbxin) +/* + * Good thing Alphas come with real CD players... + */ +static void mcd_doread(caddr_t xstate, int xmbxin) { + int state = (int)xstate; + struct mcd_mbx *mbxin = (struct mcd_mbx *)xmbxin; struct mcd_mbx *mbx = (state!=MCD_S_BEGIN) ? mbxsave : mbxin; int unit = mbx->unit; int port = mbx->port; @@ -836,7 +841,7 @@ loop: timeout((timeout_func_t)mcd_doread,(caddr_t)MCD_S_WAITSTAT,hz/100); /* XXX */ return; case MCD_S_WAITSTAT: - untimeout(mcd_doread,MCD_S_WAITSTAT); + untimeout(mcd_doread, (caddr_t)MCD_S_WAITSTAT); if (mbx->count-- >= 0) { if (inb(port+mcd_xfer) & MCD_ST_BUSY) { timeout((timeout_func_t)mcd_doread,(caddr_t)MCD_S_WAITSTAT,hz/100); /* XXX */ @@ -873,7 +878,7 @@ loop: } case MCD_S_WAITMODE: - untimeout(mcd_doread,MCD_S_WAITMODE); + untimeout(mcd_doread, (caddr_t)MCD_S_WAITMODE); if (mbx->count-- < 0) { #ifdef MCD_TO_WARNING_ON printf("mcd%d: timeout set mode\n",unit); @@ -911,7 +916,7 @@ nextblock: timeout((timeout_func_t)mcd_doread,(caddr_t)MCD_S_WAITREAD,hz/100); /* XXX */ return; case MCD_S_WAITREAD: - untimeout(mcd_doread,MCD_S_WAITREAD); + untimeout(mcd_doread,(caddr_t)MCD_S_WAITREAD); if (mbx->count-- > 0) { k = inb(port+mcd_xfer); if ((k & 2)==0) { diff --git a/sys/i386/isa/pccons.c b/sys/i386/isa/pccons.c index 1eb18214d8..8267af68bd 100644 --- a/sys/i386/isa/pccons.c +++ b/sys/i386/isa/pccons.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)pccons.c 5.11 (Berkeley) 5/21/91 - * $Id: pccons.c,v 1.8 1993/11/17 23:25:17 wollman Exp $ + * $Id: pccons.c,v 1.9 1993/11/25 01:31:46 wollman Exp $ */ /* @@ -116,7 +116,7 @@ struct isa_driver pcdriver = { static unsigned int addr_6845 = MONO_BASE; u_short *Crtat = (u_short *)MONO_BUF; -static openf; +static int openf; char *sgetc(int); static char *more_chars; @@ -707,7 +707,8 @@ sput(c, ka) } vs.kern_bg_at = BG_BLACK; - fillw(((vs.bg_at|vs.fg_at)<<8)|' ', crtat, COL*ROW-cursorat); + fillw(((vs.bg_at|vs.fg_at)<<8)|' ', (caddr_t)crtat, + COL*ROW-cursorat); } /* which attributes do we use? */ @@ -805,17 +806,17 @@ sput(c, ka) if (vs.cx == 0) /* ... to end of display */ fillw((at << 8) + ' ', - crtat, + (caddr_t)crtat, Crtat + vs.ncol * vs.nrow - crtat); else if (vs.cx == 1) /* ... to next location */ fillw((at << 8) + ' ', - Crtat, + (caddr_t)Crtat, crtat - Crtat + 1); else if (vs.cx == 2) /* ... whole display */ fillw((at << 8) + ' ', - Crtat, + (caddr_t)Crtat, vs.ncol * vs.nrow); vs.esc = 0; vs.ebrac = 0; vs.eparm = 0; @@ -824,17 +825,17 @@ sput(c, ka) if (vs.cx == 0) /* ... current to EOL */ fillw((at << 8) + ' ', - crtat, + (caddr_t)crtat, vs.ncol - (crtat - Crtat) % vs.ncol); else if (vs.cx == 1) /* ... beginning to next */ fillw((at << 8) + ' ', - crtat - (crtat - Crtat) % vs.ncol, + (caddr_t)crtat - (crtat - Crtat) % vs.ncol, ((crtat - Crtat) % vs.ncol) + 1); else if (vs.cx == 2) /* ... entire line */ fillw((at << 8) + ' ', - crtat - (crtat - Crtat) % vs.ncol, + (caddr_t)crtat - (crtat - Crtat) % vs.ncol, vs.ncol); vs.esc = 0; vs.ebrac = 0; vs.eparm = 0; break; @@ -852,14 +853,17 @@ sput(c, ka) case 'S': /* scroll up cx lines */ if (vs.cx <= 0) vs.cx = 1; bcopy(Crtat+vs.ncol*vs.cx, Crtat, vs.ncol*(vs.nrow-vs.cx)*CHR); - fillw((at <<8)+' ', Crtat+vs.ncol*(vs.nrow-vs.cx), vs.ncol*vs.cx); + fillw((at <<8)+' ', + ((caddr_t) Crtat + + vs.ncol * (vs.nrow - vs.cx)), + vs.ncol * vs.cx); /* crtat -= vs.ncol*vs.cx;*/ /* XXX */ vs.esc = 0; vs.ebrac = 0; vs.eparm = 0; break; case 'T': /* scroll down cx lines */ if (vs.cx <= 0) vs.cx = 1; bcopy(Crtat, Crtat+vs.ncol*vs.cx, vs.ncol*(vs.nrow-vs.cx)*CHR); - fillw((at <<8)+' ', Crtat, vs.ncol*vs.cx); + fillw((at <<8)+' ', (caddr_t)Crtat, vs.ncol*vs.cx); /* crtat += vs.ncol*vs.cx;*/ /* XXX */ vs.esc = 0; vs.ebrac = 0; vs.eparm = 0; break; @@ -924,7 +928,7 @@ sput(c, ka) } break; } else if (c == 'c') { /* Clear screen & home */ - fillw((at << 8) + ' ', Crtat, vs.ncol*vs.nrow); + fillw((at << 8) + ' ', (caddr_t)Crtat, vs.ncol*vs.nrow); crtat = Crtat; vs.col = 0; vs.esc = 0; vs.ebrac = 0; vs.eparm = 0; } else if (c == '[') { /* Start ESC [ sequence */ @@ -949,7 +953,7 @@ sput(c, ka) if (sc && crtat >= Crtat+vs.ncol*vs.nrow) { /* scroll check */ if (openf) do (void)sgetc(1); while (scroll); bcopy(Crtat+vs.ncol, Crtat, vs.ncol*(vs.nrow-1)*CHR); - fillw ((at << 8) + ' ', Crtat + vs.ncol*(vs.nrow-1), + fillw ((at << 8) + ' ', (caddr_t)Crtat + vs.ncol*(vs.nrow-1), vs.ncol); crtat -= vs.ncol; } @@ -1512,7 +1516,7 @@ loop: * Check for cntl-alt-esc */ if ((dt == 1) && ctrl_down && alt_down) { - Debugger(); + Debugger("manual escape to debugger"); dt |= 0x80; /* discard esc (ddb discarded ctrl-alt) */ } #endif diff --git a/sys/i386/isa/sound/dmabuf.c b/sys/i386/isa/sound/dmabuf.c index da20ec53d5..ace02d149a 100644 --- a/sys/i386/isa/sound/dmabuf.c +++ b/sys/i386/isa/sound/dmabuf.c @@ -510,9 +510,9 @@ DMAbuf_start_dma (int dev, unsigned long physaddr, int count, int dma_mode) printk ("sound: Invalid DMA mode for device %d\n", dev); isa_dmastart ((dma_mode == DMA_MODE_READ) ? B_READ : B_WRITE, - snd_raw_buf_phys[dev][0], - sound_buffsizes[dev], - chan); + (caddr_t)snd_raw_buf_phys[dev][0], + (unsigned)sound_buffsizes[dev], + (unsigned)chan); #else #ifdef ISC printk ("sound: Invalid DMA mode for device %d\n", dev); @@ -540,7 +540,7 @@ DMAbuf_start_dma (int dev, unsigned long physaddr, int count, int dma_mode) #else #ifdef __386BSD__ isa_dmastart ((dma_mode == DMA_MODE_READ) ? B_READ : B_WRITE, - physaddr, + (caddr_t)physaddr, count, chan); #else diff --git a/sys/i386/isa/sound/os.h b/sys/i386/isa/sound/os.h index 60fb96c24a..fba20980c3 100644 --- a/sys/i386/isa/sound/os.h +++ b/sys/i386/isa/sound/os.h @@ -110,12 +110,12 @@ typedef struct uio snd_rw_buf; * user space. The count is number of bytes to be moved. */ #define COPY_FROM_USER(target, source, offs, count) \ - do { if (uiomove(target, count, source)) { \ + do { if (uiomove(target, count, (struct uio *)source)) { \ printf ("sb: Bad copyin()!\n"); \ } } while(0) /* Like COPY_FOM_USER but for writes. */ #define COPY_TO_USER(target, offs, source, count) \ - do { if (uiomove(source, count, target)) { \ + do { if (uiomove(source, count, (struct uio *)target)) { \ printf ("sb: Bad copyout()!\n"); \ } } while(0) /* @@ -123,10 +123,10 @@ typedef struct uio snd_rw_buf; * short (16 bit) or long (32 bit) at a time. * The same restrictions apply than for COPY_*_USER */ -#define GET_BYTE_FROM_USER(target, addr, offs) {uiomove((char*)&(target), 1, addr);} -#define GET_SHORT_FROM_USER(target, addr, offs) {uiomove((char*)&(target), 2, addr);} -#define GET_WORD_FROM_USER(target, addr, offs) {uiomove((char*)&(target), 4, addr);} -#define PUT_WORD_TO_USER(addr, offs, data) {uiomove((char*)&(data), 4, addr);} +#define GET_BYTE_FROM_USER(target, addr, offs) {uiomove((char*)&(target), 1, (struct uio *)addr);} +#define GET_SHORT_FROM_USER(target, addr, offs) {uiomove((char*)&(target), 2, (struct uio *)addr);} +#define GET_WORD_FROM_USER(target, addr, offs) {uiomove((char*)&(target), 4, (struct uio *)addr);} +#define PUT_WORD_TO_USER(addr, offs, data) {uiomove((char*)&(data), 4, (struct uio *)addr);} /* * The way how the ioctl arguments are passed is another nonportable thing. @@ -224,6 +224,7 @@ typedef struct uio snd_rw_buf; * */ #define GET_TIME() get_time() +extern long get_time(void); /*#define GET_TIME() (lbolt)*/ /* Returns current time (1/HZ secs since boot) */ /* diff --git a/sys/i386/isa/sound/soundcard.c b/sys/i386/isa/sound/soundcard.c index b9044f3dc8..593f928983 100644 --- a/sys/i386/isa/sound/soundcard.c +++ b/sys/i386/isa/sound/soundcard.c @@ -75,7 +75,7 @@ int sndwrite (int dev, struct uio *uio); int sndselect (int dev, int rw); static void sound_mem_init(void); -int +long get_time() { extern struct timeval time; @@ -393,7 +393,7 @@ sndattach (struct isa_device *dev) static int midi_initialized = 0; static int seq_initialized = 0; static int generic_midi_initialized = 0; - unsigned long mem_start = 0xefffffff; + unsigned long mem_start = 0xefffffffUL; struct address_info hw_config; hw_config.io_base = dev->id_iobase; @@ -514,7 +514,7 @@ void sound_stop_timer (void) { if (timer_running) - untimeout (sequencer_timer, 0); + untimeout ((timeout_func_t)sequencer_timer, 0); /* XXX should fix */ timer_running = 0; } @@ -555,7 +555,7 @@ sound_mem_init (void) if (sound_buffsizes[dev] > dma_pagesize) sound_buffsizes[dev] = dma_pagesize; - sound_buffsizes[dev] &= 0xfffff000; /* Truncate to n*4k */ + sound_buffsizes[dev] &= ~0xfff; /* Truncate to n*4k */ if (sound_buffsizes[dev] < 4096) sound_buffsizes[dev] = 4096; diff --git a/sys/i386/isa/ultra14f.c b/sys/i386/isa/ultra14f.c index 9ed59f99e5..5f6d7b0c19 100644 --- a/sys/i386/isa/ultra14f.c +++ b/sys/i386/isa/ultra14f.c @@ -19,7 +19,7 @@ * commenced: Sun Sep 27 18:14:01 PDT 1992 * slight mod to make work with 34F as well: Wed Jun 2 18:05:48 WST 1993 * - * $Id: ultra14f.c,v 1.12 1993/11/18 05:02:20 rgrimes Exp $ + * $Id: ultra14f.c,v 1.13 1993/11/25 01:31:50 wollman Exp $ */ #include @@ -46,11 +46,6 @@ #ifdef KERNEL #include "ddb.h" -#if NDDB > 0 -int Debugger(); -#else /* NDDB */ -#define Debugger() panic("should call debugger here") -#endif /* NDDB */ #else /*KERNEL */ #define NUHA 1 #endif /*KERNEL */ @@ -321,7 +316,7 @@ uha_send_mbox(int unit, struct mscp *mscp) } if (spincount == 0) { printf("uha%d: uha_send_mbox, board not responding\n", unit); - Debugger(); + Debugger("ultra14f"); } outl(port + UHA_OGM0, KVTOPHYS(mscp)); outb(port + UHA_LINT, (UHA_OGMINT)); @@ -348,7 +343,7 @@ uha_abort(int unit, struct mscp *mscp) if (spincount == 0); { printf("uha%d: uha_abort, board not responding\n", unit); - Debugger(); + Debugger("ultra14f"); } outl(port + UHA_OGM0, KVTOPHYS(mscp)); outb(port + UHA_LINT, UHA_ABORT); @@ -360,7 +355,7 @@ uha_abort(int unit, struct mscp *mscp) } if (abortcount == 0) { printf("uha%d: uha_abort, board not responding\n", unit); - Debugger(); + Debugger("ultra14f"); } if ((inb(port + UHA_SINT) & 0x10) != 0) { outb(port + UHA_SINT, UHA_ABORT_ACK); @@ -528,7 +523,7 @@ uhaintr(unit) printf("uha: BAD MSCP RETURNED\n"); return (0); /* whatever it was, it'll timeout */ } - untimeout(uha_timeout, mscp); + untimeout(uha_timeout, (caddr_t)mscp); uha_done(unit, mscp); } diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c index 85790cbe85..4852adba03 100644 --- a/sys/i386/isa/wd.c +++ b/sys/i386/isa/wd.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)wd.c 7.2 (Berkeley) 5/9/91 - * $Id: wd.c,v 1.16 1993/11/23 21:36:37 nate Exp $ + * $Id: wd.c,v 1.17 1993/11/25 01:31:52 wollman Exp $ */ /* TODO:peel out buffer at low ipl, speed improvement */ @@ -46,6 +46,7 @@ #include "param.h" #include "dkbad.h" #include "systm.h" +#include "kernel.h" #include "conf.h" #include "file.h" #include "stat.h" @@ -532,7 +533,7 @@ RETRY: } /* then send it! */ - outsw (wdc+wd_data, addr+du->dk_skip * DEV_BSIZE, + outsw (wdc + wd_data, (caddr_t)addr + du->dk_skip * DEV_BSIZE, DEV_BSIZE/sizeof(short)); du->dk_bc -= DEV_BSIZE; wdtimeout_status[unit] = 2; @@ -634,11 +635,11 @@ outt: /* suck in data */ insw (wdc+wd_data, - (int)bp->b_un.b_addr + du->dk_skip * DEV_BSIZE, chk); + (caddr_t)bp->b_un.b_addr + du->dk_skip * DEV_BSIZE, chk); du->dk_bc -= chk * sizeof(short); /* for obselete fractional sector reads */ - while (chk++ < 256) insw (wdc+wd_data, &dummy, 1); + while (chk++ < 256) insw (wdc + wd_data, (caddr_t)&dummy, 1); } wdxfer[du->dk_unit]++; @@ -1298,7 +1299,8 @@ wddump(dev_t dev) /* dump core after a system crash */ blkcnt = secpercyl - (blknum % secpercyl); /* keep transfer within current cylinder */ #endif - pmap_enter(kernel_pmap, CADDR1, trunc_page(addr), VM_PROT_READ, TRUE); + pmap_enter(kernel_pmap, (vm_offset_t)CADDR1, + trunc_page(addr), VM_PROT_READ, TRUE); /* compute disk address */ cylin = blknum / secpercyl; diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c index ccfb3fd191..1e9755301e 100644 --- a/sys/i386/isa/wt.c +++ b/sys/i386/isa/wt.c @@ -19,7 +19,7 @@ * the original CMU copyright notice. * * Version 1.3, Thu Nov 11 12:09:13 MSK 1993 - * $Id$ + * $Id: wt.c,v 1.4 1993/12/13 18:38:43 alm Exp $ * */ @@ -54,6 +54,8 @@ #if NWT > 0 #include "sys/param.h" +#include "systm.h" +#include "kernel.h" #include "sys/buf.h" #include "sys/fcntl.h" #include "sys/malloc.h" @@ -150,13 +152,11 @@ typedef struct { wtinfo_t wttab[NWT]; /* tape info by unit number */ -extern int hz; /* number of ticks per second */ - static int wtwait (wtinfo_t *t, int catch, char *msg); static int wtcmd (wtinfo_t *t, int cmd); static int wtstart (wtinfo_t *t, unsigned mode, void *vaddr, unsigned len); static void wtdma (wtinfo_t *t); -static void wtimer (wtinfo_t *t); +static void wtimer (caddr_t, int); static void wtclock (wtinfo_t *t); static int wtreset (wtinfo_t *t); static int wtsense (wtinfo_t *t, int verb, int ignor); @@ -166,16 +166,8 @@ static int wtreadfm (wtinfo_t *t); static int wtwritefm (wtinfo_t *t); static int wtpoll (wtinfo_t *t, int mask, int bits); +/* XXX */ extern void DELAY (int usec); -extern void bcopy (void *from, void *to, unsigned len); -extern void isa_dmastart (int flags, void *addr, unsigned len, unsigned chan); -extern void isa_dmadone (int flags, void *addr, unsigned len, int chan); -extern void printf (char *str, ...); -extern int splbio (void); -extern int splx (int level); -extern void timeout (void (*func) (), void *arg, int timo); -extern int tsleep (void *chan, int priority, char *msg, int timo); -extern void wakeup (void *chan); /* * Probe for the presence of the device. @@ -569,7 +561,7 @@ void wtintr (int u) "rewind busy?\n" : "rewind finished\n")); t->flags &= ~TPREW; /* Rewind finished. */ wtsense (t, 1, TP_WRP); - wakeup (t); + wakeup ((caddr_t)t); return; } @@ -582,7 +574,7 @@ void wtintr (int u) if (! (s & t->NOEXCEP)) /* operation failed */ wtsense (t, 1, (t->flags & TPRMARK) ? TP_WRP : 0); t->flags &= ~(TPRMARK | TPWMARK); /* operation finished */ - wakeup (t); + wakeup ((caddr_t)t); return; } @@ -617,7 +609,7 @@ void wtintr (int u) t->flags |= TPVOL; /* end of file */ else t->flags |= TPEXCEP; /* i/o error */ - wakeup (t); + wakeup ((caddr_t)t); return; } @@ -629,7 +621,7 @@ void wtintr (int u) } if (t->dmacount > t->dmatotal) /* short last block */ t->dmacount = t->dmatotal; - wakeup (t); /* wake up user level */ + wakeup ((caddr_t)t); /* wake up user level */ DEBUG (("i/o finished, %d\n", t->dmacount)); } @@ -670,7 +662,7 @@ static int wtreadfm (wtinfo_t *t) /* write marker to the tape */ static int wtwritefm (wtinfo_t *t) { - tsleep (wtwritefm, WTPRI, "wtwfm", hz); /* timeout: 1 second */ + tsleep ((caddr_t)wtwritefm, WTPRI, "wtwfm", hz); /* timeout: 1 second */ t->flags &= ~(TPRO | TPWO); if (! wtcmd (t, QIC_WRITEFM)) { wtsense (t, 1, 0); @@ -703,7 +695,7 @@ static int wtpoll (wtinfo_t *t, int mask, int bits) s = inb (t->STATPORT); if ((s & mask) != bits) return (s); - tsleep (wtpoll, WTPRI, "wtpoll", 1); /* timeout: 1 tick */ + tsleep ((caddr_t)wtpoll, WTPRI, "wtpoll", 1); /* timeout: 1 tick */ } } @@ -733,7 +725,7 @@ static int wtwait (wtinfo_t *t, int catch, char *msg) DEBUG (("wtwait() `%s'\n", msg)); while (t->flags & (TPACTIVE | TPREW | TPRMARK | TPWMARK)) - if (error = tsleep (t, WTPRI | catch, msg, 0)) + if (error = tsleep ((caddr_t)t, WTPRI | catch, msg, 0)) return (error); return (0); } @@ -781,7 +773,7 @@ static void wtclock (wtinfo_t *t) t->flags |= TPTIMER; /* Some controllers seem to lose dma interrupts too often. * To make the tape stream we need 1 tick timeout. */ - timeout (wtimer, t, (t->flags & TPACTIVE) ? 1 : hz); + timeout (wtimer, (caddr_t)t, (t->flags & TPACTIVE) ? 1 : hz); } } @@ -790,8 +782,9 @@ static void wtclock (wtinfo_t *t) * This is necessary in case interrupts get eaten due to * multiple devices on a single IRQ line. */ -static void wtimer (wtinfo_t *t) +static void wtimer (caddr_t xt, int dummy) { + wtinfo_t *t = (wtinfo_t *)xt; int s; t->flags &= ~TPTIMER; diff --git a/sys/isofs/iso.h b/sys/isofs/iso.h index 09463b7c9c..ade2b39fc9 100644 --- a/sys/isofs/iso.h +++ b/sys/isofs/iso.h @@ -1,5 +1,5 @@ /* - * $Id: iso.h,v 1.3 1993/11/07 17:46:01 wollman Exp $ + * $Id: iso.h,v 1.4 1993/11/25 01:32:16 wollman Exp $ */ #ifndef _ISOFS_ISO_H_ @@ -114,4 +114,16 @@ int isofs_fhtovp __P((struct mount *mp, struct fid *fhp, struct vnode **vpp)); int isofs_vptofh __P((struct vnode *vp, struct fid *fhp)); void isofs_init __P((void)); +/* From isofs_util.c: */ +extern int isonum_711(char *); +extern int isonum_712(char *); +extern int isonum_721(char *); +extern int isonum_722(char *); +extern int isonum_723(char *); +extern int isonum_731(u_char *); +extern int isonum_732(u_char *); +extern int isonum_733(u_char *); +extern int isofncmp(char *, int, char *, int); +extern void isofntrans(char *, int, char *, int *); + #endif /* _ISOFS_ISO_H_ */ diff --git a/sys/isofs/isofs_bmap.c b/sys/isofs/isofs_bmap.c index 7f07c3d489..7773bd5449 100644 --- a/sys/isofs/isofs_bmap.c +++ b/sys/isofs/isofs_bmap.c @@ -1,8 +1,9 @@ /* - * $Id: isofs_bmap.c,v 1.2 1993/07/20 03:27:26 jkh Exp $ + * $Id: isofs_bmap.c,v 1.3 1993/11/25 01:32:21 wollman Exp $ */ #include "param.h" +#include "systm.h" #include "namei.h" #include "buf.h" #include "file.h" diff --git a/sys/isofs/isofs_node.h b/sys/isofs/isofs_node.h index 32a9df3e92..9b8382f0c3 100644 --- a/sys/isofs/isofs_node.h +++ b/sys/isofs/isofs_node.h @@ -1,5 +1,5 @@ /* - * $Id: isofs_node.h,v 1.3 1993/11/07 17:46:04 wollman Exp $ + * $Id: isofs_node.h,v 1.4 1993/11/25 01:32:26 wollman Exp $ */ #ifndef _ISOFS_ISOFS_NODE_H_ @@ -93,7 +93,16 @@ int isofs_strategy __P((struct buf *bp)); void isofs_print __P((struct vnode *vp)); int isofs_islocked __P((struct vnode *vp)); -void iso_ilock(struct iso_node *); -void iso_iunlock(struct iso_node *); +/* From isofs_node.c: */ +struct iso_directory_record; +extern void isofs_init(void); +extern int iso_iget(struct iso_node *, ino_t, struct iso_node **, + struct iso_directory_record *); +extern void iso_iput(struct iso_node *); +extern void iso_ilock(struct iso_node *); +extern void iso_iunlock(struct iso_node *); + + +extern int iso_blkatoff(struct iso_node *, off_t, char **, struct buf **); #endif /* _ISOFS_ISOFS_NODE_H_ */ diff --git a/sys/isofs/isofs_rrip.c b/sys/isofs/isofs_rrip.c index 7b32be6143..a1c0b6ae58 100644 --- a/sys/isofs/isofs_rrip.c +++ b/sys/isofs/isofs_rrip.c @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: isofs_rrip.c,v 1.3 1993/10/25 19:43:04 rgrimes Exp $ + * $Id: isofs_rrip.c,v 1.4 1993/11/25 01:32:27 wollman Exp $ */ #include "param.h" @@ -464,9 +464,9 @@ setdefault: * it will be return the translated ISO9660 name, */ int isofs_rrip_getname( isodir, outbuf, outlen ) -struct iso_directory_record *isodir; -char *outbuf; -int *outlen; + struct iso_directory_record *isodir; + char *outbuf; + int *outlen; { ISO_SUSP_HEADER *phead, *pend; ISO_RRIP_ALTNAME *p; diff --git a/sys/isofs/isofs_util.c b/sys/isofs/isofs_util.c index 3730325536..1b2199a20e 100644 --- a/sys/isofs/isofs_util.c +++ b/sys/isofs/isofs_util.c @@ -1,5 +1,5 @@ /* - * $Id: isofs_util.c,v 1.2 1993/07/20 03:27:33 jkh Exp $ + * $Id: isofs_util.c,v 1.3 1993/11/25 01:32:28 wollman Exp $ */ #include "param.h" @@ -14,19 +14,19 @@ char *p; int isonum_712 (p) -char *p; + char *p; { int val; val = *p; if (val & 0x80) - val |= 0xffffff00; + val |= ~0xff; return (val); } int isonum_721 (p) -char *p; + char *p; { return ((p[0] & 0xff) | ((p[1] & 0xff) << 8)); } diff --git a/sys/isofs/isofs_vfsops.c b/sys/isofs/isofs_vfsops.c index 92daa29b2e..efe2c543c0 100644 --- a/sys/isofs/isofs_vfsops.c +++ b/sys/isofs/isofs_vfsops.c @@ -1,5 +1,5 @@ /* - * $Id: isofs_vfsops.c,v 1.3 1993/10/24 04:29:08 rgrimes Exp $ + * $Id: isofs_vfsops.c,v 1.4 1993/11/25 01:32:30 wollman Exp $ */ #include "param.h" @@ -43,6 +43,8 @@ struct vfsops isofs_vfsops = { */ #define ROOTNAME "root_device" +static int iso_mountfs(struct vnode *, struct mount *, struct proc *); + int isofs_mountroot() { @@ -196,7 +198,7 @@ isofs_mount(mp, path, data, ndp, p) /* * Common code for mount and mountroot */ -int +static int iso_mountfs(devvp, mp, p) register struct vnode *devvp; struct mount *mp; diff --git a/sys/isofs/isofs_vnops.c b/sys/isofs/isofs_vnops.c index ffbce1e34c..86ba250afc 100644 --- a/sys/isofs/isofs_vnops.c +++ b/sys/isofs/isofs_vnops.c @@ -1,5 +1,5 @@ /* - * $Id: isofs_vnops.c,v 1.2 1993/07/20 03:27:37 jkh Exp $ + * $Id: isofs_vnops.c,v 1.3 1993/11/25 01:32:31 wollman Exp $ */ #include "param.h" #include "systm.h" @@ -317,27 +317,32 @@ isofs_readdir(vp, uio, cred, eofflagp) * */ switch (ep->name[0]) { - case 0: - dirent.d_name[0] = '.'; - dirent.d_namlen = 1; + case 0: + dirent.d_name[0] = '.'; + dirent.d_namlen = 1; + break; + case 1: + dirent.d_name[0] = '.'; + dirent.d_name[1] = '.'; + dirent.d_namlen = 2; + break; + default: + switch ( imp->iso_ftype ) { + case ISO_FTYPE_RRIP: + isofs_rrip_getname( ep, dirent.d_name, &dirent.d_namlen ); break; - case 1: - dirent.d_name[0] = '.'; - dirent.d_name[1] = '.'; - dirent.d_namlen = 2; + case ISO_FTYPE_9660: + { + int namelen = dirent.d_namlen; + isofntrans(ep->name, dirent.d_namlen, + dirent.d_name, &namelen); + dirent.d_namlen = namelen; break; + } default: - switch ( imp->iso_ftype ) { - case ISO_FTYPE_RRIP: - isofs_rrip_getname( ep, dirent.d_name, &dirent.d_namlen ); - break; - case ISO_FTYPE_9660: - isofntrans(ep->name, dirent.d_namlen, dirent.d_name, &dirent.d_namlen); - break; - default: - break; - } break; + } + break; } dirent.d_name[dirent.d_namlen] = 0; diff --git a/sys/kern/aout_imgact.c b/sys/kern/aout_imgact.c index e4314d40df..27defec362 100644 --- a/sys/kern/aout_imgact.c +++ b/sys/kern/aout_imgact.c @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: aout_imgact.c,v 1.3 1993/12/11 06:55:33 davidg Exp davidg $ + * $Id: aout_imgact.c,v 1.1 1993/12/12 12:23:18 davidg Exp $ */ #include "param.h" @@ -55,7 +55,7 @@ exec_aout_imgact(iparams) * We do two cases: host byte order and network byte order * (for NetBSD compatibility) */ - switch (a_out->a_magic & 0xffff) { + switch ((int)(a_out->a_magic & 0xffff)) { case ZMAGIC: virtual_offset = 0; if (a_out->a_text) { @@ -71,7 +71,7 @@ exec_aout_imgact(iparams) break; default: /* NetBSD compatibility */ - switch (ntohl(a_out->a_magic) & 0xffff) { + switch ((int)(ntohl(a_out->a_magic) & 0xffff)) { case ZMAGIC: case QMAGIC: virtual_offset = NBPG; diff --git a/sys/kern/dead_vnops.c b/sys/kern/dead_vnops.c index bc0459a6ab..de9350a1af 100644 --- a/sys/kern/dead_vnops.c +++ b/sys/kern/dead_vnops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)dead_vnops.c 7.13 (Berkeley) 4/15/91 - * $Id: dead_vnops.c,v 1.3 1993/11/07 21:44:40 wollman Exp $ + * $Id: dead_vnops.c,v 1.4 1993/11/25 01:32:42 wollman Exp $ */ #include "param.h" @@ -42,6 +42,8 @@ #include "namei.h" #include "buf.h" +static int chkvnlock(struct vnode *); + /* * Prototypes for dead operations on vnodes. */ @@ -417,7 +419,7 @@ dead_nullop() * We have to wait during times when the vnode is * in a state of change. */ -int +static int chkvnlock(vp) register struct vnode *vp; { diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index b062ed79de..842f908c61 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)init_main.c 7.41 (Berkeley) 5/15/91 - * $Id: init_main.c,v 1.9 1993/11/25 01:32:46 wollman Exp $ + * $Id: init_main.c,v 1.10 1993/11/25 13:16:07 davidg Exp $ */ #include "param.h" @@ -252,8 +252,8 @@ main() #endif /* kick off timeout driven events by calling first time */ - roundrobin(); - schedcpu(); + roundrobin(0, 0); + schedcpu(0, 0); enablertclock(); /* enable realtime clock interrupts */ /* diff --git a/sys/kern/kern__physio.c b/sys/kern/kern__physio.c index a0635de495..e9faec39f4 100644 --- a/sys/kern/kern__physio.c +++ b/sys/kern/kern__physio.c @@ -45,7 +45,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kern__physio.c,v 1.3 1993/11/18 05:02:33 rgrimes Exp $ + * $Id: kern__physio.c,v 1.4 1993/11/25 01:32:47 wollman Exp $ */ #include "param.h" @@ -58,8 +58,6 @@ #include "vm/vm.h" #include "specdev.h" -int physio(int (*)(), int, struct buf *, int, int, caddr_t, int *, struct proc *); - /* * Driver interface to do "raw" I/O in the address space of a * user process directly for read and write operations.. @@ -67,20 +65,27 @@ int physio(int (*)(), int, struct buf *, int, int, caddr_t, int *, struct proc * int rawread(dev, uio) - dev_t dev; struct uio *uio; + dev_t dev; + struct uio *uio; { - return (uioapply(physio, cdevsw[major(dev)].d_strategy, dev, uio)); + return (uioapply(physio, + (caddr_t)cdevsw[major(dev)].d_strategy, + (caddr_t)(u_long)dev, uio)); } int rawwrite(dev, uio) - dev_t dev; struct uio *uio; + dev_t dev; + struct uio *uio; { - return (uioapply(physio, cdevsw[major(dev)].d_strategy, dev, uio)); + return (uioapply(physio, + (caddr_t)cdevsw[major(dev)].d_strategy, + (caddr_t)(u_long)dev, uio)); } -int physio(strat, dev, bp, off, rw, base, len, p) - int (*strat)(); +int +physio(strat, dev, bp, off, rw, base, len, p) + d_strategy_t *strat; dev_t dev; struct buf *bp; int rw, off; @@ -136,7 +141,7 @@ int physio(strat, dev, bp, off, rw, base, len, p) /* 09 Sep 92*/ for (adr = (caddr_t)trunc_page(base); adr < base + bp->b_bcount; adr += NBPG) { vm_fault(&curproc->p_vmspace->vm_map, - adr, ftype, FALSE); + (vm_offset_t)adr, ftype, FALSE); *(int *) adr += zero; } diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index 6464ecc375..a0b3d16d14 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)kern_clock.c 7.16 (Berkeley) 5/9/91 - * $Id: kern_clock.c,v 1.9 1993/11/09 17:07:27 ache Exp $ + * $Id: kern_clock.c,v 1.10 1993/11/25 01:32:51 wollman Exp $ */ #include "param.h" @@ -40,6 +40,7 @@ #include "callout.h" #include "kernel.h" #include "proc.h" +#include "signalvar.h" #include "resourcevar.h" #include "machine/cpu.h" @@ -53,7 +54,6 @@ static void gatherstats(clockframe *); - /* From callout.h */ struct callout *callfree, *callout, calltodo; int ncallout; diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 90f94a1262..de80981159 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)kern_descrip.c 7.28 (Berkeley) 6/25/91 - * $Id: kern_descrip.c,v 1.4 1993/10/16 15:24:11 rgrimes Exp $ + * $Id: kern_descrip.c,v 1.5 1993/11/25 01:32:54 wollman Exp $ */ #include "param.h" @@ -50,6 +50,8 @@ #include "syslog.h" #include "resourcevar.h" +#include "vm/vm_user.h" + /* * Descriptor management. */ diff --git a/sys/kern/kern_execve.c b/sys/kern/kern_execve.c index bd08ab7bfd..56240a655f 100644 --- a/sys/kern/kern_execve.c +++ b/sys/kern/kern_execve.c @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kern_execve.c,v 1.4 1993/12/11 06:55:33 davidg Exp davidg $ + * $Id: kern_execve.c,v 1.10 1993/12/12 12:23:19 davidg Exp $ */ #include "param.h" @@ -50,6 +50,7 @@ #include "vm/vm_param.h" #include "vm/vm_map.h" #include "vm/vm_kern.h" +#include "vm/vm_user.h" #include "machine/reg.h" @@ -110,7 +111,8 @@ execve(p, uap, retval) * Allocate temporary demand zeroed space for argument and * environment strings */ - error = vm_allocate(kernel_map, &iparams->stringbase, ARG_MAX, TRUE); + error = vm_allocate(kernel_map, (vm_offset_t *)&iparams->stringbase, + ARG_MAX, TRUE); if (error) { log(LOG_WARNING, "execve: failed to allocate string space\n"); return (error); @@ -136,7 +138,8 @@ interpret: error = namei(ndp, p); if (error) { - vm_deallocate(kernel_map, iparams->stringbase, ARG_MAX); + vm_deallocate(kernel_map, (vm_offset_t)iparams->stringbase, + ARG_MAX); goto exec_fail; } @@ -178,16 +181,16 @@ interpret: * Map the image header (first page) of the file into * kernel address space */ - error = vm_mmap(kernel_map, /* map */ - &image_header, /* address */ - NBPG, /* size */ - VM_PROT_READ, /* protection */ - VM_PROT_READ, /* maximum protection */ - MAP_FILE, /* flags */ - vnodep, /* vnode */ - 0); /* offset */ + error = vm_mmap(kernel_map, /* map */ + (vm_offset_t *)&image_header, /* address */ + NBPG, /* size */ + VM_PROT_READ, /* protection */ + VM_PROT_READ, /* max protection */ + MAP_FILE, /* flags */ + (caddr_t)vnodep, /* vnode */ + 0); /* offset */ if (error) { - printf("mmap filed: %d\n",error); + printf("mmap failed: %d\n",error); goto exec_fail_dealloc; } iparams->image_header = image_header; @@ -214,7 +217,8 @@ interpret: /* free old vnode and name buffer */ vput(ndp->ni_vp); FREE(ndp->ni_pnbuf, M_NAMEI); - if (vm_deallocate(kernel_map, image_header, NBPG)) + if (vm_deallocate(kernel_map, + (vm_offset_t)image_header, NBPG)) panic("execve: header dealloc failed (1)"); /* set new name to that of the interpreter */ @@ -294,9 +298,10 @@ interpret: /* * free various allocated resources */ - if (vm_deallocate(kernel_map, iparams->stringbase, ARG_MAX)) + if (vm_deallocate(kernel_map, (vm_offset_t)iparams->stringbase, + ARG_MAX)) panic("execve: string buffer dealloc failed (1)"); - if (vm_deallocate(kernel_map, image_header, NBPG)) + if (vm_deallocate(kernel_map, (vm_offset_t)image_header, NBPG)) panic("execve: header dealloc failed (2)"); vput(ndp->ni_vp); FREE(ndp->ni_pnbuf, M_NAMEI); @@ -305,10 +310,12 @@ interpret: exec_fail_dealloc: if (iparams->stringbase && iparams->stringbase != (char *)-1) - if (vm_deallocate(kernel_map, iparams->stringbase, ARG_MAX)) + if (vm_deallocate(kernel_map, (vm_offset_t)iparams->stringbase, + ARG_MAX)) panic("execve: string buffer dealloc failed (2)"); if (iparams->image_header && iparams->image_header != (char *)-1) - if (vm_deallocate(kernel_map, image_header, NBPG)) + if (vm_deallocate(kernel_map, + (vm_offset_t)iparams->image_header, NBPG)) panic("execve: header dealloc failed (3)"); vput(ndp->ni_vp); FREE(ndp->ni_pnbuf, M_NAMEI); @@ -346,7 +353,8 @@ exec_new_vmspace(iparams) vm_deallocate(&vmspace->vm_map, 0, USRSTACK); /* Allocate a new stack */ - error = vm_allocate(&vmspace->vm_map, &stack_addr, DFLSSIZ, FALSE); + error = vm_allocate(&vmspace->vm_map, (vm_offset_t *)&stack_addr, + DFLSSIZ, FALSE); if (error) return(error); diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 338133738a..0534196291 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)kern_exit.c 7.35 (Berkeley) 6/27/91 - * $Id: kern_exit.c,v 1.9 1993/10/19 01:01:20 nate Exp $ + * $Id: kern_exit.c,v 1.10 1993/11/25 01:32:57 wollman Exp $ */ #include "param.h" @@ -48,6 +48,7 @@ #include "vnode.h" #include "syslog.h" #include "malloc.h" +#include "signalvar.h" #include "resourcevar.h" #include "machine/cpu.h" @@ -258,7 +259,24 @@ done: /* NOTREACHED */ } +/* + * Wait: check child processes to see if any have exited, + * stopped under trace, or (optionally) stopped by a signal. + * Pass back status and deallocate exited child's proc structure. + */ + +struct wait1_args { + int pid; + int *status; + int options; + struct rusage *rusage; +#ifdef COMPAT_43 + int compat; +#endif +}; + #ifdef COMPAT_43 +static int wait1(struct proc *, struct wait1_args *, int *); struct owait_args { int pid; @@ -280,7 +298,7 @@ owait(p, uap, retval) uap->pid = WAIT_ANY; uap->status = 0; uap->compat = 1; - return (wait1(p, uap, retval)); + return (wait1(p, (struct wait1_args *)uap, retval)); } struct wait4_args { @@ -299,29 +317,13 @@ wait4(p, uap, retval) { uap->compat = 0; - return (wait1(p, uap, retval)); + return (wait1(p, (struct wait1_args *)uap, retval)); } #else #define wait1 wait4 #endif -/* - * Wait: check child processes to see if any have exited, - * stopped under trace, or (optionally) stopped by a signal. - * Pass back status and deallocate exited child's proc structure. - */ - -struct wait1_args { - int pid; - int *status; - int options; - struct rusage *rusage; -#ifdef COMPAT_43 - int compat; -#endif -}; - -int +static int wait1(q, uap, retval) register struct proc *q; register struct wait1_args *uap; diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 1d4bfc9f45..7a03a72b46 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)kern_fork.c 7.29 (Berkeley) 5/15/91 - * $Id: kern_fork.c,v 1.4 1993/11/29 18:01:12 ache Exp $ + * $Id: kern_fork.c,v 1.5 1993/12/09 09:16:41 davidg Exp $ */ #include "param.h" @@ -47,6 +47,8 @@ #include "ktrace.h" #include "vm/vm.h" +static int fork1(struct proc *, int, int *); + /* ARGSUSED */ int fork(p, uap, retval) @@ -71,7 +73,7 @@ vfork(p, uap, retval) int nprocs = 1; /* process 0 */ -int +static int fork1(p1, isvfork, retval) register struct proc *p1; int isvfork, retval[]; diff --git a/sys/kern/kern_kinfo.c b/sys/kern/kern_kinfo.c index 4356755f3e..98c350ceee 100644 --- a/sys/kern/kern_kinfo.c +++ b/sys/kern/kern_kinfo.c @@ -31,10 +31,11 @@ * SUCH DAMAGE. * * from: @(#)kern_kinfo.c 7.17 (Berkeley) 6/26/91 - * $Id: kern_kinfo.c,v 1.7 1993/11/29 19:22:18 ache Exp $ + * $Id: kern_kinfo.c,v 1.8 1993/12/09 09:11:00 davidg Exp $ */ #include "param.h" +#include "systm.h" #include "proc.h" #include "kinfo.h" #include "ioctl.h" @@ -101,7 +102,7 @@ getkerninfo(p, uap, retval) while (kinfo_lock.kl_lock) { kinfo_lock.kl_want++; - tsleep(&kinfo_lock, PRIBIO+1, "kinflck", 0); + tsleep((caddr_t)&kinfo_lock, PRIBIO+1, "kinflck", 0); kinfo_lock.kl_want--; kinfo_lock.kl_locked++; } @@ -121,7 +122,7 @@ getkerninfo(p, uap, retval) release: kinfo_lock.kl_lock--; if (kinfo_lock.kl_want) - wakeup(&kinfo_lock); + wakeup((caddr_t)&kinfo_lock); done: if (!error) *retval = needed; diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index ee5703ec99..5d6180792e 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)kern_ktrace.c 7.15 (Berkeley) 6/21/91 - * $Id: kern_ktrace.c,v 1.4 1993/10/16 15:24:20 rgrimes Exp $ + * $Id: kern_ktrace.c,v 1.5 1993/11/25 01:33:00 wollman Exp $ */ #ifdef KTRACE @@ -47,8 +47,11 @@ #include "syslog.h" static void ktrwrite(struct vnode *, struct ktr_header *); +static int ktrops(struct proc *, struct proc *, int, int, struct vnode *); +static int ktrsetchildren(struct proc *, struct proc *, int, int, struct vnode *); +static int ktrcanset(struct proc *, struct proc *); -struct ktr_header * +static struct ktr_header * ktrgetheader(type) int type; { @@ -290,7 +293,7 @@ done: return (error); } -int +static int ktrops(curp, p, ops, facs, vp) struct proc *curp, *p; int ops; @@ -328,7 +331,7 @@ ktrops(curp, p, ops, facs, vp) return (1); } -int +static int ktrsetchildren(curp, top, ops, facs, vp) struct proc *curp, *top; int ops; @@ -420,7 +423,7 @@ ktrwrite(vp, kth) * * TODO: check groups. use caller effective gid. */ -int +static int ktrcanset(callp, targetp) struct proc *callp, *targetp; { diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index fcd6dc21c9..4b408ee201 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)kern_proc.c 7.16 (Berkeley) 6/28/91 - * $Id: kern_proc.c,v 1.2 1993/10/16 15:24:23 rgrimes Exp $ + * $Id: kern_proc.c,v 1.3 1993/11/25 01:33:03 wollman Exp $ */ #include "param.h" @@ -49,6 +49,10 @@ #include "ioctl.h" #include "tty.h" +struct prochd qs[NQS]; /* as good a place as any... */ +struct proc *zombproc; +struct proc *allproc; + static void pgdelete(struct pgrp *); static void orphanpg(struct pgrp *); @@ -70,8 +74,7 @@ inferior(p) * Locate a process by number */ struct proc * -pfind(pid) - register pid; +pfind(int pid) { register struct proc *p = pidhash[PIDHASH(pid)]; @@ -85,8 +88,7 @@ pfind(pid) * Locate a process group by number */ struct pgrp * -pgfind(pgid) - register pid_t pgid; +pgfind(pid_t pgid) { register struct pgrp *pgrp = pgrphash[PIDHASH(pgid)]; diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index d660280ee1..d886dbba27 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)kern_prot.c 7.21 (Berkeley) 5/3/91 - * $Id: kern_prot.c,v 1.3 1993/10/16 15:24:24 rgrimes Exp $ + * $Id: kern_prot.c,v 1.4 1993/11/25 01:33:04 wollman Exp $ */ /* @@ -39,8 +39,8 @@ */ #include "param.h" -#include "acct.h" #include "systm.h" +#include "acct.h" #include "ucred.h" #include "proc.h" #include "timeb.h" diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index fe9334ef82..1e4049501a 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)kern_sig.c 7.35 (Berkeley) 6/28/91 - * $Id: kern_sig.c,v 1.7 1993/11/25 01:33:08 wollman Exp $ + * $Id: kern_sig.c,v 1.8 1993/11/27 17:07:00 davidg Exp $ */ #define SIGPROP /* include signal properties table */ @@ -62,6 +62,7 @@ static void setsigvec(struct proc *, int, struct sigaction *); static void stop(struct proc *); static void sigexit(struct proc *, int); +static int killpg1(struct proc *, int, int, int); /* * Can process p, with pcred pc, send the signal signo to process q? @@ -491,7 +492,7 @@ okillpg(p, uap, retval) * Common code for kill process group/broadcast kill. * cp is calling process. */ -int +static int killpg1(cp, signo, pgid, all) register struct proc *cp; int signo, pgid, all; diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c index 4b17daabf1..9c8accffaf 100644 --- a/sys/kern/kern_subr.c +++ b/sys/kern/kern_subr.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)kern_subr.c 7.7 (Berkeley) 4/15/91 - * $Id: kern_subr.c,v 1.3 1993/11/18 05:02:34 rgrimes Exp $ + * $Id: kern_subr.c,v 1.4 1993/11/25 01:33:11 wollman Exp $ */ #include "param.h" @@ -39,11 +39,12 @@ #include "proc.h" int -uiomove(cp, n, uio) - register caddr_t cp; +uiomove(xcp, n, uio) + register void *xcp; register int n; register struct uio *uio; { + caddr_t cp = (caddr_t)xcp; register struct iovec *iov; u_int cnt; int error = 0; @@ -97,8 +98,8 @@ uiomove(cp, n, uio) int uioapply(func, arg1, arg2, uio) int (*func)() ; - int arg1; - int arg2; + caddr_t arg1; + caddr_t arg2; register struct uio *uio; { register struct iovec *iov; @@ -176,15 +177,18 @@ again: return (0); } -void +char * strcat(src, append) - register char *src, *append; + register char *src; + const char *append; { + char *old = src; for (; *src; ++src) ; while (*src++ = *append++) ; + return old; } char * @@ -198,15 +202,18 @@ strcpy(to, from) return old; } -void +char * strncpy(to, from, cnt) - register char *to, *from; - register int cnt; + char *to; + const char *from; + int cnt; { + char *old = to; for (; cnt && (*to = *from); --cnt, ++from, ++to) ; *to = '\0'; + return old; } diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 5ba84646f3..d691092a6b 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)subr_prf.c 7.30 (Berkeley) 6/29/91 - * $Id: subr_prf.c,v 1.4 1993/10/16 15:24:42 rgrimes Exp $ + * $Id: subr_prf.c,v 1.5 1993/11/13 02:25:32 davidg Exp $ */ #include "param.h" @@ -129,7 +129,7 @@ panic(msg) #endif #include "ddb.h" #if NDDB > 0 - Debugger (); + Debugger ("panic"); #endif boot(bootopt); } @@ -139,7 +139,7 @@ panic(msg) */ void tablefull(tab) - char *tab; + const char *tab; { log(LOG_ERR, "%s: table is full\n", tab); @@ -285,12 +285,12 @@ logpri(level) putchar('>', TOLOG, NULL); } -int +void #ifdef __STDC__ addlog(const char *fmt, ...) #else addlog(fmt /*, va_alist */) - char *fmt; + const char *fmt; #endif { register int s; @@ -307,7 +307,6 @@ addlog(fmt /*, va_alist */) va_end(ap); } logwakeup(); - return (0); } int consintr = 1; /* ok to handle console interrupts? */ @@ -317,7 +316,7 @@ int printf(const char *fmt, ...) #else printf(fmt /*, va_alist */) - char *fmt; + const char *fmt; #endif { va_list ap; diff --git a/sys/kern/subr_rlist.c b/sys/kern/subr_rlist.c index 3880792716..a29fece003 100644 --- a/sys/kern/subr_rlist.c +++ b/sys/kern/subr_rlist.c @@ -45,12 +45,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: subr_rlist.c,v 1.2 1993/10/16 15:24:44 rgrimes Exp $ + * $Id: subr_rlist.c,v 1.3 1993/11/25 01:33:18 wollman Exp $ */ -#include "sys/param.h" -#include "sys/cdefs.h" -#include "sys/malloc.h" +#include "param.h" +#include "systm.h" +#include "malloc.h" #include "rlist.h" /* diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 1a60e0194e..b32b92ab9e 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)sys_generic.c 7.30 (Berkeley) 5/30/91 - * $Id: sys_generic.c,v 1.4 1993/10/16 15:24:47 rgrimes Exp $ + * $Id: sys_generic.c,v 1.5 1993/11/25 01:33:20 wollman Exp $ */ #include "param.h" @@ -45,6 +45,7 @@ #include "kernel.h" #include "stat.h" #include "malloc.h" +#include "signalvar.h" #ifdef KTRACE #include "ktrace.h" #endif diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 696aec2b40..2a328de488 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)sys_process.c 7.22 (Berkeley) 5/11/91 - * $Id: sys_process.c,v 1.7 1993/11/25 01:33:22 wollman Exp $ + * $Id: sys_process.c,v 1.8 1993/12/02 02:48:15 davidg Exp $ */ #include "param.h" @@ -197,7 +197,8 @@ pwrite (struct proc *procp, unsigned int addr, unsigned int datum) { rv = vm_fault (map, pageno, VM_PROT_WRITE, 0); /* Find space in kernel_map for the page we're interested in */ - rv = vm_map_find (kernel_map, object, off, &kva, PAGE_SIZE, 1); + rv = vm_map_find (kernel_map, object, off, (vm_offset_t *)&kva, + PAGE_SIZE, 1); if (!rv) { vm_object_reference (object); @@ -428,7 +429,8 @@ profil(p, uap, retval) * addupc is set right... it's gotta be writable by the user... */ - if (useracc(uap->bufbase,uap->bufsize*sizeof(short),B_WRITE) == 0) + if (useracc((caddr_t)uap->bufbase, uap->bufsize * sizeof(short), + B_WRITE) == 0) return EFAULT; p->p_stats->p_prof.pr_base = uap->bufbase; diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index d1cc890fc6..9b13076e05 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)sys_socket.c 7.11 (Berkeley) 4/16/91 - * $Id: sys_socket.c,v 1.2 1993/10/16 15:24:50 rgrimes Exp $ + * $Id: sys_socket.c,v 1.3 1993/11/25 01:33:22 wollman Exp $ */ #include "param.h" @@ -130,7 +130,8 @@ soo_ioctl(fp, cmd, data, p) if (IOCGROUP(cmd) == 'r') return (rtioctl(cmd, data, p)); return ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL, - (struct mbuf *)cmd, (struct mbuf *)data, (struct mbuf *)0)); + (struct mbuf *)cmd, (struct mbuf *)data, (struct mbuf *)0, + (struct mbuf *)0)); } int @@ -182,7 +183,7 @@ soo_stat(so, ub) bzero((caddr_t)ub, sizeof (*ub)); return ((*so->so_proto->pr_usrreq)(so, PRU_SENSE, (struct mbuf *)ub, (struct mbuf *)0, - (struct mbuf *)0)); + (struct mbuf *)0, (struct mbuf *)0)); } /* ARGSUSED */ diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 0d87d5206f..b9d50f1395 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -37,7 +37,7 @@ * * from: Utah $Hdr: uipc_shm.c 1.9 89/08/14$ * from: @(#)sysv_shm.c 7.15 (Berkeley) 5/13/91 - * $Id: sysv_shm.c,v 1.5 1993/11/07 17:46:20 wollman Exp $ + * $Id: sysv_shm.c,v 1.6 1993/11/25 01:33:24 wollman Exp $ */ /* @@ -59,6 +59,7 @@ #include "vm/vm_kern.h" #include "vm/vm_inherit.h" #include "vm/vm_pager.h" +#include "vm/vm_user.h" #ifdef HPUXCOMPAT #include "hp300/hpux/hpux.h" @@ -89,8 +90,11 @@ struct shmhandle { caddr_t shmh_id; }; +static int ipcaccess(struct ipc_perm *, int, struct ucred *); static void shmufree(struct proc *, struct shmdesc *); static void shmfree(struct shmid_ds *); +static int shmvalid(int); + vm_map_t shm_map; /* address space for shared memory segments */ @@ -193,7 +197,7 @@ shmget(p, uap, retval) shmh = (struct shmhandle *) malloc(sizeof(struct shmhandle), M_SHM, M_WAITOK); shmh->shmh_kva = 0; - shmh->shmh_id = (caddr_t)(0xc0000000|rval); /* XXX */ + shmh->shmh_id = (caddr_t)(0xc0000000UL|rval); /* XXX */ error = vm_mmap(shm_map, &shmh->shmh_kva, ctob(size), VM_PROT_ALL, VM_PROT_DEFAULT, MAP_ANON, shmh->shmh_id, 0); if (error) { @@ -368,9 +372,11 @@ shmat(p, uap, retval) if (uva) flags |= MAP_FIXED; else - uva = (caddr_t)0x1000000; /* XXX */ - error = vm_mmap(&p->p_vmspace->vm_map, &uva, (vm_size_t)size, prot, VM_PROT_DEFAULT, - flags, ((struct shmhandle *)shp->shm_handle)->shmh_id, 0); + uva = (caddr_t)0x1000000UL; /* XXX */ + error = vm_mmap(&p->p_vmspace->vm_map, (vm_offset_t *)&uva, + (vm_size_t)size, prot, VM_PROT_DEFAULT, + flags, ((struct shmhandle *)shp->shm_handle)->shmh_id, + 0); if (error) return(error); shmd->shmd_uva = (vm_offset_t)uva; @@ -453,7 +459,7 @@ shmexit(p) p->p_vmspace->vm_shm = NULL; } -int +static int shmvalid(id) register int id; { @@ -524,7 +530,7 @@ shmfree(shp) * XXX This routine would be common to all sysV style IPC * (if the others were implemented). */ -int +static int ipcaccess(ipc, mode, cred) register struct ipc_perm *ipc; int mode; diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 2c6eff1386..6a7988eab5 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)tty.c 7.44 (Berkeley) 5/28/91 - * $Id: tty.c,v 1.9 1993/11/25 01:33:25 wollman Exp $ + * $Id: tty.c,v 1.10 1993/12/13 01:10:13 ache Exp $ */ #include "param.h" @@ -49,6 +49,7 @@ #include "kernel.h" #include "vnode.h" #include "syslog.h" +#include "signalvar.h" #include "vm/vm.h" diff --git a/sys/kern/tty_compat.c b/sys/kern/tty_compat.c index b6897ad107..811fff587e 100644 --- a/sys/kern/tty_compat.c +++ b/sys/kern/tty_compat.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tty_compat.c 7.10 (Berkeley) 5/9/91 - * $Id: tty_compat.c,v 1.2 1993/10/16 15:24:57 rgrimes Exp $ + * $Id: tty_compat.c,v 1.3 1993/11/25 01:33:26 wollman Exp $ */ /* @@ -130,7 +130,7 @@ ttcompat(tp, com, data, flag) term.c_ospeed = compatspcodes[speed]; term.c_cc[VERASE] = sg->sg_erase; term.c_cc[VKILL] = sg->sg_kill; - tp->t_flags = tp->t_flags&0xffff0000 | sg->sg_flags&0xffff; + tp->t_flags = tp->t_flags&0xffff0000UL | sg->sg_flags&0xffff; ttcompatsetflags(tp, &term); return (ttioctl(tp, com == TIOCSETP ? TIOCSETAF : TIOCSETA, (caddr_t)&term, flag)); @@ -196,7 +196,8 @@ ttcompat(tp, com, data, flag) tp->t_flags = (tp->t_flags&0xffff) | *(int *)data<<16; else { tp->t_flags = - (ttcompatgetflags(tp)&0xffff0000)|(tp->t_flags&0xffff); + (ttcompatgetflags(tp) & 0xffff0000UL) + | (tp->t_flags & 0xffff); if (com == TIOCLBIS) tp->t_flags |= *(int *)data<<16; else @@ -207,7 +208,8 @@ ttcompat(tp, com, data, flag) } case TIOCLGET: tp->t_flags = - (ttcompatgetflags(tp)&0xffff0000)|(tp->t_flags&0xffff); + (ttcompatgetflags(tp) & 0xffff0000UL) + | (tp->t_flags & 0xffff); *(int *)data = tp->t_flags>>16; if (ttydebug) printf("CLGET: returning %x\n", *(int *)data); diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index 9f94843e48..7a1091629a 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tty_pty.c 7.21 (Berkeley) 5/30/91 - * $Id: tty_pty.c,v 1.4 1993/10/16 15:25:00 rgrimes Exp $ + * $Id: tty_pty.c,v 1.5 1993/11/25 01:33:29 wollman Exp $ */ /* @@ -51,6 +51,7 @@ #include "uio.h" #include "kernel.h" #include "vnode.h" +#include "signalvar.h" #if NPTY == 1 #undef NPTY diff --git a/sys/kern/tty_ring.c b/sys/kern/tty_ring.c index e1b2a08297..91b440e990 100644 --- a/sys/kern/tty_ring.c +++ b/sys/kern/tty_ring.c @@ -45,7 +45,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: tty_ring.c,v 1.2 1993/10/16 15:25:01 rgrimes Exp $ + * $Id: tty_ring.c,v 1.3 1993/11/25 01:33:30 wollman Exp $ */ #include "param.h" @@ -54,11 +54,6 @@ #include "ioctl.h" #include "tty.h" -/* - * XXX - put this in tty.h someday. - */ -size_t rb_write __P((struct ringb *to, char *buf, size_t nfrom)); - int putc(c, rbp) int c; diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index 7d76dba89c..22613fdb76 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -31,11 +31,11 @@ * SUCH DAMAGE. * * from: @(#)uipc_domain.c 7.9 (Berkeley) 3/4/91 - * $Id: uipc_domain.c,v 1.3 1993/11/07 17:46:22 wollman Exp $ + * $Id: uipc_domain.c,v 1.4 1993/11/25 01:33:31 wollman Exp $ */ -#include #include "param.h" +#include "systm.h" #include "socket.h" #include "protosw.h" #include "domain.h" diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 23ce15a7d5..31e727579c 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)uipc_mbuf.c 7.19 (Berkeley) 4/20/91 - * $Id: uipc_mbuf.c,v 1.4 1993/11/07 17:46:23 wollman Exp $ + * $Id: uipc_mbuf.c,v 1.5 1993/11/25 01:33:32 wollman Exp $ */ #include "param.h" @@ -591,3 +591,175 @@ out: if (((m = m0)->m_flags & M_PKTHDR) && (m->m_pkthdr.len < totlen)) m->m_pkthdr.len = totlen; } +struct mbuf * +m_split (m0, len0, wait) + register struct mbuf *m0; + int len0; + int wait; +{ + register struct mbuf *m, *n; + unsigned len = len0, remain; + + for (m = m0; m && len > m -> m_len; m = m -> m_next) + len -= m -> m_len; + if (m == 0) + return (0); + remain = m -> m_len - len; + if (m0 -> m_flags & M_PKTHDR) { + MGETHDR(n, wait, m0 -> m_type); + if (n == 0) + return (0); + n -> m_pkthdr.rcvif = m0 -> m_pkthdr.rcvif; + n -> m_pkthdr.len = m0 -> m_pkthdr.len - len0; + m0 -> m_pkthdr.len = len0; + if (m -> m_flags & M_EXT) + goto extpacket; + if (remain > MHLEN) { + /* m can't be the lead packet */ + MH_ALIGN(n, 0); + n -> m_next = m_split (m, len, wait); + if (n -> m_next == 0) { + (void) m_free (n); + return (0); + } else + return (n); + } else + MH_ALIGN(n, remain); + } else if (remain == 0) { + n = m -> m_next; + m -> m_next = 0; + return (n); + } else { + MGET(n, wait, m -> m_type); + if (n == 0) + return (0); + M_ALIGN(n, remain); + } +extpacket: + if (m -> m_flags & M_EXT) { + n -> m_flags |= M_EXT; + n -> m_ext = m -> m_ext; + mclrefcnt[mtocl (m -> m_ext.ext_buf)]++; + n -> m_data = m -> m_data + len; + } else { + bcopy (mtod (m, caddr_t) + len, mtod (n, caddr_t), remain); + } + n -> m_len = remain; + m -> m_len = len; + n -> m_next = m -> m_next; + m -> m_next = 0; + return (n); +} + +/* The following taken from netiso/iso_chksum.c */ +struct mbuf * +m_append(head, m) /* XXX */ + struct mbuf *head, *m; +{ + register struct mbuf *n; + + if (m == 0) + return head; + if (head == 0) + return m; + n = head; + while (n->m_next) + n = n->m_next; + n->m_next = m; + return head; +} + +/* + * FUNCTION: m_datalen + * + * PURPOSE: returns length of the mbuf chain. + * used all over the iso code. + * + * RETURNS: integer + * + * SIDE EFFECTS: none + * + * NOTES: + */ +int +m_datalen (morig) /* XXX */ + struct mbuf *morig; +{ + int s = splimp(); + register struct mbuf *n=morig; + register int datalen = 0; + + if( morig == (struct mbuf *)0) + return 0; + for(;;) { + datalen += n->m_len; + if (n->m_next == (struct mbuf *)0 ) { + break; + } + n = n->m_next; + } + splx(s); + return datalen; +} + +int +m_compress(in, out) + register struct mbuf *in, **out; +{ + register int datalen = 0; + int s = splimp(); + + if(!in->m_next) { + *out = in; + splx(s); + return in->m_len; + } + MGET((*out), M_DONTWAIT, MT_DATA); + if(! (*out)) { + *out = in; + splx(s); + return -1; + } + (*out)->m_len = 0; + (*out)->m_act = 0; + + while (in) { + if (in->m_flags & M_EXT) { +#ifdef DEBUG + ASSERT(in->m_len == 0); +#endif + } + if ( in->m_len == 0) { + in = in->m_next; + continue; + } + if (((*out)->m_flags & M_EXT) == 0) { + int len; + + len = M_TRAILINGSPACE(*out); + len = MIN(len, in->m_len); + datalen += len; + + bcopy(mtod(in, caddr_t), mtod((*out), caddr_t) + (*out)->m_len, + (unsigned)len); + + (*out)->m_len += len; + in->m_len -= len; + continue; + } else { + /* (*out) is full */ + if( !((*out)->m_next = m_get(M_DONTWAIT, MT_DATA))) { + m_freem(*out); + *out = in; + splx(s); + return -1; + } + (*out)->m_len = 0; + (*out)->m_act = 0; + *out = (*out)->m_next; + } + } + m_freem(in); + splx(s); + return datalen; +} diff --git a/sys/kern/uipc_proto.c b/sys/kern/uipc_proto.c index 0afd5e0f99..8aa6bea1db 100644 --- a/sys/kern/uipc_proto.c +++ b/sys/kern/uipc_proto.c @@ -31,21 +31,23 @@ * SUCH DAMAGE. * * from: @(#)uipc_proto.c 7.6 (Berkeley) 5/9/91 - * $Id$ + * $Id: uipc_proto.c,v 1.2 1993/10/16 15:25:09 rgrimes Exp $ */ #include "param.h" +#include "systm.h" #include "socket.h" #include "protosw.h" #include "domain.h" #include "mbuf.h" +#include "net/raw_cb.h" + /* * Definitions of protocols supported in the UNIX domain. */ int uipc_usrreq(); -int raw_init(),raw_usrreq(),raw_input(),raw_ctlinput(); extern struct domain unixdomain; /* or at least forward */ struct protosw unixsw[] = { diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index f01ea6ac73..a22481bdc5 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)uipc_socket.c 7.28 (Berkeley) 5/4/91 - * $Id: uipc_socket.c,v 1.8 1993/10/23 16:23:49 davidg Exp $ + * $Id: uipc_socket.c,v 1.9 1993/11/25 01:33:33 wollman Exp $ */ #include "param.h" @@ -83,7 +83,8 @@ socreate(dom, aso, type, proto) so->so_proto = prp; error = (*prp->pr_usrreq)(so, PRU_ATTACH, - (struct mbuf *)0, (struct mbuf *)proto, (struct mbuf *)0); + (struct mbuf *)0, (struct mbuf *)proto, (struct mbuf *)0, + (struct mbuf *)0); if (error) { so->so_state |= SS_NOFDREF; sofree(so); @@ -103,7 +104,7 @@ sobind(so, nam) error = (*so->so_proto->pr_usrreq)(so, PRU_BIND, - (struct mbuf *)0, nam, (struct mbuf *)0); + (struct mbuf *)0, nam, (struct mbuf *)0, (struct mbuf *)0); splx(s); return (error); } @@ -117,7 +118,8 @@ solisten(so, backlog) error = (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, - (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0); + (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0, + (struct mbuf *)0); if (error) { splx(s); return (error); @@ -188,7 +190,8 @@ drop: if (so->so_pcb) { int error2 = (*so->so_proto->pr_usrreq)(so, PRU_DETACH, - (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0); + (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0, + (struct mbuf *)0); if (error == 0) error = error2; } @@ -211,7 +214,8 @@ soabort(so) return ( (*so->so_proto->pr_usrreq)(so, PRU_ABORT, - (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0)); + (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0, + (struct mbuf *)0)); } int @@ -226,7 +230,7 @@ soaccept(so, nam) panic("soaccept: !NOFDREF"); so->so_state &= ~SS_NOFDREF; error = (*so->so_proto->pr_usrreq)(so, PRU_ACCEPT, - (struct mbuf *)0, nam, (struct mbuf *)0); + (struct mbuf *)0, nam, (struct mbuf *)0, (struct mbuf *)0); splx(s); return (error); } @@ -254,7 +258,7 @@ soconnect(so, nam) error = EISCONN; else error = (*so->so_proto->pr_usrreq)(so, PRU_CONNECT, - (struct mbuf *)0, nam, (struct mbuf *)0); + (struct mbuf *)0, nam, (struct mbuf *)0, (struct mbuf *)0); splx(s); return (error); } @@ -268,7 +272,8 @@ soconnect2(so1, so2) int error; error = (*so1->so_proto->pr_usrreq)(so1, PRU_CONNECT2, - (struct mbuf *)0, (struct mbuf *)so2, (struct mbuf *)0); + (struct mbuf *)0, (struct mbuf *)so2, (struct mbuf *)0, + (struct mbuf *)0); splx(s); return (error); } @@ -289,7 +294,8 @@ sodisconnect(so) goto bad; } error = (*so->so_proto->pr_usrreq)(so, PRU_DISCONNECT, - (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0); + (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0, + (struct mbuf *)0); bad: splx(s); return (error); @@ -436,7 +442,7 @@ nopages: s = splnet(); /* XXX */ error = (*so->so_proto->pr_usrreq)(so, (flags & MSG_OOB) ? PRU_SENDOOB : PRU_SEND, - top, addr, control); + top, addr, control, (struct mbuf *)0); splx(s); if (dontroute) so->so_options &= ~SO_DONTROUTE; @@ -504,7 +510,8 @@ soreceive(so, paddr, uio, mp0, controlp, flagsp) if (flags & MSG_OOB) { m = m_get(M_WAIT, MT_DATA); error = (*pr->pr_usrreq)(so, PRU_RCVOOB, - m, (struct mbuf *)(flags & MSG_PEEK), (struct mbuf *)0); + m, (struct mbuf *)(flags & MSG_PEEK), (struct mbuf *)0, + (struct mbuf *)0); if (error) goto bad; do { @@ -521,7 +528,7 @@ bad: *mp = (struct mbuf *)0; if (so->so_state & SS_ISCONFIRMING && uio->uio_resid) (*pr->pr_usrreq)(so, PRU_RCVD, (struct mbuf *)0, - (struct mbuf *)0, (struct mbuf *)0); + (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0); restart: if (error = sblock(&so->so_rcv)) @@ -784,7 +791,8 @@ soshutdown(so, how) sorflush(so); if (how & FWRITE) return ((*pr->pr_usrreq)(so, PRU_SHUTDOWN, - (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0)); + (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0, + (struct mbuf *)0)); return (0); } diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 6c1faa041b..e7b26cd757 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)uipc_socket2.c 7.17 (Berkeley) 5/4/91 - * $Id: uipc_socket2.c,v 1.2 1993/10/16 15:25:12 rgrimes Exp $ + * $Id: uipc_socket2.c,v 1.3 1993/11/25 01:33:35 wollman Exp $ */ #include "param.h" @@ -173,7 +173,8 @@ sonewconn1(head, connstatus) (void) soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat); soqinsque(head, so, soqueue); if ((*so->so_proto->pr_usrreq)(so, PRU_ATTACH, - (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0)) { + (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0, + (struct mbuf *)0)) { (void) soqremque(so, soqueue); (void) free((caddr_t)so, M_SOCKET); return ((struct socket *)0); diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index fa9259bc9a..708dd053d5 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)uipc_syscalls.c 7.24 (Berkeley) 6/3/91 - * $Id: uipc_syscalls.c,v 1.4 1993/10/16 15:25:14 rgrimes Exp $ + * $Id: uipc_syscalls.c,v 1.5 1993/11/25 01:33:36 wollman Exp $ */ #include "param.h" @@ -49,6 +49,12 @@ #include "ktrace.h" #endif +/* First two also used by NFS, boooo, hiss! */ +int getsock(struct filedesc *, int, struct file **); +int sockargs(struct mbuf **, caddr_t, int, int); +static int sendit(struct proc *, int, struct msghdr *, int, int *); +static int recvit(struct proc *, int, struct msghdr *, caddr_t, int *); + /* * System call interface to the socket abstraction. */ @@ -133,7 +139,18 @@ listen(p, uap, retval) return (solisten((struct socket *)fp->f_data, uap->backlog)); } +struct accept1_args { + int s; + caddr_t name; + int *anamelen; #ifdef COMPAT_43 + int compat_43; +#endif +}; + +#ifdef COMPAT_43 + +int accept1(struct proc *, struct accept1_args *, int *); struct accept_args { int s; @@ -150,7 +167,7 @@ accept(p, uap, retval) { uap->compat_43 = 0; - return (accept1(p, uap, retval)); + return (accept1(p, (struct accept1_args *)uap, retval)); } struct oaccept_args { @@ -168,22 +185,13 @@ oaccept(p, uap, retval) { uap->compat_43 = 1; - return (accept1(p, uap, retval)); + return (accept1(p, (struct accept1_args *)uap, retval)); } #else /* COMPAT_43 */ #define accept1 accept #endif -struct accept1_args { - int s; - caddr_t name; - int *anamelen; -#ifdef COMPAT_43 - int compat_43; -#endif -}; - int accept1(p, uap, retval) struct proc *p; @@ -516,7 +524,7 @@ done: return (error); } -int +static int sendit(p, s, mp, flags, retsize) register struct proc *p; int s; @@ -1080,8 +1088,19 @@ free1: /* * Get socket name. */ +struct getsockname1_args { + int fdes; + caddr_t asa; + int *alen; +#ifdef COMPAT_43 + int compat_43; +#endif +}; + #ifdef COMPAT_43 +int getsockname1(struct proc *, struct getsockname1_args *, int *); + struct getsockname_args { int fdes; caddr_t asa; @@ -1097,7 +1116,7 @@ getsockname(p, uap, retval) { uap->compat_43 = 0; - return (getsockname1(p, uap, retval)); + return (getsockname1(p, (struct getsockname1_args *)uap, retval)); } struct ogetsockname_args { @@ -1115,22 +1134,13 @@ ogetsockname(p, uap, retval) { uap->compat_43 = 1; - return (getsockname1(p, uap, retval)); + return (getsockname1(p, (struct getsockname1_args *)uap, retval)); } #else /* COMPAT_43 */ #define getsockname1 getsockname #endif -struct getsockname1_args { - int fdes; - caddr_t asa; - int *alen; -#ifdef COMPAT_43 - int compat_43; -#endif -}; - /* ARGSUSED */ int getsockname1(p, uap, retval) @@ -1151,7 +1161,7 @@ getsockname1(p, uap, retval) m = m_getclr(M_WAIT, MT_SONAME); if (m == NULL) return (ENOBUFS); - if (error = (*so->so_proto->pr_usrreq)(so, PRU_SOCKADDR, 0, m, 0)) + if (error = (*so->so_proto->pr_usrreq)(so, PRU_SOCKADDR, 0, m, 0, 0)) goto bad; if (len > m->m_len) len = m->m_len; @@ -1172,8 +1182,19 @@ bad: /* * Get name of peer for connected socket. */ +struct getpeername1_args { + int fdes; + caddr_t asa; + int *alen; +#ifdef COMPAT_43 + int compat_43; +#endif +}; + #ifdef COMPAT_43 +int getpeername1(struct proc *, struct getpeername1_args *, int *); + struct getpeername_args { int fdes; caddr_t asa; @@ -1189,7 +1210,7 @@ getpeername(p, uap, retval) { uap->compat_43 = 0; - return (getpeername1(p, uap, retval)); + return (getpeername1(p, (struct getpeername1_args *)uap, retval)); } struct ogetpeername_args { @@ -1207,22 +1228,13 @@ ogetpeername(p, uap, retval) { uap->compat_43 = 1; - return (getpeername1(p, uap, retval)); + return (getpeername1(p, (struct getpeername1_args *)uap, retval)); } #else /* COMPAT_43 */ #define getpeername1 getpeername #endif -struct getpeername1_args { - int fdes; - caddr_t asa; - int *alen; -#ifdef COMPAT_43 - int compat_43; -#endif -}; - /* ARGSUSED */ int getpeername1(p, uap, retval) @@ -1245,7 +1257,7 @@ getpeername1(p, uap, retval) return (ENOBUFS); if (error = copyin((caddr_t)uap->alen, (caddr_t)&len, sizeof (len))) return (error); - if (error = (*so->so_proto->pr_usrreq)(so, PRU_PEERADDR, 0, m, 0)) + if (error = (*so->so_proto->pr_usrreq)(so, PRU_PEERADDR, 0, m, 0, 0)) goto bad; if (len > m->m_len) len = m->m_len; diff --git a/sys/kern/vfs_conf.c b/sys/kern/vfs_conf.c index 01b3815523..be674dad1a 100644 --- a/sys/kern/vfs_conf.c +++ b/sys/kern/vfs_conf.c @@ -31,10 +31,11 @@ * SUCH DAMAGE. * * from: @(#)vfs_conf.c 7.3 (Berkeley) 6/28/90 - * $Id: vfs_conf.c,v 1.2 1993/10/16 15:25:21 rgrimes Exp $ + * $Id: vfs_conf.c,v 1.3 1993/12/12 12:23:21 davidg Exp $ */ #include "param.h" +#include "systm.h" #include "mount.h" /* @@ -72,9 +73,7 @@ extern struct vfsops pcfs_vfsops; extern struct vfsops isofs_vfsops; #endif -#ifdef PROCFS extern struct vfsops procfs_vfsops; -#endif struct vfsops *vfssw[] = { (struct vfsops *)0, /* 0 = MOUNT_NONE */ @@ -99,9 +98,5 @@ struct vfsops *vfssw[] = { #else (struct vfsops *)0, #endif -#ifdef PROCFS &procfs_vfsops, /* 6 = MOUNT_PROCFS */ -#else - (struct vfsops *)0, -#endif }; diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index c7e7fd093f..e4dd24642a 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)vfs_syscalls.c 7.74 (Berkeley) 6/21/91 - * $Id: vfs_syscalls.c,v 1.6 1993/11/25 01:33:43 wollman Exp $ + * $Id: vfs_syscalls.c,v 1.7 1993/12/13 11:58:07 davidg Exp $ */ #include "param.h" @@ -47,6 +47,9 @@ #include "uio.h" #include "malloc.h" +static int getvnode(struct filedesc *, int, struct file **); +static int chdirec(struct nameidata *, struct proc *); + /* * Virtual File System System Calls */ @@ -565,7 +568,7 @@ chroot(p, uap, retval) /* * Common routine for chroot and chdir. */ -int +static int chdirec(ndp, p) struct nameidata *ndp; struct proc *p; @@ -1913,11 +1916,11 @@ out: /* * Convert a user file descriptor to a kernel file entry. */ -int +static int getvnode(fdp, fdes, fpp) struct filedesc *fdp; - struct file **fpp; int fdes; + struct file **fpp; { struct file *fp; diff --git a/sys/net/bpf.c b/sys/net/bpf.c index e8839b137e..614452e2e0 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)bpf.c 7.5 (Berkeley) 7/15/91 - * $Id$ + * $Id: bpf.c,v 1.2 1993/10/16 17:43:03 rgrimes Exp $ */ #include "bpfilter.h" @@ -1221,41 +1221,6 @@ bpfattach(driverp, ifp, dlt, hdrlen) printf("bpf: %s%d attached\n", ifp->if_name, ifp->if_unit); } -#if BSD >= 199103 -/* XXX This routine belongs in net/if.c. */ -/* - * Set/clear promiscuous mode on interface ifp based on the truth value - * of pswitch. The calls are reference counted so that only the first - * "on" request actually has an effect, as does the final "off" request. - * Results are undefined if the "off" and "on" requests are not matched. - */ -int -ifpromisc(ifp, pswitch) - struct ifnet *ifp; - int pswitch; -{ - struct ifreq ifr; - /* - * If the device is not configured up, we cannot put it in - * promiscuous mode. - */ - if ((ifp->if_flags & IFF_UP) == 0) - return (ENETDOWN); - - if (pswitch) { - if (ifp->if_pcount++ != 0) - return (0); - ifp->if_flags |= IFF_PROMISC; - } else { - if (--ifp->if_pcount > 0) - return (0); - ifp->if_flags &= ~IFF_PROMISC; - } - ifr.ifr_flags = ifp->if_flags; - return ((*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, (caddr_t)&ifr)); -} -#endif - #if BSD < 199103 /* * Allocate some memory for bpf. This is temporary SunOS support, and diff --git a/sys/net/bpf_filter.c b/sys/net/bpf_filter.c index 658e7d42c4..b61babd63d 100644 --- a/sys/net/bpf_filter.c +++ b/sys/net/bpf_filter.c @@ -36,10 +36,13 @@ * SUCH DAMAGE. * * from: @(#)bpf.c 7.5 (Berkeley) 7/15/91 - * $Id: bpf_filter.c,v 1.2 1993/10/16 17:43:07 rgrimes Exp $ + * $Id: bpf_filter.c,v 1.3 1993/11/25 01:33:48 wollman Exp $ */ #include +#ifdef KERNEL +#include "systm.h" +#endif #include #include #include diff --git a/sys/net/if.c b/sys/net/if.c index b73eb48db5..aa82e84e96 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)if.c 7.14 (Berkeley) 4/20/91 - * $Id: if.c,v 1.5 1993/11/07 17:46:53 wollman Exp $ + * $Id: if.c,v 1.6 1993/11/25 01:33:52 wollman Exp $ */ #include "param.h" @@ -545,7 +545,10 @@ ifioctl(so, cmd, data, p) cmd = SIOCGIFNETMASK; } error = ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL, - cmd, data, ifp)); + (struct mbuf *)cmd, + (struct mbuf *)data, + (struct mbuf *)ifp, + (struct mbuf *)0)); switch (ocmd) { case OSIOCGIFADDR: @@ -650,3 +653,35 @@ sprint_d(n, buf, buflen) } while (n != 0); return (cp); } + +/* + * Set/clear promiscuous mode on interface ifp based on the truth value + * of pswitch. The calls are reference counted so that only the first + * "on" request actually has an effect, as does the final "off" request. + * Results are undefined if the "off" and "on" requests are not matched. + */ +int +ifpromisc(ifp, pswitch) + struct ifnet *ifp; + int pswitch; +{ + struct ifreq ifr; + /* + * If the device is not configured up, we cannot put it in + * promiscuous mode. + */ + if ((ifp->if_flags & IFF_UP) == 0) + return (ENETDOWN); + + if (pswitch) { + if (ifp->if_pcount++ != 0) + return (0); + ifp->if_flags |= IFF_PROMISC; + } else { + if (--ifp->if_pcount > 0) + return (0); + ifp->if_flags &= ~IFF_PROMISC; + } + ifr.ifr_flags = ifp->if_flags; + return ((*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, (caddr_t)&ifr)); +} diff --git a/sys/net/if.h b/sys/net/if.h index 6864bccd82..4dbcc427c1 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)if.h 7.11 (Berkeley) 3/19/91 - * $Id: if.h,v 1.9 1993/11/16 02:37:39 wollman Exp $ + * $Id: if.h,v 1.10 1993/11/25 01:33:59 wollman Exp $ */ #ifndef _NET_IF_H_ @@ -263,7 +263,12 @@ extern struct ifqueue rawintrq; /* raw packet input queue */ extern struct ifnet *ifnet; struct ifaddr *ifa_ifwithaddr(), *ifa_ifwithnet(); struct ifaddr *ifa_ifwithdstaddr(); +extern int ifpromisc(struct ifnet *, int); + +/* Loopback interface, used internally by non-loopback code */ extern struct ifnet loif; +extern int looutput(struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); #else /* KERNEL */ #include diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index 01b48ac35e..6320eeeef8 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -70,7 +70,7 @@ */ /* - * $Id: if_ppp.c,v 1.4 1993/10/07 02:19:37 rgrimes Exp $ + * $Id: if_ppp.c,v 1.5 1993/11/25 01:34:04 wollman Exp $ * From: if_ppp.c,v 1.22 1993/08/31 23:20:40 paulus Exp * From: if_ppp.c,v 1.21 1993/08/29 11:22:37 paulus Exp * From: if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp @@ -252,7 +252,7 @@ pppopen(dev, tp) sc->sc_flags = 0; sc->sc_ilen = 0; - sc->sc_asyncmap = 0xffffffff; + sc->sc_asyncmap = ~0; sc->sc_rasyncmap = 0; sc->sc_mru = PPP_MRU; #ifdef VJC diff --git a/sys/net/raw_cb.h b/sys/net/raw_cb.h index f8591c3722..f63ac3a875 100644 --- a/sys/net/raw_cb.h +++ b/sys/net/raw_cb.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)raw_cb.h 7.6 (Berkeley) 6/28/90 - * $Id: raw_cb.h,v 1.2 1993/10/16 17:43:36 rgrimes Exp $ + * $Id: raw_cb.h,v 1.3 1993/11/07 17:47:05 wollman Exp $ */ #ifndef _NET_RAW_CB_H_ @@ -60,5 +60,12 @@ struct rawcb { #ifdef KERNEL extern struct rawcb rawcb; /* head of list */ -#endif +extern void raw_init(void); +extern int raw_input(struct mbuf *, struct sockproto *, struct sockaddr *, + struct sockaddr *); +extern void raw_ctlinput(int, struct sockaddr *); +extern int raw_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, + struct mbuf *, struct mbuf *); + +#endif /* KERNEL */ #endif /* _NET_RAW_CB_H_ */ diff --git a/sys/net/raw_usrreq.c b/sys/net/raw_usrreq.c index 22c346471e..d9ff458396 100644 --- a/sys/net/raw_usrreq.c +++ b/sys/net/raw_usrreq.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)raw_usrreq.c 7.9 (Berkeley) 6/28/90 - * $Id: raw_usrreq.c,v 1.3 1993/10/16 17:43:38 rgrimes Exp $ + * $Id: raw_usrreq.c,v 1.4 1993/11/25 01:34:09 wollman Exp $ */ #include "param.h" @@ -144,10 +144,11 @@ raw_ctlinput(cmd, arg) /*ARGSUSED*/ int -raw_usrreq(so, req, m, nam, control) +raw_usrreq(so, req, m, nam, control, dummy) struct socket *so; int req; struct mbuf *m, *nam, *control; + struct mbuf *dummy; { register struct rawcb *rp = sotorawcb(so); register int error = 0; diff --git a/sys/net/route.c b/sys/net/route.c index b426e16fce..888c4809da 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)route.c 7.22 (Berkeley) 6/27/91 - * $Id: route.c,v 1.3 1993/11/07 17:47:07 wollman Exp $ + * $Id: route.c,v 1.4 1993/11/25 01:34:10 wollman Exp $ */ #include "param.h" @@ -160,8 +160,9 @@ rtfree(rt) */ void rtredirect(dst, gateway, netmask, flags, src, rtp) - struct sockaddr *dst, *gateway, *netmask, *src; + struct sockaddr *dst, *gateway, *netmask; int flags; + struct sockaddr *src; struct rtentry **rtp; { register struct rtentry *rt = 0; diff --git a/sys/net/route.h b/sys/net/route.h index 2c46e7a779..2c550a2d07 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)route.h 7.13 (Berkeley) 4/25/91 - * $Id: route.h,v 1.3 1993/11/07 17:47:08 wollman Exp $ + * $Id: route.h,v 1.4 1993/11/25 01:34:11 wollman Exp $ */ #ifndef _NET_ROUTE_H_ @@ -223,9 +223,20 @@ extern struct route_cb route_cb; extern struct mbuf *rthost[RTHASHSIZ]; extern struct mbuf *rtnet[RTHASHSIZ]; extern struct rtstat rtstat; -struct rtentry *rtalloc1(); -extern void rt_maskedcopy(struct sockaddr *, struct sockaddr *, struct sockaddr *); - -#endif +extern void rtalloc(struct route *); +extern struct rtentry *rtalloc1(struct sockaddr *, int); +extern void rtfree(struct rtentry *); +extern void rt_maskedcopy(struct sockaddr *, struct sockaddr *, + struct sockaddr *); +extern int rtrequest(int, struct sockaddr *, struct sockaddr *, + struct sockaddr *, int, struct rtentry **); +extern void rtredirect(struct sockaddr *, struct sockaddr *, struct sockaddr *, + int, struct sockaddr *, struct rtentry **); +extern void rt_missmsg(int, struct sockaddr *, struct sockaddr *, + struct sockaddr *, struct sockaddr *, + int, int); +extern int rtinit(struct ifaddr *, int, int); + +#endif /* KERNEL */ #endif /* _NET_ROUTE_H_ */ diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 582402da70..cba1e4d32a 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)rtsock.c 7.18 (Berkeley) 6/27/91 - * $Id: rtsock.c,v 1.4 1993/11/07 17:47:09 wollman Exp $ + * $Id: rtsock.c,v 1.5 1993/11/25 01:34:12 wollman Exp $ */ #include "param.h" @@ -83,7 +83,7 @@ route_usrreq(so, req, m, nam, control) route_cb.any_count--; } s = splnet(); - error = raw_usrreq(so, req, m, nam, control); + error = raw_usrreq(so, req, m, nam, control, 0); rp = sotorawcb(so); if (req == PRU_ATTACH && rp) { int af = rp->rcb_proto.sp_protocol; @@ -603,7 +603,6 @@ rt_walk(rn, f, w) * Definitions of protocols supported in the ROUTE domain. */ -int raw_init(),raw_usrreq(),raw_input(),raw_ctlinput(); extern struct domain routedomain; /* or at least forward */ struct protosw routesw[] = { diff --git a/sys/netccitt/ccitt_proto.c b/sys/netccitt/ccitt_proto.c index 1b15a044e0..5110840336 100644 --- a/sys/netccitt/ccitt_proto.c +++ b/sys/netccitt/ccitt_proto.c @@ -36,10 +36,11 @@ * SUCH DAMAGE. * * from: @(#)ccitt_proto.c 7.5 (Berkeley) 8/30/90 - * $Id$ + * $Id: ccitt_proto.c,v 1.2 1993/10/16 19:46:33 rgrimes Exp $ */ #define HDLC #include "param.h" +#include "systm.h" #include "socket.h" #include "protosw.h" #include "domain.h" @@ -58,12 +59,21 @@ extern struct domain ccittdomain; #endif #ifdef XE -int xe_output (), xe_ctlinput (), xe_init(), xe_timer(); +int xe_output (); +void xe_ctlinput (); +void xe_init(); +void xe_timer(); #endif #ifdef HDLC -int hd_output (), hd_ctlinput (), hd_init (), hd_timer (); +int hd_output (); +void hd_ctlinput (); +void hd_init (); +void hd_timer (); #endif -int pk_usrreq (), pk_timer (), pk_init (), pk_ctloutput (); +int pk_usrreq (); +void pk_timer (); +int pk_ctloutput (); +void pk_init (); struct protosw ccittsw[] = { #ifdef XE diff --git a/sys/netccitt/if_x25subr.c b/sys/netccitt/if_x25subr.c index 7013432788..eca51efb77 100644 --- a/sys/netccitt/if_x25subr.c +++ b/sys/netccitt/if_x25subr.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)if_x25subr.c 7.14 (Berkeley) 6/26/91 - * $Id: if_x25subr.c,v 1.2 1993/10/16 19:46:44 rgrimes Exp $ + * $Id: if_x25subr.c,v 1.3 1993/11/25 01:34:25 wollman Exp $ */ #include "param.h" @@ -642,7 +642,7 @@ x25_dg_rtinit(dst, ia, af) * This uses the X25 routing table to do inverse * lookup of x25 address to sockaddr. */ - if (rt = rtalloc1(dst, 0)) { + if (rt = rtalloc1((struct sockaddr *)dst, 0)) { sa = rt->rt_gateway; rt->rt_refcnt--; } diff --git a/sys/netccitt/pk_debug.c b/sys/netccitt/pk_debug.c index 43db95bde2..7508051082 100644 --- a/sys/netccitt/pk_debug.c +++ b/sys/netccitt/pk_debug.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)pk_debug.c 7.7 (Berkeley) 5/9/91 - * $Id: pk_debug.c,v 1.2 1993/10/16 19:46:48 rgrimes Exp $ + * $Id: pk_debug.c,v 1.3 1993/11/25 01:34:28 wollman Exp $ */ #include "param.h" @@ -53,13 +53,13 @@ #include "pk.h" #include "pk_var.h" -char *pk_state[] = { +const char *const pk_state[] = { "Listen", "Ready", "Received-Call", "Sent-Call", "Data-Transfer","Received-Clear", "Sent-Clear", }; -char *pk_name[] = { +const char *const pk_name[] = { "Call", "Call-Conf", "Clear", "Clear-Conf", "Data", "Intr", "Intr-Conf", "Rr", "Rnr", "Reset", "Reset-Conf", @@ -71,7 +71,7 @@ void pk_trace (xcp, m, dir) struct x25config *xcp; register struct mbuf *m; - char *dir; + const char *dir; { register char *s; struct x25_packet *xp = mtod(m, struct x25_packet *); diff --git a/sys/netccitt/pk_input.c b/sys/netccitt/pk_input.c index 23c10aa30c..e1c833a3b8 100644 --- a/sys/netccitt/pk_input.c +++ b/sys/netccitt/pk_input.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)pk_input.c 7.14 (Berkeley) 7/16/91 - * $Id: pk_input.c,v 1.3 1993/10/30 06:37:09 rgrimes Exp $ + * $Id: pk_input.c,v 1.4 1993/11/25 01:34:29 wollman Exp $ */ #include "param.h" @@ -170,6 +170,7 @@ pk_ctlinput (code, pkp) } return (0); } + struct ifqueue pkintrq; /* * This routine is called if there are semi-smart devices that do HDLC @@ -260,7 +261,7 @@ pk_input (m) /* send response on lcd 0's output queue */ lcp = pkp -> pk_chan[0]; lcp -> lcd_template = pk_template (lcn, X25_CLEAR_CONFIRM); - pk_output (lcp); + pk_output (lcp, 0); m_freem (m); return; } @@ -322,7 +323,7 @@ pk_input (m) case CLEAR + DATA_TRANSFER: lcp -> lcd_state = RECEIVED_CLEAR; lcp -> lcd_template = pk_template (lcp -> lcd_lcn, X25_CLEAR_CONFIRM); - pk_output (lcp); + pk_output (lcp, 0); pk_clearcause (pkp, xp); if (lcp -> lcd_upper) { MCHTYPE(m, MT_CONTROL); @@ -460,7 +461,7 @@ pk_input (m) break; lcp -> lcd_intrdata = xp -> packet_data; lcp -> lcd_template = pk_template (lcp -> lcd_lcn, X25_INTERRUPT_CONFIRM); - pk_output (lcp); + pk_output (lcp, 0); m -> m_data += PKHEADERLN; m -> m_len -= PKHEADERLN; m -> m_pkthdr.len -= PKHEADERLN; @@ -498,7 +499,7 @@ pk_input (m) } if (lcp -> lcd_rnr_condition == TRUE) lcp -> lcd_rnr_condition = FALSE; - pk_output (lcp); + pk_output (lcp, 0); break; /* @@ -533,7 +534,7 @@ pk_input (m) lcp -> lcd_rsn = MODULUS - 1; lcp -> lcd_template = pk_template (lcp -> lcd_lcn, X25_RESET_CONFIRM); - pk_output (lcp); + pk_output (lcp, 0); pk_flush(lcp); if (so == 0) @@ -549,7 +550,7 @@ pk_input (m) case RESET_CONF + DATA_TRANSFER: if (lcp -> lcd_reset_condition) { lcp -> lcd_reset_condition = FALSE; - pk_output (lcp); + pk_output (lcp, 0); } else pk_procerror (RESET, lcp, "unexpected packet", 32); @@ -586,7 +587,7 @@ pk_input (m) pk_restartcause (pkp, xp); pkp -> pk_chan[0] -> lcd_template = pk_template (0, X25_RESTART_CONFIRM); - pk_output (pkp -> pk_chan[0]); + pk_output (pkp -> pk_chan[0], 0); } break; @@ -648,8 +649,7 @@ copyrest: cp2++; } -/* static */ -void +static void pk_simple_bsd (from, to, lower, len) register octet *from, *to; register len, lower; @@ -666,8 +666,7 @@ pk_simple_bsd (from, to, lower, len) *to = 0; } -/*static octet * */ -void +static void pk_from_bcd (a, iscalling, sa, xcp) register struct x25_calladdr *a; int iscalling; @@ -706,7 +705,7 @@ save_extra(m0, fp, so) { register struct mbuf *m = 0; struct cmsghdr cmsghdr; - if (m = m_copym (m, 0, (int)M_COPYALL), M_DONTWAIT) { + if (m = m_copym (m, 0, (int)M_COPYALL, M_DONTWAIT)) { int off = fp - mtod (m0, octet *); int len = m->m_pkthdr.len - off + sizeof (cmsghdr); cmsghdr.cmsg_len = len; @@ -831,7 +830,7 @@ pk_incoming_call (pkp, m0) lcp -> lcd_flags &= ~X25_DBIT; } if (so) { - pk_output (lcp); + pk_output (lcp, 0); soisconnected (so); if (so -> so_options & SO_OOBINLINE) save_extra(m0, facp, so); diff --git a/sys/netccitt/pk_output.c b/sys/netccitt/pk_output.c index 3045806a77..347bd1cc60 100644 --- a/sys/netccitt/pk_output.c +++ b/sys/netccitt/pk_output.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)pk_output.c 7.10 (Berkeley) 5/29/91 - * $Id: pk_output.c,v 1.2 1993/10/16 19:46:51 rgrimes Exp $ + * $Id: pk_output.c,v 1.3 1993/11/25 01:34:30 wollman Exp $ */ #include "param.h" @@ -54,11 +54,17 @@ #include "pk_var.h" struct mbuf_cache pk_output_cache = {0 }; -struct mbuf *nextpk (); +static struct mbuf *nextpk (struct pklcd *); -void -pk_output (lcp) +/* + * The `n' argument is just there to make if_x25subr.c happy. We + * don't actually do anything with it, although meybe we should. + * All the other code passes in a null pointer. + */ +int +pk_output (lcp, n) register struct pklcd *lcp; + struct mbuf *n; { register struct x25_packet *xp; register struct mbuf *m; @@ -66,7 +72,7 @@ pk_output (lcp) if (lcp == 0 || pkp == 0) { printf ("pk_output: zero arg\n"); - return; + return -1; } while ((m = nextpk (lcp)) != NULL) { @@ -167,7 +173,7 @@ pk_output (lcp) default: m_freem (m); - return; + return 0; } /* Trace the packet. */ @@ -178,6 +184,7 @@ pk_output (lcp) mbuf_cache(&pk_output_cache, m); (*pkp -> pk_lloutput) (pkp -> pk_llnext, m); } + return 0; } /* @@ -185,9 +192,9 @@ pk_output (lcp) * packet is composed of one or more mbufs. */ -struct mbuf * +static struct mbuf * nextpk (lcp) -struct pklcd *lcp; + struct pklcd *lcp; { register struct mbuf *m, *n; struct socket *so = lcp -> lcd_so; diff --git a/sys/netccitt/pk_subr.c b/sys/netccitt/pk_subr.c index c8df39e19c..ac538040d5 100644 --- a/sys/netccitt/pk_subr.c +++ b/sys/netccitt/pk_subr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)pk_subr.c 7.16 (Berkeley) 6/6/91 - * $Id: pk_subr.c,v 1.3 1993/11/17 23:32:23 wollman Exp $ + * $Id: pk_subr.c,v 1.4 1993/11/25 01:34:31 wollman Exp $ */ #include "param.h" @@ -75,7 +75,6 @@ struct socket *so; { register struct pklcd *lcp; register int error = ENOBUFS; - int pk_output(); MALLOC(lcp, struct pklcd *, sizeof (*lcp), M_PCB, M_NOWAIT); if (lcp) { @@ -243,7 +242,7 @@ pk_restart (pkp, restart_cause) m -> m_pkthdr.len = m -> m_len += 2; mtod (m, struct x25_packet *) -> packet_data = 0; /* DTE only */ mtod (m, octet *)[4] = restart_cause; - pk_output (lcp); + pk_output (lcp, 0); } @@ -616,7 +615,7 @@ pk_clear (lcp, diagnostic, abortive) struct sockbuf *sb = so ? & so -> so_snd : & lcp -> lcd_sb; sbappendrecord (sb, m); } - pk_output (lcp); + pk_output (lcp, 0); } @@ -638,7 +637,7 @@ pk_flowcontrol (lcp, inhibit, forced) lcp -> lcd_rxrnr_condition = inhibit; lcp -> lcd_template = pk_template (lcp -> lcd_lcn, inhibit ? X25_RNR : X25_RR); - pk_output (lcp); + pk_output (lcp, 0); } /* @@ -673,7 +672,7 @@ pk_reset (lcp, diagnostic) m -> m_pkthdr.len = m -> m_len += 2; mtod (m, struct x25_packet *) -> packet_data = 0; mtod (m, octet *)[4] = diagnostic; - pk_output (lcp); + pk_output (lcp, 0); } @@ -713,7 +712,7 @@ void pk_procerror (error, lcp, errstr, diagnostic) int error; register struct pklcd *lcp; - char *errstr; + const char *errstr; int diagnostic; { @@ -982,8 +981,8 @@ pk_message (int lcn, struct x25config *xcp, const char *fmt, ...) int pk_fragment (lcp, m0, qbit, mbit, wait) - struct mbuf *m0; register struct pklcd *lcp; + struct mbuf *m0; int qbit; int mbit; int wait; @@ -1045,62 +1044,3 @@ abort: return ENOBUFS; } -struct mbuf * -m_split (m0, len0, wait) - register struct mbuf *m0; - int len0; - int wait; -{ - register struct mbuf *m, *n; - unsigned len = len0, remain; - - for (m = m0; m && len > m -> m_len; m = m -> m_next) - len -= m -> m_len; - if (m == 0) - return (0); - remain = m -> m_len - len; - if (m0 -> m_flags & M_PKTHDR) { - MGETHDR(n, wait, m0 -> m_type); - if (n == 0) - return (0); - n -> m_pkthdr.rcvif = m0 -> m_pkthdr.rcvif; - n -> m_pkthdr.len = m0 -> m_pkthdr.len - len0; - m0 -> m_pkthdr.len = len0; - if (m -> m_flags & M_EXT) - goto extpacket; - if (remain > MHLEN) { - /* m can't be the lead packet */ - MH_ALIGN(n, 0); - n -> m_next = m_split (m, len, wait); - if (n -> m_next == 0) { - (void) m_free (n); - return (0); - } else - return (n); - } else - MH_ALIGN(n, remain); - } else if (remain == 0) { - n = m -> m_next; - m -> m_next = 0; - return (n); - } else { - MGET(n, wait, m -> m_type); - if (n == 0) - return (0); - M_ALIGN(n, remain); - } -extpacket: - if (m -> m_flags & M_EXT) { - n -> m_flags |= M_EXT; - n -> m_ext = m -> m_ext; - mclrefcnt[mtocl (m -> m_ext.ext_buf)]++; - n -> m_data = m -> m_data + len; - } else { - bcopy (mtod (m, caddr_t) + len, mtod (n, caddr_t), remain); - } - n -> m_len = remain; - m -> m_len = len; - n -> m_next = m -> m_next; - m -> m_next = 0; - return (n); -} diff --git a/sys/netccitt/pk_timer.c b/sys/netccitt/pk_timer.c index 17c44ceae9..6655e9aabb 100644 --- a/sys/netccitt/pk_timer.c +++ b/sys/netccitt/pk_timer.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)pk_timer.c 7.5 (Berkeley) 5/29/91 - * $Id: pk_timer.c,v 1.2 1993/10/16 19:46:55 rgrimes Exp $ + * $Id: pk_timer.c,v 1.3 1993/11/25 01:34:32 wollman Exp $ */ #include "param.h" @@ -60,7 +60,7 @@ int pk_t20 = 18 * PR_SLOWHZ; /* restart timer */ int pk_t21 = 20 * PR_SLOWHZ; /* call timer */ /* XXX pk_t22 is never used */ -int pk_t22 = 18 * PR_SLOWHZ; /* reset timer */ +/*int pk_t22 = 18 * PR_SLOWHZ;*/ /* reset timer */ int pk_t23 = 18 * PR_SLOWHZ; /* clear timer */ void diff --git a/sys/netccitt/pk_usrreq.c b/sys/netccitt/pk_usrreq.c index 248cb73451..9833624223 100644 --- a/sys/netccitt/pk_usrreq.c +++ b/sys/netccitt/pk_usrreq.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)pk_usrreq.c 7.16 (Berkeley) 6/27/91 - * $Id: pk_usrreq.c,v 1.3 1993/10/16 19:46:56 rgrimes Exp $ + * $Id: pk_usrreq.c,v 1.4 1993/11/25 01:34:33 wollman Exp $ */ #include "param.h" @@ -306,13 +306,12 @@ release: * other X.25 level 2 driver, have the ifp -> if_ioctl routine * assign pk_start to ia -> ia_start when called with SIOCSIFCONF_X25. */ -/* ARGSUSED */ int pk_start (lcp) register struct pklcd *lcp; { - pk_output (lcp); - return (0); /* XXX pk_output should return a value */ + pk_output (lcp, 0); + return 0; } #ifndef _offsetof diff --git a/sys/netccitt/pk_var.h b/sys/netccitt/pk_var.h index 62365d5a16..b623f64a96 100644 --- a/sys/netccitt/pk_var.h +++ b/sys/netccitt/pk_var.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)pk_var.h 7.11 (Berkeley) 5/29/91 - * $Id: pk_var.h,v 1.3 1993/11/07 17:47:26 wollman Exp $ + * $Id: pk_var.h,v 1.4 1993/11/25 01:34:36 wollman Exp $ */ @@ -125,7 +125,7 @@ struct x25_ifaddr { #define ia_flags ia_ifa.ifa_flags struct x25config ia_xc; /* network specific configuration */ #define ia_maxlcn ia_xc.xc_maxlcn - int (*ia_start) (); /* connect, confirm method */ + int (*ia_start) (struct pklcd *); /* connect, confirm method */ struct sockaddr_x25 ia_dstaddr; /* reserve space for route dst */ }; @@ -172,7 +172,6 @@ struct mbuf_cache { #if defined(KERNEL) && defined(CCITT) struct pkcb *pkcbhead; /* head of linked list of networks */ struct pklcd *pk_listenhead; -struct pklcd *pk_attach(); struct sockaddr_in; struct sockaddr_x25; @@ -183,19 +182,67 @@ extern void x25_rtinvert(int, struct sockaddr *, struct rtentry *); extern void x25_ddnip_to_ccitt(struct sockaddr_in *, struct rtentry *); extern void x25_rtattach(struct pklcd *, struct rtentry *); -extern void pk_input(struct mbuf *); -extern void pk_incoming_call(struct pkcb *, struct mbuf *); -extern void pk_call_accepted(struct pklcd *, struct mbuf *); -extern void pk_parse_facilities(octet *, struct sockaddr_x25 *); +/* From pk_subr.c: */ +extern struct pklcd *pk_attach(struct socket *); +extern void pk_disconnect(struct pklcd *); extern void pk_close(struct pklcd *); +extern struct mbuf *pk_template(int, int); +extern void pk_restart(struct pkcb *, int); extern void pk_freelcd(struct pklcd *); +extern int pk_bind(struct pklcd *, struct mbuf *); +extern int pk_listen(struct pklcd *); +extern int pk_protolisten(int, int, void (*)(/* XXX */)); +extern void pk_assoc(struct pkcb *, struct pklcd *, struct sockaddr_x25 *); +extern int pk_connect(struct pklcd *, struct sockaddr_x25 *); extern void pk_callrequest(struct pklcd *, struct sockaddr_x25 *, struct x25config *); extern void pk_build_facilities(struct mbuf *, struct sockaddr_x25 *, int); +extern int pk_getlcn(struct pkcb *); extern void pk_clear(struct pklcd *, int, int); +extern void pk_flowcontrol(struct pklcd *, int, int); extern void pk_flush(struct pklcd *); +extern void pk_procerror(int, struct pklcd *, const char *, int); +extern int pk_ack(struct pklcd *, unsigned); +extern int pk_decode(struct x25_packet *); +extern void pk_restartcause(struct pkcb *, struct x25_packet *); +extern void pk_resetcause(struct pkcb *, struct x25_packet *); +extern void pk_clearcause(struct pkcb *, struct x25_packet *); extern void pk_message(int, struct x25config *, const char *, ...); +extern int pk_fragment(struct pklcd *, struct mbuf *, int, int, int); + +/* From pk_input.c: */ +extern struct pkcb *pk_newlink(struct x25_ifaddr *, caddr_t); +extern int pk_resize(struct pkcb *); +extern int /*void*/ pk_ctlinput(int, struct pkcb *); +extern struct ifqueue pkintrq; +extern void pkintr(void); /* called from locore */ +extern void pk_input(struct mbuf *); +extern void pk_incoming_call(struct pkcb *, struct mbuf *); +extern void pk_call_accepted(struct pklcd *, struct mbuf *); +extern void pk_parse_facilities(octet *, struct sockaddr_x25 *); + +/* From pk_output.c: */ +extern int pk_output(struct pklcd *, struct mbuf *); + +/* From pk_acct.c: */ +extern int pk_accton(char *); +extern void pk_acct(struct pklcd *); + +/* From pk_debug.c: */ +extern const char *const pk_name[], *const pk_state[]; +extern void pk_trace(struct x25config *, struct mbuf *, const char *); +extern void mbuf_cache(struct mbuf_cache *, struct mbuf *); + +/* From pk_timer.c: */ +extern int pk_t20, pk_t21, pk_t23; +extern void pk_timer(void); + +/* From pk_usrreq.c: */ +extern int pk_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *); +extern int pk_start(struct pklcd *); +extern int pk_control(struct socket *, int, caddr_t, struct ifnet *); +extern int pk_ctloutput(int, struct socket *, int, int, struct mbuf **); +extern int pk_checksockaddr(struct mbuf *); +extern int pk_send(struct pklcd *, struct mbuf *); -extern char *pk_name[], *pk_state[]; -int pk_t20, pk_t21, pk_t22, pk_t23; #endif #endif /* _NETCCITT_PK_VAR_H_ */ diff --git a/sys/netinet/icmp_var.h b/sys/netinet/icmp_var.h index c8142c6da9..c5a2a78835 100644 --- a/sys/netinet/icmp_var.h +++ b/sys/netinet/icmp_var.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)icmp_var.h 7.5 (Berkeley) 6/28/90 - * $Id: icmp_var.h,v 1.3 1993/11/07 17:47:45 wollman Exp $ + * $Id: icmp_var.h,v 1.4 1993/11/18 00:08:11 wollman Exp $ */ #ifndef _NETINET_ICMP_VAR_H_ @@ -60,5 +60,9 @@ struct icmpstat { #ifdef KERNEL extern struct icmpstat icmpstat; +extern int icmpprintfs; +extern int ipbroadcastecho; +extern int ipmaskagent; +extern struct sockaddr_in icmpmask; #endif #endif /* _NETINET_ICMP_VAR_H_ */ diff --git a/sys/netinet/in.c b/sys/netinet/in.c index c3a90c3fb1..f4329a1888 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)in.c 7.17 (Berkeley) 4/20/91 - * $Id: in.c,v 1.5 1993/11/18 00:08:13 wollman Exp $ + * $Id: in.c,v 1.6 1993/11/25 01:35:02 wollman Exp $ */ #include "param.h" @@ -47,8 +47,6 @@ #include "in_var.h" #ifdef INET -struct in_ifaddr *in_ifaddr; -struct ifqueue ipintrq; static void in_ifscrub(struct ifnet *, struct in_ifaddr *); @@ -189,10 +187,6 @@ in_lnaof(in) return (host); } -#ifndef SUBNETSARELOCAL -#define SUBNETSARELOCAL 1 -#endif -int subnetsarelocal = SUBNETSARELOCAL; /* * Return 1 if an internet address is for a ``local'' host * (one to which we have a connection). If subnetsarelocal @@ -240,8 +234,7 @@ in_canforward(in) return (1); } -int in_interfaces; /* number of external internet interfaces */ -extern struct ifnet loif; +static int in_interfaces; /* number of external internet interfaces */ /* * Generic internet control operations (ioctl's). diff --git a/sys/netinet/in.h b/sys/netinet/in.h index df657adb4d..13499d8c92 100644 --- a/sys/netinet/in.h +++ b/sys/netinet/in.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)in.h 7.11 (Berkeley) 4/20/91 - * $Id$ + * $Id: in.h,v 1.3 1993/10/16 18:25:58 rgrimes Exp $ */ #ifndef _NETINET_IN_H_ @@ -82,33 +82,33 @@ struct in_addr { * On subnets, the decomposition of addresses to host and net parts * is done according to subnet mask, not the masks here. */ -#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) -#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA(i) (((u_long)(i) & 0x80000000UL) == 0) +#define IN_CLASSA_NET 0xff000000UL #define IN_CLASSA_NSHIFT 24 -#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_HOST 0x00ffffffUL #define IN_CLASSA_MAX 128 -#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) -#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB(i) (((u_long)(i) & 0xc0000000UL) == 0x80000000UL) +#define IN_CLASSB_NET 0xffff0000UL #define IN_CLASSB_NSHIFT 16 -#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_HOST 0x0000ffffUL #define IN_CLASSB_MAX 65536 -#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) -#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC(i) (((u_long)(i) & 0xe0000000UL) == 0xc0000000UL) +#define IN_CLASSC_NET 0xffffff00UL #define IN_CLASSC_NSHIFT 8 -#define IN_CLASSC_HOST 0x000000ff +#define IN_CLASSC_HOST 0x000000ffUL -#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) +#define IN_CLASSD(i) (((u_long)(i) & 0xf0000000UL) == 0xe0000000UL) #define IN_MULTICAST(i) IN_CLASSD(i) -#define IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000) == 0xe0000000) -#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) +#define IN_EXPERIMENTAL(i) (((u_long)(i) & 0xe0000000UL) == 0xe0000000UL) +#define IN_BADCLASS(i) (((u_long)(i) & 0xf0000000UL) == 0xf0000000UL) -#define INADDR_ANY (u_long)0x00000000 -#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */ +#define INADDR_ANY 0x00000000UL +#define INADDR_BROADCAST 0xffffffffUL /* must be masked */ #ifndef KERNEL -#define INADDR_NONE 0xffffffff /* -1 return */ +#define INADDR_NONE 0xffffffffUL /* -1 return */ #endif #define IN_LOOPBACKNET 127 /* official! */ @@ -150,8 +150,18 @@ struct ip_opts { #define IP_RETOPTS 8 /* ip_opts; set/get IP per-packet options */ #ifdef KERNEL -struct in_addr in_makeaddr(); -u_long in_netof(), in_lnaof(); -#endif +/* From in.c: */ +extern struct in_addr in_makeaddr(u_long, u_long); +extern u_long in_netof(struct in_addr); +extern void in_sockmaskof(struct in_addr, struct sockaddr_in *); +extern u_long in_lnaof(struct in_addr); +extern int in_localaddr(struct in_addr); +extern int in_canforward(struct in_addr); +struct socket; struct ifnet; +extern int in_control(struct socket *, int, caddr_t, struct ifnet *); +struct in_ifaddr; +extern int in_broadcast(struct in_addr); + +#endif /* KERNEL */ #endif /* _NETINET_IN_H_ */ diff --git a/sys/netinet/in_mtudisc.c b/sys/netinet/in_mtudisc.c index cb52ba1d04..ffbb2179d8 100644 --- a/sys/netinet/in_mtudisc.c +++ b/sys/netinet/in_mtudisc.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: in_mtudisc.c,v 1.1 1993/11/18 00:08:14 wollman Exp $ */ #ifdef MTUDISC @@ -61,28 +61,12 @@ struct inpcb *checkpcbs[] = { 0 }; -/* - * MTUTIMER1 is the number of minutes to wait after having incremented - * the MTU estimate before trying again. MTUTIMER2 is the number - * of minutes to wait after having decremented the MTU estimate - * before trying to increment it. - */ -#ifndef MTUTIMER1 -#define MTUTIMER1 2 -#endif -int in_mtutimer1 = MTUTIMER1; - -#ifndef MTUTIMER2 -#define MTUTIMER2 10 -#endif -int in_mtutimer2 = MTUTIMER2; - /* * Table of likely MTU values, courtesy of RFC 1191. * This MUST remain in sorted order. */ -const u_short in_mtus[] = { +static const u_short in_mtus[] = { 65535, /* maximum */ 32767, /* convenient power of 2 - 1 */ 17914, /* 16Mb Token Ring */ diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index be54b9a44b..a38a730476 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)in_pcb.c 7.14 (Berkeley) 4/20/91 - * $Id: in_pcb.c,v 1.3 1993/11/18 00:08:15 wollman Exp $ + * $Id: in_pcb.c,v 1.4 1993/11/25 01:35:05 wollman Exp $ */ #include "param.h" @@ -52,8 +52,6 @@ #include "in_pcb.h" #include "in_var.h" -struct in_addr zeroin_addr; - int in_pcballoc(so, head) struct socket *so; diff --git a/sys/netinet/in_proto.c b/sys/netinet/in_proto.c index 8ea718ee33..296b4ae88d 100644 --- a/sys/netinet/in_proto.c +++ b/sys/netinet/in_proto.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)in_proto.c 7.5 (Berkeley) 6/28/90 - * $Id$ + * $Id: in_proto.c,v 1.2 1993/10/16 18:26:04 rgrimes Exp $ */ #include "param.h" @@ -39,23 +39,52 @@ #include "protosw.h" #include "domain.h" #include "mbuf.h" +#include "net/if.h" +#include "net/route.h" #include "in.h" #include "in_systm.h" +#include "in_var.h" /* IP prototypes */ + +#include "ip.h" +#include "ip_var.h" /* more IP prototypes */ + +#include "ip_icmp.h" +#include "icmp_var.h" /* ICMP prototypes */ + +#include "udp.h" +#include "udp_var.h" /* UDP prototypes */ + +#include "tcp.h" +#include "tcp_fsm.h" +#include "tcp_seq.h" +#include "tcp_timer.h" +#include "tcp_var.h" /* TCP prototypes */ /* * TCP/IP protocol family: IP, ICMP, UDP, TCP. */ -int ip_output(),ip_ctloutput(); -int ip_init(),ip_slowtimo(),ip_drain(); -int icmp_input(); -int udp_input(),udp_ctlinput(); -int udp_usrreq(); -int udp_init(); -int tcp_input(),tcp_ctlinput(); -int tcp_usrreq(),tcp_ctloutput(); -int tcp_init(),tcp_fasttimo(),tcp_slowtimo(),tcp_drain(); -int rip_input(),rip_output(),rip_ctloutput(), rip_usrreq(); +in_output_t ip_output; +in_ctloutput_t ip_ctloutput; +void ip_init(); +void ip_slowtimo(); +void ip_drain(); +in_input_t udp_input; +in_ctlinput_t udp_ctlinput; +int udp_usrreq(); +void udp_init(); +in_input_t tcp_input; +in_ctlinput_t tcp_ctlinput; +int tcp_usrreq(); +in_ctloutput_t tcp_ctloutput; +void tcp_init(); +void tcp_fasttimo(); +void tcp_slowtimo(); +void tcp_drain(); +in_input_t rip_input; +in_output_t rip_output; +in_ctloutput_t rip_ctloutput; +int rip_usrreq(); /* * IMP protocol family: raw interface. * Using the raw interface entry to get the timer routine @@ -63,25 +92,34 @@ int rip_input(),rip_output(),rip_ctloutput(), rip_usrreq(); */ #include "imp.h" #if NIMP > 0 -int rimp_output(), hostslowtimo(); +int rimp_output(); +void hostslowtimo(); #endif #ifdef NSIP -int idpip_input(), nsip_ctlinput(); +in_input_t idpip_input; +in_ctlinput_t nsip_ctlinput; #endif #ifdef TPIP -int tpip_input(), tpip_ctlinput(), tp_ctloutput(), tp_usrreq(); -int tp_init(), tp_slowtimo(), tp_drain(); +in_input_t tpip_input; +in_ctlinput_t tpip_ctlinput; +in_ctloutput_t tp_ctloutput; +int tp_usrreq(); +void tp_init(); +void tp_slowtimo(); +void tp_drain(); #endif #ifdef EON -int eoninput(), eonctlinput(), eonprotoinit(); -#endif EON +in_input_t eoninput; +in_ctlinput_t eonctlinput; +void eonprotoinit(); +#endif /* EON */ extern struct domain inetdomain; -struct protosw inetsw[] = { +struct in_protosw inetsw[] = { { 0, &inetdomain, 0, 0, 0, ip_output, 0, 0, 0, @@ -138,8 +176,10 @@ struct protosw inetsw[] = { }; struct domain inetdomain = - { AF_INET, "internet", 0, 0, 0, - inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])] }; +{ AF_INET, "internet", 0, 0, 0, + (struct protosw *)inetsw, + (struct protosw *)&inetsw[sizeof(inetsw)/sizeof(inetsw[0])] +}; #if NIMP > 0 extern struct domain impdomain; diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h index b14dc6ce51..3b37b6a419 100644 --- a/sys/netinet/in_var.h +++ b/sys/netinet/in_var.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)in_var.h 7.6 (Berkeley) 6/28/90 - * $Id: in_var.h,v 1.3 1993/11/07 17:47:53 wollman Exp $ + * $Id: in_var.h,v 1.4 1993/11/18 00:08:17 wollman Exp $ */ #ifndef _NETINET_IN_VAR_H_ @@ -73,18 +73,64 @@ struct in_aliasreq { */ #define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr)) +struct ip; /* forward declaration */ +typedef void in_input_t(struct mbuf *, int); +typedef int in_output_t(struct mbuf *, struct socket *); +typedef void in_ctlinput_t(int, struct sockaddr *, struct ip *); +typedef int in_ctloutput_t(int, struct socket *, int, int, struct mbuf **); + +/* + * This structure is a pun for `struct protosw'. The difference is that it + * has appropriate interprotocol hook prototypes for the Internet family. + */ +struct in_protosw { + short pr_type; /* socket type used for */ + struct domain *pr_domain; /* domain protocol a member of */ + short pr_protocol; /* protocol number */ + short pr_flags; /* see below */ +/* protocol-protocol hooks */ + in_input_t *pr_input; + in_output_t *pr_output; + in_ctlinput_t *pr_ctlinput; + in_ctloutput_t *pr_ctloutput; +/* user-protocol hook */ + int (*pr_usrreq)(struct socket *, int, struct mbuf *, + struct mbuf *, struct mbuf *, struct mbuf *); +/* utility hooks */ + void (*pr_init)(void); /* initialization hook */ + void (*pr_fasttimo)(void); /* fast timeout (200ms) */ + void (*pr_slowtimo)(void); /* slow timeout (500ms) */ + void (*pr_drain)(void); /* flush any excess space possible */ +}; + + #ifdef KERNEL -extern struct in_ifaddr *in_ifaddr; -struct in_ifaddr *in_iaonnetof(); -extern struct ifqueue ipintrq; /* ip packet input queue */ -extern struct protosw inetsw[]; -extern u_char ip_protox[]; -extern struct in_addr in_makeaddr(); +extern struct in_ifaddr *in_ifaddr; +extern struct in_ifaddr *in_iaonnetof(u_long); extern struct in_ifaddr *ifptoia(struct ifnet *); +extern int in_ifinit(struct ifnet *, struct in_ifaddr *, struct sockaddr_in *, int); + +extern int in_cksum(struct mbuf *, int); + +extern struct ifqueue ipintrq; /* ip packet input queue */ +extern struct in_protosw inetsw[]; +extern struct domain inetdomain; +extern u_char ip_protox[]; extern u_char inetctlerrmap[]; extern struct in_addr zeroin_addr; -#ifdef MTUDISC + +/* From in_var.c: */ struct route; +extern int subnetsarelocal; /* obsolescent */ +extern int ipqmaxlen; +extern u_long *ip_ifmatrix; +extern int ipforwarding; +extern struct sockaddr_in ipaddr; +extern struct route ipforward_rt; +extern int ipsendredirects; + + +#ifdef MTUDISC extern unsigned in_nextmtu(unsigned, int); extern int in_routemtu(struct route *); extern void in_mtureduce(struct in_addr, unsigned); diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index 3402a1b896..496fb92140 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)ip_icmp.c 7.15 (Berkeley) 4/20/91 - * $Id: ip_icmp.c,v 1.4 1993/11/18 00:08:18 wollman Exp $ + * $Id: ip_icmp.c,v 1.5 1993/11/25 01:35:07 wollman Exp $ */ #include "param.h" @@ -58,21 +58,6 @@ * routines to turnaround packets back to the originator, and * host table maintenance routines. */ -#ifdef ICMPPRINTFS -int icmpprintfs = 0; -#endif - -#ifndef IPBROADCASTECHO -#define IPBROADCASTECHO 0 -#endif -int ipbroadcastecho = IPBROADCASTECHO; - -#ifndef IPMASKAGENT -#define IPMASKAGENT 0 -#endif -int ipmaskagent = IPMASKAGENT; - -struct icmpstat icmpstat; #define satosin(sa) ((struct sockaddr_in *)(sa)) static void icmp_reflect(struct mbuf *); @@ -228,7 +213,6 @@ static struct sockproto icmproto = { AF_INET, IPPROTO_ICMP }; static struct sockaddr_in icmpsrc = { sizeof (struct sockaddr_in), AF_INET }; static struct sockaddr_in icmpdst = { sizeof (struct sockaddr_in), AF_INET }; static struct sockaddr_in icmpgw = { sizeof (struct sockaddr_in), AF_INET }; -struct sockaddr_in icmpmask = { 8, 0 }; /* * Process a received ICMP message. @@ -243,7 +227,8 @@ icmp_input(m, hlen) int icmplen = ip->ip_len; register int i; struct in_ifaddr *ia; - int (*ctlfunc)(), code; + in_ctlinput_t *ctlfunc; + int code; /* * Locate icmp structure in mbuf, and check @@ -340,7 +325,7 @@ icmp_input(m, hlen) icmpsrc.sin_addr = icp->icmp_ip.ip_dst; if (ctlfunc = inetsw[ip_protox[icp->icmp_ip.ip_p]].pr_ctlinput) (*ctlfunc)(code, (struct sockaddr *)&icmpsrc, - (caddr_t) &icp->icmp_ip); + &icp->icmp_ip); break; badcode: diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 75ca5f7d5c..155d6deca9 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)ip_input.c 7.19 (Berkeley) 5/25/91 - * $Id: ip_input.c,v 1.5 1993/11/18 00:08:20 wollman Exp $ + * $Id: ip_input.c,v 1.6 1993/11/25 01:35:08 wollman Exp $ */ #include "param.h" @@ -56,47 +56,12 @@ #include "ip_var.h" #include "ip_icmp.h" -#ifndef IPFORWARDING -#ifdef GATEWAY -#define IPFORWARDING 1 /* forward IP packets not for us */ -#else /* not GATEWAY */ -#define IPFORWARDING 0 /* don't forward IP packets not for us */ -#endif /* not GATEWAY */ -#endif /* not IPFORWARDING */ - -/* - * NB: RFC 1122, ``Requirements for Internet Hosts: Communication Layers'', - * absolutely forbids hosts (which are not acting as gateways) from sending - * ICMP redirects. - */ -#ifndef IPSENDREDIRECTS -#ifdef GATEWAY -#define IPSENDREDIRECTS 1 -#else /* not GATEWAY */ -#define IPSENDREDIRECTS 0 -#endif /* not GATEWAY */ -#endif /* not IPSENDREDIRECTS */ - -int ipforwarding = IPFORWARDING; -int ipsendredirects = IPSENDREDIRECTS; -#ifdef DIAGNOSTIC -int ipprintfs = 0; -#endif - static void ip_freef(struct ipq *); static void ip_enq(struct ipasfrag *, struct ipasfrag *); static void ip_deq(struct ipasfrag *); static void save_rte(u_char *, struct in_addr); static void ip_forward(struct mbuf *, int); - -extern struct domain inetdomain; -extern struct protosw inetsw[]; -u_char ip_protox[IPPROTO_MAX]; -int ipqmaxlen = IFQ_MAXLEN; -struct in_ifaddr *in_ifaddr; /* first inet address */ -struct ipstat ipstat; -struct ipq ipq; -u_short ip_id; +static struct ip *ip_reass(struct ipasfrag *, struct ipq *); /* * We need to save the IP options in case a protocol wants to respond @@ -113,10 +78,7 @@ static struct ip_srcrt { struct in_addr route[MAX_IPOPTLEN/sizeof(struct in_addr)]; } ip_srcrt; -#ifdef GATEWAY extern int if_index; -u_long *ip_ifmatrix; -#endif /* * IP initialization: fill in IP protocol switch table. @@ -125,16 +87,16 @@ u_long *ip_ifmatrix; void ip_init() { - register struct protosw *pr; + register struct in_protosw *pr; register int i; - pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW); + pr = (struct in_protosw *)pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW); if (pr == 0) panic("ip_init"); for (i = 0; i < IPPROTO_MAX; i++) ip_protox[i] = pr - inetsw; - for (pr = inetdomain.dom_protosw; - pr < inetdomain.dom_protoswNPROTOSW; pr++) + for (pr = (struct in_protosw *)inetdomain.dom_protosw; + pr < (struct in_protosw *)inetdomain.dom_protoswNPROTOSW; pr++) if (pr->pr_domain->dom_family == PF_INET && pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW) ip_protox[pr->pr_protocol] = pr - inetsw; @@ -148,10 +110,6 @@ ip_init() #endif } -struct ip *ip_reass(); -struct sockaddr_in ipaddr = { sizeof(ipaddr), AF_INET }; -struct route ipforward_rt; - /* * Ip input routine. Checksum and byte swap header. If fragmented * try to reassemble. Process options. Pass to next level. @@ -370,7 +328,7 @@ bad: * reassembly of this datagram already exists, then it * is given as fp; otherwise have to make a chain. */ -struct ip * +static struct ip * ip_reass(ip, fp) register struct ipasfrag *ip; register struct ipq *fp; @@ -930,42 +888,6 @@ ip_stripoptions(m, mopt) ip->ip_hl = sizeof(struct ip) >> 2; } -u_char inetctlerrmap[PRC_NCMDS] = { - 0, /* ifdown */ - 0, /* routedead */ - 0, /* #2 */ - 0, /* quench2 */ - 0, /* quench */ - EMSGSIZE, /* msgsize */ - EHOSTDOWN, /* hostdead */ - EHOSTUNREACH, /* hostunreach */ - EHOSTUNREACH, /* unreachnet */ - EHOSTUNREACH, /* unreachhost */ - ECONNREFUSED, /* unreachproto */ - ECONNREFUSED, /* unreachport */ - EMSGSIZE, /* old needfrag */ - EHOSTUNREACH, /* srcfail */ - EHOSTUNREACH, /* netunknown */ - EHOSTUNREACH, /* hostunknown */ - EHOSTUNREACH, /* isolated */ - ECONNREFUSED, /* net admin. prohibited */ - ECONNREFUSED, /* host admin. prohibited */ - EHOSTUNREACH, /* tos net unreachable */ - EHOSTUNREACH, /* tos host unreachable */ - 0, /* redirect net */ - 0, /* redirect host */ - 0, /* redirect tosnet */ - 0, /* redirect toshost */ - 0, /* time exceeded */ - 0, /* reassembly timeout */ - ENOPROTOOPT, /* parameter problem */ - ENOPROTOOPT, /* required option missing */ - 0, /* MTU changed */ - /* NB: this means that this error will only - get propagated by in_mtunotify(), which - doesn't bother to check. */ -}; - /* * Forward a packet. If some error occurs return the sender * an icmp packet. Note we can't always generate a meaningful diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 34c0702d86..7e77bff63b 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -31,10 +31,11 @@ * SUCH DAMAGE. * * from: @(#)ip_output.c 7.23 (Berkeley) 11/12/90 - * $Id: ip_output.c,v 1.3 1993/10/19 09:14:15 davidg Exp $ + * $Id: ip_output.c,v 1.4 1993/11/25 01:35:09 wollman Exp $ */ #include "param.h" +#include "systm.h" #include "malloc.h" #include "mbuf.h" #include "errno.h" diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 99986cf550..a6a10e9253 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)raw_ip.c 7.8 (Berkeley) 7/25/90 - * $Id: raw_ip.c,v 1.2 1993/10/16 18:26:19 rgrimes Exp $ + * $Id: raw_ip.c,v 1.3 1993/11/25 01:35:11 wollman Exp $ */ #include "param.h" @@ -55,10 +55,10 @@ /* * Raw interface to IP protocol. */ +static struct sockaddr_in ripdst = { sizeof(ripdst), AF_INET }; +static struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET }; +static struct sockproto ripproto = { PF_INET }; -struct sockaddr_in ripdst = { sizeof(ripdst), AF_INET }; -struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET }; -struct sockproto ripproto = { PF_INET }; /* * Setup generic address and protocol structures * for raw_input routine, then pass them along with @@ -258,7 +258,7 @@ rip_usrreq(so, req, m, nam, control) return (0); } } - error = raw_usrreq(so, req, m, nam, control); + error = raw_usrreq(so, req, m, nam, control, 0); if (error && (req == PRU_ATTACH) && so->so_pcb) free(so->so_pcb, M_PCB); diff --git a/sys/netinet/tcp_debug.c b/sys/netinet/tcp_debug.c index 694da031a2..a506f912c2 100644 --- a/sys/netinet/tcp_debug.c +++ b/sys/netinet/tcp_debug.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tcp_debug.c 7.6 (Berkeley) 6/28/90 - * $Id: tcp_debug.c,v 1.4 1993/11/25 01:35:12 wollman Exp $ + * $Id: tcp_debug.c,v 1.5 1993/12/13 11:07:43 chmr Exp $ */ #ifdef TCPDEBUG @@ -66,10 +66,6 @@ #include "tcpip.h" #include "tcp_debug.h" -#ifdef TCPDEBUG -int tcpconsdebug = 0; -#endif - struct tcp_debug tcp_debug[TCP_NDEBUG]; int tcp_debx; @@ -136,9 +132,7 @@ tcp_trace(act, ostate, tp, ti, req) if (flags) { #ifndef lint char *cp = "<"; -#define pf(f) { if (flags & __CONCAT(TH_,f)) { \ - printf("%s%s", cp, "f"); cp = ","; } } - +#define pf(f) { if (ti->ti_flags& TH_ ## f) { printf("%s" #f, cp); cp = ","; } } pf(SYN); pf(ACK); pf(FIN); pf(RST); pf(PUSH); pf(URG); #undef pf #endif diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 673a73a904..7b07db2f6c 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tcp_input.c 7.25 (Berkeley) 6/30/90 - * $Id: tcp_input.c,v 1.2 1993/10/16 18:26:26 rgrimes Exp $ + * $Id: tcp_input.c,v 1.3 1993/11/25 01:35:13 wollman Exp $ */ #include "param.h" @@ -70,7 +70,6 @@ int tcppcbcachemiss; struct tcpiphdr tcp_saveti; struct inpcb *tcp_last_inpcb = &tcb; -struct tcpcb *tcp_newtcpcb(); /* * Insert segment ti into reassembly queue of tcp with diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 065d19bd78..db6e7ffdbb 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tcp_subr.c 7.20 (Berkeley) 12/1/90 - * $Id: tcp_subr.c,v 1.4 1993/11/18 00:08:22 wollman Exp $ + * $Id: tcp_subr.c,v 1.5 1993/11/25 01:35:16 wollman Exp $ */ #include "param.h" @@ -60,16 +60,6 @@ #include "tcp_var.h" #include "tcpip.h" -/* patchable/settable parameters for tcp */ -int tcp_ttl = TCP_TTL; -int tcp_mssdflt = TCP_MSS; -int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ; - -extern struct inpcb *tcp_last_inpcb; - -#ifdef KPROF -int tcp_acounts[TCP_NSTATES][PRU_NREQ]; -#endif tcp_seq tcp_iss; struct inpcb tcb; struct tcpstat tcpstat; @@ -415,7 +405,7 @@ tcp_notify(inp, error) * In the immortal words of Ken and Dennis, ``You are not expected to * understand this.'' */ -void /* grrr... should be void... */ +void tcp_checkmtu(struct inpcb *inp, int error) { #ifdef MTUDISC /* diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index c95c5a408b..6805a1ce91 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tcp_timer.c 7.18 (Berkeley) 6/28/90 - * $Id: tcp_timer.c,v 1.2 1993/10/16 18:26:33 rgrimes Exp $ + * $Id: tcp_timer.c,v 1.3 1993/11/25 01:35:18 wollman Exp $ */ #include "param.h" @@ -58,9 +58,6 @@ #include "tcp_var.h" #include "tcpip.h" -int tcp_keepidle = TCPTV_KEEP_IDLE; -int tcp_keepintvl = TCPTV_KEEPINTVL; -int tcp_maxidle; /* * Fast timeout routine for processing delayed acks */ @@ -115,7 +112,8 @@ tcp_slowtimo() if (tp->t_timer[i] && --tp->t_timer[i] == 0) { (void) tcp_usrreq(tp->t_inpcb->inp_socket, PRU_SLOWTIMO, (struct mbuf *)0, - (struct mbuf *)i, (struct mbuf *)0); + (struct mbuf *)i, (struct mbuf *)0, + (struct mbuf *)0); if (ipnxt->inp_prev != ip) goto tpgone; } diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 9ba0fb6085..aaa7fbf9d7 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tcp_usrreq.c 7.15 (Berkeley) 6/28/90 - * $Id: tcp_usrreq.c,v 1.2 1993/10/16 18:26:36 rgrimes Exp $ + * $Id: tcp_usrreq.c,v 1.3 1993/11/25 01:35:20 wollman Exp $ */ #include "param.h" @@ -64,7 +64,6 @@ * TCP protocol interface to socket abstraction. */ extern char *tcpstates[]; -struct tcpcb *tcp_newtcpcb(); /* * Process a TCP user request for TCP tb. If this is a send request @@ -73,10 +72,11 @@ struct tcpcb *tcp_newtcpcb(); */ /*ARGSUSED*/ int -tcp_usrreq(so, req, m, nam, control) +tcp_usrreq(so, req, m, nam, control, dummy) struct socket *so; int req; struct mbuf *m, *nam, *control; + struct mbuf *dummy; { register struct inpcb *inp; register struct tcpcb *tp = 0; @@ -397,14 +397,6 @@ tcp_ctloutput(op, so, level, optname, mp) return (error); } -#ifdef TCP_SMALLSPACE -u_long tcp_sendspace = 1024*4; -u_long tcp_recvspace = 1024*4; -#else -u_long tcp_sendspace = 1024*16; -u_long tcp_recvspace = 1024*16; -#endif /* TCP_SMALLSPACE */ - /* * Attach TCP protocol to socket, allocating * internet protocol control block, tcp control block, diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 62f9e40d45..2f4ce34165 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tcp_var.h 7.10 (Berkeley) 6/28/90 - * $Id: tcp_var.h,v 1.3 1993/11/07 17:48:11 wollman Exp $ + * $Id: tcp_var.h,v 1.4 1993/11/25 01:35:21 wollman Exp $ */ #ifndef _NETINET_TCP_VAR_H_ @@ -216,13 +216,58 @@ struct tcpstat { #ifdef KERNEL extern struct inpcb tcb; /* head of queue of active tcpcb's */ extern struct tcpstat tcpstat; /* tcp statistics */ -struct tcpiphdr *tcp_template(); -struct tcpcb *tcp_close(), *tcp_drop(); -struct tcpcb *tcp_timers(), *tcp_disconnect(), *tcp_usrclosed(); -void tcp_quench(struct inpcb *, int); -void tcp_setpersist(struct tcpcb *); +/* From tcp_input.c: */ +extern int tcp_reass(struct tcpcb *, struct tcpiphdr *, struct mbuf *); +extern void tcp_input(struct mbuf *, int); +extern int tcp_mss(struct tcpcb *, int /*u_short*/); +/* From tcp_output.c: */ +extern int tcp_output(struct tcpcb *); +extern void tcp_setpersist(struct tcpcb *); +/* From tcp_subr.c: */ +extern void tcp_init(void); +extern struct tcpiphdr *tcp_template(struct tcpcb *); +extern void tcp_respond(struct tcpcb *, struct tcpiphdr *, struct mbuf *, + tcp_seq, tcp_seq, int); +extern struct tcpcb *tcp_newtcpcb(struct inpcb *); +extern struct tcpcb *tcp_drop(struct tcpcb *, int); +extern struct tcpcb *tcp_close(struct tcpcb *); +extern void tcp_drain(void); +extern void tcp_notify(struct inpcb *, int); +#ifdef MTUDISC +extern void tcp_checkmtu(struct inpcb *, int); +extern void tcp_mtuchanged(struct inpcb *, int); #endif +extern void tcp_ctlinput(int, struct sockaddr *, struct ip *); +extern void tcp_quench(struct inpcb *, int); + +/* From tcp_timer.c: */ +extern void tcp_fasttimo(void); +extern void tcp_slowtimo(void); +extern void tcp_canceltimers(struct tcpcb *); +extern struct tcpcb *tcp_timers(struct tcpcb *, int); + +/* From tcp_usrreq.c: */ +extern int tcp_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, + struct mbuf *, struct mbuf *); +extern int tcp_ctloutput(int, struct socket *, int, int, struct mbuf **); +extern int tcp_attach(struct socket *); +extern struct tcpcb *tcp_disconnect(struct tcpcb *); +extern struct tcpcb *tcp_usrclosed(struct tcpcb *); + +extern struct inpcb *tcp_last_inpcb; + +/* From in_var.c: */ +extern int tcp_ttl; +extern int tcp_mssdflt; +extern int tcp_rttdflt; +extern int tcp_keepidle; +extern int tcp_keepintvl; +extern int tcp_maxidle; +extern u_long tcp_sendspace; +extern u_long tcp_recvspace; + +#endif /* KERNEL */ #endif /* _NETINET_TCP_VAR_H_ */ diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index e3f447c938..b4bf9e51de 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -31,10 +31,11 @@ * SUCH DAMAGE. * * from: @(#)udp_usrreq.c 7.20 (Berkeley) 4/20/91 - * $Id: udp_usrreq.c,v 1.4 1993/11/18 00:08:23 wollman Exp $ + * $Id: udp_usrreq.c,v 1.5 1993/11/25 01:35:22 wollman Exp $ */ #include "param.h" +#include "systm.h" #include "malloc.h" #include "mbuf.h" #include "protosw.h" @@ -47,6 +48,7 @@ #include "in.h" #include "in_systm.h" +#include "in_var.h" #include "ip.h" #include "in_pcb.h" #include "ip_var.h" @@ -54,10 +56,8 @@ #include "udp.h" #include "udp_var.h" -struct inpcb udb; -struct udpstat udpstat; - -struct inpcb *udp_last_inpcb = &udb; +static struct inpcb udb; +static struct inpcb *udp_last_inpcb = &udb; static void udp_detach(struct inpcb *); @@ -72,14 +72,7 @@ udp_init() udb.inp_next = udb.inp_prev = &udb; } -#ifndef COMPAT_42 -int udpcksum = 1; -#else -int udpcksum = 0; /* XXX */ -#endif -int udp_ttl = UDP_TTL; - -struct sockaddr_in udp_in = { sizeof(udp_in), AF_INET }; +static struct sockaddr_in udp_in = { sizeof(udp_in), AF_INET }; void udp_input(m, iphlen) @@ -376,10 +369,6 @@ release: return (error); } -u_long udp_sendspace = 9216; /* really max datagram size */ -u_long udp_recvspace = 40 * (1024 + sizeof(struct sockaddr_in)); - /* 40 1K datagrams */ - /*ARGSUSED*/ int udp_usrreq(so, req, m, addr, control) diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h index bb6587ef0d..4bcd74c584 100644 --- a/sys/netinet/udp_var.h +++ b/sys/netinet/udp_var.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)udp_var.h 7.7 (Berkeley) 6/28/90 - * $Id: udp_var.h,v 1.2 1993/10/16 18:26:44 rgrimes Exp $ + * $Id: udp_var.h,v 1.3 1993/11/07 17:48:16 wollman Exp $ */ #ifndef _NETINET_UDP_VAR_H_ @@ -75,5 +75,12 @@ struct udpstat { #ifdef KERNEL extern struct inpcb udb; extern struct udpstat udpstat; -#endif + +/* From in_var.h: */ +extern int udpcksum; +extern int udp_ttl; +extern u_long udp_sendspace; +extern u_long udp_recvspace; + +#endif /* KERNEL */ #endif /* _NETINET_UDP_VAR_H_ */ diff --git a/sys/netiso/clnp.h b/sys/netiso/clnp.h index a49100ae5f..d991c0ca81 100644 --- a/sys/netiso/clnp.h +++ b/sys/netiso/clnp.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)clnp.h 7.8 (Berkeley) 5/6/91 - * $Id: clnp.h,v 1.3 1993/11/07 17:49:22 wollman Exp $ + * $Id: clnp.h,v 1.4 1993/11/25 01:35:38 wollman Exp $ */ /*********************************************************** @@ -463,6 +463,21 @@ extern struct troll trollctl; #endif /* TROLL */ extern void clnp_emit_er(struct mbuf *, int /*char*/); +extern void clnp_discard(struct mbuf *, int); + +/* From clnp_subr.h: */ +struct snpa_hdr; struct route_iso; +extern struct mbuf *clnp_data_ck(struct mbuf *, int); +extern int clnp_ours(struct iso_addr *); +extern void clnp_forward(struct mbuf *, int, struct iso_addr *, + struct clnp_optidx *, int, struct snpa_hdr *); +extern int clnp_route(struct iso_addr *, struct route_iso *, int, + struct sockaddr **, struct iso_ifaddr **); +extern int clnp_srcroute(struct mbuf *, struct clnp_optidx *, + struct route_iso *, struct sockaddr **, + struct iso_ifaddr **, struct iso_addr *); +extern int clnp_badmtu(struct ifnet *, struct rtentry *, int, const char *); +extern void clnp_ypocb(caddr_t, caddr_t, u_int); #endif /* KERNEL */ #endif /* _NETISO_CLNP_H_ */ diff --git a/sys/netiso/clnp_debug.c b/sys/netiso/clnp_debug.c index b795173a8b..253e1a5b4a 100644 --- a/sys/netiso/clnp_debug.c +++ b/sys/netiso/clnp_debug.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)clnp_debug.c 7.8 (Berkeley) 5/27/91 - * $Id$ + * $Id: clnp_debug.c,v 1.2 1993/10/16 21:04:44 rgrimes Exp $ */ /*********************************************************** @@ -61,8 +61,8 @@ SOFTWARE. * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison */ -#include "types.h" #include "param.h" +#include "systm.h" #include "mbuf.h" #include "domain.h" #include "protosw.h" diff --git a/sys/netiso/clnp_er.c b/sys/netiso/clnp_er.c index 06bb8635af..30b71c7368 100644 --- a/sys/netiso/clnp_er.c +++ b/sys/netiso/clnp_er.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)clnp_er.c 7.7 (Berkeley) 5/6/91 - * $Id: clnp_er.c,v 1.2 1993/10/16 21:04:45 rgrimes Exp $ + * $Id: clnp_er.c,v 1.3 1993/11/25 01:35:40 wollman Exp $ */ /*********************************************************** @@ -62,6 +62,7 @@ SOFTWARE. */ #include "param.h" +#include "systm.h" #include "mbuf.h" #include "domain.h" #include "protosw.h" diff --git a/sys/netiso/clnp_frag.c b/sys/netiso/clnp_frag.c index 79db112e0f..839f0956ac 100644 --- a/sys/netiso/clnp_frag.c +++ b/sys/netiso/clnp_frag.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)clnp_frag.c 7.12 (Berkeley) 5/6/91 - * $Id: clnp_frag.c,v 1.3 1993/10/16 21:04:46 rgrimes Exp $ + * $Id: clnp_frag.c,v 1.4 1993/11/25 01:35:41 wollman Exp $ */ /*********************************************************** @@ -89,54 +89,54 @@ struct mbuf *clnp_comp_pdu(); /* - * FUNCTION: clnp_fragment + * FUNCTION: clnp_fragment * - * PURPOSE: Fragment a datagram, and send the itty bitty pieces - * out over an interface. + * PURPOSE: Fragment a datagram, and send the itty bitty pieces + * out over an interface. * - * RETURNS: success - 0 - * failure - unix error code + * RETURNS: success - 0 + * failure - unix error code * * SIDE EFFECTS: * - * NOTES: If there is an error sending the packet, clnp_discard - * is called to discard the packet and send an ER. If - * clnp_fragment was called from clnp_output, then - * we generated the packet, and should not send an - * ER -- clnp_emit_er will check for this. Otherwise, - * the packet was fragmented during forwarding. In this - * case, we ought to send an ER back. + * NOTES: If there is an error sending the packet, clnp_discard + * is called to discard the packet and send an ER. If + * clnp_fragment was called from clnp_output, then + * we generated the packet, and should not send an + * ER -- clnp_emit_er will check for this. Otherwise, + * the packet was fragmented during forwarding. In this + * case, we ought to send an ER back. */ int clnp_fragment(ifp, m, first_hop, total_len, segoff, flags, rt) -struct ifnet *ifp; /* ptr to outgoing interface */ -struct mbuf *m; /* ptr to packet */ -struct sockaddr *first_hop; /* ptr to first hop */ -int total_len; /* length of datagram */ -int segoff; /* offset of segpart in hdr */ -int flags; /* flags passed to clnp_output */ -struct rtentry *rt; /* route if direct ether */ + struct ifnet *ifp; /* ptr to outgoing interface */ + struct mbuf *m; /* ptr to packet */ + struct sockaddr *first_hop; /* ptr to first hop */ + int total_len; /* length of datagram */ + int segoff; /* offset of segpart in hdr */ + int flags; /* flags passed to clnp_output */ + struct rtentry *rt; /* route if direct ether */ { - struct clnp_fixed *clnp = mtod(m, struct clnp_fixed *); - int hdr_len = (int)clnp->cnf_hdr_len; - int frag_size = (SN_MTU(ifp, rt) - hdr_len) & ~7; + struct clnp_fixed *clnp = mtod(m, struct clnp_fixed *); + int hdr_len = (int)clnp->cnf_hdr_len; + int frag_size = (SN_MTU(ifp, rt) - hdr_len) & ~7; total_len -= hdr_len; if ((clnp->cnf_type & CNF_SEG_OK) && (total_len >= 8) && (frag_size > 8 || (frag_size == 8 && !(total_len & 7)))) { - struct mbuf *hdr = NULL; /* save copy of clnp hdr */ - struct mbuf *frag_hdr = NULL; - struct mbuf *frag_data = NULL; - struct clnp_segment seg_part; /* segmentation header */ - int frag_base; - int error = 0; + struct mbuf *hdr = NULL; /* save copy of clnp hdr */ + struct mbuf *frag_hdr = NULL; + struct mbuf *frag_data = NULL; + struct clnp_segment seg_part; /* segmentation header */ + int frag_base; + int error = 0; INCSTAT(cns_fragmented); - (void) bcopy(segoff + mtod(m, caddr_t), (caddr_t)&seg_part, - sizeof(seg_part)); + (void) bcopy(segoff + mtod(m, caddr_t), (caddr_t)&seg_part, + sizeof(seg_part)); frag_base = ntohs(seg_part.cng_off); /* * Duplicate header, and remove from packet @@ -250,33 +250,33 @@ struct rtentry *rt; /* route if direct ether */ #endif TROLL /* - * Tough situation: if the error occured on the last - * fragment, we can not send an ER, as the if_output - * routine consumed the packet. If the error occured - * on any intermediate packets, we can send an ER - * because we still have the original header in (m). + * Tough situation: if the error occured on the last + * fragment, we can not send an ER, as the if_output + * routine consumed the packet. If the error occured + * on any intermediate packets, we can send an ER + * because we still have the original header in (m). */ if (error) { if (frag_hdr != hdr) { - /* - * The error was not on the last fragment. We must - * free hdr and m before returning - */ + /* + * The error was not on the last fragment. We must + * free hdr and m before returning + */ clnp_discard(hdr, GEN_NOREAS); m_freem(m); } return(error); } - /* bump segment offset, trim data mbuf, and decrement count left */ +/* bump segment offset, trim data mbuf, and decrement count left */ #ifdef TROLL - /* - * Decrement frag_size by some fraction. This will cause the - * next fragment to start 'early', thus duplicating the end - * of the current fragment. troll.tr_dup_size controls - * the fraction. If positive, it specifies the fraction. If - * negative, a random fraction is used. - */ + /* + * Decrement frag_size by some fraction. This will cause the + * next fragment to start 'early', thus duplicating the end + * of the current fragment. troll.tr_dup_size controls + * the fraction. If positive, it specifies the fraction. If + * negative, a random fraction is used. + */ if ((trollctl.tr_ops & TR_DUPEND) && (!last_frag)) { int num_bytes = frag_size; diff --git a/sys/netiso/clnp_input.c b/sys/netiso/clnp_input.c index 25024a7f1c..893f1cc0b4 100644 --- a/sys/netiso/clnp_input.c +++ b/sys/netiso/clnp_input.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)clnp_input.c 7.13 (Berkeley) 5/6/91 - * $Id: clnp_input.c,v 1.2 1993/10/16 21:04:48 rgrimes Exp $ + * $Id: clnp_input.c,v 1.3 1993/11/25 01:35:43 wollman Exp $ */ /*********************************************************** @@ -61,8 +61,8 @@ SOFTWARE. * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison */ -#include "types.h" #include "param.h" +#include "systm.h" #include "mbuf.h" #include "domain.h" #include "protosw.h" @@ -96,8 +96,6 @@ struct mbuf *clnp_data_ck(); void clnp_input(struct mbuf *, struct snpa_hdr *); -int esis_input(); - #ifdef ISO_X25ESIS int x25esis_input(); #endif ISO_X25ESIS diff --git a/sys/netiso/clnp_options.c b/sys/netiso/clnp_options.c index 656f7b2950..1ffcc5fa15 100644 --- a/sys/netiso/clnp_options.c +++ b/sys/netiso/clnp_options.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)clnp_options.c 7.8 (Berkeley) 5/6/91 - * $Id: clnp_options.c,v 1.2 1993/10/16 21:04:50 rgrimes Exp $ + * $Id: clnp_options.c,v 1.3 1993/11/25 01:35:44 wollman Exp $ */ /*********************************************************** @@ -64,6 +64,7 @@ SOFTWARE. #ifdef ISO #include "types.h" +#include "systm.h" #include "param.h" #include "mbuf.h" #include "domain.h" @@ -533,4 +534,4 @@ clnp_opt_sanity(m, opts, len, oidx) ENDDEBUG return(0); } -#endif ISO +#endif /* ISO */ diff --git a/sys/netiso/clnp_output.c b/sys/netiso/clnp_output.c index 58fbb039bf..30fec0932f 100644 --- a/sys/netiso/clnp_output.c +++ b/sys/netiso/clnp_output.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)clnp_output.c 7.10 (Berkeley) 5/6/91 - * $Id: clnp_output.c,v 1.2 1993/10/16 21:04:52 rgrimes Exp $ + * $Id: clnp_output.c,v 1.3 1993/11/25 01:35:45 wollman Exp $ */ /*********************************************************** @@ -62,6 +62,7 @@ SOFTWARE. */ #include "param.h" +#include "systm.h" #include "mbuf.h" #include "domain.h" #include "protosw.h" diff --git a/sys/netiso/clnp_raw.c b/sys/netiso/clnp_raw.c index a655948225..e53d7cd726 100644 --- a/sys/netiso/clnp_raw.c +++ b/sys/netiso/clnp_raw.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)clnp_raw.c 7.8 (Berkeley) 5/6/91 - * $Id: clnp_raw.c,v 1.2 1993/10/16 21:04:53 rgrimes Exp $ + * $Id: clnp_raw.c,v 1.3 1993/11/25 01:35:46 wollman Exp $ */ /*********************************************************** @@ -62,6 +62,7 @@ SOFTWARE. */ #include "param.h" +#include "systm.h" #include "mbuf.h" #include "domain.h" #include "protosw.h" @@ -351,7 +352,7 @@ clnp_usrreq(so, req, m, nam, control) return (0); } } - error = raw_usrreq(so, req, m, nam, control); + error = raw_usrreq(so, req, m, nam, control, 0); if (error && req == PRU_ATTACH && so->so_pcb) free((caddr_t)rp, M_PCB); diff --git a/sys/netiso/clnp_subr.c b/sys/netiso/clnp_subr.c index 375d9de0f4..872d83299f 100644 --- a/sys/netiso/clnp_subr.c +++ b/sys/netiso/clnp_subr.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)clnp_subr.c 7.13 (Berkeley) 5/6/91 - * $Id: clnp_subr.c,v 1.4 1993/11/07 17:49:25 wollman Exp $ + * $Id: clnp_subr.c,v 1.5 1993/11/25 01:35:48 wollman Exp $ */ /*********************************************************** @@ -109,9 +109,9 @@ struct clnp_stat clnp_stat; */ struct mbuf * clnp_data_ck(m, length) -register struct mbuf *m; /* ptr to mbuf chain containing hdr & data */ -int length; /* length (in bytes) of packet */ - { + register struct mbuf *m; /* ptr to mbuf chain containing hdr & data */ + int length; /* length (in bytes) of packet */ +{ register int len; /* length of data */ register struct mbuf *mhead; /* ptr to head of chain */ @@ -191,7 +191,7 @@ register struct iso_addr *destp; /* ptr to destination address buffer */ else return (caddr_t) 0; } -#endif notdef +#endif /* notdef */ /* * FUNCTION: clnp_ours @@ -208,7 +208,7 @@ register struct iso_addr *destp; /* ptr to destination address buffer */ */ int clnp_ours(dst) -register struct iso_addr *dst; /* ptr to destination address */ + register struct iso_addr *dst; /* ptr to destination address */ { register struct iso_ifaddr *ia; /* scan through interface addresses */ @@ -240,7 +240,7 @@ int congest_threshold = 0; * clnpintr guarantees that the header will be * contigious (a cluster mbuf will be used if necessary). * - * If oidx is NULL, no options are present. + * If oidx is NULL, no options are present. * * RETURNS: nothing * @@ -250,12 +250,12 @@ int congest_threshold = 0; */ void clnp_forward(m, len, dst, oidx, seg_off, inbound_shp) -struct mbuf *m; /* pkt to forward */ -int len; /* length of pkt */ -struct iso_addr *dst; /* destination address */ -struct clnp_optidx *oidx; /* option index */ -int seg_off;/* offset of segmentation part */ -struct snpa_hdr *inbound_shp; /* subnetwork header of inbound packet */ + struct mbuf *m; /* pkt to forward */ + int len; /* length of pkt */ + struct iso_addr *dst; /* destination address */ + struct clnp_optidx *oidx; /* option index */ + int seg_off; /* offset of segmentation part */ + struct snpa_hdr *inbound_shp; /* subnetwork header of inbound packet */ { struct clnp_fixed *clnp; /* ptr to fixed part of header */ int error; /* return value of route function */ @@ -372,7 +372,7 @@ struct snpa_hdr *inbound_shp; /* subnetwork header of inbound packet */ } } } -#endif DECBIT +#endif /* DECBIT */ /* * Dispatch the datagram if it is small enough, otherwise fragment @@ -422,7 +422,7 @@ register struct iso_addr *dstp; /* ptr to dst addr */ return bufp; } -#endif notdef +#endif /* notdef */ /* * FUNCTION: clnp_route @@ -445,11 +445,11 @@ register struct iso_addr *dstp; /* ptr to dst addr */ */ int clnp_route(dst, ro, flags, first_hop, ifa) - struct iso_addr *dst; /* ptr to datagram destination */ - register struct route_iso *ro; /* existing route structure */ - int flags; /* flags for routing */ - struct sockaddr **first_hop; /* result: fill in with ptr to firsthop */ - struct iso_ifaddr **ifa; /* result: fill in with ptr to interface */ + struct iso_addr *dst; /* ptr to datagram destination */ + register struct route_iso *ro; /* existing route structure */ + int flags; /* flags for routing */ + struct sockaddr **first_hop; /* result: fill in with ptr to firsthop */ + struct iso_ifaddr **ifa; /* result: fill in with ptr to interface */ { if (flags & SO_DONTROUTE) { struct iso_ifaddr *ia; @@ -541,12 +541,12 @@ clnp_route(dst, ro, flags, first_hop, ifa) */ int clnp_srcroute(options, oidx, ro, first_hop, ifa, final_dst) -struct mbuf *options; /* ptr to options */ -struct clnp_optidx *oidx; /* index to options */ -struct route_iso *ro; /* route structure */ -struct sockaddr **first_hop; /* RETURN: fill in with ptr to firsthop */ -struct iso_ifaddr **ifa; /* RETURN: fill in with ptr to interface */ -struct iso_addr *final_dst; /* final destination */ + struct mbuf *options; /* ptr to options */ + struct clnp_optidx *oidx; /* index to options */ + struct route_iso *ro; /* route structure */ + struct sockaddr **first_hop; /* RETURN: fill in with ptr to firsthop */ + struct iso_ifaddr **ifa; /* RETURN: fill in with ptr to interface */ + struct iso_addr *final_dst; /* final destination */ { struct iso_addr dst; /* first hop specified by src rt */ int error = 0; /* return code */ @@ -598,16 +598,16 @@ struct iso_addr *final_dst; /* final destination */ */ int clnp_badmtu(ifp, rt, line, file) -struct ifnet *ifp; /* outgoing interface */ -struct rtentry *rt; /* dst route */ -int line; /* where the dirty deed occured */ -char *file; /* where the dirty deed occured */ + struct ifnet *ifp; /* outgoing interface */ + struct rtentry *rt; /* dst route */ + int line; /* where the dirty deed occured */ + const char *file; /* where the dirty deed occured */ { printf("sending on route %x with no mtu, line %s of file %s\n", rt, line, file); #ifdef ARGO_DEBUG printf("route dst is"); - dump_isoaddr(rt_key(rt)); + dump_isoaddr((struct sockaddr_iso *)rt_key(rt)); #endif return ifp->if_mtu; } @@ -633,3 +633,5 @@ clnp_ypocb(from, to, len) *(to + len) = *(from + len); } #endif /* ISO */ + + diff --git a/sys/netiso/clnp_timer.c b/sys/netiso/clnp_timer.c index 0854e79b8c..1b603cdeaf 100644 --- a/sys/netiso/clnp_timer.c +++ b/sys/netiso/clnp_timer.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)clnp_timer.c 7.5 (Berkeley) 5/6/91 - * $Id: clnp_timer.c,v 1.2 1993/10/16 21:04:57 rgrimes Exp $ + * $Id: clnp_timer.c,v 1.3 1993/11/25 01:35:49 wollman Exp $ */ /*********************************************************** @@ -62,6 +62,7 @@ SOFTWARE. */ #include "param.h" +#include "systm.h" #include "mbuf.h" #include "domain.h" #include "protosw.h" diff --git a/sys/netiso/esis.c b/sys/netiso/esis.c index ecfdb47302..c15a65d854 100644 --- a/sys/netiso/esis.c +++ b/sys/netiso/esis.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)esis.c 7.19 (Berkeley) 6/27/91 - * $Id: esis.c,v 1.4 1993/11/18 00:10:14 wollman Exp $ + * $Id: esis.c,v 1.5 1993/11/25 01:35:52 wollman Exp $ */ /*********************************************************** @@ -101,14 +101,9 @@ SOFTWARE. struct rawcb esis_pcb; struct esis_stat esis_stat; -void esis_config(caddr_t, int); -extern void snpac_age(caddr_t, int); -void esis_input(struct mbuf *, struct snpa_hdr *); static void esis_eshinput(struct mbuf *, struct snpa_hdr *); static void esis_ishinput(struct mbuf *, struct snpa_hdr *); static void esis_rdinput(struct mbuf *, struct snpa_hdr *); -void esis_shoutput(struct ifnet *, int, int /*short*/, caddr_t, int, struct iso_addr *); -void isis_input(struct mbuf *, struct snpa_hdr *); int esis_sendspace = 2048; int esis_recvspace = 2048; diff --git a/sys/netiso/esis.h b/sys/netiso/esis.h index fef43c30e2..cad94f5fd3 100644 --- a/sys/netiso/esis.h +++ b/sys/netiso/esis.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)esis.h 7.4 (Berkeley) 5/6/91 - * $Id: esis.h,v 1.2 1993/10/16 21:05:08 rgrimes Exp $ + * $Id: esis.h,v 1.3 1993/11/07 17:49:35 wollman Exp $ */ /*********************************************************** @@ -116,7 +116,12 @@ struct esis_stat { u_short es_rdrcvd; /* RD rcvd */ }; -#ifdef KERNEL +#ifdef KERNEL extern struct esis_stat esis_stat; +void esis_config(caddr_t, int); +void esis_input(struct mbuf *, struct snpa_hdr *); +void esis_shoutput(struct ifnet *, int, int /*short*/, caddr_t, int, struct iso_addr *); +void isis_input(struct mbuf *, struct snpa_hdr *); + #endif /* KERNEL */ #endif /* _NETISO_ESIS_H_ */ diff --git a/sys/netiso/if_eon.c b/sys/netiso/if_eon.c index 617f23b5f3..e07b1a58d5 100644 --- a/sys/netiso/if_eon.c +++ b/sys/netiso/if_eon.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)if_eon.c 7.16 (Berkeley) 6/27/91 - * $Id: if_eon.c,v 1.3 1993/11/07 17:49:38 wollman Exp $ + * $Id: if_eon.c,v 1.4 1993/11/25 01:35:54 wollman Exp $ */ /*********************************************************** @@ -579,7 +579,7 @@ eonctlinput(cmd, sin) IFDEBUG(D_EON) printf("eonctlinput: cmd 0x%x addr: ", cmd); - dump_isoaddr(sin); + dump_isoaddr((struct sockaddr_iso *)sin); printf("\n"); ENDDEBUG diff --git a/sys/netiso/iso.c b/sys/netiso/iso.c index cf35a701df..7a4a41c564 100644 --- a/sys/netiso/iso.c +++ b/sys/netiso/iso.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)iso.c 7.14 (Berkeley) 6/27/91 - * $Id: iso.c,v 1.4 1993/11/07 17:49:40 wollman Exp $ + * $Id: iso.c,v 1.5 1993/11/25 01:35:57 wollman Exp $ */ /*********************************************************** @@ -65,7 +65,6 @@ SOFTWARE. * iso.c: miscellaneous routines to support the iso address family */ -#include "types.h" #include "param.h" #include "systm.h" #include "ioctl.h" @@ -94,7 +93,6 @@ struct iso_ifaddr *iso_ifaddr; struct ifqueue clnlintrq; int iso_interfaces = 0; /* number of external interfaces */ -extern struct ifnet loif; /* loopback interface */ int ether_output(); void llc_rtrequest(); @@ -238,7 +236,7 @@ struct sockaddr_iso *sisoa, *sisob; return ((lena == lenb) && (!bcmp(bufa, bufb, lena))); } -#endif notdef +#endif /* notdef */ /* * FUNCTION: iso_hashchar @@ -255,8 +253,8 @@ struct sockaddr_iso *sisoa, *sisob; */ u_long iso_hashchar(buf, len) -register caddr_t buf; /* buffer to pack from */ -register int len; /* length of buffer */ + register caddr_t buf; /* buffer to pack from */ + register int len; /* length of buffer */ { register u_long h = 0; register int i; @@ -435,7 +433,8 @@ caddr_t buf; /* RESULT: network portion of address here */ ENDDEBUG return len; } -#endif notdef +#endif /* notdef */ + /* * Generic iso control operations (ioctl's). * Ifp is 0 if not an interface-specific ioctl. @@ -737,7 +736,7 @@ iso_ifwithidi(addr) return ((struct ifaddr *)0); } -#endif notdef +#endif /* notdef */ /* * FUNCTION: iso_ck_addr * @@ -751,7 +750,7 @@ iso_ifwithidi(addr) */ int iso_ck_addr(isoa) -struct iso_addr *isoa; /* address to check */ + struct iso_addr *isoa; /* address to check */ { return (isoa->isoa_len <= 20); @@ -787,7 +786,8 @@ struct iso_addr *isoab; /* other addr to check */ } return(0); } -#endif notdef +#endif /* notdef */ + /* * FUNCTION: iso_localifa() * @@ -843,7 +843,7 @@ iso_localifa(siso) #ifdef TPCONS #include "cons.h" -#endif TPCONS +#endif /* TPCONS */ /* * FUNCTION: iso_nlctloutput * @@ -858,10 +858,10 @@ iso_localifa(siso) */ int iso_nlctloutput(cmd, optname, pcb, m) -int cmd; /* command:set or get */ -int optname; /* option of interest */ -caddr_t pcb; /* nl pcb */ -struct mbuf *m; /* data for set, buffer for get */ + int cmd; /* command:set or get */ + int optname; /* option of interest */ + caddr_t pcb; /* nl pcb */ + struct mbuf *m; /* data for set, buffer for get */ { struct isopcb *isop = (struct isopcb *)pcb; int error = 0; /* return value */ @@ -905,7 +905,7 @@ struct mbuf *m; /* data for set, buffer for get */ bcopy(data, (caddr_t)isop->isop_x25crud, (unsigned)data_len); isop->isop_x25crud_len = data_len; break; -#endif TPCONS +#endif /* TPCONS */ default: error = EOPNOTSUPP; @@ -913,7 +913,7 @@ struct mbuf *m; /* data for set, buffer for get */ return error; } -#endif ISO +#endif /* ISO */ #ifdef ARGO_DEBUG diff --git a/sys/netiso/iso_chksum.c b/sys/netiso/iso_chksum.c index 82d353d74e..23399dc947 100644 --- a/sys/netiso/iso_chksum.c +++ b/sys/netiso/iso_chksum.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)iso_chksum.c 7.5 (Berkeley) 5/6/91 - * $Id: iso_chksum.c,v 1.3 1993/10/16 21:05:18 rgrimes Exp $ + * $Id: iso_chksum.c,v 1.4 1993/11/25 01:35:58 wollman Exp $ */ /*********************************************************** @@ -86,11 +86,11 @@ SOFTWARE. #include "param.h" #include "systm.h" #include "mbuf.h" -#endif ISO +#endif /* ISO */ #ifndef MNULL #define MNULL (struct mbuf *)0 -#endif MNULL +#endif /* MNULL */ /* * FUNCTION: iso_check_csum @@ -253,133 +253,3 @@ iso_gen_csum(m,n,l) ENDDEBUG } -struct mbuf * -m_append(head, m) - struct mbuf *head, *m; -{ - register struct mbuf *n; - - if (m == 0) - return head; - if (head == 0) - return m; - n = head; - while (n->m_next) - n = n->m_next; - n->m_next = m; - return head; -} -/* - * FUNCTION: m_datalen - * - * PURPOSE: returns length of the mbuf chain. - * used all over the iso code. - * - * RETURNS: integer - * - * SIDE EFFECTS: none - * - * NOTES: - */ - -int -m_datalen (morig) - struct mbuf *morig; -{ - int s = splimp(); - register struct mbuf *n=morig; - register int datalen = 0; - - if( morig == (struct mbuf *)0) - return 0; - for(;;) { - datalen += n->m_len; - if (n->m_next == (struct mbuf *)0 ) { - break; - } - n = n->m_next; - } - splx(s); - return datalen; -} - -int -m_compress(in, out) - register struct mbuf *in, **out; -{ - register int datalen = 0; - int s = splimp(); - - if( in->m_next == MNULL ) { - *out = in; - IFDEBUG(D_REQUEST) - printf("m_compress returning 0x%x: A\n", in->m_len); - ENDDEBUG - splx(s); - return in->m_len; - } - MGET((*out), M_DONTWAIT, MT_DATA); - if((*out) == MNULL) { - *out = in; - IFDEBUG(D_REQUEST) - printf("m_compress returning -1: B\n"); - ENDDEBUG - splx(s); - return -1; - } - (*out)->m_len = 0; - (*out)->m_act = MNULL; - - while (in) { - IFDEBUG(D_REQUEST) - printf("m_compress in 0x%x *out 0x%x\n", in, *out); - printf("m_compress in: len 0x%x, off 0x%x\n", in->m_len, in->m_data); - printf("m_compress *out: len 0x%x, off 0x%x\n", (*out)->m_len, - (*out)->m_data); - ENDDEBUG - if (in->m_flags & M_EXT) { - ASSERT(in->m_len == 0); - } - if ( in->m_len == 0) { - in = in->m_next; - continue; - } - if (((*out)->m_flags & M_EXT) == 0) { - int len; - - len = M_TRAILINGSPACE(*out); - len = MIN(len, in->m_len); - datalen += len; - - IFDEBUG(D_REQUEST) - printf("m_compress copying len %d\n", len); - ENDDEBUG - bcopy(mtod(in, caddr_t), mtod((*out), caddr_t) + (*out)->m_len, - (unsigned)len); - - (*out)->m_len += len; - in->m_len -= len; - continue; - } else { - /* (*out) is full */ - if(( (*out)->m_next = m_get(M_DONTWAIT, MT_DATA) ) == MNULL) { - m_freem(*out); - *out = in; - IFDEBUG(D_REQUEST) - printf("m_compress returning -1: B\n"); - ENDDEBUG - splx(s); - return -1; - } - (*out)->m_len = 0; - (*out)->m_act = MNULL; - *out = (*out)->m_next; - } - } - m_freem(in); - IFDEBUG(D_REQUEST) - printf("m_compress returning 0x%x: A\n", datalen); - ENDDEBUG - splx(s); - return datalen; -} diff --git a/sys/netiso/iso_proto.c b/sys/netiso/iso_proto.c index 85c20d48be..acca2bcb6a 100644 --- a/sys/netiso/iso_proto.c +++ b/sys/netiso/iso_proto.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)iso_proto.c 7.8 (Berkeley) 5/6/91 - * $Id$ + * $Id: iso_proto.c,v 1.2 1993/10/16 21:05:25 rgrimes Exp $ */ /*********************************************************** @@ -69,8 +69,8 @@ SOFTWARE. */ #ifdef ISO -#include "types.h" #include "param.h" +#include "systm.h" #include "socket.h" #include "protosw.h" #include "domain.h" @@ -78,19 +78,25 @@ SOFTWARE. #include "iso.h" -int clnp_output(), clnp_init(),clnp_slowtimo(),clnp_drain(); +int clnp_output(); +void clnp_init(),clnp_slowtimo(),clnp_drain(); int rclnp_input(), rclnp_output(), rclnp_ctloutput(), raw_usrreq(); int clnp_usrreq(); int tp_ctloutput(); -int tpclnp_ctlinput(); +void tpclnp_ctlinput(); int tpclnp_input(); int tp_usrreq(); -int tp_init(), tp_slowtimo(), tp_drain(); -int cons_init(), tpcons_input(); - -int esis_input(), esis_ctlinput(), esis_init(), esis_usrreq(); -int cltp_input(), cltp_ctlinput(), cltp_init(), cltp_usrreq(), cltp_output(); +void tp_init(), tp_slowtimo(), tp_drain(); +void cons_init(); +int tpcons_input(); + +int esis_input(); +void esis_ctlinput(), esis_init(); +int esis_usrreq(); +int cltp_input(); +void cltp_ctlinput(), cltp_init(); +int cltp_usrreq(), cltp_output(); int isis_input(); struct protosw isosw[] = { @@ -102,10 +108,10 @@ struct protosw isosw[] = { * pffindtype, which gets the first entry that matches the type. * sigh. */ -{ SOCK_DGRAM, &isodomain, ISOPROTO_CLTP, PR_ATOMIC|PR_ADDR, - 0, cltp_output, 0, 0, - cltp_usrreq, - cltp_init, 0, 0, 0 +{ SOCK_DGRAM, &isodomain, ISOPROTO_CLTP, PR_ATOMIC|PR_ADDR, + 0, cltp_output, 0, 0, + cltp_usrreq, cltp_init, 0, 0, + 0 }, /* @@ -172,4 +178,4 @@ struct domain isodomain = { isosw, /* protosw */ &isosw[sizeof(isosw)/sizeof(isosw[0])] /* NPROTOSW */ }; -#endif ISO +#endif /* ISO */ diff --git a/sys/netiso/iso_snpac.c b/sys/netiso/iso_snpac.c index f490533535..17ade99577 100644 --- a/sys/netiso/iso_snpac.c +++ b/sys/netiso/iso_snpac.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)iso_snpac.c 7.14 (Berkeley) 6/27/91 - * $Id: iso_snpac.c,v 1.3 1993/11/07 17:49:46 wollman Exp $ + * $Id: iso_snpac.c,v 1.4 1993/11/25 01:35:59 wollman Exp $ */ /*********************************************************** @@ -94,7 +94,6 @@ struct llinfo_llc llinfo_llc; int iso_systype = SNPA_ES; /* default to be an ES */ extern short esis_holding_time, esis_config_time, esis_esconfig_time; -extern int esis_config(); static void snpac_fixdstandmask(); struct sockaddr_iso blank_siso = {sizeof(blank_siso), AF_ISO}; @@ -351,7 +350,7 @@ int *snpa_len; /* RESULT: length of snpa */ */ void snpac_free(lc) -register struct llinfo_llc *lc; /* entry to free */ + register struct llinfo_llc *lc; /* entry to free */ { register struct rtentry *rt = lc->lc_rt; register struct iso_addr *r; @@ -380,12 +379,12 @@ register struct llinfo_llc *lc; /* entry to free */ */ int snpac_add(ifp, nsap, snpa, type, ht, nsellength) -struct ifnet *ifp; /* interface info is related to */ -struct iso_addr *nsap; /* nsap to add */ -caddr_t snpa; /* translation */ -char type; /* SNPA_IS or SNPA_ES */ -u_short ht; /* holding time (in seconds) */ -int nsellength; /* nsaps may differ only in trailing bytes */ + struct ifnet *ifp; /* interface info is related to */ + struct iso_addr *nsap; /* nsap to add */ + caddr_t snpa; /* translation */ + char type; /* SNPA_IS or SNPA_ES */ + u_short ht; /* holding time (in seconds) */ + int nsellength; /* nsaps may differ only in trailing bytes */ { register struct llinfo_llc *lc; register struct rtentry *rt; @@ -427,8 +426,10 @@ int nsellength; /* nsaps may differ only in trailing bytes */ goto add; if (nsellength && (rt->rt_flags & RTF_HOST)) { if (rt->rt_refcnt == 0) { - rtrequest(RTM_DELETE, S(dst), (struct sockaddr *)0, - (struct sockaddr *)0, 0, (struct rtentry *)0); + rtrequest(RTM_DELETE, S(dst), + (struct sockaddr *)0, + (struct sockaddr *)0, + 0, (struct rtentry **)0); rt = 0; goto add; } else { @@ -490,9 +491,9 @@ snpac_fixdstandmask(nsellength) */ int snpac_ioctl (so, cmd, data) -struct socket *so; -int cmd; /* ioctl to process */ -caddr_t data; /* data for the cmd */ + struct socket *so; + int cmd; /* ioctl to process */ + caddr_t data; /* data for the cmd */ { register struct systype_req *rq = (struct systype_req *)data; @@ -521,7 +522,7 @@ caddr_t data; /* data for the cmd */ if (esis_esconfig_time != rq->sr_esconfigt) { untimeout(esis_config, (caddr_t)0); esis_esconfig_time = rq->sr_esconfigt; - esis_config(); + esis_config(0, 0); } } else if (cmd == SIOCGSTYPE) { rq->sr_type = iso_systype; @@ -593,7 +594,7 @@ snpac_logdefis(sc) * than the current time. */ void -snpac_age() +snpac_age(caddr_t dummy1, int dummy2) { register struct llinfo_llc *lc, *nlc; register struct rtentry *rt; @@ -628,8 +629,8 @@ snpac_age() */ int snpac_ownmulti(snpa, len) -caddr_t snpa; -u_int len; + caddr_t snpa; + u_int len; { return (((iso_systype & SNPA_ES) && (!bcmp(snpa, (caddr_t)all_es_snpa, len))) || @@ -674,12 +675,12 @@ struct ifnet *ifp; */ void snpac_rtrequest(req, host, gateway, netmask, flags, ret_nrt) -int req; -struct iso_addr *host; -struct iso_addr *gateway; -struct iso_addr *netmask; -short flags; -struct rtentry **ret_nrt; + int req; + struct iso_addr *host; + struct iso_addr *gateway; + struct iso_addr *netmask; + short flags; + struct rtentry **ret_nrt; { register struct iso_addr *r; @@ -729,8 +730,8 @@ struct rtentry **ret_nrt; */ void snpac_addrt(ifp, host, gateway, netmask) -struct ifnet *ifp; -struct iso_addr *host, *gateway, *netmask; + struct ifnet *ifp; + struct iso_addr *host, *gateway, *netmask; { register struct iso_addr *r; @@ -745,4 +746,4 @@ struct iso_addr *host, *gateway, *netmask; rtredirect(S(dst), S(gte), (struct sockaddr *)0, RTF_DONE | RTF_HOST, S(gte), 0); } -#endif ISO +#endif /* ISO */ diff --git a/sys/netiso/iso_snpac.h b/sys/netiso/iso_snpac.h index aa1a0b4500..62d04dd868 100644 --- a/sys/netiso/iso_snpac.h +++ b/sys/netiso/iso_snpac.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)iso_snpac.h 7.8 (Berkeley) 5/6/91 - * $Id: iso_snpac.h,v 1.2 1993/10/16 21:05:28 rgrimes Exp $ + * $Id: iso_snpac.h,v 1.3 1993/11/07 17:49:47 wollman Exp $ */ /*********************************************************** @@ -111,7 +111,23 @@ struct llinfo_llc { #define SIOCSSTYPE _IOW('a', 39, struct systype_req) /* set system type */ #define SIOCGSTYPE _IOR('a', 40, struct systype_req) /* get system type */ -#ifdef KERNEL +#ifdef KERNEL extern struct llinfo_llc llinfo_llc; /* head for linked lists */ +extern void llc_rtrequest(int, struct rtentry *, struct sockaddr *); +extern int iso_snparesolve(struct ifnet *, struct sockaddr_iso *, caddr_t, + int *); +extern void snpac_free(struct llinfo_llc *); +extern int snpac_add(struct ifnet *, struct iso_addr *, caddr_t, int /*char*/, + int /*u_short*/, int); +extern int snpac_ioctl(struct socket *, int, caddr_t); +extern void snpac_age(caddr_t, int); +extern int snpac_ownmulti(caddr_t, u_int); +extern void snpac_flushifp(struct ifnet *); +extern void snpac_rtrequest(int, struct iso_addr *, struct iso_addr *, + struct iso_addr *, int /*short*/, + struct rtentry **); +extern void snpac_addrt(struct ifnet *, struct iso_addr *, struct iso_addr *, + struct iso_addr *); + #endif /* KERNEL */ #endif /* _NETISO_ISO_SNPAC_H_ */ diff --git a/sys/netiso/iso_var.h b/sys/netiso/iso_var.h index dafd225788..c598c047da 100644 --- a/sys/netiso/iso_var.h +++ b/sys/netiso/iso_var.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)iso_var.h 7.5 (Berkeley) 5/6/91 - * $Id: iso_var.h,v 1.2 1993/10/16 21:05:30 rgrimes Exp $ + * $Id: iso_var.h,v 1.3 1993/11/07 17:49:49 wollman Exp $ */ /*********************************************************** @@ -135,5 +135,21 @@ struct snpa_hdr { extern struct iso_ifaddr *iso_ifaddr; /* linked list of iso address ifaces */ struct iso_ifaddr *iso_localifa(); /* linked list of iso address ifaces */ extern struct ifqueue clnlintrq; /* clnl packet input queue */ + +extern int iso_check_csum(struct mbuf *, int); +extern void iso_gen_csum(struct mbuf *, int, int); +extern void iso_init(void); +extern int iso_addrmatch1(struct iso_addr *, struct iso_addr *); +extern int iso_addrmatch(struct sockaddr_iso *, struct sockaddr_iso *); +extern u_long iso_hashchar(caddr_t, int); +extern int iso_control(struct socket *, int, caddr_t, struct ifnet *); +extern int iso_ifinit(struct ifnet *, struct iso_ifaddr *, + struct sockaddr_iso *, int); +extern int iso_ck_addr(struct iso_addr *); +extern struct iso_ifaddr *iso_localifa(struct sockaddr_iso *); +extern int iso_nlctloutput(int, int, caddr_t, struct mbuf *); +extern void dump_isoaddr(struct sockaddr_iso *); +extern void dump_addr(struct sockaddr *); + #endif /* KERNEL */ #endif /* _NETISO_ISO_VAR_H_ */ diff --git a/sys/netiso/tp_astring.c b/sys/netiso/tp_astring.c index 1c62b375a2..998f24a358 100644 --- a/sys/netiso/tp_astring.c +++ b/sys/netiso/tp_astring.c @@ -31,12 +31,12 @@ * SUCH DAMAGE. * * from: @(#)tp_astring.c 7.4 (Berkeley) 5/6/91 - * $Id$ + * $Id: tp_astring.c,v 1.2 1993/10/16 21:05:33 rgrimes Exp $ */ #ifndef _NFILE #include -#endif _NFILE +#endif /* _NFILE */ char *tp_sstring[] = { "ST_ERROR(0x0)", "TP_CLOSED(0x1)", diff --git a/sys/netiso/tp_cons.c b/sys/netiso/tp_cons.c index ac89698863..52527bb8fd 100644 --- a/sys/netiso/tp_cons.c +++ b/sys/netiso/tp_cons.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tp_cons.c 7.8 (Berkeley) 5/9/91 - * $Id$ + * $Id: tp_cons.c,v 1.2 1993/10/16 21:05:36 rgrimes Exp $ */ /*********************************************************** @@ -79,6 +79,7 @@ SOFTWARE. #ifdef TPCONS #include "param.h" +#include "systm.h" #include "socket.h" #include "domain.h" #include "mbuf.h" @@ -286,5 +287,5 @@ tpcons_dg_output(chan, m0, datalen) { return tpcons_output(((struct pklcd *)chan)->lcd_upnext, m0, datalen, 0); } -#endif TPCONS -#endif ISO +#endif /* TPCONS */ +#endif /* ISO */ diff --git a/sys/netiso/tp_driver.c b/sys/netiso/tp_driver.c index c81948d522..7633e54645 100644 --- a/sys/netiso/tp_driver.c +++ b/sys/netiso/tp_driver.c @@ -1,6 +1,6 @@ /* * from: unknown - * $Id: tp_driver.c,v 1.3 1993/10/16 21:05:37 rgrimes Exp $ + * $Id: tp_driver.c,v 1.4 1993/11/25 01:36:00 wollman Exp $ */ #define _XEBEC_PG static @@ -51,7 +51,7 @@ void tp_indicate(), tp_getoptions(), tp_cuntimeout(), tp_ctimeout_MIN(), tp_freeref(), tp_detach(), tp0_stash(), tp0_send(), - tp_netcmd(), tp_send() + tp_netcmd(); ; typedef struct tp_pcb tpcb_struct; diff --git a/sys/netiso/tp_emit.c b/sys/netiso/tp_emit.c index 285e969c8f..45d84a4528 100644 --- a/sys/netiso/tp_emit.c +++ b/sys/netiso/tp_emit.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tp_emit.c 7.9 (Berkeley) 5/9/91 - * $Id: tp_emit.c,v 1.3 1993/10/16 21:05:39 rgrimes Exp $ + * $Id: tp_emit.c,v 1.4 1993/11/25 01:36:02 wollman Exp $ */ /*********************************************************** @@ -87,7 +87,10 @@ SOFTWARE. #include "errno.h" #include "types.h" #include "time.h" + +#include "net/if.h" #include "iso.h" +#include "iso_var.h" #include "iso_pcb.h" #include "argo_debug.h" #include "tp_timer.h" @@ -100,7 +103,6 @@ SOFTWARE. #include "tp_seq.h" #include "iso_errno.h" -#include "../net/if.h" #ifdef TRUE #undef FALSE #undef TRUE @@ -109,9 +111,6 @@ SOFTWARE. #include "../netccitt/pk.h" #include "../netccitt/pk_var.h" -void iso_gen_csum(); - - /* Here is a mighty kludge. The token ring misorders packets if you * fire them at it too fast, and TP sans checksum is "too fast", so * we have introduced a delay when checksumming isn't used. diff --git a/sys/netiso/tp_inet.c b/sys/netiso/tp_inet.c index c28c6a045b..e9a15f8eb6 100644 --- a/sys/netiso/tp_inet.c +++ b/sys/netiso/tp_inet.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tp_inet.c 7.8 (Berkeley) 5/6/91 - * $Id: tp_inet.c,v 1.2 1993/10/16 21:05:42 rgrimes Exp $ + * $Id: tp_inet.c,v 1.3 1993/11/25 01:36:03 wollman Exp $ */ /*********************************************************** @@ -85,6 +85,7 @@ SOFTWARE. #ifdef INET #include "param.h" +#include "systm.h" #include "socket.h" #include "socketvar.h" #include "mbuf.h" @@ -818,4 +819,4 @@ tpip_route(dst) return ifp; } -#endif INET +#endif /* INET */ diff --git a/sys/netiso/tp_input.c b/sys/netiso/tp_input.c index 9d208f9fad..17a4d3777b 100644 --- a/sys/netiso/tp_input.c +++ b/sys/netiso/tp_input.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)tp_input.c 7.19 (Berkeley) 6/27/91 - * $Id: tp_input.c,v 1.2 1993/10/16 21:05:44 rgrimes Exp $ + * $Id: tp_input.c,v 1.3 1993/11/25 01:36:05 wollman Exp $ */ /*********************************************************** @@ -348,7 +348,7 @@ tp_newsocket(so, fname, cons_channel, class_to_use, netservice) * the passive open case */ tpcb->tp_dont_change_params = 0; - err = tp_route_to( m, tpcb, cons_channel); + err = tp_route_to( m, tpcb, (caddr_t)cons_channel); m_free(m); if (!err) @@ -375,7 +375,7 @@ tpcons_output() { return(0); } -#endif !CONS +#endif /* !CONS */ /* * NAME: tp_input() @@ -917,7 +917,7 @@ again: /* we've now made the error reporting thing check for multiple channels and not close out if more than one in use */ -#endif old_history +#endif /* old_history */ { CHECK( ((int)dref <= 0 || dref >= N_TPREF) , @@ -1234,7 +1234,7 @@ again: #else e.ATTR(AK_TPDU).e_cdt = hdr->tpdu_AKcdtX; e.ATTR(AK_TPDU).e_seq = hdr->tpdu_AKseqX; -#endif BYTE_ORDER +#endif /* BYTE_ORDER */ } else { e.ATTR(AK_TPDU).e_cdt = hdr->tpdu_AKcdt; e.ATTR(AK_TPDU).e_seq = hdr->tpdu_AKseq; @@ -1259,7 +1259,7 @@ again: e.ATTR(XAK_TPDU).e_seq = seqeotX.s_seq; #else e.ATTR(XAK_TPDU).e_seq = hdr->tpdu_XAKseqX; -#endif BYTE_ORDER +#endif /* BYTE_ORDER */ } else { e.ATTR(XAK_TPDU).e_seq = hdr->tpdu_XAKseq; } @@ -1277,7 +1277,7 @@ again: e.ATTR(XPD_TPDU).e_seq = seqeotX.s_seq; #else e.ATTR(XPD_TPDU).e_seq = hdr->tpdu_XPDseqX; -#endif BYTE_ORDER +#endif /* BYTE_ORDER */ } else { e.ATTR(XPD_TPDU).e_seq = hdr->tpdu_XPDseq; } @@ -1312,7 +1312,7 @@ again: #else e.ATTR(DT_TPDU).e_seq = hdr->tpdu_DTseqX; e.ATTR(DT_TPDU).e_eot = hdr->tpdu_DTeotX; -#endif BYTE_ORDER +#endif /* BYTE_ORDER */ } else { e.ATTR(DT_TPDU).e_seq = hdr->tpdu_DTseq; e.ATTR(DT_TPDU).e_eot = hdr->tpdu_DTeot; diff --git a/sys/netiso/tp_iso.c b/sys/netiso/tp_iso.c index 2d2087c26a..ea2b66abd9 100644 --- a/sys/netiso/tp_iso.c +++ b/sys/netiso/tp_iso.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tp_iso.c 7.11 (Berkeley) 5/6/91 - * $Id: tp_iso.c,v 1.3 1993/10/16 21:05:47 rgrimes Exp $ + * $Id: tp_iso.c,v 1.4 1993/11/25 01:36:08 wollman Exp $ */ /*********************************************************** @@ -110,6 +110,10 @@ SOFTWARE. #include "tp_clnp.h" #include "cltp_var.h" +int clnp_output(); /* XXX */ +void tpclnp_ctlinput(); /* XXX */ +int tp_driver(); /* XXX */ + /* * CALLED FROM: * pr_usrreq() on PRU_BIND, PRU_CONNECT, PRU_ACCEPT, and PRU_PEERADDR @@ -630,7 +634,7 @@ tpiso_quench(isop) * (cmd) is the type of ICMP error. * (siso) is the address of the guy who sent the ER CLNPDU */ -ProtoHook +void tpclnp_ctlinput(cmd, siso) int cmd; struct sockaddr_iso *siso; @@ -647,9 +651,9 @@ tpclnp_ctlinput(cmd, siso) ENDDEBUG if (cmd < 0 || cmd > PRC_NCMDS) - return 0; + return; if (siso->siso_family != AF_ISO) - return 0; + return; switch (cmd) { case PRC_QUENCH2: @@ -691,7 +695,7 @@ tpclnp_ctlinput(cmd, siso) iso_pcbnotify(&tp_isopcb, siso, (int)inetctlerrmap[cmd], tpiso_abort); break; } - return 0; + return; } /* * XXX - Variant which is called by clnp_er.c with an isoaddr rather diff --git a/sys/netiso/tp_meas.c b/sys/netiso/tp_meas.c index 60304a3ced..b04f5ff48c 100644 --- a/sys/netiso/tp_meas.c +++ b/sys/netiso/tp_meas.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tp_meas.c 7.4 (Berkeley) 5/6/91 - * $Id$ + * $Id: tp_meas.c,v 1.2 1993/10/16 21:05:49 rgrimes Exp $ */ /*********************************************************** @@ -67,12 +67,12 @@ SOFTWARE. */ #include "types.h" +#include "systm.h" +#include "kernel.h" #include "time.h" #include "argo_debug.h" #include "tp_meas.h" -extern struct timeval time; - #ifdef TP_PERF_MEAS int tp_Measn = 0; struct tp_Meas tp_Meas[TPMEASN]; diff --git a/sys/netiso/tp_output.c b/sys/netiso/tp_output.c index e625e16a27..5744b86417 100644 --- a/sys/netiso/tp_output.c +++ b/sys/netiso/tp_output.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * From: @(#)tp_output.c 7.10 (Berkeley) 6/27/91 - * $Id: tp_output.c,v 1.2 1993/09/09 23:35:48 rgrimes Exp $ + * $Id: tp_output.c,v 1.3 1993/10/16 21:05:51 rgrimes Exp $ */ /*********************************************************** @@ -117,9 +117,9 @@ SOFTWARE. int tp_consistency( tpcb, cmd, param ) + struct tp_pcb *tpcb; u_int cmd; struct tp_conn_param *param; - struct tp_pcb *tpcb; { register int error = EOK; int class_to_use = tp_mask_to_num(param->p_class); diff --git a/sys/netiso/tp_param.h b/sys/netiso/tp_param.h index cad220384c..c6d61b8caa 100644 --- a/sys/netiso/tp_param.h +++ b/sys/netiso/tp_param.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tp_param.h 7.8 (Berkeley) 6/27/91 - * $Id: tp_param.h,v 1.2 1993/10/16 21:05:53 rgrimes Exp $ + * $Id: tp_param.h,v 1.3 1993/11/07 17:49:55 wollman Exp $ */ /*********************************************************** @@ -153,8 +153,8 @@ extern int N_TPREF; #define TP_MAX_CR_DATA TP_MAX_CC_DATA #define TP_MAX_DR_DATA 0x40 /* 64 octets */ -#define TP_XTD_FMT_BIT 0x80000000 -#define TP_XTD_FMT_MASK 0x7fffffff +#define TP_XTD_FMT_BIT 0x80000000ul +#define TP_XTD_FMT_MASK 0x7ffffffful #define TP_NML_FMT_BIT 0x80 #define TP_NML_FMT_MASK 0x7f @@ -236,7 +236,7 @@ extern int N_TPREF; #define MT_XPD 0x44 #define MT_EOT 0x40 -#define TP_ENOREF 0x80000000 +#define TP_ENOREF 0x80000000ul typedef unsigned int SeqNum; typedef unsigned short RefNum; diff --git a/sys/netiso/tp_pcb.c b/sys/netiso/tp_pcb.c index 2216c36529..b1c0ad8090 100644 --- a/sys/netiso/tp_pcb.c +++ b/sys/netiso/tp_pcb.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tp_pcb.c 7.11 (Berkeley) 5/6/91 - * $Id: tp_pcb.c,v 1.2 1993/10/16 21:05:55 rgrimes Exp $ + * $Id: tp_pcb.c,v 1.3 1993/11/25 01:36:09 wollman Exp $ */ /*********************************************************** @@ -76,8 +76,8 @@ SOFTWARE. * */ -#include "types.h" #include "param.h" +#include "systm.h" #include "mbuf.h" #include "socket.h" #include "socketvar.h" diff --git a/sys/netiso/tp_pcb.h b/sys/netiso/tp_pcb.h index 2fe259b46d..2f69b9a268 100644 --- a/sys/netiso/tp_pcb.h +++ b/sys/netiso/tp_pcb.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tp_pcb.h 7.9 (Berkeley) 5/6/91 - * $Id: tp_pcb.h,v 1.4 1993/11/18 00:10:15 wollman Exp $ + * $Id: tp_pcb.h,v 1.5 1993/11/25 01:36:10 wollman Exp $ */ /*********************************************************** @@ -365,6 +365,35 @@ extern struct tp_param tp_param; extern struct nl_protosw nl_protosw[]; extern struct tp_pcb *tp_listeners; extern struct tp_pcb *tp_intercepts; + +extern int tp_goodXack(struct tp_pcb *, SeqNum); +extern void tp_rtt_rtv(struct timeval *, struct timeval *, struct timeval *); +extern int tp_goodack(struct tp_pcb *, u_int, SeqNum, SeqNum); +extern int tp_send(struct tp_pcb *); +struct tp_event; +extern int tp_stash(struct tp_pcb *, struct tp_event *); + +extern void tp_local_credit(struct tp_pcb *); +extern int tp_protocol_error(struct tp_event *, struct tp_pcb *); +extern void tp_drain(void); +extern void tp_indicate(int, struct tp_pcb *, int /*u_short*/); +extern void tp_getoptions(struct tp_pcb *); +extern void tp_recycle_tsuffix(struct tp_pcb *); +extern void tp_quench(struct tp_pcb *, int); +extern void tp_netcmd(struct tp_pcb *, int); +extern int tp_mask_to_num(int /*u_char*/); +extern int tp_route_to(struct mbuf *, struct tp_pcb *, caddr_t); +extern void tp0_stash(struct tp_pcb *, struct tp_event *); +extern void ytp0_openflow(struct tp_pcb *); +extern int tp_setup_perf(struct tp_pcb *); + +extern int tp_consistency(struct tp_pcb *, u_int, struct tp_conn_param *); +extern int tp_ctloutput(int, struct socket *, int, int, struct mbuf **); +extern struct mbuf *tp_inputprep(struct mbuf *); +extern int tp_input(struct mbuf *, struct sockaddr *, struct sockaddr *, + u_int, int (*)(), int); +extern int tp_headersize(int, struct tp_pcb *); + #endif #define sototpcb(so) ((struct tp_pcb *)(so->so_tpcb)) diff --git a/sys/netiso/tp_subr2.c b/sys/netiso/tp_subr2.c index ce8cd924a2..1151e86eed 100644 --- a/sys/netiso/tp_subr2.c +++ b/sys/netiso/tp_subr2.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tp_subr2.c 7.10 (Berkeley) 6/27/91 - * $Id: tp_subr2.c,v 1.3 1993/10/16 21:06:04 rgrimes Exp $ + * $Id: tp_subr2.c,v 1.4 1993/11/25 01:36:13 wollman Exp $ */ /*********************************************************** @@ -187,10 +187,10 @@ tp_protocol_error(e,tpcb) /* Not used at the moment */ -ProtoHook -tp_drain() +void +tp_drain(void) { - return 0; + return; } @@ -636,7 +636,7 @@ done: return error; } -#ifndef TPCONS +#ifndef CCITT static void pk_flowcontrol() {} #endif diff --git a/sys/netiso/tp_timer.c b/sys/netiso/tp_timer.c index e717332333..a99b745b8d 100644 --- a/sys/netiso/tp_timer.c +++ b/sys/netiso/tp_timer.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tp_timer.c 7.5 (Berkeley) 5/6/91 - * $Id$ + * $Id: tp_timer.c,v 1.3 1993/10/16 21:06:06 rgrimes Exp $ */ /*********************************************************** @@ -102,6 +102,7 @@ struct Ecallout *TP_callout; struct tp_ref *tp_ref; int N_TPREF = 100; +int tp_driver(); /* XXX */ extern int tp_maxrefopen; /* highest ref # of an open tp connection */ /* diff --git a/sys/netiso/tp_usrreq.c b/sys/netiso/tp_usrreq.c index 99c80a1c24..238efb98b4 100644 --- a/sys/netiso/tp_usrreq.c +++ b/sys/netiso/tp_usrreq.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tp_usrreq.c 7.17 (Berkeley) 6/27/91 - * $Id: tp_usrreq.c,v 1.2 1993/10/16 21:06:14 rgrimes Exp $ + * $Id: tp_usrreq.c,v 1.3 1993/11/25 01:36:15 wollman Exp $ */ /*********************************************************** @@ -93,6 +93,8 @@ SOFTWARE. #include "iso.h" #include "iso_errno.h" +int tp_confirm(struct tp_pcb *); + int tp_attach(), tp_driver(); int TNew; int TPNagle1, TPNagle2; @@ -807,7 +809,7 @@ struct uio *uio; int tp_confirm(tpcb) -register struct tp_pcb *tpcb; + register struct tp_pcb *tpcb; { struct tp_event E; if (tpcb->tp_state == TP_CONFIRMING) diff --git a/sys/netns/idp_usrreq.c b/sys/netns/idp_usrreq.c index 0f259b5445..61f10a543a 100644 --- a/sys/netns/idp_usrreq.c +++ b/sys/netns/idp_usrreq.c @@ -31,10 +31,11 @@ * SUCH DAMAGE. * * from: @(#)idp_usrreq.c 7.11 (Berkeley) 6/27/91 - * $Id: idp_usrreq.c,v 1.3 1993/11/07 17:50:20 wollman Exp $ + * $Id: idp_usrreq.c,v 1.4 1993/11/25 01:36:21 wollman Exp $ */ #include "param.h" +#include "systm.h" #include "malloc.h" #include "mbuf.h" #include "protosw.h" @@ -105,8 +106,9 @@ bad: } void -idp_abort(nsp) +idp_abort(nsp, errno) struct nspcb *nsp; + int errno; { struct socket *so = nsp->nsp_socket; @@ -117,7 +119,7 @@ idp_abort(nsp) * Drop connection, reporting * the specified error. */ -struct nspcb * +void idp_drop(nsp, errno) register struct nspcb *nsp; int errno; @@ -136,7 +138,6 @@ idp_drop(nsp, errno) so->so_error = errno; ns_pcbdisconnect(nsp); soisdisconnected(so); - return nsp; } int noIdpRoute; @@ -260,7 +261,7 @@ idp_output(nsp, m0) } } nsp->nsp_lastdst = idp->idp_dna; -#endif ancient_history +#endif /* ancient_history */ if (noIdpRoute) ro = 0; return (ns_output(m, ro, so->so_options & SO_BROADCAST)); } @@ -365,7 +366,7 @@ idp_ctloutput(req, so, level, name, value) case SO_NSIP_ROUTE: error = nsip_route(*value); break; -#endif NSIP +#endif /* NSIP */ default: error = EINVAL; } @@ -378,10 +379,11 @@ idp_ctloutput(req, so, level, name, value) /*ARGSUSED*/ int -idp_usrreq(so, req, m, nam, control) +idp_usrreq(so, req, m, nam, control, dummy) struct socket *so; int req; struct mbuf *m, *nam, *control; + struct mbuf *dummy; { struct nspcb *nsp = sotonspcb(so); int error = 0; @@ -539,12 +541,13 @@ release: m_freem(m); return (error); } -/*ARGSUSED*/ + int -idp_raw_usrreq(so, req, m, nam, control) +idp_raw_usrreq(so, req, m, nam, control, dummy) struct socket *so; int req; struct mbuf *m, *nam, *control; + struct mbuf *dummy; { int error = 0; struct nspcb *nsp = sotonspcb(so); @@ -569,7 +572,7 @@ idp_raw_usrreq(so, req, m, nam, control) nsp->nsp_flags = NSP_RAWIN | NSP_RAWOUT; break; default: - error = idp_usrreq(so, req, m, nam, control); + error = idp_usrreq(so, req, m, nam, control, 0); } return (error); } diff --git a/sys/netns/idp_var.h b/sys/netns/idp_var.h index 478fa126f8..fa2d6b69df 100644 --- a/sys/netns/idp_var.h +++ b/sys/netns/idp_var.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)idp_var.h 7.4 (Berkeley) 6/28/90 - * $Id: idp_var.h,v 1.2 1993/10/16 19:54:12 rgrimes Exp $ + * $Id: idp_var.h,v 1.3 1993/11/07 17:50:22 wollman Exp $ */ #ifndef _NETNS_IDP_VAR_H_ @@ -50,5 +50,17 @@ struct idpstat { #ifdef KERNEL extern struct idpstat idpstat; -#endif +struct nspcb; +extern void idp_input(struct mbuf *, struct nspcb *); +extern void idp_abort(struct nspcb *, int); +extern void idp_drop(struct nspcb *, int); +extern int idp_output(struct nspcb *, struct mbuf *); +extern int idp_ctloutput(int, struct socket *, int, int, struct mbuf **); +extern int idp_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, + struct mbuf *, struct mbuf *); +extern int idp_raw_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, + struct mbuf *, struct mbuf *); + + +#endif /* KERNEL */ #endif /* _NETNS_IDP_VAR_H_ */ diff --git a/sys/netns/ns.c b/sys/netns/ns.c index 61c145b701..0de416df23 100644 --- a/sys/netns/ns.c +++ b/sys/netns/ns.c @@ -31,10 +31,11 @@ * SUCH DAMAGE. * * from: @(#)ns.c 7.8 (Berkeley) 6/27/91 - * $Id: ns.c,v 1.3 1993/11/07 17:50:23 wollman Exp $ + * $Id: ns.c,v 1.4 1993/11/25 01:36:27 wollman Exp $ */ #include "param.h" +#include "systm.h" #include "mbuf.h" #include "ioctl.h" #include "protosw.h" diff --git a/sys/netns/ns.h b/sys/netns/ns.h index df7ac110d6..b011c1176c 100644 --- a/sys/netns/ns.h +++ b/sys/netns/ns.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)ns.h 7.8 (Berkeley) 2/22/91 - * $Id: ns.h,v 1.2 1993/10/16 19:54:16 rgrimes Exp $ + * $Id: ns.h,v 1.3 1993/11/07 17:50:24 wollman Exp $ */ #ifndef _NETNS_NS_H_ @@ -143,6 +143,47 @@ extern union ns_host ns_broadhost; extern union ns_net ns_zeronet; extern union ns_net ns_broadnet; u_short ns_cksum(); +extern int ns_err_x(int); +extern void ns_error(struct mbuf *, int, int); +extern void ns_printhost(struct ns_addr *); +extern void ns_err_input(struct mbuf *); +extern int ns_echo(struct mbuf *); +extern void idpip_input(struct mbuf *, struct ifnet *); +extern int nsip_route(struct mbuf *); +extern void nsip_ctlinput(int, struct sockaddr *); +struct in_addr; +extern void nsip_rtchange(struct in_addr *); +extern void ns_init(void); +extern void nsintr(void); +extern u_char nsctlerrmap[]; +extern void idp_ctlinput(int, caddr_t); +struct route; +extern int idp_do_route(struct ns_addr *, struct route *); +extern void ns_watch_output(struct mbuf *, struct ifnet *); +extern int ns_output(struct mbuf *, struct route *, int); + +struct nspcb; + +/* This is a pun for struct protosw in sys/protosw.h: */ +struct ns_protosw { + short pr_type; /* socket type used for */ + struct domain *pr_domain; /* domain protocol a member of */ + short pr_protocol; /* protocol number */ + short pr_flags; + void (*pr_input)(struct mbuf *, struct nspcb *); + int (*pr_output)(struct nspcb *, struct mbuf *); + void (*pr_ctlinput)(int, caddr_t); + int (*pr_ctloutput)(int, struct socket *, int, int, + struct mbuf **); + int (*pr_usrreq)(struct socket *, int, struct mbuf *, + struct mbuf *, struct mbuf *, struct mbuf *); + void (*pr_init)(void); /* initialization hook */ + void (*pr_fasttimo)(void); /* fast timeout (200ms) */ + void (*pr_slowtimo)(void); /* slow timeout (500ms) */ + void (*pr_drain)(void); /* flush any excess space possible */ +}; + +extern struct ns_protosw nssw[]; #else #include diff --git a/sys/netns/ns_input.c b/sys/netns/ns_input.c index 6ba649360a..17f8b83337 100644 --- a/sys/netns/ns_input.c +++ b/sys/netns/ns_input.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)ns_input.c 7.8 (Berkeley) 6/27/91 - * $Id: ns_input.c,v 1.3 1993/11/18 00:10:53 wollman Exp $ + * $Id: ns_input.c,v 1.4 1993/11/25 01:36:30 wollman Exp $ */ #include "param.h" @@ -283,8 +283,6 @@ idp_ctlinput(cmd, arg) struct ns_addr *ns; struct nspcb *nsp; struct ns_errp *errp = 0; - int idp_abort(); - extern struct nspcb *idp_drop(); int type; if (cmd < 0 || cmd > PRC_NCMDS) @@ -487,8 +485,8 @@ idp_undo_route(ro) void ns_watch_output(m, ifp) -struct mbuf *m; -struct ifnet *ifp; + struct mbuf *m; + struct ifnet *ifp; { register struct nspcb *nsp; register struct ifaddr *ifa; diff --git a/sys/netns/ns_ip.c b/sys/netns/ns_ip.c index 0eaf5d6f40..3f8cd447f2 100644 --- a/sys/netns/ns_ip.c +++ b/sys/netns/ns_ip.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)ns_ip.c 7.6 (Berkeley) 6/28/90 - * $Id$ + * $Id: ns_ip.c,v 1.2 1993/10/16 19:54:25 rgrimes Exp $ */ /* @@ -73,7 +73,12 @@ struct ifnet_en { struct ifnet_en *ifen_next; }; -int nsipoutput(), nsipioctl(), nsipstart(); +struct rtentry; +static int nsipoutput(struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); +static int nsipioctl(struct ifnet *, int, caddr_t); +static void nsipstart(struct ifnet *); +static void nsip_free(struct ifnet *); #define LOMTU (1024+512); struct ifnet nsipif; @@ -118,7 +123,7 @@ nsipattach() /* * Process an ioctl request. */ -/* ARGSUSED */ +static int nsipioctl(ifp, cmd, data) register struct ifnet *ifp; int cmd; @@ -141,8 +146,10 @@ nsipioctl(ifp, cmd, data) case SIOCSIFFLAGS: ifr = (struct ifreq *)data; - if ((ifr->ifr_flags & IFF_UP) == 0) - error = nsip_free(ifp); + if ((ifr->ifr_flags & IFF_UP) == 0) { + nsip_free(ifp); + error = 0; + } default: @@ -155,6 +162,7 @@ struct mbuf *nsip_badlen; struct mbuf *nsip_lastin; int nsip_hold_input; +void idpip_input(m, ifp) register struct mbuf *m; struct ifnet *ifp; @@ -234,13 +242,14 @@ bad: return; } -/* ARGSUSED */ -nsipoutput(ifn, m, dst) - struct ifnet_en *ifn; +static int +nsipoutput(ifp, m, dst, rt) + struct ifnet *ifp; register struct mbuf *m; struct sockaddr *dst; + struct rtentry *rt; { - + struct ifnet_en *ifn = (struct ifnet_en *)ifp; register struct ip *ip; register struct route *ro = &(ifn->ifen_route); register int len = 0; @@ -301,6 +310,7 @@ bad: return (ENETUNREACH); } +static void nsipstart(ifp) struct ifnet *ifp; { @@ -309,6 +319,7 @@ struct ifnet *ifp; struct ifreq ifr = {"nsip0"}; +int nsip_route(m) register struct mbuf *m; { @@ -383,6 +394,7 @@ nsip_route(m) (struct ifnet *)ifn)); } +void nsip_free(ifp) struct ifnet *ifp; { @@ -394,9 +406,9 @@ struct ifnet *ifp; ro->ro_rt = 0; } ifp->if_flags &= ~IFF_UP; - return (0); } +void nsip_ctlinput(cmd, sa) int cmd; struct sockaddr *sa; @@ -425,6 +437,7 @@ nsip_ctlinput(cmd, sa) } } +void nsip_rtchange(dst) register struct in_addr *dst; { diff --git a/sys/netns/ns_output.c b/sys/netns/ns_output.c index af87b7c034..bb6661f577 100644 --- a/sys/netns/ns_output.c +++ b/sys/netns/ns_output.c @@ -31,10 +31,11 @@ * SUCH DAMAGE. * * from: @(#)ns_output.c 7.8 (Berkeley) 12/16/90 - * $Id: ns_output.c,v 1.2 1993/10/16 19:54:26 rgrimes Exp $ + * $Id: ns_output.c,v 1.3 1993/11/25 01:36:32 wollman Exp $ */ #include "param.h" +#include "systm.h" #include "malloc.h" #include "mbuf.h" #include "errno.h" diff --git a/sys/netns/ns_pcb.c b/sys/netns/ns_pcb.c index ca64e29e20..9f1c957bcc 100644 --- a/sys/netns/ns_pcb.c +++ b/sys/netns/ns_pcb.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)ns_pcb.c 7.11 (Berkeley) 6/27/91 - * $Id: ns_pcb.c,v 1.3 1993/11/07 17:50:30 wollman Exp $ + * $Id: ns_pcb.c,v 1.4 1993/11/25 01:36:33 wollman Exp $ */ #include "param.h" @@ -285,8 +285,9 @@ ns_setpeeraddr(nsp, nam) void ns_pcbnotify(dst, errno, notify, param) register struct ns_addr *dst; + int errno; + ns_notify_func_t notify; long param; - int errno, (*notify)(); { register struct nspcb *nsp, *oinp; int s = splimp(); @@ -304,7 +305,7 @@ ns_pcbnotify(dst, errno, notify, param) oinp = nsp; nsp = nsp->nsp_next; oinp->nsp_notify_param = param; - (*notify)(oinp); + (*notify)(oinp, errno); } splx(s); } diff --git a/sys/netns/ns_pcb.h b/sys/netns/ns_pcb.h index c409d7e2f4..27c4f253f1 100644 --- a/sys/netns/ns_pcb.h +++ b/sys/netns/ns_pcb.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)ns_pcb.h 7.4 (Berkeley) 6/28/90 - * $Id: ns_pcb.h,v 1.3 1993/11/07 17:50:31 wollman Exp $ + * $Id: ns_pcb.h,v 1.4 1993/11/25 01:36:34 wollman Exp $ */ #ifndef _NETNS_NS_PCB_H_ @@ -80,8 +80,17 @@ struct nspcb { #ifdef KERNEL extern struct nspcb nspcb; /* head of list */ -struct nspcb *ns_pcblookup(); + +extern int ns_pcballoc(struct socket *, struct nspcb *); +extern int ns_pcbbind(struct nspcb *, struct mbuf *); +extern int ns_pcbconnect(struct nspcb *, struct mbuf *); +extern void ns_pcbdisconnect(struct nspcb *); extern void ns_pcbdetach(struct nspcb *); +extern void ns_setsockaddr(struct nspcb *, struct mbuf *); +extern void ns_setpeeraddr(struct nspcb *, struct mbuf *); +typedef void (*ns_notify_func_t)(struct nspcb *, int); +extern void ns_pcbnotify(struct ns_addr *, int, ns_notify_func_t, long); +extern struct nspcb *ns_pcblookup(struct ns_addr *, int /*u_short*/, int); -#endif +#endif /* KERNEL */ #endif /* _NETNS_NS_PCB_H_ */ diff --git a/sys/netns/ns_proto.c b/sys/netns/ns_proto.c index 3ec33f391d..9a7776e605 100644 --- a/sys/netns/ns_proto.c +++ b/sys/netns/ns_proto.c @@ -31,10 +31,11 @@ * SUCH DAMAGE. * * from: @(#)ns_proto.c 7.4 (Berkeley) 6/28/90 - * $Id$ + * $Id: ns_proto.c,v 1.2 1993/10/16 19:54:31 rgrimes Exp $ */ #include "param.h" +#include "systm.h" #include "socket.h" #include "protosw.h" #include "domain.h" @@ -42,20 +43,21 @@ #include "ns.h" +#include "idp.h" +#include "idp_var.h" +#include "sp.h" +#include "spidp.h" +#include "spp_timer.h" +#include "spp_var.h" + /* * NS protocol family: IDP, ERR, PE, SPP, ROUTE. */ -int ns_init(); -int idp_input(), idp_output(), idp_ctlinput(), idp_usrreq(); -int idp_raw_usrreq(), idp_ctloutput(); -int spp_input(), spp_ctlinput(); -int spp_usrreq(), spp_usrreq_sp(), spp_ctloutput(); -int spp_init(), spp_fasttimo(), spp_slowtimo(); extern int raw_usrreq(); extern struct domain nsdomain; -struct protosw nssw[] = { +struct ns_protosw nssw[] = { { 0, &nsdomain, 0, 0, 0, idp_output, 0, 0, 0, @@ -82,13 +84,15 @@ struct protosw nssw[] = { 0, 0, 0, 0, }, { SOCK_RAW, &nsdomain, NSPROTO_ERROR, PR_ATOMIC|PR_ADDR, - idp_ctlinput, idp_output, 0, idp_ctloutput, + idp_input, idp_output, idp_ctlinput, idp_ctloutput, idp_raw_usrreq, 0, 0, 0, 0, }, }; -struct domain nsdomain = - { AF_NS, "network systems", 0, 0, 0, - nssw, &nssw[sizeof(nssw)/sizeof(nssw[0])] }; - +struct domain nsdomain = +{ + AF_NS, "network systems", 0, 0, 0, + (struct protosw *)nssw, + (struct protosw *)&nssw[sizeof(nssw)/sizeof(nssw[0])] +}; diff --git a/sys/netns/spp_debug.c b/sys/netns/spp_debug.c index 6131af2c6d..4bfc370446 100644 --- a/sys/netns/spp_debug.c +++ b/sys/netns/spp_debug.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)spp_debug.c 7.7 (Berkeley) 6/28/90 - * $Id: spp_debug.c,v 1.3 1993/11/07 17:50:35 wollman Exp $ + * $Id: spp_debug.c,v 1.4 1993/11/25 01:36:35 wollman Exp $ */ #include "param.h" @@ -134,7 +134,7 @@ spp_trace(act, ostate, sp, si, req) if (flags) { char *cp = "<"; #ifndef lint -#define pf(f) { if (flags&SP_/**/f) { printf("%s%s", cp, "f"); cp = ","; } } +#define pf(f) { if (flags& SP_##f) { printf("%s" #f, cp); cp = ","; } } pf(SP); pf(SA); pf(OB); pf(EM); #else cp = cp; @@ -142,7 +142,7 @@ spp_trace(act, ostate, sp, si, req) printf(">"); } #ifndef lint -#define p2(f) { printf("%s = %x, ", "f", si->si_/**/f); } +#define p2(f) { printf("%s = %x, ", "f", si->si_##f); } p2(sid);p2(did);p2(dt);p2(pt); #endif ns_printhost(&si->si_sna); @@ -167,7 +167,7 @@ spp_trace(act, ostate, sp, si, req) if (sp == 0) return; #ifndef lint -#define p3(f) { printf("%s = %x, ", "f", sp->s_/**/f); } +#define p3(f) { printf("%s = %x, ", "f", sp->s_##f); } printf("\t"); p3(rack);p3(ralo);p3(smax);p3(flags); printf("\n"); #endif #endif diff --git a/sys/netns/spp_usrreq.c b/sys/netns/spp_usrreq.c index 24156548b3..9c9a92b85c 100644 --- a/sys/netns/spp_usrreq.c +++ b/sys/netns/spp_usrreq.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)spp_usrreq.c 7.15 (Berkeley) 6/27/91 - * $Id: spp_usrreq.c,v 1.3 1993/11/07 17:50:39 wollman Exp $ + * $Id: spp_usrreq.c,v 1.4 1993/11/25 01:36:36 wollman Exp $ */ #include "param.h" @@ -58,8 +58,8 @@ #include "spp_var.h" #include "spp_debug.h" -static void spp_quench(struct nspcb *); -static void spp_abort(struct nspcb *); +static void spp_quench(struct nspcb *, int); +static void spp_abort(struct nspcb *, int); static void spp_setpersist(struct sppcb *); static void spp_template(struct sppcb *); @@ -299,8 +299,8 @@ int spprexmtthresh = 3; */ int spp_reass(cb, si) -register struct sppcb *cb; -register struct spidp *si; + register struct sppcb *cb; + register struct spidp *si; { register struct spidp_q *q; register struct mbuf *m; @@ -592,8 +592,6 @@ spp_ctlinput(cmd, arg) caddr_t arg; { struct ns_addr *na; - extern u_char nsctlerrmap[]; - extern struct nspcb *idp_drop(); struct ns_errp *errp = 0; struct nspcb *nsp; struct sockaddr_ns *sns; @@ -651,8 +649,9 @@ spp_ctlinput(cmd, arg) * to one packet. We will gradually open it again as we proceed. */ static void -spp_quench(nsp) +spp_quench(nsp, errno) struct nspcb *nsp; + int errno; { struct sppcb *cb = nstosppcb(nsp); @@ -1273,10 +1272,11 @@ spp_ctloutput(req, so, level, name, value) /*ARGSUSED*/ int -spp_usrreq(so, req, m, nam, controlp) +spp_usrreq(so, req, m, nam, controlp, dummy) struct socket *so; int req; struct mbuf *m, *nam, *controlp; + struct mbuf *dummy; { struct nspcb *nsp = sotonspcb(so); register struct sppcb *cb = 0; @@ -1526,12 +1526,13 @@ release: } int -spp_usrreq_sp(so, req, m, nam, controlp) +spp_usrreq_sp(so, req, m, nam, controlp, dummy) struct socket *so; int req; struct mbuf *m, *nam, *controlp; + struct mbuf *dummy; { - int error = spp_usrreq(so, req, m, nam, controlp); + int error = spp_usrreq(so, req, m, nam, controlp, dummy); if (req == PRU_ATTACH && error == 0) { struct nspcb *nsp = sotonspcb(so); @@ -1643,8 +1644,9 @@ spp_drop(cb, errno) } static void -spp_abort(nsp) +spp_abort(nsp, errno) struct nspcb *nsp; + int errno; { (void) spp_close((struct sppcb *)nsp->nsp_pcb); @@ -1704,9 +1706,11 @@ spp_slowtimo() for (i = 0; i < SPPT_NTIMERS; i++) { if (cb->s_timer[i] && --cb->s_timer[i] == 0) { (void) spp_usrreq(cb->s_nspcb->nsp_socket, - PRU_SLOWTIMO, (struct mbuf *)0, - (struct mbuf *)i, (struct mbuf *)0, - (struct mbuf *)0); + PRU_SLOWTIMO, + (struct mbuf *)0, + (struct mbuf *)i, + (struct mbuf *)0, + (struct mbuf *)0); if (ipnxt->nsp_prev != ip) goto tpgone; } @@ -1822,7 +1826,7 @@ spp_timers(cb, timer) } return (cb); } -#ifndef lint +#if 0 int SppcbSize = sizeof (struct sppcb); int NspcbSize = sizeof (struct nspcb); -#endif lint +#endif diff --git a/sys/netns/spp_var.h b/sys/netns/spp_var.h index 2bffd626c4..b563490d5a 100644 --- a/sys/netns/spp_var.h +++ b/sys/netns/spp_var.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)spp_var.h 7.7 (Berkeley) 6/28/90 - * $Id: spp_var.h,v 1.2 1993/10/16 19:54:41 rgrimes Exp $ + * $Id: spp_var.h,v 1.3 1993/11/07 17:50:41 wollman Exp $ */ #ifndef _NETNS_SPP_VAR_H_ @@ -195,8 +195,6 @@ extern struct spp_istat spp_istat; #endif extern u_short spp_iss; -extern struct sppcb *spp_close(), *spp_disconnect(); -extern struct sppcb *spp_usrclosed(), *spp_timers(), *spp_drop(); #endif /* KERNEL */ #define SPP_ISSINCR 128 @@ -209,4 +207,34 @@ extern struct sppcb *spp_usrclosed(), *spp_timers(), *spp_drop(); #define SSEQ_LEQ(a,b) (((short)((a)-(b))) <= 0) #define SSEQ_GT(a,b) (((short)((a)-(b))) > 0) #define SSEQ_GEQ(a,b) (((short)((a)-(b))) >= 0) + +#ifdef KERNEL +/* From spp_debug.c: */ +extern void spp_trace(int /*short*/, int /*u_char*/, struct sppcb *, + struct spidp *, int); + +/* From spp_usrreq.c: */ +extern struct spp_istat spp_istat; +extern u_short spp_iss; +extern void spp_init(void); +extern void spp_input(struct mbuf *, struct nspcb *); +extern int spprexmtthresh; +extern int spp_reass(struct sppcb *, struct spidp *); +extern void spp_ctlinput(int, caddr_t); +extern int spp_output(struct sppcb *, struct mbuf *); +extern int spp_do_persist_panics; +extern int spp_ctloutput(int, struct socket *, int, int, struct mbuf **); +extern int spp_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, + struct mbuf *, struct mbuf *); +extern int spp_usrreq_sp(struct socket *, int, struct mbuf *, struct mbuf *, + struct mbuf *, struct mbuf *); +extern struct sppcb *spp_close(struct sppcb *); +extern struct sppcb *spp_usrclosed(struct sppcb *); +extern struct sppcb *spp_disconnect(struct sppcb *); +extern struct sppcb *spp_drop(struct sppcb *, int); +extern void spp_fasttimo(void); +extern void spp_slowtimo(void); +extern struct sppcb *spp_timers(struct sppcb *, int); + +#endif /* KERNEL */ #endif /* _NETNS_SPP_VAR_H_ */ diff --git a/sys/netrmp/rmp.c b/sys/netrmp/rmp.c index 7d74cee09c..4dcdebdd22 100644 --- a/sys/netrmp/rmp.c +++ b/sys/netrmp/rmp.c @@ -38,10 +38,11 @@ * from: Utah $Hdr: rmp.c 1.3 89/06/07$ * * From: @(#)rmp.c 7.1 (Berkeley) 5/8/90 - * $Id: rmp.c,v 1.1 1993/11/07 22:55:07 wollman Exp $ + * $Id: rmp.c,v 1.2 1993/11/25 01:36:40 wollman Exp $ */ #include "param.h" +#include "systm.h" #include "mbuf.h" #include "socket.h" #include "socketvar.h" diff --git a/sys/netrmp/rmp_proto.c b/sys/netrmp/rmp_proto.c index 53722b090c..0f21832f9a 100644 --- a/sys/netrmp/rmp_proto.c +++ b/sys/netrmp/rmp_proto.c @@ -38,10 +38,11 @@ * from: Utah $Hdr: rmp_proto.c 1.3 89/06/07$ * * From: @(#)rmp_proto.c 7.1 (Berkeley) 5/8/90 - * $Id$ + * $Id: rmp_proto.c,v 1.1 1993/11/07 22:55:11 wollman Exp $ */ #include "param.h" +#include "systm.h" #include "socket.h" #include "protosw.h" #include "domain.h" diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index 79232e7fd0..629c0d4cd7 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * From: @(#)nfs_serv.c 7.40 (Berkeley) 5/15/91 - * $Id: nfs_serv.c,v 1.3 1993/09/09 22:06:03 rgrimes Exp $ + * $Id: nfs_serv.c,v 1.4 1993/11/25 01:36:50 wollman Exp $ */ /* @@ -72,6 +72,7 @@ #include "nfs.h" #include "xdr_subs.h" #include "nfsm_subs.h" +#include "nfsnode.h" /* Defs */ #define TRUE 1 @@ -616,7 +617,7 @@ nfsrv_create(mrep, md, dpos, cred, xid, mrq, repstat, p) FREE(nd.ni_pnbuf, M_NAMEI); } else if (vap->va_type == VCHR || vap->va_type == VBLK || vap->va_type == VFIFO) { - if (vap->va_type == VCHR && rdev == 0xffffffff) + if (vap->va_type == VCHR && rdev == 0xffffffffUL) vap->va_type = VFIFO; if (vap->va_type == VFIFO) { #ifndef FIFO diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c index cf23d4a302..be41044471 100644 --- a/sys/nfs/nfs_socket.c +++ b/sys/nfs/nfs_socket.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * From: @(#)nfs_socket.c 7.23 (Berkeley) 4/20/91 - * $Id$ + * $Id: nfs_socket.c,v 1.3 1993/09/09 22:06:05 rgrimes Exp $ */ /* @@ -479,7 +479,7 @@ tryagain: } if (error) goto errout; - len = ntohl(len) & ~0x80000000; + len = ntohl(len) & ~0x80000000ul; /* * This is SERIOUS! We are out of sync with the sender * and forcing a disconnect/reconnect is all I can do. @@ -810,7 +810,7 @@ nfs_request(vp, mreq, xid, procnum, procp, tryhard, mp, mrp, mdp, dposp) */ if ((nmp->nm_soflags & PR_ATOMIC) == 0) { M_PREPEND(mreq, sizeof(u_long), M_WAIT); - *mtod(mreq, u_long *) = htonl(0x80000000 | len); + *mtod(mreq, u_long *) = htonl(0x80000000ul | len); } rep->r_mreq = mreq; diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index bb63d4ed9e..44e2d3c6e5 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * From: @(#)nfs_subs.c 7.41 (Berkeley) 5/15/91 - * $Id: nfs_subs.c,v 1.3 1993/11/07 17:50:57 wollman Exp $ + * $Id: nfs_subs.c,v 1.4 1993/11/25 01:36:52 wollman Exp $ */ /* @@ -543,7 +543,7 @@ nfs_init() * Initialize reply list and start timer */ nfsreqh.r_prev = nfsreqh.r_next = &nfsreqh; - nfs_timer(); + nfs_timer(0); } /* @@ -651,7 +651,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) */ np = VTONFS(vp); if (vp->v_type == VNON) { - if (type == VCHR && rdev == 0xffffffff) + if (type == VCHR && rdev == 0xffffffffUL) vp->v_type = type = VFIFO; else vp->v_type = type; diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c index a334b51dce..9894d78385 100644 --- a/sys/nfs/nfs_syscalls.c +++ b/sys/nfs/nfs_syscalls.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * From: @(#)nfs_syscalls.c 7.26 (Berkeley) 4/16/91 - * $Id$ + * $Id: nfs_syscalls.c,v 1.3 1993/09/09 22:06:09 rgrimes Exp $ */ #include "param.h" @@ -288,7 +288,8 @@ nfssvc(p, uap, retval) */ if (!sosendallatonce(so)) { M_PREPEND(mreq, sizeof(u_long), M_WAIT); - *mtod(mreq, u_long *) = htonl(0x80000000 | siz); + *mtod(mreq, u_long *) = + htonl(0x80000000UL | siz); } error = nfs_send(so, nam, mreq, (struct nfsreq *)0); if (nam) diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index d79e856c88..222ff93f92 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * From: @(#)nfs_vfsops.c 7.31 (Berkeley) 5/6/91 - * $Id$ + * $Id: nfs_vfsops.c,v 1.2 1993/09/09 22:06:11 rgrimes Exp $ */ #include "param.h" @@ -50,6 +50,7 @@ #include "socket.h" #include "socketvar.h" #include "systm.h" +#include "kernel.h" #include "../net/if.h" #include "../net/route.h" @@ -63,6 +64,9 @@ #include "nfsm_subs.h" #include "nfsdiskless.h" +static int mountnfs(struct nfs_args *, struct mount *, struct mbuf *, + char *, char *, struct vnode **); + /* * nfs vfs operations. */ @@ -327,7 +331,7 @@ nfs_mount(mp, path, data, ndp, p) /* * Common code for mount and mountroot */ -int +static int mountnfs(argp, mp, nam, pth, hst, vpp) register struct nfs_args *argp; register struct mount *mp; diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 6b37bcb38f..300e528500 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * From: @(#)nfs_vnops.c 7.60 (Berkeley) 5/24/91 - * $Id: nfs_vnops.c,v 1.4 1993/10/25 17:56:56 davidg Exp $ + * $Id: nfs_vnops.c,v 1.5 1993/11/25 01:36:55 wollman Exp $ */ /* @@ -776,7 +776,7 @@ nfs_mknod(ndp, vap, cred, p) rdev = txdr_unsigned(vap->va_rdev); #ifdef FIFO else if (vap->va_type == VFIFO) - rdev = 0xffffffff; + rdev = 0xffffffffUL; #endif /* FIFO */ else { VOP_ABORTOP(ndp); diff --git a/sys/nfs/nfsm_subs.h b/sys/nfs/nfsm_subs.h index 9841f65c25..09e101e9f2 100644 --- a/sys/nfs/nfsm_subs.h +++ b/sys/nfs/nfsm_subs.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * From: @(#)nfsm_subs.h 7.11 (Berkeley) 4/16/91 - * $Id$ + * $Id: nfsm_subs.h,v 1.2 1993/09/09 22:06:21 rgrimes Exp $ */ #ifndef __h_nfsm_subs @@ -291,7 +291,7 @@ extern struct mbuf *nfsm_reqh(); fp->fa_size = txdr_unsigned(vap->va_size); \ fp->fa_blocksize = txdr_unsigned(vap->va_blocksize); \ if (vap->va_type == VFIFO) \ - fp->fa_rdev = 0xffffffff; \ + fp->fa_rdev = 0xffffffffUL; \ else \ fp->fa_rdev = txdr_unsigned(vap->va_rdev); \ fp->fa_blocks = txdr_unsigned(vap->va_bytes / NFS_FABLKSIZE); \ @@ -303,8 +303,7 @@ extern struct mbuf *nfsm_reqh(); fp->fa_ctime.tv_sec = txdr_unsigned(vap->va_ctime.tv_sec); \ fp->fa_ctime.tv_usec = txdr_unsigned(vap->va_gen) -/* These are here to provide prototypes for everything in the NFS system. - * Added 8.6.-93, Garrett A. Wollman, University of Vermont. */ +#ifdef KERNEL struct nfsmount; void nfs_updatetimer __P((struct nfsmount *)); @@ -316,5 +315,34 @@ void nfs_sounlock __P((int *)); int nfs_netaddr_match __P((struct mbuf *, struct mbuf *)); int nfs_badnam __P((struct mbuf *, struct mbuf *, struct mbuf *)); +extern int nfs_rephead(int, u_long, int, struct mbuf **, struct mbuf **, + caddr_t *); +extern struct mbuf *nfsm_reqh(u_long, u_long, u_long, struct ucred *, int, + caddr_t *, struct mbuf **, u_long *); +extern int nfsm_mbuftouio(struct mbuf **, struct uio *, int, caddr_t *); +extern int nfsm_uiotombuf(struct uio *, struct mbuf **, int, caddr_t *); +extern int nfsm_disct(struct mbuf **, caddr_t *, int, int, int, caddr_t *); +extern int nfs_adv(struct mbuf **, caddr_t *, int, int); +extern int nfsm_strtmbuf(struct mbuf **, char **, char *, long); +extern void nfs_init(void); +extern void nfsm_adj(struct mbuf *, int, int); +extern struct mbuf *nfs_compress(struct mbuf *); +extern struct mbuf *nfs_uncompress(struct mbuf *); +extern int nfs_request(struct vnode *, struct mbuf *, u_long, int, + struct proc *, int, struct mount *, struct mbuf **, + struct mbuf **, caddr_t *); +struct nfsreq; +extern int nfs_receive(struct socket *, struct mbuf **, struct mbuf **, + struct nfsreq *); +extern int nfs_send(struct socket *, struct mbuf *, struct mbuf *, + struct nfsreq *); +extern int nfs_getreq(struct socket *so, u_long, u_long, int, struct mbuf **, + struct mbuf **, struct mbuf **, caddr_t *, u_long *, + u_long *, struct ucred *, struct mbuf *, struct mbuf *, + int *, int *); +extern int nfs_netaddr_match(struct mbuf *, struct mbuf *); +extern int nfs_badnam(struct mbuf *, struct mbuf *, struct mbuf *); + +#endif /* KERNEL */ #endif /* __h_nfsm_subs */ diff --git a/sys/nfs/nfsnode.h b/sys/nfs/nfsnode.h index 9e58000f23..9324d5bd16 100644 --- a/sys/nfs/nfsnode.h +++ b/sys/nfs/nfsnode.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * From: @(#)nfsnode.h 7.12 (Berkeley) 4/16/91 - * $Id: nfsnode.h,v 1.4 1993/11/07 17:50:59 wollman Exp $ + * $Id: nfsnode.h,v 1.5 1993/11/25 01:36:59 wollman Exp $ */ #ifndef __h_nfsnode @@ -227,5 +227,37 @@ int nfs_advlock __P(( int flags)); void nfs_nput __P((struct vnode *)); + +extern int nfs_dogetattr(struct vnode *, struct vattr *, struct ucred *, int, + struct proc *); +extern int nfsrv_fhtovp(fhandle_t *, int, struct vnode **, struct ucred *); +struct mbuf; +extern int nfs_loadattrcache(struct vnode **, struct mbuf **, caddr_t *, + struct vattr *); +extern int nfs_getattrcache(struct vnode *, struct vattr *); +extern int nfs_namei(struct nameidata *, fhandle_t *, int, struct mbuf **, + caddr_t *, struct proc *); + +extern int nfsrv_access(struct vnode *, int, struct ucred *, struct proc *); +extern union nhead *nfs_hash(nfsv2fh_t *); +extern int nfs_nget(struct mount *, nfsv2fh_t *, struct nfsnode **); + +struct nfsreq; struct nfsmount; +extern int nfs_reply(struct nfsmount *, struct nfsreq *); +extern void nfs_timer(caddr_t); +extern void nfs_updatetimer(struct nfsmount *); +extern void nfs_backofftimer(struct nfsmount *); +extern int nfs_connect(struct nfsmount *); +extern int nfs_reconnect(struct nfsreq *, struct nfsmount *); +extern void nfs_disconnect(struct nfsmount *); +extern int nfs_sigintr(struct proc *); +extern void nfs_msg(struct proc *, const char *, const char *); +extern void nfs_solock(int *); +extern void nfs_sounlock(int *); + +/* From nfs_bio.c: */ +extern int nfs_bioread(struct vnode *, struct uio *, int, struct ucred *); +extern int nfs_write(struct vnode *, struct uio *, int, struct ucred *); + #endif /* KERNEL */ #endif /* __h_nfsnode */ diff --git a/sys/nfs/nfsrvcache.h b/sys/nfs/nfsrvcache.h index c0b66bcd26..58a03916f9 100644 --- a/sys/nfs/nfsrvcache.h +++ b/sys/nfs/nfsrvcache.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * From: @(#)nfsrvcache.h 7.3 (Berkeley) 6/28/90 - * $Id$ + * $Id: nfsrvcache.h,v 1.2 1993/09/09 22:06:26 rgrimes Exp $ */ #ifndef __h_nfsrvcache @@ -95,5 +95,12 @@ struct nfsrvcache { /* Delay time after completion that request is dropped */ #define RC_DELAY 2 /* seconds */ +#ifdef KERNEL +extern void nfsrv_initcache(void); +extern int nfsrv_getcache(struct mbuf *, u_long, int, struct mbuf **); +extern void nfsrv_updatecache(struct mbuf *, u_long, int, int, int, + struct mbuf *); + +#endif /* KERNEL */ #endif /* __h_nfsrvcache */ diff --git a/sys/pcfs/denode.h b/sys/pcfs/denode.h index cee62d9359..5fef922937 100644 --- a/sys/pcfs/denode.h +++ b/sys/pcfs/denode.h @@ -15,7 +15,7 @@ * * October 1992 * - * $Id: denode.h,v 1.4 1993/11/17 23:26:16 wollman Exp $ + * $Id: denode.h,v 1.5 1993/11/25 01:37:04 wollman Exp $ */ #ifndef _PCFS_DENODE_H_ @@ -161,7 +161,9 @@ struct denode { #define DETOV(de) ((de)->de_vnode) #define DELOCK(de) delock(de) +extern void delock(struct denode *); #define DEUNLOCK(de) deunlock(de) +extern void deunlock(struct denode *); #define DEUPDAT(dep, t, waitfor) \ if (dep->de_flag & DEUPD) \ @@ -248,5 +250,34 @@ int pcfs_advlock __P((struct vnode *vp, caddr_t id, int op, struct flock *fl, */ int deget __P((struct pcfsmount *pmp, u_long dirclust, u_long diroffset, struct direntry *direntptr, struct denode **depp)); + +extern int pcbmap(struct denode *, u_long, daddr_t *, u_long *); +extern void fc_purge(struct denode *, u_int); +extern void updateotherfats(struct pcfsmount *, struct buf *, u_long); +extern int clusterfree(struct pcfsmount *, u_long, u_long *); +extern int fatentry(int, struct pcfsmount *, u_long, u_long *, u_long); +extern int clusteralloc(struct pcfsmount *, u_long *, u_long); +extern int freeclusterchain(struct pcfsmount *, u_long); +extern int fillinusemap(struct pcfsmount *); +extern int extendfile(struct denode *, struct buf **, u_int *); +extern int readep(struct pcfsmount *, u_long, u_long, struct buf **, + struct direntry **); +extern int readde(struct denode *, struct buf **, struct direntry **); +extern int doscheckpath(struct denode *, struct denode *); +extern int dosdirempty(struct denode *); +extern int removede(struct nameidata *); +extern int markdeleted(struct pcfsmount *, u_long, u_long); +extern int createde(struct denode *, struct nameidata *, struct denode **); +extern int pcfs_lookup(struct vnode *, struct nameidata *, struct proc *); + +extern void pcfs_init(void); +extern void deput(struct denode *); +extern int deupdat(struct denode *, struct timeval *, int); +extern int detrunc(struct denode *, u_long, int); +extern void reinsert(struct denode *); +extern int pcfs_reclaim(struct vnode *); +extern int pcfs_inactive(struct vnode *, struct proc *); + + #endif /* defined(KERNEL) */ #endif /* _PCFS_DENODE_H_ */ diff --git a/sys/pcfs/pcfs_conv.c b/sys/pcfs/pcfs_conv.c index 8cf15e8338..379f84fd47 100644 --- a/sys/pcfs/pcfs_conv.c +++ b/sys/pcfs/pcfs_conv.c @@ -15,13 +15,14 @@ * * October 1992 * - * $Id: pcfs_conv.c,v 1.2 1993/10/16 19:29:31 rgrimes Exp $ + * $Id: pcfs_conv.c,v 1.3 1993/11/25 01:37:08 wollman Exp $ */ /* * System include files. */ #include "param.h" +#include "systm.h" #include "time.h" #include "kernel.h" /* defines tz */ diff --git a/sys/pcfs/pcfs_denode.c b/sys/pcfs/pcfs_denode.c index 9d799e56a6..937106f2d7 100644 --- a/sys/pcfs/pcfs_denode.c +++ b/sys/pcfs/pcfs_denode.c @@ -15,7 +15,7 @@ * * October 1992 * - * $Id: pcfs_denode.c,v 1.3 1993/11/07 21:48:09 wollman Exp $ + * $Id: pcfs_denode.c,v 1.4 1993/11/25 01:37:09 wollman Exp $ */ #include "param.h" @@ -588,7 +588,7 @@ printf("pcfs_inactive(): v_usecount %d, de_Name[0] %x\n", vp->v_usecount, return error; } -int +void delock(dep) struct denode *dep; { @@ -602,11 +602,9 @@ delock(dep) dep->de_spare1 = 0; dep->de_spare0 = curproc->p_pid; dep->de_flag |= DELOCKED; - - return 0; } -int +void deunlock(dep) struct denode *dep; { @@ -618,6 +616,4 @@ deunlock(dep) dep->de_flag &= ~DEWANT; wakeup((caddr_t)dep); } - - return 0; } diff --git a/sys/pcfs/pcfs_lookup.c b/sys/pcfs/pcfs_lookup.c index 72d2625690..39eac92ea2 100644 --- a/sys/pcfs/pcfs_lookup.c +++ b/sys/pcfs/pcfs_lookup.c @@ -15,7 +15,7 @@ * * October 1992 * - * $Id: pcfs_lookup.c,v 1.5 1993/11/17 23:26:17 wollman Exp $ + * $Id: pcfs_lookup.c,v 1.6 1993/11/25 01:37:12 wollman Exp $ */ #include "param.h" @@ -427,7 +427,8 @@ createde(dep, ndp, depp) { int bn; int error; - u_long dirclust, diroffset; + u_int dirclust; + u_long diroffset; struct direntry *ndep; struct denode *ddep = VTODE(ndp->ni_dvp); /* directory to add to */ struct pcfsmount *pmp = dep->de_pmp; diff --git a/sys/pcfs/pcfs_vnops.c b/sys/pcfs/pcfs_vnops.c index 7cd5934a68..21a8487ab3 100644 --- a/sys/pcfs/pcfs_vnops.c +++ b/sys/pcfs/pcfs_vnops.c @@ -15,7 +15,7 @@ * * October 1992 * - * $Id: pcfs_vnops.c,v 1.2 1993/10/16 19:29:39 rgrimes Exp $ + * $Id: pcfs_vnops.c,v 1.3 1993/11/25 01:37:14 wollman Exp $ */ #include "param.h" @@ -314,7 +314,7 @@ printf(" va_uid %x, va_gid %x, va_atime.tv_sec %x\n", if (cred->cr_uid == 0) dep->de_flag = vap->va_flags; else { - dep->de_flag &= 0xffff0000; + dep->de_flag &= 0xffff0000UL; dep->de_flag |= (vap->va_flags & 0xffff); } dep->de_flag |= DEUPD; @@ -719,7 +719,8 @@ printf("seek: newoff %d > foff %d\n", newoff, foff); dep->de_FileSize += pmp->pm_bpcluster; } /* end while() */ dep->de_FileSize = newoff; - return deupdat(dep, &time); + return deupdat(dep, &time, + pmp->pm_mountp->mnt_flag & MNT_SYNCHRONOUS); } return 0; } @@ -895,7 +896,7 @@ printf("pcfs_rename(fndp %08x, tndp %08x, p %08x\n", fndp, tndp, p); tdep = NULL; } /* doscheckpath() deput()'s tddep */ - error = doscheckpath(fdep, tddep, tndp->ni_cred); + error = doscheckpath(fdep, tddep); tddep = NULL; if (error) { goto bad; diff --git a/sys/procfs/procfs_subr.c b/sys/procfs/procfs_subr.c index 5a8af99e12..9a25efeaf6 100644 --- a/sys/procfs/procfs_subr.c +++ b/sys/procfs/procfs_subr.c @@ -27,7 +27,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. * - * $Id: procfs_subr.c,v 1.3 1993/08/24 16:47:24 pk Exp $ + * $Id: procfs_subr.c,v 1.1 1993/12/12 12:26:40 davidg Exp $ */ #include "param.h" #include "systm.h" @@ -42,6 +42,7 @@ #include "vm/vm.h" #include "vm/vm_page.h" #include "vm/vm_kern.h" +#include "vm/vm_user.h" #include "kinfo.h" #include "kinfo_proc.h" #include "machine/pmap.h" @@ -366,7 +367,7 @@ pfs_doio(vp, uio, ioflag, cred) } } - error = uiomove(kbuf + on, (int)n, uio); + error = uiomove((caddr_t)(kbuf + on), (int)n, uio); if( !error && uio->uio_rw == UIO_WRITE) { /* Now just fault the page table and the page */ diff --git a/sys/procfs/procfs_vnops.c b/sys/procfs/procfs_vnops.c index 8834a51d27..9f58acc221 100644 --- a/sys/procfs/procfs_vnops.c +++ b/sys/procfs/procfs_vnops.c @@ -27,7 +27,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. * - * $Id: procfs_vnops.c,v 1.7 1993/09/16 22:08:30 cgd Exp $ + * $Id: procfs_vnops.c,v 1.1 1993/12/12 12:26:41 davidg Exp $ */ /* @@ -49,7 +49,7 @@ #include "kinfo.h" #include "kinfo_proc.h" -#include "procfs.h" +#include "sys/procfs.h" #include "pfsnode.h" #include "machine/vmparam.h" @@ -452,7 +452,7 @@ pfs_setattr (vp, vap, cred, p) if (cred->cr_uid == 0) { pfsp->pfs_vflags = vap->va_flags; } else { - pfsp->pfs_vflags &= 0xffff0000; + pfsp->pfs_vflags &= 0xffff0000ul; pfsp->pfs_vflags |= (vap->va_flags & 0xffff); } } diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 46e9e3ba21..2fe220a1b5 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * - * $Id: cd.c,v 1.12 1993/11/18 05:02:46 rgrimes Exp $ + * $Id: cd.c,v 1.13 1993/11/25 01:37:28 wollman Exp $ */ #define SPLCD splbio @@ -40,11 +40,18 @@ #include /* rw_big and start_stop come from there */ #include +/* static function prototypes */ +static errval cd_get_parms(int, int); +static errval cd_get_mode(u_int32, struct cd_mode_data *, u_int32); +static errval cd_set_mode(u_int32 unit, struct cd_mode_data *); +static errval cd_read_toc(u_int32, u_int32, u_int32, struct cd_toc_entry *, + u_int32); + + int32 cdstrats, cdqueues; #include #if NDDB > 0 -int Debugger(); #else /* NDDB > 0 */ #define Debugger() #endif /* NDDB > 0 */ @@ -59,7 +66,6 @@ int Debugger(); #define RAW_PART 3 #define UNIT(z) ( (minor(z) >> UNITSHIFT) ) -extern int hz; errval cdstrategy(); void cdstart(); @@ -509,7 +515,7 @@ cdstart(unit) */ bzero(&cmd, sizeof(cmd)); cmd.op_code = READ_BIG; - cmd.addr_3 = (blkno & 0xff000000) >> 24; + cmd.addr_3 = (blkno & 0xff000000UL) >> 24; cmd.addr_2 = (blkno & 0xff0000) >> 16; cmd.addr_1 = (blkno & 0xff00) >> 8; cmd.addr_0 = blkno & 0xff; @@ -680,12 +686,14 @@ cdioctl(dev_t dev, int cmd, caddr_t addr, int flag) } break; case CDIOREADTOCHEADER: - { + { /* ??? useless bcopy? XXX */ struct ioc_toc_header th; - if (error = cd_read_toc(unit, 0, 0, &th, sizeof(th))) + if (error = cd_read_toc(unit, 0, 0, + (struct cd_toc_entry *)&th, + sizeof th)) break; th.len = (th.len & 0xff) << 8 + ((th.len >> 8) & 0xff); - bcopy(&th, addr, sizeof(th)); + bcopy(&th, addr, sizeof th); } break; case CDIOREADTOCENTRYS: @@ -971,7 +979,7 @@ cd_size(unit, flags) /* * Get the requested page into the buffer given */ -errval +static errval cd_get_mode(unit, data, page) u_int32 unit; struct cd_mode_data *data; @@ -1218,10 +1226,11 @@ cd_read_subchannel(unit, mode, format, track, data, len) /* * Read table of contents */ -errval +static errval cd_read_toc(unit, mode, start, data, len) - u_int32 unit, mode, start, len; + u_int32 unit, mode, start; struct cd_toc_entry *data; + u_int32 len; { struct scsi_read_toc scsi_cmd; errval error; @@ -1256,7 +1265,7 @@ cd_read_toc(unit, mode, start, data, len) * Get the scsi driver to send a full inquiry to the device and use the * results to fill out the disk parameter structure. */ -errval +static errval cd_get_parms(unit, flags) int unit; int flags; diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c index fd7b1eb55a..ceec9d26d6 100644 --- a/sys/scsi/ch.c +++ b/sys/scsi/ch.c @@ -2,7 +2,7 @@ * Written by grefen@????? * Based on scsi drivers by Julian Elischer (julian@tfs.com) * - * $Id: ch.c,v 1.5 1993/11/18 05:02:48 rgrimes Exp $ + * $Id: ch.c,v 1.6 1993/11/25 01:37:31 wollman Exp $ */ #include @@ -22,6 +22,8 @@ #include #include +static errval ch_mode_sense(u_int32, u_int32); + struct scsi_xfer ch_scsi_xfer[NCH]; u_int32 ch_xfer_block_wait[NCH]; @@ -233,7 +235,7 @@ chioctl(dev, cmd, arg, mode) unit = UNIT(dev); sc_link = ch_data[unit].sc_link; - switch (cmd) { + switch ((int)cmd) { case CHIOOP:{ struct chop *ch = (struct chop *) arg; SC_DEBUG(sc_link, SDEV_DB2, @@ -384,7 +386,7 @@ ch_position(unit, stat, chm, to, flags) * device and use the results to fill out the global * parameter structure. */ -errval +static errval ch_mode_sense(unit, flags) u_int32 unit, flags; { @@ -449,7 +451,7 @@ ch_mode_sense(unit, flags) u_int32 pc = (*b++) & 0x3f; u_int32 pl = *b++; u_char *bb = b; - switch (pc) { + switch ((int)pc) { case 0x1d: ch_data[unit].chmo = p2copy(bb); ch_data[unit].chms = p2copy(bb); diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index da9c2b4d94..2b4e9e938b 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -8,13 +8,13 @@ * file. * * Written by Julian Elischer (julian@dialix.oz.au) - * $Id: scsi_base.c,v 1.1 1993/11/18 05:02:51 rgrimes Exp $ + * $Id: scsi_base.c,v 1.2 1993/11/25 06:30:58 davidg Exp $ */ #define SPLSD splbio #define ESUCCESS 0 -#include #include +#include "systm.h" #include #include #include @@ -23,6 +23,9 @@ #include #include +static errval sc_err1(struct scsi_xfer *); +static errval scsi_interpret_sense(struct scsi_xfer *); + #ifdef NetBSD #ifdef DDB int Debugger(); @@ -30,9 +33,8 @@ int Debugger(); #define Debugger() #endif /* DDB */ #else /* NetBSD */ -#include +#include "ddb.h" #if NDDB > 0 -int Debugger(); #else /* NDDB > 0 */ #define Debugger() #endif /* NDDB > 0 */ @@ -70,7 +72,7 @@ get_xs(sc_link, flags) return 0; } sc_link->flags |= SDEV_WAITING; - sleep(sc_link, PRIBIO); + tsleep((caddr_t)sc_link, PRIBIO, "scsiget", 0); } sc_link->opennings--; if (xs = next_free_xs) { @@ -110,7 +112,7 @@ free_xs(xs, sc_link, flags) /* if was 0 and someone waits, wake them up */ if ((!sc_link->opennings++) && (sc_link->flags & SDEV_WAITING)) { sc_link->flags &= ~SDEV_WAITING; - wakeup(sc_link); /* remember, it wakes them ALL up */ + wakeup((caddr_t)sc_link); /* remember, it wakes them ALL up */ } else { if (sc_link->device->start) { SC_DEBUG(sc_link, SDEV_DB2, ("calling private start()\n")); @@ -347,7 +349,7 @@ scsi_done(xs) * the upper level code to handle error checking * rather than doing it here at interrupt time */ - wakeup(xs); + wakeup((caddr_t)xs); return; } /* @@ -409,7 +411,7 @@ scsi_scsi_cmd(sc_link, scsi_cmd, cmdlen, data_addr, datalen, xs->resid = datalen; xs->bp = bp; /*XXX*/ /*use constant not magic number */ - if (datalen && ((caddr_t) data_addr < (caddr_t) 0xfe000000)) { + if (datalen && ((caddr_t) data_addr < (caddr_t) 0xfe000000UL)) { if (bp) { printf("Data buffered space not in kernel context\n"); #ifdef SCSIDEBUG @@ -420,7 +422,7 @@ scsi_scsi_cmd(sc_link, scsi_cmd, cmdlen, data_addr, datalen, } xs->data = malloc(datalen, M_TEMP, M_WAITOK); /* I think waiting is ok *//*XXX */ - switch (flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) { + switch ((int)(flags & (SCSI_DATA_IN | SCSI_DATA_OUT))) { case 0: printf("No direction flags, assuming both\n"); #ifdef SCSIDEBUG @@ -466,8 +468,9 @@ retry: if (bp) return retval; /* will sleep (or not) elsewhere */ s = splbio(); - while (!(xs->flags & ITSDONE)) - sleep(xs, PRIBIO + 1); + while (!(xs->flags & ITSDONE)) { + tsleep((caddr_t)xs, PRIBIO + 1, "scsicmd", 0); + } splx(s); /* fall through to check success of completed command */ case COMPLETE: /* Polling command completed ok */ @@ -493,7 +496,7 @@ retry: * and free the memory buffer */ if (datalen && (xs->data != data_addr)) { - switch (flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) { + switch ((int)(flags & (SCSI_DATA_IN | SCSI_DATA_OUT))) { case 0: case SCSI_DATA_IN | SCSI_DATA_OUT: /* weird */ case SCSI_DATA_IN: @@ -516,7 +519,7 @@ bad: return (retval); } -errval +static errval sc_err1(xs) struct scsi_xfer *xs; { @@ -531,7 +534,7 @@ sc_err1(xs) * errors at inetrrupt time. We have probably * been called by scsi_done() */ - switch (xs->error) { + switch ((int)xs->error) { case XS_NOERROR: /* nearly always hit this one */ retval = ESUCCESS; if (bp) { @@ -560,6 +563,8 @@ sc_err1(xs) case XS_BUSY: /*should somehow arange for a 1 sec delay here (how?) */ + /* XXX tsleep(&localvar, priority, "foo", hz); + that's how! */ case XS_TIMEOUT: /* * If we can, resubmit it to the adapter. @@ -593,7 +598,7 @@ retry: * * THIS IS THE DEFAULT ERROR HANDLER */ -errval +static errval scsi_interpret_sense(xs) struct scsi_xfer *xs; { @@ -680,7 +685,7 @@ scsi_interpret_sense(xs) sc_print_addr(sc_link); printf("%s", error_mes[key - 1]); if (sense->error_code & SSD_ERRCODE_VALID) { - switch (key) { + switch ((int)key) { case 0x2: /* NOT READY */ case 0x5: /* ILLEGAL REQUEST */ case 0x6: /* UNIT ATTENTION */ @@ -696,7 +701,7 @@ scsi_interpret_sense(xs) } printf("\n"); } - switch (key) { + switch ((int)key) { case 0x0: /* NO SENSE */ case 0x1: /* RECOVERED ERROR */ if (xs->resid == xs->datalen) diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c index 0e50b49a22..01bacf1fc6 100644 --- a/sys/scsi/scsi_ioctl.c +++ b/sys/scsi/scsi_ioctl.c @@ -6,9 +6,9 @@ * * */ -#include -#include #include +#include "systm.h" +#include #include #include #define b_screq b_driver1 /* a patch in buf.h */ @@ -57,7 +57,7 @@ struct scsi_xfer *xs; SC_DEBUG(xs->sc_link,SDEV_DB2,("user-done\n")); screq->retsts = 0; screq->status = xs->status; - switch(xs->error) { + switch((int)xs->error) { case XS_NOERROR: SC_DEBUG(xs->sc_link,SDEV_DB3,("no error\n")); screq->datalen_used = xs->datalen - xs->resid; /* probably rubbish */ @@ -238,7 +238,7 @@ errval scsi_do_ioctl(struct scsi_link *sc_link, int cmd, caddr_t addr, int f) caddr_t d_addr; int len; - if((unsigned int)screq < (unsigned int)0xfe000000) + if((unsigned int)screq < (unsigned int)0xfe000000UL) { screq = malloc(sizeof(scsireq_t),M_TEMP,M_WAITOK); bcopy(screq2,screq,sizeof(scsireq_t)); @@ -269,7 +269,7 @@ errval scsi_do_ioctl(struct scsi_link *sc_link, int cmd, caddr_t addr, int f) ret = bp->b_error; } free(bp,M_TEMP); - if((unsigned int)screq2 < (unsigned int)0xfe000000) + if((unsigned int)screq2 < (unsigned int)0xfe000000UL) { bcopy(screq,screq2,sizeof(scsireq_t)); free(screq,M_TEMP); diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index 708cc7cc17..9e2dfef7cd 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * - * $Id: scsiconf.c,v 2.6 93/10/24 12:43:51 julian Exp Locker: julian $ + * $Id: scsiconf.c,v 1.7 1993/11/18 05:02:58 rgrimes Exp $ */ #include @@ -485,7 +485,7 @@ scsi_probedev(sc_link, maybe_more) * is vendor specific and won't match in this switch. */ - switch (qualifier) { + switch ((int)qualifier) { case SID_QUAL_LU_OK: qtype = ""; break; @@ -517,7 +517,7 @@ scsi_probedev(sc_link, maybe_more) break; } if (dtype == 0) { - switch (type) { + switch ((int)type) { case T_DIRECT: dtype = "direct"; break; diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index 856fe89950..018d019516 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * - * $Id: scsiconf.h,v 2.4 93/10/16 00:59:13 julian Exp Locker: julian $ + * $Id: scsiconf.h,v 1.7 1993/11/18 05:02:59 rgrimes Exp $ */ #ifndef SCSI_SCSICONF_H #define SCSI_SCSICONF_H 1 @@ -242,5 +242,7 @@ void show_mem(unsigned char * , u_int32); void lto3b __P((int val, u_char *bytes)); int _3btol __P((u_char *bytes)); +extern void sc_print_addr(struct scsi_link *); + #endif /*SCSI_SCSICONF_H*/ /* END OF FILE */ diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 660d194efd..b54363196c 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992 * - * $Id: sd.c,v 1.12 1993/11/18 05:03:02 rgrimes Exp $ + * $Id: sd.c,v 1.13 1993/11/25 01:37:34 wollman Exp $ */ #define SPLSD splbio @@ -48,9 +48,8 @@ int Debugger(); #else /* NetBSD */ #include #if NDDB > 0 -int Debugger(); #else /* NDDB > 0 */ -#define Debugger() +#define Debugger(s) #endif /* NDDB > 0 */ #endif @@ -271,7 +270,7 @@ sdopen(dev) if (sd->params.secsiz != SECSIZE) { /* XXX One day... */ printf("sd%d: Can't deal with %d bytes logical blocks\n", unit, sd->params.secsiz); - Debugger(); + Debugger("sd"); errcode = ENXIO; goto bad; } @@ -516,7 +515,7 @@ sdstart(unit) bzero(&cmd, sizeof(cmd)); cmd.op_code = (bp->b_flags & B_READ) ? READ_BIG : WRITE_BIG; - cmd.addr_3 = (blkno & 0xff000000) >> 24; + cmd.addr_3 = (blkno & 0xff000000UL) >> 24; cmd.addr_2 = (blkno & 0xff0000) >> 16; cmd.addr_1 = (blkno & 0xff00) >> 8; cmd.addr_0 = blkno & 0xff; diff --git a/sys/scsi/st.c b/sys/scsi/st.c index 08c8d4679d..686337a23c 100644 --- a/sys/scsi/st.c +++ b/sys/scsi/st.c @@ -21,13 +21,13 @@ * 16 Feb 93 Julian Elischer ADDED for SCSI system * 1.15 is the last version to support MACH and OSF/1 */ -/* $Revision: 2.6 $ */ +/* $Revision: 1.13 $ */ /* * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * major changes by Julian Elischer (julian@jules.dialix.oz.au) May 1993 * - * $Id: st.c,v 2.6 93/10/21 03:24:38 julian Exp Locker: julian $ + * $Id: st.c,v 1.13 1993/11/18 05:03:05 rgrimes Exp $ */ /* @@ -736,7 +736,7 @@ st_decide_mode(unit, first_read) * * Our first shot at a method is, "The quirks made me do it!" */ - switch (st->quirks & (ST_Q_FORCE_FIXED_MODE | ST_Q_FORCE_VAR_MODE)) { + switch ((int)(st->quirks & (ST_Q_FORCE_FIXED_MODE | ST_Q_FORCE_VAR_MODE))) { case (ST_Q_FORCE_FIXED_MODE | ST_Q_FORCE_VAR_MODE): printf("st%d: bad quirks\n", unit); return (EINVAL); @@ -772,7 +772,7 @@ st_decide_mode(unit, first_read) * If the tape density mandates (or even suggests) use of fixed * or variable-length blocks, comply. */ - switch (st->density) { + switch ((int)st->density) { case HALFINCH_800: case HALFINCH_1600: case HALFINCH_6250: @@ -833,7 +833,7 @@ done: * first read. * (I think this should be a by-product of fixed/variable..julian) */ - switch (st->density) { + switch ((int)st->density) { /* case 8 mm: What is the SCSI density code for 8 mm, anyway? */ case QIC_11: case QIC_24: @@ -1517,7 +1517,7 @@ st_space(unit, number, what, flags) struct scsi_space scsi_cmd; struct st_data *st = st_data[unit]; - switch (what) { + switch ((int)what) { case SP_BLKS: if (st->flags & ST_PER_ACTION) { if (number > 0) { @@ -1597,7 +1597,7 @@ st_write_filemarks(unit, number, flags) if (number < 0) { return EINVAL; } - switch (number) { + switch ((int)number) { case 0: /* really a command to sync the drive's buffers */ break; case 1: @@ -1643,7 +1643,7 @@ st_chkeod(unit, position, nmarks, flags) errval error; struct st_data *st = st_data[unit]; - switch (st->flags & (ST_WRITTEN | ST_FM_WRITTEN | ST_2FM_AT_EOD)) { + switch ((int)(st->flags & (ST_WRITTEN | ST_FM_WRITTEN | ST_2FM_AT_EOD))) { default: *nmarks = 0; return (ESUCCESS); @@ -1904,7 +1904,7 @@ st_touch_tape(unit) } st->blksiz = 1024; do { - switch (st->blksiz) { + switch ((int)st->blksiz) { case 512: case 1024: readsiz = st->blksiz; diff --git a/sys/scsi/uk.c b/sys/scsi/uk.c index b503593b11..149e2dfd4d 100644 --- a/sys/scsi/uk.c +++ b/sys/scsi/uk.c @@ -2,12 +2,11 @@ * Dummy driver for a device we can't identify. * by Julian Elischer (julian@tfs.com) * - * $Id: uk.c,v 1.1 1993/11/18 05:03:13 rgrimes Exp $ + * $Id: uk.c,v 1.2 1993/11/25 01:37:35 wollman Exp $ */ - -#include #include +#include "systm.h" #include #include #include diff --git a/sys/sys/buf.h b/sys/sys/buf.h index 1c2b16a36a..2c9f2a4ee6 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)buf.h 7.11 (Berkeley) 5/9/90 - * $Id: buf.h,v 1.4 1993/11/18 05:03:22 rgrimes Exp $ + * $Id: buf.h,v 1.5 1993/11/25 01:37:50 wollman Exp $ */ #ifndef _SYS_BUF_H_ @@ -162,6 +162,8 @@ extern void bgetvp(struct vnode *, struct buf *); extern void brelvp(struct buf *); extern void reassignbuf(struct buf *, struct vnode *); extern void bufstats(void); +extern int physio(void (*)(struct buf *), int, struct buf *, int, int, + caddr_t, int *, struct proc *); #endif /* KERNEL */ diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h index cda79412ba..1592f9d18a 100644 --- a/sys/sys/disklabel.h +++ b/sys/sys/disklabel.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)disklabel.h 7.19 (Berkeley) 5/7/91 - * $Id: disklabel.h,v 1.4 1993/11/25 01:37:56 wollman Exp $ + * $Id: disklabel.h,v 1.5 1993/11/28 14:23:10 ats Exp $ */ #ifndef _SYS_DISKLABEL_H_ @@ -71,7 +71,7 @@ #define LABELOFFSET 64 /* offset of label in sector */ #endif -#define DISKMAGIC ((u_long) 0x82564557) /* The disk magic number */ +#define DISKMAGIC (0x82564557UL) /* The disk magic number */ #ifndef MAXPARTITIONS #define MAXPARTITIONS 8 #endif diff --git a/sys/sys/file.h b/sys/sys/file.h index 8d395ba3d1..7f8de7c6c1 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)file.h 7.10 (Berkeley) 6/4/91 - * $Id: file.h,v 1.2 1993/10/16 17:16:47 rgrimes Exp $ + * $Id: file.h,v 1.3 1993/11/07 17:52:35 wollman Exp $ */ #ifndef _SYS_FILE_H_ @@ -74,5 +74,9 @@ extern struct file *filehead; /* head of list of open files */ extern int maxfiles; /* kernel limit on number of open files */ extern int nfiles; /* actual number of open files */ +extern void ffree(struct file *); +extern int closef(struct file *, struct proc *); +extern int falloc(struct proc *, struct file **, int *); + #endif /* KERNEL */ #endif /* _SYS_FILE_H_ */ diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index 817f7c5b63..0848593015 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)filedesc.h 7.4 (Berkeley) 5/4/91 - * $Id: filedesc.h,v 1.2 1993/10/16 17:16:48 rgrimes Exp $ + * $Id: filedesc.h,v 1.3 1993/11/07 17:52:37 wollman Exp $ */ #ifndef _SYS_FILEDESC_H_ @@ -97,8 +97,8 @@ struct filedesc0 { */ int fdalloc __P((struct proc *p, int want, int *result)); int fdavail __P((struct proc *p, int n)); -int falloc __P((struct proc *p, struct file **resultfp, int *resultfd)); struct filedesc *fdcopy __P((struct proc *p)); void fdfree __P((struct proc *p)); -#endif + +#endif /* KERNEL */ #endif /* _SYS_FILEDESC_H_ */ diff --git a/sys/sys/ioctl.h b/sys/sys/ioctl.h index eb499785e8..5737e04203 100644 --- a/sys/sys/ioctl.h +++ b/sys/sys/ioctl.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)ioctl.h 7.19 (Berkeley) 6/26/91 - * $Id: ioctl.h,v 1.4 1993/10/12 04:57:33 rgrimes Exp $ + * $Id: ioctl.h,v 1.5 1993/11/14 23:29:49 ache Exp $ */ #ifndef _IOCTL_H_ @@ -71,11 +71,11 @@ struct ttysize { #define IOCGROUP(x) (((x) >> 8) & 0xff) #define IOCPARM_MAX NBPG /* max size of ioctl, mult. of NBPG */ -#define IOC_VOID 0x20000000 /* no parameters */ -#define IOC_OUT 0x40000000 /* copy out parameters */ -#define IOC_IN 0x80000000 /* copy in parameters */ +#define IOC_VOID 0x20000000UL /* no parameters */ +#define IOC_OUT 0x40000000UL /* copy out parameters */ +#define IOC_IN 0x80000000UL /* copy in parameters */ #define IOC_INOUT (IOC_IN|IOC_OUT) -#define IOC_DIRMASK 0xe0000000 /* mask for IN/OUT/VOID */ +#define IOC_DIRMASK 0xe0000000UL /* mask for IN/OUT/VOID */ #define _IOC(inout,group,num,len) \ (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) diff --git a/sys/sys/ioctl_compat.h b/sys/sys/ioctl_compat.h index 4a006ca924..a743eab96a 100644 --- a/sys/sys/ioctl_compat.h +++ b/sys/sys/ioctl_compat.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)ioctl_compat.h 7.4 (Berkeley) 2/5/91 - * $Id$ + * $Id: ioctl_compat.h,v 1.2 1993/10/16 17:16:53 rgrimes Exp $ */ #ifndef _IOCTL_COMPAT_H_ @@ -95,7 +95,7 @@ struct sgttyb { #define TANDEM 0x00000001 /* send stopc on out q full */ #define CBREAK 0x00000002 /* half-cooked mode */ #define LCASE 0x00000004 /* simulate lower case */ -#define ECHO 0x00000008 /* echo input */ +#define ECHO 0x00000008UL /* echo input */ #define CRMOD 0x00000010 /* map \r to \r\n on output */ #define RAW 0x00000020 /* no i/o processing */ #define ODDP 0x00000040 /* get/send odd parity */ @@ -127,18 +127,18 @@ struct sgttyb { #define PRTERA 0x00020000 /* \ ... / erase */ #define CRTERA 0x00040000 /* " \b " to wipe out char */ #define TILDE 0x00080000 /* hazeltine tilde kludge */ -#define MDMBUF 0x00100000 /*start/stop output on carrier*/ +#define MDMBUF 0x00100000UL /*start/stop output on carrier*/ #define LITOUT 0x00200000 /* literal output */ -#define TOSTOP 0x00400000 /*SIGSTOP on background output*/ -#define FLUSHO 0x00800000 /* flush output to terminal */ +#define TOSTOP 0x00400000UL /*SIGSTOP on background output*/ +#define FLUSHO 0x00800000UL /* flush output to terminal */ #define NOHANG 0x01000000 /* (no-op) was no SIGHUP on carrier drop */ #define L001000 0x02000000 #define CRTKIL 0x04000000 /* kill line with " \b " */ #define PASS8 0x08000000 #define CTLECH 0x10000000 /* echo control chars as ^X */ -#define PENDIN 0x20000000 /* tp->t_rawq needs reread */ +#define PENDIN 0x20000000UL /* tp->t_rawq needs reread */ #define DECCTQ 0x40000000 /* only ^Q starts after ^S */ -#define NOFLSH 0x80000000 /* no output flush on signal */ +#define NOFLSH 0x80000000UL /* no output flush on signal */ #define TIOCLBIS _IOW('t', 127, int) /* bis local mode bits */ #define TIOCLBIC _IOW('t', 126, int) /* bic local mode bits */ #define TIOCLSET _IOW('t', 125, int) /* set entire local mode word */ diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h index 598b7899ec..570c3871ba 100644 --- a/sys/sys/kernel.h +++ b/sys/sys/kernel.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)kernel.h 7.4 (Berkeley) 2/15/91 - * $Id: kernel.h,v 1.4 1993/11/07 17:52:39 wollman Exp $ + * $Id: kernel.h,v 1.5 1993/11/25 01:37:57 wollman Exp $ */ #ifndef _SYS_KERNEL_H_ @@ -68,4 +68,33 @@ extern int profiling; extern u_short *kcount; extern char *s_lowpc; #endif + +extern const char *panicstr; /* panic message */ +extern char version[]; /* system version */ +extern char copyright[]; /* system copyright */ + +extern int nblkdev; /* number of entries in bdevsw */ +extern int nchrdev; /* number of entries in cdevsw */ +extern int nswdev; /* number of swap devices */ +extern int nswap; /* size of swap space */ + +extern int maxmem; /* max memory per process */ +extern int physmem; /* physical memory */ + +extern dev_t dumpdev; /* dump device */ +extern long dumplo; /* offset into dumpdev */ + +extern dev_t rootdev; /* root device */ +extern struct vnode *rootvp; /* vnode equivalent to above */ + +extern dev_t swapdev; /* swapping device */ +extern struct vnode *swapdev_vp;/* vnode equivalent to above */ + +extern int boothowto; /* reboot flags, from console subsystem */ +#ifdef KADB +extern char *bootesym; /* end of symbol info from boot */ +#endif + +extern u_char curpri; /* priority of current process */ + #endif /* _SYS_KERNEL_H_ */ diff --git a/sys/sys/ktrace.h b/sys/sys/ktrace.h index bcfc7768ca..f4576d0f58 100644 --- a/sys/sys/ktrace.h +++ b/sys/sys/ktrace.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)ktrace.h 7.4 (Berkeley) 5/7/91 - * $Id: ktrace.h,v 1.2 1993/10/16 17:17:01 rgrimes Exp $ + * $Id: ktrace.h,v 1.3 1993/11/07 17:52:42 wollman Exp $ */ #ifndef _SYS_KTRACE_H_ @@ -40,14 +40,14 @@ /* * operations to ktrace system call (KTROP(op)) */ -#define KTROP_SET 0 /* set trace points */ -#define KTROP_CLEAR 1 /* clear trace points */ -#define KTROP_CLEARFILE 2 /* stop all tracing to file */ +#define KTROP_SET 0UL /* set trace points */ +#define KTROP_CLEAR 1UL /* clear trace points */ +#define KTROP_CLEARFILE 2UL /* stop all tracing to file */ #define KTROP(o) ((o)&3) /* macro to extract operation */ /* * flags (ORed in with operation) */ -#define KTRFLAG_DESCEND 4 /* perform op on all children too */ +#define KTRFLAG_DESCEND 4UL /* perform op on all children too */ /* * ktrace record header @@ -125,20 +125,31 @@ struct ktr_psig { /* * kernel trace points (in p_traceflag) */ -#define KTRFAC_MASK 0x00ffffff -#define KTRFAC_SYSCALL (1< __BEGIN_DECLS diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index fd8d1e448a..b0089296fe 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)mbuf.h 7.14 (Berkeley) 12/5/90 - * $Id: mbuf.h,v 1.4 1993/11/17 20:24:25 wollman Exp $ + * $Id: mbuf.h,v 1.5 1993/11/25 01:37:58 wollman Exp $ */ #ifndef _SYS_MBUF_H_ @@ -346,8 +346,6 @@ struct mbstat { }; #ifdef KERNEL -void m_copyback(struct mbuf *, int, int, caddr_t); - extern struct mbuf *mbutl; /* virtual address of mclusters */ extern char *mclrefcnt; /* cluster reference counts */ extern struct mbstat mbstat; @@ -357,10 +355,29 @@ extern int max_linkhdr; /* largest link-level header */ extern int max_protohdr; /* largest protocol header */ extern int max_hdr; /* largest link+protocol header */ extern int max_datalen; /* MHLEN - max_hdr */ -struct mbuf *m_get(), *m_gethdr(), *m_getclr(), *m_retry(), *m_retryhdr(); -struct mbuf *m_free(), *m_copym(), *m_pullup(), *m_prepend(); -int m_clalloc(); -extern int mbtypes[]; /* XXX */ + +/* From uipc_mbuf.c: */ +extern int m_clalloc(int, int); +extern struct mbuf *m_retry(int, int); +extern struct mbuf *m_retryhdr(int, int); +extern struct mbuf *m_get(int, int); +extern struct mbuf *m_gethdr(int, int); +extern struct mbuf *m_getclr(int, int); +extern struct mbuf *m_free(struct mbuf *); +extern void m_freem(struct mbuf *); +extern struct mbuf *m_prepend(struct mbuf *, int, int); +extern struct mbuf *m_copym(struct mbuf *, int, int, int); +extern void m_copydata(struct mbuf *, int, int, caddr_t); +extern void m_cat(struct mbuf *, struct mbuf *); +extern void m_adj(struct mbuf *, int); +extern struct mbuf *m_pullup(struct mbuf *, int); +extern void m_copyback(struct mbuf *, int, int, caddr_t); +extern struct mbuf *m_split(struct mbuf *, int, int); +extern struct mbuf *m_append(struct mbuf *, struct mbuf *); +extern int m_datalen(struct mbuf *); +extern int m_compress(struct mbuf *, struct mbuf **); + +extern int mbtypes[]; /* XXX */ #ifdef MBTYPES int mbtypes[] = { /* XXX */ diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 1a277d8d34..9b7998e26c 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)proc.h 7.28 (Berkeley) 5/30/91 - * $Id: proc.h,v 1.3 1993/11/07 17:52:55 wollman Exp $ + * $Id: proc.h,v 1.4 1993/11/25 01:38:00 wollman Exp $ */ #ifndef _PROC_H_ @@ -229,7 +229,7 @@ struct pcred { extern int pidhashmask; /* in param.c */ extern struct proc *pidhash[]; /* in param.c */ extern struct pgrp *pgrphash[]; /* in param.c */ -struct proc *zombproc, *allproc; /* lists of procs in various states */ +extern struct proc *zombproc, *allproc; /* lists of procs in various states */ extern struct proc proc0; /* process slot for swapper */ extern struct proc *initproc, *pageproc; /* process slots for init, pager */ extern struct proc *curproc; /* current running proc */ @@ -239,14 +239,24 @@ extern int nprocs, maxproc; /* current and max number of procs */ struct prochd { struct proc *ph_link; /* linked list of running processes */ struct proc *ph_rlink; -} qs[NQS]; +}; +extern struct prochd qs[NQS]; extern int whichqs; /* bit mask summarizing non-empty qs's */ -extern struct pgrp *pgfind(); /* find process group by id */ -extern struct proc *pfind(); /* find process by id */ +extern struct pgrp *pgfind(pid_t); /* find process group by id */ +extern struct proc *pfind(int); /* find process by id */ void fixjobc(struct proc *, struct pgrp *, int); +void unsleep(struct proc *); +void setrun(struct proc *); +void setpri(struct proc *); + +void remrq __P((struct proc *)); +void setrq __P((struct proc *)); +void updatepri __P((struct proc *)); +int cpu_fork __P((struct proc *, struct proc *)); +void enterpgrp __P((struct proc *, int /*pid_t*/, int)); #endif /* KERNEL */ diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h index 9072a1eba5..cf4234d532 100644 --- a/sys/sys/protosw.h +++ b/sys/sys/protosw.h @@ -31,12 +31,15 @@ * SUCH DAMAGE. * * from: @(#)protosw.h 7.8 (Berkeley) 4/28/91 - * $Id: protosw.h,v 1.3 1993/11/07 17:52:56 wollman Exp $ + * $Id: protosw.h,v 1.4 1993/11/18 00:12:34 wollman Exp $ */ #ifndef _SYS_PROTOSW_H_ #define _SYS_PROTOSW_H_ 1 +struct mbuf; /* forward declarations */ +struct socket; + /* * Protocol switch table. * @@ -51,13 +54,17 @@ * * Protocols pass data between themselves as chains of mbufs using * the pr_input and pr_output hooks. Pr_input passes data up (towards - * UNIX) and pr_output passes it down (towards the imps); control + * UNIX) and pr_output passes it down (towards the interfaces); control * information passes up and down on pr_ctlinput and pr_ctloutput. * The protocol is responsible for the space occupied by any the * arguments to these entries and must dispose it. * * The userreq routine interfaces protocols to the system and is * described below. + * + * Beware that protocol families may make puns of this structure with + * pr_{ctl,}{in,out}put routines having prototypes appropriate for that + * protocol's conventions. (See, for example, netinet/in_var.h.) */ struct protosw { short pr_type; /* socket type used for */ @@ -67,15 +74,19 @@ struct protosw { /* protocol-protocol hooks */ int (*pr_input)(); /* input to protocol (from below) */ int (*pr_output)(); /* output to protocol (from above) */ - int (*pr_ctlinput)(); /* control input (from below) */ - int (*pr_ctloutput)(); /* control output (from above) */ + void (*pr_ctlinput)(); /* control input (from below) */ + int (*pr_ctloutput)(int, struct socket *, int, int, + struct mbuf **); + /* control output (from above) */ /* user-protocol hook */ - int (*pr_usrreq)(); /* user request: see list below */ + int (*pr_usrreq)(struct socket *, int, struct mbuf *, + struct mbuf *, struct mbuf *, struct mbuf *); + /* user request: see list below */ /* utility hooks */ - int (*pr_init)(); /* initialization hook */ - int (*pr_fasttimo)(); /* fast timeout (200ms) */ - int (*pr_slowtimo)(); /* slow timeout (500ms) */ - int (*pr_drain)(); /* flush any excess space possible */ + void (*pr_init)(void); /* initialization hook */ + void (*pr_fasttimo)(void); /* fast timeout (200ms) */ + void (*pr_slowtimo)(void); /* slow timeout (500ms) */ + void (*pr_drain)(void); /* flush any excess space possible */ }; #define PR_SLOWHZ 2 /* 2 slow timeouts per second */ @@ -223,6 +234,10 @@ char *prcorequests[] = { #endif #ifdef KERNEL -extern struct protosw *pffindproto(), *pffindtype(); -#endif +extern void domaininit(void); +extern struct protosw *pffindtype(int, int); +extern struct protosw *pffindproto(int, int, int); +struct sockaddr; +extern void pfctlinput(int, struct sockaddr *); +#endif /* KERNEL */ #endif /* _SYS_PROTOSW_H_ */ diff --git a/sys/sys/reboot.h b/sys/sys/reboot.h index d43f914500..2745cc0929 100644 --- a/sys/sys/reboot.h +++ b/sys/sys/reboot.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)reboot.h 7.6 (Berkeley) 6/28/90 - * $Id: reboot.h,v 1.2 1993/10/16 17:17:26 rgrimes Exp $ + * $Id: reboot.h,v 1.3 1993/11/07 17:52:58 wollman Exp $ */ #ifndef _SYS_REBOOT_H_ @@ -82,8 +82,8 @@ #define B_TYPEMASK 0xff #define B_TYPE(val) (((val) >> B_TYPESHIFT) & B_TYPEMASK) -#define B_MAGICMASK ((u_long)0xf0000000) -#define B_DEVMAGIC ((u_long)0xa0000000) +#define B_MAGICMASK (0xf0000000UL) +#define B_DEVMAGIC (0xa0000000UL) #define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \ (((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \ diff --git a/sys/sys/resource.h b/sys/sys/resource.h index 9c7fe711ae..a8935f3597 100644 --- a/sys/sys/resource.h +++ b/sys/sys/resource.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)resource.h 7.5 (Berkeley) 3/17/91 - * $Id$ + * $Id: resource.h,v 1.2 1993/10/16 17:17:28 rgrimes Exp $ */ #ifndef _RESOURCE_H_ @@ -97,7 +97,11 @@ struct rlimit { long rlim_max; /* maximum value for rlim_cur */ }; -#ifndef KERNEL +#ifdef KERNEL + +extern void ruadd(struct rusage *, struct rusage *); + +#else /* not KERNEL */ #include __BEGIN_DECLS diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h new file mode 100644 index 0000000000..09cf91ac9f --- /dev/null +++ b/sys/sys/sysent.h @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 1982, 1988, 1991 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. + * + * from: @(#)systm.h 7.17 (Berkeley) 5/25/91 + * $Id$ + */ + +#ifndef _SYS_SYSENT_H_ +#define _SYS_SYSENT_H_ 1 + +struct sysent { /* system call table */ + int sy_narg; /* number of arguments */ + int (*sy_call)(); /* implementing function */ +}; + +#ifdef KERNEL +extern struct sysent sysent[]; +#endif + +#endif /* _SYS_SYSENT_H_ */ + + diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 5ab4e8ebc7..caad844c42 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -31,97 +31,86 @@ * SUCH DAMAGE. * * from: @(#)systm.h 7.17 (Berkeley) 5/25/91 - * $Id: systm.h,v 1.7 1993/10/08 20:59:39 rgrimes Exp $ + * $Id: systm.h,v 1.8 1993/11/25 01:38:05 wollman Exp $ */ #ifndef _SYS_SYSTM_H_ #define _SYS_SYSTM_H_ -extern struct sysent { /* system call table */ - int sy_narg; /* number of arguments */ - int (*sy_call)(); /* implementing function */ -} sysent[]; - -/* Prototypes I needed to fix that kern_exit warning - ---- this really the first step in the work that's - been done on sun-lamp to add kernel function - prototypes. */ -void kexit __P((struct proc *, int)); -void cpu_exit __P((struct proc *)); -void swtch __P((void)); - - -extern const char *panicstr; /* panic message */ -extern char version[]; /* system version */ -extern char copyright[]; /* system copyright */ - -extern int nblkdev; /* number of entries in bdevsw */ -extern int nchrdev; /* number of entries in cdevsw */ -extern int nswdev; /* number of swap devices */ -extern int nswap; /* size of swap space */ +#include "sys/param.h" +#include "sys/sysent.h" /* XXX */ + +/* Initialize the world */ +void startrtclock __P((void)); +void consinit __P((void)); +void vm_mem_init __P((void)); +void kmeminit __P((void)); +void cpu_startup __P((void)); +void rqinit __P((void)); +void vm_init_limits __P((struct proc *)); +void vfsinit __P((void)); +void mbinit __P((void)); +void shminit __P((void)); +void ifinit __P((void)); +void domaininit __P((void)); +void swapinit __P((void)); +void enablertclock __P((void)); + + +/* Default network interfaces... */ +void slattach(void); +void pppattach(void); +void loattach(void); + + +/* select() support functions */ +int selscan __P((struct proc *, fd_set *, fd_set *, int, int *)); +int seltrue __P((int /*dev_t*/, int, struct proc *)); +void selwakeup __P((int /*pid_t*/, int)); extern int selwait; /* select timeout address */ -extern u_char curpri; /* priority of current process */ - -extern int maxmem; /* max memory per process */ -extern int physmem; /* physical memory */ - -extern dev_t dumpdev; /* dump device */ -extern long dumplo; /* offset into dumpdev */ - -extern dev_t rootdev; /* root device */ -extern struct vnode *rootvp; /* vnode equivalent to above */ - -extern dev_t swapdev; /* swapping device */ -extern struct vnode *swapdev_vp;/* vnode equivalent to above */ - -extern int boothowto; /* reboot flags, from console subsystem */ -#ifdef KADB -extern char *bootesym; /* end of symbol info from boot */ -#endif - -/* casts to keep lint happy */ -#define insque(q,p) _insque((caddr_t)q,(caddr_t)p) -#define remque(q) _remque((caddr_t)q) - -/* - * General function declarations. - */ - - -int nullop __P((void)); -int enodev __P((void)); -int enoioctl __P((void)); -int enxio __P((void)); -int eopnotsupp __P((void)); -int selscan __P((struct proc *p, fd_set *ibits, fd_set *obits, - int nfd, int *retval)); -int seltrue __P((int /*dev_t*/ dev, int which, struct proc *p)); -void selwakeup __P((int /*pid_t*/ pid, int coll)); - -__dead void panic __P((const char *)); -void tablefull __P((char *)); -int addlog __P((const char *, ...)); -void log __P((int, const char *, ...)); -int printf __P((const char *, ...)); -int sprintf __P((char *buf, const char *, ...)); -void ttyprintf __P((struct tty *, const char *, ...)); - -void bcopy __P((void *from, void *to, u_int len)); -void ovbcopy __P((void *from, void *to, u_int len)); -void bzero __P((void *buf, u_int len)); -#ifndef __GNUC__ -int bcmp __P((void *str1, void *str2, u_int len)); -#endif -size_t strlen __P((const char *string)); +/* SPL Levels */ +extern int splbio(void); +extern int splclock(void); +extern int splhigh(void); +extern int splimp(void); +extern int splnet(void); +extern int splsoftclock(void); +extern int spltty(void); +extern int splnone(void); +extern int splx(int); +#define spl0 splnone + + +/* Scheduling */ +void roundrobin __P((caddr_t, int)); +void schedcpu __P((caddr_t, int)); +void softclock(); +void setsoftclock __P((void)); +void setpri __P((struct proc *)); +void swtch __P((void)); +void vmmeter __P((void)); + + +/* Timeouts and sleeps */ +typedef void (*timeout_func_t)(caddr_t, int); +extern void timeout(timeout_func_t, caddr_t, int); +extern void wakeup(caddr_t); +extern void untimeout(timeout_func_t, caddr_t); +extern int tsleep(caddr_t, int, const char *, int); +extern void wakeup(caddr_t); + + +/* User data reference */ +int useracc __P((caddr_t, int, int)); +int kernacc __P((caddr_t, int, int)); int copystr __P((void *kfaddr, void *kdaddr, u_int len, u_int *done)); int copyinstr __P((void *udaddr, void *kaddr, u_int len, u_int *done)); int copyoutstr __P((void *kaddr, void *udaddr, u_int len, u_int *done)); int copyin __P((void *udaddr, void *kaddr, u_int len)); int copyout __P((void *kaddr, void *udaddr, u_int len)); - int fubyte __P((void *base)); #ifdef notdef int fuibyte __P((void *base)); @@ -133,34 +122,76 @@ int fuiword __P((void *base)); int suword __P((void *base, int word)); int suiword __P((void *base, int word)); + +/* printf() family */ +int printf __P((const char *, ...)); +int sprintf __P((char *, const char *, ...)); +void uprintf __P((const char *, ...)); + + +/* Miscellaneous */ +void logwakeup __P((void)); +void addlog __P((const char *, ...)); +void log __P((int, const char *, ...)); +void tablefull __P((const char *)); +void DELAY __P((int)); +void spinwait __P((int)); +struct ucred; +int suser __P((struct ucred *, u_short *)); + +/* Functions to return errors */ +int nullop __P((void)); /* WARNING WILL ROBINSON */ +int enodev __P((void)); /* All these routines are potentially */ +int enoioctl __P((void)); /* called with differing arguments. */ +int enxio __P((void)); +int eopnotsupp __P((void)); + + +/* routines which never return */ +#ifdef __GNUC__ +typedef void _sched_t(void); /* sched() */ +__dead _sched_t sched; + +typedef void _kexit_t(struct proc *, int); /* kexit() */ +__dead _kexit_t kexit; + +typedef void _cpu_exit_t(struct proc *); /* cpu_exit() */ +__dead _cpu_exit_t cpu_exit; + +typedef void _panic_t(const char *); /* panic() */ +__dead _panic_t panic; + +typedef void _boot_t(int); /* boot() */ +__dead _boot_t boot; + +#else +void panic __P((const char *)); +void sched __P((void)); +void exit __P((struct proc *, int)); +void cpu_exit __P((struct proc *)); +void boot __P((int)); +#endif + + +/* string functions */ +size_t strlen __P((const char *)); +int strcmp __P((const char *, const char *)); +char *strncpy __P((char *, const char *, int)); +char *strcat __P((char *, const char *)); +char *strcpy __P((char *, const char *)); +void bcopy __P((const void *from, void *to, u_int len)); +void ovbcopy __P((void *from, void *to, u_int len)); +void bzero __P((void *, u_int)); +#ifndef __GNUC__ +int bcmp __P((const void *str1, const void *str2, u_int len)); +#endif int scanc __P((unsigned size, u_char *cp, u_char *table, int mask)); -int skpc __P((int mask, int size, char *cp)); -int locc __P((int mask, char *cp, unsigned size)); -int ffs __P((long value)); +int skpc __P((int, u_int, u_char *)); +int locc __P((int, unsigned, u_char *)); +int ffs __P((long)); -/* - * XXX - a lot were missing. A lot are still missing. Some of the above - * are inconsistent with ANSI C. I fixed strlen. Others are inconsistent - * with with non-ANSI C due to having unpromoted args. - */ -struct proc; - -typedef void (*timeout_func_t) __P((caddr_t arg, int ticks)); - -void DELAY __P((int count)); -void psignal __P((struct proc *p, int sig)); -void spinwait __P((int millisecs)); -int splhigh __P((void)); -int spltty __P((void)); -int splx __P((int new_pri)); -void timeout __P((timeout_func_t func, caddr_t arg, int t)); -void trapsignal __P((struct proc *p, int sig, unsigned code)); -void wakeup __P((caddr_t chan)); -int tsleep(caddr_t, int, const char *, int); -void unsleep(struct proc *); -void wakeup(caddr_t); -void setrun(struct proc *); /* xxx move to proc.h */ -void setpri(struct proc *); /* xxx move to proc.h */ +/* Debugger entry points */ +void Debugger __P((const char *)); /* * Machine-dependent function declarations. diff --git a/sys/sys/termios.h b/sys/sys/termios.h index a1c1fff480..dbd5625c9b 100644 --- a/sys/sys/termios.h +++ b/sys/sys/termios.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)termios.h 7.22 (Berkeley) 5/7/91 - * $Id: termios.h,v 1.3 1993/10/16 17:17:57 rgrimes Exp $ + * $Id: termios.h,v 1.4 1993/11/14 22:38:32 ache Exp $ */ /* @@ -153,31 +153,31 @@ */ #ifndef _POSIX_SOURCE -#define ECHOKE 0x00000001 /* visual erase for line kill */ +#define ECHOKE 0x00000001UL /* visual erase for line kill */ #endif /*_POSIX_SOURCE */ -#define ECHOE 0x00000002 /* visually erase chars */ -#define ECHOK 0x00000004 /* echo NL after line kill */ -#define ECHO 0x00000008 /* enable echoing */ -#define ECHONL 0x00000010 /* echo NL even if ECHO is off */ +#define ECHOE 0x00000002UL /* visually erase chars */ +#define ECHOK 0x00000004UL /* echo NL after line kill */ +#define ECHO 0x00000008UL /* enable echoing */ +#define ECHONL 0x00000010UL /* echo NL even if ECHO is off */ #ifndef _POSIX_SOURCE -#define ECHOPRT 0x00000020 /* visual erase mode for hardcopy */ -#define ECHOCTL 0x00000040 /* echo control chars as ^(Char) */ +#define ECHOPRT 0x00000020UL /* visual erase mode for hardcopy */ +#define ECHOCTL 0x00000040UL /* echo control chars as ^(Char) */ #endif /*_POSIX_SOURCE */ -#define ISIG 0x00000080 /* enable signals INTR, QUIT, [D]SUSP */ -#define ICANON 0x00000100 /* canonicalize input lines */ +#define ISIG 0x00000080UL /* enable signals INTR, QUIT, [D]SUSP */ +#define ICANON 0x00000100UL /* canonicalize input lines */ #ifndef _POSIX_SOURCE -#define ALTWERASE 0x00000200 /* use alternate WERASE algorithm */ +#define ALTWERASE 0x00000200UL /* use alternate WERASE algorithm */ #endif /*_POSIX_SOURCE */ -#define IEXTEN 0x00000400 /* enable DISCARD and LNEXT */ -#define EXTPROC 0x00000800 /* external processing */ -#define TOSTOP 0x00400000 /* stop background jobs from output */ +#define IEXTEN 0x00000400UL /* enable DISCARD and LNEXT */ +#define EXTPROC 0x00000800UL /* external processing */ +#define TOSTOP 0x00400000UL /* stop background jobs from output */ #ifndef _POSIX_SOURCE -#define FLUSHO 0x00800000 /* output being flushed (state) */ -#define MDMBUF 0x00100000 /* flow control output via Carrier */ -#define NOKERNINFO 0x02000000 /* no kernel output from VSTATUS */ -#define PENDIN 0x20000000 /* XXX retype pending input (state) */ +#define FLUSHO 0x00800000UL /* output being flushed (state) */ +#define MDMBUF 0x00100000UL /* flow control output via Carrier */ +#define NOKERNINFO 0x02000000UL /* no kernel output from VSTATUS */ +#define PENDIN 0x20000000UL /* XXX retype pending input (state) */ #endif /*_POSIX_SOURCE */ -#define NOFLSH 0x80000000 /* don't flush after interrupt */ +#define NOFLSH 0x80000000UL /* don't flush after interrupt */ typedef unsigned long tcflag_t; typedef unsigned char cc_t; diff --git a/sys/sys/time.h b/sys/sys/time.h index d01f7772d7..32e332e9ed 100644 --- a/sys/sys/time.h +++ b/sys/sys/time.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)time.h 7.6 (Berkeley) 2/22/91 - * $Id: time.h,v 1.2 1993/10/16 17:17:59 rgrimes Exp $ + * $Id: time.h,v 1.3 1993/11/25 01:38:06 wollman Exp $ */ #ifndef _SYS_TIME_H_ @@ -87,6 +87,8 @@ extern void timevaladd(struct timeval *, struct timeval *); extern void timevalsub(struct timeval *, struct timeval *); extern void timevalfix(struct timeval *); extern void realitexpire(caddr_t, int); +extern int itimerdecr(struct itimerval *, int); /* XXX 2nd arg? */ +extern u_long hzto(struct timeval *); #else /* not KERNEL */ #include diff --git a/sys/sys/tty.h b/sys/sys/tty.h index ea9f65dfb7..b776e4de42 100644 --- a/sys/sys/tty.h +++ b/sys/sys/tty.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)tty.h 7.10 (Berkeley) 6/26/91 - * $Id: tty.h,v 1.5 1993/11/14 23:29:50 ache Exp $ + * $Id: tty.h,v 1.6 1993/11/25 01:38:07 wollman Exp $ */ #ifndef _SYS_TTY_H_ @@ -134,30 +134,30 @@ extern struct ttychars ttydefaults; #endif /* KERNEL */ /* internal state bits */ -#define TS_TIMEOUT 0x000001 /* delay timeout in progress */ -#define TS_WOPEN 0x000002 /* waiting for open to complete */ -#define TS_ISOPEN 0x000004 /* device is open */ -#define TS_FLUSH 0x000008 /* outq has been flushed during DMA */ -#define TS_CARR_ON 0x000010 /* software copy of carrier-present */ -#define TS_BUSY 0x000020 /* output in progress */ -#define TS_ASLEEP 0x000040 /* wakeup when output done */ -#define TS_XCLUDE 0x000080 /* exclusive-use flag against open */ -#define TS_TTSTOP 0x000100 /* output stopped by ctl-s */ -/* was TS_HUPCLS 0x000200 * hang up upon last close */ -#define TS_TBLOCK 0x000400 /* tandem queue blocked */ -#define TS_RCOLL 0x000800 /* collision in read select */ -#define TS_WCOLL 0x001000 /* collision in write select */ -#define TS_ASYNC 0x004000 /* tty in async i/o mode */ +#define TS_TIMEOUT 0x000001UL /* delay timeout in progress */ +#define TS_WOPEN 0x000002UL /* waiting for open to complete */ +#define TS_ISOPEN 0x000004UL /* device is open */ +#define TS_FLUSH 0x000008UL /* outq has been flushed during DMA */ +#define TS_CARR_ON 0x000010UL /* software copy of carrier-present */ +#define TS_BUSY 0x000020UL /* output in progress */ +#define TS_ASLEEP 0x000040UL /* wakeup when output done */ +#define TS_XCLUDE 0x000080UL /* exclusive-use flag against open */ +#define TS_TTSTOP 0x000100UL /* output stopped by ctl-s */ +/* was TS_HUPCLS 0x000200UL * hang up upon last close */ +#define TS_TBLOCK 0x000400UL /* tandem queue blocked */ +#define TS_RCOLL 0x000800UL /* collision in read select */ +#define TS_WCOLL 0x001000UL /* collision in write select */ +#define TS_ASYNC 0x004000UL /* tty in async i/o mode */ /* state for intra-line fancy editing work */ -#define TS_BKSL 0x010000 /* state for lowercase \ work */ -#define TS_ERASE 0x040000 /* within a \.../ for PRTRUB */ -#define TS_LNCH 0x080000 /* next character is literal */ -#define TS_TYPEN 0x100000 /* retyping suspended input (PENDIN) */ -#define TS_CNTTB 0x200000 /* counting tab width, ignore FLUSHO */ +#define TS_BKSL 0x010000UL /* state for lowercase \ work */ +#define TS_ERASE 0x040000UL /* within a \.../ for PRTRUB */ +#define TS_LNCH 0x080000UL /* next character is literal */ +#define TS_TYPEN 0x100000UL /* retyping suspended input (PENDIN) */ +#define TS_CNTTB 0x200000UL /* counting tab width, ignore FLUSHO */ /* flow-control-invoked bits */ -#define TS_CAR_OFLOW 0x0400000 /* for MDMBUF (XXX handle in driver) */ -#define TS_DTR_IFLOW 0x2000000 /* not implemented */ -#define TS_RTS_IFLOW 0x4000000 /* for CRTS_IFLOW */ +#define TS_CAR_OFLOW 0x0400000UL /* for MDMBUF (XXX handle in driver) */ +#define TS_DTR_IFLOW 0x2000000UL /* not implemented */ +#define TS_RTS_IFLOW 0x4000000UL /* for CRTS_IFLOW */ #define TS_HW_IFLOW (TS_DTR_IFLOW | TS_RTS_IFLOW) #define TS_LOCAL (TS_BKSL|TS_ERASE|TS_LNCH|TS_TYPEN|TS_CNTTB) @@ -178,11 +178,11 @@ struct speedtab { /* * Flags on character passed to ttyinput */ -#define TTY_CHARMASK 0x000000ff /* Character mask */ -#define TTY_QUOTE 0x00000100 /* Character quoted */ -#define TTY_ERRORMASK 0xff000000 /* Error mask */ -#define TTY_FE 0x01000000 /* Framing error or BREAK condition */ -#define TTY_PE 0x02000000 /* Parity error */ +#define TTY_CHARMASK 0x000000ffUL /* Character mask */ +#define TTY_QUOTE 0x00000100UL /* Character quoted */ +#define TTY_ERRORMASK 0xff000000UL /* Error mask */ +#define TTY_FE 0x01000000UL /* Framing error or BREAK condition */ +#define TTY_PE 0x02000000UL /* Parity error */ /* * Is tp controlling terminal for p @@ -244,7 +244,13 @@ extern int tputchar(int, struct tty *); extern int ttysleep(struct tty *, caddr_t, int, const char *, int); /* From tty_ring.c: */ +extern int putc(int, struct ringb *); extern int getc(struct ringb *); +extern int nextc(char **, struct ringb *); +extern int ungetc(int, struct ringb *); +extern int unputc(struct ringb *); +extern void initrb(struct ringb *); +extern void catb(struct ringb *, struct ringb *); extern size_t rb_write(struct ringb *, char *, size_t); /* From tty_compat.c: */ diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h index 78638c71ae..b1b2950763 100644 --- a/sys/sys/ucred.h +++ b/sys/sys/ucred.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)ucred.h 7.5 (Berkeley) 2/5/91 - * $Id: ucred.h,v 1.2 1993/10/16 17:18:14 rgrimes Exp $ + * $Id: ucred.h,v 1.3 1993/11/07 17:53:13 wollman Exp $ */ #ifndef _UCRED_H_ @@ -50,10 +50,12 @@ struct ucred { #define NOCRED ((struct ucred *)-1) #ifdef KERNEL + #define crhold(cr) (cr)->cr_ref++ -struct ucred *crget(); -struct ucred *crcopy(); -struct ucred *crdup(); -#endif /* KERNEL */ +extern struct ucred *crget(void); +extern void crfree(struct ucred *); +extern struct ucred *crcopy(struct ucred *); +extern struct ucred *crdup(struct ucred *); +#endif /* KERNEL */ #endif /* !_UCRED_H_ */ diff --git a/sys/sys/uio.h b/sys/sys/uio.h index 395643d580..6f1f3730e8 100644 --- a/sys/sys/uio.h +++ b/sys/sys/uio.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)uio.h 7.8 (Berkeley) 4/15/91 - * $Id$ + * $Id: uio.h,v 1.2 1993/10/16 17:18:15 rgrimes Exp $ */ #ifndef _UIO_H_ @@ -69,7 +69,22 @@ struct uio { #define UIO_MAXIOV 1024 /* max 1K of iov's */ #define UIO_SMALLIOV 8 /* 8 on stack, else malloc */ -#ifndef KERNEL +#ifdef KERNEL + +extern int uiomove(void *, int, struct uio *); +/* + * NB: argument cannot be properly declared because this function is often + * called with arguments not matching the appropriate type. The actual + * type of the first argument is `int (*)(caddr_t, caddr_t, caddr_t, off_t, + * enum uio_rw, caddr_t, u_int *, struct proc *)'. + */ + +typedef int (*uioapply_func_t)(caddr_t, caddr_t, caddr_t, off_t, enum uio_rw, caddr_t, u_int *, struct proc *); + +extern int uioapply(int (*)(), caddr_t, caddr_t, struct uio *); +extern int ureadc(int, struct uio *); + +#else /* not KERNEL */ #include diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 04d5f94612..97b806b140 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)vnode.h 7.39 (Berkeley) 6/27/91 - * $Id: vnode.h,v 1.5 1993/11/25 01:38:11 wollman Exp $ + * $Id: vnode.h,v 1.6 1993/12/12 12:27:03 davidg Exp $ */ #ifndef _SYS_VNODE_H_ @@ -273,7 +273,7 @@ struct vnodeops { /* * Token indicating no attribute value yet assigned */ -#define VNOVAL ((unsigned)0xffffffff) +#define VNOVAL (~0) #ifdef KERNEL /* @@ -291,6 +291,9 @@ int vn_write __P((struct file *fp, struct uio *uio, struct ucred *cred)); int vn_ioctl __P((struct file *fp, int com, caddr_t data, struct proc *p)); int vn_select __P((struct file *fp, int which, struct proc *p)); int vn_closefile __P((struct file *fp, struct proc *p)); +struct stat; +int vn_stat __P((struct vnode *, struct stat *, struct proc *)); +int vn_writechk __P((struct vnode *)); int getnewvnode __P((enum vtagtype tag, struct mount *mp, struct vnodeops *vops, struct vnode **vpp)); int bdevvp __P((int dev, struct vnode **vpp)); @@ -316,6 +319,10 @@ extern void vclean(struct vnode *, int); extern int vfinddev(int /*dev_t*/, enum vtype, struct vnode **); extern void vprint(const char *, struct vnode *); extern int kinfo_vnode(int, char *, int *, int, int *); +extern int vnode_pager_uncache(struct vnode *); +extern void vnode_pager_setsize(struct vnode *, u_long); +extern void cache_purge(struct vnode *); +extern void cache_purgevfs(struct mount *); /* * Flags to various vnode functions. diff --git a/sys/ufs/fs.h b/sys/ufs/fs.h index ed21894d9c..a319c7ddb0 100644 --- a/sys/ufs/fs.h +++ b/sys/ufs/fs.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)fs.h 7.12 (Berkeley) 5/8/91 - * $Id: fs.h,v 1.3 1993/11/07 17:53:36 wollman Exp $ + * $Id: fs.h,v 1.4 1993/11/25 01:38:17 wollman Exp $ */ #ifndef _UFS_FS_H_ @@ -446,6 +446,12 @@ struct ocg { #ifdef KERNEL extern void fserr(struct fs *, int /*uid_t*/, const char *); +extern void fragacct(struct fs *, int, long *, int); +extern int isblock(struct fs *, u_char *, daddr_t); +extern void clrblock(struct fs *, u_char *, daddr_t); +extern void setblock(struct fs *, u_char *, daddr_t); +extern ino_t dirpref(struct fs *); +extern daddr_t mapsearch(struct fs *, struct cg *, daddr_t, int); #endif /* KERNEL */ #endif /* _UFS_FS_H_ */ diff --git a/sys/ufs/inode.h b/sys/ufs/inode.h index 5cd2aeb2fa..0a291a0ad8 100644 --- a/sys/ufs/inode.h +++ b/sys/ufs/inode.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)inode.h 7.17 (Berkeley) 5/8/91 - * $Id: inode.h,v 1.4 1993/11/07 17:53:38 wollman Exp $ + * $Id: inode.h,v 1.5 1993/11/25 01:38:21 wollman Exp $ */ #ifndef _UFS_INODE_H_ @@ -242,5 +242,40 @@ extern void ilock(struct inode *); extern void iunlock(struct inode *); extern void dirbad(struct inode *, off_t, char *); +extern int alloc(struct inode *, daddr_t, daddr_t, int, daddr_t *); +extern int realloccg(struct inode *, off_t, daddr_t, int, int, struct buf **); +extern int ialloc(struct inode *, ino_t, int, struct ucred *, struct inode **); +extern daddr_t blkpref(struct inode *, daddr_t, int, daddr_t *); +extern u_long hashalloc(struct inode *, int, long, int, + u_long (*)(struct inode *, int, long, int)); +extern daddr_t fragextend(struct inode *, int, long, int, int); +extern daddr_t alloccg(struct inode *, int, daddr_t, int); + +struct cg; /* I really don't want to know why */ +struct direct; /* this header is required by NFS... */ + +extern daddr_t alloccgblk(struct fs *, struct cg *, daddr_t); +extern ino_t ialloccg(struct inode *, int, daddr_t, int); +extern int ufs_lookup(struct vnode *, struct nameidata *, struct proc *); +extern int dirbadentry(struct direct *, int); +extern int direnter(struct inode *, struct nameidata *); +extern int dirremove(struct nameidata *); +extern int dirrewrite(struct inode *, struct inode *, struct nameidata *); +extern int blkatoff(struct inode *, off_t, char **, struct buf **); +extern int dirempty(struct inode *, ino_t, struct ucred *); +extern int checkpath(struct inode *, struct inode *, struct ucred *); + +extern void ufs_init(void); +extern int iget(struct inode *, ino_t, struct inode **); +extern int ufs_inactive(struct vnode *, struct proc *); +extern int ufs_reclaim(struct vnode *); +extern int iupdat(struct inode *, struct timeval *, struct timeval *, + int); +extern int itrunc(struct inode *, u_long, int); +extern int indirtrunc(struct inode *, daddr_t, daddr_t, int, long *); + +extern int bmap(struct inode *, daddr_t, daddr_t *); +extern int balloc(struct inode *, daddr_t, int, struct buf **, int); + #endif /* KERNEL */ #endif /* _UFS_INODE_H_ */ diff --git a/sys/ufs/lockf.h b/sys/ufs/lockf.h index ec58f5d91f..5435bd2d14 100644 --- a/sys/ufs/lockf.h +++ b/sys/ufs/lockf.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)lockf.h 7.1 (Berkeley) 2/1/91 - * $Id: lockf.h,v 1.3 1993/10/20 07:31:36 davidg Exp $ + * $Id: lockf.h,v 1.4 1993/11/07 17:53:40 wollman Exp $ */ #ifndef _UFS_LOCKF_H_ @@ -66,8 +66,14 @@ struct lockf { /* * Public lock manipulation routines */ -extern struct lockf *lf_remove(); /* Remove a lock */ -extern struct lockf *lf_getblock(); /* Return the first blocking lock */ +extern int lf_advlock(struct lockf **, u_long, caddr_t, int, struct flock *, + int); +extern int lf_setlock(struct lockf *); +extern int lf_clearlock(struct lockf *); +extern int lf_getlock(struct lockf *, struct flock *); +extern struct lockf *lf_getblock(struct lockf *); +extern int lf_findoverlap(struct lockf *, struct lockf *, int, + struct lockf ***, struct lockf **); #ifdef LOCKF_DEBUG extern int lockf_debug; diff --git a/sys/ufs/mfs_vfsops.c b/sys/ufs/mfs_vfsops.c index 6c56909d2f..6d2b0161cb 100644 --- a/sys/ufs/mfs_vfsops.c +++ b/sys/ufs/mfs_vfsops.c @@ -31,10 +31,11 @@ * SUCH DAMAGE. * * from: @(#)mfs_vfsops.c 7.19 (Berkeley) 4/16/91 - * $Id: mfs_vfsops.c,v 1.4 1993/11/12 10:15:41 chmr Exp $ + * $Id: mfs_vfsops.c,v 1.5 1993/11/25 01:38:25 wollman Exp $ */ #include "param.h" +#include "systm.h" #include "time.h" #include "kernel.h" #include "proc.h" diff --git a/sys/ufs/ufs_alloc.c b/sys/ufs/ufs_alloc.c index 8c40f9670b..d109fac4a0 100644 --- a/sys/ufs/ufs_alloc.c +++ b/sys/ufs/ufs_alloc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)ufs_alloc.c 7.26 (Berkeley) 5/2/91 - * $Id: ufs_alloc.c,v 1.2 1993/10/16 18:17:49 rgrimes Exp $ + * $Id: ufs_alloc.c,v 1.3 1993/11/25 01:38:29 wollman Exp $ */ #include "param.h" @@ -46,6 +46,7 @@ #include "inode.h" #include "fs.h" +/* XXX */ extern u_long hashalloc(); extern ino_t ialloccg(); extern daddr_t alloccg(); diff --git a/sys/ufs/ufs_disksubr.c b/sys/ufs/ufs_disksubr.c index 8930afd722..5bbd46d564 100644 --- a/sys/ufs/ufs_disksubr.c +++ b/sys/ufs/ufs_disksubr.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 - * $Id: ufs_disksubr.c,v 1.3 1993/10/08 21:00:37 rgrimes Exp $ + * $Id: ufs_disksubr.c,v 1.4 1993/11/25 01:38:31 wollman Exp $ */ #include "param.h" @@ -336,7 +336,7 @@ setdisklabel(olp, nlp, openmask, dp) return(EINVAL); /* special case to allow disklabel to be invalidated */ - if (nlp->d_magic == 0xffffffff) { + if (nlp->d_magic == 0xffffffffUL) { *olp = *nlp; return (0); } @@ -566,7 +566,7 @@ diskerr(bp, dname, what, pri, blkdone, lp) if (pri != LOG_PRINTF) { log(pri, ""); - pr = addlog; + pr = (int (*)(const char *, ...))addlog; /* XXX FIXME! */ } else pr = printf; (*pr)("%s%d%c: %s %sing fsbn ", dname, unit, partname, what, diff --git a/sys/ufs/ufs_lockf.c b/sys/ufs/ufs_lockf.c index 042c64407e..1404033d23 100644 --- a/sys/ufs/ufs_lockf.c +++ b/sys/ufs/ufs_lockf.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)ufs_lockf.c 7.7 (Berkeley) 7/2/91 - * $Id: ufs_lockf.c,v 1.5 1993/10/25 03:19:43 davidg Exp $ + * $Id: ufs_lockf.c,v 1.6 1993/11/25 01:38:34 wollman Exp $ */ #include "param.h" @@ -726,7 +726,7 @@ lf_split(lock1, lock2) /* * Wakeup a blocklist */ -void +static void lf_wakelock(listhead) struct lockf *listhead; { diff --git a/sys/ufs/ufs_subr.c b/sys/ufs/ufs_subr.c index 457651f379..6693d87e78 100644 --- a/sys/ufs/ufs_subr.c +++ b/sys/ufs/ufs_subr.c @@ -31,11 +31,12 @@ * SUCH DAMAGE. * * from: @(#)ufs_subr.c 7.13 (Berkeley) 6/28/90 - * $Id: ufs_subr.c,v 1.2 1993/10/16 18:17:59 rgrimes Exp $ + * $Id: ufs_subr.c,v 1.3 1993/11/25 01:38:38 wollman Exp $ */ #ifdef KERNEL #include "param.h" +#include "systm.h" #include "../ufs/fs.h" #else #include diff --git a/sys/ufs/ufs_tables.c b/sys/ufs/ufs_tables.c index 42ccff41ca..4fd90ddc44 100644 --- a/sys/ufs/ufs_tables.c +++ b/sys/ufs/ufs_tables.c @@ -31,11 +31,12 @@ * SUCH DAMAGE. * * from: @(#)ufs_tables.c 7.4 (Berkeley) 6/28/90 - * $Id$ + * $Id: ufs_tables.c,v 1.2 1993/10/16 18:18:00 rgrimes Exp $ */ #ifdef KERNEL #include "param.h" +#include "systm.h" #else #include #endif diff --git a/sys/ufs/ufs_vfsops.c b/sys/ufs/ufs_vfsops.c index fda1f79233..0f2af4caa0 100644 --- a/sys/ufs/ufs_vfsops.c +++ b/sys/ufs/ufs_vfsops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)ufs_vfsops.c 7.56 (Berkeley) 6/28/91 - * $Id: ufs_vfsops.c,v 1.4 1993/10/16 18:18:01 rgrimes Exp $ + * $Id: ufs_vfsops.c,v 1.5 1993/11/25 01:38:39 wollman Exp $ */ #include "param.h" @@ -55,6 +55,8 @@ #include "ufsmount.h" #include "inode.h" +int mountfs(struct vnode *, struct mount *, struct proc *); + struct vfsops ufs_vfsops = { ufs_mount, ufs_start, diff --git a/sys/ufs/ufs_vnops.c b/sys/ufs/ufs_vnops.c index e06f4da2d8..d33c14204f 100644 --- a/sys/ufs/ufs_vnops.c +++ b/sys/ufs/ufs_vnops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)ufs_vnops.c 7.64 (Berkeley) 5/16/91 - * $Id: ufs_vnops.c,v 1.7 1993/11/13 22:46:40 rgrimes Exp $ + * $Id: ufs_vnops.c,v 1.8 1993/11/25 01:38:40 wollman Exp $ */ #include "param.h" @@ -59,6 +59,11 @@ /* Get the current value of _POSIX_CHOWN_RESTRICTED */ #include "sys/unistd.h" /* make sure to get sys/ version. */ +static int maknode(int, struct nameidata *, struct inode **); + +/* XXX - don't want to change ucred.h again */ +extern int groupmember(int /*gid_t*/, struct ucred *); + /* * Create a regular file */ @@ -310,7 +315,7 @@ ufs_setattr(vp, vap, cred, p) if (cred->cr_uid == 0) { ip->i_flags = vap->va_flags; } else { - ip->i_flags &= 0xffff0000; + ip->i_flags &= 0xffff0000ul; ip->i_flags |= (vap->va_flags & 0xffff); } ip->i_flag |= ICHG; @@ -1643,7 +1648,7 @@ ufsfifo_close(vp, fflag, cred, p) /* * Allocate a new inode. */ -int +static int maknode(mode, ndp, ipp) int mode; register struct nameidata *ndp; diff --git a/sys/vm/kern_lock.c b/sys/vm/kern_lock.c index 2246f0faa9..e573723bb6 100644 --- a/sys/vm/kern_lock.c +++ b/sys/vm/kern_lock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)kern_lock.c 7.4 (Berkeley) 4/21/91 - * $Id$ + * $Id: kern_lock.c,v 1.2 1993/10/16 16:20:13 rgrimes Exp $ */ /* @@ -69,9 +69,12 @@ */ #include "param.h" +#include "systm.h" #include "vm_param.h" #include "lock.h" +#include "vm/vm.h" + /* XXX */ #include "proc.h" typedef int *thread_t; diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index a5f43ca286..e0829505a0 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -37,7 +37,7 @@ * * from: Utah $Hdr: swap_pager.c 1.4 91/04/30$ * from: @(#)swap_pager.c 7.4 (Berkeley) 5/7/91 - * $Id: swap_pager.c,v 1.5 1993/11/25 01:38:56 wollman Exp $ + * $Id: swap_pager.c,v 1.6 1993/11/29 14:50:27 ache Exp $ */ /* @@ -58,6 +58,7 @@ #include "vnode.h" #include "malloc.h" #include "rlist.h" +#include "kernel.h" #include "vm.h" #include "vm_page.h" @@ -345,7 +346,7 @@ swap_pager_dealloc(pager) s = splbio(); while (swp->sw_poip) { swp->sw_flags |= SW_WANTED; - assert_wait((int)swp); + assert_wait((int)swp, 0); thread_block("swpgde"); } splx(s); @@ -666,7 +667,7 @@ swap_pager_io(swp, m, flags) swap_pager_poip++; #endif while ((bp->b_flags & B_DONE) == 0) { - assert_wait((int)bp); + assert_wait((int)bp, 0); thread_block("swpgio"); } #ifdef DEBUG diff --git a/sys/vm/vm.h b/sys/vm/vm.h index 73fb0c066f..382b3f7cf4 100644 --- a/sys/vm/vm.h +++ b/sys/vm/vm.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)vm.h 7.1 (Berkeley) 5/5/91 - * $Id: vm.h,v 1.4 1993/11/25 01:38:58 wollman Exp $ + * $Id: vm.h,v 1.5 1993/12/12 12:27:21 davidg Exp $ */ #ifndef _VM_H_ @@ -77,4 +77,9 @@ void vmspace_free __P((struct vmspace *)); extern void thread_block(const char *); +/* This really doesn't belong here, but the VM code doesn't distinguish + * very well between internal and interface code. */ +#define assert_wait(e, r) (curproc->p_thread = (e)) +#define thread_wakeup(e) (wakeup((caddr_t)(e))) + #endif /* _VM_H_ */ diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 673d4cddfb..e5e3ac60a1 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_fault.c 7.6 (Berkeley) 5/7/91 - * $Id: vm_fault.c,v 1.7 1993/11/25 01:38:59 wollman Exp $ + * $Id: vm_fault.c,v 1.8 1993/12/12 12:27:22 davidg Exp $ */ /* @@ -69,10 +69,13 @@ */ #include "param.h" +#include "systm.h" +#include "proc.h" /* XXX - just to get curproc */ #include "vm.h" #include "vm_page.h" #include "vm_pageout.h" +#include "vm_user.h" /* make sure we match prototype */ vm_statistics_data_t vm_stat; diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index ee62f79ec6..d603505c7e 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_glue.c 7.8 (Berkeley) 5/15/91 - * $Id: vm_glue.c,v 1.12 1993/11/25 01:39:01 wollman Exp $ + * $Id: vm_glue.c,v 1.13 1993/12/12 12:27:23 davidg Exp $ */ /* @@ -502,6 +502,7 @@ swapout(p) * The rest of these routines fake thread handling */ +#ifndef assert_wait void assert_wait(event, ruptible) int event; @@ -512,6 +513,7 @@ assert_wait(event, ruptible) #endif curproc->p_thread = event; } +#endif /* assert_wait */ void thread_block(const char *wmesg) @@ -540,6 +542,7 @@ thread_sleep_(event, lock, wmesg) splx(s); } +#ifndef thread_wakeup void thread_wakeup(event) int event; @@ -553,6 +556,7 @@ thread_wakeup(event) splx(s); #endif } +#endif /* thread_wakeup */ /* * DEBUG stuff @@ -563,13 +567,13 @@ int indent = 0; /*ARGSUSED2*/ void -iprintf(const char *a, ...) +iprintf(const char *fmt, ...) { va_list args; int i, j = 0; char indentbuf[indent + 1]; - va_start(args, a); + va_start(args, fmt); i = indent; while (i >= 8) { indentbuf[j++] = '\t'; @@ -580,7 +584,7 @@ iprintf(const char *a, ...) indentbuf[j++] = '\0'; - printf("%s%r", indentbuf, a, args); + printf("%s%r", indentbuf, fmt, args); va_end(args); } #endif /* defined(DEBUG) || (NDDB > 0) */ diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index cbeea58e5c..5c3bae6ef7 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_kern.c 7.4 (Berkeley) 5/7/91 - * $Id: vm_kern.c,v 1.4 1993/11/07 17:54:13 wollman Exp $ + * $Id: vm_kern.c,v 1.5 1993/11/25 01:39:02 wollman Exp $ */ /* @@ -70,6 +70,8 @@ */ #include "param.h" +#include "systm.h" +#include "proc.h" /* XXX - for curproc */ #include "syslog.h" #include "vm.h" diff --git a/sys/vm/vm_kern.h b/sys/vm/vm_kern.h index e7b5e90ed2..6e8de0323d 100644 --- a/sys/vm/vm_kern.h +++ b/sys/vm/vm_kern.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_kern.h 7.2 (Berkeley) 4/21/91 - * $Id: vm_kern.h,v 1.2 1993/10/16 16:20:31 rgrimes Exp $ + * $Id: vm_kern.h,v 1.3 1993/11/07 17:54:14 wollman Exp $ */ /* @@ -87,4 +87,5 @@ extern vm_map_t mb_map; extern vm_map_t kmem_map; extern vm_map_t phys_map; extern vm_map_t buffer_map; + #endif /* _VM_VM_KERN_H_ */ diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index fb91152b89..57eac467b1 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_map.c 7.3 (Berkeley) 4/21/91 - * $Id: vm_map.c,v 1.7 1993/10/16 16:20:33 rgrimes Exp $ + * $Id: vm_map.c,v 1.8 1993/11/25 01:39:04 wollman Exp $ */ /* @@ -790,6 +790,7 @@ void vm_map_simplify_entry(map, entry) * This routine is called only when it is known that * the entry must be split. */ +static void _vm_map_clip_start(map, entry, start) register vm_map_t map; register vm_map_entry_t entry; @@ -834,7 +835,6 @@ void _vm_map_clip_start(map, entry, start) * it splits the entry into two. */ -void _vm_map_clip_end(); #define vm_map_clip_end(map, entry, endaddr) \ { \ if (endaddr < entry->end) \ @@ -845,6 +845,7 @@ void _vm_map_clip_end(); * This routine is called only when it is known that * the entry must be split. */ +static void _vm_map_clip_end(map, entry, end) register vm_map_t map; register vm_map_entry_t entry; diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h index 8f1334d5f1..6d5bb7ade1 100644 --- a/sys/vm/vm_map.h +++ b/sys/vm/vm_map.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_map.h 7.3 (Berkeley) 4/21/91 - * $Id$ + * $Id: vm_map.h,v 1.2 1993/10/16 16:20:36 rgrimes Exp $ */ /* @@ -176,22 +176,50 @@ typedef struct { /* * Exported procedures that operate on vm_map_t. */ +extern int vm_map_pageable(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); +extern void vm_map_startup(void); +struct pmap; struct vm_object; +extern vm_map_t vm_map_create(struct pmap *, vm_offset_t, vm_offset_t, + boolean_t); +extern void vm_map_init(struct vm_map *, vm_offset_t, vm_offset_t, boolean_t); +extern vm_map_entry_t vm_map_entry_create(vm_map_t); +extern void vm_map_entry_dispose(vm_map_t, vm_map_entry_t); +extern void vm_map_reference(vm_map_t); +extern void vm_map_deallocate(vm_map_t); +extern int vm_map_insert(vm_map_t, struct vm_object *, vm_offset_t, vm_offset_t, + vm_offset_t); +extern boolean_t vm_map_lookup_entry(vm_map_t, vm_offset_t, vm_map_entry_t *); +extern int vm_map_find(vm_map_t, struct vm_object *, vm_offset_t, vm_offset_t*, + vm_size_t, boolean_t); +extern void vm_map_simplify_entry(vm_map_t, vm_map_entry_t); +extern int vm_map_submap(vm_map_t, vm_offset_t, vm_offset_t, vm_map_t); +extern int vm_map_protect(vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t, + boolean_t); +extern int vm_map_inherit(vm_map_t, vm_offset_t, vm_offset_t, vm_inherit_t); +extern int vm_map_pageable(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); +extern void vm_map_entry_unwire(vm_map_t, vm_map_entry_t); +extern void vm_map_entry_delete(vm_map_t, vm_map_entry_t); +extern int vm_map_delete(vm_map_t, vm_offset_t, vm_offset_t); +extern int vm_map_remove(vm_map_t, vm_offset_t, vm_offset_t); +extern boolean_t vm_map_check_protection(vm_map_t, vm_offset_t, vm_offset_t, + vm_prot_t); +extern void vm_map_copy_entry(vm_map_t, vm_map_t, vm_map_entry_t, + vm_map_entry_t); +extern int vm_map_copy(vm_map_t, vm_map_t, vm_offset_t, vm_size_t, vm_offset_t, + boolean_t, boolean_t); +extern int vm_map_lookup(vm_map_t *, vm_offset_t, vm_prot_t, + vm_map_entry_t *, struct vm_object **, vm_offset_t *, + vm_prot_t *, boolean_t *, boolean_t *); +extern void vm_map_lookup_done(vm_map_t, vm_map_entry_t); +extern void vm_map_simplify(vm_map_t, vm_offset_t); +extern void vm_map_print(vm_map_t, boolean_t); /* f defined(DEBUG) || NDDB>0 */ + +extern int vm_fault(struct vm_map *, vm_offset_t, vm_prot_t, boolean_t); +extern void vm_fault_wire(struct vm_map *, vm_offset_t, vm_offset_t); +extern void vm_fault_unwire(struct vm_map *, vm_offset_t, vm_offset_t); +extern void vm_fault_copy_entry(vm_map_t, vm_map_t, vm_map_entry_t, + vm_map_entry_t); -void vm_map_init(); -vm_map_t vm_map_create(); -void vm_map_deallocate(); -void vm_map_reference(); -int vm_map_find(); -int vm_map_remove(); -int vm_map_lookup(); -void vm_map_lookup_done(); -int vm_map_protect(); -int vm_map_inherit(); -int vm_map_copy(); -void vm_map_print(); -void vm_map_copy_entry(); -boolean_t vm_map_verify(); -void vm_map_verify_done(); /* * Functions implemented as macros diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 173df036a7..f0c9f58792 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -37,7 +37,7 @@ * * from: Utah $Hdr: vm_mmap.c 1.3 90/01/21$ * from: @(#)vm_mmap.c 7.5 (Berkeley) 6/28/91 - * $Id: vm_mmap.c,v 1.14 1993/11/29 15:45:44 davidg Exp $ + * $Id: vm_mmap.c,v 1.15 1993/12/13 13:00:53 davidg Exp $ */ /* @@ -58,6 +58,10 @@ #include "vm_pager.h" #include "vm_prot.h" #include "vm_statistics.h" +#include "vm_user.h" + +static boolean_t vm_map_is_allocated(vm_map_t, vm_offset_t, vm_offset_t, + boolean_t); #ifdef DEBUG int mmapdebug = 0; @@ -861,7 +865,7 @@ vm_allocate_with_pager(map, addr, size, fitit, pager, poffset, internal) * * start and end should be page aligned. */ -boolean_t +static boolean_t vm_map_is_allocated(map, start, end, single_entry) vm_map_t map; vm_offset_t start, end; diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 77308eb1a9..8be0b4e10f 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_object.c 7.4 (Berkeley) 5/7/91 - * $Id: vm_object.c,v 1.9 1993/11/25 01:39:10 wollman Exp $ + * $Id: vm_object.c,v 1.10 1993/11/25 12:07:41 davidg Exp $ */ /* @@ -68,13 +68,14 @@ * Virtual memory object module. */ -#include "ddb.h" - #include "param.h" +#include "systm.h" #include "malloc.h" #include "vm.h" #include "vm_page.h" +#include "ddb.h" + static void _vm_object_allocate(vm_size_t, vm_object_t); static void vm_object_deactivate_pages(vm_object_t); diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 845874b6e6..765e83ac6d 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_object.h 7.3 (Berkeley) 4/21/91 - * $Id: vm_object.h,v 1.3 1993/11/07 17:54:20 wollman Exp $ + * $Id: vm_object.h,v 1.4 1993/11/25 01:39:11 wollman Exp $ */ /* @@ -171,5 +171,6 @@ void vm_object_print(); #endif /* VM_OBJECT_DEBUG */ extern void vm_object_page_clean(vm_object_t, vm_offset_t, vm_offset_t); +extern int pager_cache(vm_object_t, boolean_t); #endif /* _VM_OBJECT_ */ diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 495bed6458..fd24784af1 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_page.c 7.4 (Berkeley) 5/7/91 - * $Id: vm_page.c,v 1.3 1993/11/25 01:39:12 wollman Exp $ + * $Id: vm_page.c,v 1.4 1993/12/12 12:27:24 davidg Exp $ */ /* @@ -69,6 +69,7 @@ */ #include "param.h" +#include "systm.h" #include "vm.h" #include "vm_map.h" diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index f551c17e50..97032e1b5d 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_page.h 7.3 (Berkeley) 4/21/91 - * $Id: vm_page.h,v 1.3 1993/11/07 17:54:21 wollman Exp $ + * $Id: vm_page.h,v 1.4 1993/12/12 12:27:25 davidg Exp $ */ /* @@ -260,5 +260,25 @@ void vm_set_page_size(); #define vm_page_unlock_queues() simple_unlock(&vm_page_queue_lock) #define vm_page_set_modified(m) { (m)->clean = FALSE; } + +/* Some pmap things are declared here for the convenience of other bits of + code. */ +extern void pmap_bootstrap(vm_offset_t, vm_offset_t); +extern void pmap_init(vm_offset_t, vm_offset_t); +extern vm_offset_t pmap_map(vm_offset_t, vm_offset_t, vm_offset_t, int); +extern void pmap_remove_all(vm_offset_t); +extern void pmap_copy_on_write(vm_offset_t); +extern void pmap_page_protect(vm_offset_t, vm_prot_t); +extern void pmap_update(void); +extern void pmap_zero_page(vm_offset_t); +extern void pmap_copy_page(vm_offset_t, vm_offset_t); +extern void pmap_clear_modify(vm_offset_t); +extern void pmap_clear_reference(vm_offset_t); +extern boolean_t pmap_is_referenced(vm_offset_t); +extern boolean_t pmap_is_modified(vm_offset_t); +extern vm_offset_t pmap_phys_ddress(int); +extern boolean_t pmap_testbit(vm_offset_t, int); +extern void pmap_changebit(vm_offset_t, int, boolean_t); + #endif /* KERNEL */ #endif /* _VM_PAGE_ */ diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index b56589bc27..8501cab349 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_pageout.c 7.4 (Berkeley) 5/7/91 - * $Id: vm_pageout.c,v 1.5 1993/11/25 01:39:14 wollman Exp $ + * $Id: vm_pageout.c,v 1.6 1993/11/25 12:07:42 davidg Exp $ */ /* @@ -69,6 +69,7 @@ */ #include "param.h" +#include "systm.h" #include "vm.h" #include "vm_page.h" diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 033afd161d..5a2b1267ba 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_pager.c 7.4 (Berkeley) 5/7/91 - * $Id: vm_pager.c,v 1.4 1993/11/22 09:49:54 davidg Exp $ + * $Id: vm_pager.c,v 1.5 1993/11/25 01:39:15 wollman Exp $ */ /* @@ -70,6 +70,7 @@ */ #include "param.h" +#include "systm.h" #include "malloc.h" #include "vm.h" diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index a36832b5d6..32899be063 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)vm_pager.h 7.2 (Berkeley) 4/20/91 - * $Id$ + * $Id: vm_pager.h,v 1.2 1993/10/16 16:20:51 rgrimes Exp $ */ /* @@ -90,16 +90,17 @@ struct pagerops { #define VM_PAGER_HASPAGE(pg, o) (*(pg)->pg_ops->pgo_haspage)(pg, o) #ifdef KERNEL -vm_pager_t vm_pager_allocate(); -void vm_pager_deallocate(); -int vm_pager_get(); -int vm_pager_put(); -boolean_t vm_pager_has_page(); - -vm_offset_t vm_pager_map_page(); -void vm_pager_unmap_page(); -vm_pager_t vm_pager_lookup(); -void vm_pager_sync(); +extern void vm_pager_init(void); +extern vm_pager_t vm_pager_allocate(int, caddr_t, vm_size_t, vm_prot_t, int); +extern void vm_pager_deallocate(vm_pager_t); +struct vm_page; +extern int vm_pager_get(vm_pager_t, struct vm_page *, boolean_t); +extern int vm_pager_put(vm_pager_t, struct vm_page *, boolean_t); +extern boolean_t vm_pager_has_page(vm_pager_t, vm_offset_t); +extern void vm_pager_sync(void); +extern vm_offset_t vm_pager_map_page(struct vm_page *); +extern void vm_pager_unmap_page(vm_offset_t); +extern vm_pager_t vm_pager_lookup(queue_head_t *, caddr_t); extern struct pagerops *dfltpagerops; #endif diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c index bb1b0a1ef4..85427d7e71 100644 --- a/sys/vm/vm_swap.c +++ b/sys/vm/vm_swap.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)vm_swap.c 7.18 (Berkeley) 5/6/91 - * $Id: vm_swap.c,v 1.5 1993/11/17 23:27:04 wollman Exp $ + * $Id: vm_swap.c,v 1.6 1993/11/25 01:39:16 wollman Exp $ */ #include "param.h" @@ -45,6 +45,9 @@ #include "specdev.h" #include "file.h" #include "rlist.h" +#include "kernel.h" + +static int swfree(struct proc *, int); /* * Indirect driver for multi-controller paging. @@ -230,7 +233,7 @@ swapon(p, uap, retval) * space, which is laid out with blocks of dmmax pages circularly * among the devices. */ -int +static int swfree(p, index) struct proc *p; int index; diff --git a/sys/vm/vm_user.h b/sys/vm/vm_user.h index 1bfbcb6968..4baef11e0b 100644 --- a/sys/vm/vm_user.h +++ b/sys/vm/vm_user.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_user.h 7.2 (Berkeley) 4/21/91 - * $Id: vm_user.h,v 1.2 1993/10/16 16:21:00 rgrimes Exp $ + * $Id: vm_user.h,v 1.3 1993/11/07 17:54:29 wollman Exp $ */ /* @@ -71,23 +71,47 @@ #ifndef _VM_USER_ #define _VM_USER_ +#ifdef KERNEL + +#include "sys/cdefs.h" +#include "vm/vm_param.h" +#include "vm/vm_inherit.h" +#include "vm/vm_prot.h" + +struct vm_map; struct vm_object; struct pager_struct; + +extern int munmapfd(struct proc *, int); +extern int vm_mmap(struct vm_map *, vm_offset_t *, vm_size_t, vm_prot_t, + vm_prot_t, int, caddr_t, vm_offset_t); +extern int vm_region(struct vm_map *, vm_offset_t *, vm_size_t *, vm_prot_t *, + vm_prot_t *, vm_inherit_t *, boolean_t *, + struct vm_object **, + vm_offset_t *); +extern int vm_allocate_with_pager(struct vm_map *, vm_offset_t *, vm_size_t, + boolean_t, struct pager_struct *, + vm_offset_t, boolean_t); + + +extern int vm_allocate(struct vm_map *, vm_offset_t *, vm_size_t, boolean_t); +extern int vm_deallocate(struct vm_map *, vm_offset_t, vm_size_t); +extern int vm_inherit(struct vm_map *, vm_offset_t, vm_size_t, vm_inherit_t); +extern int vm_protect(struct vm_map *, vm_offset_t, vm_size_t, boolean_t, + vm_prot_t); + +#else /* not KERNEL */ #include +#include +#include +#include -#ifdef KERNEL -int vm_allocate(); -int vm_deallocate(); -int vm_inherit(); -int vm_protect(); -int vm_statistics(); -#else __BEGIN_DECLS -int vm_allocate(); -int vm_deallocate(); -int vm_inherit(); -int vm_protect(); +int vm_allocate __P((void *, vm_offset_t *, vm_size_t, boolean_t)); +int vm_deallocate __P((void *, vm_offset_t, vm_size_t)); +int vm_inherit __P((void *, vm_offset_t, vm_size_t, vm_inherit_t)); +int vm_protect __P((void *, vm_offset_t, vm_size_t, boolean_t, vm_prot_t)); __END_DECLS -#endif +#endif /* not KERNEL */ #endif /* _VM_USER_ */ diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index e102e06b25..f062bdda26 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)vnode_pager.c 7.5 (Berkeley) 4/20/91 - * $Id: vnode_pager.c,v 1.3 1993/11/07 17:54:30 wollman Exp $ + * $Id: vnode_pager.c,v 1.4 1993/11/25 01:39:19 wollman Exp $ */ /* @@ -50,6 +50,7 @@ #if NVNODEPAGER > 0 #include "param.h" +#include "systm.h" #include "proc.h" #include "malloc.h" #include "vnode.h" @@ -73,6 +74,8 @@ struct pagerops vnodepagerops = { vnode_pager_haspage }; +static int vnode_pager_io(vn_pager_t, vm_page_t, enum uio_rw); + queue_head_t vnode_pager_list; /* list of managed vnodes */ #ifdef DEBUG @@ -419,7 +422,7 @@ vnode_pager_uncache(vp) return(uncached); } -int +static int vnode_pager_io(vnp, m, rw) register vn_pager_t vnp; vm_page_t m; @@ -489,7 +492,7 @@ vnode_pager_io(vnp, m, rw) if (count == 0) error = EINVAL; else if (count != PAGE_SIZE && rw == UIO_READ) - bzero(kva + count, PAGE_SIZE - count); + bzero((caddr_t)(kva + count), PAGE_SIZE - count); } vm_pager_unmap_page(kva); return (error ? VM_PAGER_FAIL : VM_PAGER_OK); -- 2.20.1