xref: /illumos-gate/usr/src/lib/libshare/common/scfutil.h (revision 20a7641f9918de8574b8b3b47dbe35c4bfc78df1)
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 2007 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 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 #include <libxml/tree.h>
38 
39 typedef struct scfutilhandle {
40 	scf_handle_t		*handle;
41 	int			scf_state;
42 	scf_service_t		*service;
43 	scf_scope_t		*scope;
44 	scf_transaction_t	*trans;
45 	scf_transaction_entry_t	*entry;
46 	scf_propertygroup_t	*pg;
47 	scf_instance_t		*instance;
48 } scfutilhandle_t;
49 
50 #define	SCH_STATE_UNINIT	0
51 #define	SCH_STATE_INITIALIZING	1
52 #define	SCH_STATE_INIT	2
53 
54 extern void sa_scf_fini(scfutilhandle_t *);
55 extern scfutilhandle_t *sa_scf_init();
56 extern int sa_get_config(scfutilhandle_t *, xmlNodePtr, sa_handle_t);
57 extern int sa_get_instance(scfutilhandle_t *, char *);
58 extern int sa_create_instance(scfutilhandle_t *, char *);
59 
60 /*
61  * Shares are held in a property group with name of the form
62  * S-<GUID>.  The total length of the name is 38 characters.
63  */
64 #define	SA_SHARE_PG_PREFIX	"S-"
65 #define	SA_SHARE_PG_PREFIXLEN	2
66 #define	SA_SHARE_PG_LEN		38
67 #define	SA_SHARE_UUID_BUFLEN	64
68 
69 /*
70  * service instance related defines
71  */
72 #define	SA_GROUP_SVC_NAME	"network/shares/group"
73 #define	SA_GROUP_INST_LEN	256
74 
75 #ifdef	__cplusplus
76 }
77 #endif
78 
79 #endif /* _SCFUTIL_H */
80