Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/rump_allserver Make it possible to specify the type ...
details: https://anonhg.NetBSD.org/src/rev/0ba0ce5c27a7
branches: trunk
changeset: 762206:0ba0ce5c27a7
user: pooka <pooka%NetBSD.org@localhost>
date: Thu Feb 17 16:03:05 2011 +0000
description:
Make it possible to specify the type of file (blk/chr/reg) that a
mapped file (-d) is exposed as within the rump kernel.
diffstat:
usr.bin/rump_allserver/rump_allserver.1 | 20 +++++++++++---
usr.bin/rump_allserver/rump_allserver.c | 43 ++++++++++++++++++++++++++++++--
2 files changed, 55 insertions(+), 8 deletions(-)
diffs (158 lines):
diff -r 0fd948463da7 -r 0ba0ce5c27a7 usr.bin/rump_allserver/rump_allserver.1
--- a/usr.bin/rump_allserver/rump_allserver.1 Thu Feb 17 15:41:34 2011 +0000
+++ b/usr.bin/rump_allserver/rump_allserver.1 Thu Feb 17 16:03:05 2011 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: rump_allserver.1,v 1.12 2011/02/04 20:06:23 pooka Exp $
+.\" $NetBSD: rump_allserver.1,v 1.13 2011/02/17 16:03:05 pooka Exp $
.\"
.\" Copyright (c) 2010 Antti Kantee. All rights reserved.
.\"
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd February 4, 2011
+.Dd February 17, 2011
.Dt RUMP_SERVER 1
.Os
.Sh NAME
@@ -70,7 +70,7 @@
.It Fl d Ar drivespec
The argument
.Ar drivespec
-maps a host file a block device in the rump fs namespace.
+maps a host file in the rump fs namespace.
The string
.Ar drivespec
must be of comma-separated
@@ -98,8 +98,7 @@
must contain an existing and valid disklabel within the first 64k.
.El
.Pp
-The following specifier is optional and used only if disklabel is
-not specified:
+The following are optional:
.Bl -tag -width hostpath1234
.It Ar offset
Offset of the mapping.
@@ -108,6 +107,17 @@
therefore is
.Fa [ offset , offset+size ] .
In case this parameter is not given, the default value 0 is used.
+.It Ar type
+The type of file that
+.Ar key
+is exposed as within the rump kernel.
+The possibilities are
+.Dq blk ,
+.Dq chr ,
+and
+.Dq reg
+for block device, character device and regular file, respectively.
+The default is a block device.
.El
.Pp
In case
diff -r 0fd948463da7 -r 0ba0ce5c27a7 usr.bin/rump_allserver/rump_allserver.c
--- a/usr.bin/rump_allserver/rump_allserver.c Thu Feb 17 15:41:34 2011 +0000
+++ b/usr.bin/rump_allserver/rump_allserver.c Thu Feb 17 16:03:05 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_allserver.c,v 1.16 2011/02/04 20:06:23 pooka Exp $ */
+/* $NetBSD: rump_allserver.c,v 1.17 2011/02/17 16:03:05 pooka Exp $ */
/*-
* Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved.
@@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: rump_allserver.c,v 1.16 2011/02/04 20:06:23 pooka Exp $");
+__RCSID("$NetBSD: rump_allserver.c,v 1.17 2011/02/17 16:03:05 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@@ -87,6 +87,8 @@
"offset",
#define DLABEL 4
"disklabel",
+#define DTYPE 5
+ "type",
NULL
};
@@ -99,6 +101,15 @@
enum rump_etfs_type type;
};
+struct etfstype {
+ const char *name;
+ enum rump_etfs_type type;
+} etfstypes[] = {
+ { "blk", RUMP_ETFS_BLK },
+ { "chr", RUMP_ETFS_CHR },
+ { "reg", RUMP_ETFS_REG },
+};
+
int
main(int argc, char *argv[])
{
@@ -129,10 +140,12 @@
char *key, *hostpath;
long long flen, foffset;
char partition;
+ int ftype;
flen = foffset = 0;
partition = 0;
key = hostpath = NULL;
+ ftype = -1;
options = optarg;
while (*options) {
switch (getsubopt(&options,
@@ -192,6 +205,28 @@
partition = *value;
break;
+ case DTYPE:
+ if (ftype != -1) {
+ fprintf(stderr,
+ "type already specified\n");
+ usage();
+ }
+
+ for (i = 0;
+ i < __arraycount(etfstypes);
+ i++) {
+ if (strcmp(etfstypes[i].name,
+ value) == 0)
+ break;
+ }
+ if (i == __arraycount(etfstypes)) {
+ fprintf(stderr,
+ "invalid type %s\n", value);
+ usage();
+ }
+ ftype = etfstypes[i].type;
+ break;
+
default:
fprintf(stderr, "invalid dtoken\n");
usage();
@@ -204,6 +239,8 @@
fprintf(stderr, "incomplete drivespec\n");
usage();
}
+ if (ftype == -1)
+ ftype = RUMP_ETFS_BLK;
if (netfs - curetfs == 0) {
etfs = realloc(etfs, (netfs+16)*sizeof(*etfs));
@@ -217,7 +254,7 @@
etfs[curetfs].flen = flen;
etfs[curetfs].foffset = foffset;
etfs[curetfs].partition = partition;
- etfs[curetfs].type = RUMP_ETFS_BLK;
+ etfs[curetfs].type = ftype;
curetfs++;
break;
Home |
Main Index |
Thread Index |
Old Index