diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-09-09 16:50:24 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-09-09 16:50:24 +0000 |
commit | db0a8a77ed55dc3936f22e404c97f7fa57ea1b49 (patch) | |
tree | fce5e236707dd8a951f9376afb277c71032e5e68 /sys/dev/raidframe | |
parent | 69660582124d73b68700fe04ac7349b2e5eb7787 (diff) |
The obvious bzero/memset -> M_ZERO changes.
Diffstat (limited to 'sys/dev/raidframe')
-rw-r--r-- | sys/dev/raidframe/rf_debugMem.h | 5 | ||||
-rw-r--r-- | sys/dev/raidframe/rf_diskqueue.c | 7 | ||||
-rw-r--r-- | sys/dev/raidframe/rf_engine.c | 8 | ||||
-rw-r--r-- | sys/dev/raidframe/rf_openbsdkintf.c | 23 |
4 files changed, 14 insertions, 29 deletions
diff --git a/sys/dev/raidframe/rf_debugMem.h b/sys/dev/raidframe/rf_debugMem.h index a22b9dc5917..fd257a10d76 100644 --- a/sys/dev/raidframe/rf_debugMem.h +++ b/sys/dev/raidframe/rf_debugMem.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rf_debugMem.h,v 1.5 2002/12/16 07:01:03 tdeval Exp $ */ +/* $OpenBSD: rf_debugMem.h,v 1.6 2007/09/09 16:50:23 krw Exp $ */ /* $NetBSD: rf_debugMem.h,v 1.7 1999/09/05 01:58:11 oster Exp $ */ /* @@ -46,8 +46,7 @@ #include <sys/malloc.h> #define RF_Malloc(_p_,_size_,_cast_) do { \ - _p_ = _cast_ malloc((u_long)_size_, M_RAIDFRAME, M_WAITOK); \ - bzero((char *)_p_, _size_); \ + _p_ = _cast_ malloc((u_long)_size_, M_RAIDFRAME, M_WAITOK | M_ZERO);\ if (rf_memDebug) \ rf_record_malloc(_p_, _size_, __LINE__, __FILE__); \ } while (0) diff --git a/sys/dev/raidframe/rf_diskqueue.c b/sys/dev/raidframe/rf_diskqueue.c index e29d25b81a2..172f198cae9 100644 --- a/sys/dev/raidframe/rf_diskqueue.c +++ b/sys/dev/raidframe/rf_diskqueue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rf_diskqueue.c,v 1.7 2002/12/16 07:01:03 tdeval Exp $ */ +/* $OpenBSD: rf_diskqueue.c,v 1.8 2007/09/09 16:50:23 krw Exp $ */ /* $NetBSD: rf_diskqueue.c,v 1.13 2000/03/04 04:22:34 oster Exp $ */ /* @@ -163,13 +163,10 @@ int rf_init_dqd(RF_DiskQueueData_t *dqd) { - dqd->bp = (struct buf *) malloc(sizeof(struct buf), M_RAIDFRAME, - M_NOWAIT); + dqd->bp = malloc(sizeof(struct buf), M_RAIDFRAME, M_NOWAIT | M_ZERO); if (dqd->bp == NULL) { return (ENOMEM); } - /* If you don't do it, nobody else will... */ - memset(dqd->bp, 0, sizeof(struct buf)); return (0); } diff --git a/sys/dev/raidframe/rf_engine.c b/sys/dev/raidframe/rf_engine.c index d4c1dbd155f..64aeebd253c 100644 --- a/sys/dev/raidframe/rf_engine.c +++ b/sys/dev/raidframe/rf_engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rf_engine.c,v 1.15 2003/04/27 11:22:54 ho Exp $ */ +/* $OpenBSD: rf_engine.c,v 1.16 2007/09/09 16:50:23 krw Exp $ */ /* $NetBSD: rf_engine.c,v 1.10 2000/08/20 16:51:03 thorpej Exp $ */ /* @@ -163,12 +163,10 @@ rf_ConfigureEngine(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, (initproc)?"Starting":"Creating"); } if (rf_hook_cookies == NULL) { - rf_hook_cookies = - malloc(numraid * sizeof(void *), - M_RAIDFRAME, M_NOWAIT); + rf_hook_cookies = malloc(numraid * sizeof(void *), M_RAIDFRAME, + M_NOWAIT | M_ZERO); if (rf_hook_cookies == NULL) return (ENOMEM); - bzero(rf_hook_cookies, numraid * sizeof(void *)); } #ifdef RAID_AUTOCONFIG if (initproc == NULL) { diff --git a/sys/dev/raidframe/rf_openbsdkintf.c b/sys/dev/raidframe/rf_openbsdkintf.c index 02c9c6ce792..ea77f766d01 100644 --- a/sys/dev/raidframe/rf_openbsdkintf.c +++ b/sys/dev/raidframe/rf_openbsdkintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rf_openbsdkintf.c,v 1.42 2007/06/23 03:11:34 krw Exp $ */ +/* $OpenBSD: rf_openbsdkintf.c,v 1.43 2007/09/09 16:50:23 krw Exp $ */ /* $NetBSD: rf_netbsdkintf.c,v 1.109 2001/07/27 03:30:07 oster Exp $ */ /*- @@ -388,25 +388,20 @@ raidattach(int num) * This lets us lock the device and what-not when it gets opened. */ - raid_softc = (struct raid_softc *) - malloc(num * sizeof(struct raid_softc), M_RAIDFRAME, M_NOWAIT); + raid_softc = malloc(num * sizeof(struct raid_softc), M_RAIDFRAME, + M_NOWAIT | M_ZERO); if (raid_softc == NULL) { printf("WARNING: no memory for RAIDframe driver\n"); return; } - bzero(raid_softc, num * sizeof (struct raid_softc)); - - raid_scPtrs = (struct raid_softc **) - malloc(num * sizeof(struct raid_softc *), M_RAIDFRAME, - M_NOWAIT); + raid_scPtrs = malloc(num * sizeof(struct raid_softc *), M_RAIDFRAME, + M_NOWAIT | M_ZERO); if (raid_scPtrs == NULL) { printf("WARNING: no memory for RAIDframe driver\n"); return; } - bzero(raid_scPtrs, num * sizeof (struct raid_softc *)); - raidrootdev = (struct device *)malloc(num * sizeof(struct device), M_RAIDFRAME, M_NOWAIT); if (raidrootdev == NULL) { @@ -1649,12 +1644,11 @@ raidinit(RF_Raid_t *raidPtr) * config_attach the raid device into the device tree. * For autoconf rootdev selection... */ - cf = malloc(sizeof(struct cfdata), M_RAIDFRAME, M_NOWAIT); + cf = malloc(sizeof(struct cfdata), M_RAIDFRAME, M_NOWAIT | M_ZERO); if (cf == NULL) { printf("WARNING: no memory for cfdata struct\n"); return; } - bzero(cf, sizeof(struct cfdata)); cf->cf_attach = &raid_ca; cf->cf_driver = &raid_cd; @@ -3424,16 +3418,13 @@ rf_auto_config_set(RF_ConfigSet_t *cset, int *unit) /* 1. Create a config structure. */ - config = (RF_Config_t *)malloc(sizeof(RF_Config_t), M_RAIDFRAME, - M_NOWAIT); + config = malloc(sizeof(RF_Config_t), M_RAIDFRAME, M_NOWAIT | M_ZERO); if (config==NULL) { printf("Out of mem!?!?\n"); /* XXX Do something more intelligent here. */ return(1); } - memset(config, 0, sizeof(RF_Config_t)); - /* XXX raidID needs to be set correctly... */ /* |