geom_slice.h revision 113713
158551Skris/*- 2228060Sbapt * Copyright (c) 2002 Poul-Henning Kamp 3228060Sbapt * Copyright (c) 2002 Networks Associates Technology, Inc. 4228060Sbapt * All rights reserved. 558551Skris * 6228060Sbapt * This software was developed for the FreeBSD Project by Poul-Henning Kamp 758551Skris * and NAI Labs, the Security Research Division of Network Associates, Inc. 8228060Sbapt * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the 9228060Sbapt * DARPA CHATS research program. 10228060Sbapt * 11228060Sbapt * Redistribution and use in source and binary forms, with or without 1258551Skris * modification, are permitted provided that the following conditions 13228060Sbapt * are met: 14228060Sbapt * 1. Redistributions of source code must retain the above copyright 15228060Sbapt * notice, this list of conditions and the following disclaimer. 16228060Sbapt * 2. Redistributions in binary form must reproduce the above copyright 1758551Skris * notice, this list of conditions and the following disclaimer in the 18228060Sbapt * documentation and/or other materials provided with the distribution. 19228060Sbapt * 3. The names of the authors may not be used to endorse or promote 20228060Sbapt * products derived from this software without specific prior written 21228060Sbapt * permission. 2258551Skris * 23228060Sbapt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 2458551Skris * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2558551Skris * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2658551Skris * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2758551Skris * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2858551Skris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2958551Skris * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3058551Skris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31228060Sbapt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32228060Sbapt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33228060Sbapt * SUCH DAMAGE. 3458551Skris * 35228060Sbapt * $FreeBSD: head/sys/geom/geom_slice.h 113713 2003-04-19 10:14:39Z phk $ 36228060Sbapt */ 37228060Sbapt 38228060Sbapt#ifndef _GEOM_GEOM_SLICE_H_ 39228060Sbapt#define _GEOM_GEOM_SLICE_H_ 40228060Sbapt 41228060Sbaptstruct g_slice { 42228060Sbapt off_t offset; 43228060Sbapt off_t length; 44228060Sbapt u_int sectorsize; 45228060Sbapt struct g_provider *provider; 4658551Skris}; 47228060Sbapt 48228060Sbaptstruct g_slice_hot { 49228060Sbapt off_t offset; 50228060Sbapt off_t length; 51228060Sbapt int ract; 52228060Sbapt int dact; 53228060Sbapt int wact; 54228060Sbapt}; 55228060Sbapt 56228060Sbapttypedef int g_slice_start_t (struct bio *bp); 57228060Sbapt 58228060Sbaptstruct g_slicer { 59228060Sbapt u_int nslice; 60228060Sbapt u_int nprovider; 61228060Sbapt struct g_slice *slices; 62228060Sbapt 63228060Sbapt u_int nhotspot; 64228060Sbapt struct g_slice_hot *hotspot; 65228060Sbapt 66228060Sbapt void *softc; 67228060Sbapt g_slice_start_t *start; 68228060Sbapt g_call_me_t *hot; 69228060Sbapt}; 70228060Sbapt 71228060Sbaptg_dumpconf_t g_slice_dumpconf; 72228060Sbaptint g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length, u_int sectorsize, const char *fmt, ...); 73228060Sbapt#define G_SLICE_CONFIG_CHECK 0 74228060Sbapt#define G_SLICE_CONFIG_SET 1 75228060Sbapt#define G_SLICE_CONFIG_FORCE 2 76228060Sbaptstruct 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); 77228060Sbapt 78228060Sbaptint g_slice_conf_hot(struct g_geom *gp, u_int idx, off_t offset, off_t length, int ract, int dact, int wact); 79228060Sbapt#define G_SLICE_HOT_ALLOW 1 80228060Sbapt#define G_SLICE_HOT_DENY 2 81228060Sbapt#define G_SLICE_HOT_START 4 82228060Sbapt#define G_SLICE_HOT_CALL 8 8358551Skris 8458551Skrisvoid g_slice_finish_hot(struct bio *bp); 85228060Sbapt 86228060Sbapt#endif /* _GEOM_GEOM_SLICE_H_ */ 8758551Skris