geom_slice.c (105542) | geom_slice.c (105551) |
---|---|
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 105542 2002-10-20 19:18:07Z phk $ | 35 * $FreeBSD: head/sys/geom/geom_slice.c 105551 2002-10-20 20:28:24Z phk $ |
36 */ 37 38 39#include <sys/param.h> 40#include <sys/stdint.h> 41#ifndef _KERNEL 42#include <stdio.h> 43#include <unistd.h> --- 114 unchanged lines hidden (view full) --- 158 bp2->bio_offset += gsl->offset; 159 g_io_request(bp2, cp); 160 return; 161 case BIO_GETATTR: 162 case BIO_SETATTR: 163 /* Give the real method a chance to override */ 164 if (gsp->start(bp)) 165 return; | 36 */ 37 38 39#include <sys/param.h> 40#include <sys/stdint.h> 41#ifndef _KERNEL 42#include <stdio.h> 43#include <unistd.h> --- 114 unchanged lines hidden (view full) --- 158 bp2->bio_offset += gsl->offset; 159 g_io_request(bp2, cp); 160 return; 161 case BIO_GETATTR: 162 case BIO_SETATTR: 163 /* Give the real method a chance to override */ 164 if (gsp->start(bp)) 165 return; |
166 if (g_handleattr_off_t(bp, "GEOM::mediasize", 167 gsp->slices[index].length)) 168 return; | |
169 if (!strcmp("GEOM::frontstuff", bp->bio_attribute)) { 170 t = gsp->cfrontstuff; 171 if (gsp->frontstuff > t) 172 t = gsp->frontstuff; 173 t -= gsl->offset; 174 if (t < 0) 175 t = 0; 176 if (t > gsl->length) --- 153 unchanged lines hidden (view full) --- 330 gsp->start = start; 331 gp->access = g_slice_access; 332 gp->orphan = g_slice_orphan; 333 gp->softc = gsp; 334 gp->start = g_slice_start; 335 gp->spoiled = g_std_spoiled; 336 gp->dumpconf = g_slice_dumpconf; 337 cp = g_new_consumer(gp); | 166 if (!strcmp("GEOM::frontstuff", bp->bio_attribute)) { 167 t = gsp->cfrontstuff; 168 if (gsp->frontstuff > t) 169 t = gsp->frontstuff; 170 t -= gsl->offset; 171 if (t < 0) 172 t = 0; 173 if (t > gsl->length) --- 153 unchanged lines hidden (view full) --- 327 gsp->start = start; 328 gp->access = g_slice_access; 329 gp->orphan = g_slice_orphan; 330 gp->softc = gsp; 331 gp->start = g_slice_start; 332 gp->spoiled = g_std_spoiled; 333 gp->dumpconf = g_slice_dumpconf; 334 cp = g_new_consumer(gp); |
338 g_attach(cp, pp); 339 error = g_access_rel(cp, 1, 0, 0); | 335 error = g_attach(cp, pp); 336 if (error == 0) 337 error = g_access_rel(cp, 1, 0, 0); |
340 if (error) { | 338 if (error) { |
341 g_detach(cp); | 339 if (cp->provider != NULL) 340 g_detach(cp); |
342 g_destroy_consumer(cp); 343 g_free(gsp->slices); 344 g_free(gp->softc); 345 g_destroy_geom(gp); 346 return (NULL); 347 } 348 /* Find out if there are any magic bytes on the consumer */ 349 i = sizeof gsp->cfrontstuff; --- 27 unchanged lines hidden --- | 341 g_destroy_consumer(cp); 342 g_free(gsp->slices); 343 g_free(gp->softc); 344 g_destroy_geom(gp); 345 return (NULL); 346 } 347 /* Find out if there are any magic bytes on the consumer */ 348 i = sizeof gsp->cfrontstuff; --- 27 unchanged lines hidden --- |