Calling diskfs_init_main is mandatory. diskfs_init_main calls
diskfs_init_diskfs itself. Therefore, having diskfs_init_diskfs
as a public interface is useless especially with its current
comment. Additionally, diskfs_init_main is the only caller of
diskfs_init_diskfs.
Thus, this patch merges diskfs_init_diskfs and diskfs_init_init
into diskfs_init_diskfs.
--- hurd-20010329-snapshot/libdiskfs/diskfs.h Tue Jan 30 02:12:51 2001
+++ hurd-20010329/libdiskfs/diskfs.h Sat Mar 31 10:00:23 2001
@@ -1,5 +1,5 @@
/* Definitions for fileserver helper functions
- Copyright (C) 1994, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
+ Copyright (C) 1994, 95, 96, 97, 98, 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
@@ -551,17 +551,13 @@
parsing diskfs options. */
error_t diskfs_init_diskfs (void);
-/* Call this once the filesystem is fully initialized, to advertise the new
+/* Call this once the filesystem is fully initialized to advertise the new
filesystem control port to our parent filesystem. If BOOTSTRAP is set,
the diskfs will call fsys_startup on that port as appropriate and return
- the REALNODE returned in that call; otherwise we return MACH_PORT_NULL.
- FLAGS specifies how to open REALNODE (from the O_* set). */
+ the REALNODE returned in that call; otherwise we assume we are the
+ bootstrap file system, do special initialization and return MACH_PORT_NULL.
+ FLAGS specifies how to open REALNODE (as from the O_* set). */
mach_port_t diskfs_startup_diskfs (mach_port_t bootstrap, int flags);
-
-/* Call this after all format-specific initialization is done (except
- for setting diskfs_root_node); at this point the pagers should be
- ready to go. */
-void diskfs_spawn_first_thread (void);
/* Once diskfs_root_node is set, call this if we are a bootstrap
filesystem. If you call this, then the library will call
--- hurd-20010329-snapshot/libdiskfs/init-main.c Sun May 14 21:46:04 2000
+++ hurd-20010329/libdiskfs/init-main.c Fri Mar 30 16:07:33 2001
@@ -1,5 +1,6 @@
-/* diskfs_init_main -- initialize diskfs world, parse arguments, and open store
- Copyright (C) 1999 Free Software Foundation, Inc.
+/* diskfs_init_main -- initialize diskfs world, parse arguments, open store and
+ start first thread.
+ Copyright (C) 1999,2001 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -17,12 +18,18 @@
along with the GNU Hurd; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+#include "priv.h"
#include "diskfs.h"
+
+#include <stdlib.h>
#include <argp.h>
#include <assert.h>
#include <error.h>
+#include <cthreads.h>
#include <hurd/store.h>
+static any_t master_thread_function (any_t foo);
+
struct store *
diskfs_init_main (struct argp *startup_argp,
int argc, char **argv,
@@ -72,7 +79,32 @@
diskfs_readonly = diskfs_hard_readonly = 1;
/* Start the first request thread, to handle RPCs and page requests. */
- diskfs_spawn_first_thread ();
+ cthread_detach (cthread_fork ((cthread_fn_t) master_thread_function,
+ (any_t) 0));
return store;
+}
+
+static int thread_timeout = 1000 * 60 * 2; /* two minutes */
+static int server_timeout = 1000 * 60 * 10; /* ten minutes */
+
+static any_t
+master_thread_function (any_t foo __attribute__ ((unused)))
+{
+ error_t err;
+
+ do
+ {
+ ports_manage_port_operations_multithread (diskfs_port_bucket,
+ diskfs_demuxer,
+ thread_timeout,
+ server_timeout,
+ 0);
+ err = diskfs_shutdown (0);
+ }
+ while (err);
+
+ exit (0);
+ /* NOTREACHED */
+ return (any_t) 0;
}
--- hurd-20010329-snapshot/libdiskfs/Makefile Mon Feb 26 05:14:56 2001
+++ hurd-20010329/libdiskfs/Makefile Fri Mar 30 16:07:32 2001
@@ -41,7 +41,7 @@
node-nref.c node-nput.c node-nrele.c node-nrefl.c node-nputl.c \
node-nrelel.c \
peropen-make.c peropen-rele.c protid-make.c protid-rele.c \
- init-init.c init-startup.c init-first.c init-main.c \
+ init-init.c init-startup.c init-main.c \
rdwr-internal.c boot-start.c demuxer.c node-times.c shutdown.c \
sync-interval.c sync-default.c \
opts-set.c opts-get.c opts-std-startup.c opts-std-runtime.c \
PGP signature