xref: /illumos-gate/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/PoolInternal.java (revision 55fea89dcaa64928bed4327112404dcb3e07b79f)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  *
26  * ident	"%Z%%M%	%I%	%E% SMI"
27  */
28 
29 package com.sun.solaris.service.pools;
30 
31 /**
32  * A thin layer over the libpool(3LIB) interface so that Java can be
33  * used to manipulate resource pools. For more information on this
34  * facility refer to the manpage and the developer documentation.
35  *
36  * Most of the functionality in this class is not intended to be
37  * exposed to users of the package. The other classes in the package
38  * provide appropriate Java abstractions for using this functionality.
39  *
40  * Refer to the package documentation and the documentation of the
41  * other publicly visible classes for more details.
42  */
43 public class PoolInternal {
44 	static {
45 		System.loadLibrary("jpool");
PoolInternal.init()46 		PoolInternal.init();
47 	}
48 
init()49 	final static native void init();
pool_version(long ver)50 	final static native long pool_version(long ver);
get_POX_NATIVE()51 	final static native int get_POX_NATIVE();
get_POX_TEXT()52 	final static native int get_POX_TEXT();
get_POC_INVAL()53 	final static native int get_POC_INVAL();
get_POC_UINT()54 	final static native int get_POC_UINT();
get_POC_INT()55 	final static native int get_POC_INT();
get_POC_DOUBLE()56 	final static native int get_POC_DOUBLE();
get_POC_BOOL()57 	final static native int get_POC_BOOL();
get_POC_STRING()58 	final static native int get_POC_STRING();
get_POV_NONE()59 	final static native int get_POV_NONE();
get_POV_LOOSE()60 	final static native int get_POV_LOOSE();
get_POV_STRICT()61 	final static native int get_POV_STRICT();
get_POV_RUNTIME()62 	final static native int get_POV_RUNTIME();
get_POF_INVALID()63 	final static native int get_POF_INVALID();
get_POF_VALID()64 	final static native int get_POF_VALID();
get_POF_DESTROY()65 	final static native int get_POF_DESTROY();
pool_error()66 	public final static native int pool_error();
pool_strerror(int error)67 	public final static native String pool_strerror(int error);
pool_strerror_sys()68 	public final static native String pool_strerror_sys();
pool_resource_type_list(long types, long numtypes)69 	public final static native int pool_resource_type_list(long types,
70 	    long numtypes);
pool_get_status()71 	public final static native int pool_get_status();
pool_set_status(int state)72 	public final static native int pool_set_status(int state);
pool_conf_alloc()73 	final static native long pool_conf_alloc();
pool_conf_free(long conf)74 	final static native void pool_conf_free(long conf);
pool_conf_status(long conf)75 	final static native int pool_conf_status(long conf);
pool_conf_close(long conf)76 	final static native int pool_conf_close(long conf);
pool_conf_remove(long conf)77 	final static native int pool_conf_remove(long conf);
pool_conf_open(long conf, String location, int oflags)78 	final static native int pool_conf_open(long conf, String location,
79 	    int oflags);
pool_conf_rollback(long conf)80 	final static native int pool_conf_rollback(long conf);
pool_conf_commit(long conf, int active)81 	final static native int pool_conf_commit(long conf, int active);
pool_conf_export(long conf, String location, int fmt)82 	final static native int pool_conf_export(long conf, String location,
83 	    int fmt);
pool_conf_validate(long conf, int level)84 	final static native int pool_conf_validate(long conf, int level);
pool_conf_update(long conf)85 	final static native int pool_conf_update(long conf);
pool_get_pool(long conf, String name)86 	final static native long pool_get_pool(long conf, String name);
pool_query_pools(long conf, java.util.List props)87 	final static native java.util.List pool_query_pools(long conf,
88 	    java.util.List props);
pool_get_resource(long conf, String type, String name)89 	final static native long pool_get_resource(long conf, String type,
90 	    String name);
pool_query_resources(long conf, java.util.List props)91 	final static native java.util.List pool_query_resources(long conf,
92 	    java.util.List props);
pool_query_components(long conf, java.util.List props)93 	final static native java.util.List pool_query_components(long conf,
94 	    java.util.List props);
pool_conf_location(long conf)95 	final static native String pool_conf_location(long conf);
pool_conf_info(long conf, int deep)96 	final static native String pool_conf_info(long conf, int deep);
pool_resource_create(long conf, String type, String name)97 	final static native long pool_resource_create(long conf,
98 	    String type, String name);
pool_resource_destroy(long conf, long res)99 	final static native int pool_resource_destroy(long conf, long res);
pool_resource_transfer(long conf, long src, long tgt, long size)100 	final static native int pool_resource_transfer(long conf,
101 	    long src, long tgt, long size);
pool_resource_xtransfer(long conf, long src, long tgt, java.util.List components)102 	final static native int pool_resource_xtransfer(long conf,
103 	    long src, long tgt, java.util.List components);
pool_query_resource_components( long conf, long res, java.util.List props)104 	final static native java.util.List pool_query_resource_components(
105 	    long conf, long res, java.util.List props);
pool_resource_info(long conf, long res, int deep)106 	final static native String pool_resource_info(long conf, long res,
107 	    int deep);
pool_create(long conf, String name)108 	final static native long pool_create(long conf, String name);
pool_destroy(long conf, long pool)109 	final static native int pool_destroy(long conf, long pool);
pool_associate(long conf, long pool, long res)110 	final static native int pool_associate(long conf, long pool,
111 	    long res);
pool_dissociate(long conf, long pool, long res)112 	final static native int pool_dissociate(long conf, long pool,
113 	    long res);
pool_info(long conf, long pool, int deep)114 	final static native String pool_info(long conf, long pool, int deep);
pool_query_pool_resources( long conf, long pool, java.util.List props)115 	final static native java.util.List pool_query_pool_resources(
116 	    long conf, long pool, java.util.List props);
pool_get_owning_resource(long conf, long comp)117 	final static native long pool_get_owning_resource(long conf,
118 	    long comp);
pool_component_info(long conf, long comp, int deep)119 	final static native String pool_component_info(long conf,
120 	    long comp, int deep);
pool_get_property(long conf, long elem, String name, long val)121 	final static native int pool_get_property(long conf, long elem,
122 	    String name, long val);
pool_put_property(long conf, long elem, String name, long val)123 	final static native int pool_put_property(long conf, long elem,
124 	    String name, long val);
pool_rm_property(long conf, long elem, String name)125 	final static native int pool_rm_property(long conf, long elem,
126 	    String name);
pool_walk_properties(long conf, long elem, long user, long callback)127 	final static native int pool_walk_properties(long conf, long elem,
128 	    long user, long callback);
pool_conf_to_elem(long conf)129 	final static native long pool_conf_to_elem(long conf);
pool_to_elem(long conf, long pool)130 	final static native long pool_to_elem(long conf, long pool);
pool_resource_to_elem(long conf, long res)131 	final static native long pool_resource_to_elem(long conf, long res);
pool_component_to_elem(long conf, long comp)132 	final static native long pool_component_to_elem(long conf, long comp);
pool_value_get_uint64(long pv, long result)133 	final static native int pool_value_get_uint64(long pv, long result);
pool_value_get_int64(long pv, long result)134 	final static native int pool_value_get_int64(long pv, long result);
pool_value_get_double(long pv, long result)135 	final static native int pool_value_get_double(long pv, long result);
pool_value_get_bool(long pv, long result)136 	final static native int pool_value_get_bool(long pv, long result);
pool_value_get_string(long pv, long result)137 	final static native int pool_value_get_string(long pv, long result);
pool_value_get_type(long pv)138 	final static native int pool_value_get_type(long pv);
pool_value_set_uint64(long pv, long val)139 	final static native void pool_value_set_uint64(long pv, long val);
pool_value_set_int64(long pv, long val)140 	final static native void pool_value_set_int64(long pv, long val);
pool_value_set_double(long pv, double val)141 	final static native void pool_value_set_double(long pv, double val);
pool_value_set_bool(long pv, short val)142 	final static native void pool_value_set_bool(long pv, short val);
pool_value_set_string(long pv, String val)143 	final static native int pool_value_set_string(long pv, String val);
pool_value_get_name(long pv)144 	final static native String pool_value_get_name(long pv);
pool_value_set_name(long pv, String val)145 	final static native int pool_value_set_name(long pv, String val);
pool_value_alloc()146 	final static native long pool_value_alloc();
pool_value_free(long pv)147 	final static native void pool_value_free(long pv);
pool_static_location()148 	public final static native String pool_static_location();
pool_dynamic_location()149 	public final static native String pool_dynamic_location();
pool_set_binding(String name, int idtype, int id)150 	public final static native int pool_set_binding(String name,
151 	    int idtype, int id);
pool_get_binding(int pid)152 	public final static native String pool_get_binding(int pid);
pool_get_resource_binding( String type, int pid)153 	public final static native String pool_get_resource_binding(
154 	    String type, int pid);
pool_walk_pools(long conf, long user, long callback)155 	final static native int pool_walk_pools(long conf, long user,
156 	    long callback);
pool_walk_resources(long conf, long pool, long user, long callback)157 	final static native int pool_walk_resources(long conf, long pool,
158 	    long user, long callback);
pool_walk_components(long conf, long res, long user, long callback)159 	final static native int pool_walk_components(long conf, long res,
160 	    long user, long callback);
161 	/*
162 	 * enums and constants
163 	 */
164 	public final static int POOL_VER_CURRENT = 1;
165 	public final static int POOL_VER_NONE = 0;
166 	public final static int PO_TRUE = 1;
167 	public final static int PO_FALSE = 0;
168 	public final static int PO_SUCCESS = 0;
169 	public final static int PO_FAIL = -1;
170 	public final static int POE_OK = 0;
171 	public final static int POE_BAD_PROP_TYPE = 1;
172 	public final static int POE_INVALID_CONF = 2;
173 	public final static int POE_NOTSUP = 3;
174 	public final static int POE_INVALID_SEARCH = 4;
175 	public final static int POE_BADPARAM = 5;
176 	public final static int POE_PUTPROP = 6;
177 	public final static int POE_DATASTORE = 7;
178 	public final static int POE_SYSTEM = 8;
179 	public final static int POE_ACCESS = 9;
180 	public final static int PO_RDONLY = 0x0;
181 	public final static int PO_RDWR = 0x1;
182 	public final static int PO_CREAT = 0x2;
183 	public final static int PO_DISCO = 0x4;
184 	public final static int PO_UPDATE = 0x8;
185 	public final static String POA_IMPORTANCE = "importance based";
186 	public final static String POA_SURPLUS_TO_DEFAULT =
187 	    "surplus to default";
188 	public final static int POU_SYSTEM = 0x1;
189 	public final static int POU_POOL = 0x2;
190 	public final static int POU_PSET = 0x4;
191 	public final static int POU_CPU = 0x8;
192 	public final static int POX_NATIVE = get_POX_NATIVE();
193 	public final static int POX_TEXT = get_POX_TEXT();
194 	public final static int POC_INVAL = get_POC_INVAL();
195 	public final static int POC_UINT = get_POC_UINT();
196 	public final static int POC_INT = get_POC_INT();
197 	public final static int POC_DOUBLE = get_POC_DOUBLE();
198 	public final static int POC_BOOL = get_POC_BOOL();
199 	public final static int POC_STRING = get_POC_STRING();
200 	public final static int POV_NONE = get_POV_NONE();
201 	public final static int POV_LOOSE = get_POV_LOOSE();
202 	public final static int POV_STRICT = get_POV_STRICT();
203 	public final static int POV_RUNTIME = get_POV_RUNTIME();
204 	public final static int POF_INVALID = get_POF_INVALID();
205 	public final static int POF_VALID = get_POF_VALID();
206 	public final static int POF_DESTROY = get_POF_DESTROY();
207 }
208