geom_slice.c (110713) | geom_slice.c (111119) |
---|---|
1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * | 1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * |
35 * $FreeBSD: head/sys/geom/geom_slice.c 110713 2003-02-11 15:23:41Z phk $ | 35 * $FreeBSD: head/sys/geom/geom_slice.c 111119 2003-02-19 05:47:46Z imp $ |
36 */ 37 38 39#include <sys/param.h> 40#include <sys/stdint.h> 41#ifndef _KERNEL 42#include <stdio.h> 43#include <unistd.h> --- 22 unchanged lines hidden (view full) --- 66static g_access_t g_slice_access; 67static g_start_t g_slice_start; 68 69static struct g_slicer * 70g_slice_init(unsigned nslice, unsigned scsize) 71{ 72 struct g_slicer *gsp; 73 | 36 */ 37 38 39#include <sys/param.h> 40#include <sys/stdint.h> 41#ifndef _KERNEL 42#include <stdio.h> 43#include <unistd.h> --- 22 unchanged lines hidden (view full) --- 66static g_access_t g_slice_access; 67static g_start_t g_slice_start; 68 69static struct g_slicer * 70g_slice_init(unsigned nslice, unsigned scsize) 71{ 72 struct g_slicer *gsp; 73 |
74 gsp = g_malloc(sizeof *gsp, M_ZERO); 75 gsp->softc = g_malloc(scsize, M_ZERO); | 74 gsp = g_malloc(sizeof *gsp, M_WAITOK | M_ZERO); 75 gsp->softc = g_malloc(scsize, M_WAITOK | M_ZERO); |
76 gsp->slices = g_malloc(nslice * sizeof(struct g_slice), | 76 gsp->slices = g_malloc(nslice * sizeof(struct g_slice), |
77 M_ZERO); | 77 M_WAITOK | M_ZERO); |
78 gsp->nslice = nslice; 79 return (gsp); 80} 81 82static int 83g_slice_access(struct g_provider *pp, int dr, int dw, int de) 84{ 85 int error; --- 286 unchanged lines hidden (view full) --- 372 struct g_slicer *gsp; 373 struct g_slice *gsl, *gsl2; 374 375 g_trace(G_T_TOPOLOGY, "g_slice_conf_hot()"); 376 g_topology_assert(); 377 gsp = gp->softc; 378 gsl = gsp->hot; 379 if(idx >= gsp->nhot) { | 78 gsp->nslice = nslice; 79 return (gsp); 80} 81 82static int 83g_slice_access(struct g_provider *pp, int dr, int dw, int de) 84{ 85 int error; --- 286 unchanged lines hidden (view full) --- 372 struct g_slicer *gsp; 373 struct g_slice *gsl, *gsl2; 374 375 g_trace(G_T_TOPOLOGY, "g_slice_conf_hot()"); 376 g_topology_assert(); 377 gsp = gp->softc; 378 gsl = gsp->hot; 379 if(idx >= gsp->nhot) { |
380 gsl2 = g_malloc((idx + 1) * sizeof *gsl2, M_ZERO); | 380 gsl2 = g_malloc((idx + 1) * sizeof *gsl2, M_WAITOK | M_ZERO); |
381 if (gsp->hot != NULL) 382 bcopy(gsp->hot, gsl2, gsp->nhot * sizeof *gsl2); 383 gsp->hot = gsl2; 384 if (gsp->hot != NULL) 385 g_free(gsl); 386 gsl = gsl2; 387 gsp->nhot = idx + 1; 388 } --- 72 unchanged lines hidden --- | 381 if (gsp->hot != NULL) 382 bcopy(gsp->hot, gsl2, gsp->nhot * sizeof *gsl2); 383 gsp->hot = gsl2; 384 if (gsp->hot != NULL) 385 g_free(gsl); 386 gsl = gsl2; 387 gsp->nhot = idx + 1; 388 } --- 72 unchanged lines hidden --- |