geom_slice.c (108003) | geom_slice.c (109623) |
---|---|
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 108003 2002-12-17 21:31:58Z phk $ | 35 * $FreeBSD: head/sys/geom/geom_slice.c 109623 2003-01-21 08:56:16Z alfred $ |
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_WAITOK | M_ZERO); 75 gsp->softc = g_malloc(scsize, M_WAITOK | M_ZERO); | 74 gsp = g_malloc(sizeof *gsp, M_ZERO); 75 gsp->softc = g_malloc(scsize, M_ZERO); |
76 gsp->slices = g_malloc(nslice * sizeof(struct g_slice), | 76 gsp->slices = g_malloc(nslice * sizeof(struct g_slice), |
77 M_WAITOK | M_ZERO); | 77 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; --- 280 unchanged lines hidden (view full) --- 366 struct g_slicer *gsp; 367 struct g_slice *gsl, *gsl2; 368 369 g_trace(G_T_TOPOLOGY, "g_slice_conf_hot()"); 370 g_topology_assert(); 371 gsp = gp->softc; 372 gsl = gsp->hot; 373 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; --- 280 unchanged lines hidden (view full) --- 366 struct g_slicer *gsp; 367 struct g_slice *gsl, *gsl2; 368 369 g_trace(G_T_TOPOLOGY, "g_slice_conf_hot()"); 370 g_topology_assert(); 371 gsp = gp->softc; 372 gsl = gsp->hot; 373 if(idx >= gsp->nhot) { |
374 gsl2 = g_malloc((idx + 1) * sizeof *gsl2, M_WAITOK | M_ZERO); | 374 gsl2 = g_malloc((idx + 1) * sizeof *gsl2, M_ZERO); |
375 if (gsp->hot != NULL) 376 bcopy(gsp->hot, gsl2, gsp->nhot * sizeof *gsl2); 377 gsp->hot = gsl2; 378 if (gsp->hot != NULL) 379 g_free(gsl); 380 gsl = gsl2; 381 gsp->nhot = idx + 1; 382 } --- 72 unchanged lines hidden --- | 375 if (gsp->hot != NULL) 376 bcopy(gsp->hot, gsl2, gsp->nhot * sizeof *gsl2); 377 gsp->hot = gsl2; 378 if (gsp->hot != NULL) 379 g_free(gsl); 380 gsl = gsl2; 381 gsp->nhot = idx + 1; 382 } --- 72 unchanged lines hidden --- |