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 2006 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 27 /* All Rights Reserved */ 28 29 #ifndef _NFS_NFSSYS_H 30 #define _NFS_NFSSYS_H 31 32 #pragma ident "%Z%%M% %I% %E% SMI" 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 /* 39 * Private definitions for the nfssys system call. 40 * Note: <nfs/export.h> and <nfs/nfs.h> must be included before 41 * this file. 42 */ 43 44 /* 45 * Flavors of nfssys call. Note that OLD_mumble commands are no longer 46 * implemented, but the entries are kept as placeholders for binary 47 * compatibility. 48 */ 49 enum nfssys_op { OLD_NFS_SVC, OLD_ASYNC_DAEMON, EXPORTFS, OLD_NFS_GETFH, 50 OLD_NFS_CNVT, NFS_REVAUTH, OLD_NFS_FH_TO_FID, OLD_LM_SVC, KILL_LOCKMGR, 51 LOG_FLUSH, SVCPOOL_CREATE, NFS_SVC, LM_SVC, SVCPOOL_WAIT, SVCPOOL_RUN, 52 NFS4_SVC, RDMA_SVC_INIT, NFS4_CLR_STATE, NFS_IDMAP, 53 NFS4_SVC_REQUEST_QUIESCE, NFS_GETFH, NFS4_DSS_SETPATHS, 54 NFS4_DSS_SETPATHS_SIZE }; 55 56 struct nfs_svc_args { 57 int fd; /* Connection endpoint */ 58 char *netid; /* Identify transport */ 59 struct netbuf addrmask; /* Address mask for host */ 60 int versmin; /* Min protocol version to offer */ 61 int versmax; /* Max protocol version to offer */ 62 int delegation; /* NFSv4 delegation on/off? */ 63 }; 64 65 #ifdef _SYSCALL32 66 struct nfs_svc_args32 { 67 int32_t fd; /* Connection endpoint */ 68 caddr32_t netid; /* Identify transport */ 69 struct netbuf32 addrmask; /* Address mask for host */ 70 int32_t versmin; /* Min protocol version to offer */ 71 int32_t versmax; /* Max protocol version to offer */ 72 int32_t delegation; /* NFSv4 delegation on/off? */ 73 }; 74 #endif 75 76 struct exportfs_args { 77 char *dname; 78 struct exportdata *uex; 79 }; 80 81 #ifdef _SYSCALL32 82 struct exportfs_args32 { 83 caddr32_t dname; 84 caddr32_t uex; 85 }; 86 #endif 87 88 struct nfs_getfh_args { 89 char *fname; 90 int vers; 91 int *lenp; 92 char *fhp; 93 }; 94 95 #ifdef _SYSCALL32 96 struct nfs_getfh_args32 { 97 caddr32_t fname; 98 int32_t vers; 99 caddr32_t lenp; 100 caddr32_t fhp; 101 }; 102 #endif 103 104 struct nfs_revauth_args { 105 int authtype; 106 uid_t uid; 107 }; 108 109 #ifdef _SYSCALL32 110 struct nfs_revauth_args32 { 111 int32_t authtype; 112 uid32_t uid; 113 }; 114 #endif 115 116 /* 117 * Arguments for establishing lock manager service. If you change 118 * lm_svc_args, you should increment the version number. Try to keep 119 * supporting one or more old versions of the args, so that old lockd's 120 * will work with new kernels. 121 */ 122 123 enum lm_fmly { LM_INET, LM_INET6, LM_LOOPBACK }; 124 enum lm_proto { LM_TCP, LM_UDP }; 125 126 struct lm_svc_args { 127 int version; /* keep this first */ 128 int fd; 129 enum lm_fmly n_fmly; /* protocol family */ 130 enum lm_proto n_proto; /* protocol */ 131 dev_t n_rdev; /* device ID */ 132 int debug; /* debugging level */ 133 time_t timout; /* client handle life (asynch RPCs) */ 134 int grace; /* secs in grace period */ 135 time_t retransmittimeout; /* retransmission interval */ 136 }; 137 138 #ifdef _SYSCALL32 139 struct lm_svc_args32 { 140 int32_t version; /* keep this first */ 141 int32_t fd; 142 enum lm_fmly n_fmly; /* protocol family */ 143 enum lm_proto n_proto; /* protocol */ 144 dev32_t n_rdev; /* device ID */ 145 int32_t debug; /* debugging level */ 146 time32_t timout; /* client handle life (asynch RPCs) */ 147 int32_t grace; /* secs in grace period */ 148 time32_t retransmittimeout; /* retransmission interval */ 149 }; 150 #endif 151 152 #define LM_SVC_CUR_VERS 30 /* current lm_svc_args vers num */ 153 154 /* 155 * Arguments for nfslog flush service. 156 */ 157 struct nfsl_flush_args { 158 int version; 159 int directive; 160 char *buff; /* buffer to flush/rename */ 161 int buff_len; /* includes terminating '\0' */ 162 }; 163 164 #define NFSL_FLUSH_ARGS_VERS 1 /* current nfsl_flush_args vers num */ 165 166 #ifdef _SYSCALL32 167 struct nfsl_flush_args32 { 168 int32_t version; 169 int32_t directive; 170 caddr32_t buff; /* buffer to flush/rename */ 171 int32_t buff_len; /* includes terminating '\0' */ 172 }; 173 #endif 174 175 /* 176 * Arguments for initialising RDMA service. 177 */ 178 struct rdma_svc_args { 179 uint32_t poolid; /* Thread Pool ID */ 180 char *netid; /* Network Identifier */ 181 int nfs_versmin; /* Min NFS version to offer */ 182 int nfs_versmax; /* Max NFS version to offer */ 183 int delegation; /* NFSv4 delegation on/off? */ 184 }; 185 186 #ifdef _SYSCALL32 187 struct rdma_svc_args32 { 188 uint32_t poolid; /* Thread Pool ID */ 189 caddr32_t netid; /* Network Identifier */ 190 int32_t nfs_versmin; /* Min NFS version to offer */ 191 int32_t nfs_versmax; /* Max NFS version to offer */ 192 int32_t delegation; /* NFSv4 delegation on/off? */ 193 }; 194 #endif 195 196 197 #define NFS4_CLRST_VERSION 1 198 struct nfs4clrst_args { 199 int vers; 200 int addr_type; 201 void *ap; 202 }; 203 204 #ifdef _SYSCALL32 205 struct nfs4clrst_args32 { 206 int32_t vers; 207 int32_t addr_type; 208 caddr32_t ap; 209 }; 210 #endif 211 212 struct nfsidmap_args { 213 uint_t state; /* Flushes caches, set state up 1 or down 0 */ 214 uint_t did; /* Door id to upcall */ 215 }; 216 217 #define NFSL_ALL 0x01 /* Flush all buffers */ 218 #define NFSL_RENAME 0x02 /* Rename buffer(s) */ 219 #define NFSL_SYNC 0x04 /* Perform operation synchronously? */ 220 221 #ifdef _KERNEL 222 union nfssysargs { 223 struct exportfs_args *exportfs_args_u; /* exportfs args */ 224 struct nfs_getfh_args *nfs_getfh_args_u; /* nfs_getfh args */ 225 struct nfs_svc_args *nfs_svc_args_u; /* nfs_svc args */ 226 struct rdma_svc_args *rdma_svc_args_u; /* rdma_svc args */ 227 struct nfs_revauth_args *nfs_revauth_args_u; /* nfs_revauth args */ 228 struct lm_svc_args *lm_svc_args_u; /* lm_svc args */ 229 /* kill_lockmgr args: none */ 230 struct nfsl_flush_args *nfsl_flush_args_u; /* nfsl_flush args */ 231 struct svcpool_args *svcpool_args_u; /* svcpool args */ 232 struct nfs4clrst_args *nfs4clrst_u; /* nfs4 clear state */ 233 struct nfsidmap_args *nfsidmap_u; /* nfsidmap */ 234 }; 235 236 struct nfssysa { 237 enum nfssys_op opcode; /* operation discriminator */ 238 union nfssysargs arg; /* syscall-specific arg pointer */ 239 }; 240 #define nfssysarg_exportfs arg.exportfs_args_u 241 #define nfssysarg_getfh arg.nfs_getfh_args_u 242 #define nfssysarg_svc arg.nfs_svc_args_u 243 #define nfssysarg_rdmastart arg.rdma_svc_args_u 244 #define nfssysarg_revauth arg.nfs_revauth_args_u 245 #define nfssysarg_lmsvc arg.lm_svc_args_u 246 #define nfssysarg_nfslflush arg.nfsl_flush_args_u 247 #define nfssysarg_svcpool arg.svcpool_args_u 248 #define nfssysarg_nfs4clrst arg.nfs4clrst_u 249 #define nfssysarg_nfsidmap arg.nfsidmap_u 250 251 #ifdef _SYSCALL32 252 union nfssysargs32 { 253 caddr32_t exportfs_args_u; /* exportfs args */ 254 caddr32_t nfs_getfh_args_u; /* nfs_getfh args */ 255 caddr32_t nfs_svc_args_u; /* nfs_svc args */ 256 caddr32_t rdma_svc_args_u; /* rdma_start args */ 257 caddr32_t nfs_revauth_args_u; /* nfs_revauth args */ 258 caddr32_t lm_svc_args_u; /* lm_svc args */ 259 /* kill_lockmgr args: none */ 260 caddr32_t nfsl_flush_args_u; /* nfsl_flush args */ 261 caddr32_t svcpool_args_u; 262 caddr32_t nfs4clrst_u; 263 }; 264 struct nfssysa32 { 265 enum nfssys_op opcode; /* operation discriminator */ 266 union nfssysargs32 arg; /* syscall-specific arg pointer */ 267 }; 268 #endif /* _SYSCALL32 */ 269 270 #endif /* _KERNEL */ 271 272 struct nfs4_svc_args { 273 int fd; /* Connection endpoint */ 274 int cmd; 275 char *netid; /* Transport Identifier */ 276 char *addr; /* Universal Address */ 277 char *protofmly; /* Protocol Family */ 278 char *proto; /* Protocol, eg. "tcp" */ 279 struct netbuf addrmask; /* Address mask for host */ 280 }; 281 282 #ifdef _SYSCALL32 283 struct nfs4_svc_args32 { 284 int32_t fd; 285 int32_t cmd; 286 caddr32_t netid; 287 caddr32_t addr; 288 caddr32_t protofmly; 289 caddr32_t proto; 290 struct netbuf32 addrmask; 291 }; 292 #endif 293 294 #define NFS4_KRPC_START 1 295 #define NFS4_SETPORT 2 296 #define NFS4_DQUERY 4 297 298 /* DSS: distributed stable storage */ 299 #define NFS4_DSS_STATE_LEAF "v4_state" 300 #define NFS4_DSS_OLDSTATE_LEAF "v4_oldstate" 301 #define NFS4_DSS_DIR_MODE 0755 302 #define NFS4_DSS_NVPAIR_NAME "dss_pathname_array" 303 /* default storage dir */ 304 #define NFS4_DSS_VAR_DIR "/var/nfs" 305 306 #ifdef _KERNEL 307 308 #include <sys/systm.h> /* for rval_t typedef */ 309 310 extern int nfssys(enum nfssys_op opcode, void *arg); 311 extern int exportfs(struct exportfs_args *, model_t, cred_t *); 312 extern int nfs_getfh(struct nfs_getfh_args *, model_t, cred_t *); 313 extern int nfs_svc(struct nfs_svc_args *, model_t); 314 extern int lm_svc(struct lm_svc_args *uap); 315 extern int lm_shutdown(void); 316 extern int nfsl_flush(struct nfsl_flush_args *, model_t); 317 extern int nfs4_svc(struct nfs4_svc_args *, model_t); 318 extern int rdma_start(struct rdma_svc_args *); 319 extern void rfs4_clear_client_state(struct nfs4clrst_args *); 320 extern void nfs_idmap_args(struct nfsidmap_args *); 321 #endif 322 323 #ifdef __cplusplus 324 } 325 #endif 326 327 #endif /* _NFS_NFSSYS_H */ 328