summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMichael Knudsen <mk@cvs.openbsd.org>2008-06-14 10:55:22 +0000
committerMichael Knudsen <mk@cvs.openbsd.org>2008-06-14 10:55:22 +0000
commitace977b163a487262367b29bf0a11c9438cd3480 (patch)
treea9aacbf84fd80fdaa00d85a1f4cf5d4d21c7ae8d /sys
parent4ef5afc9653e726120eef49602859549321429b8 (diff)
A bunch of pool_get() + bzero() -> pool_get(..., .. | PR_ZERO)
conversions that should shave a few bytes off the kernel. ok henning, krw, jsing, oga, miod, and thib (``even though i usually prefer FOO|BAR''; thanks for looking.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/m68k/m68k/pmap_motorola.c5
-rw-r--r--sys/arch/m88k/m88k/pmap.c5
-rw-r--r--sys/arch/mips64/mips64/pmap.c5
-rw-r--r--sys/arch/powerpc/powerpc/pmap.c14
-rw-r--r--sys/arch/powerpc/powerpc/trap.c8
-rw-r--r--sys/arch/solbourne/solbourne/pmap.c5
-rw-r--r--sys/arch/sparc64/sparc64/pmap.c5
-rw-r--r--sys/arch/vax/vax/pmap.c5
-rw-r--r--sys/dev/ccd.c6
-rw-r--r--sys/isofs/udf/udf_vfsops.c5
-rw-r--r--sys/isofs/udf/udf_vnops.c5
-rw-r--r--sys/kern/uipc_socket.c5
-rw-r--r--sys/kern/vfs_subr.c5
-rw-r--r--sys/nfs/nfs_node.c5
-rw-r--r--sys/ufs/ffs/ffs_softdep.c25
15 files changed, 42 insertions, 66 deletions
diff --git a/sys/arch/m68k/m68k/pmap_motorola.c b/sys/arch/m68k/m68k/pmap_motorola.c
index 82a1285317f..51d15bf2145 100644
--- a/sys/arch/m68k/m68k/pmap_motorola.c
+++ b/sys/arch/m68k/m68k/pmap_motorola.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap_motorola.c,v 1.52 2007/04/13 18:57:49 art Exp $ */
+/* $OpenBSD: pmap_motorola.c,v 1.53 2008/06/14 10:55:20 mk Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -644,8 +644,7 @@ pmap_create()
PMAP_DPRINTF(PDB_FOLLOW|PDB_CREATE,
("pmap_create\n"));
- pmap = pool_get(&pmap_pmap_pool, PR_WAITOK);
- bzero(pmap, sizeof(*pmap));
+ pmap = pool_get(&pmap_pmap_pool, PR_WAITOK | PR_ZERO);
/*
* No need to allocate page table space yet but we do need a
diff --git a/sys/arch/m88k/m88k/pmap.c b/sys/arch/m88k/m88k/pmap.c
index febde613ea0..beb668556a5 100644
--- a/sys/arch/m88k/m88k/pmap.c
+++ b/sys/arch/m88k/m88k/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.44 2008/06/10 21:12:14 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.45 2008/06/14 10:55:20 mk Exp $ */
/*
* Copyright (c) 2001-2004, Miodrag Vallat
* Copyright (c) 1998-2001 Steve Murphree, Jr.
@@ -837,8 +837,7 @@ pmap_create(void)
paddr_t stpa;
u_int s;
- pmap = pool_get(&pmappool, PR_WAITOK);
- bzero(pmap, sizeof(*pmap));
+ pmap = pool_get(&pmappool, PR_WAITOK | PR_ZERO);
/*
* Allocate memory for *actual* segment table and *shadow* table.
diff --git a/sys/arch/mips64/mips64/pmap.c b/sys/arch/mips64/mips64/pmap.c
index 38553ea56f6..598f57f33cd 100644
--- a/sys/arch/mips64/mips64/pmap.c
+++ b/sys/arch/mips64/mips64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.33 2008/04/07 22:30:48 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.34 2008/06/14 10:55:20 mk Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -278,9 +278,8 @@ extern struct user *proc0paddr;
DPRINTF(PDB_FOLLOW|PDB_CREATE, ("pmap_create()\n"));
s = splvm();
- pmap = pool_get(&pmap_pmap_pool, PR_WAITOK);
+ pmap = pool_get(&pmap_pmap_pool, PR_WAITOK | PR_ZERO);
splx(s);
- bzero(pmap, sizeof(*pmap));
simple_lock_init(&pmap->pm_lock);
pmap->pm_count = 1;
diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c
index e2cedd6a540..8d5829f2693 100644
--- a/sys/arch/powerpc/powerpc/pmap.c
+++ b/sys/arch/powerpc/powerpc/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.104 2008/04/26 22:37:41 drahn Exp $ */
+/* $OpenBSD: pmap.c,v 1.105 2008/06/14 10:55:20 mk Exp $ */
/*
* Copyright (c) 2001, 2002, 2007 Dale Rahn.
@@ -321,18 +321,16 @@ pmap_vp_enter(pmap_t pm, vaddr_t va, struct pte_desc *pted)
vp1 = pm->pm_vp[VP_SR(va)];
if (vp1 == NULL) {
s = splvm();
- vp1 = pool_get(&pmap_vp_pool, PR_NOWAIT);
+ vp1 = pool_get(&pmap_vp_pool, PR_NOWAIT | PR_ZERO);
splx(s);
- bzero(vp1, sizeof (struct pmapvp));
pm->pm_vp[VP_SR(va)] = vp1;
}
vp2 = vp1->vp[VP_IDX1(va)];
if (vp2 == NULL) {
s = splvm();
- vp2 = pool_get(&pmap_vp_pool, PR_NOWAIT);
+ vp2 = pool_get(&pmap_vp_pool, PR_NOWAIT | PR_ZERO);
splx(s);
- bzero(vp2, sizeof (struct pmapvp));
vp1->vp[VP_IDX1(va)] = vp2;
}
@@ -516,8 +514,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
/* Do not have pted for this, get one and put it in VP */
if (pted == NULL) {
- pted = pool_get(&pmap_pted_pool, PR_NOWAIT);
- bzero(pted, sizeof (*pted));
+ pted = pool_get(&pmap_pted_pool, PR_NOWAIT | PR_ZERO);
pmap_vp_enter(pm, va, pted);
}
@@ -725,8 +722,7 @@ _pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, int flags, int cache)
/* XXX - future panic? */
printf("pted not preallocated in pmap_kernel() va %lx pa %lx\n",
va, pa);
- pted = pool_get(&pmap_pted_pool, PR_NOWAIT);
- bzero(pted, sizeof (*pted));
+ pted = pool_get(&pmap_pted_pool, PR_NOWAIT | PR_ZERO);
pmap_vp_enter(pm, va, pted);
}
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c
index 17a10d044f7..0c3a5d03873 100644
--- a/sys/arch/powerpc/powerpc/trap.c
+++ b/sys/arch/powerpc/powerpc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.82 2008/05/03 17:27:04 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.83 2008/06/14 10:55:20 mk Exp $ */
/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */
/*
@@ -184,10 +184,8 @@ enable_vec(struct proc *p)
/* If this is the very first altivec instruction executed
* by this process, create a context.
*/
- if (pcb->pcb_vr == NULL) {
- pcb->pcb_vr = pool_get(&ppc_vecpl, PR_WAITOK);
- bzero(pcb->pcb_vr, sizeof *(pcb->pcb_vr));
- }
+ if (pcb->pcb_vr == NULL)
+ pcb->pcb_vr = pool_get(&ppc_vecpl, PR_WAITOK | PR_ZERO);
if (curcpu()->ci_vecproc != NULL || pcb->pcb_veccpu != NULL)
printf("attempting to restore vector in use vecproc %x"
diff --git a/sys/arch/solbourne/solbourne/pmap.c b/sys/arch/solbourne/solbourne/pmap.c
index f805831401e..09a70e96e3b 100644
--- a/sys/arch/solbourne/solbourne/pmap.c
+++ b/sys/arch/solbourne/solbourne/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.1 2005/04/19 21:30:18 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.2 2008/06/14 10:55:20 mk Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat
*
@@ -504,9 +504,8 @@ pmap_create()
DPRINTF(PDB_CREATE, ("pmap_create()"));
- pmap = pool_get(&pmappool, PR_WAITOK);
+ pmap = pool_get(&pmappool, PR_WAITOK | PR_ZERO);
- bzero(pmap, sizeof(*pmap));
pmap->pm_refcount = 1;
simple_lock_init(&pmap->pm_lock);
diff --git a/sys/arch/sparc64/sparc64/pmap.c b/sys/arch/sparc64/sparc64/pmap.c
index 059418b9f10..239b03bd9cc 100644
--- a/sys/arch/sparc64/sparc64/pmap.c
+++ b/sys/arch/sparc64/sparc64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.62 2008/06/09 20:32:56 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.63 2008/06/14 10:55:20 mk Exp $ */
/* $NetBSD: pmap.c,v 1.107 2001/08/31 16:47:41 eeh Exp $ */
#undef NO_VCACHE /* Don't forget the locked TLB in dostart */
/*
@@ -1670,8 +1670,7 @@ pmap_create(void)
DPRINTF(PDB_CREATE, ("pmap_create()\n"));
- pm = pool_get(&pmap_pool, PR_WAITOK);
- bzero((caddr_t)pm, sizeof *pm);
+ pm = pool_get(&pmap_pool, PR_WAITOK | PR_ZERO);
DPRINTF(PDB_CREATE, ("pmap_create(): created %p\n", pm));
pm->pm_refs = 1;
diff --git a/sys/arch/vax/vax/pmap.c b/sys/arch/vax/vax/pmap.c
index 7807ce56db7..8831ca80c55 100644
--- a/sys/arch/vax/vax/pmap.c
+++ b/sys/arch/vax/vax/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.43 2008/06/09 20:31:49 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.44 2008/06/14 10:55:20 mk Exp $ */
/* $NetBSD: pmap.c,v 1.74 1999/11/13 21:32:25 matt Exp $ */
/*
* Copyright (c) 1994, 1998, 1999 Ludd, University of Lule}, Sweden.
@@ -379,8 +379,7 @@ pmap_create()
struct pmap *pmap;
int bytesiz, res;
- pmap = pool_get(&pmap_pmap_pool, PR_WAITOK);
- bzero(pmap, sizeof(struct pmap));
+ pmap = pool_get(&pmap_pmap_pool, PR_WAITOK | PR_ZERO);
/*
* Allocate PTEs and stash them away in the pmap.
diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c
index 5c05feb4dd6..4a889a02a24 100644
--- a/sys/dev/ccd.c
+++ b/sys/dev/ccd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ccd.c,v 1.82 2007/09/12 18:45:14 mk Exp $ */
+/* $OpenBSD: ccd.c,v 1.83 2008/06/14 10:55:20 mk Exp $ */
/* $NetBSD: ccd.c,v 1.33 1996/05/05 04:21:14 thorpej Exp $ */
/*-
@@ -211,8 +211,8 @@ getccdbuf(void)
{
struct ccdbuf *cbp;
- if ((cbp = pool_get(&ccdbufpl, PR_WAITOK)))
- bzero(cbp, sizeof(struct ccdbuf));
+ cbp = pool_get(&ccdbufpl, PR_WAITOK | PR_ZERO);
+
return (cbp);
}
diff --git a/sys/isofs/udf/udf_vfsops.c b/sys/isofs/udf/udf_vfsops.c
index 9b9266d8153..bc5d871f021 100644
--- a/sys/isofs/udf/udf_vfsops.c
+++ b/sys/isofs/udf/udf_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udf_vfsops.c,v 1.26 2007/12/09 20:54:01 jmc Exp $ */
+/* $OpenBSD: udf_vfsops.c,v 1.27 2008/06/14 10:55:21 mk Exp $ */
/*
* Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org>
@@ -527,8 +527,7 @@ udf_vget(struct mount *mp, ino_t ino, struct vnode **vpp)
* Allocate memory and check the tag id's before grabbing a new
* vnode, since it's hard to roll back if there is a problem.
*/
- up = pool_get(&unode_pool, PR_WAITOK);
- bzero(up, sizeof(struct unode));
+ up = pool_get(&unode_pool, PR_WAITOK | PR_ZERO);
/*
* Copy in the file entry. Per the spec, the size can only be 1 block.
diff --git a/sys/isofs/udf/udf_vnops.c b/sys/isofs/udf/udf_vnops.c
index 5b096a7b8eb..52924f2d59d 100644
--- a/sys/isofs/udf/udf_vnops.c
+++ b/sys/isofs/udf/udf_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udf_vnops.c,v 1.32 2008/06/09 23:38:37 millert Exp $ */
+/* $OpenBSD: udf_vnops.c,v 1.33 2008/06/14 10:55:21 mk Exp $ */
/*
* Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org>
@@ -550,8 +550,7 @@ udf_opendir(struct unode *up, int offset, int fsize, struct umount *ump)
{
struct udf_dirstream *ds;
- ds = pool_get(&udf_ds_pool, PR_WAITOK);
- bzero(ds, sizeof(struct udf_dirstream));
+ ds = pool_get(&udf_ds_pool, PR_WAITOK | PR_ZERO);
ds->node = up;
ds->offset = offset;
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 4728d781d99..7dffd74c857 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.70 2008/05/23 15:51:12 thib Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.71 2008/06/14 10:55:21 mk Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -103,8 +103,7 @@ socreate(int dom, struct socket **aso, int type, int proto)
if (prp->pr_type != type)
return (EPROTOTYPE);
s = splsoftnet();
- so = pool_get(&socket_pool, PR_WAITOK);
- bzero(so, sizeof(*so));
+ so = pool_get(&socket_pool, PR_WAITOK | PR_ZERO);
TAILQ_INIT(&so->so_q0);
TAILQ_INIT(&so->so_q);
so->so_type = type;
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 0e22ab4652d..d7e525a81ee 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.171 2008/06/13 03:45:39 beck Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.172 2008/06/14 10:55:21 mk Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -342,8 +342,7 @@ getnewvnode(enum vtagtype tag, struct mount *mp, int (**vops)(void *),
((TAILQ_FIRST(listhd = &vnode_free_list) == NULL) &&
((TAILQ_FIRST(listhd = &vnode_hold_list) == NULL) || toggle))) {
splx(s);
- vp = pool_get(&vnode_pool, PR_WAITOK);
- bzero((char *)vp, sizeof *vp);
+ vp = pool_get(&vnode_pool, PR_WAITOK | PR_ZERO);
numvnodes++;
} else {
for (vp = TAILQ_FIRST(listhd); vp != NULLVP;
diff --git a/sys/nfs/nfs_node.c b/sys/nfs/nfs_node.c
index c14d6717138..94e87cfe8f5 100644
--- a/sys/nfs/nfs_node.c
+++ b/sys/nfs/nfs_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_node.c,v 1.39 2008/06/11 04:52:27 blambert Exp $ */
+/* $OpenBSD: nfs_node.c,v 1.40 2008/06/14 10:55:21 mk Exp $ */
/* $NetBSD: nfs_node.c,v 1.16 1996/02/18 11:53:42 fvdl Exp $ */
/*
@@ -123,8 +123,7 @@ loop:
return (error);
}
vp = nvp;
- np = pool_get(&nfs_node_pool, PR_WAITOK);
- bzero((caddr_t)np, sizeof *np);
+ np = pool_get(&nfs_node_pool, PR_WAITOK | PR_ZERO);
vp->v_data = np;
np->n_vnode = vp;
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index b7ef8b81994..7c6959df7a9 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_softdep.c,v 1.97 2008/06/12 06:58:40 deraadt Exp $ */
+/* $OpenBSD: ffs_softdep.c,v 1.98 2008/06/14 10:55:21 mk Exp $ */
/*
* Copyright 1998, 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -1027,8 +1027,7 @@ top:
ACQUIRE_LOCK(&lk);
goto top;
}
- pagedep = pool_get(&pagedep_pool, PR_WAITOK);
- bzero(pagedep, sizeof(struct pagedep));
+ pagedep = pool_get(&pagedep_pool, PR_WAITOK | PR_ZERO);
pagedep->pd_list.wk_type = D_PAGEDEP;
pagedep->pd_mnt = mp;
pagedep->pd_ino = ip->i_number;
@@ -1452,8 +1451,7 @@ softdep_setup_allocdirect(ip, lbn, newblkno, oldblkno, newsize, oldsize, bp)
struct pagedep *pagedep;
struct newblk *newblk;
- adp = pool_get(&allocdirect_pool, PR_WAITOK);
- bzero(adp, sizeof(struct allocdirect));
+ adp = pool_get(&allocdirect_pool, PR_WAITOK | PR_ZERO);
adp->ad_list.wk_type = D_ALLOCDIRECT;
adp->ad_lbn = lbn;
adp->ad_newblkno = newblkno;
@@ -1700,8 +1698,7 @@ newallocindir(ip, ptrno, newblkno, oldblkno)
{
struct allocindir *aip;
- aip = pool_get(&allocindir_pool, PR_WAITOK);
- bzero(aip,sizeof(struct allocindir));
+ aip = pool_get(&allocindir_pool, PR_WAITOK | PR_ZERO);
aip->ai_list.wk_type = D_ALLOCINDIR;
aip->ai_state = ATTACHED;
aip->ai_offset = ptrno;
@@ -1928,8 +1925,7 @@ softdep_setup_freeblocks(ip, length)
fs = ip->i_fs;
if (length != 0)
panic("softdep_setup_freeblocks: non-zero length");
- freeblks = pool_get(&freeblks_pool, PR_WAITOK);
- bzero(freeblks, sizeof(struct freeblks));
+ freeblks = pool_get(&freeblks_pool, PR_WAITOK | PR_ZERO);
freeblks->fb_list.wk_type = D_FREEBLKS;
freeblks->fb_state = ATTACHED;
freeblks->fb_uid = DIP(ip, uid);
@@ -2621,8 +2617,7 @@ softdep_setup_directory_add(bp, dp, diroffset, newinum, newdirbp, isnewblk)
fs = dp->i_fs;
lbn = lblkno(fs, diroffset);
offset = blkoff(fs, diroffset);
- dap = pool_get(&diradd_pool, PR_WAITOK);
- bzero(dap,sizeof(struct diradd));
+ dap = pool_get(&diradd_pool, PR_WAITOK | PR_ZERO);
dap->da_list.wk_type = D_DIRADD;
dap->da_offset = offset;
dap->da_newinum = newinum;
@@ -2929,8 +2924,7 @@ newdirrem(bp, dp, ip, isrmdir, prevdirremp)
if (num_dirrem > max_softdeps / 2)
(void) request_cleanup(FLUSH_REMOVE, 0);
num_dirrem += 1;
- dirrem = pool_get(&dirrem_pool, PR_WAITOK);
- bzero(dirrem,sizeof(struct dirrem));
+ dirrem = pool_get(&dirrem_pool, PR_WAITOK | PR_ZERO);
dirrem->dm_list.wk_type = D_DIRREM;
dirrem->dm_state = isrmdir ? RMDIR : 0;
dirrem->dm_mnt = ITOV(ip)->v_mount;
@@ -3018,14 +3012,13 @@ softdep_setup_directory_change(bp, dp, ip, newinum, isrmdir)
int isrmdir; /* indicates if doing RMDIR */
{
int offset;
- struct diradd *dap = NULL;
+ struct diradd *dap;
struct dirrem *dirrem, *prevdirrem;
struct pagedep *pagedep;
struct inodedep *inodedep;
offset = blkoff(dp->i_fs, dp->i_offset);
- dap = pool_get(&diradd_pool, PR_WAITOK);
- bzero(dap,sizeof(struct diradd));
+ dap = pool_get(&diradd_pool, PR_WAITOK | PR_ZERO);
dap->da_list.wk_type = D_DIRADD;
dap->da_state = DIRCHG | ATTACHED | DEPCOMPLETE;
dap->da_offset = offset;