geom_slice.h revision 105542
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 105542 2002-10-20 19:18:07Z 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 { 5192108Sphk int nslice; 52104064Sphk int nprovider; 5394287Sphk off_t cfrontstuff; 5494287Sphk off_t frontstuff; 5592108Sphk struct g_slice *slices; 5692108Sphk void *softc; 5792108Sphk g_slice_start_t *start; 5892108Sphk}; 5992108Sphk 6093776Sphkg_dumpconf_t g_slice_dumpconf; 61105542Sphkstruct g_provider * g_slice_addslice(struct g_geom *gp, int index, off_t offset, off_t length, u_int sectorsize, char *fmt, ...); 62105542Sphkint g_slice_config(struct g_geom *gp, int index, int how, off_t offset, off_t length, u_int sectorsize, char *fmt, ...); 63104064Sphk#define G_SLICE_CONFIG_CHECK 0 64104064Sphk#define G_SLICE_CONFIG_SET 1 65104064Sphk#define G_SLICE_CONFIG_FORCE 2 6693248Sphkstruct g_geom * g_slice_new(struct g_class *mp, int slices, struct g_provider *pp, struct g_consumer **cpp, void *extrap, int extra, g_slice_start_t *start); 6792108Sphk 68104064Sphk#endif /* _GEOM_GEOM_SLICE_H_ */ 69