17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 56a8ebdc3Sthurlow * Common Development and Distribution License (the "License"). 66a8ebdc3Sthurlow * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22da6c28aaSamw * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 277c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifndef _NFS_RNODE_H 307c478bd9Sstevel@tonic-gate #define _NFS_RNODE_H 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #include <sys/avl.h> 357c478bd9Sstevel@tonic-gate #include <sys/list.h> 367c478bd9Sstevel@tonic-gate #include <nfs/nfs.h> 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #ifdef __cplusplus 397c478bd9Sstevel@tonic-gate extern "C" { 407c478bd9Sstevel@tonic-gate #endif 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate typedef enum nfs_access_type { 437c478bd9Sstevel@tonic-gate NFS_ACCESS_UNKNOWN, 447c478bd9Sstevel@tonic-gate NFS_ACCESS_ALLOWED, 457c478bd9Sstevel@tonic-gate NFS_ACCESS_DENIED 467c478bd9Sstevel@tonic-gate } nfs_access_type_t; 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate typedef struct acache_hash { 497c478bd9Sstevel@tonic-gate struct acache *next; /* next and prev must be first */ 507c478bd9Sstevel@tonic-gate struct acache *prev; 517c478bd9Sstevel@tonic-gate krwlock_t lock; 527c478bd9Sstevel@tonic-gate } acache_hash_t; 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate typedef struct acache { 557c478bd9Sstevel@tonic-gate struct acache *next; /* next and prev must be first */ 567c478bd9Sstevel@tonic-gate struct acache *prev; 577c478bd9Sstevel@tonic-gate uint32_t known; 587c478bd9Sstevel@tonic-gate uint32_t allowed; 597c478bd9Sstevel@tonic-gate struct rnode *rnode; 607c478bd9Sstevel@tonic-gate cred_t *cred; 617c478bd9Sstevel@tonic-gate struct acache *list; 627c478bd9Sstevel@tonic-gate struct acache_hash *hashq; 637c478bd9Sstevel@tonic-gate } acache_t; 647c478bd9Sstevel@tonic-gate 656a8ebdc3Sthurlow #define NFS_FHANDLE_LEN 72 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate typedef struct nfs_fhandle { 687c478bd9Sstevel@tonic-gate int fh_len; 697c478bd9Sstevel@tonic-gate char fh_buf[NFS_FHANDLE_LEN]; 707c478bd9Sstevel@tonic-gate } nfs_fhandle; 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate typedef struct rddir_cache { 737c478bd9Sstevel@tonic-gate lloff_t _cookie; /* cookie used to find this cache entry */ 747c478bd9Sstevel@tonic-gate lloff_t _ncookie; /* cookie used to find the next cache entry */ 757c478bd9Sstevel@tonic-gate char *entries; /* buffer containing dirent entries */ 767c478bd9Sstevel@tonic-gate int eof; /* EOF reached after this request */ 777c478bd9Sstevel@tonic-gate int entlen; /* size of dirent entries in buf */ 787c478bd9Sstevel@tonic-gate int buflen; /* size of the buffer used to store entries */ 797c478bd9Sstevel@tonic-gate int flags; /* control flags, see below */ 807c478bd9Sstevel@tonic-gate kcondvar_t cv; /* cv for blocking */ 817c478bd9Sstevel@tonic-gate int error; /* error from RPC operation */ 827c478bd9Sstevel@tonic-gate kmutex_t lock; 837c478bd9Sstevel@tonic-gate uint_t count; /* reference count */ 847c478bd9Sstevel@tonic-gate avl_node_t tree; /* AVL tree links */ 857c478bd9Sstevel@tonic-gate } rddir_cache; 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate #define nfs_cookie _cookie._p._l 887c478bd9Sstevel@tonic-gate #define nfs_ncookie _ncookie._p._l 897c478bd9Sstevel@tonic-gate #define nfs3_cookie _cookie._f 907c478bd9Sstevel@tonic-gate #define nfs3_ncookie _ncookie._f 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate #define RDDIR 0x1 /* readdir operation in progress */ 937c478bd9Sstevel@tonic-gate #define RDDIRWAIT 0x2 /* waiting on readdir in progress */ 947c478bd9Sstevel@tonic-gate #define RDDIRREQ 0x4 /* a new readdir is required */ 957c478bd9Sstevel@tonic-gate #define RDDIRCACHED 0x8 /* entry is in the cache */ 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate #define HAVE_RDDIR_CACHE(rp) (avl_numnodes(&(rp)->r_dir) > 0) 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate typedef struct symlink_cache { 1007c478bd9Sstevel@tonic-gate char *contents; /* contents of the symbolic link */ 1017c478bd9Sstevel@tonic-gate int len; /* length of the contents */ 1027c478bd9Sstevel@tonic-gate int size; /* size of the allocated buffer */ 1037c478bd9Sstevel@tonic-gate } symlink_cache; 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate typedef struct commit { 1067c478bd9Sstevel@tonic-gate page_t *c_pages; /* list of pages to commit */ 1077c478bd9Sstevel@tonic-gate offset3 c_commbase; /* base offset to do commit from */ 1087c478bd9Sstevel@tonic-gate count3 c_commlen; /* len to commit */ 1097c478bd9Sstevel@tonic-gate kcondvar_t c_cv; /* condvar for waiting for commit */ 1107c478bd9Sstevel@tonic-gate } commit_t; 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate /* 1137c478bd9Sstevel@tonic-gate * The various values for the commit states. These are stored in 1147c478bd9Sstevel@tonic-gate * the p_fsdata byte in the page struct. 1157c478bd9Sstevel@tonic-gate */ 1167c478bd9Sstevel@tonic-gate #define C_NOCOMMIT 0 /* no commit is required */ 1177c478bd9Sstevel@tonic-gate #define C_COMMIT 1 /* a commit is required so do it now */ 1187c478bd9Sstevel@tonic-gate #define C_DELAYCOMMIT 2 /* a commit is required, but can be delayed */ 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate /* 1217c478bd9Sstevel@tonic-gate * The lock manager holds state making it possible for the client 1227c478bd9Sstevel@tonic-gate * and server to be out of sync. For example, if the response from 1237c478bd9Sstevel@tonic-gate * the server granting a lock request is lost, the server will think 1247c478bd9Sstevel@tonic-gate * the lock is granted and the client will think the lock is lost. 1257c478bd9Sstevel@tonic-gate * To deal with this, a list of processes for which the client is 1267c478bd9Sstevel@tonic-gate * not sure if the server holds a lock is attached to the rnode. 1277c478bd9Sstevel@tonic-gate * When such a process closes the rnode, an unlock request is sent 1287c478bd9Sstevel@tonic-gate * to the server to unlock the entire file. 1297c478bd9Sstevel@tonic-gate * 1307c478bd9Sstevel@tonic-gate * The list is kept as a singularly linked NULL terminated list. 1317c478bd9Sstevel@tonic-gate * Because it is only added to under extreme error conditions, the 1327c478bd9Sstevel@tonic-gate * list shouldn't get very big. DEBUG kernels print a console warning 1337c478bd9Sstevel@tonic-gate * when the number of entries on a list go beyond nfs_lmpl_high_water 1347c478bd9Sstevel@tonic-gate * an arbitrary number defined in nfs_add_locking_id() 1357c478bd9Sstevel@tonic-gate */ 1367c478bd9Sstevel@tonic-gate #define RLMPL_PID 1 1377c478bd9Sstevel@tonic-gate #define RLMPL_OWNER 2 1387c478bd9Sstevel@tonic-gate typedef struct lock_manager_pid_list { 1397c478bd9Sstevel@tonic-gate int lmpl_type; 1407c478bd9Sstevel@tonic-gate pid_t lmpl_pid; 1417c478bd9Sstevel@tonic-gate union { 1427c478bd9Sstevel@tonic-gate pid_t _pid; 1437c478bd9Sstevel@tonic-gate struct { 1447c478bd9Sstevel@tonic-gate int len; 1457c478bd9Sstevel@tonic-gate char *owner; 1467c478bd9Sstevel@tonic-gate } _own; 1477c478bd9Sstevel@tonic-gate } un; 1487c478bd9Sstevel@tonic-gate struct lock_manager_pid_list *lmpl_next; 1497c478bd9Sstevel@tonic-gate } lmpl_t; 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate #define lmpl_opid un._pid 1527c478bd9Sstevel@tonic-gate #define lmpl_own_len un._own.len 1537c478bd9Sstevel@tonic-gate #define lmpl_owner un._own.owner 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate /* 1567c478bd9Sstevel@tonic-gate * A homegrown reader/writer lock implementation. It addresses 1577c478bd9Sstevel@tonic-gate * two requirements not addressed by the system primitives. They 1587c478bd9Sstevel@tonic-gate * are that the `enter" operation is optionally interruptible and 1597c478bd9Sstevel@tonic-gate * that that they can be re`enter'ed by writers without deadlock. 1607c478bd9Sstevel@tonic-gate */ 1617c478bd9Sstevel@tonic-gate typedef struct nfs_rwlock { 1627c478bd9Sstevel@tonic-gate int count; 1637c478bd9Sstevel@tonic-gate int waiters; 1647c478bd9Sstevel@tonic-gate kthread_t *owner; 1657c478bd9Sstevel@tonic-gate kmutex_t lock; 1667c478bd9Sstevel@tonic-gate kcondvar_t cv; 1677c478bd9Sstevel@tonic-gate } nfs_rwlock_t; 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate /* 1707c478bd9Sstevel@tonic-gate * The format of the hash bucket used to lookup rnodes from a file handle. 1717c478bd9Sstevel@tonic-gate */ 1727c478bd9Sstevel@tonic-gate typedef struct rhashq { 1737c478bd9Sstevel@tonic-gate struct rnode *r_hashf; 1747c478bd9Sstevel@tonic-gate struct rnode *r_hashb; 1757c478bd9Sstevel@tonic-gate krwlock_t r_lock; 1767c478bd9Sstevel@tonic-gate } rhashq_t; 1777c478bd9Sstevel@tonic-gate 1787c478bd9Sstevel@tonic-gate /* 1797c478bd9Sstevel@tonic-gate * Remote file information structure. 1807c478bd9Sstevel@tonic-gate * 1817c478bd9Sstevel@tonic-gate * The rnode is the "inode" for remote files. It contains all the 1827c478bd9Sstevel@tonic-gate * information necessary to handle remote file on the client side. 1837c478bd9Sstevel@tonic-gate * 1847c478bd9Sstevel@tonic-gate * Note on file sizes: we keep two file sizes in the rnode: the size 1857c478bd9Sstevel@tonic-gate * according to the client (r_size) and the size according to the server 1867c478bd9Sstevel@tonic-gate * (r_attr.va_size). They can differ because we modify r_size during a 1877c478bd9Sstevel@tonic-gate * write system call (nfs_rdwr), before the write request goes over the 1887c478bd9Sstevel@tonic-gate * wire (before the file is actually modified on the server). If an OTW 1897c478bd9Sstevel@tonic-gate * request occurs before the cached data is written to the server the file 1907c478bd9Sstevel@tonic-gate * size returned from the server (r_attr.va_size) may not match r_size. 1917c478bd9Sstevel@tonic-gate * r_size is the one we use, in general. r_attr.va_size is only used to 1927c478bd9Sstevel@tonic-gate * determine whether or not our cached data is valid. 1937c478bd9Sstevel@tonic-gate * 1947c478bd9Sstevel@tonic-gate * Each rnode has 3 locks associated with it (not including the rnode 1957c478bd9Sstevel@tonic-gate * hash table and free list locks): 1967c478bd9Sstevel@tonic-gate * 1977c478bd9Sstevel@tonic-gate * r_rwlock: Serializes nfs_write and nfs_setattr requests 1987c478bd9Sstevel@tonic-gate * and allows nfs_read requests to proceed in parallel. 1997c478bd9Sstevel@tonic-gate * Serializes reads/updates to directories. 2007c478bd9Sstevel@tonic-gate * 2017c478bd9Sstevel@tonic-gate * r_lkserlock: Serializes lock requests with map, write, and 2027c478bd9Sstevel@tonic-gate * readahead operations. 2037c478bd9Sstevel@tonic-gate * 2047c478bd9Sstevel@tonic-gate * r_statelock: Protects all fields in the rnode except for 2057c478bd9Sstevel@tonic-gate * those listed below. This lock is intented 2067c478bd9Sstevel@tonic-gate * to be held for relatively short periods of 2077c478bd9Sstevel@tonic-gate * time (not accross entire putpage operations, 2087c478bd9Sstevel@tonic-gate * for example). 2097c478bd9Sstevel@tonic-gate * 2107c478bd9Sstevel@tonic-gate * The following members are protected by the mutex rpfreelist_lock: 2117c478bd9Sstevel@tonic-gate * r_freef 2127c478bd9Sstevel@tonic-gate * r_freeb 2137c478bd9Sstevel@tonic-gate * 2147c478bd9Sstevel@tonic-gate * The following members are protected by the hash bucket rwlock: 2157c478bd9Sstevel@tonic-gate * r_hashf 2167c478bd9Sstevel@tonic-gate * r_hashb 2177c478bd9Sstevel@tonic-gate * 2187c478bd9Sstevel@tonic-gate * Note: r_modaddr is only accessed when the r_statelock mutex is held. 2197c478bd9Sstevel@tonic-gate * Its value is also controlled via r_rwlock. It is assumed that 2207c478bd9Sstevel@tonic-gate * there will be only 1 writer active at a time, so it safe to 2217c478bd9Sstevel@tonic-gate * set r_modaddr and release r_statelock as long as the r_rwlock 2227c478bd9Sstevel@tonic-gate * writer lock is held. 2237c478bd9Sstevel@tonic-gate * 2247c478bd9Sstevel@tonic-gate * 64-bit offsets: the code formerly assumed that atomic reads of 2257c478bd9Sstevel@tonic-gate * r_size were safe and reliable; on 32-bit architectures, this is 2267c478bd9Sstevel@tonic-gate * not true since an intervening bus cycle from another processor 2277c478bd9Sstevel@tonic-gate * could update half of the size field. The r_statelock must now 2287c478bd9Sstevel@tonic-gate * be held whenever any kind of access of r_size is made. 2297c478bd9Sstevel@tonic-gate * 2307c478bd9Sstevel@tonic-gate * Lock ordering: 2317c478bd9Sstevel@tonic-gate * r_rwlock > r_lkserlock > r_statelock 2327c478bd9Sstevel@tonic-gate */ 2337c478bd9Sstevel@tonic-gate struct exportinfo; /* defined in nfs/export.h */ 2347c478bd9Sstevel@tonic-gate struct servinfo; /* defined in nfs/nfs_clnt.h */ 2357c478bd9Sstevel@tonic-gate struct failinfo; /* defined in nfs/nfs_clnt.h */ 2367c478bd9Sstevel@tonic-gate struct mntinfo; /* defined in nfs/nfs_clnt.h */ 2377c478bd9Sstevel@tonic-gate 2387c478bd9Sstevel@tonic-gate #ifdef _KERNEL 2397c478bd9Sstevel@tonic-gate 2407c478bd9Sstevel@tonic-gate typedef struct rnode { 2417c478bd9Sstevel@tonic-gate /* the hash fields must be first to match the rhashq_t */ 2427c478bd9Sstevel@tonic-gate struct rnode *r_hashf; /* hash queue forward pointer */ 2437c478bd9Sstevel@tonic-gate struct rnode *r_hashb; /* hash queue back pointer */ 2447c478bd9Sstevel@tonic-gate struct rnode *r_freef; /* free list forward pointer */ 2457c478bd9Sstevel@tonic-gate struct rnode *r_freeb; /* free list back pointer */ 2467c478bd9Sstevel@tonic-gate rhashq_t *r_hashq; /* pointer to the hash bucket */ 2477c478bd9Sstevel@tonic-gate vnode_t *r_vnode; /* vnode for remote file */ 2487c478bd9Sstevel@tonic-gate nfs_rwlock_t r_rwlock; /* serializes write/setattr requests */ 2497c478bd9Sstevel@tonic-gate nfs_rwlock_t r_lkserlock; /* serialize lock with other ops */ 2507c478bd9Sstevel@tonic-gate kmutex_t r_statelock; /* protects (most of) rnode contents */ 2517c478bd9Sstevel@tonic-gate nfs_fhandle r_fh; /* file handle */ 2527c478bd9Sstevel@tonic-gate struct servinfo *r_server; /* current server */ 2537c478bd9Sstevel@tonic-gate char *r_path; /* path to this rnode */ 2547c478bd9Sstevel@tonic-gate u_offset_t r_nextr; /* next byte read offset (read-ahead) */ 2557c478bd9Sstevel@tonic-gate cred_t *r_cred; /* current credentials */ 2567c478bd9Sstevel@tonic-gate cred_t *r_unlcred; /* unlinked credentials */ 2577c478bd9Sstevel@tonic-gate char *r_unlname; /* unlinked file name */ 2587c478bd9Sstevel@tonic-gate vnode_t *r_unldvp; /* parent dir of unlinked file */ 2597c478bd9Sstevel@tonic-gate len_t r_size; /* client's view of file size */ 2607c478bd9Sstevel@tonic-gate struct vattr r_attr; /* cached vnode attributes */ 2617c478bd9Sstevel@tonic-gate hrtime_t r_attrtime; /* time attributes become invalid */ 2627c478bd9Sstevel@tonic-gate hrtime_t r_mtime; /* client time file last modified */ 2637c478bd9Sstevel@tonic-gate long r_mapcnt; /* count of mmapped pages */ 2647c478bd9Sstevel@tonic-gate uint_t r_count; /* # of refs not reflect in v_count */ 2657c478bd9Sstevel@tonic-gate uint_t r_awcount; /* # of outstanding async write */ 2667c478bd9Sstevel@tonic-gate uint_t r_gcount; /* getattrs waiting to flush pages */ 2677c478bd9Sstevel@tonic-gate ushort_t r_flags; /* flags, see below */ 2687c478bd9Sstevel@tonic-gate short r_error; /* async write error */ 2697c478bd9Sstevel@tonic-gate kcondvar_t r_cv; /* condvar for blocked threads */ 2707c478bd9Sstevel@tonic-gate int (*r_putapage) /* address of putapage routine */ 2717c478bd9Sstevel@tonic-gate (vnode_t *, page_t *, u_offset_t *, size_t *, int, cred_t *); 2727c478bd9Sstevel@tonic-gate avl_tree_t r_dir; /* cache of readdir responses */ 2737c478bd9Sstevel@tonic-gate rddir_cache *r_direof; /* pointer to the EOF entry */ 2747c478bd9Sstevel@tonic-gate symlink_cache r_symlink; /* cached readlink response */ 2757c478bd9Sstevel@tonic-gate writeverf3 r_verf; /* version 3 write verifier */ 2767c478bd9Sstevel@tonic-gate u_offset_t r_modaddr; /* address for page in writerp */ 2777c478bd9Sstevel@tonic-gate commit_t r_commit; /* commit information */ 2787c478bd9Sstevel@tonic-gate u_offset_t r_truncaddr; /* base for truncate operation */ 2797c478bd9Sstevel@tonic-gate vsecattr_t *r_secattr; /* cached security attributes (acls) */ 2807c478bd9Sstevel@tonic-gate cookieverf3 r_cookieverf; /* version 3 readdir cookie verifier */ 2817c478bd9Sstevel@tonic-gate lmpl_t *r_lmpl; /* pids that may be holding locks */ 2827c478bd9Sstevel@tonic-gate nfs3_pathconf_info *r_pathconf; /* cached pathconf information */ 2837c478bd9Sstevel@tonic-gate acache_t *r_acache; /* list of access cache entries */ 2847c478bd9Sstevel@tonic-gate kthread_t *r_serial; /* id of purging thread */ 2857c478bd9Sstevel@tonic-gate list_t r_indelmap; /* list of delmap callers */ 2867c478bd9Sstevel@tonic-gate } rnode_t; 2877c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 2887c478bd9Sstevel@tonic-gate 2897c478bd9Sstevel@tonic-gate /* 2907c478bd9Sstevel@tonic-gate * Flags 2917c478bd9Sstevel@tonic-gate */ 2927c478bd9Sstevel@tonic-gate #define RREADDIRPLUS 0x1 /* issue a READDIRPLUS instead of READDIR */ 2937c478bd9Sstevel@tonic-gate #define RDIRTY 0x2 /* dirty pages from write operation */ 2947c478bd9Sstevel@tonic-gate #define RSTALE 0x4 /* file handle is stale */ 2957c478bd9Sstevel@tonic-gate #define RMODINPROGRESS 0x8 /* page modification happening */ 2967c478bd9Sstevel@tonic-gate #define RTRUNCATE 0x10 /* truncating, don't commit */ 2977c478bd9Sstevel@tonic-gate #define RHAVEVERF 0x20 /* have a write verifier to compare against */ 2987c478bd9Sstevel@tonic-gate #define RCOMMIT 0x40 /* commit in progress */ 2997c478bd9Sstevel@tonic-gate #define RCOMMITWAIT 0x80 /* someone is waiting to do a commit */ 3007c478bd9Sstevel@tonic-gate #define RHASHED 0x100 /* rnode is in hash queues */ 3017c478bd9Sstevel@tonic-gate #define ROUTOFSPACE 0x200 /* an out of space error has happened */ 3027c478bd9Sstevel@tonic-gate #define RDIRECTIO 0x400 /* bypass the buffer cache */ 3037c478bd9Sstevel@tonic-gate #define RLOOKUP 0x800 /* a lookup has been performed */ 3047c478bd9Sstevel@tonic-gate #define RWRITEATTR 0x1000 /* attributes came from WRITE */ 3057c478bd9Sstevel@tonic-gate #define RINDNLCPURGE 0x2000 /* in the process of purging DNLC references */ 3067c478bd9Sstevel@tonic-gate #define RDELMAPLIST 0x4000 /* delmap callers tracking for as callback */ 307*5e4df02aSvv149972 #define RINCACHEPURGE 0x8000 /* purging caches due to file size change */ 3087c478bd9Sstevel@tonic-gate 3097c478bd9Sstevel@tonic-gate /* 3107c478bd9Sstevel@tonic-gate * Convert between vnode and rnode 3117c478bd9Sstevel@tonic-gate */ 3127c478bd9Sstevel@tonic-gate #define RTOV(rp) ((rp)->r_vnode) 3137c478bd9Sstevel@tonic-gate #define VTOR(vp) ((rnode_t *)((vp)->v_data)) 3147c478bd9Sstevel@tonic-gate 3157c478bd9Sstevel@tonic-gate #define VTOFH(vp) (RTOFH(VTOR(vp))) 3167c478bd9Sstevel@tonic-gate #define RTOFH(rp) ((fhandle_t *)(&(rp)->r_fh.fh_buf)) 3177c478bd9Sstevel@tonic-gate #define VTOFH3(vp) (RTOFH3(VTOR(vp))) 3187c478bd9Sstevel@tonic-gate #define RTOFH3(rp) ((nfs_fh3 *)(&(rp)->r_fh)) 3197c478bd9Sstevel@tonic-gate 3207c478bd9Sstevel@tonic-gate #ifdef _KERNEL 3217c478bd9Sstevel@tonic-gate extern int nfs_async_readahead(vnode_t *, u_offset_t, caddr_t, 3227c478bd9Sstevel@tonic-gate struct seg *, cred_t *, 3237c478bd9Sstevel@tonic-gate void (*)(vnode_t *, u_offset_t, 3247c478bd9Sstevel@tonic-gate caddr_t, struct seg *, cred_t *)); 3257c478bd9Sstevel@tonic-gate extern int nfs_async_putapage(vnode_t *, page_t *, u_offset_t, size_t, 3267c478bd9Sstevel@tonic-gate int, cred_t *, int (*)(vnode_t *, page_t *, 3277c478bd9Sstevel@tonic-gate u_offset_t, size_t, int, cred_t *)); 3287c478bd9Sstevel@tonic-gate extern int nfs_async_pageio(vnode_t *, page_t *, u_offset_t, size_t, 3297c478bd9Sstevel@tonic-gate int, cred_t *, int (*)(vnode_t *, page_t *, 3307c478bd9Sstevel@tonic-gate u_offset_t, size_t, int, cred_t *)); 3317c478bd9Sstevel@tonic-gate extern void nfs_async_readdir(vnode_t *, rddir_cache *, 3327c478bd9Sstevel@tonic-gate cred_t *, int (*)(vnode_t *, 3337c478bd9Sstevel@tonic-gate rddir_cache *, cred_t *)); 3347c478bd9Sstevel@tonic-gate extern void nfs_async_commit(vnode_t *, page_t *, offset3, count3, 3357c478bd9Sstevel@tonic-gate cred_t *, void (*)(vnode_t *, page_t *, 3367c478bd9Sstevel@tonic-gate offset3, count3, cred_t *)); 3377c478bd9Sstevel@tonic-gate extern void nfs_async_inactive(vnode_t *, cred_t *, void (*)(vnode_t *, 338da6c28aaSamw cred_t *, caller_context_t *)); 3397c478bd9Sstevel@tonic-gate extern int writerp(rnode_t *, caddr_t, int, struct uio *, int); 3407c478bd9Sstevel@tonic-gate extern int nfs_putpages(vnode_t *, u_offset_t, size_t, int, cred_t *); 3417c478bd9Sstevel@tonic-gate extern void nfs_invalidate_pages(vnode_t *, u_offset_t, cred_t *); 3427c478bd9Sstevel@tonic-gate extern int rfs2call(struct mntinfo *, rpcproc_t, xdrproc_t, caddr_t, 3437c478bd9Sstevel@tonic-gate xdrproc_t, caddr_t, cred_t *, int *, enum nfsstat *, 3447c478bd9Sstevel@tonic-gate int, struct failinfo *); 3457c478bd9Sstevel@tonic-gate extern int rfs3call(struct mntinfo *, rpcproc_t, xdrproc_t, caddr_t, 3467c478bd9Sstevel@tonic-gate xdrproc_t, caddr_t, cred_t *, int *, nfsstat3 *, 3477c478bd9Sstevel@tonic-gate int, struct failinfo *); 3487c478bd9Sstevel@tonic-gate extern void nfs_setswaplike(vnode_t *, vattr_t *); 3497c478bd9Sstevel@tonic-gate extern vnode_t *makenfsnode(fhandle_t *, struct nfsfattr *, struct vfs *, 3507c478bd9Sstevel@tonic-gate hrtime_t, cred_t *, char *, char *); 3517c478bd9Sstevel@tonic-gate extern vnode_t *makenfs3node_va(nfs_fh3 *, vattr_t *, struct vfs *, hrtime_t, 3527c478bd9Sstevel@tonic-gate cred_t *, char *, char *); 3537c478bd9Sstevel@tonic-gate extern vnode_t *makenfs3node(nfs_fh3 *, fattr3 *, struct vfs *, hrtime_t, 3547c478bd9Sstevel@tonic-gate cred_t *, char *, char *); 3557c478bd9Sstevel@tonic-gate extern void rp_addfree(rnode_t *, cred_t *); 3567c478bd9Sstevel@tonic-gate extern void rp_rmhash(rnode_t *); 3577c478bd9Sstevel@tonic-gate extern int check_rtable(struct vfs *); 3587c478bd9Sstevel@tonic-gate extern void destroy_rtable(struct vfs *, cred_t *); 3597c478bd9Sstevel@tonic-gate extern void rflush(struct vfs *, cred_t *); 3607c478bd9Sstevel@tonic-gate extern nfs_access_type_t nfs_access_check(rnode_t *, uint32_t, cred_t *); 3617c478bd9Sstevel@tonic-gate extern void nfs_access_cache(rnode_t *rp, uint32_t, uint32_t, cred_t *); 3627c478bd9Sstevel@tonic-gate extern int nfs_access_purge_rp(rnode_t *); 3637c478bd9Sstevel@tonic-gate extern int nfs_putapage(vnode_t *, page_t *, u_offset_t *, size_t *, 3647c478bd9Sstevel@tonic-gate int, cred_t *); 3657c478bd9Sstevel@tonic-gate extern int nfs3_putapage(vnode_t *, page_t *, u_offset_t *, size_t *, 3667c478bd9Sstevel@tonic-gate int, cred_t *); 3677c478bd9Sstevel@tonic-gate extern void nfs_printfhandle(nfs_fhandle *); 3687c478bd9Sstevel@tonic-gate extern void nfs_write_error(vnode_t *, int, cred_t *); 3697c478bd9Sstevel@tonic-gate extern rddir_cache *rddir_cache_alloc(int); 3707c478bd9Sstevel@tonic-gate extern void rddir_cache_hold(rddir_cache *); 3717c478bd9Sstevel@tonic-gate extern void rddir_cache_rele(rddir_cache *); 3727c478bd9Sstevel@tonic-gate #ifdef DEBUG 3737c478bd9Sstevel@tonic-gate extern char *rddir_cache_buf_alloc(size_t, int); 3747c478bd9Sstevel@tonic-gate extern void rddir_cache_buf_free(void *, size_t); 3757c478bd9Sstevel@tonic-gate #endif 3767c478bd9Sstevel@tonic-gate extern int nfs_rw_enter_sig(nfs_rwlock_t *, krw_t, int); 3777c478bd9Sstevel@tonic-gate extern int nfs_rw_tryenter(nfs_rwlock_t *, krw_t); 3787c478bd9Sstevel@tonic-gate extern void nfs_rw_exit(nfs_rwlock_t *); 3797c478bd9Sstevel@tonic-gate extern int nfs_rw_lock_held(nfs_rwlock_t *, krw_t); 3807c478bd9Sstevel@tonic-gate extern void nfs_rw_init(nfs_rwlock_t *, char *, krw_type_t, void *); 3817c478bd9Sstevel@tonic-gate extern void nfs_rw_destroy(nfs_rwlock_t *); 3827c478bd9Sstevel@tonic-gate extern int nfs_directio(vnode_t *, int, cred_t *); 3837c478bd9Sstevel@tonic-gate extern int nfs3_rddir_compar(const void *, const void *); 3847c478bd9Sstevel@tonic-gate extern int nfs_rddir_compar(const void *, const void *); 385108322fbScarlsonj extern struct zone *nfs_zone(void); 386108322fbScarlsonj extern zoneid_t nfs_zoneid(void); 3877c478bd9Sstevel@tonic-gate 3887c478bd9Sstevel@tonic-gate #endif 3897c478bd9Sstevel@tonic-gate 3907c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3917c478bd9Sstevel@tonic-gate } 3927c478bd9Sstevel@tonic-gate #endif 3937c478bd9Sstevel@tonic-gate 3947c478bd9Sstevel@tonic-gate #endif /* _NFS_RNODE_H */ 395