xref: /titanic_41/usr/src/cmd/lvm/metassist/common/volume_request.h (revision 37714ae43602c675f9dc59b070bfdf9fa702872c)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_VOLUME_REQUEST_H
28 #define	_VOLUME_REQUEST_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #include "volume_devconfig.h"
37 
38 /*
39  * request_t - struct to hold a layout request
40  */
41 typedef struct request {
42 	/*
43 	 * The devconfig_t representing the disk set at the top of the
44 	 * request hierarchy.  This hierarchy represents the requested
45 	 * volume configuration, as read from the volume-request.
46 	 */
47 	devconfig_t *diskset_req;
48 
49 	/*
50 	 * The devconfig_t representing the disk set at the top of the
51 	 * resulting proposed volume hierarchy.  This hierarchy
52 	 * represents the volume configuration proposed by the layout
53 	 * engine.  This configuration will eventually be converted to
54 	 * a volume-spec.
55 	 */
56 	devconfig_t *diskset_config;
57 } request_t;
58 
59 /*
60  * Constructor: Create a request_t struct. This request_t must be
61  * freed.
62  *
63  * @param       request
64  *              RETURN: a pointer to a new request_t
65  *
66  * @return      0
67  *              if successful
68  *
69  * @return      non-zero
70  *              if an error occurred.  Use get_error_string() to
71  *              retrieve the associated error message.
72  */
73 extern int new_request(request_t **request);
74 
75 /*
76  * Free memory (recursively) allocated to a request_t struct
77  *
78  * @param       arg
79  *              pointer to the request_t struct to free
80  */
81 extern void free_request(void *arg);
82 
83 /*
84  * Set the disk set at the top of the request hierarchy
85  *
86  * @param       request
87  *              The request_t representing the request to modify
88  *
89  * @param       diskset
90  *              The devconfig_t representing the toplevel (disk set)
91  *              device in the volume request hierarchy
92  */
93 extern void request_set_diskset_req(request_t *request, devconfig_t *diskset);
94 
95 /*
96  * Get the disk set at the top of the request hierarchy
97  *
98  * @param       request
99  *              The request_t representing the request to examine
100  *
101  * @return      The devconfig_t representing the toplevel (disk set)
102  *              device in the volume request hierarchy
103  */
104 extern devconfig_t *request_get_diskset_req(request_t *request);
105 
106 /*
107  * Set/get the disk set at the top of the proposed volume hierarchy
108  *
109  * @param       request
110  *              The request_t representing the request to modify
111  *
112  * @param       diskset
113  *              The devconfig_t representing the toplevel (disk set)
114  *              device in the proposed volume hierarchy
115  */
116 extern void request_set_diskset_config(
117 	request_t *request, devconfig_t *diskset);
118 
119 /*
120  * Get the disk set at the top of the request hierarchy
121  *
122  * @param       request
123  *              The request_t representing the request to examine
124  *
125  * @return      The devconfig_t representing the toplevel (disk set)
126  *              device in the proposed volume hierarchy
127  */
128 extern devconfig_t *request_get_diskset_config(request_t *request);
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif /* _VOLUME_REQUEST_H */
135