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