2001-08-16 12:26:13 +04:00
/*
* device - mapper . h
*
* Copyright ( C ) 2001 Sistina Software
*
* This software is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation ; either version 2 , or ( at
* your option ) any later version .
*
* This software is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with GNU CC ; see the file COPYING . If not , write to
* the Free Software Foundation , 59 Temple Place - Suite 330 ,
* Boston , MA 02111 - 1307 , USA .
*/
/*
* Changelog
*
* 14 / 08 / 2001 - First version [ Joe Thornber ]
*/
# ifndef DEVICE_MAPPER_H
# define DEVICE_MAPPER_H
# include <linux/major.h>
2001-08-22 17:46:58 +04:00
/* FIXME: Use value from local range for now, for co-existence with LVM 1 */
# define DM_BLK_MAJOR 124
2001-08-16 12:26:13 +04:00
2001-08-31 19:13:33 +04:00
struct dm_table ;
2001-09-07 15:34:46 +04:00
struct text_region ;
2001-08-20 12:03:02 +04:00
typedef unsigned int offset_t ;
2001-08-16 12:26:13 +04:00
2001-09-07 15:34:46 +04:00
typedef void ( * dm_error_fn ) ( const char * message , void * private ) ;
2001-08-28 17:04:44 +04:00
/* constructor, destructor and map fn types */
2001-09-20 23:25:58 +04:00
typedef void * ( * dm_ctr_fn ) ( struct dm_table * t ,
2001-09-02 14:49:20 +04:00
offset_t b , offset_t l ,
2001-09-20 23:25:58 +04:00
struct text_region * args ) ;
2001-09-07 15:34:46 +04:00
2001-08-31 20:36:56 +04:00
typedef void ( * dm_dtr_fn ) ( struct dm_table * t , void * c ) ;
2001-09-14 20:22:02 +04:00
typedef int ( * dm_map_fn ) ( struct buffer_head * bh , int rw , void * context ) ;
typedef int ( * dm_err_fn ) ( struct buffer_head * bh , int rw , void * context ) ;
2001-08-16 12:26:13 +04:00
2001-09-13 22:30:05 +04:00
/*
* information about a target type
*/
struct target_type {
struct list_head list ;
const char * name ;
long use ;
struct module * module ;
dm_ctr_fn ctr ;
dm_dtr_fn dtr ;
dm_map_fn map ;
2001-09-14 20:22:02 +04:00
dm_err_fn err ;
2001-09-14 17:45:40 +04:00
unsigned long flags ;
2001-09-13 22:30:05 +04:00
} ;
2001-09-14 17:45:40 +04:00
# define TF_BMAP 0x0001 /* Target supports bmap operation */
2001-09-13 22:30:05 +04:00
int dm_register_target ( struct target_type * t ) ;
int dm_unregister_target ( struct target_type * t ) ;
2001-08-16 12:26:13 +04:00
2001-09-14 15:25:51 +04:00
struct block_device * dm_blkdev_get ( const char * path ) ;
int dm_blkdev_put ( struct block_device * ) ;
2001-08-31 19:13:33 +04:00
2001-09-14 13:45:35 +04:00
struct text_region {
const char * b ;
const char * e ;
} ;
/*
* These may be useful for people writing target
* types .
2001-08-31 19:13:33 +04:00
*/
2001-09-14 13:45:35 +04:00
int dm_get_number ( struct text_region * txt , unsigned int * n ) ;
int dm_get_line ( struct text_region * txt , struct text_region * line ) ;
int dm_get_word ( struct text_region * txt , struct text_region * word ) ;
void dm_txt_copy ( char * dest , size_t max , struct text_region * txt ) ;
void dm_eat_space ( struct text_region * txt ) ;
2001-08-20 20:12:22 +04:00
2001-09-13 22:30:05 +04:00
# endif /* DEVICE_MAPPER_H */
2001-08-16 12:26:13 +04:00
/*
* Local variables :
* c - file - style : " linux "
* End :
*/