1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * ns_fnutils.h 24*7c478bd9Sstevel@tonic-gate * 25*7c478bd9Sstevel@tonic-gate * Copyright (c) 1995 - 1996, by Sun Microsystems, Inc. 26*7c478bd9Sstevel@tonic-gate * All rights reserved. 27*7c478bd9Sstevel@tonic-gate */ 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate #ifndef _NS_FNUTILS_H 30*7c478bd9Sstevel@tonic-gate #define _NS_FNUTILS_H 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate #include <rpc/rpc.h> 35*7c478bd9Sstevel@tonic-gate #include <xfn/xfn.h> 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 38*7c478bd9Sstevel@tonic-gate extern "C" { 39*7c478bd9Sstevel@tonic-gate #endif 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate /* 42*7c478bd9Sstevel@tonic-gate * Enable compilation for either XFN1 (pre-2.6) or XFN2 environment. 43*7c478bd9Sstevel@tonic-gate */ 44*7c478bd9Sstevel@tonic-gate #ifdef XFN1ENV 45*7c478bd9Sstevel@tonic-gate #define XFN1(x) /* cstyle */, x 46*7c478bd9Sstevel@tonic-gate #define XFN2(x) 47*7c478bd9Sstevel@tonic-gate #define _fn_ctx_handle_from_initial_with_uid(uid, auth, status) \ 48*7c478bd9Sstevel@tonic-gate fn_ctx_handle_from_initial(status) 49*7c478bd9Sstevel@tonic-gate #else 50*7c478bd9Sstevel@tonic-gate #define XFN1(x) 51*7c478bd9Sstevel@tonic-gate #define XFN2(x) x, 52*7c478bd9Sstevel@tonic-gate #endif 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gate /* 55*7c478bd9Sstevel@tonic-gate * FNS file system reference and address types. Each (char *) array is indexed 56*7c478bd9Sstevel@tonic-gate * using the corresponding enumeration. 57*7c478bd9Sstevel@tonic-gate */ 58*7c478bd9Sstevel@tonic-gate extern const char *reftypes[]; 59*7c478bd9Sstevel@tonic-gate 60*7c478bd9Sstevel@tonic-gate typedef enum { 61*7c478bd9Sstevel@tonic-gate REF_FN_FS, 62*7c478bd9Sstevel@tonic-gate NUM_REFTYPES /* Not a ref type, but rather a count of them */ 63*7c478bd9Sstevel@tonic-gate } reftype_t; 64*7c478bd9Sstevel@tonic-gate 65*7c478bd9Sstevel@tonic-gate extern const char *addrtypes[]; 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gate typedef enum { 68*7c478bd9Sstevel@tonic-gate ADDR_MOUNT, 69*7c478bd9Sstevel@tonic-gate ADDR_HOST, 70*7c478bd9Sstevel@tonic-gate ADDR_USER, 71*7c478bd9Sstevel@tonic-gate ADDR_USER_NISPLUS, 72*7c478bd9Sstevel@tonic-gate NUM_ADDRTYPES /* Not an addr type, but rather a count of them */ 73*7c478bd9Sstevel@tonic-gate } addrtype_t; 74*7c478bd9Sstevel@tonic-gate 75*7c478bd9Sstevel@tonic-gate 76*7c478bd9Sstevel@tonic-gate /* 77*7c478bd9Sstevel@tonic-gate * Initialization for FNS. Return 0 on success. 78*7c478bd9Sstevel@tonic-gate */ 79*7c478bd9Sstevel@tonic-gate extern int 80*7c478bd9Sstevel@tonic-gate init_fn(void); 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate /* 83*7c478bd9Sstevel@tonic-gate * Allocate a new composite name. On error, log an error message and 84*7c478bd9Sstevel@tonic-gate * return NULL. 85*7c478bd9Sstevel@tonic-gate */ 86*7c478bd9Sstevel@tonic-gate extern FN_composite_name_t * 87*7c478bd9Sstevel@tonic-gate new_cname(const char *); 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate /* 90*7c478bd9Sstevel@tonic-gate * Return the type of a reference, or NUM_REFTYPES if the type is unknown. 91*7c478bd9Sstevel@tonic-gate */ 92*7c478bd9Sstevel@tonic-gate extern reftype_t 93*7c478bd9Sstevel@tonic-gate reftype(const FN_ref_t *); 94*7c478bd9Sstevel@tonic-gate 95*7c478bd9Sstevel@tonic-gate /* 96*7c478bd9Sstevel@tonic-gate * Return the type of an address, or NUM_ADDRTYPES if the type is unknown. 97*7c478bd9Sstevel@tonic-gate */ 98*7c478bd9Sstevel@tonic-gate extern addrtype_t 99*7c478bd9Sstevel@tonic-gate addrtype(const FN_ref_addr_t *); 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate /* 102*7c478bd9Sstevel@tonic-gate * Determine whether two identifiers match. 103*7c478bd9Sstevel@tonic-gate */ 104*7c478bd9Sstevel@tonic-gate extern bool_t 105*7c478bd9Sstevel@tonic-gate ident_equal(const FN_identifier_t *, const FN_identifier_t *); 106*7c478bd9Sstevel@tonic-gate 107*7c478bd9Sstevel@tonic-gate /* 108*7c478bd9Sstevel@tonic-gate * Determine whether an identifier and a string match. 109*7c478bd9Sstevel@tonic-gate */ 110*7c478bd9Sstevel@tonic-gate extern bool_t 111*7c478bd9Sstevel@tonic-gate ident_str_equal(const FN_identifier_t *, const char *); 112*7c478bd9Sstevel@tonic-gate 113*7c478bd9Sstevel@tonic-gate /* 114*7c478bd9Sstevel@tonic-gate * Syslog an error message and status info (with detail level DETAIL) 115*7c478bd9Sstevel@tonic-gate * if "verbose" is set. 116*7c478bd9Sstevel@tonic-gate */ 117*7c478bd9Sstevel@tonic-gate #define DETAIL 0 118*7c478bd9Sstevel@tonic-gate extern void 119*7c478bd9Sstevel@tonic-gate logstat(const FN_status_t *, const char *msg1, const char *msg2); 120*7c478bd9Sstevel@tonic-gate 121*7c478bd9Sstevel@tonic-gate /* 122*7c478bd9Sstevel@tonic-gate * Determine whether an error is potentially transient. 123*7c478bd9Sstevel@tonic-gate */ 124*7c478bd9Sstevel@tonic-gate extern bool_t 125*7c478bd9Sstevel@tonic-gate transient(const FN_status_t *); 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate /* 128*7c478bd9Sstevel@tonic-gate * Log a memory allocation failure if "verbose" is true. 129*7c478bd9Sstevel@tonic-gate */ 130*7c478bd9Sstevel@tonic-gate extern void 131*7c478bd9Sstevel@tonic-gate log_mem_failure(void); 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate extern FN_ctx_t * 134*7c478bd9Sstevel@tonic-gate _fn_ctx_handle_from_initial_with_uid(uid_t, unsigned int, FN_status_t *); 135*7c478bd9Sstevel@tonic-gate 136*7c478bd9Sstevel@tonic-gate extern FN_string_t *empty_string; 137*7c478bd9Sstevel@tonic-gate extern FN_composite_name_t *empty_cname; 138*7c478bd9Sstevel@tonic-gate extern FN_composite_name_t *slash_cname; /* "/" */ 139*7c478bd9Sstevel@tonic-gate 140*7c478bd9Sstevel@tonic-gate 141*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 142*7c478bd9Sstevel@tonic-gate } 143*7c478bd9Sstevel@tonic-gate #endif 144*7c478bd9Sstevel@tonic-gate 145*7c478bd9Sstevel@tonic-gate #endif /* _NS_FNUTILS_H */ 146