/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 2002 Poul-Henning Kamp4* Copyright (c) 2002 Networks Associates Technology, Inc.5* All rights reserved.6*7* This software was developed for the FreeBSD Project by Poul-Henning Kamp8* and NAI Labs, the Security Research Division of Network Associates, Inc.9* under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the10* DARPA CHATS research program.11*12* Redistribution and use in source and binary forms, with or without13* modification, are permitted provided that the following conditions14* are met:15* 1. Redistributions of source code must retain the above copyright16* notice, this list of conditions and the following disclaimer.17* 2. Redistributions in binary form must reproduce the above copyright18* notice, this list of conditions and the following disclaimer in the19* documentation and/or other materials provided with the distribution.20* 3. The names of the authors may not be used to endorse or promote21* products derived from this software without specific prior written22* permission.23*24* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND25* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE26* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE27* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE28* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL29* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS30* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)31* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT32* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY33* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF34* SUCH DAMAGE.35*/3637#ifndef _GEOM_GEOM_SLICE_H_38#define _GEOM_GEOM_SLICE_H_3940struct g_slice {41off_t offset;42off_t length;43u_int sectorsize;44struct g_provider *provider;45};4647struct g_slice_hot {48off_t offset;49off_t length;50int ract;51int dact;52int wact;53};5455typedef int g_slice_start_t (struct bio *bp);5657struct g_slicer {58u_int nslice;59u_int nprovider;60struct g_slice *slices;6162u_int nhotspot;63struct g_slice_hot *hotspot;6465void *softc;66g_slice_start_t *start;67g_event_t *hot;68};6970g_dumpconf_t g_slice_dumpconf;71int g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length, u_int sectorsize, const char *fmt, ...) __printflike(7, 8);72void g_slice_spoiled(struct g_consumer *cp);73void g_slice_orphan(struct g_consumer *cp);74#define G_SLICE_CONFIG_CHECK 075#define G_SLICE_CONFIG_SET 176#define G_SLICE_CONFIG_FORCE 277struct 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);7879int g_slice_conf_hot(struct g_geom *gp, u_int idx, off_t offset, off_t length, int ract, int dact, int wact);80#define G_SLICE_HOT_ALLOW 181#define G_SLICE_HOT_DENY 282#define G_SLICE_HOT_START 483#define G_SLICE_HOT_CALL 88485int g_slice_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp);8687void g_slice_finish_hot(struct bio *bp);8889#endif /* _GEOM_GEOM_SLICE_H_ */909192