10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 51610Sthurlow * Common Development and Distribution License (the "License"). 61610Sthurlow * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*5302Sth199096 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 270Sstevel@tonic-gate /* All Rights Reserved */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate #ifndef _NFS_NFSSYS_H 300Sstevel@tonic-gate #define _NFS_NFSSYS_H 310Sstevel@tonic-gate 320Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 330Sstevel@tonic-gate 340Sstevel@tonic-gate #ifdef __cplusplus 350Sstevel@tonic-gate extern "C" { 360Sstevel@tonic-gate #endif 370Sstevel@tonic-gate 380Sstevel@tonic-gate /* 390Sstevel@tonic-gate * Private definitions for the nfssys system call. 400Sstevel@tonic-gate * Note: <nfs/export.h> and <nfs/nfs.h> must be included before 410Sstevel@tonic-gate * this file. 420Sstevel@tonic-gate */ 430Sstevel@tonic-gate 440Sstevel@tonic-gate /* 450Sstevel@tonic-gate * Flavors of nfssys call. Note that OLD_mumble commands are no longer 460Sstevel@tonic-gate * implemented, but the entries are kept as placeholders for binary 470Sstevel@tonic-gate * compatibility. 480Sstevel@tonic-gate */ 491610Sthurlow enum nfssys_op { OLD_NFS_SVC, OLD_ASYNC_DAEMON, EXPORTFS, OLD_NFS_GETFH, 500Sstevel@tonic-gate OLD_NFS_CNVT, NFS_REVAUTH, OLD_NFS_FH_TO_FID, OLD_LM_SVC, KILL_LOCKMGR, 510Sstevel@tonic-gate LOG_FLUSH, SVCPOOL_CREATE, NFS_SVC, LM_SVC, SVCPOOL_WAIT, SVCPOOL_RUN, 520Sstevel@tonic-gate NFS4_SVC, RDMA_SVC_INIT, NFS4_CLR_STATE, NFS_IDMAP, 532035Scalum NFS4_SVC_REQUEST_QUIESCE, NFS_GETFH, NFS4_DSS_SETPATHS, 54*5302Sth199096 NFS4_DSS_SETPATHS_SIZE, NFS4_EPHEMERAL_MOUNT_TO, MOUNTD_ARGS }; 550Sstevel@tonic-gate 560Sstevel@tonic-gate struct nfs_svc_args { 570Sstevel@tonic-gate int fd; /* Connection endpoint */ 580Sstevel@tonic-gate char *netid; /* Identify transport */ 590Sstevel@tonic-gate struct netbuf addrmask; /* Address mask for host */ 600Sstevel@tonic-gate int versmin; /* Min protocol version to offer */ 610Sstevel@tonic-gate int versmax; /* Max protocol version to offer */ 620Sstevel@tonic-gate int delegation; /* NFSv4 delegation on/off? */ 630Sstevel@tonic-gate }; 640Sstevel@tonic-gate 650Sstevel@tonic-gate #ifdef _SYSCALL32 660Sstevel@tonic-gate struct nfs_svc_args32 { 670Sstevel@tonic-gate int32_t fd; /* Connection endpoint */ 680Sstevel@tonic-gate caddr32_t netid; /* Identify transport */ 690Sstevel@tonic-gate struct netbuf32 addrmask; /* Address mask for host */ 700Sstevel@tonic-gate int32_t versmin; /* Min protocol version to offer */ 710Sstevel@tonic-gate int32_t versmax; /* Max protocol version to offer */ 720Sstevel@tonic-gate int32_t delegation; /* NFSv4 delegation on/off? */ 730Sstevel@tonic-gate }; 740Sstevel@tonic-gate #endif 750Sstevel@tonic-gate 760Sstevel@tonic-gate struct exportfs_args { 770Sstevel@tonic-gate char *dname; 780Sstevel@tonic-gate struct exportdata *uex; 790Sstevel@tonic-gate }; 800Sstevel@tonic-gate 810Sstevel@tonic-gate #ifdef _SYSCALL32 820Sstevel@tonic-gate struct exportfs_args32 { 830Sstevel@tonic-gate caddr32_t dname; 840Sstevel@tonic-gate caddr32_t uex; 850Sstevel@tonic-gate }; 860Sstevel@tonic-gate #endif 870Sstevel@tonic-gate 880Sstevel@tonic-gate struct nfs_getfh_args { 890Sstevel@tonic-gate char *fname; 901610Sthurlow int vers; 911610Sthurlow int *lenp; 921610Sthurlow char *fhp; 930Sstevel@tonic-gate }; 940Sstevel@tonic-gate 950Sstevel@tonic-gate #ifdef _SYSCALL32 960Sstevel@tonic-gate struct nfs_getfh_args32 { 970Sstevel@tonic-gate caddr32_t fname; 981610Sthurlow int32_t vers; 991610Sthurlow caddr32_t lenp; 1000Sstevel@tonic-gate caddr32_t fhp; 1010Sstevel@tonic-gate }; 1020Sstevel@tonic-gate #endif 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate struct nfs_revauth_args { 1050Sstevel@tonic-gate int authtype; 1060Sstevel@tonic-gate uid_t uid; 1070Sstevel@tonic-gate }; 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate #ifdef _SYSCALL32 1100Sstevel@tonic-gate struct nfs_revauth_args32 { 1110Sstevel@tonic-gate int32_t authtype; 1120Sstevel@tonic-gate uid32_t uid; 1130Sstevel@tonic-gate }; 1140Sstevel@tonic-gate #endif 1150Sstevel@tonic-gate 1160Sstevel@tonic-gate /* 1170Sstevel@tonic-gate * Arguments for establishing lock manager service. If you change 1180Sstevel@tonic-gate * lm_svc_args, you should increment the version number. Try to keep 1190Sstevel@tonic-gate * supporting one or more old versions of the args, so that old lockd's 1200Sstevel@tonic-gate * will work with new kernels. 1210Sstevel@tonic-gate */ 1220Sstevel@tonic-gate 1230Sstevel@tonic-gate enum lm_fmly { LM_INET, LM_INET6, LM_LOOPBACK }; 1240Sstevel@tonic-gate enum lm_proto { LM_TCP, LM_UDP }; 1250Sstevel@tonic-gate 1260Sstevel@tonic-gate struct lm_svc_args { 1270Sstevel@tonic-gate int version; /* keep this first */ 1280Sstevel@tonic-gate int fd; 1290Sstevel@tonic-gate enum lm_fmly n_fmly; /* protocol family */ 1300Sstevel@tonic-gate enum lm_proto n_proto; /* protocol */ 1310Sstevel@tonic-gate dev_t n_rdev; /* device ID */ 1320Sstevel@tonic-gate int debug; /* debugging level */ 1330Sstevel@tonic-gate time_t timout; /* client handle life (asynch RPCs) */ 1340Sstevel@tonic-gate int grace; /* secs in grace period */ 1350Sstevel@tonic-gate time_t retransmittimeout; /* retransmission interval */ 1360Sstevel@tonic-gate }; 1370Sstevel@tonic-gate 1380Sstevel@tonic-gate #ifdef _SYSCALL32 1390Sstevel@tonic-gate struct lm_svc_args32 { 1400Sstevel@tonic-gate int32_t version; /* keep this first */ 1410Sstevel@tonic-gate int32_t fd; 1420Sstevel@tonic-gate enum lm_fmly n_fmly; /* protocol family */ 1430Sstevel@tonic-gate enum lm_proto n_proto; /* protocol */ 1440Sstevel@tonic-gate dev32_t n_rdev; /* device ID */ 1450Sstevel@tonic-gate int32_t debug; /* debugging level */ 1460Sstevel@tonic-gate time32_t timout; /* client handle life (asynch RPCs) */ 1470Sstevel@tonic-gate int32_t grace; /* secs in grace period */ 1480Sstevel@tonic-gate time32_t retransmittimeout; /* retransmission interval */ 1490Sstevel@tonic-gate }; 1500Sstevel@tonic-gate #endif 1510Sstevel@tonic-gate 1520Sstevel@tonic-gate #define LM_SVC_CUR_VERS 30 /* current lm_svc_args vers num */ 1530Sstevel@tonic-gate 1540Sstevel@tonic-gate /* 1550Sstevel@tonic-gate * Arguments for nfslog flush service. 1560Sstevel@tonic-gate */ 1570Sstevel@tonic-gate struct nfsl_flush_args { 1580Sstevel@tonic-gate int version; 1590Sstevel@tonic-gate int directive; 1600Sstevel@tonic-gate char *buff; /* buffer to flush/rename */ 1610Sstevel@tonic-gate int buff_len; /* includes terminating '\0' */ 1620Sstevel@tonic-gate }; 1630Sstevel@tonic-gate 1640Sstevel@tonic-gate #define NFSL_FLUSH_ARGS_VERS 1 /* current nfsl_flush_args vers num */ 1650Sstevel@tonic-gate 1660Sstevel@tonic-gate #ifdef _SYSCALL32 1670Sstevel@tonic-gate struct nfsl_flush_args32 { 1680Sstevel@tonic-gate int32_t version; 1690Sstevel@tonic-gate int32_t directive; 1700Sstevel@tonic-gate caddr32_t buff; /* buffer to flush/rename */ 1710Sstevel@tonic-gate int32_t buff_len; /* includes terminating '\0' */ 1720Sstevel@tonic-gate }; 1730Sstevel@tonic-gate #endif 1740Sstevel@tonic-gate 1750Sstevel@tonic-gate /* 1760Sstevel@tonic-gate * Arguments for initialising RDMA service. 1770Sstevel@tonic-gate */ 1780Sstevel@tonic-gate struct rdma_svc_args { 1790Sstevel@tonic-gate uint32_t poolid; /* Thread Pool ID */ 1800Sstevel@tonic-gate char *netid; /* Network Identifier */ 1810Sstevel@tonic-gate int nfs_versmin; /* Min NFS version to offer */ 1820Sstevel@tonic-gate int nfs_versmax; /* Max NFS version to offer */ 1830Sstevel@tonic-gate int delegation; /* NFSv4 delegation on/off? */ 1840Sstevel@tonic-gate }; 1850Sstevel@tonic-gate 1860Sstevel@tonic-gate #ifdef _SYSCALL32 1870Sstevel@tonic-gate struct rdma_svc_args32 { 1880Sstevel@tonic-gate uint32_t poolid; /* Thread Pool ID */ 1890Sstevel@tonic-gate caddr32_t netid; /* Network Identifier */ 1900Sstevel@tonic-gate int32_t nfs_versmin; /* Min NFS version to offer */ 1910Sstevel@tonic-gate int32_t nfs_versmax; /* Max NFS version to offer */ 1920Sstevel@tonic-gate int32_t delegation; /* NFSv4 delegation on/off? */ 1930Sstevel@tonic-gate }; 1940Sstevel@tonic-gate #endif 1950Sstevel@tonic-gate 1960Sstevel@tonic-gate 1970Sstevel@tonic-gate #define NFS4_CLRST_VERSION 1 1980Sstevel@tonic-gate struct nfs4clrst_args { 1990Sstevel@tonic-gate int vers; 2000Sstevel@tonic-gate int addr_type; 2010Sstevel@tonic-gate void *ap; 2020Sstevel@tonic-gate }; 2030Sstevel@tonic-gate 2040Sstevel@tonic-gate #ifdef _SYSCALL32 2050Sstevel@tonic-gate struct nfs4clrst_args32 { 2060Sstevel@tonic-gate int32_t vers; 2070Sstevel@tonic-gate int32_t addr_type; 2080Sstevel@tonic-gate caddr32_t ap; 2090Sstevel@tonic-gate }; 2100Sstevel@tonic-gate #endif 2110Sstevel@tonic-gate 2120Sstevel@tonic-gate struct nfsidmap_args { 2130Sstevel@tonic-gate uint_t state; /* Flushes caches, set state up 1 or down 0 */ 2140Sstevel@tonic-gate uint_t did; /* Door id to upcall */ 2150Sstevel@tonic-gate }; 2160Sstevel@tonic-gate 2170Sstevel@tonic-gate #define NFSL_ALL 0x01 /* Flush all buffers */ 2180Sstevel@tonic-gate #define NFSL_RENAME 0x02 /* Rename buffer(s) */ 2190Sstevel@tonic-gate #define NFSL_SYNC 0x04 /* Perform operation synchronously? */ 2200Sstevel@tonic-gate 2210Sstevel@tonic-gate #ifdef _KERNEL 2220Sstevel@tonic-gate union nfssysargs { 2230Sstevel@tonic-gate struct exportfs_args *exportfs_args_u; /* exportfs args */ 2240Sstevel@tonic-gate struct nfs_getfh_args *nfs_getfh_args_u; /* nfs_getfh args */ 2250Sstevel@tonic-gate struct nfs_svc_args *nfs_svc_args_u; /* nfs_svc args */ 2260Sstevel@tonic-gate struct rdma_svc_args *rdma_svc_args_u; /* rdma_svc args */ 2270Sstevel@tonic-gate struct nfs_revauth_args *nfs_revauth_args_u; /* nfs_revauth args */ 2280Sstevel@tonic-gate struct lm_svc_args *lm_svc_args_u; /* lm_svc args */ 2290Sstevel@tonic-gate /* kill_lockmgr args: none */ 2300Sstevel@tonic-gate struct nfsl_flush_args *nfsl_flush_args_u; /* nfsl_flush args */ 2310Sstevel@tonic-gate struct svcpool_args *svcpool_args_u; /* svcpool args */ 2320Sstevel@tonic-gate struct nfs4clrst_args *nfs4clrst_u; /* nfs4 clear state */ 2330Sstevel@tonic-gate struct nfsidmap_args *nfsidmap_u; /* nfsidmap */ 2340Sstevel@tonic-gate }; 2350Sstevel@tonic-gate 2360Sstevel@tonic-gate struct nfssysa { 2370Sstevel@tonic-gate enum nfssys_op opcode; /* operation discriminator */ 2380Sstevel@tonic-gate union nfssysargs arg; /* syscall-specific arg pointer */ 2390Sstevel@tonic-gate }; 2400Sstevel@tonic-gate #define nfssysarg_exportfs arg.exportfs_args_u 2410Sstevel@tonic-gate #define nfssysarg_getfh arg.nfs_getfh_args_u 2420Sstevel@tonic-gate #define nfssysarg_svc arg.nfs_svc_args_u 2430Sstevel@tonic-gate #define nfssysarg_rdmastart arg.rdma_svc_args_u 2440Sstevel@tonic-gate #define nfssysarg_revauth arg.nfs_revauth_args_u 2450Sstevel@tonic-gate #define nfssysarg_lmsvc arg.lm_svc_args_u 2460Sstevel@tonic-gate #define nfssysarg_nfslflush arg.nfsl_flush_args_u 2470Sstevel@tonic-gate #define nfssysarg_svcpool arg.svcpool_args_u 2480Sstevel@tonic-gate #define nfssysarg_nfs4clrst arg.nfs4clrst_u 2490Sstevel@tonic-gate #define nfssysarg_nfsidmap arg.nfsidmap_u 2500Sstevel@tonic-gate 2510Sstevel@tonic-gate #ifdef _SYSCALL32 2520Sstevel@tonic-gate union nfssysargs32 { 2530Sstevel@tonic-gate caddr32_t exportfs_args_u; /* exportfs args */ 2540Sstevel@tonic-gate caddr32_t nfs_getfh_args_u; /* nfs_getfh args */ 2550Sstevel@tonic-gate caddr32_t nfs_svc_args_u; /* nfs_svc args */ 2560Sstevel@tonic-gate caddr32_t rdma_svc_args_u; /* rdma_start args */ 2570Sstevel@tonic-gate caddr32_t nfs_revauth_args_u; /* nfs_revauth args */ 2580Sstevel@tonic-gate caddr32_t lm_svc_args_u; /* lm_svc args */ 2590Sstevel@tonic-gate /* kill_lockmgr args: none */ 2600Sstevel@tonic-gate caddr32_t nfsl_flush_args_u; /* nfsl_flush args */ 2610Sstevel@tonic-gate caddr32_t svcpool_args_u; 2620Sstevel@tonic-gate caddr32_t nfs4clrst_u; 2630Sstevel@tonic-gate }; 2640Sstevel@tonic-gate struct nfssysa32 { 2650Sstevel@tonic-gate enum nfssys_op opcode; /* operation discriminator */ 2660Sstevel@tonic-gate union nfssysargs32 arg; /* syscall-specific arg pointer */ 2670Sstevel@tonic-gate }; 2680Sstevel@tonic-gate #endif /* _SYSCALL32 */ 2690Sstevel@tonic-gate 2700Sstevel@tonic-gate #endif /* _KERNEL */ 2710Sstevel@tonic-gate 2720Sstevel@tonic-gate struct nfs4_svc_args { 2730Sstevel@tonic-gate int fd; /* Connection endpoint */ 2740Sstevel@tonic-gate int cmd; 2750Sstevel@tonic-gate char *netid; /* Transport Identifier */ 2760Sstevel@tonic-gate char *addr; /* Universal Address */ 2770Sstevel@tonic-gate char *protofmly; /* Protocol Family */ 2780Sstevel@tonic-gate char *proto; /* Protocol, eg. "tcp" */ 2790Sstevel@tonic-gate struct netbuf addrmask; /* Address mask for host */ 2800Sstevel@tonic-gate }; 2810Sstevel@tonic-gate 2820Sstevel@tonic-gate #ifdef _SYSCALL32 2830Sstevel@tonic-gate struct nfs4_svc_args32 { 2840Sstevel@tonic-gate int32_t fd; 2850Sstevel@tonic-gate int32_t cmd; 2860Sstevel@tonic-gate caddr32_t netid; 2870Sstevel@tonic-gate caddr32_t addr; 2880Sstevel@tonic-gate caddr32_t protofmly; 2890Sstevel@tonic-gate caddr32_t proto; 2900Sstevel@tonic-gate struct netbuf32 addrmask; 2910Sstevel@tonic-gate }; 2920Sstevel@tonic-gate #endif 2930Sstevel@tonic-gate 2940Sstevel@tonic-gate #define NFS4_KRPC_START 1 2950Sstevel@tonic-gate #define NFS4_SETPORT 2 2960Sstevel@tonic-gate #define NFS4_DQUERY 4 2970Sstevel@tonic-gate 2982035Scalum /* DSS: distributed stable storage */ 2992035Scalum #define NFS4_DSS_STATE_LEAF "v4_state" 3002035Scalum #define NFS4_DSS_OLDSTATE_LEAF "v4_oldstate" 3012035Scalum #define NFS4_DSS_DIR_MODE 0755 3022035Scalum #define NFS4_DSS_NVPAIR_NAME "dss_pathname_array" 3032035Scalum /* default storage dir */ 3042035Scalum #define NFS4_DSS_VAR_DIR "/var/nfs" 3052035Scalum 3060Sstevel@tonic-gate #ifdef _KERNEL 3070Sstevel@tonic-gate 3080Sstevel@tonic-gate #include <sys/systm.h> /* for rval_t typedef */ 3090Sstevel@tonic-gate 3100Sstevel@tonic-gate extern int nfssys(enum nfssys_op opcode, void *arg); 3110Sstevel@tonic-gate extern int exportfs(struct exportfs_args *, model_t, cred_t *); 3120Sstevel@tonic-gate extern int nfs_getfh(struct nfs_getfh_args *, model_t, cred_t *); 3130Sstevel@tonic-gate extern int nfs_svc(struct nfs_svc_args *, model_t); 3140Sstevel@tonic-gate extern int lm_svc(struct lm_svc_args *uap); 3150Sstevel@tonic-gate extern int lm_shutdown(void); 3160Sstevel@tonic-gate extern int nfsl_flush(struct nfsl_flush_args *, model_t); 3170Sstevel@tonic-gate extern int nfs4_svc(struct nfs4_svc_args *, model_t); 3180Sstevel@tonic-gate extern int rdma_start(struct rdma_svc_args *); 3190Sstevel@tonic-gate extern void rfs4_clear_client_state(struct nfs4clrst_args *); 3200Sstevel@tonic-gate extern void nfs_idmap_args(struct nfsidmap_args *); 321*5302Sth199096 extern void nfs4_ephemeral_set_mount_to(uint_t); 3222140Srmesta extern void mountd_args(uint_t); 3230Sstevel@tonic-gate #endif 3240Sstevel@tonic-gate 3250Sstevel@tonic-gate #ifdef __cplusplus 3260Sstevel@tonic-gate } 3270Sstevel@tonic-gate #endif 3280Sstevel@tonic-gate 3290Sstevel@tonic-gate #endif /* _NFS_NFSSYS_H */ 330