summaryrefslogtreecommitdiff
path: root/isofs
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-01-24 03:12:21 +0000
committerRoland McGrath <roland@gnu.org>1999-01-24 03:12:21 +0000
commit1d64ba55aba50b7b77054d6cdfbc38017df1dd7b (patch)
treef5fcfa6b299fceea88588f2959e7fbe77ce60d42 /isofs
parentcfb36b88d93f75685b8830a4ee115dd61071fdfe (diff)
1999-01-23 Roland McGrath <roland@baalperazim.frob.com>
* main.c (main): Use diskfs_init_main.
Diffstat (limited to 'isofs')
-rw-r--r--isofs/main.c66
1 files changed, 19 insertions, 47 deletions
diff --git a/isofs/main.c b/isofs/main.c
index caaf38bb..ea40a3a9 100644
--- a/isofs/main.c
+++ b/isofs/main.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1997 Free Software Foundation, Inc.
+/*
+ Copyright (C) 1997, 98 Free Software Foundation, Inc.
Written by Thomas Bushnell, n/BSG.
This file is part of the GNU Hurd.
@@ -38,7 +38,8 @@ int diskfs_synchronous = 0;
int diskfs_link_max = INT_MAX;
int diskfs_maxsymlinks = 8;
-int diskfs_readonly = 1;
+/* This filesystem is never capable of writing. */
+int diskfs_readonly = 1, diskfs_hard_readonly = 1;
/* Fetch the root node */
static void
@@ -52,14 +53,14 @@ fetch_root ()
/* First check for SUSP and all relevant extensions */
rrip_initialize (dr);
-
+
/* Now rescan the node for real */
rrip_lookup (dr, &rl, 1);
-
+
/* And fetch the node. */
err = load_inode (&diskfs_root_node, dr, &rl);
assert_perror (err);
-
+
mutex_unlock (&diskfs_root_node->lock);
}
@@ -71,11 +72,11 @@ read_sblock ()
struct voldesc *vd;
error_t err;
struct sblock * volatile sb = 0;
-
+
err = diskfs_catch_exception ();
if (err)
error (4, err, "reading superblock");
-
+
/* Start at logical sector 16 and keep going until
we find a matching superblock */
for (vd = disk_image + (logical_sector_size * 16);
@@ -94,7 +95,7 @@ read_sblock ()
break;
}
}
-
+
if (!sb)
error (1, 0, "Could not find valid superblock");
@@ -124,50 +125,22 @@ diskfs_append_args (char **argz, unsigned *argz_len)
int
main (int argc, char **argv)
{
- error_t err;
mach_port_t bootstrap;
- struct store_argp_params store_params = { 0 };
-
- argp_parse (&diskfs_store_startup_argp, argc, argv, 0, 0, &store_params);
- store_parsed = store_params.result;
-
- err = store_parsed_name (store_parsed, &diskfs_disk_name);
- if (err)
- error (2, err, "store_parsed_name");
-
- diskfs_console_stdio ();
-
- if (diskfs_boot_flags)
- bootstrap = MACH_PORT_NULL;
- else
- {
- task_get_bootstrap_port (mach_task_self (), &bootstrap);
- if (bootstrap == MACH_PORT_NULL)
- error (2, 0, "Must be started as a translator");
- }
- err = diskfs_init_diskfs ();
- if (err)
- error (4, err, "init");
-
- err = store_parsed_open (store_parsed, STORE_READONLY, &store);
- if (err)
- error (3, err, "%s", diskfs_disk_name);
-
- diskfs_readonly = diskfs_hard_readonly = 1;
+ /* Initialize the diskfs library, parse arguments, and open the store.
+ This starts the first diskfs thread for us. */
+ store = diskfs_init_main (NULL, argc, argv, &store_parsed, &bootstrap);
create_disk_pager ();
-
- diskfs_spawn_first_thread ();
-
+
read_sblock ();
-
+
fetch_root ();
-
+
diskfs_startup_diskfs (bootstrap, 0);
-
+
cthread_exit (0);
-
+
return 0;
}
@@ -187,7 +160,6 @@ diskfs_set_hypermetadata (int wait, int clean)
void
diskfs_readonly_changed (int readonly)
{
- /* We should never get here because we define our own diskfs_set_readonly
- above. */
+ /* We should never get here because we set diskfs_hard_readonly above. */
abort ();
}