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*7961SNatalie.Li@Sun.COM * Copyright 2008 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 #ifdef __cplusplus 330Sstevel@tonic-gate extern "C" { 340Sstevel@tonic-gate #endif 350Sstevel@tonic-gate 360Sstevel@tonic-gate /* 370Sstevel@tonic-gate * Private definitions for the nfssys system call. 380Sstevel@tonic-gate * Note: <nfs/export.h> and <nfs/nfs.h> must be included before 390Sstevel@tonic-gate * this file. 400Sstevel@tonic-gate */ 410Sstevel@tonic-gate 420Sstevel@tonic-gate /* 430Sstevel@tonic-gate * Flavors of nfssys call. Note that OLD_mumble commands are no longer 440Sstevel@tonic-gate * implemented, but the entries are kept as placeholders for binary 450Sstevel@tonic-gate * compatibility. 460Sstevel@tonic-gate */ 471610Sthurlow enum nfssys_op { OLD_NFS_SVC, OLD_ASYNC_DAEMON, EXPORTFS, OLD_NFS_GETFH, 480Sstevel@tonic-gate OLD_NFS_CNVT, NFS_REVAUTH, OLD_NFS_FH_TO_FID, OLD_LM_SVC, KILL_LOCKMGR, 490Sstevel@tonic-gate LOG_FLUSH, SVCPOOL_CREATE, NFS_SVC, LM_SVC, SVCPOOL_WAIT, SVCPOOL_RUN, 500Sstevel@tonic-gate NFS4_SVC, RDMA_SVC_INIT, NFS4_CLR_STATE, NFS_IDMAP, 512035Scalum NFS4_SVC_REQUEST_QUIESCE, NFS_GETFH, NFS4_DSS_SETPATHS, 52*7961SNatalie.Li@Sun.COM NFS4_DSS_SETPATHS_SIZE, NFS4_EPHEMERAL_MOUNT_TO, MOUNTD_ARGS, 53*7961SNatalie.Li@Sun.COM NFSCMD_ARGS }; 540Sstevel@tonic-gate 550Sstevel@tonic-gate struct nfs_svc_args { 560Sstevel@tonic-gate int fd; /* Connection endpoint */ 570Sstevel@tonic-gate char *netid; /* Identify transport */ 580Sstevel@tonic-gate struct netbuf addrmask; /* Address mask for host */ 590Sstevel@tonic-gate int versmin; /* Min protocol version to offer */ 600Sstevel@tonic-gate int versmax; /* Max protocol version to offer */ 610Sstevel@tonic-gate int delegation; /* NFSv4 delegation on/off? */ 620Sstevel@tonic-gate }; 630Sstevel@tonic-gate 640Sstevel@tonic-gate #ifdef _SYSCALL32 650Sstevel@tonic-gate struct nfs_svc_args32 { 660Sstevel@tonic-gate int32_t fd; /* Connection endpoint */ 670Sstevel@tonic-gate caddr32_t netid; /* Identify transport */ 680Sstevel@tonic-gate struct netbuf32 addrmask; /* Address mask for host */ 690Sstevel@tonic-gate int32_t versmin; /* Min protocol version to offer */ 700Sstevel@tonic-gate int32_t versmax; /* Max protocol version to offer */ 710Sstevel@tonic-gate int32_t delegation; /* NFSv4 delegation on/off? */ 720Sstevel@tonic-gate }; 730Sstevel@tonic-gate #endif 740Sstevel@tonic-gate 750Sstevel@tonic-gate struct exportfs_args { 760Sstevel@tonic-gate char *dname; 770Sstevel@tonic-gate struct exportdata *uex; 780Sstevel@tonic-gate }; 790Sstevel@tonic-gate 800Sstevel@tonic-gate #ifdef _SYSCALL32 810Sstevel@tonic-gate struct exportfs_args32 { 820Sstevel@tonic-gate caddr32_t dname; 830Sstevel@tonic-gate caddr32_t uex; 840Sstevel@tonic-gate }; 850Sstevel@tonic-gate #endif 860Sstevel@tonic-gate 870Sstevel@tonic-gate struct nfs_getfh_args { 880Sstevel@tonic-gate char *fname; 891610Sthurlow int vers; 901610Sthurlow int *lenp; 911610Sthurlow char *fhp; 920Sstevel@tonic-gate }; 930Sstevel@tonic-gate 940Sstevel@tonic-gate #ifdef _SYSCALL32 950Sstevel@tonic-gate struct nfs_getfh_args32 { 960Sstevel@tonic-gate caddr32_t fname; 971610Sthurlow int32_t vers; 981610Sthurlow caddr32_t lenp; 990Sstevel@tonic-gate caddr32_t fhp; 1000Sstevel@tonic-gate }; 1010Sstevel@tonic-gate #endif 1020Sstevel@tonic-gate 1030Sstevel@tonic-gate struct nfs_revauth_args { 1040Sstevel@tonic-gate int authtype; 1050Sstevel@tonic-gate uid_t uid; 1060Sstevel@tonic-gate }; 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate #ifdef _SYSCALL32 1090Sstevel@tonic-gate struct nfs_revauth_args32 { 1100Sstevel@tonic-gate int32_t authtype; 1110Sstevel@tonic-gate uid32_t uid; 1120Sstevel@tonic-gate }; 1130Sstevel@tonic-gate #endif 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate /* 1160Sstevel@tonic-gate * Arguments for establishing lock manager service. If you change 1170Sstevel@tonic-gate * lm_svc_args, you should increment the version number. Try to keep 1180Sstevel@tonic-gate * supporting one or more old versions of the args, so that old lockd's 1190Sstevel@tonic-gate * will work with new kernels. 1200Sstevel@tonic-gate */ 1210Sstevel@tonic-gate 1220Sstevel@tonic-gate enum lm_fmly { LM_INET, LM_INET6, LM_LOOPBACK }; 1230Sstevel@tonic-gate enum lm_proto { LM_TCP, LM_UDP }; 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate struct lm_svc_args { 1260Sstevel@tonic-gate int version; /* keep this first */ 1270Sstevel@tonic-gate int fd; 1280Sstevel@tonic-gate enum lm_fmly n_fmly; /* protocol family */ 1290Sstevel@tonic-gate enum lm_proto n_proto; /* protocol */ 1300Sstevel@tonic-gate dev_t n_rdev; /* device ID */ 1310Sstevel@tonic-gate int debug; /* debugging level */ 1320Sstevel@tonic-gate time_t timout; /* client handle life (asynch RPCs) */ 1330Sstevel@tonic-gate int grace; /* secs in grace period */ 1340Sstevel@tonic-gate time_t retransmittimeout; /* retransmission interval */ 1350Sstevel@tonic-gate }; 1360Sstevel@tonic-gate 1370Sstevel@tonic-gate #ifdef _SYSCALL32 1380Sstevel@tonic-gate struct lm_svc_args32 { 1390Sstevel@tonic-gate int32_t version; /* keep this first */ 1400Sstevel@tonic-gate int32_t fd; 1410Sstevel@tonic-gate enum lm_fmly n_fmly; /* protocol family */ 1420Sstevel@tonic-gate enum lm_proto n_proto; /* protocol */ 1430Sstevel@tonic-gate dev32_t n_rdev; /* device ID */ 1440Sstevel@tonic-gate int32_t debug; /* debugging level */ 1450Sstevel@tonic-gate time32_t timout; /* client handle life (asynch RPCs) */ 1460Sstevel@tonic-gate int32_t grace; /* secs in grace period */ 1470Sstevel@tonic-gate time32_t retransmittimeout; /* retransmission interval */ 1480Sstevel@tonic-gate }; 1490Sstevel@tonic-gate #endif 1500Sstevel@tonic-gate 1510Sstevel@tonic-gate #define LM_SVC_CUR_VERS 30 /* current lm_svc_args vers num */ 1520Sstevel@tonic-gate 1530Sstevel@tonic-gate /* 1540Sstevel@tonic-gate * Arguments for nfslog flush service. 1550Sstevel@tonic-gate */ 1560Sstevel@tonic-gate struct nfsl_flush_args { 1570Sstevel@tonic-gate int version; 1580Sstevel@tonic-gate int directive; 1590Sstevel@tonic-gate char *buff; /* buffer to flush/rename */ 1600Sstevel@tonic-gate int buff_len; /* includes terminating '\0' */ 1610Sstevel@tonic-gate }; 1620Sstevel@tonic-gate 1630Sstevel@tonic-gate #define NFSL_FLUSH_ARGS_VERS 1 /* current nfsl_flush_args vers num */ 1640Sstevel@tonic-gate 1650Sstevel@tonic-gate #ifdef _SYSCALL32 1660Sstevel@tonic-gate struct nfsl_flush_args32 { 1670Sstevel@tonic-gate int32_t version; 1680Sstevel@tonic-gate int32_t directive; 1690Sstevel@tonic-gate caddr32_t buff; /* buffer to flush/rename */ 1700Sstevel@tonic-gate int32_t buff_len; /* includes terminating '\0' */ 1710Sstevel@tonic-gate }; 1720Sstevel@tonic-gate #endif 1730Sstevel@tonic-gate 1740Sstevel@tonic-gate /* 1750Sstevel@tonic-gate * Arguments for initialising RDMA service. 1760Sstevel@tonic-gate */ 1770Sstevel@tonic-gate struct rdma_svc_args { 1780Sstevel@tonic-gate uint32_t poolid; /* Thread Pool ID */ 1790Sstevel@tonic-gate char *netid; /* Network Identifier */ 1800Sstevel@tonic-gate int nfs_versmin; /* Min NFS version to offer */ 1810Sstevel@tonic-gate int nfs_versmax; /* Max NFS version to offer */ 1820Sstevel@tonic-gate int delegation; /* NFSv4 delegation on/off? */ 1830Sstevel@tonic-gate }; 1840Sstevel@tonic-gate 1850Sstevel@tonic-gate #ifdef _SYSCALL32 1860Sstevel@tonic-gate struct rdma_svc_args32 { 1870Sstevel@tonic-gate uint32_t poolid; /* Thread Pool ID */ 1880Sstevel@tonic-gate caddr32_t netid; /* Network Identifier */ 1890Sstevel@tonic-gate int32_t nfs_versmin; /* Min NFS version to offer */ 1900Sstevel@tonic-gate int32_t nfs_versmax; /* Max NFS version to offer */ 1910Sstevel@tonic-gate int32_t delegation; /* NFSv4 delegation on/off? */ 1920Sstevel@tonic-gate }; 1930Sstevel@tonic-gate #endif 1940Sstevel@tonic-gate 1950Sstevel@tonic-gate 1960Sstevel@tonic-gate #define NFS4_CLRST_VERSION 1 1970Sstevel@tonic-gate struct nfs4clrst_args { 1980Sstevel@tonic-gate int vers; 1990Sstevel@tonic-gate int addr_type; 2000Sstevel@tonic-gate void *ap; 2010Sstevel@tonic-gate }; 2020Sstevel@tonic-gate 2030Sstevel@tonic-gate #ifdef _SYSCALL32 2040Sstevel@tonic-gate struct nfs4clrst_args32 { 2050Sstevel@tonic-gate int32_t vers; 2060Sstevel@tonic-gate int32_t addr_type; 2070Sstevel@tonic-gate caddr32_t ap; 2080Sstevel@tonic-gate }; 2090Sstevel@tonic-gate #endif 2100Sstevel@tonic-gate 2110Sstevel@tonic-gate struct nfsidmap_args { 2120Sstevel@tonic-gate uint_t state; /* Flushes caches, set state up 1 or down 0 */ 2130Sstevel@tonic-gate uint_t did; /* Door id to upcall */ 2140Sstevel@tonic-gate }; 2150Sstevel@tonic-gate 2160Sstevel@tonic-gate #define NFSL_ALL 0x01 /* Flush all buffers */ 2170Sstevel@tonic-gate #define NFSL_RENAME 0x02 /* Rename buffer(s) */ 2180Sstevel@tonic-gate #define NFSL_SYNC 0x04 /* Perform operation synchronously? */ 2190Sstevel@tonic-gate 2200Sstevel@tonic-gate #ifdef _KERNEL 2210Sstevel@tonic-gate union nfssysargs { 2220Sstevel@tonic-gate struct exportfs_args *exportfs_args_u; /* exportfs args */ 2230Sstevel@tonic-gate struct nfs_getfh_args *nfs_getfh_args_u; /* nfs_getfh args */ 2240Sstevel@tonic-gate struct nfs_svc_args *nfs_svc_args_u; /* nfs_svc args */ 2250Sstevel@tonic-gate struct rdma_svc_args *rdma_svc_args_u; /* rdma_svc args */ 2260Sstevel@tonic-gate struct nfs_revauth_args *nfs_revauth_args_u; /* nfs_revauth args */ 2270Sstevel@tonic-gate struct lm_svc_args *lm_svc_args_u; /* lm_svc args */ 2280Sstevel@tonic-gate /* kill_lockmgr args: none */ 2290Sstevel@tonic-gate struct nfsl_flush_args *nfsl_flush_args_u; /* nfsl_flush args */ 2300Sstevel@tonic-gate struct svcpool_args *svcpool_args_u; /* svcpool args */ 2310Sstevel@tonic-gate struct nfs4clrst_args *nfs4clrst_u; /* nfs4 clear state */ 2320Sstevel@tonic-gate struct nfsidmap_args *nfsidmap_u; /* nfsidmap */ 2330Sstevel@tonic-gate }; 2340Sstevel@tonic-gate 2350Sstevel@tonic-gate struct nfssysa { 2360Sstevel@tonic-gate enum nfssys_op opcode; /* operation discriminator */ 2370Sstevel@tonic-gate union nfssysargs arg; /* syscall-specific arg pointer */ 2380Sstevel@tonic-gate }; 2390Sstevel@tonic-gate #define nfssysarg_exportfs arg.exportfs_args_u 2400Sstevel@tonic-gate #define nfssysarg_getfh arg.nfs_getfh_args_u 2410Sstevel@tonic-gate #define nfssysarg_svc arg.nfs_svc_args_u 2420Sstevel@tonic-gate #define nfssysarg_rdmastart arg.rdma_svc_args_u 2430Sstevel@tonic-gate #define nfssysarg_revauth arg.nfs_revauth_args_u 2440Sstevel@tonic-gate #define nfssysarg_lmsvc arg.lm_svc_args_u 2450Sstevel@tonic-gate #define nfssysarg_nfslflush arg.nfsl_flush_args_u 2460Sstevel@tonic-gate #define nfssysarg_svcpool arg.svcpool_args_u 2470Sstevel@tonic-gate #define nfssysarg_nfs4clrst arg.nfs4clrst_u 2480Sstevel@tonic-gate #define nfssysarg_nfsidmap arg.nfsidmap_u 2490Sstevel@tonic-gate 2500Sstevel@tonic-gate #ifdef _SYSCALL32 2510Sstevel@tonic-gate union nfssysargs32 { 2520Sstevel@tonic-gate caddr32_t exportfs_args_u; /* exportfs args */ 2530Sstevel@tonic-gate caddr32_t nfs_getfh_args_u; /* nfs_getfh args */ 2540Sstevel@tonic-gate caddr32_t nfs_svc_args_u; /* nfs_svc args */ 2550Sstevel@tonic-gate caddr32_t rdma_svc_args_u; /* rdma_start args */ 2560Sstevel@tonic-gate caddr32_t nfs_revauth_args_u; /* nfs_revauth args */ 2570Sstevel@tonic-gate caddr32_t lm_svc_args_u; /* lm_svc args */ 2580Sstevel@tonic-gate /* kill_lockmgr args: none */ 2590Sstevel@tonic-gate caddr32_t nfsl_flush_args_u; /* nfsl_flush args */ 2600Sstevel@tonic-gate caddr32_t svcpool_args_u; 2610Sstevel@tonic-gate caddr32_t nfs4clrst_u; 2620Sstevel@tonic-gate }; 2630Sstevel@tonic-gate struct nfssysa32 { 2640Sstevel@tonic-gate enum nfssys_op opcode; /* operation discriminator */ 2650Sstevel@tonic-gate union nfssysargs32 arg; /* syscall-specific arg pointer */ 2660Sstevel@tonic-gate }; 2670Sstevel@tonic-gate #endif /* _SYSCALL32 */ 2680Sstevel@tonic-gate 2690Sstevel@tonic-gate #endif /* _KERNEL */ 2700Sstevel@tonic-gate 2710Sstevel@tonic-gate struct nfs4_svc_args { 2720Sstevel@tonic-gate int fd; /* Connection endpoint */ 2730Sstevel@tonic-gate int cmd; 2740Sstevel@tonic-gate char *netid; /* Transport Identifier */ 2750Sstevel@tonic-gate char *addr; /* Universal Address */ 2760Sstevel@tonic-gate char *protofmly; /* Protocol Family */ 2770Sstevel@tonic-gate char *proto; /* Protocol, eg. "tcp" */ 2780Sstevel@tonic-gate struct netbuf addrmask; /* Address mask for host */ 2790Sstevel@tonic-gate }; 2800Sstevel@tonic-gate 2810Sstevel@tonic-gate #ifdef _SYSCALL32 2820Sstevel@tonic-gate struct nfs4_svc_args32 { 2830Sstevel@tonic-gate int32_t fd; 2840Sstevel@tonic-gate int32_t cmd; 2850Sstevel@tonic-gate caddr32_t netid; 2860Sstevel@tonic-gate caddr32_t addr; 2870Sstevel@tonic-gate caddr32_t protofmly; 2880Sstevel@tonic-gate caddr32_t proto; 2890Sstevel@tonic-gate struct netbuf32 addrmask; 2900Sstevel@tonic-gate }; 2910Sstevel@tonic-gate #endif 2920Sstevel@tonic-gate 2930Sstevel@tonic-gate #define NFS4_KRPC_START 1 2940Sstevel@tonic-gate #define NFS4_SETPORT 2 2950Sstevel@tonic-gate #define NFS4_DQUERY 4 2960Sstevel@tonic-gate 2972035Scalum /* DSS: distributed stable storage */ 2982035Scalum #define NFS4_DSS_STATE_LEAF "v4_state" 2992035Scalum #define NFS4_DSS_OLDSTATE_LEAF "v4_oldstate" 3002035Scalum #define NFS4_DSS_DIR_MODE 0755 3012035Scalum #define NFS4_DSS_NVPAIR_NAME "dss_pathname_array" 3022035Scalum /* default storage dir */ 3032035Scalum #define NFS4_DSS_VAR_DIR "/var/nfs" 3042035Scalum 3050Sstevel@tonic-gate #ifdef _KERNEL 3060Sstevel@tonic-gate 3070Sstevel@tonic-gate #include <sys/systm.h> /* for rval_t typedef */ 3080Sstevel@tonic-gate 3090Sstevel@tonic-gate extern int nfssys(enum nfssys_op opcode, void *arg); 3100Sstevel@tonic-gate extern int exportfs(struct exportfs_args *, model_t, cred_t *); 3110Sstevel@tonic-gate extern int nfs_getfh(struct nfs_getfh_args *, model_t, cred_t *); 3120Sstevel@tonic-gate extern int nfs_svc(struct nfs_svc_args *, model_t); 3130Sstevel@tonic-gate extern int lm_svc(struct lm_svc_args *uap); 3140Sstevel@tonic-gate extern int lm_shutdown(void); 3150Sstevel@tonic-gate extern int nfsl_flush(struct nfsl_flush_args *, model_t); 3160Sstevel@tonic-gate extern int nfs4_svc(struct nfs4_svc_args *, model_t); 3170Sstevel@tonic-gate extern int rdma_start(struct rdma_svc_args *); 3180Sstevel@tonic-gate extern void rfs4_clear_client_state(struct nfs4clrst_args *); 3190Sstevel@tonic-gate extern void nfs_idmap_args(struct nfsidmap_args *); 3205302Sth199096 extern void nfs4_ephemeral_set_mount_to(uint_t); 3212140Srmesta extern void mountd_args(uint_t); 3220Sstevel@tonic-gate #endif 3230Sstevel@tonic-gate 3240Sstevel@tonic-gate #ifdef __cplusplus 3250Sstevel@tonic-gate } 3260Sstevel@tonic-gate #endif 3270Sstevel@tonic-gate 3280Sstevel@tonic-gate #endif /* _NFS_NFSSYS_H */ 329