geom_slice.h revision 107953
192108Sphk/*- 292108Sphk * Copyright (c) 2002 Poul-Henning Kamp 392108Sphk * Copyright (c) 2002 Networks Associates Technology, Inc. 492108Sphk * All rights reserved. 592108Sphk * 692108Sphk * This software was developed for the FreeBSD Project by Poul-Henning Kamp 792108Sphk * and NAI Labs, the Security Research Division of Network Associates, Inc. 892108Sphk * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the 992108Sphk * DARPA CHATS research program. 1092108Sphk * 1192108Sphk * Redistribution and use in source and binary forms, with or without 1292108Sphk * modification, are permitted provided that the following conditions 1392108Sphk * are met: 1492108Sphk * 1. Redistributions of source code must retain the above copyright 1592108Sphk * notice, this list of conditions and the following disclaimer. 1692108Sphk * 2. Redistributions in binary form must reproduce the above copyright 1792108Sphk * notice, this list of conditions and the following disclaimer in the 1892108Sphk * documentation and/or other materials provided with the distribution. 1992108Sphk * 3. The names of the authors may not be used to endorse or promote 2092108Sphk * products derived from this software without specific prior written 2192108Sphk * permission. 2292108Sphk * 2392108Sphk * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 2492108Sphk * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2592108Sphk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2692108Sphk * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2792108Sphk * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2892108Sphk * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2992108Sphk * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3092108Sphk * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3192108Sphk * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3292108Sphk * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3392108Sphk * SUCH DAMAGE. 3492108Sphk * 3592108Sphk * $FreeBSD: head/sys/geom/geom_slice.h 107953 2002-12-16 22:33:27Z phk $ 3692108Sphk */ 3792108Sphk 38104064Sphk#ifndef _GEOM_GEOM_SLICE_H_ 39104064Sphk#define _GEOM_GEOM_SLICE_H_ 40104064Sphk 4192108Sphkstruct g_slice { 4292108Sphk off_t offset; 4392108Sphk off_t length; 44105542Sphk u_int sectorsize; 4592108Sphk struct g_provider *provider; 4692108Sphk}; 4792108Sphk 4892108Sphktypedef int g_slice_start_t (struct bio *bp); 4992108Sphk 5092108Sphkstruct g_slicer { 51107522Sphk u_int nslice; 52107522Sphk u_int nprovider; 53107522Sphk u_int nhot; 5494287Sphk off_t cfrontstuff; 5594287Sphk off_t frontstuff; 5692108Sphk struct g_slice *slices; 57107522Sphk struct g_slice *hot; 5892108Sphk void *softc; 5992108Sphk g_slice_start_t *start; 6092108Sphk}; 6192108Sphk 6293776Sphkg_dumpconf_t g_slice_dumpconf; 63107953Sphkstruct g_provider * g_slice_addslice(struct g_geom *gp, int idx, off_t offset, off_t length, u_int sectorsize, const char *fmt, ...); 64107953Sphkint g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length, u_int sectorsize, const char *fmt, ...); 65104064Sphk#define G_SLICE_CONFIG_CHECK 0 66104064Sphk#define G_SLICE_CONFIG_SET 1 67104064Sphk#define G_SLICE_CONFIG_FORCE 2 68107522Sphkstruct g_geom * g_slice_new(struct g_class *mp, u_int slices, struct g_provider *pp, struct g_consumer **cpp, void *extrap, int extra, g_slice_start_t *start); 6992108Sphk 70107953Sphkint g_slice_conf_hot(struct g_geom *gp, u_int idx, off_t offset, off_t length); 71107522Sphkvoid g_slice_finish_hot(struct bio *bp); 72107522Sphk 73104064Sphk#endif /* _GEOM_GEOM_SLICE_H_ */ 74