summaryrefslogtreecommitdiff
path: root/nfsd
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1996-08-14 18:10:19 +0000
committerThomas Bushnell <thomas@gnu.org>1996-08-14 18:10:19 +0000
commit2026ce0437cca8cb15149a5c488f93110f69131d (patch)
tree7bdeded20cbe0cc5222cb8aeeb773f761cc7cc79 /nfsd
parent332efe88b6fbf47a33cd27a4b9b22276a30c181f (diff)
*** empty log message ***
Diffstat (limited to 'nfsd')
-rw-r--r--nfsd/ChangeLog13
-rw-r--r--nfsd/cache.c28
-rw-r--r--nfsd/loop.c2
-rw-r--r--nfsd/nfsd.h6
-rw-r--r--nfsd/ops.c20
-rw-r--r--nfsd/xdr.c14
6 files changed, 48 insertions, 35 deletions
diff --git a/nfsd/ChangeLog b/nfsd/ChangeLog
index 3fc876e2..744bd3b8 100644
--- a/nfsd/ChangeLog
+++ b/nfsd/ChangeLog
@@ -1,3 +1,16 @@
+Wed Aug 14 13:46:45 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
+
+ * ops.c (nfstable): Renamed to nfs2table.
+ * nfsd.h (nfstable): Likewise.
+ * loop.c (server_loop): Reference nfs2table instead of nfstable.
+
+ * nfsd.h, cache.c, ops.c, xdr.c: Use new names for things that
+ have just been changed in ../nfs/rpcsvc/nfs_prot.h.
+ * xdr.c (hurd_mode_to_nfs_type): New parm VERSION; all callers
+ changed.
+ (encode_fattr): New parm VERSION; all callers changed.
+ * nfsd.h (encode_fattr): New parm VERSION.
+
Tue Aug 13 14:38:36 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* ops.c (op_create): Sun's NFS client implementation actually
diff --git a/nfsd/cache.c b/nfsd/cache.c
index 8b1ee134..29e64834 100644
--- a/nfsd/cache.c
+++ b/nfsd/cache.c
@@ -243,7 +243,7 @@ fh_hash (char *fhandle, struct idspec *i)
{
int hash = 0, n;
- for (n = 0; n < NFS_FHSIZE; n++)
+ for (n = 0; n < NFS2_FHSIZE; n++)
hash += fhandle[n];
hash += (int) i >> 6;
return hash % FHHASH_TABLE_SIZE;
@@ -260,14 +260,14 @@ lookup_cache_handle (int *p, struct cache_handle **cp, struct idspec *i)
hash = fh_hash ((char *)p, i);
mutex_lock (&fhhashlock);
for (c = fhhashtable[hash]; c; c = c->next)
- if (c->ids == i && ! bcmp (c->handle, p, NFS_FHSIZE))
+ if (c->ids == i && ! bcmp (c->handle, p, NFS2_FHSIZE))
{
if (c->references == 0)
nfreefh--;
c->references++;
mutex_unlock (&fhhashlock);
*cp = c;
- return p + NFS_FHSIZE / sizeof (int);
+ return p + NFS2_FHSIZE / sizeof (int);
}
/* Not found */
@@ -276,15 +276,15 @@ lookup_cache_handle (int *p, struct cache_handle **cp, struct idspec *i)
fsys = lookup_filesystem (*p);
if (fsys == MACH_PORT_NULL
|| fsys_getfile (fsys, i->uids, i->nuids, i->gids, i->ngids,
- (char *)(p + 1), NFS_FHSIZE - sizeof (int), &port))
+ (char *)(p + 1), NFS2_FHSIZE - sizeof (int), &port))
{
mutex_unlock (&fhhashlock);
*cp = 0;
- return p + NFS_FHSIZE / sizeof (int);
+ return p + NFS2_FHSIZE / sizeof (int);
}
c = malloc (sizeof (struct cache_handle));
- bcopy (p, c->handle, NFS_FHSIZE);
+ bcopy (p, c->handle, NFS2_FHSIZE);
cred_ref (i);
c->ids = i;
c->port = port;
@@ -298,7 +298,7 @@ lookup_cache_handle (int *p, struct cache_handle **cp, struct idspec *i)
mutex_unlock (&fhhashlock);
*cp = c;
- return p + NFS_FHSIZE / sizeof (int);
+ return p + NFS2_FHSIZE / sizeof (int);
}
void
@@ -351,12 +351,12 @@ scan_fhs ()
struct cache_handle *
create_cached_handle (int fs, struct cache_handle *credc, file_t userport)
{
- char fhandle[NFS_FHSIZE];
+ char fhandle[NFS2_FHSIZE];
error_t err;
struct cache_handle *c;
int hash;
char *bp = fhandle + sizeof (int);
- size_t handlelen = NFS_FHSIZE - sizeof (int);
+ size_t handlelen = NFS2_FHSIZE - sizeof (int);
mach_port_t newport, ref;
/* Authenticate USERPORT so that we can call file_getfh on it. */
@@ -377,11 +377,11 @@ create_cached_handle (int fs, struct cache_handle *credc, file_t userport)
*(int *)fhandle = fs;
err = file_getfh (newport, &bp, &handlelen);
mach_port_deallocate (mach_task_self (), newport);
- if (err || handlelen != NFS_FHSIZE - sizeof (int))
+ if (err || handlelen != NFS2_FHSIZE - sizeof (int))
return 0;
if (bp != fhandle + sizeof (int))
{
- bcopy (bp, fhandle + sizeof (int), NFS_FHSIZE - sizeof (int));
+ bcopy (bp, fhandle + sizeof (int), NFS2_FHSIZE - sizeof (int));
vm_deallocate (mach_task_self (), (vm_address_t) bp, handlelen);
}
@@ -389,7 +389,7 @@ create_cached_handle (int fs, struct cache_handle *credc, file_t userport)
hash = fh_hash (fhandle, credc->ids);
mutex_lock (&fhhashlock);
for (c = fhhashtable[hash]; c; c = c->next)
- if (c->ids == credc->ids && ! bcmp (fhandle, c->handle, NFS_FHSIZE))
+ if (c->ids == credc->ids && ! bcmp (fhandle, c->handle, NFS2_FHSIZE))
{
/* Return this one */
if (c->references == 0)
@@ -405,7 +405,7 @@ create_cached_handle (int fs, struct cache_handle *credc, file_t userport)
err = fsys_getfile (lookup_filesystem (fs),
credc->ids->uids, credc->ids->nuids,
credc->ids->gids, credc->ids->ngids,
- fhandle + sizeof (int), NFS_FHSIZE - sizeof (int),
+ fhandle + sizeof (int), NFS2_FHSIZE - sizeof (int),
&newport);
if (err)
{
@@ -415,7 +415,7 @@ create_cached_handle (int fs, struct cache_handle *credc, file_t userport)
/* Create it anew */
c = malloc (sizeof (struct cache_handle));
- bcopy (fhandle, c->handle, NFS_FHSIZE);
+ bcopy (fhandle, c->handle, NFS2_FHSIZE);
cred_ref (credc->ids);
c->ids = credc->ids;
c->port = newport;
diff --git a/nfsd/loop.c b/nfsd/loop.c
index 38edae62..7d047490 100644
--- a/nfsd/loop.c
+++ b/nfsd/loop.c
@@ -101,7 +101,7 @@ server_loop (int fd)
case NFS_PROGRAM:
version = NFS_VERSION;
- table = &nfstable;
+ table = &nfs2table;
break;
case PMAPPROG:
diff --git a/nfsd/nfsd.h b/nfsd/nfsd.h
index c8ec86e2..d6d7aac9 100644
--- a/nfsd/nfsd.h
+++ b/nfsd/nfsd.h
@@ -46,7 +46,7 @@ struct idspec
struct cache_handle
{
struct cache_handle *next, **prevp;
- char handle[NFS_FHSIZE];
+ char handle[NFS2_FHSIZE];
struct idspec *ids;
file_t port;
time_t lastuse;
@@ -113,11 +113,11 @@ void scan_replies (void);
void server_loop (int);
/* ops.c */
-extern struct proctable nfstable, mounttable, pmaptable;
+extern struct proctable nfs2table, mounttable, pmaptable;
/* xdr.c */
int nfs_error_trans (error_t, int);
-int *encode_fattr (int *, struct stat *);
+int *encode_fattr (int *, struct stat *, int version);
int *decode_name (int *, char **);
int *encode_fhandle (int *, char *);
int *encode_string (int *, char *);
diff --git a/nfsd/ops.c b/nfsd/ops.c
index 4319d226..efcfa103 100644
--- a/nfsd/ops.c
+++ b/nfsd/ops.c
@@ -49,7 +49,7 @@ op_getattr (struct cache_handle *c,
err = io_stat (c->port, &st);
if (!err)
- *reply = encode_fattr (*reply, &st);
+ *reply = encode_fattr (*reply, &st, version);
return err;
}
@@ -133,7 +133,7 @@ op_setattr (struct cache_handle *c,
if (err)
return err;
- *reply = encode_fattr (*reply, &st);
+ *reply = encode_fattr (*reply, &st, version);
return 0;
}
@@ -173,7 +173,7 @@ op_lookup (struct cache_handle *c,
if (!newc)
return ESTALE;
*reply = encode_fhandle (*reply, newc->handle);
- *reply = encode_fattr (*reply, &st);
+ *reply = encode_fattr (*reply, &st, version);
return 0;
}
@@ -232,7 +232,7 @@ op_read (struct cache_handle *c,
if (err)
return err;
- *reply = encode_fattr (*reply, &st);
+ *reply = encode_fattr (*reply, &st, version);
*reply = encode_data (*reply, bp, buflen);
return 0;
}
@@ -273,7 +273,7 @@ op_write (struct cache_handle *c,
err = io_stat (c->port, &st);
if (err)
return err;
- *reply = encode_fattr (*reply, &st);
+ *reply = encode_fattr (*reply, &st, version);
return 0;
}
@@ -345,7 +345,7 @@ op_create (struct cache_handle *c,
return ESTALE;
*reply = encode_fhandle (*reply, newc->handle);
- *reply = encode_fattr (*reply, &st);
+ *reply = encode_fattr (*reply, &st, version);
return 0;
}
@@ -500,7 +500,7 @@ op_mkdir (struct cache_handle *c,
if (!newc)
return ESTALE;
*reply = encode_fhandle (*reply, newc->handle);
- *reply = encode_fattr (*reply, &st);
+ *reply = encode_fattr (*reply, &st, version);
return 0;
}
@@ -649,10 +649,10 @@ op_getport (struct cache_handle *c,
}
-struct proctable nfstable =
+struct proctable nfs2table =
{
- NFSPROC_NULL, /* first proc */
- NFSPROC_STATFS, /* last proc */
+ NFS2PROC_NULL, /* first proc */
+ NFS2PROC_STATFS, /* last proc */
{
{ op_null, 0, 0, 0},
{ op_getattr, 0, 1, 1},
diff --git a/nfsd/xdr.c b/nfsd/xdr.c
index 57ee1fdf..cb954e75 100644
--- a/nfsd/xdr.c
+++ b/nfsd/xdr.c
@@ -31,7 +31,7 @@ hurd_mode_to_nfs_mode (mode_t m)
}
static int
-hurd_mode_to_nfs_type (mode_t m)
+hurd_mode_to_nfs_type (mode_t m, int version)
{
switch (m & S_IFMT)
{
@@ -54,18 +54,18 @@ hurd_mode_to_nfs_type (mode_t m)
return NFSOCK;
case S_IFIFO:
- return NFFIFO;
+ return (version == 2 ? NF2FIFO : NF3FIFO);
default:
- return NFNON;
+ return (version == 2 ? NF2NON : NFREG);
}
}
/* Encode ST into P and return the next thing to come after it. */
int *
-encode_fattr (int *p, struct stat *st)
+encode_fattr (int *p, struct stat *st, int version)
{
- *p++ = htonl (hurd_mode_to_nfs_type (st->st_mode));
+ *p++ = htonl (hurd_mode_to_nfs_type (st->st_mode, version));
*p++ = htonl (hurd_mode_to_nfs_mode (st->st_mode));
*p++ = htonl (st->st_nlink);
*p++ = htonl (st->st_uid);
@@ -102,8 +102,8 @@ decode_name (int *p, char **name)
int *
encode_fhandle (int *p, char *handle)
{
- bcopy (handle, p, NFS_FHSIZE);
- return p + INTSIZE (NFS_FHSIZE);
+ bcopy (handle, p, NFS2_FHSIZE);
+ return p + INTSIZE (NFS2_FHSIZE);
}
/* Encode STRING into P and return the next thing to come after it. */