xref: /titanic_52/usr/src/lib/libshare/common/scfutil.h (revision 1d1813a7a7c570174c2b6adc372045307b266117)
16185db85Sdougm /*
26185db85Sdougm  * CDDL HEADER START
36185db85Sdougm  *
46185db85Sdougm  * The contents of this file are subject to the terms of the
56185db85Sdougm  * Common Development and Distribution License (the "License").
66185db85Sdougm  * You may not use this file except in compliance with the License.
76185db85Sdougm  *
86185db85Sdougm  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
96185db85Sdougm  * or http://www.opensolaris.org/os/licensing.
106185db85Sdougm  * See the License for the specific language governing permissions
116185db85Sdougm  * and limitations under the License.
126185db85Sdougm  *
136185db85Sdougm  * When distributing Covered Code, include this CDDL HEADER in each
146185db85Sdougm  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
156185db85Sdougm  * If applicable, add the following below this CDDL HEADER, with the
166185db85Sdougm  * fields enclosed by brackets "[]" replaced with your own identifying
176185db85Sdougm  * information: Portions Copyright [yyyy] [name of copyright owner]
186185db85Sdougm  *
196185db85Sdougm  * CDDL HEADER END
206185db85Sdougm  */
216185db85Sdougm 
226185db85Sdougm /*
23549ec3ffSdougm  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
246185db85Sdougm  * Use is subject to license terms.
256185db85Sdougm  */
266185db85Sdougm 
276185db85Sdougm /*
286185db85Sdougm  * basic API declarations for share management
296185db85Sdougm  */
306185db85Sdougm 
316185db85Sdougm #ifndef _SCFUTIL_H
326185db85Sdougm #define	_SCFUTIL_H
336185db85Sdougm 
346185db85Sdougm #pragma ident	"%Z%%M%	%I%	%E% SMI"
356185db85Sdougm 
366185db85Sdougm #ifdef	__cplusplus
376185db85Sdougm extern "C" {
386185db85Sdougm #endif
396185db85Sdougm #include <libxml/tree.h>
406185db85Sdougm 
416185db85Sdougm typedef struct scfutilhandle {
426185db85Sdougm 	scf_handle_t		*handle;
436185db85Sdougm 	int			scf_state;
446185db85Sdougm 	scf_service_t		*service;
456185db85Sdougm 	scf_scope_t		*scope;
466185db85Sdougm 	scf_transaction_t	*trans;
476185db85Sdougm 	scf_transaction_entry_t	*entry;
486185db85Sdougm 	scf_propertygroup_t	*pg;
496185db85Sdougm 	scf_instance_t		*instance;
506185db85Sdougm } scfutilhandle_t;
516185db85Sdougm 
526185db85Sdougm #define	SCH_STATE_UNINIT	0
536185db85Sdougm #define	SCH_STATE_INITIALIZING	1
546185db85Sdougm #define	SCH_STATE_INIT	2
556185db85Sdougm 
566185db85Sdougm extern void sa_scf_fini(scfutilhandle_t *);
576185db85Sdougm extern scfutilhandle_t *sa_scf_init();
58*1d1813a7Sdougm extern int sa_get_config(scfutilhandle_t *, xmlNodePtr, sa_handle_t);
596185db85Sdougm extern int sa_get_instance(scfutilhandle_t *, char *);
606185db85Sdougm extern int sa_create_instance(scfutilhandle_t *, char *);
616185db85Sdougm 
626185db85Sdougm /*
636185db85Sdougm  * Shares are held in a property group with name of the form
646185db85Sdougm  * S-<GUID>.  The total length of the name is 38 characters.
656185db85Sdougm  */
666185db85Sdougm #define	SA_SHARE_PG_PREFIX	"S-"
676185db85Sdougm #define	SA_SHARE_PG_PREFIXLEN	2
686185db85Sdougm #define	SA_SHARE_PG_LEN		38
696185db85Sdougm #define	SA_SHARE_UUID_BUFLEN	64
706185db85Sdougm 
716185db85Sdougm /*
726185db85Sdougm  * service instance related defines
736185db85Sdougm  */
746185db85Sdougm #define	SA_GROUP_SVC_NAME	"network/shares/group"
756185db85Sdougm #define	SA_GROUP_INST_LEN	256
766185db85Sdougm 
776185db85Sdougm #ifdef	__cplusplus
786185db85Sdougm }
796185db85Sdougm #endif
806185db85Sdougm 
816185db85Sdougm #endif /* _SCFUTIL_H */
82