2001-12-11 11:42:30 +00:00
/*
2002-01-10 18:12:26 +00:00
* Copyright ( C ) 2002 Sistina Software ( UK ) Limited .
2001-12-11 11:42:30 +00:00
*
2002-01-10 15:01:58 +00:00
* This file is released under the LGPL .
2001-12-11 11:42:30 +00:00
*/
2002-01-10 15:01:58 +00:00
# ifndef _LVM_LABEL_H
# define _LVM_LABEL_H
2001-12-11 11:42:30 +00:00
2002-01-10 15:01:58 +00:00
# include "uuid.h"
# include "device.h"
2001-12-11 16:49:40 +00:00
2002-01-10 15:01:58 +00:00
struct label {
2002-01-10 16:48:28 +00:00
struct id id ;
2002-01-10 15:01:58 +00:00
char volume_type [ 32 ] ;
uint32_t version [ 3 ] ;
2002-01-15 10:24:48 +00:00
void * extra_info ;
struct labeller * labeller ;
2002-01-10 15:01:58 +00:00
} ;
struct labeller ;
struct label_ops {
/*
* Is the device labelled with this format ?
*/
int ( * can_handle ) ( struct labeller * l , struct device * dev ) ;
/*
* Write a label to a volume .
*/
int ( * write ) ( struct labeller * l ,
struct device * dev , struct label * label ) ;
/*
* Remove a label from a device .
*/
int ( * remove ) ( struct labeller * l , struct device * dev ) ;
/*
* Read a label from a volume .
*/
int ( * read ) ( struct labeller * l ,
struct device * dev , struct label * * label ) ;
/*
* Additional consistency checks for the paranoid .
*/
int ( * verify ) ( struct labeller * l , struct device * dev ) ;
2002-01-15 10:24:48 +00:00
/*
* Destroy a previously read label .
*/
2002-01-15 17:37:23 +00:00
void ( * destroy_label ) ( struct labeller * l , struct label * label ) ;
2002-01-15 10:24:48 +00:00
2002-01-10 15:01:58 +00:00
/*
* Destructor .
*/
void ( * destroy ) ( struct labeller * l ) ;
} ;
struct labeller {
struct label_ops * ops ;
void * private ;
2001-12-11 16:49:40 +00:00
} ;
2001-12-11 11:42:30 +00:00
2002-01-10 15:01:58 +00:00
int label_init ( void ) ;
void label_exit ( void ) ;
int label_register_handler ( const char * name , struct labeller * handler ) ;
struct labeller * label_get_handler ( const char * name ) ;
2002-01-11 10:43:32 +00:00
int label_remove ( struct device * dev ) ;
int label_read ( struct device * dev , struct label * * result ) ;
int label_verify ( struct device * dev ) ;
2002-01-15 10:24:48 +00:00
void label_destroy ( struct label * lab ) ;
2002-01-10 15:01:58 +00:00
/*
* We ' ll support two label types : the ' pretend the
* LVM1 pv structure at the begining of the disk
* is a label ' hack , and pjc ' s 1 sector labels at
* the front and back of the device .
*/
2001-12-11 11:42:30 +00:00
2002-01-10 15:01:58 +00:00
# endif