summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libtrivfs/startup.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/libtrivfs/startup.c b/libtrivfs/startup.c
index 487276a0..3783efc2 100644
--- a/libtrivfs/startup.c
+++ b/libtrivfs/startup.c
@@ -38,30 +38,31 @@ trivfs_startup(mach_port_t bootstrap, int flags,
struct port_bucket *protid_bucket,
struct trivfs_control **control)
{
- error_t err;
- mach_port_t realnode;
- struct trivfs_control *tcntl;
- mach_port_t mcntl =
- trivfs_handle_port (MACH_PORT_NULL, control_class, control_bucket,
- protid_class, protid_bucket);
+ mach_port_t underlying, right;
+ struct trivfs_control *fsys;
+ error_t err =
+ trivfs_create_control (MACH_PORT_NULL,
+ control_class, control_bucket,
+ protid_class, protid_bucket,
+ &fsys);
- assert(mcntl != MACH_PORT_NULL);
+ if (err)
+ return err;
- /* Contact whoever started us. */
- err =
- fsys_startup (bootstrap, flags, mcntl, MACH_MSG_TYPE_MAKE_SEND, &realnode);
+ right = ports_get_right (fsys);
- /* Install the returned realnode for trivfs's use */
- tcntl = ports_lookup_port (control_bucket, mcntl, control_class);
- assert (tcntl);
+ /* Contact whoever started us. */
+ err = fsys_startup (bootstrap, flags, right, MACH_MSG_TYPE_MAKE_SEND,
+ &underlying);
- if (!err)
- tcntl->underlying = realnode;
+ if (! err)
+ fsys->underlying = underlying;
- ports_port_deref (tcntl);
+ ports_port_deref (fsys);
- if (control)
- *control = tcntl;
+ /* Pass back what we got, unless the caller doesn't want it. */
+ if (!err && control)
+ *control = fsys;
return err;
}