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