geom_slice.c (110696) | geom_slice.c (110710) |
---|---|
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 110696 2003-02-11 12:36:33Z phk $ | 35 * $FreeBSD: head/sys/geom/geom_slice.c 110710 2003-02-11 14:57:34Z 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> --- 242 unchanged lines hidden (view full) --- 286 sbuf_printf(sb, "%s<secoffset>%ju</secoffset>\n", indent, 287 (uintmax_t)gsp->slices[pp->index].offset / 512); 288 } 289} 290 291int 292g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length, u_int sectorsize, const char *fmt, ...) 293{ | 36 */ 37 38 39#include <sys/param.h> 40#include <sys/stdint.h> 41#ifndef _KERNEL 42#include <stdio.h> 43#include <unistd.h> --- 242 unchanged lines hidden (view full) --- 286 sbuf_printf(sb, "%s<secoffset>%ju</secoffset>\n", indent, 287 (uintmax_t)gsp->slices[pp->index].offset / 512); 288 } 289} 290 291int 292g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length, u_int sectorsize, const char *fmt, ...) 293{ |
294 struct g_provider *pp; | 294 struct g_provider *pp, *pp2; |
295 struct g_slicer *gsp; 296 struct g_slice *gsl; 297 va_list ap; 298 struct sbuf *sb; 299 int error, acc; 300 301 g_trace(G_T_TOPOLOGY, "g_slice_config(%s, %d, %d)", 302 gp->name, idx, how); --- 38 unchanged lines hidden (view full) --- 341 pp->mediasize = gsl->length; 342 return (0); 343 } 344 va_start(ap, fmt); 345 sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); 346 sbuf_vprintf(sb, fmt, ap); 347 sbuf_finish(sb); 348 pp = g_new_providerf(gp, sbuf_data(sb)); | 295 struct g_slicer *gsp; 296 struct g_slice *gsl; 297 va_list ap; 298 struct sbuf *sb; 299 int error, acc; 300 301 g_trace(G_T_TOPOLOGY, "g_slice_config(%s, %d, %d)", 302 gp->name, idx, how); --- 38 unchanged lines hidden (view full) --- 341 pp->mediasize = gsl->length; 342 return (0); 343 } 344 va_start(ap, fmt); 345 sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); 346 sbuf_vprintf(sb, fmt, ap); 347 sbuf_finish(sb); 348 pp = g_new_providerf(gp, sbuf_data(sb)); |
349 pp->flags = 350 LIST_FIRST(&gp->consumer)->provider->flags & G_PF_CANDELETE; | 349 pp2 = LIST_FIRST(&gp->consumer)->provider; 350 pp->flags = pp2->flags & G_PF_CANDELETE; 351 pp->stripesize = pp2->stripesize; 352 pp->stripeoffset = (pp2->stripeoffset + offset) % pp->stripesize; |
351 if (bootverbose) 352 printf("GEOM: Configure %s, start %jd length %jd end %jd\n", 353 pp->name, (intmax_t)offset, (intmax_t)length, 354 (intmax_t)(offset + length - 1)); 355 pp->index = idx; 356 pp->mediasize = gsl->length; 357 pp->sectorsize = gsl->sectorsize; 358 gsl->provider = pp; --- 98 unchanged lines hidden --- | 353 if (bootverbose) 354 printf("GEOM: Configure %s, start %jd length %jd end %jd\n", 355 pp->name, (intmax_t)offset, (intmax_t)length, 356 (intmax_t)(offset + length - 1)); 357 pp->index = idx; 358 pp->mediasize = gsl->length; 359 pp->sectorsize = gsl->sectorsize; 360 gsl->provider = pp; --- 98 unchanged lines hidden --- |