summaryrefslogtreecommitdiff
path: root/storeio
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-11-18 06:23:27 +0000
committerRoland McGrath <roland@gnu.org>1999-11-18 06:23:27 +0000
commit0e224593fa805f84729abf366db3910dc0b28bfa (patch)
tree9faebe3a3a31c328c000ac87fe4053ec1e70acb7 /storeio
parenta28b7971a74ad65d1d38fc96f0b53283abac15b4 (diff)
1999-11-14 Roland McGrath <roland@baalperazim.frob.com>
* storeio.c (check_open_hook): Don't check for D_NO_SUCH_DEVICE here. Translation to ENXIO now done in libstore. * dev.h (struct dev): New member `enforced'. * storeio.c (enforce_store): New variable. (options, parse_opt, trivfs_append_args): Grok new option --enforced/-e to set enforce_store. (check_open_hook): Set DEVICE->enforced from enforce_store. * io.c (trivfs_S_file_get_storage_info): If DEV->enforced is set and the store flags lack STORE_ENFORCED, then return STORAGE_OTHER.
Diffstat (limited to 'storeio')
-rw-r--r--storeio/storeio.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/storeio/storeio.c b/storeio/storeio.c
index 0224aa11..29b8dd6a 100644
--- a/storeio/storeio.c
+++ b/storeio/storeio.c
@@ -38,6 +38,7 @@ static struct argp_option options[] =
{"readonly", 'r', 0, 0,"Disallow writing"},
{"writable", 'w', 0, 0,"Allow writing"},
{"no-cache", 'c', 0, 0,"Never cache data--user io does direct device io"},
+ {"enforced", 'e', 0, 0,"Never reveal underlying devices, even to root"},
{"rdev", 'n', "ID", 0,
"The stat rdev number for this node; may be either a"
" single integer, or of the form MAJOR,MINOR"},
@@ -59,6 +60,9 @@ static int readonly;
/* Nonzero if user gave --no-cache flag. */
static int inhibit_cache;
+/* Nonzero if user gave --enforced flag. */
+static int enforce_store;
+
/* A unixy device number to return when the device is stat'd. */
static int rdev;
@@ -72,6 +76,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
case 'w': readonly = 0; break;
case 'c': inhibit_cache = 1; break;
+ case 'e': enforce_store = 1; break;
case 'n':
{
@@ -156,6 +161,9 @@ trivfs_append_args (struct trivfs_control *trivfs_control,
if (!err && inhibit_cache)
err = argz_add (argz, argz_len, "--no-cache");
+ if (!err && enforce_store)
+ err = argz_add (argz, argz_len, "--enforced");
+
if (! err)
err = argz_add (argz, argz_len, readonly ? "--readonly" : "--writable");
@@ -186,14 +194,12 @@ check_open_hook (struct trivfs_control *trivfs_control,
&device);
if (err)
device = NULL;
+ else
+ device->enforced = enforce_store;
if (err && (flags & (O_READ|O_WRITE)) == 0)
/* If we're not opening for read or write, then just ignore the
error, as this allows stat to word correctly. XXX */
err = 0;
- if (err == D_NO_SUCH_DEVICE)
- /* Give the canonical POSIX error code for an absent device,
- rather than letting the Mach code propagate up. */
- err = ENXIO;
}
mutex_unlock (&device_lock);