2001-08-16 12:26:13 +04:00
/*
* device - mapper . h
*
2001-09-26 18:32:07 +04:00
* Copyright ( C ) 2001 Sistina Software ( UK ) Limited .
2001-08-16 12:26:13 +04:00
*
2001-09-26 18:32:07 +04:00
* This file is released under the GPL .
2001-08-16 12:26:13 +04:00
*/
/*
* 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-26 18:32:07 +04:00
struct dm_dev ;
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-09-26 18:32:07 +04:00
/*
* constructor , destructor and map fn types
*/
typedef int ( * dm_ctr_fn ) ( struct dm_table * t , offset_t b , offset_t l ,
2001-10-17 15:34:50 +04:00
char * args , void * * context ) ;
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-10-17 15:34:50 +04:00
typedef char * ( * dm_print_fn ) ( void * context ) ;
2001-09-26 18:32:07 +04:00
/*
* Contructors should call this to make sure any
* destination devices are handled correctly
* ( ie . opened / closed ) .
*/
2001-09-26 23:48:20 +04:00
int dm_table_get_device ( struct dm_table * t , const char * path ,
struct dm_dev * * result ) ;
2001-09-26 21:32:57 +04:00
void dm_table_put_device ( struct dm_table * table , struct dm_dev * d ) ;
2001-09-26 18:32:07 +04:00
2001-09-13 22:30:05 +04:00
/*
* information about a target type
*/
struct target_type {
const char * name ;
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-10-17 15:34:50 +04:00
dm_print_fn print ;
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-10-17 15:34:50 +04:00
static inline char * next_token ( char * * p )
{
static const char * delim = " \t " ;
char * r ;
do {
r = strsep ( p , delim ) ;
} while ( r & & * r = = 0 ) ;
2001-09-14 13:45:35 +04:00
2001-10-17 15:34:50 +04:00
return r ;
}
2001-08-20 20:12:22 +04:00
2001-09-26 18:32:07 +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 :
*/