summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sbin/mdconfig/mdconfig.819
-rw-r--r--sbin/mdconfig/mdconfig.c2
-rw-r--r--sys/sys/mdioctl.h9
3 files changed, 25 insertions, 5 deletions
diff --git a/sbin/mdconfig/mdconfig.8 b/sbin/mdconfig/mdconfig.8
index 824bacc..c7ccba9 100644
--- a/sbin/mdconfig/mdconfig.8
+++ b/sbin/mdconfig/mdconfig.8
@@ -52,6 +52,7 @@
.Fl a
.Fl t Ar type
.Op Fl o Ar [no]option
+.Op Fl b Ar baseaddress
.Op Fl s Ar size
.Op Fl f Ar file
.Op Fl u Ar unit
@@ -80,8 +81,8 @@ Storage for this type of memory disk is allocated with
.Xr malloc 9 .
This limits the size to the malloc bucket limit in the kernel.
.It Ar preload
-This type represents memory disks which were instantiated by objects loaded
-by the bootloader. They can not be created on the fly.
+This type represents memory disks which are backed by memory outside the kernels normal address space.
+These can be instantiated automatically by objects loaded by the bootloader or configured on the fly.
.It Ar vnode
A file specified with
.Fl f Ar file
@@ -89,6 +90,8 @@ becomes the backingstore for this memory disk.
.It Ar swap
swapspace is used to back this memory disk.
.El
+.It Fl b Ar baseaddress
+Starting address in kernel virtual space of the memory to be used for a ``preload'' type disk.
.It Fl f Ar file
Filename to use for the vnode type memory disk.
.It Fl s Ar size
@@ -108,7 +111,13 @@ Automatically allocate the next free unit number for this disk.
The basename of the disk is printed on stdout.
.It Ar [no]compress
Enable/Disable compression features to reduce memory usage.
+.It Ar [no]readonly
+Enable/Disable readonly mode.
.El
+.It Fl u Ar unit
+Force the
+.Xr md(4)
+device to use a specific unit number.
.El
.Sh EXAMPLES
.Pp
@@ -138,6 +147,12 @@ To create and mount a 128MByte swap backed filesystem on
.Dl newfs -f 4096 /dev/md10c
.Dl tunefs -n enable /dev/md10c
.Dl mount /dev/md10c /tmp
+.Pp
+It is practically impossible to give a universal example of the ``preload'' type of disk,
+it is mainly useful in the embedded systems market, but to give a feel for how it works:
+On most standard PC architecture machines this will create a disk backed by the BIOS ROM:
+.Pp
+.Dl mdconfig -a -t preload -s 128k -b 0xc00fe000
.Sh SEE ALSO
.Xr md 4 ,
.Xr disklabel 8 ,
diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c
index dca1b40..9f43877 100644
--- a/sbin/mdconfig/mdconfig.c
+++ b/sbin/mdconfig/mdconfig.c
@@ -44,7 +44,7 @@ main(int argc, char **argv)
int cmdline = 0;
for (;;) {
- ch = getopt(argc, argv, "adf:o:s:t:u:");
+ ch = getopt(argc, argv, "ab:df:o:s:t:u:");
if (ch == -1)
break;
switch (ch) {
diff --git a/sys/sys/mdioctl.h b/sys/sys/mdioctl.h
index 6782e1a..1507e6f 100644
--- a/sys/sys/mdioctl.h
+++ b/sys/sys/mdioctl.h
@@ -54,13 +54,18 @@ enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWAP};
*/
struct md_ioctl {
+ unsigned md_version; /* Structure layout version */
unsigned md_unit; /* unit number */
enum md_types md_type ; /* type of disk */
- char md_file[MAXPATHLEN + 1]; /* pathname of file to mount */
- unsigned md_size; /* (returned) size of disk */
+ char *md_file; /* pathname of file to mount */
+ unsigned md_size; /* size of disk in DEV_BSIZE units */
unsigned md_options; /* options */
+ u_int64_t md_base; /* base address */
+ int pad[100]; /* padding for future ideas */
};
+#define MDIOVERSION 1
+
/*
* Before you can use a unit, it must be configured with MDIOCSET.
* The configuration persists across opens and closes of the device;
OpenPOWER on IntegriCloud