xref: /freebsd/sys/geom/vinum/geom_vinum.h (revision 1e413cf93298b5b97441a21d9a50fdcd0ee9945e)
1 /*-
2  * Copyright (c) 2004 Lukas Ertl
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28 
29 #ifndef	_GEOM_VINUM_H_
30 #define	_GEOM_VINUM_H_
31 
32 #define	ERRBUFSIZ	1024
33 
34 /* geom_vinum_drive.c */
35 void	gv_config_new_drive(struct gv_drive *);
36 void	gv_drive_modify(struct gv_drive *);
37 void	gv_save_config_all(struct gv_softc *);
38 void	gv_save_config(struct g_consumer *, struct gv_drive *,
39 	    struct gv_softc *);
40 
41 /* geom_vinum_init.c */
42 void	gv_parityop(struct g_geom *, struct gctl_req *);
43 void	gv_start_obj(struct g_geom *, struct gctl_req *);
44 
45 /* geom_vinum_list.c */
46 void	gv_ld(struct g_geom *, struct gctl_req *, struct sbuf *);
47 void	gv_lp(struct g_geom *, struct gctl_req *, struct sbuf *);
48 void	gv_ls(struct g_geom *, struct gctl_req *, struct sbuf *);
49 void	gv_lv(struct g_geom *, struct gctl_req *, struct sbuf *);
50 void	gv_list(struct g_geom *, struct gctl_req *);
51 
52 /* geom_vinum_move.c */
53 void	gv_move(struct g_geom *, struct gctl_req *);
54 
55 /* geom_vinum_rename.c */
56 void	gv_rename(struct g_geom *, struct gctl_req *);
57 
58 /* geom_vinum_rm.c */
59 void	gv_remove(struct g_geom *, struct gctl_req *);
60 int	gv_resetconfig(struct g_geom *, struct gctl_req *);
61 int	gv_rm_sd(struct gv_softc *sc, struct gctl_req *req,
62 	    struct gv_sd *s, int flags);
63 
64 /* geom_vinum_state.c */
65 int	gv_sdstatemap(struct gv_plex *);
66 void	gv_setstate(struct g_geom *, struct gctl_req *);
67 int	gv_set_drive_state(struct gv_drive *, int, int);
68 int	gv_set_sd_state(struct gv_sd *, int, int);
69 void	gv_update_sd_state(struct gv_sd *);
70 void	gv_update_plex_state(struct gv_plex *);
71 void	gv_update_vol_state(struct gv_volume *);
72 
73 /* geom_vinum_subr.c */
74 void	gv_adjust_freespace(struct gv_sd *, off_t);
75 void	gv_free_sd(struct gv_sd *);
76 struct g_geom	*find_vinum_geom(void);
77 struct gv_drive	*gv_find_drive(struct gv_softc *, char *);
78 struct gv_plex	*gv_find_plex(struct gv_softc *, char *);
79 struct gv_sd	*gv_find_sd(struct gv_softc *, char *);
80 struct gv_volume *gv_find_vol(struct gv_softc *, char *);
81 void	gv_format_config(struct gv_softc *, struct sbuf *, int, char *);
82 int	gv_is_striped(struct gv_plex *);
83 int	gv_is_open(struct g_geom *);
84 void	gv_kill_drive_thread(struct gv_drive *);
85 void	gv_kill_plex_thread(struct gv_plex *);
86 void	gv_kill_vol_thread(struct gv_volume *);
87 int	gv_object_type(struct gv_softc *, char *);
88 void	gv_parse_config(struct gv_softc *, u_char *, int);
89 int	gv_sd_to_drive(struct gv_softc *, struct gv_drive *, struct gv_sd *,
90 	    char *, int);
91 int	gv_sd_to_plex(struct gv_plex *, struct gv_sd *, int);
92 void	gv_update_plex_config(struct gv_plex *);
93 void	gv_update_vol_size(struct gv_volume *, off_t);
94 off_t	gv_vol_size(struct gv_volume *);
95 off_t	gv_plex_size(struct gv_plex *);
96 
97 #endif /* !_GEOM_VINUM_H_ */
98