Add padding space and a version number to the md_ioctl structre for future
extension. Add ability to create a preload disk giving an address and a length (suggested by imp) Fix bug relating to very small md(4) devices. Update md.c copyright to reflect the status of code copied from vn.c. (noticed by dillon)
This commit is contained in:
parent
b5073b49d9
commit
e06b153abe
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=70573
@ -52,6 +52,7 @@
|
|||||||
.Fl a
|
.Fl a
|
||||||
.Fl t Ar type
|
.Fl t Ar type
|
||||||
.Op Fl o Ar [no]option
|
.Op Fl o Ar [no]option
|
||||||
|
.Op Fl b Ar baseaddress
|
||||||
.Op Fl s Ar size
|
.Op Fl s Ar size
|
||||||
.Op Fl f Ar file
|
.Op Fl f Ar file
|
||||||
.Op Fl u Ar unit
|
.Op Fl u Ar unit
|
||||||
@ -80,8 +81,8 @@ Storage for this type of memory disk is allocated with
|
|||||||
.Xr malloc 9 .
|
.Xr malloc 9 .
|
||||||
This limits the size to the malloc bucket limit in the kernel.
|
This limits the size to the malloc bucket limit in the kernel.
|
||||||
.It Ar preload
|
.It Ar preload
|
||||||
This type represents memory disks which were instantiated by objects loaded
|
This type represents memory disks which are backed by memory outside the kernels normal address space.
|
||||||
by the bootloader. They can not be created on the fly.
|
These can be instantiated automatically by objects loaded by the bootloader or configured on the fly.
|
||||||
.It Ar vnode
|
.It Ar vnode
|
||||||
A file specified with
|
A file specified with
|
||||||
.Fl f Ar file
|
.Fl f Ar file
|
||||||
@ -89,6 +90,8 @@ becomes the backingstore for this memory disk.
|
|||||||
.It Ar swap
|
.It Ar swap
|
||||||
swapspace is used to back this memory disk.
|
swapspace is used to back this memory disk.
|
||||||
.El
|
.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
|
.It Fl f Ar file
|
||||||
Filename to use for the vnode type memory disk.
|
Filename to use for the vnode type memory disk.
|
||||||
.It Fl s Ar size
|
.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.
|
The basename of the disk is printed on stdout.
|
||||||
.It Ar [no]compress
|
.It Ar [no]compress
|
||||||
Enable/Disable compression features to reduce memory usage.
|
Enable/Disable compression features to reduce memory usage.
|
||||||
|
.It Ar [no]readonly
|
||||||
|
Enable/Disable readonly mode.
|
||||||
.El
|
.El
|
||||||
|
.It Fl u Ar unit
|
||||||
|
Force the
|
||||||
|
.Xr md(4)
|
||||||
|
device to use a specific unit number.
|
||||||
.El
|
.El
|
||||||
.Sh EXAMPLES
|
.Sh EXAMPLES
|
||||||
.Pp
|
.Pp
|
||||||
@ -138,6 +147,12 @@ To create and mount a 128MByte swap backed filesystem on
|
|||||||
.Dl newfs -f 4096 /dev/md10c
|
.Dl newfs -f 4096 /dev/md10c
|
||||||
.Dl tunefs -n enable /dev/md10c
|
.Dl tunefs -n enable /dev/md10c
|
||||||
.Dl mount /dev/md10c /tmp
|
.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
|
.Sh SEE ALSO
|
||||||
.Xr md 4 ,
|
.Xr md 4 ,
|
||||||
.Xr disklabel 8 ,
|
.Xr disklabel 8 ,
|
||||||
|
@ -44,7 +44,7 @@ main(int argc, char **argv)
|
|||||||
int cmdline = 0;
|
int cmdline = 0;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ch = getopt(argc, argv, "adf:o:s:t:u:");
|
ch = getopt(argc, argv, "ab:df:o:s:t:u:");
|
||||||
if (ch == -1)
|
if (ch == -1)
|
||||||
break;
|
break;
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
|
@ -54,13 +54,18 @@ enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWAP};
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct md_ioctl {
|
struct md_ioctl {
|
||||||
|
unsigned md_version; /* Structure layout version */
|
||||||
unsigned md_unit; /* unit number */
|
unsigned md_unit; /* unit number */
|
||||||
enum md_types md_type ; /* type of disk */
|
enum md_types md_type ; /* type of disk */
|
||||||
char md_file[MAXPATHLEN + 1]; /* pathname of file to mount */
|
char *md_file; /* pathname of file to mount */
|
||||||
unsigned md_size; /* (returned) size of disk */
|
unsigned md_size; /* size of disk in DEV_BSIZE units */
|
||||||
unsigned md_options; /* options */
|
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.
|
* Before you can use a unit, it must be configured with MDIOCSET.
|
||||||
* The configuration persists across opens and closes of the device;
|
* The configuration persists across opens and closes of the device;
|
||||||
|
Loading…
Reference in New Issue
Block a user