fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER START
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The contents of this file are subject to the terms of the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Common Development and Distribution License, Version 1.0 only
fa9e4066f08beec538e775443c5be79dd423fcabahrens * (the "License"). You may not use this file except in compliance
fa9e4066f08beec538e775443c5be79dd423fcabahrens * with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens * See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens * and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * When distributing Covered Code, include this CDDL HEADER in each
fa9e4066f08beec538e775443c5be79dd423fcabahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If applicable, add the following below this CDDL HEADER, with the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * fields enclosed by brackets "[]" replaced with your own identifying
fa9e4066f08beec538e775443c5be79dd423fcabahrens * information: Portions Copyright [yyyy] [name of copyright owner]
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER END
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Use is subject to license terms.
fa9e4066f08beec538e775443c5be79dd423fcabahrens#pragma ident "%Z%%M% %I% %E% SMI"
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Function prototypes
fa9e4066f08beec538e775443c5be79dd423fcabahrensstatic jobject create_DiskDeviceBean(JNIEnv *, dmgt_disk_t *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensstatic jobject create_SliceUsage(JNIEnv *env, dmgt_slice_t *sp);
fa9e4066f08beec538e775443c5be79dd423fcabahrensstatic jobject create_SliceDeviceBean(JNIEnv *env, dmgt_slice_t *sp);
fa9e4066f08beec538e775443c5be79dd423fcabahrensstatic jobjectArray create_SliceDeviceBean_array(JNIEnv *, dmgt_slice_t **);
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Static functions
fa9e4066f08beec538e775443c5be79dd423fcabahrens int naliases = zjni_count_elements((void **)dp->aliases);
fa9e4066f08beec538e775443c5be79dd423fcabahrens jobjectArray slices = create_SliceDeviceBean_array(env,
fa9e4066f08beec538e775443c5be79dd423fcabahrens jstring nameUTF = (*env)->NewStringUTF(env, dp->name);
fa9e4066f08beec538e775443c5be79dd423fcabahrens dm_usage, "L" ZFSJNI_PACKAGE_DATA "SliceUsage$Use;");
fa9e4066f08beec538e775443c5be79dd423fcabahrens /* Retrieve the proper SliceUsage$Use enum value */
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif /* DEBUG */
fa9e4066f08beec538e775443c5be79dd423fcabahrens jobject use = get_SliceUsage_Use(env, sp->used_name);
fa9e4066f08beec538e775443c5be79dd423fcabahrens "SliceUsage$Use;Ljava/lang/String;)V");
fa9e4066f08beec538e775443c5be79dd423fcabahrens /* May be NULL if unused */
fa9e4066f08beec538e775443c5be79dd423fcabahrens jstring nameUTF = (*env)->NewStringUTF(env, sp->name);
fa9e4066f08beec538e775443c5be79dd423fcabahrens (*env)->GetMethodID(env, class_SliceDeviceBean, "<init>",
fa9e4066f08beec538e775443c5be79dd423fcabahrens "(JLjava/lang/String;JL" ZFSJNI_PACKAGE_DATA "SliceUsage;)V");
fa9e4066f08beec538e775443c5be79dd423fcabahrens slice = (*env)->NewObject(env, class_SliceDeviceBean,
fa9e4066f08beec538e775443c5be79dd423fcabahrenscreate_SliceDeviceBean_array(JNIEnv *env, dmgt_slice_t **slices)
fa9e4066f08beec538e775443c5be79dd423fcabahrens /* Create an array list */
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Package-private functions
fa9e4066f08beec538e775443c5be79dd423fcabahrenszjni_create_add_DiskDevice(dmgt_disk_t *dp, void *data)
fa9e4066f08beec538e775443c5be79dd423fcabahrens JNIEnv *env = ((zjni_ArrayCallbackData_t *)data)->env;
fa9e4066f08beec538e775443c5be79dd423fcabahrens zjni_Collection_t *list = ((zjni_ArrayCallbackData_t *)data)->list;
fa9e4066f08beec538e775443c5be79dd423fcabahrens /* Add disk to zjni_ArrayList */
fa9e4066f08beec538e775443c5be79dd423fcabahrens (*env)->CallBooleanMethod(env, ((zjni_Object_t *)list)->object,
fa9e4066f08beec538e775443c5be79dd423fcabahrens return (0);