summaryrefslogtreecommitdiff
path: root/storeio
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-01-16 11:51:00 +0000
committerRoland McGrath <roland@gnu.org>2001-01-16 11:51:00 +0000
commit73cca3c79358164f2baa93ad75072998fed44cf4 (patch)
tree80a6313f7c7f60f5ce97858cc19e5d502270fe5a /storeio
parent600a46782cd5d273e9afeda26e926944faecf13a (diff)
2001-01-16 Roland McGrath <roland@frob.com>
* storeio.c (parse_opt): Set PARAMS->store_params.store_optional. (storeio_fsys): New global variable. (main): Use it. * dev.h: Declare it. * dev.c (dev_open): If DEV->store_name is null, open the underlying node using store_create.
Diffstat (limited to 'storeio')
-rw-r--r--storeio/dev.c19
-rw-r--r--storeio/dev.h4
-rw-r--r--storeio/storeio.c13
3 files changed, 26 insertions, 10 deletions
diff --git a/storeio/dev.c b/storeio/dev.c
index ba57f23f..96f60395 100644
--- a/storeio/dev.c
+++ b/storeio/dev.c
@@ -1,6 +1,6 @@
/* store `device' I/O
- Copyright (C) 1995,96,98,99,2000 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,98,99,2000,2001 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.org>
This program is free software; you can redistribute it and/or
@@ -140,9 +140,20 @@ dev_open (struct dev *dev)
assert (dev->store == 0);
- err = store_parsed_open (dev->store_name,
- dev->readonly ? STORE_READONLY : 0,
- &dev->store);
+ if (dev->store_name == 0)
+ {
+ /* This means we had no store arguments.
+ We are to operate on our underlying node. */
+ err = store_create (storeio_fsys->underlying,
+ dev->readonly ? STORE_READONLY : 0,
+ &dev->store);
+
+ }
+ else
+ /* Open based on the previously parsed store arguments. */
+ err = store_parsed_open (dev->store_name,
+ dev->readonly ? STORE_READONLY : 0,
+ &dev->store);
if (err)
return err;
diff --git a/storeio/dev.h b/storeio/dev.h
index b223fe7e..52960cd7 100644
--- a/storeio/dev.h
+++ b/storeio/dev.h
@@ -1,6 +1,6 @@
/* store `device' I/O
- Copyright (C) 1995,96,97,99,2000 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,99,2000,2001 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.org>
This program is free software; you can redistribute it and/or
@@ -25,6 +25,8 @@
#include <rwlock.h>
#include <hurd/store.h>
+extern struct trivfs_control *storeio_fsys;
+
/* Information about backend store, which we presumptively call a "device". */
struct dev
{
diff --git a/storeio/storeio.c b/storeio/storeio.c
index 7c0d4fe4..5b82a6c8 100644
--- a/storeio/storeio.c
+++ b/storeio/storeio.c
@@ -1,6 +1,6 @@
/* A translator for doing I/O to stores
- Copyright (C) 1995,96,97,98,99,2000 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,98,99,2000,01 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.org>
This program is free software; you can redistribute it and/or
@@ -97,6 +97,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
The default_type member is our input parameter to it. */
bzero (&params->store_params, sizeof params->store_params);
params->store_params.default_type = "device";
+ params->store_params.store_optional = 1;
state->child_inputs[0] = &params->store_params;
break;
@@ -113,12 +114,13 @@ parse_opt (int key, char *arg, struct argp_state *state)
static const struct argp_child argp_kids[] = { { &store_argp }, {0} };
static const struct argp argp = { options, parse_opt, 0, doc, argp_kids };
+struct trivfs_control *storeio_fsys;
+
int
main (int argc, char *argv[])
{
error_t err;
mach_port_t bootstrap;
- struct trivfs_control *fsys;
struct dev device;
struct storeio_argp_params params;
@@ -133,14 +135,15 @@ main (int argc, char *argv[])
error (2, 0, "Must be started as a translator");
/* Reply to our parent */
- err = trivfs_startup (bootstrap, 0, 0, 0, 0, 0, &fsys);
+ err = trivfs_startup (bootstrap, 0, 0, 0, 0, 0, &storeio_fsys);
if (err)
error (3, err, "trivfs_startup");
- fsys->hook = &device;
+ storeio_fsys->hook = &device;
/* Launch. */
- ports_manage_port_operations_multithread (fsys->pi.bucket, trivfs_demuxer,
+ ports_manage_port_operations_multithread (storeio_fsys->pi.bucket,
+ trivfs_demuxer,
30*1000, 5*60*1000, 0);
return 0;