From 8011f5df83da36ceeb1911635524c95894f83d3f Mon Sep 17 00:00:00 2001 From: Mike Karels Date: Mon, 24 Feb 1986 07:30:08 -0800 Subject: [PATCH] lint SCCS-vsn: sys/vax/vax/Locore.c 6.8 SCCS-vsn: sys/vax/vax/crl.c 1.3 SCCS-vsn: sys/vax/vax/ioa.h 1.3 SCCS-vsn: sys/vax/vax/locore.s 6.35 SCCS-vsn: sys/vax/vax/machdep.c 6.26 SCCS-vsn: sys/vax/vax/mem.c 6.4 SCCS-vsn: sys/vax/vax/trap.c 6.8 SCCS-vsn: sys/vax/vax/tu.c 6.7 SCCS-vsn: sys/kern/init_main.c 6.15 SCCS-vsn: sys/kern/kern_exec.c 6.17 SCCS-vsn: sys/kern/kern_fork.c 6.9 SCCS-vsn: sys/kern/kern_prot.c 6.8 SCCS-vsn: sys/kern/kern_sig.c 6.21 SCCS-vsn: sys/kern/kern_time.c 6.9 SCCS-vsn: sys/kern/subr_log.c 6.8 SCCS-vsn: sys/kern/subr_prf.c 6.12 SCCS-vsn: sys/kern/subr_xxx.c 6.7 SCCS-vsn: sys/kern/tty.c 6.26 SCCS-vsn: sys/kern/tty_pty.c 6.20 SCCS-vsn: sys/ufs/ffs/ffs_inode.c 6.19 SCCS-vsn: sys/ufs/ffs/ufs_inode.c 6.19 SCCS-vsn: sys/ufs/lfs/lfs_inode.c 6.19 SCCS-vsn: sys/ufs/ufs/ufs_inode.c 6.19 SCCS-vsn: sys/kern/vfs_lookup.c 6.28 SCCS-vsn: sys/ufs/ffs/ufs_lookup.c 6.28 SCCS-vsn: sys/ufs/ufs/ufs_lookup.c 6.28 SCCS-vsn: sys/kern/vfs_syscalls.c 6.22 SCCS-vsn: sys/ufs/ffs/ffs_vnops.c 6.22 SCCS-vsn: sys/ufs/ffs/ufs_vnops.c 6.22 SCCS-vsn: sys/ufs/lfs/lfs_vnops.c 6.22 SCCS-vsn: sys/ufs/ufs/ufs_vnops.c 6.22 SCCS-vsn: sys/kern/uipc_socket.c 6.23 SCCS-vsn: sys/kern/uipc_socket2.c 6.15 SCCS-vsn: sys/kern/uipc_syscalls.c 6.15 SCCS-vsn: sys/kern/uipc_usrreq.c 6.21 SCCS-vsn: sys/vax/uba/dmf.c 6.15 SCCS-vsn: sys/vax/uba/lp.c 6.8 SCCS-vsn: sys/vax/uba/lpa.c 6.4 SCCS-vsn: sys/vax/uba/ps.c 6.7 SCCS-vsn: sys/vax/uba/rl.c 6.7 SCCS-vsn: sys/vax/uba/tm.c 6.10 SCCS-vsn: sys/vax/uba/tmscp.c 5.4 SCCS-vsn: sys/vax/uba/uba.c 6.10 SCCS-vsn: sys/vax/uba/uda.c 6.19 SCCS-vsn: sys/vax/uba/up.c 6.10 SCCS-vsn: sys/vax/uba/ut.c 6.8 SCCS-vsn: sys/vax/mba/hp.c 6.20 SCCS-vsn: sys/vax/mba/mba.c 6.8 SCCS-vsn: sys/vax/mba/mt.c 6.6 SCCS-vsn: sys/net/if_sl.c 5.3 SCCS-vsn: sys/net/raw_usrreq.c 6.13 SCCS-vsn: sys/netinet/if_ether.c 6.17 SCCS-vsn: sys/netinet/in.c 6.13 SCCS-vsn: sys/netinet/in.h 6.10 SCCS-vsn: sys/netinet/in_pcb.c 6.14 SCCS-vsn: sys/netinet/in_var.h 6.4 SCCS-vsn: sys/netinet/ip_icmp.c 6.16 SCCS-vsn: sys/netinet/ip_input.c 6.20 SCCS-vsn: sys/netinet/ip_output.c 6.13 SCCS-vsn: sys/netinet/raw_ip.c 6.8 SCCS-vsn: sys/netinet/tcp_input.c 6.21 SCCS-vsn: sys/netinet/tcp_output.c 6.14 SCCS-vsn: sys/netinet/tcp_usrreq.c 6.10 SCCS-vsn: sys/netns/ns_error.c 6.7 SCCS-vsn: sys/netns/ns_output.c 6.10 SCCS-vsn: sys/vax/if/if_ddn.c 6.5 SCCS-vsn: sys/vax/if/if_ec.c 6.18 SCCS-vsn: sys/vax/if/if_ex.c 6.14 SCCS-vsn: sys/vax/if/if_hdh.c 6.6 SCCS-vsn: sys/vax/if/if_hy.c 6.9 SCCS-vsn: sys/vax/if/if_uba.c 6.11 SCCS-vsn: sys/vax/if/if_uba.h 6.6 SCCS-vsn: sys/vax/if/if_vv.c 6.18 --- usr/src/sys/kern/init_main.c | 4 +- usr/src/sys/kern/kern_exec.c | 21 ++- usr/src/sys/kern/kern_fork.c | 6 +- usr/src/sys/kern/kern_prot.c | 4 +- usr/src/sys/kern/kern_sig.c | 14 +- usr/src/sys/kern/kern_time.c | 5 +- usr/src/sys/kern/subr_log.c | 4 +- usr/src/sys/kern/subr_prf.c | 4 +- usr/src/sys/kern/subr_xxx.c | 8 +- usr/src/sys/kern/tty.c | 10 +- usr/src/sys/kern/tty_pty.c | 6 +- usr/src/sys/kern/uipc_socket.c | 4 +- usr/src/sys/kern/uipc_socket2.c | 8 +- usr/src/sys/kern/uipc_syscalls.c | 10 +- usr/src/sys/kern/uipc_usrreq.c | 4 +- usr/src/sys/kern/vfs_lookup.c | 7 +- usr/src/sys/kern/vfs_syscalls.c | 10 +- usr/src/sys/net/if_sl.c | 298 +++++++++++++++++++------------ usr/src/sys/net/raw_usrreq.c | 4 +- usr/src/sys/netinet/if_ether.c | 6 +- usr/src/sys/netinet/in.c | 13 +- usr/src/sys/netinet/in.h | 16 +- usr/src/sys/netinet/in_pcb.c | 8 +- usr/src/sys/netinet/in_var.h | 6 +- usr/src/sys/netinet/ip_icmp.c | 6 +- usr/src/sys/netinet/ip_input.c | 20 +-- usr/src/sys/netinet/ip_output.c | 26 +-- usr/src/sys/netinet/raw_ip.c | 6 +- usr/src/sys/netinet/tcp_input.c | 6 +- usr/src/sys/netinet/tcp_output.c | 6 +- usr/src/sys/netinet/tcp_usrreq.c | 4 +- usr/src/sys/netns/ns_error.c | 5 +- usr/src/sys/netns/ns_output.c | 4 +- usr/src/sys/ufs/ffs/ffs_inode.c | 8 +- usr/src/sys/ufs/ffs/ffs_vnops.c | 10 +- usr/src/sys/ufs/ffs/ufs_inode.c | 8 +- usr/src/sys/ufs/ffs/ufs_lookup.c | 7 +- usr/src/sys/ufs/ffs/ufs_vnops.c | 10 +- usr/src/sys/ufs/lfs/lfs_inode.c | 8 +- usr/src/sys/ufs/lfs/lfs_vnops.c | 10 +- usr/src/sys/ufs/ufs/ufs_inode.c | 8 +- usr/src/sys/ufs/ufs/ufs_lookup.c | 7 +- usr/src/sys/ufs/ufs/ufs_vnops.c | 10 +- usr/src/sys/vax/if/if_ddn.c | 20 +-- usr/src/sys/vax/if/if_ec.c | 6 +- usr/src/sys/vax/if/if_ex.c | 15 +- usr/src/sys/vax/if/if_hdh.c | 5 +- usr/src/sys/vax/if/if_hy.c | 8 +- usr/src/sys/vax/if/if_uba.c | 10 +- usr/src/sys/vax/if/if_uba.h | 6 +- usr/src/sys/vax/if/if_vv.c | 6 +- usr/src/sys/vax/mba/hp.c | 18 +- usr/src/sys/vax/mba/mba.c | 4 +- usr/src/sys/vax/mba/mt.c | 19 +- usr/src/sys/vax/uba/dmf.c | 43 +++-- usr/src/sys/vax/uba/lp.c | 13 +- usr/src/sys/vax/uba/lpa.c | 16 +- usr/src/sys/vax/uba/ps.c | 10 +- usr/src/sys/vax/uba/rl.c | 4 +- usr/src/sys/vax/uba/tm.c | 4 +- usr/src/sys/vax/uba/tmscp.c | 29 +-- usr/src/sys/vax/uba/uba.c | 18 +- usr/src/sys/vax/uba/uda.c | 41 ++--- usr/src/sys/vax/uba/up.c | 4 +- usr/src/sys/vax/uba/ut.c | 4 +- usr/src/sys/vax/vax/Locore.c | 10 +- usr/src/sys/vax/vax/crl.c | 5 +- usr/src/sys/vax/vax/ioa.h | 5 +- usr/src/sys/vax/vax/locore.s | 6 +- usr/src/sys/vax/vax/machdep.c | 4 +- usr/src/sys/vax/vax/mem.c | 7 +- usr/src/sys/vax/vax/trap.c | 6 +- usr/src/sys/vax/vax/tu.c | 24 +-- 73 files changed, 545 insertions(+), 474 deletions(-) diff --git a/usr/src/sys/kern/init_main.c b/usr/src/sys/kern/init_main.c index 13bb6a9426..0442746ddc 100644 --- a/usr/src/sys/kern/init_main.c +++ b/usr/src/sys/kern/init_main.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)init_main.c 6.14 (Berkeley) %G% + * @(#)init_main.c 6.15 (Berkeley) %G% */ #include "../machine/pte.h" @@ -163,7 +163,7 @@ main(firstaddr) proc[0].p_szpt = CLSIZE; if (newproc(0)) { expand(clrnd((int)btoc(szicode)), 0); - (void) swpexpand(u.u_dsize, 0, &u.u_dmap, &u.u_smap); + (void) swpexpand(u.u_dsize, (size_t)0, &u.u_dmap, &u.u_smap); (void) copyout((caddr_t)icode, (caddr_t)0, (unsigned)szicode); /* * Return goes to loc. 0 of user init diff --git a/usr/src/sys/kern/kern_exec.c b/usr/src/sys/kern/kern_exec.c index 0c45f3fbee..bb9ed6a2fb 100644 --- a/usr/src/sys/kern/kern_exec.c +++ b/usr/src/sys/kern/kern_exec.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)kern_exec.c 6.16 (Berkeley) %G% + * @(#)kern_exec.c 6.17 (Berkeley) %G% */ #include "../machine/reg.h" @@ -52,7 +52,8 @@ execve() register char *cp; register struct buf *bp; register struct execa *uap; - int na, ne, ucp, ap, len, cc; + int na, ne, ucp, ap, cc; + unsigned len; int indir, uid, gid; char *sharg; struct inode *ip; @@ -109,7 +110,7 @@ execve() */ exdata.ex_shell[0] = '\0'; /* for zero length files */ u.u_error = rdwri(UIO_READ, ip, (caddr_t)&exdata, sizeof (exdata), - 0, 1, &resid); + (off_t)0, 1, &resid); if (u.u_error) goto bad; #ifndef lint @@ -246,10 +247,11 @@ execve() cp = bp->b_un.b_addr; } if (sharg) { - error = copystr(sharg, cp, cc, &len); + error = copystr(sharg, cp, (unsigned)cc, &len); sharg += len; } else { - error = copyinstr((caddr_t)ap, cp, cc, &len); + error = copyinstr((caddr_t)ap, cp, (unsigned)cc, + &len); ap += len; } cp += len; @@ -313,7 +315,8 @@ badarg: bp->b_flags &= ~B_DELWRI; /* cancel io */ cp = bp->b_un.b_addr; } - error = copyoutstr(cp, (caddr_t)ucp, cc, &len); + error = copyoutstr(cp, (caddr_t)ucp, (unsigned)cc, + &len); ucp += len; cp += len; nc += len; @@ -329,7 +332,7 @@ badarg: * remain held through p_sigmask. */ while (u.u_procp->p_sigcatch) { - nc = ffs(u.u_procp->p_sigcatch); + nc = ffs((long)u.u_procp->p_sigcatch); u.u_procp->p_sigcatch &= ~sigmask(nc); u.u_signal[nc] = SIG_DFL; } @@ -457,13 +460,13 @@ getxfile(ip, ep, nargc, uid, gid) rdwri(UIO_READ, ip, (char *)ctob(dptov(u.u_procp, 0)), (int)ep->a_data, - (int)(sizeof (struct exec) + ep->a_text), + (off_t)(sizeof (struct exec) + ep->a_text), 0, (int *)0); xalloc(ip, ep, pagi); if (pagi && u.u_procp->p_textp) vinifod((struct fpte *)dptopte(u.u_procp, 0), PG_FTEXT, u.u_procp->p_textp->x_iptr, - (long)(1 + ts/CLSIZE), (int)btoc(ep->a_data)); + (long)(1 + ts/CLSIZE), (size_t)btoc(ep->a_data)); #ifdef vax /* THIS SHOULD BE DONE AT A LOWER LEVEL, IF AT ALL */ diff --git a/usr/src/sys/kern/kern_fork.c b/usr/src/sys/kern/kern_fork.c index efe13babb0..1693853a78 100644 --- a/usr/src/sys/kern/kern_fork.c +++ b/usr/src/sys/kern/kern_fork.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)kern_fork.c 6.8 (Berkeley) %G% + * @(#)kern_fork.c 6.9 (Berkeley) %G% */ #include "../machine/reg.h" @@ -73,8 +73,8 @@ fork1(isvfork) if (p2==NULL || (u.u_uid!=0 && (p2->p_nxt == NULL || a>MAXUPRC))) { u.u_error = EAGAIN; if (!isvfork) { - (void) vsexpand(0, &u.u_cdmap, 1); - (void) vsexpand(0, &u.u_csmap, 1); + (void) vsexpand((size_t)0, &u.u_cdmap, 1); + (void) vsexpand((size_t)0, &u.u_csmap, 1); } goto out; } diff --git a/usr/src/sys/kern/kern_prot.c b/usr/src/sys/kern/kern_prot.c index e2c5ebf556..005ab26ad7 100644 --- a/usr/src/sys/kern/kern_prot.c +++ b/usr/src/sys/kern/kern_prot.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)kern_prot.c 6.7 (Berkeley) %G% + * @(#)kern_prot.c 6.8 (Berkeley) %G% */ /* @@ -139,7 +139,7 @@ setreuid() #ifdef QUOTA if (u.u_quota->q_uid != ruid) { qclean(); - qstart(getquota(ruid, 0, 0)); + qstart(getquota((uid_t)ruid, 0, 0)); } #endif u.u_procp->p_uid = euid; diff --git a/usr/src/sys/kern/kern_sig.c b/usr/src/sys/kern/kern_sig.c index 3b6ba1c88b..614642a0f5 100644 --- a/usr/src/sys/kern/kern_sig.c +++ b/usr/src/sys/kern/kern_sig.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)kern_sig.c 6.20 (Berkeley) %G% + * @(#)kern_sig.c 6.21 (Berkeley) %G% */ #include "../machine/reg.h" @@ -533,7 +533,7 @@ issig() sigbits &= ~stopsigmask; if (sigbits == 0) break; - sig = ffs(sigbits); + sig = ffs((long)sigbits); mask = sigmask(sig); p->p_sig &= ~mask; /* take the signal! */ p->p_cursig = sig; @@ -789,17 +789,17 @@ core() u.u_error = rdwri(UIO_WRITE, ip, (caddr_t)&u, ctob(UPAGES), - 0, 1, (int *)0); + (off_t)0, 1, (int *)0); if (u.u_error == 0) u.u_error = rdwri(UIO_WRITE, ip, (caddr_t)ctob(dptov(u.u_procp, 0)), - ctob(u.u_dsize), - ctob(UPAGES), 0, (int *)0); + (int)ctob(u.u_dsize), + (off_t)ctob(UPAGES), 0, (int *)0); if (u.u_error == 0) u.u_error = rdwri(UIO_WRITE, ip, (caddr_t)ctob(sptov(u.u_procp, u.u_ssize - 1)), - ctob(u.u_ssize), - ctob(UPAGES)+ctob(u.u_dsize), 0, (int *)0); + (int)ctob(u.u_ssize), + (off_t)ctob(UPAGES)+ctob(u.u_dsize), 0, (int *)0); out: iput(ip); return (u.u_error == 0); diff --git a/usr/src/sys/kern/kern_time.c b/usr/src/sys/kern/kern_time.c index db3d21af39..1f79805cf9 100644 --- a/usr/src/sys/kern/kern_time.c +++ b/usr/src/sys/kern/kern_time.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)kern_time.c 6.8 (Berkeley) %G% + * @(#)kern_time.c 6.9 (Berkeley) %G% */ #include "../machine/reg.h" @@ -186,7 +186,8 @@ setitimer() } if (aitvp == 0) return; - u.u_error = copyin(aitvp, (caddr_t)&aitv, sizeof (struct itimerval)); + u.u_error = copyin((caddr_t)aitvp, (caddr_t)&aitv, + sizeof (struct itimerval)); if (u.u_error) return; if (itimerfix(&aitv.it_value) || itimerfix(&aitv.it_interval)) { diff --git a/usr/src/sys/kern/subr_log.c b/usr/src/sys/kern/subr_log.c index 48502d8c87..6c2ff584a6 100644 --- a/usr/src/sys/kern/subr_log.c +++ b/usr/src/sys/kern/subr_log.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)subr_log.c 6.7 (Berkeley) %G% + * @(#)subr_log.c 6.8 (Berkeley) %G% */ /* @@ -94,7 +94,7 @@ logread(dev, uio) l = msgbuf.msg_bufx - msgbuf.msg_bufr; if (l < 0) l = MSG_BSIZE - msgbuf.msg_bufr; - l = min(l, uio->uio_resid); + l = MIN(l, uio->uio_resid); if (l == 0) break; error = uiomove((caddr_t)&msgbuf.msg_bufc[msgbuf.msg_bufr], diff --git a/usr/src/sys/kern/subr_prf.c b/usr/src/sys/kern/subr_prf.c index 4fb91dfb07..338364b8c3 100644 --- a/usr/src/sys/kern/subr_prf.c +++ b/usr/src/sys/kern/subr_prf.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)subr_prf.c 6.11 (Berkeley) %G% + * @(#)subr_prf.c 6.12 (Berkeley) %G% */ #include "param.h" @@ -141,7 +141,7 @@ logpri(level) { putchar('<', TOLOG, (struct tty *)0); - printn(level, 10, TOLOG, (struct tty *)0); + printn((u_long)level, 10, TOLOG, (struct tty *)0); putchar('>', TOLOG, (struct tty *)0); } diff --git a/usr/src/sys/kern/subr_xxx.c b/usr/src/sys/kern/subr_xxx.c index 13e90aa84d..10ec341ee7 100644 --- a/usr/src/sys/kern/subr_xxx.c +++ b/usr/src/sys/kern/subr_xxx.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)subr_xxx.c 6.6 (Berkeley) %G% + * @(#)subr_xxx.c 6.7 (Berkeley) %G% */ #include "../machine/pte.h" @@ -40,7 +40,7 @@ nulldev() return (0); } -#ifndef vax +#ifdef notdef imin(a, b) { @@ -68,7 +68,7 @@ max(a, b) return (a > b ? a : b); } -#endif not vax +#endif notdef extern cabase, calimit; extern struct pte camap[]; @@ -105,6 +105,7 @@ calloc(size) return (res); } +#ifdef notdef /* * Stub routine in case it is ever possible to free space. */ @@ -114,6 +115,7 @@ cfreemem(cp, size) { printf("freeing %x, size %d\n", cp, size); } +#endif #ifndef vax ffs(mask) diff --git a/usr/src/sys/kern/tty.c b/usr/src/sys/kern/tty.c index 887cc2146e..45fdd03d64 100644 --- a/usr/src/sys/kern/tty.c +++ b/usr/src/sys/kern/tty.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)tty.c 6.25 (Berkeley) %G% + * @(#)tty.c 6.26 (Berkeley) %G% */ #include "../machine/reg.h" @@ -1066,9 +1066,11 @@ ttyoutput(c, tp) case NEWLINE: ctype = (tp->t_flags >> 8) & 03; if (ctype == 1) { /* tty 37 */ - if (*colp > 0) - c = max((((unsigned)*colp) >> 4) + 3, - (unsigned)6); + if (*colp > 0) { + c = (((unsigned)*colp) >> 4) + 3; + if ((unsigned)c > 6) + c = 6; + } } else if (ctype == 2) /* vt05 */ c = mstohz(100); *colp = 0; diff --git a/usr/src/sys/kern/tty_pty.c b/usr/src/sys/kern/tty_pty.c index 7c92c2e269..7f05de6c15 100644 --- a/usr/src/sys/kern/tty_pty.c +++ b/usr/src/sys/kern/tty_pty.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)tty_pty.c 6.19 (Berkeley) %G% + * @(#)tty_pty.c 6.20 (Berkeley) %G% */ /* @@ -244,14 +244,14 @@ ptcread(dev, uio) for (;;) { if (tp->t_state&TS_ISOPEN) { if (pti->pt_flags&PF_PKT && pti->pt_send) { - error = ureadc(pti->pt_send, uio); + error = ureadc((int)pti->pt_send, uio); if (error) return (error); pti->pt_send = 0; return (0); } if (pti->pt_flags&PF_UCNTL && pti->pt_ucntl) { - error = ureadc(pti->pt_ucntl, uio); + error = ureadc((int)pti->pt_ucntl, uio); if (error) return (error); pti->pt_ucntl = 0; diff --git a/usr/src/sys/kern/uipc_socket.c b/usr/src/sys/kern/uipc_socket.c index 6a999be2a2..be3b0ea258 100644 --- a/usr/src/sys/kern/uipc_socket.c +++ b/usr/src/sys/kern/uipc_socket.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)uipc_socket.c 6.22 (Berkeley) %G% + * @(#)uipc_socket.c 6.23 (Berkeley) %G% */ #include "param.h" @@ -781,7 +781,7 @@ sogetopt(so, level, optname, mp) break; default: - m_free(m); + (void)m_free(m); return (ENOPROTOOPT); } *mp = m; diff --git a/usr/src/sys/kern/uipc_socket2.c b/usr/src/sys/kern/uipc_socket2.c index f90ca1910d..312b1ecfb0 100644 --- a/usr/src/sys/kern/uipc_socket2.c +++ b/usr/src/sys/kern/uipc_socket2.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)uipc_socket2.c 6.14 (Berkeley) %G% + * @(#)uipc_socket2.c 6.15 (Berkeley) %G% */ #include "param.h" @@ -554,7 +554,7 @@ sbflush(sb) if (sb->sb_flags & SB_LOCK) panic("sbflush"); while (sb->sb_mbcnt) - sbdrop(sb, sb->sb_cc); + sbdrop(sb, (int)sb->sb_cc); if (sb->sb_cc || sb->sb_mbcnt || sb->sb_mb) panic("sbflush 2"); } @@ -562,7 +562,6 @@ sbflush(sb) /* * Drop data from (the front of) a sockbuf. */ -struct mbuf * sbdrop(sb, len) register struct sockbuf *sb; register int len; @@ -600,14 +599,12 @@ sbdrop(sb, len) m->m_act = next; } else sb->sb_mb = next; - return (sb->sb_mb); } /* * Drop a record off the front of a sockbuf * and move the next record to the front. */ -struct mbuf * sbdroprecord(sb) register struct sockbuf *sb; { @@ -621,5 +618,4 @@ sbdroprecord(sb) MFREE(m, mn); } while (m = mn); } - return (sb->sb_mb); } diff --git a/usr/src/sys/kern/uipc_syscalls.c b/usr/src/sys/kern/uipc_syscalls.c index baef35c637..6ef219909f 100644 --- a/usr/src/sys/kern/uipc_syscalls.c +++ b/usr/src/sys/kern/uipc_syscalls.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)uipc_syscalls.c 6.14 (Berkeley) %G% + * @(#)uipc_syscalls.c 6.15 (Berkeley) %G% */ #include "param.h" @@ -275,9 +275,9 @@ free3: fp1->f_count = 0; u.u_ofile[sv[0]] = 0; free2: - soclose(so2); + (void)soclose(so2); free: - soclose(so1); + (void)soclose(so1); } sendto() @@ -700,9 +700,9 @@ free3: rf->f_count = 0; u.u_ofile[r] = 0; free2: - soclose(wso); + (void)soclose(wso); free: - soclose(rso); + (void)soclose(rso); } /* diff --git a/usr/src/sys/kern/uipc_usrreq.c b/usr/src/sys/kern/uipc_usrreq.c index 6b63703e18..c07b93ac8b 100644 --- a/usr/src/sys/kern/uipc_usrreq.c +++ b/usr/src/sys/kern/uipc_usrreq.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)uipc_usrreq.c 6.20 (Berkeley) %G% + * @(#)uipc_usrreq.c 6.21 (Berkeley) %G% */ #include "param.h" @@ -195,7 +195,7 @@ uipc_usrreq(so, req, m, nam, rights) * Wake up readers. */ if (rights) - sbappendrights(rcv, m, rights); + (void)sbappendrights(rcv, m, rights); else sbappend(rcv, m); snd->sb_mbmax -= diff --git a/usr/src/sys/kern/vfs_lookup.c b/usr/src/sys/kern/vfs_lookup.c index feec207a65..07cb4b785b 100644 --- a/usr/src/sys/kern/vfs_lookup.c +++ b/usr/src/sys/kern/vfs_lookup.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)vfs_lookup.c 6.27 (Berkeley) %G% + * @(#)vfs_lookup.c 6.28 (Berkeley) %G% */ #include "param.h" @@ -785,7 +785,7 @@ haveino: ovbcopy(cp, nbp->b_un.b_addr + dp->i_size, pathlen); u.u_error = rdwri(UIO_READ, dp, nbp->b_un.b_addr, (int)dp->i_size, - 0, 1, (int *)0); + (off_t)0, 1, (int *)0); if (u.u_error) goto bad2; cp = nbp->b_un.b_addr; @@ -1017,8 +1017,7 @@ dirremove(ndp) /* * Collapse new free space into previous entry. */ - bp = blkatoff(dp, (int)(ndp->ni_offset - ndp->ni_count), - (char **)&ep); + bp = blkatoff(dp, ndp->ni_offset - ndp->ni_count, (char **)&ep); if (bp == 0) return (0); ep->d_reclen += ndp->ni_dent.d_reclen; diff --git a/usr/src/sys/kern/vfs_syscalls.c b/usr/src/sys/kern/vfs_syscalls.c index 42cea13be1..2d2d27a1e9 100644 --- a/usr/src/sys/kern/vfs_syscalls.c +++ b/usr/src/sys/kern/vfs_syscalls.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)vfs_syscalls.c 6.21 (Berkeley) %G% + * @(#)vfs_syscalls.c 6.22 (Berkeley) %G% */ #include "param.h" @@ -331,7 +331,8 @@ symlink() ip = maknode(IFLNK | 0777, ndp); if (ip == NULL) return; - u.u_error = rdwri(UIO_WRITE, ip, uap->target, nc, 0, 0, (int *)0); + u.u_error = rdwri(UIO_WRITE, ip, uap->target, nc, (off_t)0, 0, + (int *)0); /* handle u.u_error != 0 */ iput(ip); } @@ -516,7 +517,8 @@ readlink() u.u_error = EINVAL; goto out; } - u.u_error = rdwri(UIO_READ, ip, uap->buf, uap->count, 0, 0, &resid); + u.u_error = rdwri(UIO_READ, ip, uap->buf, uap->count, (off_t)0, 0, + &resid); out: iput(ip); u.u_r.r_val1 = uap->count - resid; @@ -664,7 +666,7 @@ chown1(ip, uid, gid) #ifdef QUOTA ip->i_dquot = inoquota(ip); (void) chkdq(ip, change, 1); - (void) chkiq(ip->i_dev, (struct inode *)NULL, uid, 1); + (void) chkiq(ip->i_dev, (struct inode *)NULL, (uid_t)uid, 1); return (u.u_error); /* should == 0 ALWAYS !! */ #else return (0); diff --git a/usr/src/sys/net/if_sl.c b/usr/src/sys/net/if_sl.c index 8f3cd32fbf..a21e972ebc 100644 --- a/usr/src/sys/net/if_sl.c +++ b/usr/src/sys/net/if_sl.c @@ -1,4 +1,4 @@ -/* @(#)if_sl.c 5.2 (Berkeley) %G% */ +/* @(#)if_sl.c 5.3 (Berkeley) %G% */ /* * Serial Line interface @@ -11,16 +11,13 @@ * rick@seismo.ARPA * seismo!rick * - * Some things done here could obviously be done in a better way, - * but they were done this way to minimize the number of files - * that had to be changed to accomodate this device. - * * Pounded on heavily by Chris Torek (chris@mimsy.umd.edu, umcp-cs!chris). - * N.B.: this belongs in netinet, not vaxif, the way it stands now. + * N.B.: this belongs in netinet, not net, the way it stands now. * Should have a link-layer type designation, but wouldn't be * backwards-compatible. * * Converted to 4.3BSD Beta by Chris Torek. + * Other changes made at Berkeley, based in part on code by Kirk Smith. */ /* $Header: if_sl.c,v 1.12 85/12/20 21:54:55 chris Exp $ */ @@ -32,29 +29,34 @@ #include "param.h" #include "mbuf.h" #include "buf.h" +#include "dk.h" #include "socket.h" #include "ioctl.h" +#include "file.h" #include "tty.h" #include "errno.h" -#include "../net/if.h" -#include "../net/netisr.h" -#include "../net/route.h" +#include "if.h" +#include "netisr.h" +#include "route.h" +#if INET #include "../netinet/in.h" #include "../netinet/in_systm.h" #include "../netinet/ip.h" #include "../netinet/ip_var.h" +#endif #ifdef vax #include "../vax/mtpr.h" #endif vax /* - * N.B.: SLMTU is now a hard limit on input packet size. Some limit - * is required, lest we use up all mbufs in the case of deleterious data - * dribbling down the line. + * N.B.: SLMTU is now a hard limit on input packet size. + * SLMTU must be <= CLBYTES - sizeof(struct ifnet *). */ #define SLMTU 1006 +#define SLIP_HIWAT 1000 /* don't start a new packet if HIWAT on queue */ +#define CLISTRESERVE 1000 /* Can't let clists get too low */ struct sl_softc { struct ifnet sc_if; /* network-visible interface */ @@ -62,7 +64,7 @@ struct sl_softc { short sc_ilen; /* length of input-packet-so-far */ struct tty *sc_ttyp; /* pointer to tty structure */ char *sc_mp; /* pointer to next available buf char */ - char sc_buf[SLMTU]; /* input buffer */ + char *sc_buf; /* input buffer */ } sl_softc[NSL]; /* flags */ @@ -102,6 +104,7 @@ slattach() * Line specific open routine. * Attach the given tty to the first available sl unit. */ +/* ARGSUSED */ slopen(dev, tp) dev_t dev; register struct tty *tp; @@ -109,20 +112,24 @@ slopen(dev, tp) register struct sl_softc *sc; register int nsl; - if (tp->t_sc != NULL) + if (!suser()) + return (EPERM); + if (tp->t_line == SLIPDISC) return (EBUSY); for (nsl = 0, sc = sl_softc; nsl < NSL; nsl++, sc++) if (sc->sc_ttyp == NULL) { sc->sc_flags = 0; sc->sc_ilen = 0; - sc->sc_mp = sc->sc_buf; + if (slinit(sc) == 0) + return (ENOBUFS); tp->t_sc = (caddr_t)sc; sc->sc_ttyp = tp; + ttyflush(tp, FREAD | FWRITE); return (0); } - return (ENOSPC); + return (ENXIO); } /* @@ -144,6 +151,8 @@ slclose(tp) if_down(&sc->sc_if); sc->sc_ttyp = NULL; tp->t_sc = NULL; + MCLFREE((struct mbuf *)sc->sc_buf); + sc->sc_buf = 0; } splx(s); } @@ -152,6 +161,7 @@ slclose(tp) * Line specific (tty) ioctl routine. * Provide a way to get the sl unit number. */ +/* ARGSUSED */ sltioctl(tp, cmd, data, flag) struct tty *tp; caddr_t data; @@ -196,7 +206,7 @@ sloutput(ifp, m, dst) IF_DROP(&ifp->if_snd); splx(s); m_freem(m); - sc->sc_if.if_collisions++; + sc->sc_if.if_oerrors++; return (ENOBUFS); } IF_ENQUEUE(&ifp->if_snd, m); @@ -218,105 +228,151 @@ slstart(tp) { register struct sl_softc *sc = (struct sl_softc *)tp->t_sc; register struct mbuf *m; - register int c, len; - register u_char *mcp; - int flush; + register int len; + register u_char *cp; + int flush, nd, np, n, s; + struct mbuf *m2; + extern int cfreecount; - /* - * If there is more in the output queue, just send it now. - * We are being called in lieu of ttstart and must do what - * it would. - */ - if (tp->t_outq.c_cc > 0) { - ttstart(tp); - return; - } + for (;;) { + /* + * If there is more in the output queue, just send it now. + * We are being called in lieu of ttstart and must do what + * it would. + */ + if (tp->t_outq.c_cc > 0) + ttstart(tp); + if (tp->t_outq.c_cc > SLIP_HIWAT) + return; - /* - * This happens briefly when the line shuts down. - */ - if (sc == NULL) - return; + /* + * This happens briefly when the line shuts down. + */ + if (sc == NULL) + return; - /* - * Get a packet and map it to the interface. - */ - c = splimp(); - IF_DEQUEUE(&sc->sc_if.if_snd, m); - if (m == NULL) { - sc->sc_flags &= ~SC_OACTIVE; - splx(c); - return; - } - flush = !(sc->sc_flags & SC_OACTIVE); - sc->sc_flags |= SC_OACTIVE; - splx(c); + /* + * If system is getting low on clists + * and we have something running already, stop here. + */ + if (cfreecount < CLISTRESERVE + SLMTU && + sc->sc_flags & SC_OACTIVE) + return; - /* - * The extra FRAME_END will start up a new packet, and thus - * will flush any accumulated garbage. We do this whenever - * the line may have been idle for some time. - */ - if (flush) - (void) putc(FRAME_END, &tp->t_outq); - - while (m != NULL) { - len = m->m_len; - mcp = mtod(m, u_char *); - while (--len >= 0) { - c = *mcp++; - if (c == FRAME_ESCAPE || c == FRAME_END) { - if (putc(FRAME_ESCAPE, &tp->t_outq)) - goto full; - c = c == FRAME_ESCAPE ? TRANS_FRAME_ESCAPE : - TRANS_FRAME_END; - if (putc(c, &tp->t_outq)) { - (void) unputc(&tp->t_outq); - goto full; - } - } else - if (putc(c, &tp->t_outq)) - goto full; + /* + * Get a packet and send it to the interface. + */ + s = splimp(); + IF_DEQUEUE(&sc->sc_if.if_snd, m); + if (m == NULL) { + if (tp->t_outq.c_cc == 0) + sc->sc_flags &= ~SC_OACTIVE; + splx(s); + return; } - m = m_free(m); - } + flush = !(sc->sc_flags & SC_OACTIVE); + sc->sc_flags |= SC_OACTIVE; + splx(s); - if (putc(FRAME_END, &tp->t_outq)) { -full: /* - * If you get many oerrors (more than one or two a day) - * you probably do not have enough clists and you should - * increase "nclist" in param.c. + * The extra FRAME_END will start up a new packet, and thus + * will flush any accumulated garbage. We do this whenever + * the line may have been idle for some time. */ - (void) unputc(&tp->t_outq); /* make room */ - putc(FRAME_END, &tp->t_outq); /* end the packet */ - sc->sc_if.if_oerrors++; - } else - sc->sc_if.if_opackets++; + if (flush) + (void) putc(FRAME_END, &tp->t_outq); + + while (m) { + cp = mtod(m, u_char *); + len = m->m_len; + while (len > 0) { + /* + * Find out how many bytes in the string we can + * handle without doing something special. + */ + nd = locc(FRAME_ESCAPE, len, cp); + np = locc(FRAME_END, len, cp); + n = len - MAX(nd, np); + if (n) { + /* + * Put n characters at once + * into the tty output queue. + */ + if (b_to_q((char *)cp, n, &tp->t_outq)) + break; + } + /* + * If there are characters left in the mbuf, + * the first one must be special.. + * Put it out in a different form. + */ + if (len) { + if (putc(FRAME_ESCAPE, &tp->t_outq)) + break; + if (putc(*cp == FRAME_ESCAPE ? + TRANS_FRAME_ESCAPE : TRANS_FRAME_END, + &tp->t_outq)) { + (void) unputc(&tp->t_outq); + break; + } + cp++; + len--; + } + } + MFREE(m, m2); + m = m2; + } - /* - * Start transmission. Note that slstart, not ttstart, will be - * called when the transmission completes, be that after a single - * piece of what we have mapped, or be it after the entire thing - * has been sent. That is why we need to check the output queue - * count at the top. - */ - ttstart(tp); + if (putc(FRAME_END, &tp->t_outq)) { + /* + * Not enough room. Remove a char to make room + * and end the packet normally. + * If you get many collisions (more than one or two + * a day) you probably do not have enough clists + * and you should increase "nclist" in param.c. + */ + (void) unputc(&tp->t_outq); + (void) putc(FRAME_END, &tp->t_outq); + sc->sc_if.if_collisions++; + } else + sc->sc_if.if_opackets++; + } +} + +slinit(sc) + register struct sl_softc *sc; +{ + struct mbuf *p; + + if (sc->sc_buf == (char *) 0) { + MCLALLOC(p, 1); + if (p) { + sc->sc_buf = (char *)p; + sc->sc_mp = sc->sc_buf + sizeof(struct ifnet *); + } else { + printf("sl%d: can't allocate buffer\n", sc - sl_softc); + sc->sc_if.if_flags &= ~IFF_UP; + return (0); + } + } + return (1); } /* * Copy data buffer to mbuf chain; add ifnet pointer ifp. */ struct mbuf * -sl_btom(addr, len, ifp) - register caddr_t addr; +sl_btom(sc, len, ifp) + struct sl_softc *sc; register int len; struct ifnet *ifp; { + register caddr_t cp; register struct mbuf *m, **mp; - register int count; + register unsigned count; struct mbuf *top = NULL; + cp = sc->sc_buf + sizeof(struct ifnet *); mp = ⊤ while (len > 0) { MGET(m, M_DONTWAIT, MT_DATA); @@ -324,23 +380,36 @@ sl_btom(addr, len, ifp) m_freem(top); return (NULL); } - if (ifp) { + if (ifp) m->m_off += sizeof(ifp); - count = MIN(len, MLEN - sizeof(ifp)); - } else { - if (len >= NBPG) { - struct mbuf *p; - - MCLGET(p, 1); - if (p != NULL) { - count = MIN(len, CLBYTES); - m->m_off = (int)p - (int)m; + /* + * If we have at least NBPG bytes, + * allocate a new page. Swap the current buffer page + * with the new one. We depend on having a space + * left at the beginning of the buffer + * for the interface pointer. + */ + if (len >= NBPG) { + MCLGET(m); + if (m->m_len == CLBYTES) { + cp = mtod(m, char *); + m->m_off = (int)sc->sc_buf - (int)m; + sc->sc_buf = mtod(m, char *); + if (ifp) { + m->m_off += sizeof(ifp); + count = MIN(len, + CLBYTES - sizeof(struct ifnet *)); } else - count = MIN(len, MLEN); - } else - count = MIN(len, MLEN); + count = MIN(len, CLBYTES); + goto nocopy; + } } - bcopy(addr, mtod(m, caddr_t), count); + if (ifp) + count = MIN(len, MLEN - sizeof(ifp)); + else + count = MIN(len, MLEN); + bcopy(cp, mtod(m, caddr_t), count); +nocopy: m->m_len = count; if (ifp) { m->m_off -= sizeof(ifp); @@ -348,7 +417,7 @@ sl_btom(addr, len, ifp) *mtod(m, struct ifnet **) = ifp; ifp = NULL; } - addr += count; + cp += count; len -= count; mp = &m->m_next; } @@ -366,6 +435,7 @@ slinput(c, tp) register struct mbuf *m; int s; + tk_nin++; sc = (struct sl_softc *)tp->t_sc; if (sc == NULL) return; @@ -385,7 +455,7 @@ slinput(c, tp) default: sc->sc_if.if_ierrors++; - sc->sc_mp = sc->sc_buf; + sc->sc_mp = sc->sc_buf + sizeof(struct ifnet *); sc->sc_ilen = 0; return; } @@ -395,12 +465,12 @@ slinput(c, tp) case FRAME_END: if (sc->sc_ilen == 0) /* ignore */ return; - m = sl_btom(sc->sc_buf, sc->sc_ilen, &sc->sc_if); + m = sl_btom(sc, sc->sc_ilen, &sc->sc_if); if (m == NULL) { sc->sc_if.if_ierrors++; return; } - sc->sc_mp = sc->sc_buf; + sc->sc_mp = sc->sc_buf + sizeof(struct ifnet *); sc->sc_ilen = 0; sc->sc_if.if_ipackets++; s = splimp(); @@ -422,7 +492,7 @@ slinput(c, tp) } if (++sc->sc_ilen >= SLMTU) { sc->sc_if.if_ierrors++; - sc->sc_mp = sc->sc_buf; + sc->sc_mp = sc->sc_buf + sizeof(struct ifnet *); sc->sc_ilen = 0; return; } diff --git a/usr/src/sys/net/raw_usrreq.c b/usr/src/sys/net/raw_usrreq.c index 0a05affee5..42259f6b0e 100644 --- a/usr/src/sys/net/raw_usrreq.c +++ b/usr/src/sys/net/raw_usrreq.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)raw_usrreq.c 6.12 (Berkeley) %G% + * @(#)raw_usrreq.c 6.13 (Berkeley) %G% */ #include "param.h" @@ -142,7 +142,7 @@ next: /*ARGSUSED*/ raw_ctlinput(cmd, arg) int cmd; - caddr_t arg; + struct sockaddr *arg; { if (cmd < 0 || cmd > PRC_NCMDS) diff --git a/usr/src/sys/netinet/if_ether.c b/usr/src/sys/netinet/if_ether.c index 31dd6d3886..e695fa7bd7 100644 --- a/usr/src/sys/netinet/if_ether.c +++ b/usr/src/sys/netinet/if_ether.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)if_ether.c 6.16 (Berkeley) %G% + * @(#)if_ether.c 6.17 (Berkeley) %G% */ /* @@ -93,7 +93,7 @@ arpwhohas(ac, addr) struct sockaddr sa; if ((m = m_get(M_DONTWAIT, MT_DATA)) == NULL) - return (1); + return; m->m_len = sizeof *ea; m->m_off = MMAXOFF - m->m_len; ea = mtod(m, struct ether_arp *); @@ -113,7 +113,7 @@ arpwhohas(ac, addr) sizeof(ea->arp_spa)); bcopy((caddr_t)addr, (caddr_t)ea->arp_tpa, sizeof(ea->arp_tpa)); sa.sa_family = AF_UNSPEC; - return ((*ac->ac_if.if_output)(&ac->ac_if, m, &sa)); + (*ac->ac_if.if_output)(&ac->ac_if, m, &sa); } /* diff --git a/usr/src/sys/netinet/in.c b/usr/src/sys/netinet/in.c index e026b07d37..066776ea24 100644 --- a/usr/src/sys/netinet/in.c +++ b/usr/src/sys/netinet/in.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)in.c 6.12 (Berkeley) %G% + * @(#)in.c 6.13 (Berkeley) %G% */ #include "param.h" @@ -101,6 +101,7 @@ in_netof(in) /* * Return the host portion of an internet address. */ +u_long in_lnaof(in) struct in_addr in; { @@ -129,9 +130,15 @@ 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 through a local logical net). + * (one to which we have a connection). If subnetsarelocal + * is true, this includes other subnets of the local net. + * Otherwise, it includes only the directly-connected (sub)nets. */ in_localaddr(in) struct in_addr in; @@ -148,7 +155,7 @@ in_localaddr(in) net = i & IN_CLASSC_NET; for (ia = in_ifaddr; ia; ia = ia->ia_next) - if (net == ia->ia_net) + if (net == subnetsarelocal ? ia->ia_net : ia->ia_subnet) return (1); return (0); } diff --git a/usr/src/sys/netinet/in.h b/usr/src/sys/netinet/in.h index 2af66ff891..b629fe482a 100644 --- a/usr/src/sys/netinet/in.h +++ b/usr/src/sys/netinet/in.h @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)in.h 6.9 (Berkeley) %G% + * @(#)in.h 6.10 (Berkeley) %G% */ /* @@ -55,25 +55,25 @@ 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(i) (((long)(i) & 0x80000000) == 0) #define IN_CLASSA_NET 0xff000000 #define IN_CLASSA_NSHIFT 24 #define IN_CLASSA_HOST 0x00ffffff #define IN_CLASSA_MAX 128 -#define IN_CLASSB(i) ((((long)(i))&0xc0000000)==0x80000000) +#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) #define IN_CLASSB_NET 0xffff0000 #define IN_CLASSB_NSHIFT 16 #define IN_CLASSB_HOST 0x0000ffff #define IN_CLASSB_MAX 65536 -#define IN_CLASSC(i) ((((long)(i))&0xc0000000)==0xc0000000) +#define IN_CLASSC(i) (((long)(i) & 0xc0000000) == 0xc0000000) #define IN_CLASSC_NET 0xffffff00 #define IN_CLASSC_NSHIFT 8 #define IN_CLASSC_HOST 0x000000ff -#define INADDR_ANY 0x00000000 -#define INADDR_BROADCAST 0xffffffff /* must be masked */ +#define INADDR_ANY (u_long)0x00000000 +#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */ /* * Socket address, internet style. @@ -90,7 +90,7 @@ struct sockaddr_in { */ #define IP_OPTIONS 1 /* set/get IP per-packet options */ -#if !defined(vax) +#if !defined(vax) && !defined(ntohl) /* * Macros for number representation conversion. */ @@ -104,5 +104,5 @@ struct sockaddr_in { extern struct domain inetdomain; extern struct protosw inetsw[]; struct in_addr in_makeaddr(); -u_long in_netof(); +u_long in_netof(), in_lnaof(); #endif diff --git a/usr/src/sys/netinet/in_pcb.c b/usr/src/sys/netinet/in_pcb.c index 3f41b14c25..ba9816e429 100644 --- a/usr/src/sys/netinet/in_pcb.c +++ b/usr/src/sys/netinet/in_pcb.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)in_pcb.c 6.13 (Berkeley) %G% + * @(#)in_pcb.c 6.14 (Berkeley) %G% */ #include "param.h" @@ -186,7 +186,7 @@ in_pcbconnect(inp, nam) return (EADDRINUSE); if (inp->inp_laddr.s_addr == INADDR_ANY) { if (inp->inp_lport == 0) - in_pcbbind(inp, (struct mbuf *)0); + (void)in_pcbbind(inp, (struct mbuf *)0); inp->inp_laddr = ifaddr->sin_addr; } inp->inp_faddr = sin->sin_addr; @@ -212,7 +212,7 @@ in_pcbdetach(inp) so->so_pcb = 0; sofree(so); if (inp->inp_options) - m_free(inp->inp_options); + (void)m_free(inp->inp_options); if (inp->inp_route.ro_rt) rtfree(inp->inp_route.ro_rt); remque(inp); @@ -289,7 +289,7 @@ in_losing(inp) if ((rt = inp->inp_route.ro_rt)) { if (rt->rt_flags & RTF_DYNAMIC) - rtrequest(SIOCDELRT, rt); + (void) rtrequest(SIOCDELRT, rt); rtfree(rt); inp->inp_route.ro_rt = 0; /* diff --git a/usr/src/sys/netinet/in_var.h b/usr/src/sys/netinet/in_var.h index a3d14c3818..e5fb108dfc 100644 --- a/usr/src/sys/netinet/in_var.h +++ b/usr/src/sys/netinet/in_var.h @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)in_var.h 6.3 (Berkeley) %G% + * @(#)in_var.h 6.4 (Berkeley) %G% */ /* @@ -37,6 +37,6 @@ struct in_ifaddr { #define IFA_ROUTE 0x01 /* routing entry installed */ #ifdef KERNEL -extern struct in_ifaddr *in_ifaddr; -extern struct in_ifaddr *in_iaonnetof(); +struct in_ifaddr *in_ifaddr; +struct in_ifaddr *in_iaonnetof(); #endif diff --git a/usr/src/sys/netinet/ip_icmp.c b/usr/src/sys/netinet/ip_icmp.c index 1f42440d75..41a4b5737b 100644 --- a/usr/src/sys/netinet/ip_icmp.c +++ b/usr/src/sys/netinet/ip_icmp.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ip_icmp.c 6.15 (Berkeley) %G% + * @(#)ip_icmp.c 6.16 (Berkeley) %G% */ #include "param.h" @@ -48,7 +48,7 @@ icmp_error(oip, type, code, ifp, dest) register struct icmp *icp; struct mbuf *m; struct ip *nip; - int icmplen; + unsigned icmplen; #ifdef ICMPPRINTFS if (icmpprintfs) @@ -373,7 +373,7 @@ icmp_reflect(ip, ifp) } icmp_send(ip, opts); if (opts) - m_free(opts); + (void)m_free(opts); } struct in_ifaddr * diff --git a/usr/src/sys/netinet/ip_input.c b/usr/src/sys/netinet/ip_input.c index 7ae30e567e..e205096c9b 100644 --- a/usr/src/sys/netinet/ip_input.c +++ b/usr/src/sys/netinet/ip_input.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ip_input.c 6.19 (Berkeley) %G% + * @(#)ip_input.c 6.20 (Berkeley) %G% */ #include "param.h" @@ -567,7 +567,7 @@ ip_dooptions(ip, ifp) /* * locate outgoing interface */ - bcopy(cp + off, (caddr_t)&ipaddr.sin_addr, + bcopy((caddr_t)(cp + off), (caddr_t)&ipaddr.sin_addr, sizeof(ipaddr.sin_addr)); if ((opt == IPOPT_SSRR && in_iaonnetof(in_netof(ipaddr.sin_addr)) == 0) || @@ -577,8 +577,8 @@ ip_dooptions(ip, ifp) goto bad; } ip->ip_dst = ipaddr.sin_addr; - bcopy(&(IA_SIN(ia)->sin_addr), cp + off, - sizeof(struct in_addr)); + bcopy((caddr_t)&(IA_SIN(ia)->sin_addr), + (caddr_t)(cp + off), sizeof(struct in_addr)); cp[IPOPT_OFFSET] += sizeof(struct in_addr); break; @@ -593,7 +593,7 @@ ip_dooptions(ip, ifp) off--; /* 0 origin */ if (off > optlen - sizeof(struct in_addr)) break; - bcopy(cp + off, (caddr_t)&ipaddr.sin_addr, + bcopy((caddr_t)(cp + off), (caddr_t)&ipaddr.sin_addr, sizeof(ipaddr.sin_addr)); /* * locate outgoing interface @@ -603,8 +603,8 @@ ip_dooptions(ip, ifp) code = ICMP_UNREACH_SRCFAIL; goto bad; } - bcopy(&(IA_SIN(ia)->sin_addr), cp + off, - sizeof(struct in_addr)); + bcopy((caddr_t)&(IA_SIN(ia)->sin_addr), + (caddr_t)(cp + off), sizeof(struct in_addr)); cp[IPOPT_OFFSET] += sizeof(struct in_addr); break; @@ -699,10 +699,10 @@ ip_rtaddr(dst) * to be picked up later by ip_srcroute if the receiver is interested. */ save_rte(option, dst) - caddr_t option; + u_char *option; struct in_addr dst; { - int olen; + unsigned olen; extern ipprintfs; olen = option[IPOPT_OLEN]; @@ -711,7 +711,7 @@ save_rte(option, dst) printf("save_rte: olen %d\n", olen); return; } - bcopy(option, (caddr_t)ip_srcrt.srcopt, olen); + bcopy((caddr_t)option, (caddr_t)ip_srcrt.srcopt, olen); ip_nhops = (olen - IPOPT_OFFSET - 1) / sizeof(struct in_addr); ip_srcrt.route[ip_nhops++] = dst; } diff --git a/usr/src/sys/netinet/ip_output.c b/usr/src/sys/netinet/ip_output.c index 53dd7ebb5c..a68b2cacb8 100644 --- a/usr/src/sys/netinet/ip_output.c +++ b/usr/src/sys/netinet/ip_output.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ip_output.c 6.12 (Berkeley) %G% + * @(#)ip_output.c 6.13 (Berkeley) %G% */ #include "param.h" @@ -235,7 +235,7 @@ ip_insertoptions(m, opt, phlen) register struct ipoption *p = mtod(opt, struct ipoption *); struct mbuf *n; register struct ip *ip = mtod(m, struct ip *); - int optlen; + unsigned optlen; optlen = opt->m_len - sizeof(p->ipopt_dst); if (p->ipopt_dst.s_addr) @@ -257,7 +257,7 @@ ip_insertoptions(m, opt, phlen) ovbcopy((caddr_t)ip, mtod(m, caddr_t), sizeof(struct ip)); } ip = mtod(m, struct ip *); - bcopy((caddr_t)p->ipopt_list, (caddr_t)(ip + 1), optlen); + bcopy((caddr_t)p->ipopt_list, (caddr_t)(ip + 1), (unsigned)optlen); *phlen = sizeof(struct ip) + optlen; ip->ip_len += optlen; return (m); @@ -333,7 +333,7 @@ ip_ctloutput(op, so, level, optname, m) (*m)->m_off = inp->inp_options->m_off; (*m)->m_len = inp->inp_options->m_len; bcopy(mtod(inp->inp_options, caddr_t), - mtod(*m, caddr_t), (*m)->m_len); + mtod(*m, caddr_t), (unsigned)(*m)->m_len); } else (*m)->m_len = 0; break; @@ -344,7 +344,7 @@ ip_ctloutput(op, so, level, optname, m) break; } if (op == PRCO_SETOPT) - m_free(*m); + (void)m_free(*m); return (error); } @@ -363,14 +363,14 @@ ip_pcbopts(pcbopt, m) /* turn off any old options */ if (*pcbopt) - m_free(*pcbopt); + (void)m_free(*pcbopt); *pcbopt = 0; if (m == (struct mbuf *)0 || m->m_len == 0) { /* * Only turning off any previous options. */ if (m) - m_free(m); + (void)m_free(m); return (0); } @@ -393,7 +393,7 @@ ip_pcbopts(pcbopt, m) cnt = m->m_len; m->m_len += sizeof(struct in_addr); cp = mtod(m, u_char *) + sizeof(struct in_addr); - ovbcopy(mtod(m, caddr_t), cp, cnt); + ovbcopy(mtod(m, caddr_t), (caddr_t)cp, (unsigned)cnt); bzero(mtod(m, caddr_t), sizeof(struct in_addr)); for (; cnt > 0; cnt -= optlen, cp += optlen) { @@ -431,14 +431,16 @@ ip_pcbopts(pcbopt, m) /* * Move first hop before start of options. */ - bcopy(&cp[IPOPT_OFFSET+1], mtod(m, caddr_t), + bcopy((caddr_t)&cp[IPOPT_OFFSET+1], mtod(m, caddr_t), sizeof(struct in_addr)); /* * Then copy rest of options back * to close up the deleted entry. */ - ovbcopy(&cp[IPOPT_OFFSET+1] + sizeof(struct in_addr), - &cp[IPOPT_OFFSET+1], cnt + sizeof(struct in_addr)); + ovbcopy((caddr_t)(&cp[IPOPT_OFFSET+1] + + sizeof(struct in_addr)), + (caddr_t)&cp[IPOPT_OFFSET+1], + (unsigned)cnt + sizeof(struct in_addr)); break; } } @@ -446,6 +448,6 @@ ip_pcbopts(pcbopt, m) return (0); bad: - m_free(m); + (void)m_free(m); return (EINVAL); } diff --git a/usr/src/sys/netinet/raw_ip.c b/usr/src/sys/netinet/raw_ip.c index b3bb3e33f9..72d45e1ac5 100644 --- a/usr/src/sys/netinet/raw_ip.c +++ b/usr/src/sys/netinet/raw_ip.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)raw_ip.c 6.7 (Berkeley) %G% + * @(#)raw_ip.c 6.8 (Berkeley) %G% */ #include "param.h" @@ -136,7 +136,7 @@ rip_ctloutput(op, so, level, optname, m) (*m)->m_off = rp->rcb_options->m_off; (*m)->m_len = rp->rcb_options->m_len; bcopy(mtod(rp->rcb_options, caddr_t), - mtod(*m, caddr_t), (*m)->m_len); + mtod(*m, caddr_t), (unsigned)(*m)->m_len); } else (*m)->m_len = 0; break; @@ -147,6 +147,6 @@ rip_ctloutput(op, so, level, optname, m) break; } if (op == PRCO_SETOPT) - m_free(*m); + (void)m_free(*m); return (error); } diff --git a/usr/src/sys/netinet/tcp_input.c b/usr/src/sys/netinet/tcp_input.c index 9061863354..f4ae30248c 100644 --- a/usr/src/sys/netinet/tcp_input.c +++ b/usr/src/sys/netinet/tcp_input.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)tcp_input.c 6.20 (Berkeley) %G% + * @(#)tcp_input.c 6.21 (Berkeley) %G% */ #include "param.h" @@ -379,7 +379,7 @@ tcp_input(m0) (void) m_free(am); tp->t_template = tcp_template(tp); if (tp->t_template == 0) { - tp = tcp_drop(tp); + tp = tcp_drop(tp, ENOBUFS); dropsocket = 0; /* socket is already gone */ goto drop; } @@ -648,7 +648,7 @@ trimthenstep6: tp->snd_cwnd = MIN(11 * tp->snd_cwnd / 10, 65535); if (acked > so->so_snd.sb_cc) { tp->snd_wnd -= so->so_snd.sb_cc; - sbdrop(&so->so_snd, so->so_snd.sb_cc); + sbdrop(&so->so_snd, (int)so->so_snd.sb_cc); } else { sbdrop(&so->so_snd, acked); tp->snd_wnd -= acked; diff --git a/usr/src/sys/netinet/tcp_output.c b/usr/src/sys/netinet/tcp_output.c index 14945e6175..40cb16d0ce 100644 --- a/usr/src/sys/netinet/tcp_output.c +++ b/usr/src/sys/netinet/tcp_output.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)tcp_output.c 6.13 (Berkeley) %G% + * @(#)tcp_output.c 6.14 (Berkeley) %G% */ #include "param.h" @@ -213,7 +213,7 @@ send: */ opt = NULL; if (tp->t_state < TCPS_ESTABLISHED && (tp->t_flags & TF_NOOPT) == 0) { - int mss; + u_short mss; mss = MIN(so->so_rcv.sb_hiwat / 2, tcp_mss(tp)); if (mss > IP_MSS - sizeof(struct tcpiphdr)) { @@ -256,7 +256,7 @@ send: win = (int)(tp->rcv_adv - tp->rcv_nxt); ti->ti_win = htons((u_short)win); if (SEQ_GT(tp->snd_up, tp->snd_nxt)) { - ti->ti_urp = htons(tp->snd_up - tp->snd_nxt); + ti->ti_urp = htons((u_short)(tp->snd_up - tp->snd_nxt)); ti->ti_flags |= TH_URG; } else /* diff --git a/usr/src/sys/netinet/tcp_usrreq.c b/usr/src/sys/netinet/tcp_usrreq.c index 155ea50693..eea17126f3 100644 --- a/usr/src/sys/netinet/tcp_usrreq.c +++ b/usr/src/sys/netinet/tcp_usrreq.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)tcp_usrreq.c 6.9 (Berkeley) %G% + * @(#)tcp_usrreq.c 6.10 (Berkeley) %G% */ #include "param.h" @@ -335,7 +335,7 @@ tcp_ctloutput(op, so, level, optname, mp) error = EINVAL; break; } - m_free(m); + (void)m_free(m); break; case PRCO_GETOPT: diff --git a/usr/src/sys/netns/ns_error.c b/usr/src/sys/netns/ns_error.c index 8320977248..4fbd684a18 100644 --- a/usr/src/sys/netns/ns_error.c +++ b/usr/src/sys/netns/ns_error.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ns_error.c 6.6 (Berkeley) %G% + * @(#)ns_error.c 6.7 (Berkeley) %G% */ #include "param.h" @@ -140,7 +140,6 @@ ns_err_input(m) register struct ns_epidp *epidp = mtod(m, struct ns_epidp *); register int i; int type, code, param; - extern struct ns_addr if_makeaddr(); /* * Locate ns_err structure in mbuf, and check @@ -268,6 +267,6 @@ register struct idp *idp; idp->idp_sum = 0; idp->idp_sum = ns_cksum(m, (((ntohs(idp->idp_len) - 1)|1)+1)); } - (void) ns_output(m, 0, NS_FORWARDING); + (void) ns_output(m, (struct route *)0, NS_FORWARDING); return(0); } diff --git a/usr/src/sys/netns/ns_output.c b/usr/src/sys/netns/ns_output.c index 8517918cd5..9155e91776 100644 --- a/usr/src/sys/netns/ns_output.c +++ b/usr/src/sys/netns/ns_output.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ns_output.c 6.9 (Berkeley) %G% + * @(#)ns_output.c 6.10 (Berkeley) %G% */ #include "param.h" @@ -42,7 +42,7 @@ ns_output(m0, ro, flags) if (ns_hold_output) { if (ns_lastout) { - m_free(ns_lastout); + (void)m_free(ns_lastout); } ns_lastout = m_copy(m0, 0, (int)M_COPYALL); } diff --git a/usr/src/sys/ufs/ffs/ffs_inode.c b/usr/src/sys/ufs/ffs/ffs_inode.c index 34559b513b..238034b72f 100644 --- a/usr/src/sys/ufs/ffs/ffs_inode.c +++ b/usr/src/sys/ufs/ffs/ffs_inode.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ffs_inode.c 6.18 (Berkeley) %G% + * @(#)ffs_inode.c 6.19 (Berkeley) %G% */ #include "param.h" @@ -485,7 +485,7 @@ itrunc(oip, length) * All whole direct blocks or frags. */ for (i = NDADDR - 1; i > lastblock; i--) { - register int bsize; + register off_t bsize; bn = ip->i_db[i]; if (bn == 0) @@ -504,7 +504,7 @@ itrunc(oip, length) */ bn = ip->i_db[lastblock]; if (bn != 0) { - int oldspace, newspace; + off_t oldspace, newspace; /* * Calculate amount of space we're giving @@ -609,7 +609,7 @@ indirtrunc(ip, bn, lastbn, level) if (level > SINGLE) blocksreleased += indirtrunc(ip, nb, (daddr_t)-1, level - 1); - free(ip, nb, (int)fs->fs_bsize); + free(ip, nb, (off_t)fs->fs_bsize); blocksreleased += nblocks; } diff --git a/usr/src/sys/ufs/ffs/ffs_vnops.c b/usr/src/sys/ufs/ffs/ffs_vnops.c index a8946835ca..87189558f2 100644 --- a/usr/src/sys/ufs/ffs/ffs_vnops.c +++ b/usr/src/sys/ufs/ffs/ffs_vnops.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ffs_vnops.c 6.21 (Berkeley) %G% + * @(#)ffs_vnops.c 6.22 (Berkeley) %G% */ #include "param.h" @@ -331,7 +331,8 @@ symlink() ip = maknode(IFLNK | 0777, ndp); if (ip == NULL) return; - u.u_error = rdwri(UIO_WRITE, ip, uap->target, nc, 0, 0, (int *)0); + u.u_error = rdwri(UIO_WRITE, ip, uap->target, nc, (off_t)0, 0, + (int *)0); /* handle u.u_error != 0 */ iput(ip); } @@ -516,7 +517,8 @@ readlink() u.u_error = EINVAL; goto out; } - u.u_error = rdwri(UIO_READ, ip, uap->buf, uap->count, 0, 0, &resid); + u.u_error = rdwri(UIO_READ, ip, uap->buf, uap->count, (off_t)0, 0, + &resid); out: iput(ip); u.u_r.r_val1 = uap->count - resid; @@ -664,7 +666,7 @@ chown1(ip, uid, gid) #ifdef QUOTA ip->i_dquot = inoquota(ip); (void) chkdq(ip, change, 1); - (void) chkiq(ip->i_dev, (struct inode *)NULL, uid, 1); + (void) chkiq(ip->i_dev, (struct inode *)NULL, (uid_t)uid, 1); return (u.u_error); /* should == 0 ALWAYS !! */ #else return (0); diff --git a/usr/src/sys/ufs/ffs/ufs_inode.c b/usr/src/sys/ufs/ffs/ufs_inode.c index a8362ddb62..7262ba320d 100644 --- a/usr/src/sys/ufs/ffs/ufs_inode.c +++ b/usr/src/sys/ufs/ffs/ufs_inode.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ufs_inode.c 6.18 (Berkeley) %G% + * @(#)ufs_inode.c 6.19 (Berkeley) %G% */ #include "param.h" @@ -485,7 +485,7 @@ itrunc(oip, length) * All whole direct blocks or frags. */ for (i = NDADDR - 1; i > lastblock; i--) { - register int bsize; + register off_t bsize; bn = ip->i_db[i]; if (bn == 0) @@ -504,7 +504,7 @@ itrunc(oip, length) */ bn = ip->i_db[lastblock]; if (bn != 0) { - int oldspace, newspace; + off_t oldspace, newspace; /* * Calculate amount of space we're giving @@ -609,7 +609,7 @@ indirtrunc(ip, bn, lastbn, level) if (level > SINGLE) blocksreleased += indirtrunc(ip, nb, (daddr_t)-1, level - 1); - free(ip, nb, (int)fs->fs_bsize); + free(ip, nb, (off_t)fs->fs_bsize); blocksreleased += nblocks; } diff --git a/usr/src/sys/ufs/ffs/ufs_lookup.c b/usr/src/sys/ufs/ffs/ufs_lookup.c index 5acc45ea18..78708af589 100644 --- a/usr/src/sys/ufs/ffs/ufs_lookup.c +++ b/usr/src/sys/ufs/ffs/ufs_lookup.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ufs_lookup.c 6.27 (Berkeley) %G% + * @(#)ufs_lookup.c 6.28 (Berkeley) %G% */ #include "param.h" @@ -785,7 +785,7 @@ haveino: ovbcopy(cp, nbp->b_un.b_addr + dp->i_size, pathlen); u.u_error = rdwri(UIO_READ, dp, nbp->b_un.b_addr, (int)dp->i_size, - 0, 1, (int *)0); + (off_t)0, 1, (int *)0); if (u.u_error) goto bad2; cp = nbp->b_un.b_addr; @@ -1017,8 +1017,7 @@ dirremove(ndp) /* * Collapse new free space into previous entry. */ - bp = blkatoff(dp, (int)(ndp->ni_offset - ndp->ni_count), - (char **)&ep); + bp = blkatoff(dp, ndp->ni_offset - ndp->ni_count, (char **)&ep); if (bp == 0) return (0); ep->d_reclen += ndp->ni_dent.d_reclen; diff --git a/usr/src/sys/ufs/ffs/ufs_vnops.c b/usr/src/sys/ufs/ffs/ufs_vnops.c index a6729f0cdb..865f8a5694 100644 --- a/usr/src/sys/ufs/ffs/ufs_vnops.c +++ b/usr/src/sys/ufs/ffs/ufs_vnops.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ufs_vnops.c 6.21 (Berkeley) %G% + * @(#)ufs_vnops.c 6.22 (Berkeley) %G% */ #include "param.h" @@ -331,7 +331,8 @@ symlink() ip = maknode(IFLNK | 0777, ndp); if (ip == NULL) return; - u.u_error = rdwri(UIO_WRITE, ip, uap->target, nc, 0, 0, (int *)0); + u.u_error = rdwri(UIO_WRITE, ip, uap->target, nc, (off_t)0, 0, + (int *)0); /* handle u.u_error != 0 */ iput(ip); } @@ -516,7 +517,8 @@ readlink() u.u_error = EINVAL; goto out; } - u.u_error = rdwri(UIO_READ, ip, uap->buf, uap->count, 0, 0, &resid); + u.u_error = rdwri(UIO_READ, ip, uap->buf, uap->count, (off_t)0, 0, + &resid); out: iput(ip); u.u_r.r_val1 = uap->count - resid; @@ -664,7 +666,7 @@ chown1(ip, uid, gid) #ifdef QUOTA ip->i_dquot = inoquota(ip); (void) chkdq(ip, change, 1); - (void) chkiq(ip->i_dev, (struct inode *)NULL, uid, 1); + (void) chkiq(ip->i_dev, (struct inode *)NULL, (uid_t)uid, 1); return (u.u_error); /* should == 0 ALWAYS !! */ #else return (0); diff --git a/usr/src/sys/ufs/lfs/lfs_inode.c b/usr/src/sys/ufs/lfs/lfs_inode.c index eff33ba32b..3199b470e7 100644 --- a/usr/src/sys/ufs/lfs/lfs_inode.c +++ b/usr/src/sys/ufs/lfs/lfs_inode.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)lfs_inode.c 6.18 (Berkeley) %G% + * @(#)lfs_inode.c 6.19 (Berkeley) %G% */ #include "param.h" @@ -485,7 +485,7 @@ itrunc(oip, length) * All whole direct blocks or frags. */ for (i = NDADDR - 1; i > lastblock; i--) { - register int bsize; + register off_t bsize; bn = ip->i_db[i]; if (bn == 0) @@ -504,7 +504,7 @@ itrunc(oip, length) */ bn = ip->i_db[lastblock]; if (bn != 0) { - int oldspace, newspace; + off_t oldspace, newspace; /* * Calculate amount of space we're giving @@ -609,7 +609,7 @@ indirtrunc(ip, bn, lastbn, level) if (level > SINGLE) blocksreleased += indirtrunc(ip, nb, (daddr_t)-1, level - 1); - free(ip, nb, (int)fs->fs_bsize); + free(ip, nb, (off_t)fs->fs_bsize); blocksreleased += nblocks; } diff --git a/usr/src/sys/ufs/lfs/lfs_vnops.c b/usr/src/sys/ufs/lfs/lfs_vnops.c index 9095bce82f..1184ff94b5 100644 --- a/usr/src/sys/ufs/lfs/lfs_vnops.c +++ b/usr/src/sys/ufs/lfs/lfs_vnops.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)lfs_vnops.c 6.21 (Berkeley) %G% + * @(#)lfs_vnops.c 6.22 (Berkeley) %G% */ #include "param.h" @@ -331,7 +331,8 @@ symlink() ip = maknode(IFLNK | 0777, ndp); if (ip == NULL) return; - u.u_error = rdwri(UIO_WRITE, ip, uap->target, nc, 0, 0, (int *)0); + u.u_error = rdwri(UIO_WRITE, ip, uap->target, nc, (off_t)0, 0, + (int *)0); /* handle u.u_error != 0 */ iput(ip); } @@ -516,7 +517,8 @@ readlink() u.u_error = EINVAL; goto out; } - u.u_error = rdwri(UIO_READ, ip, uap->buf, uap->count, 0, 0, &resid); + u.u_error = rdwri(UIO_READ, ip, uap->buf, uap->count, (off_t)0, 0, + &resid); out: iput(ip); u.u_r.r_val1 = uap->count - resid; @@ -664,7 +666,7 @@ chown1(ip, uid, gid) #ifdef QUOTA ip->i_dquot = inoquota(ip); (void) chkdq(ip, change, 1); - (void) chkiq(ip->i_dev, (struct inode *)NULL, uid, 1); + (void) chkiq(ip->i_dev, (struct inode *)NULL, (uid_t)uid, 1); return (u.u_error); /* should == 0 ALWAYS !! */ #else return (0); diff --git a/usr/src/sys/ufs/ufs/ufs_inode.c b/usr/src/sys/ufs/ufs/ufs_inode.c index a8362ddb62..7262ba320d 100644 --- a/usr/src/sys/ufs/ufs/ufs_inode.c +++ b/usr/src/sys/ufs/ufs/ufs_inode.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ufs_inode.c 6.18 (Berkeley) %G% + * @(#)ufs_inode.c 6.19 (Berkeley) %G% */ #include "param.h" @@ -485,7 +485,7 @@ itrunc(oip, length) * All whole direct blocks or frags. */ for (i = NDADDR - 1; i > lastblock; i--) { - register int bsize; + register off_t bsize; bn = ip->i_db[i]; if (bn == 0) @@ -504,7 +504,7 @@ itrunc(oip, length) */ bn = ip->i_db[lastblock]; if (bn != 0) { - int oldspace, newspace; + off_t oldspace, newspace; /* * Calculate amount of space we're giving @@ -609,7 +609,7 @@ indirtrunc(ip, bn, lastbn, level) if (level > SINGLE) blocksreleased += indirtrunc(ip, nb, (daddr_t)-1, level - 1); - free(ip, nb, (int)fs->fs_bsize); + free(ip, nb, (off_t)fs->fs_bsize); blocksreleased += nblocks; } diff --git a/usr/src/sys/ufs/ufs/ufs_lookup.c b/usr/src/sys/ufs/ufs/ufs_lookup.c index 5acc45ea18..78708af589 100644 --- a/usr/src/sys/ufs/ufs/ufs_lookup.c +++ b/usr/src/sys/ufs/ufs/ufs_lookup.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ufs_lookup.c 6.27 (Berkeley) %G% + * @(#)ufs_lookup.c 6.28 (Berkeley) %G% */ #include "param.h" @@ -785,7 +785,7 @@ haveino: ovbcopy(cp, nbp->b_un.b_addr + dp->i_size, pathlen); u.u_error = rdwri(UIO_READ, dp, nbp->b_un.b_addr, (int)dp->i_size, - 0, 1, (int *)0); + (off_t)0, 1, (int *)0); if (u.u_error) goto bad2; cp = nbp->b_un.b_addr; @@ -1017,8 +1017,7 @@ dirremove(ndp) /* * Collapse new free space into previous entry. */ - bp = blkatoff(dp, (int)(ndp->ni_offset - ndp->ni_count), - (char **)&ep); + bp = blkatoff(dp, ndp->ni_offset - ndp->ni_count, (char **)&ep); if (bp == 0) return (0); ep->d_reclen += ndp->ni_dent.d_reclen; diff --git a/usr/src/sys/ufs/ufs/ufs_vnops.c b/usr/src/sys/ufs/ufs/ufs_vnops.c index a6729f0cdb..865f8a5694 100644 --- a/usr/src/sys/ufs/ufs/ufs_vnops.c +++ b/usr/src/sys/ufs/ufs/ufs_vnops.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ufs_vnops.c 6.21 (Berkeley) %G% + * @(#)ufs_vnops.c 6.22 (Berkeley) %G% */ #include "param.h" @@ -331,7 +331,8 @@ symlink() ip = maknode(IFLNK | 0777, ndp); if (ip == NULL) return; - u.u_error = rdwri(UIO_WRITE, ip, uap->target, nc, 0, 0, (int *)0); + u.u_error = rdwri(UIO_WRITE, ip, uap->target, nc, (off_t)0, 0, + (int *)0); /* handle u.u_error != 0 */ iput(ip); } @@ -516,7 +517,8 @@ readlink() u.u_error = EINVAL; goto out; } - u.u_error = rdwri(UIO_READ, ip, uap->buf, uap->count, 0, 0, &resid); + u.u_error = rdwri(UIO_READ, ip, uap->buf, uap->count, (off_t)0, 0, + &resid); out: iput(ip); u.u_r.r_val1 = uap->count - resid; @@ -664,7 +666,7 @@ chown1(ip, uid, gid) #ifdef QUOTA ip->i_dquot = inoquota(ip); (void) chkdq(ip, change, 1); - (void) chkiq(ip->i_dev, (struct inode *)NULL, uid, 1); + (void) chkiq(ip->i_dev, (struct inode *)NULL, (uid_t)uid, 1); return (u.u_error); /* should == 0 ALWAYS !! */ #else return (0); diff --git a/usr/src/sys/vax/if/if_ddn.c b/usr/src/sys/vax/if/if_ddn.c index ebac17582d..b1d0f103ba 100644 --- a/usr/src/sys/vax/if/if_ddn.c +++ b/usr/src/sys/vax/if/if_ddn.c @@ -1,4 +1,4 @@ -/* @(#)if_ddn.c 6.4 (Berkeley) %G% */ +/* @(#)if_ddn.c 6.5 (Berkeley) %G% */ /************************************************************************\ @@ -768,7 +768,7 @@ printf("ddn%d: x25_init()\n", ds->ddn_if.if_unit); init_msg[3] = sizeof(init_msg) - 4; /* set cmnd ext length */ - bcopy(init_msg, mtod(m, u_char *), sizeof(init_msg)); + bcopy((caddr_t)init_msg, mtod(m, caddr_t), sizeof(init_msg)); m->m_len = sizeof(init_msg); /* set msg length */ @@ -1010,13 +1010,13 @@ register struct ddn_softc *ds; register struct ddn_cb *dc; { register struct mbuf *m_callbfr; - register u_char *cb; + register caddr_t cb; MGET(m_callbfr, M_DONTWAIT, MT_DATA); /* try to get call cmnd buffer */ if (m_callbfr == 0) return(0); - cb = mtod(m_callbfr, u_char *); + cb = mtod(m_callbfr, caddr_t); convert_ip_addr(ds->ddn_ipaddr, cb_calling_addr); @@ -1046,27 +1046,27 @@ register struct ddn_cb *dc; m_callbfr->m_len = cb_cmnd[3] + 4; /* copy command header */ - bcopy(cb_cmnd, cb, 4); + bcopy((caddr_t)cb_cmnd, cb, 4); cb += 4; /* copy called address */ - bcopy(cb_called_addr, cb, cb_called_addr[0] + 1); + bcopy((caddr_t)cb_called_addr, cb, cb_called_addr[0] + 1); cb += (cb_called_addr[0] + 1); /* copy calling address */ - bcopy(cb_calling_addr, cb, cb_calling_addr[0] + 1); + bcopy((caddr_t)cb_calling_addr, cb, cb_calling_addr[0] + 1); cb += (cb_calling_addr[0] + 1); /* copy protocol */ - bcopy(cb_protocol, cb, cb_protocol[0] + 1); + bcopy((caddr_t)cb_protocol, cb, cb_protocol[0] + 1); cb += (cb_protocol[0] + 1); /* copy facilities */ - bcopy(cb_facilities, cb, cb_facilities[0] + 1); + bcopy((caddr_t)cb_facilities, cb, cb_facilities[0] + 1); cb += (cb_facilities[0] + 1); /* copy user data */ - bcopy(cb_user_data, cb, cb_user_data[0] + 1); + bcopy((caddr_t)cb_user_data, cb, cb_user_data[0] + 1); cb += (cb_user_data[0] + 1); dc->dc_state = LC_CALL_PENDING; /* set state */ diff --git a/usr/src/sys/vax/if/if_ec.c b/usr/src/sys/vax/if/if_ec.c index e7f9055bb9..e5530bc009 100644 --- a/usr/src/sys/vax/if/if_ec.c +++ b/usr/src/sys/vax/if/if_ec.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)if_ec.c 6.17 (Berkeley) %G% + * @(#)if_ec.c 6.18 (Berkeley) %G% */ #include "ec.h" @@ -858,8 +858,8 @@ ecioctl(ifp, cmd, data) * so reset everything */ ifp->if_flags &= ~IFF_RUNNING; - bcopy(ina->x_host.c_host, es->es_addr, - sizeof(es->es_addr)); + bcopy((caddr_t)ina->x_host.c_host, + (caddr_t)es->es_addr, sizeof(es->es_addr)); } ecinit(ifp->if_unit); /* does ec_setaddr() */ break; diff --git a/usr/src/sys/vax/if/if_ex.c b/usr/src/sys/vax/if/if_ex.c index b81ad262af..1e9c0395fd 100644 --- a/usr/src/sys/vax/if/if_ex.c +++ b/usr/src/sys/vax/if/if_ex.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)if_ex.c 6.13 (Berkeley) %G% + * @(#)if_ex.c 6.14 (Berkeley) %G% */ @@ -94,7 +94,7 @@ struct ex_softc { #define EX_SETADDR (1<<3) /* physaddr has been changed */ struct ex_msg *xs_h2xnext; /* host pointer to request queue */ struct ex_msg *xs_x2hnext; /* host pointer to reply queue */ - u_long xs_ubaddr; /* map info for structs below */ + int xs_ubaddr; /* map info for structs below */ #define UNIADDR(x) ((u_long)(x)&0x3FFFF) #define P_UNIADDR(x) ((u_long)(x)&0x3FFF0) /* the following structures are always mapped in */ @@ -105,11 +105,11 @@ struct ex_softc { struct confmsg xs_cm; /* configuration message */ struct stat_array xs_xsa; /* EXOS writes stats here */ /* end mapped area */ -#define INCORE_BASE(p) (((u_long)(&(p)->xs_h2xhdr)) & 0xFFFFFFF0) +#define INCORE_BASE(p) ((caddr_t)((u_long)(&(p)->xs_h2xhdr) & 0xFFFFFFF0)) #define RVAL_OFF(unit, n) \ - ((u_long)(&(ex_softc[unit].n)) - INCORE_BASE(&ex_softc[unit])) + ((caddr_t)(&(ex_softc[unit].n)) - INCORE_BASE(&ex_softc[unit])) #define LVAL_OFF(unit, n) \ - ((u_long)(ex_softc[unit].n) - INCORE_BASE(&ex_softc[unit])) + ((caddr_t)(ex_softc[unit].n) - INCORE_BASE(&ex_softc[unit])) #define H2XHDR_OFFSET(unit) RVAL_OFF(unit, xs_h2xhdr) #define X2HHDR_OFFSET(unit) RVAL_OFF(unit, xs_x2hhdr) #define H2XENT_OFFSET(unit) LVAL_OFF(unit, xs_h2xent) @@ -159,6 +159,7 @@ exprobe(reg) } #ifdef lint br = br; + excdint(0); #endif ex_ncall++; return (sizeof(struct exdevice)); @@ -294,7 +295,7 @@ exinit(unit) xs->xs_if.if_flags |= IFF_RUNNING; xs->xs_flags |= EX_RUNNING; if (xs->xs_flags & EX_SETADDR) - ex_setaddr(0, unit); + ex_setaddr((u_char *)0, unit); exstart(unit); /* start transmits */ splx(s); } @@ -904,7 +905,7 @@ ex_setaddr(physaddr, unit) bp->mb_rqst = LLNET_ADDRS; bp->mb_na.na_mask = READ_OBJ|WRITE_OBJ; bp->mb_na.na_slot = PHYSSLOT; - bcopy(xs->xs_addr, bp->mb_na.na_addrs, 6); + bcopy((caddr_t)xs->xs_addr, (caddr_t)bp->mb_na.na_addrs, 6); bp->mb_status |= MH_EXOS; addr->xd_portb = EX_NTRUPT; bp = xs->xs_x2hnext; diff --git a/usr/src/sys/vax/if/if_hdh.c b/usr/src/sys/vax/if/if_hdh.c index 915ec91d3e..e424ff424c 100644 --- a/usr/src/sys/vax/if/if_hdh.c +++ b/usr/src/sys/vax/if/if_hdh.c @@ -1,4 +1,4 @@ -/* @(#)if_hdh.c 6.5 (Berkeley) %G% */ +/* @(#)if_hdh.c 6.6 (Berkeley) %G% */ /************************************************************************\ @@ -83,7 +83,7 @@ Revision History: #include "if_hdhreg.h" #include "if_uba.h" -int hdhprobe(), hdhattach(), hdhrint(), hdhxint(); +int hdhprobe(), hdhattach(), hdhintr(); struct uba_device *hdhinfo[NHDH]; u_short hdhstd[] = { 0 }; struct uba_driver hdhdriver = @@ -174,6 +174,7 @@ caddr_t reg; struct hdhregs *addr = (struct hdhregs *)reg; #ifdef lint br = 0; cvec = br; br = cvec; + hdhintr(0); #endif br = 0x15; /* priority 21 (5 on UNIBUS) */ diff --git a/usr/src/sys/vax/if/if_hy.c b/usr/src/sys/vax/if/if_hy.c index 77a16c34ca..b6b48cc0c9 100644 --- a/usr/src/sys/vax/if/if_hy.c +++ b/usr/src/sys/vax/if/if_hy.c @@ -1,9 +1,5 @@ /* - * Copyright (c) 1982 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - * - * @(#)if_hy.c 6.8 (Berkeley) %G% + * @(#)if_hy.c 6.9 (Berkeley) %G% */ /* @@ -1462,7 +1458,7 @@ hyioctl(ifp, cmd, data) goto out; } hy_log.hyl_wait = sgl->hylsg_cmd; - sleep((caddr_t)&hy_log); + sleep((caddr_t)&hy_log, PZERO - 1); } if (copyout((caddr_t)&hy_log, sgl->hylsg_ptr, sizeof(hy_log))) { diff --git a/usr/src/sys/vax/if/if_uba.c b/usr/src/sys/vax/if/if_uba.c index b56a533159..5935d5f3fd 100644 --- a/usr/src/sys/vax/if/if_uba.c +++ b/usr/src/sys/vax/if/if_uba.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)if_uba.c 6.10 (Berkeley) %G% + * @(#)if_uba.c 6.11 (Berkeley) %G% */ #include "../machine/pte.h" @@ -59,7 +59,7 @@ if_ubaminit(ifu, uban, hlen, nmr, ifr, nr, ifw, nw) if (ifr[0].ifrw_addr) cp = ifr[0].ifrw_addr - off; else { - cp = m_clalloc((nr + nw) * ncl, MPG_SPACE); + cp = m_clalloc((nr + nw) * ncl, MPG_SPACE, M_DONTWAIT); if (cp == 0) return (0); p = cp; @@ -276,7 +276,7 @@ rcv_xmtbuf(ifw) int t; char *cp; - while (i = ffs(ifw->ifw_xswapd)) { + while (i = ffs((long)ifw->ifw_xswapd)) { cp = ifw->ifw_base + i * CLBYTES; i--; ifw->ifw_xswapd &= ~(1<ifw_mr[i] = ifw->ifw_wmap[i]; @@ -363,7 +363,7 @@ if_ubaput(ifu, ifw, m) cc = cp - ifw->ifw_addr; x = ((cc - ifu->iff_hlen) + CLBYTES - 1) >> CLSHIFT; ifw->ifw_xswapd &= ~xswapd; - while (i = ffs(ifw->ifw_xswapd)) { + while (i = ffs((long)ifw->ifw_xswapd)) { i--; if (i >= x) break; diff --git a/usr/src/sys/vax/if/if_uba.h b/usr/src/sys/vax/if/if_uba.h index 1a16ba6059..a3dad9caa2 100644 --- a/usr/src/sys/vax/if/if_uba.h +++ b/usr/src/sys/vax/if/if_uba.h @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)if_uba.h 6.5 (Berkeley) %G% + * @(#)if_uba.h 6.6 (Berkeley) %G% */ /* @@ -96,10 +96,10 @@ struct ifuba { #ifdef KERNEL #define if_ubainit(ifuba, uban, hlen, nmr) \ if_ubaminit(&(ifuba)->ifu_info, uban, hlen, nmr, \ - &(ifuba)->ifu_r, 1, &(ifuba)->ifu_w, 1) + &(ifuba)->ifu_r, 1, &(ifuba)->ifu_xmt, 1) #define if_rubaget(ifu, totlen, off0, ifp) \ if_ubaget(&(ifu)->ifu_info, &(ifu)->ifu_r, totlen, off0, ifp) #define if_wubaput(ifu, m) \ - if_ubaput(&(ifu)->ifu_info, &(ifu)->ifu_w, m) + if_ubaput(&(ifu)->ifu_info, &(ifu)->ifu_xmt, m) struct mbuf *if_ubaget(); #endif diff --git a/usr/src/sys/vax/if/if_vv.c b/usr/src/sys/vax/if/if_vv.c index aa70212995..324787ef5f 100644 --- a/usr/src/sys/vax/if/if_vv.c +++ b/usr/src/sys/vax/if/if_vv.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)if_vv.c 6.17 (Berkeley) %G% + * @(#)if_vv.c 6.18 (Berkeley) %G% */ #include "vv.h" @@ -106,7 +106,7 @@ int vv_tracehdr = 0; /* 1 => trace headers (slowly!!) */ */ int vvprobe(), vvattach(), vvreset(), vvinit(); int vvidentify(), vvstart(), vvxint(), vvwatchdog(); -int vvrint(), vvoutput(), vvioctl(), vvsetaddr(); +int vvrint(), vvoutput(), vvioctl(); struct uba_device *vvinfo[NVV]; u_short vvstd[] = { 0 }; struct uba_driver vvdriver = @@ -423,7 +423,7 @@ gotit: /* we got something--is it any good? */ UBAPURGE(vs->vs_ifuba.ifu_uba, vs->vs_ifuba.ifu_r.ifrw_bdp); m = if_rubaget(&vs->vs_ifuba, sizeof(struct vv_header), - 0, 0); + 0, &vs->vs_if); if (m != NULL) m_freem(m); diff --git a/usr/src/sys/vax/mba/hp.c b/usr/src/sys/vax/mba/hp.c index b3a78c7629..653629564e 100644 --- a/usr/src/sys/vax/mba/hp.c +++ b/usr/src/sys/vax/mba/hp.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)hp.c 6.19 (Berkeley) %G% + * @(#)hp.c 6.20 (Berkeley) %G% */ #ifdef HPDEBUG @@ -265,7 +265,11 @@ struct hpsoftc { #define hpunit(dev) (minor(dev) >> 3) #define MASKREG(reg) ((reg)&0xffff) +#ifdef lint +#define HPWAIT(mi, addr) (hpwait(mi)) +#else #define HPWAIT(mi, addr) (((addr)->hpds & HPDS_DRY) || hpwait(mi)) +#endif /*ARGSUSED*/ hpattach(mi, slave) @@ -491,7 +495,7 @@ hpustart(mi) switch (sc->sc_recal) { case 1: - HPWAIT(mi, hpaddr); + (void)HPWAIT(mi, hpaddr); hpaddr->hpdc = bp->b_cylin; hpaddr->hpcs1 = HP_SEEK|HP_GO; sc->sc_recal++; @@ -528,7 +532,7 @@ hpustart(mi) hpaddr->hpof = hp_offset[mi->mi_tab.b_errcnt & 017]|HPOF_FMT22; hpaddr->hpcs1 = HP_OFFSET|HP_GO; - HPWAIT(mi, hpaddr); + (void)HPWAIT(mi, hpaddr); mbclrattn(mi); } return (MBU_DODATA); @@ -720,7 +724,7 @@ hard: hpaddr->hper2, HPER2_BITS); } #endif - HPWAIT(mi, hpaddr); + (void)HPWAIT(mi, hpaddr); if (retry) return (MBD_RETRY); if (mi->mi_tab.b_errcnt >= 16) { @@ -729,7 +733,7 @@ hard: * bother with interrupts. */ hpaddr->hpcs1 = HP_RTC|HP_GO; - HPWAIT(mi, hpaddr); + (void)HPWAIT(mi, hpaddr); mbclrattn(mi); } if (mi->mi_tab.b_errcnt && (bp->b_flags & B_ERROR) == 0) @@ -898,7 +902,9 @@ hpecc(mi, flag) sn = bn%st->nspc; tn = sn/st->nsect; sn %= st->nsect; - mbp->mba_bcr = -(min(512, bp->b_bcount - (int)ptob(npf))); + bcr = bp->b_bcount - (int)ptob(npf); + bcr = MIN(bcr, 512); + mbp->mba_bcr = -bcr; #ifdef HPBDEBUG if (hpbdebug) log(LOG_DEBUG, "revector to cn %d tn %d sn %d\n", cn, tn, sn); diff --git a/usr/src/sys/vax/mba/mba.c b/usr/src/sys/vax/mba/mba.c index a9373c76b9..64bbe96165 100644 --- a/usr/src/sys/vax/mba/mba.c +++ b/usr/src/sys/vax/mba/mba.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)mba.c 6.7 (Berkeley) %G% + * @(#)mba.c 6.8 (Berkeley) %G% */ #include "mba.h" @@ -295,7 +295,7 @@ mbintr(mbanum) * Service drives which require attention * after non-data-transfer operations. */ - while (drive = ffs(as)) { + while (drive = ffs((long)as)) { drive--; /* was 1 origin */ as &= ~(1 << drive); mi = mhp->mh_mbip[drive]; diff --git a/usr/src/sys/vax/mba/mt.c b/usr/src/sys/vax/mba/mt.c index c5212f3411..08fe5dc204 100644 --- a/usr/src/sys/vax/mba/mt.c +++ b/usr/src/sys/vax/mba/mt.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)mt.c 6.5 (Berkeley) %G% + * @(#)mt.c 6.6 (Berkeley) %G% */ #include "mu.h" @@ -110,9 +110,6 @@ void mtcreset(); mtattach(mi) struct mba_device *mi; { -#ifdef lint - mtread(0); mtwrite(0); mtioctl(0, 0, 0, 0); -#endif } mtslave(mi, ms, sn) @@ -122,7 +119,7 @@ mtslave(mi, ms, sn) { register struct mu_softc *sc = &mu_softc[ms->ms_unit]; register struct mtdevice *mtaddr = (struct mtdevice *)mi->mi_drv; - int s = spl7(), rtn = 0, i; + int s = spl5(), rtn = 0, i; /* Just in case the controller is ill, reset it. Then issue */ /* a sense operation and wait about a second for it to respond. */ @@ -298,6 +295,7 @@ mtustart(mi) register struct buf *bp = mi->mi_tab.b_actf; register struct mu_softc *sc = &mu_softc[MUUNIT(bp->b_dev)]; daddr_t blkno; + int count; if (sc->sc_openf < 0) { bp->b_flags |= B_ERROR; @@ -370,13 +368,12 @@ mtustart(mi) /* Issue skip operations to position the next block for cooked I/O. */ if (blkno < bdbtofsb(bp->b_blkno)) - mtaddr->mtncs[MUUNIT(bp->b_dev)] = - (min((unsigned)(bdbtofsb(bp->b_blkno) - blkno), 0377) << 8) | - MT_SFORW|MT_GO; + count = (unsigned)(bdbtofsb(bp->b_blkno) - blkno); else - mtaddr->mtncs[MUUNIT(bp->b_dev)] = - (min((unsigned)(blkno - bdbtofsb(bp->b_blkno)), 0377) << 8) | - MT_SREV|MT_GO; + count = (unsigned)(blkno - bdbtofsb(bp->b_blkno)); + if (count > 0377) + count = 0377; + mtaddr->mtncs[MUUNIT(bp->b_dev)] = count | MT_SFORW|MT_GO; return (MBU_STARTED); } diff --git a/usr/src/sys/vax/uba/dmf.c b/usr/src/sys/vax/uba/dmf.c index 76adf4f1f2..26040756d6 100644 --- a/usr/src/sys/vax/uba/dmf.c +++ b/usr/src/sys/vax/uba/dmf.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)dmf.c 6.14 (Berkeley) %G% + * @(#)dmf.c 6.15 (Berkeley) %G% */ #include "dmf.h" @@ -86,13 +86,12 @@ char dmf_speeds[] = struct tty dmf_tty[NDMF*8]; char dmfsoftCAR[NDMF]; -struct dmfl_softc -{ - unsigned dmfl_state; /* soft state bits */ - unsigned dmfl_info; /* uba info */ - unsigned short dmfl_lines; /* lines per page (66 def.) */ - unsigned short dmfl_cols; /* cols per line (132 def.) */ - char dmfl_buf[DMFL_BUFSIZ]; +struct dmfl_softc { + u_int dmfl_state; /* soft state bits */ + int dmfl_info; /* uba info */ + u_short dmfl_lines; /* lines per page (66 def.) */ + u_short dmfl_cols; /* cols per line (132 def.) */ + char dmfl_buf[DMFL_BUFSIZ]; } dmfl_softc[NDMF]; /* @@ -141,7 +140,7 @@ dmfprobe(reg, ctlr) #ifdef lint br = 0; cvec = br; br = cvec; dmfxint(0); dmfrint(0); - dmfsrint(); dmfsxint(); dmfdaint(); dmfdbint(); dmflint(); + dmfsrint(); dmfsxint(); dmfdaint(); dmfdbint(); dmflint(0); #endif /* * Pick the usual size DMF vector here (don't decrement it here). @@ -854,28 +853,27 @@ dmflclose(dev, flag) register int dmf= DMFL_UNIT(dev); register struct dmfl_softc *sc = &dmfl_softc[dmf]; - dmflout(dev, "\f", 1); + (void)dmflout(dev, "\f", 1); sc->dmfl_state = 0; if (sc->dmfl_info != 0) - ubarelse((struct dmfdevice *)(dmfinfo[dmf])->ui_ubanum, + ubarelse((int)dmfinfo[dmf]->ui_ubanum, &(sc->dmfl_info)); ((struct dmfdevice *)(dmfinfo[dmf]->ui_addr))->dmfl[0] = 0; - return (0); } dmflwrite(dev, uio) dev_t dev; struct uio *uio; { - register unsigned int n; + register int n; register int error; register struct dmfl_softc *sc; sc = &dmfl_softc[DMFL_UNIT(dev)]; if (sc->dmfl_state&ERROR) return(EIO); - while (n = min(DMFL_BUFSIZ, (unsigned)uio->uio_resid)) { + while (n = MIN(DMFL_BUFSIZ, (unsigned)uio->uio_resid)) { if (error = uiomove(&sc->dmfl_buf[0], (int)n, UIO_WRITE, uio)) { printf("uio move error\n"); return (error); @@ -904,8 +902,7 @@ dmflout(dev, cp, n) register int dmf; register struct uba_device *ui; register struct dmfdevice *d; - register unsigned info; - register unsigned i; + int i; dmf = DMFL_UNIT(dev); sc = &dmfl_softc[dmf]; @@ -916,20 +913,20 @@ dmflout(dev, cp, n) * allocate unibus resources, will be released when io * operation is done. */ - sc->dmfl_info = info = uballoc(ui->ui_ubanum,cp,n,0); + sc->dmfl_info = uballoc(ui->ui_ubanum,cp,n,0); d = (struct dmfdevice *)ui->ui_addr; d->dmfl[0] = (2<<8) | DMFL_FORMAT; /* indir reg 2 */ /* indir reg auto increments on r/w */ /* SO DON'T CHANGE THE ORDER OF THIS CODE */ d->dmfl[1] = 0; /* prefix chars & num */ d->dmfl[1] = 0; /* suffix chars & num */ - d->dmfl[1] = info; /* dma lo 16 bits addr */ + d->dmfl[1] = sc->dmfl_info; /* dma lo 16 bits addr */ /* NOT DOCUMENTED !! */ d->dmfl[1] = -n; /* number of chars */ /* ----------^-------- */ - d->dmfl[1] = ((info>>16)&3) /* dma hi 2 bits addr */ + d->dmfl[1] = ((sc->dmfl_info>>16)&3) /* dma hi 2 bits addr */ | (1<<8) /* auto cr insert */ | (1<<9) /* use real ff */ | (1<<15); /* no u/l conversion */ @@ -941,8 +938,8 @@ dmflout(dev, cp, n) while (sc->dmfl_state & ASLP) { sleep(&sc->dmfl_buf[0], (PZERO+8)); while (sc->dmfl_state & ERROR) { - timeout(dmflint, dmf, 10*hz); - sleep(&sc->dmfl_state, (PZERO+8)); + timeout(dmflint, (caddr_t)dmf, 10*hz); + sleep((caddr_t)&sc->dmfl_state, (PZERO+8)); } /*if (sc->dmfl_state&ERROR) return (EIO);*/ } @@ -970,7 +967,7 @@ dmflint(dmf) printf("dmfl: intr while in error state \n"); if ((d->dmfl[0]&DMFL_OFFLINE) == 0) sc->dmfl_state &= ~ERROR; - wakeup(&sc->dmfl_state); + wakeup((caddr_t)&sc->dmfl_state); return; } if (d->dmfl[0] & DMFL_DMAERR) @@ -986,7 +983,7 @@ dmflint(dmf) #endif } sc->dmfl_state &= ~ASLP; - wakeup(&sc->dmfl_buf[0]); + wakeup((caddr_t)&sc->dmfl_buf[0]); if (sc->dmfl_info != 0) ubarelse(ui->ui_ubanum, &sc->dmfl_info); sc->dmfl_info = 0; diff --git a/usr/src/sys/vax/uba/lp.c b/usr/src/sys/vax/uba/lp.c index c73f2dcc53..8e6e8d811c 100644 --- a/usr/src/sys/vax/uba/lp.c +++ b/usr/src/sys/vax/uba/lp.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)lp.c 6.7 (Berkeley) %G% + * @(#)lp.c 6.8 (Berkeley) %G% */ #include "lp.h" @@ -36,10 +36,11 @@ #define LPLWAT 650 #define LPHWAT 800 -#define MAXCOL 132 -#define CAP 1 +#define LPBUFSIZE 1024 +#define MAXCOL 132 +#define CAP 1 -#define LPUNIT(dev) (minor(dev) >> 3) +#define LPUNIT(dev) (minor(dev) >> 3) struct lpdevice { short lpsr; @@ -118,7 +119,7 @@ lpopen(dev, flag) if (lpaddr->lpsr&ERROR) return (EIO); sc->sc_state |= OPEN; - sc->sc_inbuf = geteblk(512); + sc->sc_inbuf = geteblk(LPBUFSIZE); sc->sc_flags = minor(dev) & 07; s = spl4(); if ((sc->sc_state&TOUT) == 0) { @@ -151,7 +152,7 @@ lpwrite(dev, uio) register struct lp_softc *sc = &lp_softc[LPUNIT(dev)]; int error; - while (n = min(512, (unsigned)uio->uio_resid)) { + while (n = MIN(LPBUFSIZE, (unsigned)uio->uio_resid)) { cp = sc->sc_inbuf->b_un.b_addr; error = uiomove(cp, (int)n, UIO_WRITE, uio); if (error) diff --git a/usr/src/sys/vax/uba/lpa.c b/usr/src/sys/vax/uba/lpa.c index 9674c6ac60..8e6f508c8c 100644 --- a/usr/src/sys/vax/uba/lpa.c +++ b/usr/src/sys/vax/uba/lpa.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)lpa.c 6.3 (Berkeley) %G% + * @(#)lpa.c 6.4 (Berkeley) %G% */ #include "lpa.h" @@ -207,7 +207,7 @@ TRACER("OPEN\n"); if (unit >= NLPA || sc->sc_flag & OPEN || ui == 0 || ui->ui_alive == 0) return (ENXIO); - (void) spl7(); + (void) splhigh(); lpaaddr->lcim = RESET; lpaaddr->lcim = 0; (void) spl0(); @@ -246,14 +246,14 @@ TRACER("SLEEP\n"); sleep((caddr_t)sc, LPAPRI); } } - (void) spl7(); + (void) splhigh(); lpaaddr->lcim = RESET; lpaaddr->lcim = 0; (void) spl0(); if (sc->sc_ubabuf) { ubarelse(ui->ui_ubanum, &sc->sc_ubabuf); sc->sc_ubabuf = 0; - (void) spl6(); + (void) splclock(); vsunlock(sc->sc_ubuffer.b_un.b_addr, sc->sc_ubuffer.b_bcount, (sc->sc_device)? B_READ : B_WRITE); u.u_procp->p_flag &= ~SPHYSIO; @@ -351,7 +351,7 @@ lpadmdt(lpaaddr, sc, ubanum, uio) *p++ = ADIO3; *p++ = ADIO4; *p++ = ADIO5; - n = min(uio->uio_resid, 256); /* dedicated mode dispatch table */ + n = MIN(uio->uio_resid, 256); /* dedicated mode dispatch table */ error = uiomove((char *)p, n, UIO_WRITE, uio); if (error) return (error); @@ -567,11 +567,11 @@ TRACER(""); } inc(sc_lbufnx); TRACERN("", sc->sc_ustat); - spx = spl7(); + spx = splhigh(); sc->sc_ustat &= ~NBI; sc->sc_ustat |= sc->sc_lbufnx << 8; sc->sc_ustat &= ~DONE; - (void) splx(spx); + splx(spx); TRACERN("}", sc->sc_lbufnx); } @@ -592,7 +592,7 @@ TRACER("LPA RESET\n"); lpaaddr = (struct lpadevice *)ui->ui_addr; sc = &lpa_softc[unit]; sc->sc_flag |= ERROR; - (void) spl7(); + (void) splhigh(); lpaaddr->lcim = RESET; lpaaddr->lcim = 0; (void) spl0(); diff --git a/usr/src/sys/vax/uba/ps.c b/usr/src/sys/vax/uba/ps.c index 92ef39027f..0802aa3422 100644 --- a/usr/src/sys/vax/uba/ps.c +++ b/usr/src/sys/vax/uba/ps.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ps.c 6.6 (Berkeley) %G% + * @(#)ps.c 6.7 (Berkeley) %G% */ /* @@ -357,7 +357,7 @@ psioctl(dev, cmd, data, flag) #define SAVEPSADDR(psaddr, savepsaddr) { \ register short i, xx1; \ - xx1 = spl6(); \ + xx1 = splclock(); \ i = psaddr->ps_addr; \ while ((psaddr->ps_iostat & DIOREADY) == 0) \ ; \ @@ -366,7 +366,7 @@ psioctl(dev, cmd, data, flag) } #define RESTORPSADDR(psaddr, savepsaddr) { \ register short xx2; \ - xx2 = spl6(); \ + xx2 = splclock(); \ while ((psaddr->ps_iostat & DIOREADY) == 0) \ ;\ psaddr->ps_addr = savepsaddr; \ @@ -451,7 +451,7 @@ pssystemintr(dev) else psp->ps_map.mode = WAITING_RF; #ifdef EXTERNAL_SYNC - x = spl6(); + x = splclock(); #endif (void) psrfnext(psp, psaddr); #ifdef EXTERNAL_SYNC @@ -494,7 +494,7 @@ tryrf: } psp->ps_refresh.srcntr = 0; #ifdef EXTERNAL_SYNC - x = spl6(); + x = splclock(); #endif psp->ps_refresh.mode = SYNCING_RF; if (psp->ps_clockticks) diff --git a/usr/src/sys/vax/uba/rl.c b/usr/src/sys/vax/uba/rl.c index 19de88bec3..1de8eb494c 100644 --- a/usr/src/sys/vax/uba/rl.c +++ b/usr/src/sys/vax/uba/rl.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)rl.c 6.6 (Berkeley) %G% + * @(#)rl.c 6.7 (Berkeley) %G% */ #include "rl.h" @@ -538,7 +538,7 @@ rlintr(rl21) * the unit start routine to place the slave * on the controller device queue. */ - while (unit = ffs(as)) { + while (unit = ffs((long)as)) { unit--; /* was 1 origin */ as &= ~(1<sc_lastiow = 0; sc->sc_dens = dens; sc->sc_ttyp = u.u_ttyp; - s = spl6(); + s = splclock(); if (sc->sc_tact == 0) { sc->sc_timo = INF; sc->sc_tact = 1; diff --git a/usr/src/sys/vax/uba/tmscp.c b/usr/src/sys/vax/uba/tmscp.c index 66b25972cb..851e87bf27 100644 --- a/usr/src/sys/vax/uba/tmscp.c +++ b/usr/src/sys/vax/uba/tmscp.c @@ -1,4 +1,4 @@ -/* @(#)tmscp.c 5.3 (Berkeley) %G% */ +/* @(#)tmscp.c 5.4 (Berkeley) %G% */ #ifndef lint static char *sccsid = "@(#)tmscp.c 1.24 (ULTRIX) 1/21/86"; @@ -622,20 +622,7 @@ tmscpintr (d) */ if (tm->tmscp_ca.ca_bdp) { - /* - * THIS IS A KLUDGE. - * Maybe we should change the entire - * UBA interface structure. - */ - int s = spl6(); - i = um->um_ubinfo; -# ifdef DEBUG - printd("tmscp: purge bdp %d\n", tm->tmscp_ca.ca_bdp); -# endif - um->um_ubinfo = tm->tmscp_ca.ca_bdp<<28; - ubapurge(um); - um->um_ubinfo = i; - (void) splx(s); + UBAPURGE(um->um_hd->uh_uba, tm->tmscp_ca.ca_bdp); tm->tmscp_ca.ca_bdp = 0; tmscpaddr->tmscpsa = 0; /* signal purge complete */ } @@ -668,7 +655,7 @@ tmscpintr (d) tm->tmscp_ca.ca_cmdint = 0; } if(tmscp_cp_wait) - wakeup(&tmscp_cp_wait); + wakeup((caddr_t)&tmscp_cp_wait); (void) tmscpstart(um); } @@ -741,7 +728,7 @@ tmscpopen(dev, flag) while(0 ==(mp = tmscpgetcp(um))) { tmscp_cp_wait++; - sleep(&tmscp_cp_wait,PSWP+1); + sleep((caddr_t)&tmscp_cp_wait,PSWP+1); tmscp_cp_wait--; } (void) splx(s); @@ -1051,7 +1038,7 @@ tmscpstart(um) minor(bp->b_dev)&03, bp->b_blkno); log(TMS_PRI, "tmscp%d: sa 0%o, state %d\n",um->um_ctlr, tmscpaddr->tmscpsa&0xffff, sc->sc_state); - tmscpinit(um->um_ctlr); + (void)tmscpinit(um->um_ctlr); /* SHOULD REQUEUE OUTSTANDING REQUESTS, LIKE TMSCPRESET */ break; } @@ -1296,7 +1283,7 @@ tmscpstart(um) if (tmscpaddr->tmscpsa&TMSCP_ERR) { printf("tmscp%d: fatal error (0%o)\n", um->um_ctlr, tmscpaddr->tmscpsa&0xffff); - tmscpinit(um->um_ctlr); + (void)tmscpinit(um->um_ctlr); break; } } /* end for */ @@ -1440,7 +1427,7 @@ tmscprsp(um, tm, sc, i) } if(mp->mscp_cmdref!=NULL) /* Seems to get lost sometimes in uda */ - wakeup((caddr_t *) mp->mscp_cmdref); + wakeup((caddr_t)mp->mscp_cmdref); break; /* * The AVAILABLE ATTENTION message occurs when the @@ -2063,7 +2050,7 @@ tmscpreset (uban) dp->b_active = 1; } } - tmscpinit(d); + (void)tmscpinit(d); } } diff --git a/usr/src/sys/vax/uba/uba.c b/usr/src/sys/vax/uba/uba.c index be3ef52e72..ba9d9adac9 100644 --- a/usr/src/sys/vax/uba/uba.c +++ b/usr/src/sys/vax/uba/uba.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)uba.c 6.9 (Berkeley) %G% + * @(#)uba.c 6.10 (Berkeley) %G% */ #include "../machine/pte.h" @@ -30,6 +30,8 @@ char ubasr_bits[] = UBASR_BITS; #endif +#define spluba spl7 /* IPL 17 */ + /* * Do transfer on device argument. The controller * and uba involved are implied by the device. @@ -51,7 +53,7 @@ ubago(ui) register int s, unit; uh = &uba_hd[um->um_ubanum]; - s = spl6(); + s = spluba(); if (um->um_driver->ud_xclu && uh->uh_users > 0 || uh->uh_xclu) goto rwait; um->um_ubinfo = ubasetup(um->um_ubanum, um->um_tab.b_actf->b_actf, @@ -125,7 +127,7 @@ ubasetup(uban, bp, flags) v = btop(bp->b_un.b_addr); o = (int)bp->b_un.b_addr & PGOFSET; npf = btoc(bp->b_bcount + o) + 1; - a = spl6(); + a = spluba(); while ((reg = rmalloc(uh->uh_map, (long)npf)) == 0) { if (flags & UBA_CANTWAIT) { splx(a); @@ -145,7 +147,7 @@ ubasetup(uban, bp, flags) } bdp = 0; if (flags & UBA_NEEDBDP) { - while ((bdp = ffs(uh->uh_bdpfree)) == 0) { + while ((bdp = ffs((long)uh->uh_bdpfree)) == 0) { if (flags & UBA_CANTWAIT) { rmfree(uh->uh_map, (long)npf, (long)reg); splx(a); @@ -217,7 +219,7 @@ ubarelse(uban, amr) * Carefully see if we should release the space, since * it may be released asynchronously at uba reset time. */ - s = spl6(); + s = spluba(); mr = *amr; if (mr == 0) { /* @@ -331,7 +333,7 @@ ubareset(uban) register struct uba_hd *uh = &uba_hd[uban]; int s; - s = spl6(); + s = spluba(); uh->uh_users = 0; uh->uh_zvcnt = 0; uh->uh_xclu = 0; @@ -445,7 +447,7 @@ ubaerror(uban, uh, ipl, uvec, uba) return; } sr = uba->uba_sr; - s = spl7(); + s = spluba(); printf("uba%d: uba error sr=%b fmer=%x fubar=%o\n", uban, uba->uba_sr, ubasr_bits, uba->uba_fmer, 4*uba->uba_fubar); splx(s); @@ -533,7 +535,7 @@ ubamem(uban, addr, npg, doalloc) int s; a = (addr >> 9) + 1; - s = spl6(); + s = spluba(); if (doalloc) a = rmget(uh->uh_map, npg, a); else diff --git a/usr/src/sys/vax/uba/uda.c b/usr/src/sys/vax/uba/uda.c index d1f840369a..372423026b 100644 --- a/usr/src/sys/vax/uba/uda.c +++ b/usr/src/sys/vax/uba/uda.c @@ -1,5 +1,5 @@ /* - * @(#)uda.c 6.18 (Berkeley) %G% + * @(#)uda.c 6.19 (Berkeley) %G% */ /************************************************************************ @@ -163,8 +163,6 @@ struct buf udutab[NRA]; struct buf udwtab[NUDA]; /* I/O wait queue, per controller */ -int nNRA = NRA; -int nNUDA = NUDA; int udamicro[NUDA]; /* to store microcode level */ int udaburst[NUDA] = { 0 }; /* DMA burst size, 0 is default */ @@ -342,7 +340,7 @@ udopen(dev, flag) extern quota; unit = udunit(dev); - if (unit >= nNRA || (ui = uddinfo[unit]) == 0 || ui->ui_alive == 0) + if (unit >= NRA || (ui = uddinfo[unit]) == 0 || ui->ui_alive == 0) return (ENXIO); sc = &uda_softc[ui->ui_ctlr]; s = spl5(); @@ -371,7 +369,7 @@ udopen(dev, flag) s = spl5(); while(0 ==(mp = udgetcp(um))){ uda_cp_wait++; - sleep(&uda_cp_wait,PSWP+1); + sleep((caddr_t)&uda_cp_wait,PSWP+1); uda_cp_wait--; } mp->mscp_opcode = M_OP_ONLIN; @@ -460,7 +458,7 @@ udstrategy(bp) sz = (bp->b_bcount+511) >> 9; unit = udunit(bp->b_dev); - if (unit >= nNRA) { + if (unit >= NRA) { bp->b_error = ENXIO; goto bad; } @@ -577,7 +575,7 @@ loop: if ((udaddr->udasa&UDA_ERR) || sc->sc_state != S_RUN) { harderr(bp, "ra"); mprintf("Uda%d udasa %o, state %d\n",um->um_ctlr , udaddr->udasa&0xffff, sc->sc_state); - udinit(um->um_ctlr); + (void)udinit(um->um_ctlr); /* SHOULD REQUEUE OUTSTANDING REQUESTS, LIKE UDRESET */ return (0); } @@ -790,21 +788,10 @@ udintr(d) * Check for a buffer purge request. */ if (ud->uda_ca.ca_bdp) { - /* - * THIS IS A KLUDGE. - * Maybe we should change the entire - * UBA interface structure. - */ - int s = spl6(); /* was spl7 but I don't like turning */ - /* off machine checks */ - i = um->um_ubinfo; #ifdef DEBUG printd("uda: purge bdp %d\n", ud->uda_ca.ca_bdp); #endif - um->um_ubinfo = ud->uda_ca.ca_bdp<<28; - ubapurge(um); - um->um_ubinfo = i; - (void) splx(s); + UBAPURGE(um->um_hd->uh_uba, ud->uda_ca.ca_bdp); ud->uda_ca.ca_bdp = 0; udaddr->udasa = 0; /* signal purge complete */ } @@ -834,7 +821,7 @@ udintr(d) ud->uda_ca.ca_cmdint = 0; } if(uda_cp_wait) - wakeup(&uda_cp_wait); + wakeup((caddr_t)&uda_cp_wait); (void) udstart(um); } @@ -959,7 +946,7 @@ udrsp(um, ud, sc, i) } } if(mp->mscp_cmdref!=NULL){/* Seems to get lost sometimes */ - wakeup((caddr_t *) mp->mscp_cmdref); + wakeup((caddr_t)mp->mscp_cmdref); } break; @@ -1176,7 +1163,7 @@ udread(dev, uio) { register int unit = udunit(dev); - if (unit >= nNRA) + if (unit >= NRA) return (ENXIO); return (physio(udstrategy, &rudbuf[unit], dev, B_READ, minphys, uio)); } @@ -1187,7 +1174,7 @@ udwrite(dev, uio) { register int unit = udunit(dev); - if (unit >= nNRA) + if (unit >= NRA) return (ENXIO); return (physio(udstrategy, &rudbuf[unit], dev, B_WRITE, minphys, uio)); } @@ -1211,7 +1198,7 @@ udreset(uban) um->um_tab.b_actf = um->um_tab.b_actl = 0; uda_softc[d].sc_state = S_IDLE; uda_softc[d].sc_mapped = 0; /* Rich */ - for (unit = 0; unit < nNRA; unit++) { + for (unit = 0; unit < NRA; unit++) { if ((ui = uddinfo[unit]) == 0) continue; if (ui->ui_alive == 0 || ui->ui_mi != um) @@ -1245,7 +1232,7 @@ udreset(uban) dp->b_active = 1; } } - udinit(d); + (void)udinit(d); } } @@ -1274,7 +1261,7 @@ uddump(dev) register int i; struct size *rasizes; unit = udunit(dev); - if (unit >= nNRA) + if (unit >= NRA) return (ENXIO); #define phys(cast, addr) ((cast)((int)addr & 0x7fffffff)) ui = phys(struct uba_device *, uddinfo[unit]); @@ -1392,7 +1379,7 @@ udsize(dev) struct uba_device *ui; struct size *rasizes; - if (unit >= nNRA || (ui = uddinfo[unit]) == 0 || ui->ui_alive == 0 + if (unit >= NRA || (ui = uddinfo[unit]) == 0 || ui->ui_alive == 0 || ui->ui_flags == 0) return (-1); rasizes = ra_info[ui->ui_unit].ra_sizes; diff --git a/usr/src/sys/vax/uba/up.c b/usr/src/sys/vax/uba/up.c index c8308a9356..5fcabf930b 100644 --- a/usr/src/sys/vax/uba/up.c +++ b/usr/src/sys/vax/uba/up.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)up.c 6.9 (Berkeley) %G% + * @(#)up.c 6.10 (Berkeley) %G% */ #include "up.h" @@ -763,7 +763,7 @@ doattn: * the unit start routine to place the slave * on the controller device queue. */ - while (unit = ffs(as)) { + while (unit = ffs((long)as)) { unit--; /* was 1 origin */ as &= ~(1<upas = 1<ui_driver->ud_xclu = (dens&(T_1600BPI|T_6250BPI)) == T_6250BPI; - s = spl6(); + s = splclock(); if (sc->sc_tact == 0) { sc->sc_timo = INF; sc->sc_tact = 1; diff --git a/usr/src/sys/vax/vax/Locore.c b/usr/src/sys/vax/vax/Locore.c index 7159f5100d..a6be025606 100644 --- a/usr/src/sys/vax/vax/Locore.c +++ b/usr/src/sys/vax/vax/Locore.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)Locore.c 6.7 (Berkeley) %G% + * @(#)Locore.c 6.8 (Berkeley) %G% */ #include "dz.h" @@ -28,6 +28,7 @@ #include "map.h" #include "nexus.h" +#include "ioa.h" #include "../vaxuba/ubavar.h" #include "../vaxuba/ubareg.h" @@ -182,6 +183,7 @@ char Sysbase[6*NPTEPG*NBPG]; int umbabeg; struct pte Nexmap[16][16]; struct nexus nexus[MAXNNEXUS]; +struct pte Ioamap[MAXNIOA][IOAMAPSIZ/NBPG]; struct pte UMEMmap[NUBA][512]; char umem[NUBA][512*NBPG]; int umbaend; @@ -255,8 +257,10 @@ resume(pcbpf) unsigned pcbpf; { } /*ARGSUSED*/ fubyte(base) caddr_t base; { return (0); } +#ifdef notdef /*ARGSUSED*/ fuibyte(base) caddr_t base; { return (0); } +#endif /*ARGSUSED*/ subyte(base, i) caddr_t base; { return (0); } /*ARGSUSED*/ @@ -321,7 +325,7 @@ scanc(size, cp, table, mask) { return (0); } /*ARGSUSED*/ -skpc(mask, size, cp) int mask; char *cp; unsigned size; { return (0); } +skpc(mask, size, cp) int mask; int size; char *cp; { return (0); } #ifdef notdef /*ARGSUSED*/ @@ -336,10 +340,12 @@ _remque(p) caddr_t p; { } /*ARGSUSED*/ ffs(v) long v; { return (0); } +#ifdef notdef imin(a, b) int a, b; { return (a < b ? a : b); } imax(a, b) int a, b; { return (a > b ? a : b); } unsigned min(a, b) u_int a, b; { return (a < b ? a : b); } unsigned max(a, b) u_int a, b; { return (a > b ? a : b); } +#endif ntohs(s) u_short s; { return ((int)s); } htons(s) u_short s; { return ((int)s); } ntohl(l) u_long l; { return ((int)l); } diff --git a/usr/src/sys/vax/vax/crl.c b/usr/src/sys/vax/vax/crl.c index 778d1ee063..d95dccf445 100644 --- a/usr/src/sys/vax/vax/crl.c +++ b/usr/src/sys/vax/vax/crl.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)crl.c 1.2 (Berkeley) %G% + * @(#)crl.c 1.3 (Berkeley) %G% */ /* * TO DO (tef 7/18/85): @@ -151,6 +151,9 @@ crlstart() crltab.crl_active = CRL_F_WRITE; mtpr(STXCS, bp->b_blkno<<8 | STXCS_IE | CRL_F_WRITE); } +#ifdef lint + crlintr(); +#endif } crlintr() diff --git a/usr/src/sys/vax/vax/ioa.h b/usr/src/sys/vax/vax/ioa.h index de8972b259..37c51670ed 100644 --- a/usr/src/sys/vax/vax/ioa.h +++ b/usr/src/sys/vax/vax/ioa.h @@ -1,5 +1,5 @@ /* - * @(#)ioa.h 1.2 (Berkeley) %G% + * @(#)ioa.h 1.3 (Berkeley) %G% */ /************************************************************************ * * @@ -83,6 +83,3 @@ struct ioa ioa[MAXNIOA]; #define IOA_TYPMSK 0xf0 #define IOA_SBIA 0x10 -#define IOA_SBI780 0x01 -#define IOA_CMI750 0x02 -#define IOA_XXX730 0x04 diff --git a/usr/src/sys/vax/vax/locore.s b/usr/src/sys/vax/vax/locore.s index 29f5d9d06b..80ee5e3c17 100644 --- a/usr/src/sys/vax/vax/locore.s +++ b/usr/src/sys/vax/vax/locore.s @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)locore.s 6.34 (Berkeley) %G% + * @(#)locore.s 6.35 (Berkeley) %G% */ #include "psl.h" @@ -1159,7 +1159,7 @@ ENTRY(savectx, 0) /* * Setrq(p), using fancy VAX instructions. * - * Call should be made at spl6(), and p->p_stat should be SRUN + * Call should be made at splclock(), and p->p_stat should be SRUN */ .align 1 JSBENTRY(Setrq, R0) @@ -1181,7 +1181,7 @@ set3: .asciz "setrq" /* * Remrq(p), using fancy VAX instructions * - * Call should be made at spl6(). + * Call should be made at splclock(). */ .align 1 JSBENTRY(Remrq, R0) diff --git a/usr/src/sys/vax/vax/machdep.c b/usr/src/sys/vax/vax/machdep.c index 46dc14d98d..13608d9841 100644 --- a/usr/src/sys/vax/vax/machdep.c +++ b/usr/src/sys/vax/vax/machdep.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)machdep.c 6.25 (Berkeley) %G% + * @(#)machdep.c 6.26 (Berkeley) %G% */ #include "reg.h" @@ -333,7 +333,7 @@ sendsig(p, sig, mask) scp = (struct sigcontext *)regs[SP] - 1; fp = (struct sigframe *)scp - 1; if ((int)fp <= USRSTACK - ctob(u.u_ssize)) - grow((unsigned)fp); + (void)grow((unsigned)fp); if (useracc((caddr_t)fp, sizeof (*fp) + sizeof (*scp), B_WRITE) == 0) { /* * Process has trashed its stack; give it an illegal diff --git a/usr/src/sys/vax/vax/mem.c b/usr/src/sys/vax/vax/mem.c index 516ff0454a..35afcc4a7f 100644 --- a/usr/src/sys/vax/vax/mem.c +++ b/usr/src/sys/vax/vax/mem.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)mem.c 6.3 (Berkeley) %G% + * @(#)mem.c 6.4 (Berkeley) %G% */ /* @@ -72,8 +72,9 @@ mmrw(dev, uio, rw) (rw == UIO_READ ? PG_KR : PG_KW); mtpr(TBIS, vmmap); o = (int)uio->uio_offset & PGOFSET; - c = min((u_int)(NBPG - o), (u_int)iov->iov_len); - c = min(c, (u_int)(NBPG - ((int)iov->iov_base&PGOFSET))); + c = (u_int)(NBPG - ((int)iov->iov_base & PGOFSET)); + c = MIN(c, (u_int)(NBPG - o)); + c = MIN(c, (u_int)iov->iov_len); error = uiomove((caddr_t)&vmmap[o], (int)c, rw, uio); continue; diff --git a/usr/src/sys/vax/vax/trap.c b/usr/src/sys/vax/vax/trap.c index ca5cda53a5..95d31e8cf0 100644 --- a/usr/src/sys/vax/vax/trap.c +++ b/usr/src/sys/vax/vax/trap.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)trap.c 6.7 (Berkeley) %G% + * @(#)trap.c 6.8 (Berkeley) %G% */ #include "psl.h" @@ -157,7 +157,7 @@ out: * swtch()'ed, we might not be on the queue indicated by * our priority. */ - (void) spl6(); + (void) splclock(); setrq(p); u.u_ru.ru_nivcsw++; swtch(); @@ -279,7 +279,7 @@ done: * swtch()'ed, we might not be on the queue indicated by * our priority. */ - (void) spl6(); + (void) splclock(); setrq(p); u.u_ru.ru_nivcsw++; swtch(); diff --git a/usr/src/sys/vax/vax/tu.c b/usr/src/sys/vax/vax/tu.c index 3e7cdace3d..4630c07a73 100644 --- a/usr/src/sys/vax/vax/tu.c +++ b/usr/src/sys/vax/vax/tu.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)tu.c 6.6 (Berkeley) %G% + * @(#)tu.c 6.7 (Berkeley) %G% */ #if defined(VAX750) || defined(VAX730) @@ -46,7 +46,7 @@ int tudebug; /* printd */ #define NTUBLK 512 /* number of blocks on a TU58 cassette */ #define WRV 02 /* bit in minor dev => write w. read verify */ #define NTUQ 2 /* # of blocks which can be queued up */ -#define TUIPL ((cpu == VAX_750) ? 0x17 : 0x14) +#define spltu() ((cpu == VAX_750) ? spl7() : spl4()) #ifndef MRSP #define MRSP (cpu != VAX_750) @@ -113,7 +113,7 @@ tuopen(dev, flag) if (tutimer++ == 0) timeout(tuwatch, (caddr_t)0, hz); - s = splx(TUIPL); + s = spltu(); tu.tu_dopen[minor(dev)&DNUM]++; /* * If the cassette's already initialized, @@ -157,7 +157,7 @@ tuclose(dev, flag) int s, unit = minor(dev); struct buf *bp, *last = NULL; - s = splx(TUIPL); + s = spltu(); while (tu_pcnt[unit]) sleep(&tu_pcnt[unit], PRIBIO); /* @@ -186,7 +186,7 @@ tuclose(dev, flag) tuwake(bp) struct buf *bp; { - wakeup(bp); + wakeup((caddr_t)bp); } /* @@ -225,7 +225,7 @@ tustrategy(bp) if ((bp->b_flags&B_READ) == 0) tu_pee(&tu_pcnt[minor(bp->b_dev)&DNUM]); bp->av_forw = NULL; - s = splx(TUIPL); + s = spltu(); if (tutab.b_actf == NULL) tutab.b_actf = bp; else @@ -246,7 +246,7 @@ tustart() if ((bp = tutab.b_actf) == NULL) return; - s = splx(TUIPL); + s = spltu(); if (tu.tu_state != TUS_IDLE) { tureset(); splx(s); @@ -331,7 +331,7 @@ turintr() tudata.pk_flag = TUF_DATA; tudata.pk_mcount = MIN(128, tu.tu_count); tudata.pk_chksum = - tuchk(*((short *)&tudata), (caddr_t)tu.tu_addr, + tuchk(*((short *)&tudata), (u_short *)tu.tu_addr, (int)tudata.pk_mcount); tu.tu_state = TUS_SENDH; tu.tu_wbptr = (u_char *)&tudata; @@ -638,7 +638,7 @@ tuchk(word, cp, n) #else tuchk(word0, wp, n) register int word0; /* r11 */ - register char *wp; /* r10 */ + register u_short *wp; /* r10 */ register int n; /* r9 */ { asm("loop:"); @@ -676,7 +676,7 @@ tuwatch() tu.tu_wbptr, tu.tu_wcnt, tu.tu_state, tu.tu_flag, tu.tu_addr, tu.tu_count); #endif - s = splx(TUIPL); + s = spltu(); tu.tu_flag = 0; (void) mfpr(CSRD); mtpr(CSRS, IE); /* in case we were flushing */ @@ -706,7 +706,7 @@ tu_pee(cp) { register int s; - s = splx(TUIPL); + s = spltu(); if (++(*cp) > NTUQ) sleep(cp, PRIBIO); splx(s); @@ -717,7 +717,7 @@ tu_vee(cp) { register int s; - s = splx(TUIPL); + s = spltu(); if (--(*cp) <= NTUQ) wakeup(cp); splx(s); -- 2.20.1