Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
ubd_kern.c File Reference
#include <linux/module.h>
#include <linux/init.h>
#include <linux/blkdev.h>
#include <linux/ata.h>
#include <linux/hdreg.h>
#include <linux/cdrom.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/ctype.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/platform_device.h>
#include <linux/scatterlist.h>
#include <asm/tlbflush.h>
#include <kern_util.h>
#include "mconsole_kern.h"
#include <init.h>
#include <irq_kern.h>
#include "ubd.h"
#include <os.h>
#include "cow.h"

Go to the source code of this file.

Data Structures

struct  io_thread_req
 
struct  cow
 
struct  ubd
 

Macros

#define UBD_SHIFT   4
 
#define DRIVER_NAME   "uml-blkdev"
 
#define MAX_DEV   (16)
 
#define OPEN_FLAGS
 
#define MAX_SG   64
 
#define DEFAULT_COW
 
#define DEFAULT_UBD
 
#define ROUND_BLOCK(n)   ((n + ((1 << 9) - 1)) & (-1 << 9))
 

Enumerations

enum  ubd_req { UBD_READ, UBD_WRITE }
 

Functions

 __setup ("fake_ide", fake_ide_setup)
 
 __uml_help (fake_ide_setup,"fake_ide\n"" Create ide0 entries that map onto ubd devices.\n\n")
 
 __setup ("ubd", ubd_setup)
 
 __uml_help (ubd_setup,"ubd<n><flags>=<filename>[(:|,)<filename2>]\n"" This is used to associate a device with a file in the underlying\n"" filesystem. When specifying two filenames, the first one is the\n"" COW name and the second is the backing file name. As separator you can\n"" use either a ':' or a ',': the first one allows writing things like;\n"" ubd0=~/Uml/root_cow:~/Uml/root_backing_file\n"" while with a ',' the shell would not expand the 2nd '~'.\n"" When using only one filename, UML will detect whether to treat it like\n"" a COW file or a backing file. To override this detection, add the 'd'\n"" flag:\n"" ubd0d=BackingFile\n"" Usually, there is a filesystem in the file, but \n"" that's not required. Swap devices containing swap files can be\n"" specified like this. Also, a file which doesn't contain a\n"" filesystem can have its contents read in the virtual \n"" machine by running 'dd' on the device. <n> must be in the range\n"" 0 to 7. Appending an 'r' to the number will cause that device\n"" to be mounted read-only. For example ubd1r=./ext_fs. Appending\n"" an 's' will cause data to be written to disk on the host immediately.\n"" 'c' will cause the device to be treated as being shared between multiple\n"" UMLs and file locking will be turned off - this is appropriate for a\n"" cluster filesystem and inappropriate at almost all other times.\n\n")
 
 __setup ("udb", udb_setup)
 
 __uml_help (udb_setup,"udb\n"" This option is here solely to catch ubd -> udb typos, which can be\n"" to impossible to catch visually unless you specifically look for\n"" them. The only result of any option starting with 'udb' is an error\n"" in the boot output.\n\n")
 
 __uml_exitcall (kill_io_thread)
 
 __initcall (ubd_mc_init)
 
 __initcall (ubd0_init)
 
 late_initcall (ubd_init)
 
 device_initcall (ubd_driver_init)
 
int io_thread (void *arg)
 

Variables

int kernel_fd = -1
 

Macro Definition Documentation

#define DEFAULT_COW
Value:
{ \
.file = NULL, \
.fd = -1, \
.bitmap = NULL, \
.bitmap_offset = 0, \
.data_offset = 0, \
}

Definition at line 154 of file ubd_kern.c.

#define DEFAULT_UBD
Value:
{ \
.file = NULL, \
.count = 0, \
.fd = -1, \
.size = -1, \
.boot_openflags = OPEN_FLAGS, \
.openflags = OPEN_FLAGS, \
.no_cow = 0, \
.shared = 0, \
.cow = DEFAULT_COW, \
.lock = __SPIN_LOCK_UNLOCKED(ubd_devs.lock), \
.request = NULL, \
.start_sg = 0, \
.end_sg = 0, \
.rq_pos = 0, \
}

Definition at line 162 of file ubd_kern.c.

#define DRIVER_NAME   "uml-blkdev"

Definition at line 84 of file ubd_kern.c.

#define MAX_DEV   (16)

Definition at line 95 of file ubd_kern.c.

#define MAX_SG   64

Definition at line 130 of file ubd_kern.c.

#define OPEN_FLAGS
Value:
((struct openflags) { .r = 1, .w = 1, .s = 0, .c = 0, \
.cl = 1 })

Definition at line 114 of file ubd_kern.c.

#define ROUND_BLOCK (   n)    ((n + ((1 << 9) - 1)) & (-1 << 9))

Definition at line 841 of file ubd_kern.c.

#define UBD_SHIFT   4

Definition at line 20 of file ubd_kern.c.

Enumeration Type Documentation

enum ubd_req
Enumerator:
UBD_READ 
UBD_WRITE 

Definition at line 44 of file ubd_kern.c.

Function Documentation

__initcall ( ubd_mc_init  )
__initcall ( ubd0_init  )
__setup ( "fake_ide"  ,
fake_ide_setup   
)
__setup ( "ubd"  ,
ubd_setup   
)
__setup ( "udb"  ,
udb_setup   
)
__uml_exitcall ( kill_io_thread  )
__uml_help ( fake_ide_setup  ,
"fake_ide\n"" Create ide0 entries that map onto ubd devices.\n\n  
)
__uml_help ( ubd_setup  ,
"ubd<n><flags = <filename>[(:|,)<filename2>]\n""    This is used to associate a device with a file in the underlying\n""    filesystem. When specifying two filenames,
the first one is the\n""COW name and the second is the backing file name.As separator you can\n""use either a ':'or a ,
':the first one allows writing things like;\n""  ubd0 = ~/Uml/root_cow:~/Uml/root_backing_file\n""    while with a ',' the shell would not expand the 2nd '~'.\n""    When using only one filename,
UML will detect whether to treat it like\n""a COW file or a backing file.To override this  detection,
add the 'd'\n""flag:\n""  ubd0d = BackingFile\n""    Usually,
there is a filesystem in the  file,
but\n""that's not required.Swap devices containing swap files can be\n""specified like this.  Also 
)
__uml_help ( udb_setup  ,
"udb\n"" This option is here solely to catch ubd -> udb  typos,
which can be\n""to impossible to catch visually unless you specifically look for\n""them.The only result of any option starting with 'udb'is an error\n""in the boot output.\n\n  
)
device_initcall ( ubd_driver_init  )
int io_thread ( void arg)

Definition at line 1430 of file ubd_kern.c.

late_initcall ( ubd_init  )

Variable Documentation

int kernel_fd = -1

Definition at line 1425 of file ubd_kern.c.