xref: /freebsd-src/sys/contrib/openzfs/lib/libspl/include/libshare.h (revision eda14cbc264d6969b02f2b1994cef11148e914f1)
1*eda14cbcSMatt Macy /*
2*eda14cbcSMatt Macy  * CDDL HEADER START
3*eda14cbcSMatt Macy  *
4*eda14cbcSMatt Macy  * The contents of this file are subject to the terms of the
5*eda14cbcSMatt Macy  * Common Development and Distribution License (the "License").
6*eda14cbcSMatt Macy  * You may not use this file except in compliance with the License.
7*eda14cbcSMatt Macy  *
8*eda14cbcSMatt Macy  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*eda14cbcSMatt Macy  * or http://www.opensolaris.org/os/licensing.
10*eda14cbcSMatt Macy  * See the License for the specific language governing permissions
11*eda14cbcSMatt Macy  * and limitations under the License.
12*eda14cbcSMatt Macy  *
13*eda14cbcSMatt Macy  * When distributing Covered Code, include this CDDL HEADER in each
14*eda14cbcSMatt Macy  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*eda14cbcSMatt Macy  * If applicable, add the following below this CDDL HEADER, with the
16*eda14cbcSMatt Macy  * fields enclosed by brackets "[]" replaced with your own identifying
17*eda14cbcSMatt Macy  * information: Portions Copyright [yyyy] [name of copyright owner]
18*eda14cbcSMatt Macy  *
19*eda14cbcSMatt Macy  * CDDL HEADER END
20*eda14cbcSMatt Macy  */
21*eda14cbcSMatt Macy 
22*eda14cbcSMatt Macy /*
23*eda14cbcSMatt Macy  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24*eda14cbcSMatt Macy  * Use is subject to license terms.
25*eda14cbcSMatt Macy  * Copyright (c) 2019, 2020 by Delphix. All rights reserved.
26*eda14cbcSMatt Macy  */
27*eda14cbcSMatt Macy #ifndef _LIBSPL_LIBSHARE_H
28*eda14cbcSMatt Macy #define	_LIBSPL_LIBSHARE_H
29*eda14cbcSMatt Macy 
30*eda14cbcSMatt Macy /* API Initialization */
31*eda14cbcSMatt Macy #define	SA_INIT_SHARE_API	0x0001	/* init share specific interface */
32*eda14cbcSMatt Macy #define	SA_INIT_CONTROL_API	0x0002	/* init control specific interface */
33*eda14cbcSMatt Macy 
34*eda14cbcSMatt Macy /*
35*eda14cbcSMatt Macy  * defined error values
36*eda14cbcSMatt Macy  */
37*eda14cbcSMatt Macy 
38*eda14cbcSMatt Macy #define	SA_OK			0
39*eda14cbcSMatt Macy #define	SA_NO_SUCH_PATH		1	/* provided path doesn't exist */
40*eda14cbcSMatt Macy #define	SA_NO_MEMORY		2	/* no memory for data structures */
41*eda14cbcSMatt Macy #define	SA_DUPLICATE_NAME	3	/* object name is already in use */
42*eda14cbcSMatt Macy #define	SA_BAD_PATH		4	/* not a full path */
43*eda14cbcSMatt Macy #define	SA_NO_SUCH_GROUP	5	/* group is not defined */
44*eda14cbcSMatt Macy #define	SA_CONFIG_ERR		6	/* system configuration error */
45*eda14cbcSMatt Macy #define	SA_SYSTEM_ERR		7	/* system error, use errno */
46*eda14cbcSMatt Macy #define	SA_SYNTAX_ERR		8	/* syntax error on command line */
47*eda14cbcSMatt Macy #define	SA_NO_PERMISSION	9	/* no permission for operation */
48*eda14cbcSMatt Macy #define	SA_BUSY			10	/* resource is busy */
49*eda14cbcSMatt Macy #define	SA_NO_SUCH_PROP		11	/* property doesn't exist */
50*eda14cbcSMatt Macy #define	SA_INVALID_NAME		12	/* name of object is invalid */
51*eda14cbcSMatt Macy #define	SA_INVALID_PROTOCOL	13	/* specified protocol not valid */
52*eda14cbcSMatt Macy #define	SA_NOT_ALLOWED		14	/* operation not allowed */
53*eda14cbcSMatt Macy #define	SA_BAD_VALUE		15	/* bad value for property */
54*eda14cbcSMatt Macy #define	SA_INVALID_SECURITY	16	/* invalid security type */
55*eda14cbcSMatt Macy #define	SA_NO_SUCH_SECURITY	17	/* security set not found */
56*eda14cbcSMatt Macy #define	SA_VALUE_CONFLICT	18	/* property value conflict */
57*eda14cbcSMatt Macy #define	SA_NOT_IMPLEMENTED	19	/* plugin interface not implemented */
58*eda14cbcSMatt Macy #define	SA_INVALID_PATH		20	/* path is sub-dir of existing share */
59*eda14cbcSMatt Macy #define	SA_NOT_SUPPORTED	21	/* operation not supported for proto */
60*eda14cbcSMatt Macy #define	SA_PROP_SHARE_ONLY	22	/* property valid on share only */
61*eda14cbcSMatt Macy #define	SA_NOT_SHARED		23	/* path is not shared */
62*eda14cbcSMatt Macy #define	SA_NO_SUCH_RESOURCE	24	/* resource not found */
63*eda14cbcSMatt Macy #define	SA_RESOURCE_REQUIRED	25	/* resource name is required  */
64*eda14cbcSMatt Macy #define	SA_MULTIPLE_ERROR	26	/* multiple protocols reported error */
65*eda14cbcSMatt Macy #define	SA_PATH_IS_SUBDIR	27	/* check_path found path is subdir */
66*eda14cbcSMatt Macy #define	SA_PATH_IS_PARENTDIR	28	/* check_path found path is parent */
67*eda14cbcSMatt Macy #define	SA_NO_SECTION		29	/* protocol requires section info */
68*eda14cbcSMatt Macy #define	SA_NO_SUCH_SECTION	30	/* no section found */
69*eda14cbcSMatt Macy #define	SA_NO_PROPERTIES	31	/* no properties found */
70*eda14cbcSMatt Macy #define	SA_PASSWORD_ENC		32	/* passwords must be encrypted */
71*eda14cbcSMatt Macy #define	SA_SHARE_EXISTS		33	/* path or file is already shared */
72*eda14cbcSMatt Macy 
73*eda14cbcSMatt Macy /* initialization */
74*eda14cbcSMatt Macy extern char *sa_errorstr(int);
75*eda14cbcSMatt Macy 
76*eda14cbcSMatt Macy /* share control */
77*eda14cbcSMatt Macy extern int sa_enable_share(const char *, const char *, const char *,
78*eda14cbcSMatt Macy     char *);
79*eda14cbcSMatt Macy extern int sa_disable_share(const char *, char *);
80*eda14cbcSMatt Macy extern boolean_t sa_is_shared(const char *, char *);
81*eda14cbcSMatt Macy extern void sa_commit_shares(const char *);
82*eda14cbcSMatt Macy 
83*eda14cbcSMatt Macy /* protocol specific interfaces */
84*eda14cbcSMatt Macy extern int sa_validate_shareopts(char *, char *);
85*eda14cbcSMatt Macy 
86*eda14cbcSMatt Macy #endif /* _LIBSPL_LIBSHARE_H */
87