2001-09-28 15:42:25 +00:00
/*
2001-10-03 11:06:31 +00:00
* Copyright ( C ) 2001 Sistina Software ( UK ) Limited .
2001-09-28 15:42:25 +00:00
*
* This file is released under the GPL .
*/
2001-10-01 15:14:39 +00:00
# ifndef _LVM_DEV_CACHE_H
# define _LVM_DEV_CACHE_H
2001-09-28 15:42:25 +00:00
2001-10-04 10:13:07 +00:00
# include "lvm-types.h"
2001-10-01 22:12:10 +00:00
2001-10-01 15:27:16 +00:00
/*
* All devices in LVM will be represented by one of these .
* pointer comparisons are valid .
*/
2001-09-28 15:42:25 +00:00
struct device {
char * name ;
dev_t dev ;
} ;
2001-10-01 15:27:16 +00:00
struct dev_filter {
2001-10-01 22:12:10 +00:00
int ( * passes_filter ) ( struct dev_filter * f , struct device * dev ) ;
2001-10-01 15:27:16 +00:00
void * private ;
} ;
/*
* The global device cache .
*/
int dev_cache_init ( void ) ;
void dev_cache_exit ( void ) ;
int dev_cache_add_dir ( const char * path ) ;
2001-10-03 11:06:31 +00:00
struct device * dev_cache_get ( const char * name , struct dev_filter * f ) ;
2001-10-01 15:27:16 +00:00
/*
* Object for iterating through the cache .
*/
struct dev_iter ;
2001-10-01 15:28:28 +00:00
struct dev_iter * dev_iter_create ( struct dev_filter * f ) ;
2001-10-01 15:27:16 +00:00
void dev_iter_destroy ( struct dev_iter * iter ) ;
2001-10-01 15:43:51 +00:00
struct device * dev_iter_get ( struct dev_iter * iter ) ;
2001-09-28 15:42:25 +00:00
/*
* All io should use these routines , rather than opening the devices
2001-10-03 11:06:31 +00:00
* by hand . You do not have to call an open routine . ATM all io is
* immediately flushed .
2001-09-28 15:42:25 +00:00
*/
2001-10-03 11:06:31 +00:00
int dev_get_size ( struct device * dev , uint64_t * size ) ; /* in k */
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-09-28 15:42:25 +00:00
# endif