geom_slice.h revision 94287
1176829Srink/*-
2176829Srink * Copyright (c) 2002 Poul-Henning Kamp
3176829Srink * Copyright (c) 2002 Networks Associates Technology, Inc.
4176829Srink * All rights reserved.
5176829Srink *
6176829Srink * This software was developed for the FreeBSD Project by Poul-Henning Kamp
7176829Srink * and NAI Labs, the Security Research Division of Network Associates, Inc.
8176829Srink * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
9176829Srink * DARPA CHATS research program.
10176829Srink *
11176829Srink * Redistribution and use in source and binary forms, with or without
12176829Srink * modification, are permitted provided that the following conditions
13176829Srink * are met:
14176829Srink * 1. Redistributions of source code must retain the above copyright
15176829Srink *    notice, this list of conditions and the following disclaimer.
16176829Srink * 2. Redistributions in binary form must reproduce the above copyright
17176829Srink *    notice, this list of conditions and the following disclaimer in the
18176829Srink *    documentation and/or other materials provided with the distribution.
19239037Sgavin * 3. The names of the authors may not be used to endorse or promote
20176829Srink *    products derived from this software without specific prior written
21176829Srink *    permission.
22176829Srink *
23176829Srink * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24239037Sgavin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25176829Srink * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26176829Srink * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27176829Srink * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28176829Srink * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29176829Srink * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30227750Smiwi * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31227750Smiwi * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32176829Srink * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33176829Srink * SUCH DAMAGE.
34176829Srink *
35176829Srink * $FreeBSD: head/sys/geom/geom_slice.h 94287 2002-04-09 15:43:32Z phk $
36176829Srink */
37176829Srink
38176829Srinkstruct g_slice {
39176829Srink	off_t	offset;
40176829Srink	off_t	length;
41176829Srink	struct	g_provider *provider;
42176829Srink};
43176829Srink
44239037Sgavintypedef int g_slice_start_t (struct bio *bp);
45238803Sgavin
46176834Sbruefferstruct g_slicer {
47176829Srink	int		nslice;
48176829Srink	off_t		cfrontstuff;
49176829Srink	off_t		frontstuff;
50176834Sbrueffer	struct g_slice	*slices;
51176834Sbrueffer	void		*softc;
52176834Sbrueffer	g_slice_start_t	*start;
53238803Sgavin};
54238803Sgavin
55238803Sgavinstruct g_slicer * g_slice_init(unsigned nslice, unsigned scsize);
56238803Sgaving_dumpconf_t g_slice_dumpconf;
57238803Sgavinstruct g_provider * g_slice_addslice(struct g_geom *gp, int index, off_t offset, off_t length, char *fmt, ...);
58238803Sgavinstruct 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);
59238803Sgavin
60238803Sgavin