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 (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 /* 28 * basic API declarations for share management 29 */ 30 31 #ifndef _SCFUTIL_H 32 #define _SCFUTIL_H 33 34 #pragma ident "%Z%%M% %I% %E% SMI" 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 #include <libxml/tree.h> 40 41 typedef struct scfutilhandle { 42 scf_handle_t *handle; 43 int scf_state; 44 scf_service_t *service; 45 scf_scope_t *scope; 46 scf_transaction_t *trans; 47 scf_transaction_entry_t *entry; 48 scf_propertygroup_t *pg; 49 scf_instance_t *instance; 50 } scfutilhandle_t; 51 52 #define SCH_STATE_UNINIT 0 53 #define SCH_STATE_INITIALIZING 1 54 #define SCH_STATE_INIT 2 55 56 extern void sa_scf_fini(scfutilhandle_t *); 57 extern scfutilhandle_t *sa_scf_init(); 58 extern int sa_get_config(scfutilhandle_t *, xmlNodePtr *, xmlDocPtr *); 59 extern int sa_get_instance(scfutilhandle_t *, char *); 60 extern int sa_create_instance(scfutilhandle_t *, char *); 61 62 /* 63 * Shares are held in a property group with name of the form 64 * S-<GUID>. The total length of the name is 38 characters. 65 */ 66 #define SA_SHARE_PG_PREFIX "S-" 67 #define SA_SHARE_PG_PREFIXLEN 2 68 #define SA_SHARE_PG_LEN 38 69 #define SA_SHARE_UUID_BUFLEN 64 70 71 /* 72 * service instance related defines 73 */ 74 #define SA_GROUP_SVC_NAME "network/shares/group" 75 #define SA_GROUP_INST_LEN 256 76 77 #ifdef __cplusplus 78 } 79 #endif 80 81 #endif /* _SCFUTIL_H */ 82