2001-09-25 16:49:28 +04:00
/*
2001-10-03 16:41:29 +04:00
* Copyright ( C ) 2001 Sistina Software ( UK ) Limited .
2001-09-25 16:49:28 +04:00
*
2001-10-03 16:41:29 +04:00
* This file is released under the GPL .
2001-09-25 16:49:28 +04:00
*/
# ifndef _LVM_DEVICE_H
# define _LVM_DEVICE_H
2001-10-03 16:41:29 +04:00
# include "lvm-types.h"
2001-10-25 15:34:55 +04:00
# include "list.h"
2001-10-03 16:41:29 +04:00
/*
* All devices in LVM will be represented by one of these .
* pointer comparisons are valid .
*/
struct device {
2001-10-31 15:47:01 +03:00
struct list aliases ; /* struct str_list from lvm-types.h */
2001-10-03 16:41:29 +04:00
dev_t dev ;
2001-11-14 13:01:52 +03:00
/* private */
int fd ;
2001-10-03 16:41:29 +04:00
} ;
/*
2001-11-14 13:01:52 +03:00
* All io should use these routines .
2001-10-03 16:41:29 +04:00
*/
int dev_get_size ( struct device * dev , uint64_t * size ) ;
2001-12-11 13:18:49 +03:00
int dev_get_sectsize ( struct device * dev , uint32_t * size ) ;
2001-11-14 13:01:52 +03:00
int dev_open ( struct device * dev , int flags ) ;
int dev_close ( struct device * dev ) ;
2001-10-03 16:41:29 +04:00
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-11-13 21:52:52 +03:00
int dev_zero ( struct device * dev , uint64_t offset , int64_t len ) ;
2001-10-03 16:41:29 +04:00
2001-11-14 13:01:52 +03:00
2001-10-25 18:04:18 +04:00
static inline const char * dev_name ( struct device * dev ) {
2001-10-31 15:47:01 +03:00
return list_item ( dev - > aliases . n , struct str_list ) - > str ;
2001-10-25 18:04:18 +04:00
}
2001-10-12 14:32:06 +04:00
static inline int is_lvm_partition ( const char * name ) {
return 1 ;
}
2001-09-25 16:49:28 +04:00
# endif