geom_slice.h revision 107522
11539Srgrimes/*- 21539Srgrimes * Copyright (c) 2002 Poul-Henning Kamp 31539Srgrimes * Copyright (c) 2002 Networks Associates Technology, Inc. 41539Srgrimes * All rights reserved. 51539Srgrimes * 61539Srgrimes * This software was developed for the FreeBSD Project by Poul-Henning Kamp 71539Srgrimes * and NAI Labs, the Security Research Division of Network Associates, Inc. 81539Srgrimes * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the 91539Srgrimes * DARPA CHATS research program. 101539Srgrimes * 111539Srgrimes * Redistribution and use in source and binary forms, with or without 121539Srgrimes * modification, are permitted provided that the following conditions 131539Srgrimes * are met: 141539Srgrimes * 1. Redistributions of source code must retain the above copyright 151539Srgrimes * notice, this list of conditions and the following disclaimer. 161539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 171539Srgrimes * notice, this list of conditions and the following disclaimer in the 181539Srgrimes * documentation and/or other materials provided with the distribution. 191539Srgrimes * 3. The names of the authors may not be used to endorse or promote 201539Srgrimes * products derived from this software without specific prior written 211539Srgrimes * permission. 221539Srgrimes * 231539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 241539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 251539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 261539Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 271539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 281539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 291539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 301539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 311539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 321539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3384747Sbde * SUCH DAMAGE. 3484699Smike * 351539Srgrimes * $FreeBSD: head/sys/geom/geom_slice.h 107522 2002-12-02 19:59:25Z phk $ 361539Srgrimes */ 371539Srgrimes 381539Srgrimes#ifndef _GEOM_GEOM_SLICE_H_ 3993747Smike#define _GEOM_GEOM_SLICE_H_ 4093747Smike 41102227Smikestruct g_slice { 421539Srgrimes off_t offset; 4393747Smike off_t length; 4493747Smike u_int sectorsize; 4593747Smike struct g_provider *provider; 4693747Smike}; 4793747Smike 4893747Smiketypedef int g_slice_start_t (struct bio *bp); 4993747Smike 5093747Smikestruct g_slicer { 51102227Smike u_int nslice; 52102227Smike u_int nprovider; 53102227Smike u_int nhot; 541539Srgrimes off_t cfrontstuff; 551539Srgrimes off_t frontstuff; 561539Srgrimes struct g_slice *slices; 571539Srgrimes struct g_slice *hot; 581539Srgrimes void *softc; 591539Srgrimes g_slice_start_t *start; 601539Srgrimes}; 61105128Smike 62105128Smikeg_dumpconf_t g_slice_dumpconf; 63105128Smikestruct g_provider * g_slice_addslice(struct g_geom *gp, int index, off_t offset, off_t length, u_int sectorsize, char *fmt, ...); 6493032Simpint g_slice_config(struct g_geom *gp, u_int index, int how, off_t offset, off_t length, u_int sectorsize, char *fmt, ...); 6593032Simp#define G_SLICE_CONFIG_CHECK 0 6693747Smike#define G_SLICE_CONFIG_SET 1 6793032Simp#define G_SLICE_CONFIG_FORCE 2 6893032Simpstruct 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); 69105128Smike 70105128Smikeint g_slice_conf_hot(struct g_geom *gp, u_int index, off_t offset, off_t length); 71105128Smikevoid g_slice_finish_hot(struct bio *bp); 72105128Smike 7393747Smike#endif /* _GEOM_GEOM_SLICE_H_ */ 7493032Simp