summaryrefslogtreecommitdiffstats
path: root/sys/lib/libsa/nfs.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2003-08-11 06:23:07 +0000
committerderaadt <deraadt@openbsd.org>2003-08-11 06:23:07 +0000
commit599546b3df9d501c5df00d16afc0d6ef8054a751 (patch)
tree497dafb2e950a5b91385da061a8c32b00de30455 /sys/lib/libsa/nfs.c
parentmake sure Debugger() is called only inside _both_ DDB and OSIOP_DEBUG (diff)
downloadwireguard-openbsd-599546b3df9d501c5df00d16afc0d6ef8054a751.tar.xz
wireguard-openbsd-599546b3df9d501c5df00d16afc0d6ef8054a751.zip
ansification and knf and protos
Diffstat (limited to 'sys/lib/libsa/nfs.c')
-rw-r--r--sys/lib/libsa/nfs.c100
1 files changed, 32 insertions, 68 deletions
diff --git a/sys/lib/libsa/nfs.c b/sys/lib/libsa/nfs.c
index d103b186c74..86e0b65d1dd 100644
--- a/sys/lib/libsa/nfs.c
+++ b/sys/lib/libsa/nfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs.c,v 1.9 2003/06/01 17:00:33 deraadt Exp $ */
+/* $OpenBSD: nfs.c,v 1.10 2003/08/11 06:23:09 deraadt Exp $ */
/* $NetBSD: nfs.c,v 1.19 1996/10/13 02:29:04 christos Exp $ */
/*-
@@ -102,13 +102,10 @@ struct nfs_iodesc nfs_root_node;
* Fetch the root file handle (call mount daemon)
* On error, return non-zero and set errno.
*/
-int
-nfs_getrootfh(d, path, fhp)
- register struct iodesc *d;
- char *path;
- u_char *fhp;
+static int
+nfs_getrootfh(struct iodesc *d, char *path, u_char *fhp)
{
- register int len;
+ int len;
struct args {
n_long len;
char path[FNAME_SIZE];
@@ -165,13 +162,10 @@ nfs_getrootfh(d, path, fhp)
* Lookup a file. Store handle and attributes.
* Return zero or error number.
*/
-int
-nfs_lookupfh(d, name, newfd)
- struct nfs_iodesc *d;
- char *name;
- struct nfs_iodesc *newfd;
+static int
+nfs_lookupfh(struct nfs_iodesc *d, char *name, struct nfs_iodesc *newfd)
{
- register int len, rlen;
+ int len, rlen;
struct args {
u_char fh[NFS_FHSIZE];
n_long len;
@@ -230,10 +224,8 @@ nfs_lookupfh(d, name, newfd)
/*
* Get the destination of a symbolic link.
*/
-int
-nfs_readlink(d, buf)
- struct nfs_iodesc *d;
- char *buf;
+static int
+nfs_readlink(struct nfs_iodesc *d, char *buf)
{
struct {
n_long h[RPC_HEADER_WORDS];
@@ -252,8 +244,8 @@ nfs_readlink(d, buf)
bcopy(d->fh, sdata.fh, NFS_FHSIZE);
cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER2, NFSPROC_READLINK,
- sdata.fh, NFS_FHSIZE,
- &rdata.d, sizeof(rdata.d));
+ sdata.fh, NFS_FHSIZE,
+ &rdata.d, sizeof(rdata.d));
if (cc == -1)
return (errno);
@@ -276,12 +268,8 @@ nfs_readlink(d, buf)
* Read data from a file.
* Return transfer count or -1 (and set errno)
*/
-ssize_t
-nfs_readdata(d, off, addr, len)
- struct nfs_iodesc *d;
- off_t off;
- void *addr;
- size_t len;
+static ssize_t
+nfs_readdata(struct nfs_iodesc *d, off_t off, void *addr, size_t len)
{
struct nfs_read_args *args;
struct nfs_read_repl *repl;
@@ -339,10 +327,7 @@ nfs_readdata(d, off, addr, len)
* On error, return non-zero and set errno.
*/
int
-nfs_mount(sock, ip, path)
- int sock;
- struct in_addr ip;
- char *path;
+nfs_mount(int sock, struct in_addr ip, char *path)
{
struct iodesc *desc;
struct nfsv2_fattrs *fa;
@@ -377,17 +362,12 @@ nfs_mount(sock, ip, path)
* return zero or error number
*/
int
-nfs_open(path, f)
- char *path;
- struct open_file *f;
+nfs_open(char *path, struct open_file *f)
{
struct nfs_iodesc *newfd, *currfd;
- register char *cp, *ncp;
- register int c;
- char namebuf[NFS_MAXPATHLEN + 1];
+ char namebuf[NFS_MAXPATHLEN + 1], *cp, *ncp;
char linkbuf[NFS_MAXPATHLEN + 1];
- int nlinks = 0;
- int error = 0;
+ int nlinks = 0, error = 0, c;
#ifdef NFS_DEBUG
if (debug)
@@ -428,7 +408,7 @@ nfs_open(path, f)
* Get next component of path name.
*/
{
- register int len = 0;
+ int len = 0;
ncp = cp;
while ((c = *cp) != '\0' && c != '/') {
@@ -460,8 +440,8 @@ nfs_open(path, f)
link_len = strlen(linkbuf);
len = strlen(cp);
- if (link_len + len > MAXPATHLEN
- || ++nlinks > MAXSYMLINKS) {
+ if (link_len + len > MAXPATHLEN ||
+ ++nlinks > MAXSYMLINKS) {
error = ENOENT;
goto out;
}
@@ -514,10 +494,9 @@ out:
}
int
-nfs_close(f)
- struct open_file *f;
+nfs_close(struct open_file *f)
{
- register struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
+ struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
#ifdef NFS_DEBUG
if (debug)
@@ -535,15 +514,11 @@ nfs_close(f)
* read a portion of a file
*/
int
-nfs_read(f, buf, size, resid)
- struct open_file *f;
- void *buf;
- size_t size;
- size_t *resid; /* out */
+nfs_read(struct open_file *f, void *buf, size_t size, size_t *resid)
{
- register struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
- register ssize_t cc;
- register char *addr = buf;
+ struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
+ ssize_t cc;
+ char *addr = buf;
#ifdef NFS_DEBUG
if (debug)
@@ -580,22 +555,15 @@ ret:
* Not implemented.
*/
int
-nfs_write(f, buf, size, resid)
- struct open_file *f;
- void *buf;
- size_t size;
- size_t *resid; /* out */
+nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid)
{
return (EROFS);
}
off_t
-nfs_seek(f, offset, where)
- struct open_file *f;
- off_t offset;
- int where;
+nfs_seek(struct open_file *f, off_t offset, int where)
{
- register struct nfs_iodesc *d = (struct nfs_iodesc *)f->f_fsdata;
+ struct nfs_iodesc *d = (struct nfs_iodesc *)f->f_fsdata;
n_long size = ntohl(d->fa.fa_size);
switch (where) {
@@ -620,12 +588,10 @@ int nfs_stat_types[8] = {
0, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, 0 };
int
-nfs_stat(f, sb)
- struct open_file *f;
- struct stat *sb;
+nfs_stat(struct open_file *f, struct stat *sb)
{
struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
- register n_long ftype, mode;
+ n_long ftype, mode;
ftype = ntohl(fp->fa.fa_type);
mode = ntohl(fp->fa.fa_mode);
@@ -645,9 +611,7 @@ nfs_stat(f, sb)
*/
#ifndef NO_READDIR
int
-nfs_readdir(f, name)
- struct open_file *f;
- char *name;
+nfs_readdir(struct open_file *f, char *name)
{
return (EROFS);
}