2001-09-25 12:49:28 +00:00
/*
2001-10-03 12:41:29 +00:00
* Copyright ( C ) 2001 Sistina Software ( UK ) Limited .
2001-09-25 12:49:28 +00:00
*
2001-10-03 12:41:29 +00:00
* This file is released under the GPL .
2001-09-25 12:49:28 +00:00
*/
# ifndef _LVM_DEVICE_H
# define _LVM_DEVICE_H
2001-10-03 12:41:29 +00:00
# include "lvm-types.h"
2001-10-25 11:34:55 +00:00
# include "list.h"
2001-10-03 12:41:29 +00:00
/*
* All devices in LVM will be represented by one of these .
* pointer comparisons are valid .
*/
struct device {
2001-10-31 12:47:01 +00:00
struct list aliases ; /* struct str_list from lvm-types.h */
2001-10-03 12:41:29 +00:00
dev_t dev ;
} ;
/*
* All io should use these routines , rather than opening the devices
* by hand . You do not have to call an open routine . ATM all io is
* immediately flushed .
*/
int dev_get_size ( struct device * dev , uint64_t * size ) ;
int64_t dev_read ( struct device * dev ,
uint64_t offset , int64_t len , void * buffer ) ;
int64_t dev_write ( struct device * dev ,
uint64_t offset , int64_t len , void * buffer ) ;
2001-10-25 14:04:18 +00:00
static inline const char * dev_name ( struct device * dev ) {
2001-10-31 12:47:01 +00:00
return list_item ( dev - > aliases . n , struct str_list ) - > str ;
2001-10-25 14:04:18 +00:00
}
2001-10-12 10:32:06 +00:00
static inline int is_lvm_partition ( const char * name ) {
return 1 ;
}
2001-09-25 12:49:28 +00:00
2001-10-03 17:03:25 +00:00
# define LVM_DEFAULT_DIR_PREFIX " / dev / "
/* FIXME Allow config file override */
static inline char * lvm_dir_prefix ( void ) { return LVM_DEFAULT_DIR_PREFIX ; }
2001-09-25 12:49:28 +00:00
# endif