geom_slice.h revision 113390
138786Sdfr/*-
238786Sdfr * Copyright (c) 2002 Poul-Henning Kamp
338786Sdfr * Copyright (c) 2002 Networks Associates Technology, Inc.
438786Sdfr * All rights reserved.
538786Sdfr *
638786Sdfr * This software was developed for the FreeBSD Project by Poul-Henning Kamp
738786Sdfr * and NAI Labs, the Security Research Division of Network Associates, Inc.
838786Sdfr * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
938786Sdfr * DARPA CHATS research program.
1038786Sdfr *
1138786Sdfr * Redistribution and use in source and binary forms, with or without
1238786Sdfr * modification, are permitted provided that the following conditions
1338786Sdfr * are met:
1438786Sdfr * 1. Redistributions of source code must retain the above copyright
1538786Sdfr *    notice, this list of conditions and the following disclaimer.
1638786Sdfr * 2. Redistributions in binary form must reproduce the above copyright
1738786Sdfr *    notice, this list of conditions and the following disclaimer in the
1838786Sdfr *    documentation and/or other materials provided with the distribution.
1938786Sdfr * 3. The names of the authors may not be used to endorse or promote
2038786Sdfr *    products derived from this software without specific prior written
2138786Sdfr *    permission.
2238786Sdfr *
2338786Sdfr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2438786Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2538786Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2638786Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2738786Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2838786Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2950476Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3038786Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3138786Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3238786Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3379538Sru * SUCH DAMAGE.
3438786Sdfr *
3538786Sdfr * $FreeBSD: head/sys/geom/geom_slice.h 113390 2003-04-12 08:41:26Z phk $
3638786Sdfr */
3738786Sdfr
3838786Sdfr#ifndef _GEOM_GEOM_SLICE_H_
3984306Sru#define _GEOM_GEOM_SLICE_H_
4084306Sru
4138786Sdfrstruct g_slice {
4244522Sbde	off_t	offset;
4338786Sdfr	off_t	length;
4444522Sbde	u_int	sectorsize;
4538786Sdfr	struct	g_provider *provider;
4638786Sdfr};
47121379Shmp
48121379Shmptypedef int g_slice_start_t (struct bio *bp);
4938786Sdfr
5038786Sdfrstruct g_slicer {
5138786Sdfr	u_int		nslice;
5238786Sdfr	u_int		nprovider;
5338786Sdfr	u_int		nhot;
5438786Sdfr	struct g_slice	*slices;
5538786Sdfr	struct g_slice	*hot;
5638786Sdfr	void		*softc;
5738786Sdfr	g_slice_start_t	*start;
5838786Sdfr};
5938786Sdfr
6038786Sdfrg_dumpconf_t g_slice_dumpconf;
6138786Sdfrint g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length, u_int sectorsize, const char *fmt, ...);
62121414Shmp#define G_SLICE_CONFIG_CHECK	0
6338786Sdfr#define G_SLICE_CONFIG_SET	1
64#define G_SLICE_CONFIG_FORCE	2
65struct 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);
66
67int g_slice_conf_hot(struct g_geom *gp, u_int idx, off_t offset, off_t length);
68void g_slice_finish_hot(struct bio *bp);
69
70#endif /* _GEOM_GEOM_SLICE_H_ */
71