Deleted Added
full compact
geom_slice.c (98066) geom_slice.c (104057)
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 98066 2002-06-09 10:57:34Z phk $
35 * $FreeBSD: head/sys/geom/geom_slice.c 104057 2002-09-27 20:47:23Z phk $
36 */
37
38
39#include <sys/param.h>
40#ifndef _KERNEL
41#include <stdio.h>
42#include <unistd.h>
43#include <stdlib.h>

--- 23 unchanged lines hidden (view full) ---

67
68static struct g_slicer *
69g_slice_init(unsigned nslice, unsigned scsize)
70{
71 struct g_slicer *gsp;
72
73 gsp = g_malloc(sizeof *gsp, M_WAITOK | M_ZERO);
74 gsp->softc = g_malloc(scsize, M_WAITOK | M_ZERO);
36 */
37
38
39#include <sys/param.h>
40#ifndef _KERNEL
41#include <stdio.h>
42#include <unistd.h>
43#include <stdlib.h>

--- 23 unchanged lines hidden (view full) ---

67
68static struct g_slicer *
69g_slice_init(unsigned nslice, unsigned scsize)
70{
71 struct g_slicer *gsp;
72
73 gsp = g_malloc(sizeof *gsp, M_WAITOK | M_ZERO);
74 gsp->softc = g_malloc(scsize, M_WAITOK | M_ZERO);
75 gsp->slices = g_malloc(nslice * sizeof(struct g_slice), M_WAITOK | M_ZERO);
75 gsp->slices = g_malloc(nslice * sizeof(struct g_slice),
76 M_WAITOK | M_ZERO);
76 gsp->nslice = nslice;
77 return (gsp);
78}
79
80static int
81g_slice_access(struct g_provider *pp, int dr, int dw, int de)
82{
83 int error, i;

--- 59 unchanged lines hidden (view full) ---

143 case BIO_WRITE:
144 case BIO_DELETE:
145 if (bp->bio_offset > gsl->length) {
146 bp->bio_error = EINVAL; /* XXX: EWHAT ? */
147 g_io_deliver(bp);
148 return;
149 }
150 bp2 = g_clone_bio(bp);
77 gsp->nslice = nslice;
78 return (gsp);
79}
80
81static int
82g_slice_access(struct g_provider *pp, int dr, int dw, int de)
83{
84 int error, i;

--- 59 unchanged lines hidden (view full) ---

144 case BIO_WRITE:
145 case BIO_DELETE:
146 if (bp->bio_offset > gsl->length) {
147 bp->bio_error = EINVAL; /* XXX: EWHAT ? */
148 g_io_deliver(bp);
149 return;
150 }
151 bp2 = g_clone_bio(bp);
152 if (bp2 == NULL) {
153 g_io_fail(bp, ENOMEM);
154 return;
155 }
151 if (bp2->bio_offset + bp2->bio_length > gsl->length)
152 bp2->bio_length = gsl->length - bp2->bio_offset;
153 bp2->bio_done = g_std_done;
154 bp2->bio_offset += gsl->offset;
155 g_io_request(bp2, cp);
156 return;
157 case BIO_GETATTR:
158 case BIO_SETATTR:

--- 151 unchanged lines hidden ---
156 if (bp2->bio_offset + bp2->bio_length > gsl->length)
157 bp2->bio_length = gsl->length - bp2->bio_offset;
158 bp2->bio_done = g_std_done;
159 bp2->bio_offset += gsl->offset;
160 g_io_request(bp2, cp);
161 return;
162 case BIO_GETATTR:
163 case BIO_SETATTR:

--- 151 unchanged lines hidden ---