xref: /titanic_41/usr/src/uts/common/fs/fs_reparse.h (revision e18306b13ed357bd545696aa96b53617b64db4a3)
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  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _FS_REPARSE_H
27 #define	_FS_REPARSE_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #include <sys/types.h>
34 #include <sys/param.h>
35 #ifdef _KERNEL
36 #include <sys/time.h>
37 #include <sys/nvpair.h>
38 #else
39 #include <libnvpair.h>
40 #endif
41 
42 #define	FS_REPARSE_TAG_STR		"@{REPARSE"
43 #define	FS_REPARSE_TAG_END_CHAR		'}'
44 #define	FS_REPARSE_TAG_END_STR		"}"
45 #define	FS_TOKEN_START_STR		"@{"
46 #define	FS_TOKEN_END_STR		"}"
47 
48 #define	REPARSED			"svc:/system/filesystem/reparse:default"
49 #define	MAXREPARSELEN			MAXPATHLEN
50 #define	REPARSED_DOOR			"/var/run/reparsed_door"
51 #define	REPARSED_DOORCALL_MAX_RETRY	4
52 
53 /*
54  * This structure is shared between kernel code and user reparsed daemon.
55  * The 'res_len' must be defined as int, and not size_t, for 32-bit reparsed
56  * binary and 64-bit kernel code to work together.
57  */
58 typedef struct reparsed_door_res {
59 	int	res_status;
60 	int	res_len;
61 	char	res_data[1];
62 } reparsed_door_res_t;
63 
64 extern nvlist_t *reparse_init(void);
65 extern void reparse_free(nvlist_t *nvl);
66 extern int reparse_parse(const char *reparse_data, nvlist_t *nvl);
67 extern int reparse_validate(const char *reparse_data);
68 
69 #ifdef _KERNEL
70 extern int reparse_kderef(const char *svc_type, const char *svc_data,
71 			char *buf, size_t *bufsz);
72 extern int reparse_vnode_parse(vnode_t *vp, nvlist_t *nvl);
73 #else
74 extern int reparse_add(nvlist_t *nvl, const char *svc_type,
75 			const char *svc_data);
76 extern int reparse_remove(nvlist_t *nvl, const char *svc_type);
77 extern int reparse_unparse(nvlist_t *nvl, char **stringp);
78 extern int reparse_create(const char *path, const char *data);
79 extern int reparse_delete(const char *path);
80 extern int reparse_deref(const char *svc_type, const char *svc_data,
81 			char *buf, size_t *bufsz);
82 #endif
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif	/* _FS_REPARSE_H */
89