summaryrefslogtreecommitdiff
path: root/libdiskfs/init-startup.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1996-04-30 19:09:26 +0000
committerMichael I. Bushnell <mib@gnu.org>1996-04-30 19:09:26 +0000
commit1943ccd6e5f29b04e0f7059df6f76be8f82c55d9 (patch)
tree6c7e900a22d03de8abe0fe176a2769c313dfc0a1 /libdiskfs/init-startup.c
parent7d4d2739cc4899f196c037b4352ef94c419cc563 (diff)
Include <string.h> and <hurd/startup.h>.
(diskfs_startup_diskfs): If not bootstrap filesystem, call _diskfs_init_completed here. (diskfs_S_startup_dosync): New function (commented out). (_diskfs_init_completed): New function.
Diffstat (limited to 'libdiskfs/init-startup.c')
-rw-r--r--libdiskfs/init-startup.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/libdiskfs/init-startup.c b/libdiskfs/init-startup.c
index ca1764e1..b9857c76 100644
--- a/libdiskfs/init-startup.c
+++ b/libdiskfs/init-startup.c
@@ -21,7 +21,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
#include <stdio.h>
+#include <string.h>
#include <hurd/fsys.h>
+#include <hurd/startup.h>
mach_port_t
diskfs_startup_diskfs (mach_port_t bootstrap, int flags)
@@ -50,6 +52,8 @@ diskfs_startup_diskfs (mach_port_t bootstrap, int flags)
}
mach_port_deallocate (mach_task_self (), bootstrap);
_diskfs_ncontrol_ports++;
+
+ _diskfs_init_completed ();
}
else
{
@@ -65,3 +69,85 @@ diskfs_startup_diskfs (mach_port_t bootstrap, int flags)
return realnode;
}
+
+#if 0
+error_t
+diskfs_S_startup_dosync (mach_port_t handle)
+{
+ struct port_info *pi
+ = ports_lookup_port (diskfs_port_bucket,
+ diskfs_shutdown_notification_class);
+ if (!pi)
+ return EOPNOTSUPP;
+
+ /* First start a sync so that if something goes wrong
+ we at least get this much done. */
+ diskfs_sync_everything (0);
+ diskfs_set_hypermetadata (0, 0);
+
+ rwlock_writer_lock (&diskfs_fsys_lock);
+
+ /* Permit all the current RPC's to finish, and then suspend new ones */
+ err = ports_inhibit_class_rpcs (diskfs_protid_class);
+ if (err)
+ return err;
+
+ diskfs_shutdown_pager ();
+ diskfs_set_hypermetadata (1, 1);
+
+ return 0;
+}
+#endif
+
+/* This is called when we have an ordinary environment, complete
+ with proc and auth ports. */
+void
+_diskfs_init_completed ()
+{
+ startup_t init;
+ process_t proc;
+ error_t err;
+ struct port_info *pi;
+ mach_port_t notify;
+
+ /* Contact the startup server and register our shutdown request.
+ If we get an error, print an informational message. */
+
+ proc = getproc ();
+ assert (proc);
+
+ err = ports_create_port (diskfs_shutdown_notification_class,
+ diskfs_port_bucket, sizeof (struct port_info),
+ &pi);
+ if (err)
+ goto errout;
+
+ err = proc_getmsgport (proc, 1, &init);
+ mach_port_deallocate (mach_task_self (), proc);
+ if (err)
+ goto errout;
+
+ notify = ports_get_right (pi);
+ ports_port_deref (pi);
+ err = mach_port_insert_right (mach_task_self (), notify, notify,
+ MACH_MSG_TYPE_MAKE_SEND);
+ if (err)
+ {
+ mach_port_deallocate (mach_task_self (), init);
+ goto errout;
+ }
+
+ err = startup_request_notification (init, notify /* , name */);
+ if (err)
+ goto errout;
+
+ mach_port_deallocate (mach_task_self (), init);
+ mach_port_deallocate (mach_task_self (), notify);
+ return;
+
+ errout:
+ fprintf (stderr, "Cannot request shutdown notification: %s\n",
+ strerror (err));
+}
+
+