summaryrefslogtreecommitdiff
path: root/nfs/cache.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2002-09-29 15:11:59 +0000
committerMarcus Brinkmann <marcus@gnu.org>2002-09-29 15:11:59 +0000
commit5942bd6f73499f198b23975b8d7b8df1383934d8 (patch)
tree3494bab9ac5bc1fc0be29906ec508e393b01f106 /nfs/cache.c
parent253348bac2dced91688712d909059a035d5b9b0c (diff)
2002-09-29 Marcus Brinkmann <marcus@gnu.org>
* mount.c (mount_root): Add parenthesis for post-decrement (even though it is only used as an lvalue here). Increment P after using it in the macro, not within. * rpc.c (initialize_rpc, conduct_rpc): Likewise. * ops.c (process_returned_stat, process_wcc_stat, netfs_validate_stat, netfs_attempt_chown, netfs_attempt_chmod, netfs_attempt_utimes, netfs_attempt_set_size, netfs_attempt_statfs, netfs_attempt_read, netfs_attempt_write, verify_nonexistent, netfs_attempt_lookup, netfs_attempt_mkdir, netfs_attempt_rmdir, netfs_attempt_link, netfs_attempt_create_file, netfs_attempt_unlink, netfs_attempt_rename, netfs_attempt_readlink, netfs_report_access, netfs_check_open_permissions): Likewise. (fetch_directory): Likewise. Also use memcpy instead bcopy. * cache.c (recache_handle): Likewise. * nfs.c (xdr_encode_data, xdr_encode_sattr_mode, xdr_encode_sattr_ids, xdr_encode_sattr_size, xdr_encode_sattr_times, xdr_encode_create_state, xdr_encode_sattr_stat, xdr_decode_64bit, xdr_decode_fattr): Likewise. (xdr_decode_string): Likewise. Also use memcpy instead bcopy. (xdr_decode_fhandle): Likewise. Also use memcpy instead bcopy.
Diffstat (limited to 'nfs/cache.c')
-rw-r--r--nfs/cache.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/nfs/cache.c b/nfs/cache.c
index 3cdb527f..8f87f5d0 100644
--- a/nfs/cache.c
+++ b/nfs/cache.c
@@ -1,5 +1,5 @@
-/* Node cache management for NFS client implementation
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* cache.c - Node cache management for NFS client implementation.
+ Copyright (C) 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -23,14 +23,15 @@
#include <string.h>
#include <netinet/in.h>
-/* Hash table containing all the nodes currently active.
- XXX Was 512, however, a prime is much nice for the hash
- function. 509 is nice as not only is it prime, it keeps
- the array within a page or two */
+/* Hash table containing all the nodes currently active. XXX Was 512,
+ however, a prime is much nicer for the hash function. 509 is nice
+ as not only is it prime, it also keeps the array within a page or
+ two. */
#define CACHESIZE 509
static struct node *nodehash [CACHESIZE];
-/* Compute and return a hash key for NFS file handle DATA of LEN bytes. */
+/* Compute and return a hash key for NFS file handle DATA of LEN
+ bytes. */
static inline int
hash (int *data, size_t len)
{
@@ -96,15 +97,15 @@ lookup_fhandle (void *p, size_t len, struct node **npp)
*npp = np;
}
-/* Package holding args to forked_node_delete. */
+/* Package holding args to forked_node_delete. */
struct fnd
{
struct node *dir;
char *name;
};
-/* Worker function to delete nodes that don't have any more local references
- or links. */
+/* Worker function to delete nodes that don't have any more local
+ references or links. */
any_t
forked_node_delete (any_t arg)
{
@@ -121,7 +122,7 @@ forked_node_delete (any_t arg)
/* Called by libnetfs when node NP has no more references. (See
<hurd/libnetfs.h> for details. Just clear its local state and
remove it from the hash table. Called and expected to leave with
- NETFS_NODE_REFCNT_LOCK held. */
+ NETFS_NODE_REFCNT_LOCK held. */
void
netfs_node_norefs (struct node *np)
{
@@ -141,8 +142,9 @@ netfs_node_norefs (struct node *np)
np->nn->dead_name = 0;
netfs_nput (np);
- /* Do this in a separate thread so that we don't wait for it;
- it acquires a lock on the dir, which we are not allowed to do. */
+ /* Do this in a separate thread so that we don't wait for it; it
+ acquires a lock on the dir, which we are not allowed to
+ do. */
cthread_detach (cthread_fork (forked_node_delete, (any_t) args));
/* Caller expects us to leave this locked... */
@@ -162,7 +164,7 @@ netfs_node_norefs (struct node *np)
/* Change the file handle used for node NP to be the handle at P.
Make sure the hash table stays up to date. Return the address
- after the handle. The lock on the node should be held. */
+ after the handle. The lock on the node should be held. */
int *
recache_handle (int *p, struct node *np)
{
@@ -172,7 +174,10 @@ recache_handle (int *p, struct node *np)
if (protocol_version == 2)
len = NFS2_FHSIZE;
else
- len = ntohl (*p++);
+ {
+ len = ntohl (*p);
+ p++;
+ }
/* Unlink it */
spin_lock (&netfs_node_refcnt_lock);