]> git.proxmox.com Git - mirror_zfs.git/blame - lib/libspl/include/libshare.h
cstyle: Resolve C style issues
[mirror_zfs.git] / lib / libspl / include / libshare.h
CommitLineData
a26baf28
BB
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 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
a26baf28 26#ifndef _LIBSPL_LIBSHARE_H
d1d7e268 27#define _LIBSPL_LIBSHARE_H
a26baf28 28
c5d915f4
BB
29typedef void *sa_handle_t; /* opaque handle to access core functions */
30typedef void *sa_group_t;
31typedef void *sa_share_t;
32
33/* API Initialization */
34#define SA_INIT_SHARE_API 0x0001 /* init share specific interface */
35#define SA_INIT_CONTROL_API 0x0002 /* init control specific interface */
36
46e18b3f
GB
37/*
38 * defined error values
39 */
40
c5d915f4 41#define SA_OK 0
46e18b3f 42#define SA_NO_SUCH_PATH 1 /* provided path doesn't exist */
c5d915f4 43#define SA_NO_MEMORY 2 /* no memory for data structures */
46e18b3f
GB
44#define SA_DUPLICATE_NAME 3 /* object name is already in use */
45#define SA_BAD_PATH 4 /* not a full path */
46#define SA_NO_SUCH_GROUP 5 /* group is not defined */
c5d915f4 47#define SA_CONFIG_ERR 6 /* system configuration error */
46e18b3f
GB
48#define SA_SYSTEM_ERR 7 /* system error, use errno */
49#define SA_SYNTAX_ERR 8 /* syntax error on command line */
50#define SA_NO_PERMISSION 9 /* no permission for operation */
51#define SA_BUSY 10 /* resource is busy */
52#define SA_NO_SUCH_PROP 11 /* property doesn't exist */
53#define SA_INVALID_NAME 12 /* name of object is invalid */
54#define SA_INVALID_PROTOCOL 13 /* specified protocol not valid */
55#define SA_NOT_ALLOWED 14 /* operation not allowed */
56#define SA_BAD_VALUE 15 /* bad value for property */
57#define SA_INVALID_SECURITY 16 /* invalid security type */
58#define SA_NO_SUCH_SECURITY 17 /* security set not found */
59#define SA_VALUE_CONFLICT 18 /* property value conflict */
60#define SA_NOT_IMPLEMENTED 19 /* plugin interface not implemented */
61#define SA_INVALID_PATH 20 /* path is sub-dir of existing share */
62#define SA_NOT_SUPPORTED 21 /* operation not supported for proto */
63#define SA_PROP_SHARE_ONLY 22 /* property valid on share only */
64#define SA_NOT_SHARED 23 /* path is not shared */
65#define SA_NO_SUCH_RESOURCE 24 /* resource not found */
66#define SA_RESOURCE_REQUIRED 25 /* resource name is required */
67#define SA_MULTIPLE_ERROR 26 /* multiple protocols reported error */
68#define SA_PATH_IS_SUBDIR 27 /* check_path found path is subdir */
69#define SA_PATH_IS_PARENTDIR 28 /* check_path found path is parent */
70#define SA_NO_SECTION 29 /* protocol requires section info */
71#define SA_NO_SUCH_SECTION 30 /* no section found */
72#define SA_NO_PROPERTIES 31 /* no properties found */
73#define SA_PASSWORD_ENC 32 /* passwords must be encrypted */
74#define SA_SHARE_EXISTS 33 /* path or file is already shared */
75
76/* initialization */
77extern sa_handle_t sa_init(int);
78extern void sa_fini(sa_handle_t);
79extern char *sa_errorstr(int);
80
81/* share control */
82extern sa_share_t sa_find_share(sa_handle_t, char *);
83extern int sa_enable_share(sa_group_t, char *);
84extern int sa_disable_share(sa_share_t, char *);
85
86/* protocol specific interfaces */
87extern int sa_parse_legacy_options(sa_group_t, char *, char *);
88
89/* ZFS functions */
90extern boolean_t sa_needs_refresh(sa_handle_t handle);
91libzfs_handle_t *sa_get_zfs_handle(sa_handle_t handle);
92extern int sa_zfs_process_share(sa_handle_t handle, sa_group_t group,
93 sa_share_t share, char *mountpoint, char *proto, zprop_source_t source,
94 char *shareopts, char *sourcestr, char *dataset);
c5d915f4 95
a26baf28 96#endif /* _LIBSPL_LIBSHARE_H */