Home | History | Annotate | Line # | Download | only in doc
design.txt revision 1.2.2.2
      1  1.2.2.2  mjf 		Device-mapper to libdevmapper protocol
      2  1.2.2.2  mjf 		
      3  1.2.2.2  mjf 
      4  1.2.2.2  mjf 
      5  1.2.2.2  mjf   1) Device mapper device in a POV of LVM it is an Logical Volume. 
      6  1.2.2.2  mjf      Logical Volume is virtual block device is made from logical blocks.
      7  1.2.2.2  mjf      These blocks are mapped to real device blocks with algorithm called 
      8  1.2.2.2  mjf      target.
      9  1.2.2.2  mjf      
     10  1.2.2.2  mjf      Functions available to dm device:
     11  1.2.2.2  mjf      	       create, remove, list, status of device.
     12  1.2.2.2  mjf 
     13  1.2.2.2  mjf   2) device mapper target is function which  defines how are Logical blocks 
     14  1.2.2.2  mjf      mapped to physical. There are many targets linear, stripe, mirror etc.
     15  1.2.2.2  mjf 
     16  1.2.2.2  mjf      Functions available to dm device:
     17  1.2.2.2  mjf      	       list available targets. They can be added with module in linux.     	       
     18  1.2.2.2  mjf 
     19  1.2.2.2  mjf   3) dm table.
     20  1.2.2.2  mjf      Every device-mapper device consits from one or more tables. Table specify 
     21  1.2.2.2  mjf      Start, length of logical blocks and target which is used to map them to 
     22  1.2.2.2  mjf      physical blocks. 
     23  1.2.2.2  mjf 
     24  1.2.2.2  mjf      {start} {length} {target} | {device} {target parameters}
     25  1.2.2.2  mjf      
     26  1.2.2.2  mjf      after | are target specific parameters listed. 
     27  1.2.2.2  mjf 
     28  1.2.2.2  mjf      Functions available to dm device:
     29  1.2.2.2  mjf      	       load, unload, table_status.
     30  1.2.2.2  mjf 
     31  1.2.2.2  mjf 
     32  1.2.2.2  mjf    List of available ioct calls
     33  1.2.2.2  mjf    
     34  1.2.2.2  mjf    DM_VERSION
     35  1.2.2.2  mjf    DM_REMOVE_ALL
     36  1.2.2.2  mjf    DM_LIST_DEVICES
     37  1.2.2.2  mjf    DM_DEV_CREATE
     38  1.2.2.2  mjf    DM_DEV_REMOVE
     39  1.2.2.2  mjf    DM_DEV_RENAME
     40  1.2.2.2  mjf    DM_DEV_SUSPEND
     41  1.2.2.2  mjf    DM_DEV_STATUS
     42  1.2.2.2  mjf    DM_DEV_WAIT
     43  1.2.2.2  mjf    DM_TABLE_LOAD
     44  1.2.2.2  mjf    DM_TABLE_CLEAR
     45  1.2.2.2  mjf    DM_TABLE_DEPS
     46  1.2.2.2  mjf    DM_TABLE_STATUS
     47  1.2.2.2  mjf    DM_LIST_VERSIONS
     48  1.2.2.2  mjf    DM_TARGET_MSG   
     49  1.2.2.2  mjf    DM_DEV_SET_GEOMETRY    
     50  1.2.2.2  mjf 
     51  1.2.2.2  mjf    1) DM_VERSION 
     52  1.2.2.2  mjf 
     53  1.2.2.2  mjf       in: struct dm-ioctl
     54  1.2.2.2  mjf 
     55  1.2.2.2  mjf       out: struct dm-ioctl
     56  1.2.2.2  mjf 
     57  1.2.2.2  mjf       Fuction:
     58  1.2.2.2  mjf 	 sends libdevmapper ioctl protocol version to kernel and ask for kernel version.
     59  1.2.2.2  mjf 	 If major and minor numbers are good we can continue.
     60  1.2.2.2  mjf 
     61  1.2.2.2  mjf    2) DM_REMOVE_ALL
     62  1.2.2.2  mjf       
     63  1.2.2.2  mjf       in: none
     64  1.2.2.2  mjf 
     65  1.2.2.2  mjf       out: none
     66  1.2.2.2  mjf 
     67  1.2.2.2  mjf       Function:
     68  1.2.2.2  mjf 	This ioctl will remove all DM devices/tables from DM driver.
     69  1.2.2.2  mjf 
     70  1.2.2.2  mjf   3) DM_LIST_DEVICES
     71  1.2.2.2  mjf      
     72  1.2.2.2  mjf      in: none
     73  1.2.2.2  mjf 	
     74  1.2.2.2  mjf      out: List of structures describing all devices created in driver.
     75  1.2.2.2  mjf 
     76  1.2.2.2  mjf      Function: 
     77  1.2.2.2  mjf        List all devices created in driver. (linux use struct dm_name_list)
     78  1.2.2.2  mjf 
     79  1.2.2.2  mjf      Implementation:
     80  1.2.2.2  mjf        Kernel driver will place list of struct dm_name_list behind 
     81  1.2.2.2  mjf        struct dm_ioctl in userspace. Kernel driver will list through
     82  1.2.2.2  mjf        the all devices and copyout info about them.
     83  1.2.2.2  mjf 
     84  1.2.2.2  mjf   4) DM_DEV_CREATE
     85  1.2.2.2  mjf      
     86  1.2.2.2  mjf      in: struct dm-ioctl(name/uuid)
     87  1.2.2.2  mjf 
     88  1.2.2.2  mjf      out: none
     89  1.2.2.2  mjf 
     90  1.2.2.2  mjf      Function:
     91  1.2.2.2  mjf        Create device in dm driver, with specified name/uuid(uuid is prefered). 
     92  1.2.2.2  mjf        (linux use struct dm_name_list)
     93  1.2.2.2  mjf        
     94  1.2.2.2  mjf  5) DM_DEV_REMOVE
     95  1.2.2.2  mjf      
     96  1.2.2.2  mjf     in: struct dm-ioctl(name/uuid)
     97  1.2.2.2  mjf 
     98  1.2.2.2  mjf     out: none
     99  1.2.2.2  mjf 
    100  1.2.2.2  mjf     Function:
    101  1.2.2.2  mjf       Remove device from dm driver list, also remove device tables.
    102  1.2.2.2  mjf 
    103  1.2.2.2  mjf  6) DM_DEV_RENAME
    104  1.2.2.2  mjf     
    105  1.2.2.2  mjf     in: struct dm-ioctl(name/uuid) and string found after dm-ioctl struct in buffer
    106  1.2.2.2  mjf 
    107  1.2.2.2  mjf     out: none
    108  1.2.2.2  mjf 
    109  1.2.2.2  mjf     Function:
    110  1.2.2.2  mjf       Rename device from name to string.
    111  1.2.2.2  mjf 
    112  1.2.2.2  mjf     Implementation:
    113  1.2.2.2  mjf        Kernel driver will find device with name from struct dm_ioctl-name/uuid.
    114  1.2.2.2  mjf        Change name of selected device to string foun behind struc dm_ioctl header 
    115  1.2.2.2  mjf        in userspace buffer.
    116  1.2.2.2  mjf 
    117  1.2.2.2  mjf  7) DM_DEV_SUSPEND
    118  1.2.2.2  mjf     
    119  1.2.2.2  mjf     in: dm-ioctl(name/uuid)
    120  1.2.2.2  mjf 
    121  1.2.2.2  mjf     out: none
    122  1.2.2.2  mjf 
    123  1.2.2.2  mjf     Function: 
    124  1.2.2.2  mjf       Suspend all io's  on device, after this ioctl. Already started io's will be done.
    125  1.2.2.2  mjf       Newer can't be started.
    126  1.2.2.2  mjf 
    127  1.2.2.2  mjf  8) DM_DEV_STATUS
    128  1.2.2.2  mjf 
    129  1.2.2.2  mjf     in: dm-ioctl(name/uuid)
    130  1.2.2.2  mjf 
    131  1.2.2.2  mjf     out: dm-ioctl (minor,open_count,target_count)
    132  1.2.2.2  mjf 
    133  1.2.2.2  mjf     Function: 
    134  1.2.2.2  mjf       Return status info about selected device
    135  1.2.2.2  mjf 
    136  1.2.2.2  mjf     Implementation:
    137  1.2.2.2  mjf        Kernel driver will find device with name from struct dm_ioctl-name/uuid.
    138  1.2.2.2  mjf        Change values minor,open_count,target_count in dm_ioctl struct for 
    139  1.2.2.2  mjf        selected device.
    140  1.2.2.2  mjf 
    141  1.2.2.2  mjf  9) DM_DEV_WAIT
    142  1.2.2.2  mjf 
    143  1.2.2.2  mjf     in: dm-ioctl(name/uuid)
    144  1.2.2.2  mjf 
    145  1.2.2.2  mjf     out: none
    146  1.2.2.2  mjf 
    147  1.2.2.2  mjf     Function: 
    148  1.2.2.2  mjf       Wait for device event to happen.
    149  1.2.2.2  mjf 
    150  1.2.2.2  mjf  10) DM_TABLE_LOAD
    151  1.2.2.2  mjf 
    152  1.2.2.2  mjf      in: dm-ioctl(name/uuid),table specification
    153  1.2.2.2  mjf 
    154  1.2.2.2  mjf      out: none
    155  1.2.2.2  mjf  
    156  1.2.2.2  mjf      Function: 
    157  1.2.2.2  mjf        Load table to selected device. Table is loaded to unused slot and than switched.
    158  1.2.2.2  mjf        (linux use struct dm_target_spec)
    159  1.2.2.2  mjf        
    160  1.2.2.2  mjf      Implementation:
    161  1.2.2.2  mjf        Kernel driver will find device with name from struct dm_ioctl-name/uuid.
    162  1.2.2.2  mjf        Table is added to the inactive slot. Every device can have more than one 
    163  1.2.2.2  mjf        table loaded. Tables are stored in SLIST. This ioctl also open physical 
    164  1.2.2.2  mjf        device spedcified in table and add it to dm_device specific pdev list.
    165  1.2.2.2  mjf 
    166  1.2.2.2  mjf  11) DM_TABLE_CLEAR
    167  1.2.2.2  mjf 
    168  1.2.2.2  mjf      in: dm-ioctl(name/uuid)
    169  1.2.2.2  mjf 
    170  1.2.2.2  mjf      out: none
    171  1.2.2.2  mjf 
    172  1.2.2.2  mjf      Function: 
    173  1.2.2.2  mjf        Remove table from unused slot. 
    174  1.2.2.2  mjf 
    175  1.2.2.2  mjf  12) DM_TABLE_DEPS
    176  1.2.2.2  mjf 
    177  1.2.2.2  mjf      in: dm-ioctl(name/uuid)
    178  1.2.2.2  mjf 
    179  1.2.2.2  mjf      out: list of dependiences devices
    180  1.2.2.2  mjf 
    181  1.2.2.2  mjf      Function: 
    182  1.2.2.2  mjf        Return set of device dependiences e.g. mirror device for mirror target etc..
    183  1.2.2.2  mjf 
    184  1.2.2.2  mjf  13) DM_TABLE_STATUS
    185  1.2.2.2  mjf 
    186  1.2.2.2  mjf      in: dm-ioctl(name/uuid)
    187  1.2.2.2  mjf 
    188  1.2.2.2  mjf      out: list of used tables from selected devices (linux use struct dm_target_spec)
    189  1.2.2.2  mjf 
    190  1.2.2.2  mjf      Function: 
    191  1.2.2.2  mjf        List all tables in active slot in device with name name/uuid.       
    192  1.2.2.2  mjf 
    193  1.2.2.2  mjf      Implementation:
    194  1.2.2.2  mjf        Kernel driver will find device with name from struct dm_ioctl-name/uuid.
    195  1.2.2.2  mjf        DM driver will copyout dm_target_spec structures behidn struct dm_ioctl.
    196  1.2.2.2  mjf 
    197  1.2.2.2  mjf  14) DM_LIST_VERSIONS	
    198  1.2.2.2  mjf      
    199  1.2.2.2  mjf      in: none
    200  1.2.2.2  mjf 
    201  1.2.2.2  mjf      out: list of all targets in device-mapper driver (linux use struct dm_target_versions)
    202  1.2.2.2  mjf 
    203  1.2.2.2  mjf      Function:
    204  1.2.2.2  mjf        List all available targets to libdevmapper.
    205  1.2.2.2  mjf 
    206  1.2.2.2  mjf      Implementation:
    207  1.2.2.2  mjf        Kernel driver will copy out known target versions.
    208  1.2.2.2  mjf 
    209  1.2.2.2  mjf  15) DM_TARGET_MSG
    210  1.2.2.2  mjf      
    211  1.2.2.2  mjf      in: message to driver (linux use struct dm_target_msg)
    212  1.2.2.2  mjf 
    213  1.2.2.2  mjf      out: none
    214  1.2.2.2  mjf 
    215  1.2.2.2  mjf      Function:
    216  1.2.2.2  mjf       Send message to kernel driver target.
    217  1.2.2.2  mjf      
    218  1.2.2.2  mjf 
    219  1.2.2.2  mjf  16) DM_DEV_SET_GEOMETRY
    220  1.2.2.2  mjf 
    221  1.2.2.2  mjf      Function:
    222  1.2.2.2  mjf        Set geometry of device-mapper driver.
    223  1.2.2.2  mjf 
    224  1.2.2.2  mjf 
    225  1.2.2.2  mjf 	    	NetBSD device-mapper driver implementation
    226  1.2.2.2  mjf 		
    227  1.2.2.2  mjf    device-mapper devices -> devs dm_dev.c
    228  1.2.2.2  mjf 
    229  1.2.2.2  mjf    This entity is created with DM_DEV_CREATE ioctl, and stores info 
    230  1.2.2.2  mjf    about every device in device mapper driver. It has two slots for 
    231  1.2.2.2  mjf    active and inactive table, list of active physical devices added 
    232  1.2.2.2  mjf    to this device and list of upcalled devices (for targets which use
    233  1.2.2.2  mjf    more than one physical device e.g. mirror, snapshot etc..).
    234  1.2.2.2  mjf 
    235  1.2.2.2  mjf    device-mapper physical devices -> pdevs dm_pdev.c
    236  1.2.2.2  mjf 
    237  1.2.2.2  mjf    This structure contains opened device VNODES. Because I physical 
    238  1.2.2.2  mjf    device can be found in more than one table loaded to different 
    239  1.2.2.2  mjf    dm devices. When device is destroyed I decrement all reference 
    240  1.2.2.2  mjf    counters for all added pdevs (I remove pdevs with ref_cnt == 0).
    241  1.2.2.2  mjf 
    242  1.2.2.2  mjf    device-mapper tables -> table  dm_table.c, dm_ioctl.c
    243  1.2.2.2  mjf    
    244  1.2.2.2  mjf    Table describe how is dm device made. What blocks are mapped with 
    245  1.2.2.2  mjf    what target. In our implementation every table contains pointer to
    246  1.2.2.2  mjf    target specific config data. These config_data are allocated in 
    247  1.2.2.2  mjf    DM_TABLE_LOAD function with target_init routine. Every table 
    248  1.2.2.2  mjf    contains pointer to used target.
    249  1.2.2.2  mjf 
    250  1.2.2.2  mjf    device-mapper targets -> target dm_target.c
    251  1.2.2.2  mjf    
    252  1.2.2.2  mjf    Target describes mapping of logical blocks to physical. It has 
    253  1.2.2.2  mjf    function pointers to function which does init, strategy, destroy,
    254  1.2.2.2  mjf    upcall functions.
    255  1.2.2.2  mjf 
    256  1.2.2.2  mjf    P.S I want to thank reinod@ for great help and guidance :).
    257  1.2.2.2  mjf    
    258  1.2.2.2  mjf 	
    259  1.2.2.2  mjf 
    260  1.2.2.2  mjf 		Desing of new device-mapper ioctl interface
    261  1.2.2.2  mjf 
    262  1.2.2.2  mjf    Basic architecture of device-mapper -> libdevmapper ioctl interface is this. 
    263  1.2.2.2  mjf    Libdevmapper allocate buffer with size of data_size. At the start of this buffer 
    264  1.2.2.2  mjf    dm-ioctl structure is placed. any aditional information from/to kernel are placed
    265  1.2.2.2  mjf    behind end (start of data part is pointed with data_start var.) of dm-ioctl struct. 
    266  1.2.2.2  mjf    
    267  1.2.2.2  mjf    Kernel driver then after ioctl call have to copyin data from userspace to kernel.
    268  1.2.2.2  mjf    When kernel driver want to send data back to user space library it must copyout 
    269  1.2.2.2  mjf    data from kernel.
    270  1.2.2.2  mjf 
    271  1.2.2.2  mjf 1) In Linux device-mapper ioctl interface implementation there are these ioctls.
    272  1.2.2.2  mjf 
    273  1.2.2.2  mjf    DM_VERSION                 *
    274  1.2.2.2  mjf    DM_REMOVE_ALL	      
    275  1.2.2.2  mjf    DM_LIST_DEVICES	      *
    276  1.2.2.2  mjf    DM_DEV_CREATE	      *
    277  1.2.2.2  mjf    DM_DEV_REMOVE	      *
    278  1.2.2.2  mjf    DM_DEV_RENAME	      *
    279  1.2.2.2  mjf    DM_DEV_SUSPEND	      
    280  1.2.2.2  mjf    DM_DEV_STATUS	      *
    281  1.2.2.2  mjf    DM_DEV_WAIT		      
    282  1.2.2.2  mjf    DM_TABLE_LOAD	      *
    283  1.2.2.2  mjf    DM_TABLE_CLEAR	      *
    284  1.2.2.2  mjf    DM_TABLE_DEPS	      
    285  1.2.2.2  mjf    DM_TABLE_STATUS	      *
    286  1.2.2.2  mjf    DM_LIST_VERSIONS	      *
    287  1.2.2.2  mjf    DM_TARGET_MSG   
    288  1.2.2.2  mjf    DM_DEV_SET_GEOMETRY
    289  1.2.2.2  mjf 
    290  1.2.2.2  mjf * means implemented in current version of NetBSD device-mapper.
    291  1.2.2.2  mjf 
    292  1.2.2.2  mjf   1a) struct dm_ioctl based ioctl calls
    293  1.2.2.2  mjf         These ioctl calls communicate only with basic dm_ioctl structure. 
    294  1.2.2.2  mjf 	
    295  1.2.2.2  mjf 	  DM_VERSION
    296  1.2.2.2  mjf   	  DM_DEV_STATUS
    297  1.2.2.2  mjf 	  DM_DEV_CREATE	  
    298  1.2.2.2  mjf 
    299  1.2.2.2  mjf   Protocol structure:
    300  1.2.2.2  mjf 	  
    301  1.2.2.2  mjf   struct dm_ioctl {
    302  1.2.2.2  mjf 	uint32_t version[3];	/* device-mapper kernel/userspace version */
    303  1.2.2.2  mjf 	uint32_t data_size;	/* total size of data passed in
    304  1.2.2.2  mjf 				 * including this struct */
    305  1.2.2.2  mjf 
    306  1.2.2.2  mjf 	uint32_t data_start;	/* offset to start of data
    307  1.2.2.2  mjf 				 * relative to start of this struct */
    308  1.2.2.2  mjf 
    309  1.2.2.2  mjf 	uint32_t target_count;	/* in/out */ /* This should be set when DM_TABLE_STATUS is called */
    310  1.2.2.2  mjf 	int32_t  open_count;	/* device open count */
    311  1.2.2.2  mjf 	uint32_t flags;		/* information flags  */
    312  1.2.2.2  mjf         uint32_t event_nr;      /* event counters not implemented */
    313  1.2.2.2  mjf 	uint32_t padding;
    314  1.2.2.2  mjf 
    315  1.2.2.2  mjf 	uint64_t dev;		/* dev_t */
    316  1.2.2.2  mjf 
    317  1.2.2.2  mjf 	char name[DM_NAME_LEN];	/* device name */
    318  1.2.2.2  mjf 	char uuid[DM_UUID_LEN];	/* unique identifier for
    319  1.2.2.2  mjf 				 * the block device */
    320  1.2.2.2  mjf 
    321  1.2.2.2  mjf         void *user_space_addr;  /*this is needed for netbsd 
    322  1.2.2.2  mjf 				  because they differently 
    323  1.2.2.2  mjf 				  implement ioctl syscall*/
    324  1.2.2.2  mjf   };
    325  1.2.2.2  mjf 
    326  1.2.2.2  mjf  As SOC task I want to replace this structure with proplib dict. Proplib dict 
    327  1.2.2.2  mjf  basic structure should be:
    328  1.2.2.2  mjf 
    329  1.2.2.2  mjf  Note: I don't need data_star, data_size and use_space_addr. They are needed 
    330  1.2.2.2  mjf        for current implementation. 
    331  1.2.2.2  mjf 
    332  1.2.2.2  mjf        <dict>
    333  1.2.2.2  mjf                <key>version</key>
    334  1.2.2.2  mjf                <string>...</string>
    335  1.2.2.2  mjf 
    336  1.2.2.2  mjf                <key>target_count</key>
    337  1.2.2.2  mjf 	       <integer></integer>
    338  1.2.2.2  mjf 
    339  1.2.2.2  mjf                <key>open_count</key>
    340  1.2.2.2  mjf 	       <integer></integer>
    341  1.2.2.2  mjf 
    342  1.2.2.2  mjf                <key>flags</key>
    343  1.2.2.2  mjf 	       <integer></integer>
    344  1.2.2.2  mjf 
    345  1.2.2.2  mjf                <key>event_nr</key>
    346  1.2.2.2  mjf 	       <integer></integer>
    347  1.2.2.2  mjf 
    348  1.2.2.2  mjf 	       <key>dev</key>
    349  1.2.2.2  mjf 	       <integer></integer>
    350  1.2.2.2  mjf 	       
    351  1.2.2.2  mjf 	       <key>name</key>
    352  1.2.2.2  mjf                <string>...</string>
    353  1.2.2.2  mjf 
    354  1.2.2.2  mjf                <key>uuid</key>
    355  1.2.2.2  mjf                <string>...</string>
    356  1.2.2.2  mjf 
    357  1.2.2.2  mjf 
    358  1.2.2.2  mjf 	       <dict>
    359  1.2.2.2  mjf 	        <!-- ioctl specific data -->
    360  1.2.2.2  mjf 	       </dict>
    361  1.2.2.2  mjf        </dict>
    362  1.2.2.2  mjf 
    363  1.2.2.2  mjf     1b) DM_LIST_VERSIONS ioctl
    364  1.2.2.2  mjf 
    365  1.2.2.2  mjf     This ioctl is used to get list of supported targets from kernel. Target 
    366  1.2.2.2  mjf     define mapping of Logical blocks to physical blocks on real device.
    367  1.2.2.2  mjf     There are linear, zero, error, mirror, snapshot, multipath etc... targets.
    368  1.2.2.2  mjf 
    369  1.2.2.2  mjf     For every target kernel driver should copyout this structure to userspace.
    370  1.2.2.2  mjf 
    371  1.2.2.2  mjf     Protocol structure:
    372  1.2.2.2  mjf 
    373  1.2.2.2  mjf     struct dm_target_versions {
    374  1.2.2.2  mjf         uint32_t next;
    375  1.2.2.2  mjf         uint32_t version[3];
    376  1.2.2.2  mjf 
    377  1.2.2.2  mjf         char name[0];
    378  1.2.2.2  mjf     };
    379  1.2.2.2  mjf 
    380  1.2.2.2  mjf     Because I need more then on dm_target_version I will need one major proplib 
    381  1.2.2.2  mjf     dictionary to store children dictionaries with target data.
    382  1.2.2.2  mjf 
    383  1.2.2.2  mjf     <dict>
    384  1.2.2.2  mjf         <dict ID="id">
    385  1.2.2.2  mjf 	   <key>version</key>
    386  1.2.2.2  mjf            <string>...</string>	
    387  1.2.2.2  mjf 
    388  1.2.2.2  mjf 	   <key>name</key>
    389  1.2.2.2  mjf 	   <string>...</string>	
    390  1.2.2.2  mjf 	</dict>
    391  1.2.2.2  mjf     </dict>
    392  1.2.2.2  mjf 
    393  1.2.2.2  mjf     2a) DM_LIST_DEVICES 
    394  1.2.2.2  mjf     
    395  1.2.2.2  mjf     This ioctl is used to list all devices defined in kernel driver. 
    396  1.2.2.2  mjf 
    397  1.2.2.2  mjf     Protocol structure:
    398  1.2.2.2  mjf     
    399  1.2.2.2  mjf     struct dm_name_list {
    400  1.2.2.2  mjf         uint64_t dev;
    401  1.2.2.2  mjf         uint32_t next;          /* offset to the next record from                                    
    402  1.2.2.2  mjf                                    the _start_ of this */
    403  1.2.2.2  mjf         char name[0];
    404  1.2.2.2  mjf     };
    405  1.2.2.2  mjf 
    406  1.2.2.2  mjf     Again because I can have more than one device in kernel driver I need one parent 
    407  1.2.2.2  mjf     dictionary and more children dictionaries.
    408  1.2.2.2  mjf 
    409  1.2.2.2  mjf         <dict>
    410  1.2.2.2  mjf           <dict ID="id">
    411  1.2.2.2  mjf 	   <key>dev</key>
    412  1.2.2.2  mjf            <integer>...</integer>	
    413  1.2.2.2  mjf 
    414  1.2.2.2  mjf 	   <key>name</key>
    415  1.2.2.2  mjf 	   <string>...</string>	
    416  1.2.2.2  mjf 	  </dict>
    417  1.2.2.2  mjf         </dict>
    418  1.2.2.2  mjf 	
    419  1.2.2.2  mjf    2b) DM_DEV_RENAME 
    420  1.2.2.2  mjf       This ioctl is called when libdevmapper want to rename device-mapper device.
    421  1.2.2.2  mjf       Libdevmapper library appends null terminated string to dm_ioctl struct in 
    422  1.2.2.2  mjf       userspace..
    423  1.2.2.2  mjf       
    424  1.2.2.2  mjf       <dict>
    425  1.2.2.2  mjf             <key>name</key>
    426  1.2.2.2  mjf       	    <string>...</string>
    427  1.2.2.2  mjf       </dict>
    428  1.2.2.2  mjf       
    429  1.2.2.2  mjf    2c) DM_DEV_CREATE, DM_DEV_REMOVE, DM_DEV_STATUS 
    430  1.2.2.2  mjf        Modify only dm_ioctl structure so I don't need to specify new structures.
    431  1.2.2.2  mjf 
    432  1.2.2.2  mjf 
    433  1.2.2.2  mjf   3a) DM_TABLE_LOAD, DM_TABLE_STATUS
    434  1.2.2.2  mjf       DM_TABLE_LOAD ioctl loads table to device. DM_TABLE_STATUS send info about 
    435  1.2.2.2  mjf       every table for selected device to userspace. Table is different for every 
    436  1.2.2.2  mjf       target basic table structure is this 
    437  1.2.2.2  mjf 
    438  1.2.2.2  mjf       {start} {length} {target} {additional information}
    439  1.2.2.2  mjf 
    440  1.2.2.2  mjf       e.g. 
    441  1.2.2.2  mjf       0 100 zero 
    442  1.2.2.2  mjf 
    443  1.2.2.2  mjf       0 100 linear /dev/wdba 384      
    444  1.2.2.2  mjf 
    445  1.2.2.2  mjf       Protocol structure:
    446  1.2.2.2  mjf 
    447  1.2.2.2  mjf       struct dm_target_spec {
    448  1.2.2.2  mjf         uint64_t sector_start;
    449  1.2.2.2  mjf         uint64_t length;
    450  1.2.2.2  mjf         int32_t status;         /* used when reading from kernel only */
    451  1.2.2.2  mjf 
    452  1.2.2.2  mjf         uint32_t next;
    453  1.2.2.2  mjf 
    454  1.2.2.2  mjf         char target_type[DM_MAX_TYPE_NAME];
    455  1.2.2.2  mjf         
    456  1.2.2.2  mjf         /*
    457  1.2.2.2  mjf          * Parameter string starts immediately after this object.
    458  1.2.2.2  mjf          * Be careful to add padding after string to ensure correct
    459  1.2.2.2  mjf          * alignment of subsequent dm_target_spec.
    460  1.2.2.2  mjf 	 */
    461  1.2.2.2  mjf       };
    462  1.2.2.2  mjf 
    463  1.2.2.2  mjf       <dict>
    464  1.2.2.2  mjf 	<key>sector_start</key>
    465  1.2.2.2  mjf 	<integer>...</integer>
    466  1.2.2.2  mjf 
    467  1.2.2.2  mjf 	<key>length</key>
    468  1.2.2.2  mjf 	<integer>...</integer>
    469  1.2.2.2  mjf 
    470  1.2.2.2  mjf 	<key>target_type</key>
    471  1.2.2.2  mjf 	<string>...</string>
    472  1.2.2.2  mjf 	
    473  1.2.2.2  mjf 	<key>aditional info</key>
    474  1.2.2.2  mjf 	<string>...</string>
    475  1.2.2.2  mjf       </dict>
    476