summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authoreivind <eivind@FreeBSD.org>1999-01-10 01:58:29 +0000
committereivind <eivind@FreeBSD.org>1999-01-10 01:58:29 +0000
commit89e11995349cb9c2dab945decdcca7c775b1da23 (patch)
treecbf327b4157cdef7815c3325d5228ee8a2401bb7 /sys/kern
parent541b200a907df9730d6c52f272bc2eb5385c41fe (diff)
downloadFreeBSD-src-89e11995349cb9c2dab945decdcca7c775b1da23.zip
FreeBSD-src-89e11995349cb9c2dab945decdcca7c775b1da23.tar.gz
KNFize, by bde.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_lock.c3
-rw-r--r--sys/kern/kern_malloc.c11
-rw-r--r--sys/kern/kern_proc.c11
-rw-r--r--sys/kern/kern_sig.c4
-rw-r--r--sys/kern/kern_subr.c10
-rw-r--r--sys/kern/kern_synch.c7
-rw-r--r--sys/kern/subr_rlist.c8
-rw-r--r--sys/kern/tty_snoop.c5
-rw-r--r--sys/kern/uipc_socket.c4
-rw-r--r--sys/kern/vfs_bio.c25
-rw-r--r--sys/kern/vfs_cluster.c17
-rw-r--r--sys/kern/vfs_export.c6
-rw-r--r--sys/kern/vfs_lookup.c8
-rw-r--r--sys/kern/vfs_subr.c6
14 files changed, 59 insertions, 66 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index 0bf31d0..0903f6e 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -38,7 +38,7 @@
* SUCH DAMAGE.
*
* @(#)kern_lock.c 8.18 (Berkeley) 5/21/95
- * $Id: kern_lock.c,v 1.20 1998/11/26 18:50:23 eivind Exp $
+ * $Id: kern_lock.c,v 1.21 1999/01/08 17:31:08 eivind Exp $
*/
#include "opt_lint.h"
@@ -83,6 +83,7 @@ sharelock(struct lock *lkp, int incr) {
static LOCK_INLINE void
shareunlock(struct lock *lkp, int decr) {
+
KASSERT(lkp->lk_sharecount >= decr, ("shareunlock: count < decr"));
if (lkp->lk_sharecount == decr) {
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 4cd7b73..a9776a5 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94
- * $Id: kern_malloc.c,v 1.49 1998/11/10 08:46:24 peter Exp $
+ * $Id: kern_malloc.c,v 1.50 1999/01/08 17:31:09 eivind Exp $
*/
#include "opt_vm.h"
@@ -64,7 +64,7 @@ static char *kmembase;
static char *kmemlimit;
static int vm_kmem_size;
-#if defined(INVARIANTS)
+#ifdef INVARIANTS
/*
* This structure provides a set of masks to catch unaligned frees.
*/
@@ -261,7 +261,7 @@ free(addr, type)
panic("freeing with unknown type (%s)", type->ks_shortdesc);
KASSERT(kmembase <= (char *)addr && (char *)addr < kmemlimit,
- ("free: address %p out of range", (void *)addr));
+ ("free: address %p out of range", (void *)addr));
kup = btokup(addr);
size = 1 << kup->ku_indx;
kbp = &bucket[kup->ku_indx];
@@ -302,11 +302,10 @@ free(addr, type)
if (freep->spare0 == WEIRD_ADDR) {
fp = (struct freelist *)kbp->kb_next;
while (fp) {
- if (fp->spare0 != WEIRD_ADDR) {
+ if (fp->spare0 != WEIRD_ADDR)
panic("free: free item %p modified", fp);
- } else if (addr == (caddr_t)fp) {
+ else if (addr == (caddr_t)fp)
panic("free: multiple freed item %p", addr);
- }
fp = (struct freelist *)fp->next;
}
}
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 313a9e7..c615d95 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)kern_proc.c 8.7 (Berkeley) 2/14/95
- * $Id: kern_proc.c,v 1.40 1998/11/11 10:55:56 truckman Exp $
+ * $Id: kern_proc.c,v 1.41 1999/01/08 17:31:09 eivind Exp $
*/
#include <sys/param.h>
@@ -196,9 +196,10 @@ enterpgrp(p, pgid, mksess)
register struct pgrp *pgrp = pgfind(pgid);
KASSERT(pgrp == NULL || !mksess,
- ("enterpgrp: setsid into non-empty pgrp"));
+ ("enterpgrp: setsid into non-empty pgrp"));
KASSERT(!SESS_LEADER(p),
- ("enterpgrp: session leader attempted setpgrp"));
+ ("enterpgrp: session leader attempted setpgrp"));
+
if (pgrp == NULL) {
pid_t savepid = p->p_pid;
struct proc *np;
@@ -206,7 +207,7 @@ enterpgrp(p, pgid, mksess)
* new process group
*/
KASSERT(p->p_pid == pgid,
- ("enterpgrp: new pgrp and pid != pgid"));
+ ("enterpgrp: new pgrp and pid != pgid"));
MALLOC(pgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP,
M_WAITOK);
if ((np = pfind(savepid)) == NULL || np != p)
@@ -229,7 +230,7 @@ enterpgrp(p, pgid, mksess)
p->p_flag &= ~P_CONTROLT;
pgrp->pg_session = sess;
KASSERT(p == curproc,
- ("enterpgrp: mksession and p != curproc"));
+ ("enterpgrp: mksession and p != curproc"));
} else {
pgrp->pg_session = p->p_session;
pgrp->pg_session->s_count++;
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index e9a51d4..bf89d8a 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_sig.c 8.7 (Berkeley) 4/18/94
- * $Id: kern_sig.c,v 1.51 1998/12/19 02:55:33 julian Exp $
+ * $Id: kern_sig.c,v 1.52 1999/01/08 17:31:10 eivind Exp $
*/
#include "opt_compat.h"
@@ -1213,7 +1213,7 @@ postsig(signum)
* If we get here, the signal must be caught.
*/
KASSERT(action != SIG_IGN && (p->p_sigmask & mask) == 0,
- ("postsig action"));
+ ("postsig action"));
/*
* Set the new mask value and also defer further
* occurences of this signal.
diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c
index d775d97..a96d554 100644
--- a/sys/kern/kern_subr.c
+++ b/sys/kern/kern_subr.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_subr.c 8.3 (Berkeley) 1/21/94
- * $Id: kern_subr.c,v 1.22 1998/08/04 09:21:04 phk Exp $
+ * $Id: kern_subr.c,v 1.23 1999/01/08 17:31:10 eivind Exp $
*/
#include <sys/param.h>
@@ -62,9 +62,9 @@ uiomove(cp, n, uio)
int error;
KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE,
- ("uiomove: mode"));
+ ("uiomove: mode"));
KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_procp == curproc,
- ("uiomove proc"));
+ ("uiomove proc"));
while (n > 0 && uio->uio_resid) {
iov = uio->uio_iov;
@@ -120,9 +120,9 @@ uiomoveco(cp, n, uio, obj)
int error;
KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE,
- ("uiomoveco: mode"));
+ ("uiomoveco: mode"));
KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_procp == curproc,
- ("uiomoveco proc"));
+ ("uiomoveco proc"));
while (n > 0 && uio->uio_resid) {
iov = uio->uio_iov;
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 3a9391d..f8baf85 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_synch.c 8.9 (Berkeley) 5/19/95
- * $Id: kern_synch.c,v 1.70 1998/12/21 07:41:51 dillon Exp $
+ * $Id: kern_synch.c,v 1.71 1999/01/08 17:31:10 eivind Exp $
*/
#include "opt_ktrace.h"
@@ -401,11 +401,8 @@ tsleep(ident, priority, wmesg, timo)
splx(s);
return (0);
}
-
KASSERT(p != NULL, ("tsleep1"));
- KASSERT(ident != NULL && p->p_stat == SRUN,
- ("tsleep"));
-
+ KASSERT(ident != NULL && p->p_stat == SRUN, ("tsleep"));
/*
* Process may be sitting on a slpque if asleep() was called, remove
* it before re-adding.
diff --git a/sys/kern/subr_rlist.c b/sys/kern/subr_rlist.c
index c3fdabf..d637ab4 100644
--- a/sys/kern/subr_rlist.c
+++ b/sys/kern/subr_rlist.c
@@ -54,7 +54,7 @@
* functioning of this software, nor does the author assume any responsibility
* for damages incurred with its use.
*
- * $Id: subr_rlist.c,v 1.27 1998/08/05 14:06:04 dg Exp $
+ * $Id: subr_rlist.c,v 1.28 1999/01/08 17:31:12 eivind Exp $
*/
#include <sys/param.h>
@@ -139,11 +139,11 @@ rlist_free(rlh, start, end)
break;
if (prev_rlp) {
KASSERT(prev_rlp->rl_end + 1 != cur_rlp->rl_start,
- ("rlist_free: missed coalesce opportunity"));
+ ("rlist_free: missed coalesce opportunity"));
KASSERT(prev_rlp->rl_end != cur_rlp->rl_start,
- ("rlist_free: entries overlap"));
+ ("rlist_free: entries overlap"));
KASSERT(prev_rlp->rl_end <= cur_rlp->rl_start,
- ("entries out of order"));
+ ("entries out of order"));
}
prev_rlp = cur_rlp;
cur_rlp = cur_rlp->rl_next;
diff --git a/sys/kern/tty_snoop.c b/sys/kern/tty_snoop.c
index 06f17dd..ba71a94 100644
--- a/sys/kern/tty_snoop.c
+++ b/sys/kern/tty_snoop.c
@@ -136,7 +136,7 @@ snpread(dev, uio, flag)
char *nbuf;
KASSERT(snp->snp_len + snp->snp_base <= snp->snp_blen,
- ("snoop buffer error"));
+ ("snoop buffer error"));
if (snp->snp_tty == NULL)
return (EIO);
@@ -206,12 +206,11 @@ snpin(snp, buf, n)
caddr_t from, to;
char *nbuf;
+ KASSERT(n >= 0, ("negative snoop char count"));
if (n == 0)
return 0;
- KASSERT(n > 0, ("negative snoop char count"));
-
#ifdef DIAGNOSTIC
if (!(snp->snp_flags & SNOOP_OPEN)) {
printf("Snoop: data coming to closed device.\n");
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index f7fe5a7..5ce603b 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94
- * $Id: uipc_socket.c,v 1.47 1998/12/07 21:58:29 archie Exp $
+ * $Id: uipc_socket.c,v 1.48 1999/01/08 17:31:13 eivind Exp $
*/
#include <sys/param.h>
@@ -736,7 +736,7 @@ dontblock:
break;
else
KASSERT(m->m_type == MT_DATA || m->m_type == MT_HEADER,
- ("receive 3"));
+ ("receive 3"));
so->so_state &= ~SS_RCVATMARK;
len = uio->uio_resid;
if (so->so_oobmark && len > so->so_oobmark - offset)
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 28d8a03..6ed2d6b 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -11,7 +11,7 @@
* 2. Absolutely no warranty of function or purpose is made by the author
* John S. Dyson.
*
- * $Id: vfs_bio.c,v 1.189 1998/12/22 18:57:30 dillon Exp $
+ * $Id: vfs_bio.c,v 1.190 1999/01/08 17:31:14 eivind Exp $
*/
/*
@@ -692,6 +692,7 @@ brelse(struct buf * bp)
int poffset = foff & PAGE_MASK;
int presid = resid > (PAGE_SIZE - poffset) ?
(PAGE_SIZE - poffset) : resid;
+
KASSERT(presid >= 0, ("brelse: extra page"));
vm_page_set_invalid(m, poffset, presid);
}
@@ -998,10 +999,8 @@ trytofreespace:
while (needsbuffer & VFS_BIO_NEED_ANY);
return (0);
}
-
KASSERT(!(bp->b_flags & B_BUSY),
- ("getnewbuf: busy buffer on free list\n"));
-
+ ("getnewbuf: busy buffer on free list\n"));
/*
* We are fairly aggressive about freeing VMIO buffers, but since
* the buffering is intact without buffer headers, there is not
@@ -1453,10 +1452,8 @@ loop:
goto loop;
}
}
-
KASSERT(bp->b_offset != NOOFFSET,
- ("getblk: no buffer offset"));
-
+ ("getblk: no buffer offset"));
/*
* Check that the constituted buffer really deserves for the
* B_CACHE bit to be set. B_VMIO type buffers might not
@@ -1704,7 +1701,7 @@ allocbuf(struct buf * bp, int size)
*/
m = bp->b_pages[i];
KASSERT(m != bogus_page,
- ("allocbuf: bogus page found"));
+ ("allocbuf: bogus page found"));
vm_page_sleep(m, "biodep", &m->busy);
bp->b_pages[i] = NULL;
@@ -1738,8 +1735,7 @@ allocbuf(struct buf * bp, int size)
off = bp->b_offset;
KASSERT(bp->b_offset != NOOFFSET,
- ("allocbuf: no buffer offset"));
-
+ ("allocbuf: no buffer offset"));
curbpnpages = bp->b_npages;
doretry:
bp->b_validoff = orig_validoff;
@@ -1927,7 +1923,7 @@ biodone(register struct buf * bp)
foff = bp->b_offset;
KASSERT(bp->b_offset != NOOFFSET,
- ("biodone: no buffer offset"));
+ ("biodone: no buffer offset"));
#if !defined(MAX_PERF)
if (!obj) {
@@ -2200,8 +2196,7 @@ vfs_busy_pages(struct buf * bp, int clear_modify)
foff = bp->b_offset;
KASSERT(bp->b_offset != NOOFFSET,
- ("vfs_busy_pages: no buffer offset"));
-
+ ("vfs_busy_pages: no buffer offset"));
vfs_setdirty(bp);
retry:
@@ -2249,10 +2244,8 @@ vfs_clean_pages(struct buf * bp)
if (bp->b_flags & B_VMIO) {
vm_ooffset_t foff;
foff = bp->b_offset;
-
KASSERT(bp->b_offset != NOOFFSET,
- ("vfs_clean_pages: no buffer offset"));
-
+ ("vfs_clean_pages: no buffer offset"));
for (i = 0; i < bp->b_npages; i++) {
vm_page_t m = bp->b_pages[i];
vfs_page_set_valid(bp, foff, i, m);
diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c
index 07434ce..ce842ad 100644
--- a/sys/kern/vfs_cluster.c
+++ b/sys/kern/vfs_cluster.c
@@ -33,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94
- * $Id: vfs_cluster.c,v 1.75 1998/12/05 06:12:14 mckusick Exp $
+ * $Id: vfs_cluster.c,v 1.76 1999/01/08 17:31:15 eivind Exp $
*/
#include "opt_debug_cluster.h"
@@ -166,10 +166,10 @@ cluster_read(vp, filesize, lblkno, size, cred, totread, seqcount, bpp)
}
reqbp = bp = NULL;
} else {
- off_t firstread;
- firstread = bp->b_offset;
+ off_t firstread = bp->b_offset;
+
KASSERT(bp->b_offset != NOOFFSET,
- ("cluster_read: no buffer offset"));
+ ("cluster_read: no buffer offset"));
if (firstread + totread > filesize)
totread = filesize - firstread;
if (totread > size) {
@@ -311,8 +311,9 @@ cluster_rbuild(vp, filesize, lbn, blkno, size, run, fbp)
int i, inc, j;
KASSERT(size == vp->v_mount->mnt_stat.f_iosize,
- ("cluster_rbuild: size %ld != filesize %ld\n",
- size, vp->v_mount->mnt_stat.f_iosize));
+ ("cluster_rbuild: size %ld != filesize %ld\n",
+ size, vp->v_mount->mnt_stat.f_iosize));
+
/*
* avoid a division
*/
@@ -346,8 +347,7 @@ cluster_rbuild(vp, filesize, lbn, blkno, size, run, fbp)
bp->b_blkno = blkno;
bp->b_lblkno = lbn;
bp->b_offset = tbp->b_offset;
- KASSERT(bp->b_offset != NOOFFSET,
- ("cluster_rbuild: no buffer offset"));
+ KASSERT(bp->b_offset != NOOFFSET, ("cluster_rbuild: no buffer offset"));
pbgetvp(vp, bp);
TAILQ_INIT(&bp->b_cluster.cluster_head);
@@ -510,7 +510,6 @@ cluster_write(bp, filesize)
lblocksize = bp->b_bufsize;
}
lbn = bp->b_lblkno;
-
KASSERT(bp->b_offset != NOOFFSET, ("cluster_write: no buffer offset"));
/* Initialize vnode to beginning of file. */
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c
index 92a8710..179ef78 100644
--- a/sys/kern/vfs_export.c
+++ b/sys/kern/vfs_export.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
- * $Id: vfs_subr.c,v 1.180 1999/01/05 18:49:53 eivind Exp $
+ * $Id: vfs_subr.c,v 1.181 1999/01/08 17:31:17 eivind Exp $
*/
/*
@@ -797,6 +797,7 @@ bgetvp(vp, bp)
int s;
KASSERT(bp->b_vp == NULL, ("bgetvp: not free"));
+
vhold(vp);
bp->b_vp = vp;
if (vp->v_type == VBLK || vp->v_type == VCHR)
@@ -990,6 +991,7 @@ pbgetvp(vp, bp)
register struct vnode *vp;
register struct buf *bp;
{
+
KASSERT(bp->b_vp == NULL, ("pbgetvp: not free"));
bp->b_vp = vp;
@@ -1302,7 +1304,7 @@ vrele(vp)
{
struct proc *p = curproc; /* XXX */
- KASSERT(vp, ("vrele: null vp"));
+ KASSERT(vp != NULL, ("vrele: null vp"));
simple_lock(&vp->v_interlock);
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index e6e8a6f..67efd52 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_lookup.c 8.4 (Berkeley) 2/16/94
- * $Id: vfs_lookup.c,v 1.29 1999/01/05 18:49:52 eivind Exp $
+ * $Id: vfs_lookup.c,v 1.30 1999/01/08 17:31:16 eivind Exp $
*/
#include "opt_ktrace.h"
@@ -91,9 +91,9 @@ namei(ndp)
ndp->ni_cnd.cn_cred = ndp->ni_cnd.cn_proc->p_ucred;
KASSERT(cnp->cn_cred && cnp->cn_proc, ("namei: bad cred/proc"));
KASSERT((cnp->cn_nameiop & (~OPMASK)) == 0,
- ("namei: nameiop contaminated with flags"));
+ ("namei: nameiop contaminated with flags"));
KASSERT((cnp->cn_flags & OPMASK) == 0,
- ("namei: flags contaminated with nameiops"));
+ ("namei: flags contaminated with nameiops"));
fdp = cnp->cn_proc->p_fd;
/*
@@ -670,7 +670,7 @@ relookup(dvp, vpp, cnp)
* Check for symbolic link
*/
KASSERT(dp->v_type != VLNK || !(cnp->cn_flags & FOLLOW),
- ("relookup: symlink found.\n"));
+ ("relookup: symlink found.\n"));
/*
* Disallow directory write attempts on read-only file systems.
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 92a8710..179ef78 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
- * $Id: vfs_subr.c,v 1.180 1999/01/05 18:49:53 eivind Exp $
+ * $Id: vfs_subr.c,v 1.181 1999/01/08 17:31:17 eivind Exp $
*/
/*
@@ -797,6 +797,7 @@ bgetvp(vp, bp)
int s;
KASSERT(bp->b_vp == NULL, ("bgetvp: not free"));
+
vhold(vp);
bp->b_vp = vp;
if (vp->v_type == VBLK || vp->v_type == VCHR)
@@ -990,6 +991,7 @@ pbgetvp(vp, bp)
register struct vnode *vp;
register struct buf *bp;
{
+
KASSERT(bp->b_vp == NULL, ("pbgetvp: not free"));
bp->b_vp = vp;
@@ -1302,7 +1304,7 @@ vrele(vp)
{
struct proc *p = curproc; /* XXX */
- KASSERT(vp, ("vrele: null vp"));
+ KASSERT(vp != NULL, ("vrele: null vp"));
simple_lock(&vp->v_interlock);
OpenPOWER on IntegriCloud