diff options
author | Roland McGrath <roland@gnu.org> | 2002-05-03 22:52:40 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2002-05-03 22:52:40 +0000 |
commit | 6d949206e081d7c5a167d67029830ed8c0e79b22 (patch) | |
tree | e3a9c5214ef02d406783d0e3956807bb3a606778 | |
parent | 4dc56d7cac6732f34aa0e0dc9a9a702671b9e8a2 (diff) |
2002-05-03 Roland McGrath <roland@frob.com>
* main.c: Include <error.h>.
* fsys.c: Likewise.
-rw-r--r-- | nfsd/fsys.c | 24 | ||||
-rw-r--r-- | nfsd/main.c | 13 |
2 files changed, 19 insertions, 18 deletions
diff --git a/nfsd/fsys.c b/nfsd/fsys.c index 8a2cd03b..7b15d150 100644 --- a/nfsd/fsys.c +++ b/nfsd/fsys.c @@ -20,13 +20,14 @@ #include <stdio.h> #include <errno.h> +#include <error.h> #include <hurd.h> #include <fcntl.h> #include <string.h> #include "nfsd.h" -struct fsys_spec +struct fsys_spec { fsys_t fsys; char *name; @@ -58,10 +59,10 @@ init_filesystems (void) fsystable[i].fsys = MACH_PORT_NULL; fsystable[i].name = 0; } - + if (!index_file_name) return; - + index_file = fopen (index_file_name, "r"); if (!index_file) { @@ -77,7 +78,7 @@ init_filesystems (void) fclose (index_file); return; } - + if (nitems != 2) { error (0, 0, "%s:%d Bad syntax", index_file_name, line); @@ -87,7 +88,7 @@ init_filesystems (void) root = file_name_lookup (name, 0, 0); if (root == MACH_PORT_NULL) { - error (0, errno, "%s:%d Filesystem `%s'", + error (0, errno, "%s:%d Filesystem `%s'", index_file_name, line, name); free (name); continue; @@ -95,7 +96,7 @@ init_filesystems (void) if (index >= fsystablesize) { - fsystable = (struct fsys_spec *) + fsystable = (struct fsys_spec *) realloc (fsystable, index * 2 * sizeof (struct fsys_spec)); for (i = fsystablesize; i < index * 2; i++) { @@ -107,7 +108,7 @@ init_filesystems (void) if (index + 1 > nfsys) nfsys = index + 1; - + fsystable[index].name = name; file_getcontrol (root, &fsystable[index].fsys); mach_port_deallocate (mach_task_self (), root); @@ -125,7 +126,7 @@ write_filesystems (void) if (!index_file_name) return; - + if (index_file_dir == MACH_PORT_NULL) { index_file_dir = file_name_split (index_file_name, &index_file_compname); @@ -147,9 +148,9 @@ write_filesystems (void) index_file_dir = MACH_PORT_NULL; return; } - + f = fopenport (newindex, "w"); - + for (i = 0; i < nfsys; i++) if (fsystable[i].name) fprintf (f, "%d %s\n", i, fsystable[i].name); @@ -183,7 +184,7 @@ enter_filesystem (char *name, file_t root) for (i = 0; i < nfsys; i++) if (fsystable[i].name && !strcmp (fsystable[i].name, name)) return i; - + if (nfsys == fsystablesize) { fsystable = (struct fsys_spec *) realloc (fsystable, @@ -206,4 +207,3 @@ enter_filesystem (char *name, file_t root) return nfsys - 1; } - diff --git a/nfsd/main.c b/nfsd/main.c index 2e5df1c2..2e5c47c4 100644 --- a/nfsd/main.c +++ b/nfsd/main.c @@ -1,5 +1,5 @@ /* Main NFS server program - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996, 2002 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. This file is part of the GNU Hurd. @@ -24,6 +24,7 @@ #include <rpc/pmap_prot.h> #include <maptime.h> #include <hurd.h> +#include <error.h> int main_udp_socket, pmap_udp_socket; struct sockaddr_in main_address, pmap_address; @@ -47,7 +48,7 @@ main (int argc, char **argv) nthreads = atoi (argv[1]); if (!nthreads) nthreads = 4; - + authserver = getauth (); maptime_map (0, 0, &mapped_time); @@ -64,7 +65,7 @@ main (int argc, char **argv) sizeof (struct sockaddr_in)); if (fail) error (1, errno, "Binding NFS socket"); - + fail = bind (pmap_udp_socket, (struct sockaddr *)&pmap_address, sizeof (struct sockaddr_in)); if (fail) @@ -74,11 +75,11 @@ main (int argc, char **argv) cthread_detach (cthread_fork ((cthread_fn_t) server_loop, (any_t) pmap_udp_socket)); - + while (nthreads--) - cthread_detach (cthread_fork ((cthread_fn_t) server_loop, + cthread_detach (cthread_fork ((cthread_fn_t) server_loop, (any_t) main_udp_socket)); - + for (;;) { sleep (1); |