8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / fs.d / autofs / ns_fnutils.h
blob82235d8a6c03db8c464f58bd5709382192a79bf9
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * ns_fnutils.h
24 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
28 #ifndef _NS_FNUTILS_H
29 #define _NS_FNUTILS_H
31 #include <rpc/rpc.h>
32 #include <xfn/xfn.h>
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
39 * Enable compilation for either XFN1 (pre-2.6) or XFN2 environment.
41 #ifdef XFN1ENV
42 #define XFN1(x) /* cstyle */, x
43 #define XFN2(x)
44 #define _fn_ctx_handle_from_initial_with_uid(uid, auth, status) \
45 fn_ctx_handle_from_initial(status)
46 #else
47 #define XFN1(x)
48 #define XFN2(x) x,
49 #endif
52 * FNS file system reference and address types. Each (char *) array is indexed
53 * using the corresponding enumeration.
55 extern const char *reftypes[];
57 typedef enum {
58 REF_FN_FS,
59 NUM_REFTYPES /* Not a ref type, but rather a count of them */
60 } reftype_t;
62 extern const char *addrtypes[];
64 typedef enum {
65 ADDR_MOUNT,
66 ADDR_HOST,
67 ADDR_USER,
68 NUM_ADDRTYPES /* Not an addr type, but rather a count of them */
69 } addrtype_t;
73 * Initialization for FNS. Return 0 on success.
75 extern int
76 init_fn(void);
79 * Allocate a new composite name. On error, log an error message and
80 * return NULL.
82 extern FN_composite_name_t *
83 new_cname(const char *);
86 * Return the type of a reference, or NUM_REFTYPES if the type is unknown.
88 extern reftype_t
89 reftype(const FN_ref_t *);
92 * Return the type of an address, or NUM_ADDRTYPES if the type is unknown.
94 extern addrtype_t
95 addrtype(const FN_ref_addr_t *);
98 * Determine whether two identifiers match.
100 extern bool_t
101 ident_equal(const FN_identifier_t *, const FN_identifier_t *);
104 * Determine whether an identifier and a string match.
106 extern bool_t
107 ident_str_equal(const FN_identifier_t *, const char *);
110 * Syslog an error message and status info (with detail level DETAIL)
111 * if "verbose" is set.
113 #define DETAIL 0
114 extern void
115 logstat(const FN_status_t *, const char *msg1, const char *msg2);
118 * Determine whether an error is potentially transient.
120 extern bool_t
121 transient(const FN_status_t *);
124 * Log a memory allocation failure if "verbose" is true.
126 extern void
127 log_mem_failure(void);
129 extern FN_ctx_t *
130 _fn_ctx_handle_from_initial_with_uid(uid_t, unsigned int, FN_status_t *);
132 extern FN_string_t *empty_string;
133 extern FN_composite_name_t *empty_cname;
134 extern FN_composite_name_t *slash_cname; /* "/" */
137 #ifdef __cplusplus
139 #endif
141 #endif /* _NS_FNUTILS_H */