2 .\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH POOL_RESOURCE_CREATE 3POOL "April 9, 2016"
8 pool_resource_create, pool_resource_destroy, pool_resource_info,
9 pool_query_resource_components, pool_resource_transfer, pool_resource_xtransfer
10 \- resource pool resource manipulation functions
14 cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lpool\fR [ \fIlibrary\fR\&.\|.\|. ]
17 \fBpool_resource_t *\fR\fBpool_resource_create\fR(\fBpool_conf_t *\fR\fIconf\fR,
18 \fBconst char *\fR\fItype\fR, \fBconst char *\fR\fIname\fR);
23 \fBint\fR \fBpool_resource_destroy\fR(\fBpool_conf_t *\fR\fIconf\fR,
24 \fBpool_resource_t *\fR\fIresource\fR);
29 \fBconst char *\fR\fBpool_resource_info\fR(\fBpool_conf_t *\fR\fIconf\fR
30 \fBpool_resource_t *\fR\fIresource\fR, \fBint\fR \fIflags\fR);
35 \fBpool_component_t **\fR\fBpool_query_resource_components\fR(
36 \fBpool_conf_t *\fR\fIconf\fR, \fBpool_resource_t *\fR\fIresource\fR,
37 \fBuint_t *\fR\fInelem\fR, \fBpool_value_t **\fR\fIprops\fR);
42 \fBint\fR \fBpool_resource_transfer\fR(\fBpool_conf_t *\fR\fIconf\fR,
43 \fBpool_resource_t *\fR\fIsource\fR, \fBpool_resource_t *\fR\fItarget\fR,
44 \fBuint64_t\fR \fIsize\fR);
49 \fBint\fR \fBpool_resource_xtransfer\fR(\fBpool_conf_t *\fR\fIconf\fR,
50 \fBpool_resource_t *\fR\fIsource\fR, \fBpool_resource_t *\fR\fItarget\fR,
51 \fBpool_component_t **\fR\fIcomponents\fR);
56 The \fBpool_resource_create()\fR function creates and returns a new resource of
57 the given \fIname\fR and \fItype\fR in the provided configuration. If there is
58 already a resource of the given name, the operation will fail.
61 The \fBpool_resource_destroy()\fR function removes the specified \fIresource\fR
62 from its configuration file.
65 The \fBpool_resource_info()\fR function returns a string describing the given
66 \fIresource\fR. The string is allocated with \fBmalloc\fR(3C). The caller is
67 responsible for freeing the returned string. If the \fIflags\fR argument is
68 non-zero, the string returned also describes the components (if any) contained
72 The \fBpool_query_resource_components()\fR function returns a null-terminated
73 array of the components (if any) that comprise the given resource.
76 The \fBpool_resource_transfer()\fR function transfers \fIsize\fR basic units
77 from the \fIsource\fR resource to the \fItarget\fR. Both resources must be of
78 the same type for the operation to succeed. Transferring component resources,
79 such as processors, is always performed as series of
80 \fBpool_resource_xtransfer()\fR operations, since discrete resources must be
81 identified for transfer.
84 The \fBpool_resource_xtransfer()\fR function transfers the specific
85 \fIcomponents\fR from the \fIsource\fR resource to the \fItarget\fR. Both
86 resources must be of the same type, and of a type that contains components
87 (such as processor sets). The \fIcomponents\fR argument is a null-terminated
88 list of \fBpool_component_t\fR.
91 The \fIconf\fR argument for each function refers to the target configuration to
92 which the operation applies.
95 Upon successful completion, \fBpool_resource_create()\fR returns a new
96 \fBpool_resource_t\fR with default properties initialized. Otherwise,
97 \fINULL\fR is returned and \fBpool_error\fR(3POOL) returns the pool-specific
101 Upon successful completion, \fBpool_resource_destroy()\fR returns 0. Otherwise,
102 -1 is returned and \fBpool_error()\fR returns the pool-specific error value.
105 Upon successful completion, \fBpool_resource_info()\fR returns a string
106 describing the given resource (and optionally its components). Otherwise,
107 \fINULL\fR is returned and \fBpool_error()\fR returns the pool-specific error
111 Upon successful completion, \fBpool_query_resource_components()\fR returns a
112 null-terminated array of \fBpool_component_t *\fR that match the provided
113 null-terminated property list and are contained in the given resource.
114 Otherwise, \fINULL\fR is returned and \fBpool_error()\fR returns the
115 pool-specific error value.
118 Upon successful completion, \fBpool_resource_transfer()\fR and
119 \fBpool_resource_xtransfer()\fR return 0. Otherwise -1 is returned and
120 \fBpool_error()\fR returns the pool-specific error value.
123 The \fBpool_resource_create()\fR function will fail if:
127 \fB\fBPOE_BADPARAM\fR\fR
130 The supplied configuration's status is not \fBPOF_VALID\fR or \fIname\fR is in
131 use for this resource type.
137 \fB\fBPOE_INVALID_CONF\fR\fR
140 The resource element could not be created because the configuration would be
147 \fB\fBPOE_PUTPROP\fR\fR
150 One of the supplied properties could not be set.
156 \fB\fBPOE_SYSTEM\fR\fR
159 A system error has occurred. Check the system error code for more details.
164 The \fBpool_resource_destroy()\fR function will fail if:
168 \fB\fBPOE_BADPARAM\fR\fR
171 The supplied configuration's status is not \fBPOF_VALID\fR.
176 The \fBpool_resource_info()\fR function will fail if:
180 \fB\fBPOE_BADPARAM\fR\fR
183 The supplied configuration's status is not \fBPOF_VALID\fR or the \fIflags\fR
184 paramter is neither 0 nor 1.
190 \fB\fBPOE_INVALID_CONF\fR\fR
193 The configuration is invalid.
199 \fB\fBPOE_SYSTEM\fR\fR
202 A system error has occurred. Check the system error code for more details.
207 The \fBpool_query_resource_components()\fR function will fail if:
211 \fB\fBPOE_BADPARAM\fR\fR
214 The supplied configuration's status is not \fBPOF_VALID\fR.
220 \fB\fBPOE_INVALID_CONF\fR\fR
223 The configuration is invalid.
229 \fB\fBPOE_SYSTEM\fR\fR
232 A system error has occurred. Check the system error code for more details.
237 The \fBpool_resource_transfer()\fR function will fail if:
241 \fB\fBPOE_BADPARAM\fR\fR
244 The supplied configuration's status is not \fBPOF_VALID\fR, the two resources
245 are not of the same type, or the transfer would cause either of the resources
246 to exceed their \fBmin\fR and \fBmax\fR properties.
252 \fB\fBPOE_SYSTEM\fR\fR
255 A system error has occurred. Check the system error code for more details.
260 The \fBpool_resource_xtransfer()\fR function will fail if:
264 \fB\fBPOE_BADPARAM\fR\fR
267 The supplied configuration's status is not \fBPOF_VALID\fR, the two resources
268 are not of the same type, or the supplied resources do not belong to the
275 \fB\fBPOE_INVALID_CONF\fR\fR
278 The transfer operation failed and the configuration may be invalid.
284 \fB\fBPOE_SYSTEM\fR\fR
287 A system error has occurred. Check the system error code for more details.
292 \fBExample 1 \fRCreate a new resource of type \fBpset\fR named \fBfoo\fR.
302 pool_resource_t *resource;
305 if ((resource = pool_resource_create(conf, "pset",
307 (void) fprintf(stderr, "Cannot create resource\\B{}n");
315 See \fBattributes\fR(5) for descriptions of the following attributes:
323 ATTRIBUTE TYPE ATTRIBUTE VALUE
327 Interface Stability Unstable
334 \fBlibpool\fR(3LIB), \fBpool_error\fR(3POOL), \fBattributes\fR(5)