summaryrefslogtreecommitdiff
path: root/libdiskfs/init-startup.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdiskfs/init-startup.c')
-rw-r--r--libdiskfs/init-startup.c58
1 files changed, 38 insertions, 20 deletions
diff --git a/libdiskfs/init-startup.c b/libdiskfs/init-startup.c
index a2e3638d..92ef8f94 100644
--- a/libdiskfs/init-startup.c
+++ b/libdiskfs/init-startup.c
@@ -32,12 +32,35 @@
char *_diskfs_chroot_directory;
-mach_port_t
-diskfs_startup_diskfs (mach_port_t bootstrap, int flags)
+static void
+diskfs_call_fsys_startup (mach_port_t bootstrap, int flags,
+ mach_port_t *realnode)
{
error_t err;
- mach_port_t realnode, right;
struct port_info *newpi;
+ mach_port_t right;
+
+ err = ports_create_port (diskfs_control_class, diskfs_port_bucket,
+ sizeof (struct port_info), &newpi);
+ if (! err)
+ {
+ right = ports_get_send_right (newpi);
+ err = fsys_startup (bootstrap, flags, right,
+ MACH_MSG_TYPE_COPY_SEND, realnode);
+ mach_port_deallocate (mach_task_self (), right);
+ ports_port_deref (newpi);
+ }
+ if (err)
+ error (1, err, "Translator startup failure: fsys_startup");
+
+ _diskfs_ncontrol_ports++;
+}
+
+mach_port_t
+diskfs_startup_diskfs (mach_port_t fs_bootstrap, int flags)
+{
+ error_t err;
+ mach_port_t realnode, bootstrap;
if (_diskfs_chroot_directory != NULL)
{
@@ -88,24 +111,11 @@ diskfs_startup_diskfs (mach_port_t bootstrap, int flags)
diskfs_nput (old);
}
- if (bootstrap != MACH_PORT_NULL)
+ if (fs_bootstrap != MACH_PORT_NULL)
{
- err = ports_create_port (diskfs_control_class, diskfs_port_bucket,
- sizeof (struct port_info), &newpi);
- if (! err)
- {
- right = ports_get_send_right (newpi);
- err = fsys_startup (bootstrap, flags, right,
- MACH_MSG_TYPE_COPY_SEND, &realnode);
- mach_port_deallocate (mach_task_self (), right);
- ports_port_deref (newpi);
- }
- if (err)
- error (1, err, "Translator startup failure: fsys_startup");
-
- mach_port_deallocate (mach_task_self (), bootstrap);
- _diskfs_ncontrol_ports++;
-
+ /* We do the startup from filesystem's bootstrap */
+ diskfs_call_fsys_startup (fs_bootstrap, flags, &realnode);
+ mach_port_deallocate (mach_task_self (), fs_bootstrap);
_diskfs_init_completed ();
}
else
@@ -114,6 +124,14 @@ diskfs_startup_diskfs (mach_port_t bootstrap, int flags)
/* We are the bootstrap filesystem; do special boot-time setup. */
diskfs_start_bootstrap ();
+
+ /* If we have a bootstrap port we must call fsys_startup */
+ task_get_bootstrap_port (mach_task_self (), &bootstrap);
+ if (bootstrap != MACH_PORT_NULL)
+ {
+ diskfs_call_fsys_startup (bootstrap, flags, &realnode);
+ mach_port_deallocate (mach_task_self (), bootstrap);
+ }
}
if (diskfs_default_sync_interval)