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