diff options
Diffstat (limited to 'nfs/nfs.h')
-rw-r--r-- | nfs/nfs.h | 85 |
1 files changed, 52 insertions, 33 deletions
@@ -1,5 +1,5 @@ /* Data structures and global variables for NFS client - Copyright (C) 1994, 1995, 1996 Free Software Foundation + Copyright (C) 1994,95,96,97,99,2001 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -15,20 +15,30 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* Needed for the rpcsvc include files to work. */ -typedef int bool_t; /* Ick. */ +#ifndef NFS_NFS_H +#define NFS_NFS_H #include <sys/stat.h> #include <sys/types.h> -#include <rpcsvc/nfs_prot.h> +#include <stdint.h> +#include <sys/mman.h> +#include "nfs-spec.h" #include <hurd/netfs.h> -/* One of these exists for private data needed by the client for each +/* A file handle */ +struct fhandle +{ + size_t size; + + /* Leave enough room for the largest possible fhandle. */ + char data[NFS3_FHSIZE]; +}; + +/* There exists one of there for the private data needed by each client node. */ -struct netnode +struct netnode { - char handle[NFS_FHSIZE]; + struct fhandle handle; time_t stat_updated; struct node *hnext, **hprevp; @@ -49,9 +59,9 @@ struct netnode char *name; dev_t indexes; } transarg; - + #ifdef notyet - /* This indicates that the length of the file must be at + /* This indicates that the length of the file must be at least this big because we've written this much locally, even if the server thinks we haven't gone this far. */ off_t extend_len; @@ -60,27 +70,19 @@ struct netnode struct user_pager_info *fileinfo; /* If this node has been renamed by "deletion" then - this is the directory and name in that directory which - is holding the node */ + this is the directory and the name in that directory + which is holding the node */ struct node *dead_dir; char *dead_name; }; -/* Credential structure to identify a particular user. */ -struct netcred -{ - uid_t *uids, *gids; - int nuids, ngids; - int refcnt; -}; - /* Socket file descriptor for talking to RPC servers. */ int main_udp_socket; /* Our hostname */ char *hostname; -/* The current time */ +/* The current time */ volatile struct mapped_time_value *mapped_time; /* Some tunable parameters */ @@ -91,6 +93,12 @@ extern int stat_timeout; /* How long to keep around file contents caches */ extern int cache_timeout; +/* How long to keep around positive dir cache entries */ +extern int name_cache_timeout; + +/* How long to keep around negative dir cache entries */ +extern int name_cache_neg_timeout; + /* How long to wait for replies before re-sending RPC's. */ extern int initial_transmit_timeout; extern int max_transmit_timeout; @@ -120,7 +128,7 @@ extern int mount_program; /* RPC program version for the mount agent */ extern int mount_version; -/* If this is nonzero, it's the port to use for the mount agent if +/* If this is nonzero, it's the port to use for the mount agent if the portmapper fails or can't be found. */ extern short mount_port; @@ -134,7 +142,7 @@ extern int nfs_program; /* RPC program version for the NFS server */ extern int nfs_version; -/* If this is nonzero, it's the port to be used to find the nfs agent +/* If this is nonzero, it's the port to be used to find the nfs agent if the portmapper fails or can't be found */ extern short nfs_port; @@ -142,17 +150,17 @@ extern short nfs_port; portmapper. */ extern int nfs_port_override; +/* Which NFS protocol version we are using */ +extern int protocol_version; + -/* Count how many four-byte chunks it takss to hold LEN bytes. */ +/* Count how many four-byte chunks it takes to hold LEN bytes. */ #define INTSIZE(len) (((len)+3)>>2) -/* cred.c */ -int cred_has_uid (struct netcred *, uid_t); -int cred_has_gid (struct netcred *, gid_t); - /* nfs.c */ -int *xdr_encode_fhandle (int *, void *); +int hurd_mode_to_nfs_type (mode_t); +int *xdr_encode_fhandle (int *, struct fhandle *); int *xdr_encode_data (int *, char *, size_t); int *xdr_encode_string (int *, char *); int *xdr_encode_sattr_mode (int *, mode_t); @@ -160,15 +168,18 @@ int *xdr_encode_sattr_ids (int *, u_int, u_int); int *xdr_encode_sattr_size (int *, off_t); int *xdr_encode_sattr_times (int *, struct timespec *, struct timespec *); int *xdr_encode_sattr_stat (int *, struct stat *); -int *xdr_encode_create_state (int *, mode_t); +int *xdr_encode_create_state (int *, mode_t, uid_t); int *xdr_decode_fattr (int *, struct stat *); int *xdr_decode_string (int *, char *); -int *nfs_initialize_rpc (int, struct netcred *, size_t, void **, +int *xdr_decode_fhandle (int *, struct node **); +int *nfs_initialize_rpc (int, struct iouser *, size_t, void **, struct node *, uid_t); error_t nfs_error_trans (int); /* mount.c */ struct node *mount_root (char *, char *); +extern const char *mounted_hostname; +extern uint16_t mounted_nfs_port; /* host order */ /* ops.c */ int *register_fresh_stat (struct node *, int *); @@ -180,5 +191,13 @@ void timeout_service_thread (void); void rpc_receive_thread (void); /* cache.c */ -struct node *lookup_fhandle (void *); -void recache_handle (struct node *, void *); +void lookup_fhandle (void *, size_t, struct node **); +int *recache_handle (int *, struct node *); + +/* name-cache.c */ +void enter_lookup_cache (char *, size_t, struct node *, char *); +void purge_lookup_cache (struct node *, char *, size_t); +struct node *check_lookup_cache (struct node *, char *); +void purge_lookup_cache_node (struct node *); + +#endif /* NFS_NFS_H */ |