diff options
author | Roland McGrath <roland@gnu.org> | 2002-01-02 01:32:36 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2002-01-02 01:32:36 +0000 |
commit | bc86c37cdef33382667000557f254e3474f7b612 (patch) | |
tree | 2a19b93d23d02377b6ddc2b524ba4aff8a1e9d27 | |
parent | e809db1d3f4e7658927d3dfd0c0c57a5fed4dc85 (diff) |
2001-12-28 Roland McGrath <roland@frob.com>
* dev.h (struct dev): New member `no_fileio' (flag).
* storeio.c (options): Add --no-file-io/-F.
(parse_opt): Parse it to set PARAMS->dev->no_fileio.
(trivfs_append_args): Add --no-file-io if it's set.
* dev.c (dev_open): Pass STORE_NOFILEIO flag if DEV->no_fileio is set.
-rw-r--r-- | storeio/dev.c | 12 | ||||
-rw-r--r-- | storeio/dev.h | 2 | ||||
-rw-r--r-- | storeio/storeio.c | 6 |
3 files changed, 12 insertions, 8 deletions
diff --git a/storeio/dev.c b/storeio/dev.c index 0c795a4b..f82200e8 100644 --- a/storeio/dev.c +++ b/storeio/dev.c @@ -137,6 +137,8 @@ error_t dev_open (struct dev *dev) { error_t err; + const int flags = ((dev->readonly ? STORE_READONLY : 0) + | (dev->no_fileio ? STORE_NO_FILEIO : 0)); assert (dev->store == 0); @@ -144,20 +146,16 @@ dev_open (struct dev *dev) { /* 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, - 0, &dev->store); + err = store_create (storeio_fsys->underlying, flags, 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); + err = store_parsed_open (dev->store_name, flags, &dev->store); if (err) return err; /* Inactivate the store, it will be activated at first access. - We ignore possible EINVAL here. XXX Pass STORE_INACTIVE to + We ignore possible EINVAL here . XXX Pass STORE_INACTIVE to store_create/store_parsed_open instead when libstore is fixed to support this. */ store_set_flags (dev->store, STORE_INACTIVE); diff --git a/storeio/dev.h b/storeio/dev.h index d5b9d1a4..23924ca5 100644 --- a/storeio/dev.h +++ b/storeio/dev.h @@ -40,6 +40,7 @@ struct dev int readonly; /* Nonzero if user gave --readonly flag. */ int enforced; /* Nonzero if user gave --enforced flag. */ + int no_fileio; /* Nonzero if user gave --no-fileio flag. */ dev_t rdev; /* A unixy device number for st_rdev. */ /* The current owner of the open device. For terminals, this affects @@ -63,7 +64,6 @@ struct dev and don't need to be initialized or cleaned up. */ int inhibit_cache; - /* A bitmask corresponding to the part of an offset that lies within a device block. */ unsigned block_mask; diff --git a/storeio/storeio.c b/storeio/storeio.c index 84b90067..6dffb716 100644 --- a/storeio/storeio.c +++ b/storeio/storeio.c @@ -37,6 +37,8 @@ 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"}, + {"no-file-io", 'F', 0, 0,"Never perform io via plain file io RPCs"}, + {"no-fileio", 0, 0, OPTION_ALIAS | OPTION_HIDDEN}, {"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" @@ -68,6 +70,7 @@ parse_opt (int key, char *arg, struct argp_state *state) case 'c': params->dev->inhibit_cache = 1; break; case 'e': params->dev->enforced = 1; break; + case 'F': params->dev->no_fileio = 1; break; case 'n': { @@ -170,6 +173,9 @@ trivfs_append_args (struct trivfs_control *trivfs_control, if (!err && dev->enforced) err = argz_add (argz, argz_len, "--enforced"); + if (!err && dev->no_fileio) + err = argz_add (argz, argz_len, "--no-file-io"); + if (! err) err = argz_add (argz, argz_len, dev->readonly ? "--readonly" : "--writable"); |