nfs_clnt.h revision 3fd6cc295d1c8c721b4b8abb49bbe0fefe51d034
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ifndef _NFS_NFS_CLNT_H
#define _NFS_NFS_CLNT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#define HOSTNAMESZ 32
/*
* rfscall() flags
*/
/*
* Fake errno passed back from rfscall to indicate transfer size adjustment
*/
#define ENFS_TRYAGAIN 999
/*
* The NFS specific async_reqs structure.
*/
enum iotype {
};
struct nfs_async_read_req {
void (*readahead)(); /* pointer to readahead function */
};
struct nfs_pageio_req {
int (*pageio)(); /* pointer to pageio function */
int flags;
};
struct nfs_readdir_req {
int (*readdir)(); /* pointer to readdir function */
};
struct nfs_commit_req {
void (*commit)(); /* pointer to commit function */
};
struct nfs_inactive_req {
void (*inactive)(); /* pointer to inactive function */
};
struct nfs_async_reqs {
#ifdef DEBUG
#endif
union {
struct nfs_async_read_req a_read_args;
struct nfs_pageio_req a_pageio_args;
struct nfs_readdir_req a_readdir_args;
struct nfs_commit_req a_commit_args;
struct nfs_inactive_req a_inactive_args;
} a_args;
};
/*
* Due to the way the address space callbacks are used to execute a delmap,
* we must keep track of how many times the same thread has called
* VOP_DELMAP()->nfs_delmap()/nfs3_delmap(). This is done by having a list of
* nfs_delmapcall_t's associated with each rnode_t. This list is protected
* by the rnode_t's r_statelock. The individual elements do not need to be
* protected as they will only ever be created, modified and destroyed by
* one thread (the call_id).
* See nfs_delmap()/nfs3_delmap() for further explanation.
*/
typedef struct nfs_delmapcall {
int error; /* error from delmap */
/*
* delmap address space callback args
*/
typedef struct nfs_delmap_args {
#ifdef _KERNEL
extern nfs_delmapcall_t *nfs_init_delmapcall(void);
extern void nfs_free_delmapcall(nfs_delmapcall_t *);
#endif /* _KERNEL */
/*
* The following structures, chhead and chtab, make up the client handle
* cache. chhead represents a quadruple(RPC program, RPC version, Protocol
* Family, and Transport). For example, a chhead entry could represent
* linked list and is referenced from chtable.
*
* chtab represents an allocated client handle bound to a particular
* quadruple. These nodes chain down from a chhead node. chtab
* entries which are on the chain are considered free, so a thread may simply
* unlink the first node without traversing the chain. When the thread is
* completed with its request, it puts the chtab node back on the chain.
*/
typedef struct chhead {
char *ch_protofmly; /* protocol (i.e. NC_INET, NC_LOOPBACK) */
} chhead_t;
typedef struct chtab {
} chtab_t;
/*
* clinfo is a structure which encapsulates data that is needed to
* obtain a client handle from the cache
*/
typedef struct clinfo {
int cl_retrans; /* times to retry request */
} clinfo_t;
/*
* Failover information, passed opaquely through rfscall()
*/
typedef struct failinfo {
} failinfo_t;
/*
* Static server information
*
* These fields are protected by sv_lock:
* sv_flags
*/
typedef struct servinfo {
char *sv_hostname; /* server's hostname */
int sv_hostnamelen; /* server's hostname length */
} servinfo_t;
/*
* The values for sv_flags.
*/
/*
* Switch from RDMA knconf to original mount knconf
*/
/*
* NFS private data per mounted file system
* The mi_lock mutex protects the following fields:
* mi_flags
* mi_printed
* mi_down
* mi_tsize
* mi_stsize
* mi_curread
* mi_curwrite
* mi_timers
* mi_curr_serv
* mi_readers
* mi_klmconfig
*
* The mi_async_lock mutex protects the following fields:
* mi_async_reqs
* mi_async_req_count
* mi_async_tail
* mi_async_curr
* mi_async_clusters
* mi_async_init_clusters
* mi_threads
* mi_manager_thread
*
* Normally the netconfig information for the mount comes from
* mi_curr_serv and mi_klmconfig is NULL. If NLM calls need to use a
* different transport, mi_klmconfig contains the necessary netconfig
* information.
*
* 'mi_zone' is initialized at structure creation time, and never
* changes; it may be read without a lock.
*
* mi_zone_node is linkage into the mi4_globals.mig_list, and is
* protected by mi4_globals.mig_list_lock.
*
* Locking order:
* mi_globals::mig_lock > mi_async_lock > mi_lock
*/
typedef struct mntinfo {
int mi_readers; /* failover - users of mi_curr_serv */
int mi_timeo; /* inital timeout in 10th sec */
int mi_retrans; /* times to retry request */
/*
* Extra fields for congestion control, one per NFS call type,
* plus one global one.
*/
int mi_curread; /* current read size */
int mi_curwrite; /* current write size */
/*
* async I/O management
*/
/*
* Other stuff
*/
char **mi_rfsnames; /* mapping to proc names */
/*
* ACL entries
*/
char **mi_aclnames; /* mapping to proc names */
/*
* Client Side Failover stats
*/
/*
* Kstat statistics
*/
struct kstat *mi_io_kstats;
struct kstat *mi_ro_kstats;
struct knetconfig *mi_klmconfig;
/*
* Zones support.
*/
} mntinfo_t;
/*
* vfs pointer to mount info
*/
/*
* vnode pointer to mount info
*/
/*
* The values for mi_flags.
*/
/*
* Read-only mntinfo statistics
*/
struct mntinfo_kstat {
char mik_proto[KNC_STRSIZE];
int mik_timeo;
int mik_retrans;
struct {
char mik_curserver[SYS_NMLN];
};
/*
* Mark cached attributes as timed out
*
* The caller must not be holding the rnode r_statelock mutex.
*/
#define PURGE_ATTRCACHE(vp) { \
}
#define PURGE_ATTRCACHE_LOCKED(rp) { \
}
/*
* Is the attribute cache valid?
*/
/*
* Flags to indicate whether to purge the DNLC for non-directory vnodes
* in a call to nfs_purge_caches.
*/
#define NFS_NOPURGE_DNLC 0
#define NFS_PURGE_DNLC 1
/*
* If returned error is ESTALE flush all caches.
*/
} \
if (vn_has_cached_data(vp)) \
}
/*
* Is cache valid?
* Swap is always valid, if no attributes (attrtime == 0) or
* if mtime matches cached mtime it is valid
* NOTE: mtime is now a timestruc_t.
* Caller should be holding the rnode r_statelock mutex.
*/
/*
* Macro to detect forced unmount or a zone shutdown.
*/
#define FS_OR_ZONE_GONE(vfsp) \
/*
* Convert NFS tunables to hrtime_t units, seconds to nanoseconds.
*/
/*
* Structure to identify owner of a PC file share reservation.
*/
struct nfs_owner {
int magic; /* magic uniquifying number */
};
/*
* Values for magic.
*/
#define NFS_OWNER_MAGIC 0x1D81E
/*
* Support for extended attributes
*/
/*
* Short hand for checking to see whether the file system was mounted
* interruptible or not.
*/
/*
* Short hand for checking whether failover is enabled or not
*/
/*
* How long will async threads wait for additional work.
*/
#ifdef _KERNEL
struct chtab **);
extern void nfs_mi_zonelist_add(mntinfo_t *);
extern void nfs_free_mi(mntinfo_t *);
extern void nfs_mnt_kstat_init(struct vfs *);
#endif
/*
* Per-zone data for managing client handles. Included here solely for the
* benefit of MDB.
*/
/*
* client side statistics
*/
struct clstat {
#ifdef DEBUG
#endif
};
struct nfs_clnt {
struct chhead *nfscl_chtable;
struct clstat nfscl_stat;
};
#ifdef __cplusplus
}
#endif
#endif /* _NFS_NFS_CLNT_H */