2001-12-11 14:42:30 +03:00
/*
2002-01-10 21:12:26 +03:00
* Copyright ( C ) 2002 Sistina Software ( UK ) Limited .
2001-12-11 14:42:30 +03:00
*
2002-01-10 18:01:58 +03:00
* This file is released under the LGPL .
2001-12-11 14:42:30 +03:00
*/
2002-01-10 18:01:58 +03:00
# ifndef _LVM_LABEL_H
# define _LVM_LABEL_H
2001-12-11 14:42:30 +03:00
2002-01-10 18:01:58 +03:00
# include "uuid.h"
# include "device.h"
2001-12-11 19:49:40 +03:00
2002-01-10 18:01:58 +03:00
struct label {
2002-01-10 19:48:28 +03:00
struct id id ;
2002-01-10 18:01:58 +03:00
char volume_type [ 32 ] ;
uint32_t version [ 3 ] ;
2002-01-15 13:24:48 +03:00
void * extra_info ;
struct labeller * labeller ;
2002-01-10 18:01:58 +03: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 13:24:48 +03:00
/*
* Destroy a previously read label .
*/
int ( * destroy_label ) ( struct labeller * l , struct label * label ) ;
2002-01-10 18:01:58 +03:00
/*
* Destructor .
*/
void ( * destroy ) ( struct labeller * l ) ;
} ;
struct labeller {
struct label_ops * ops ;
void * private ;
2001-12-11 19:49:40 +03:00
} ;
2001-12-11 14:42:30 +03:00
2002-01-10 18:01:58 +03: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 13:43:32 +03: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 13:24:48 +03:00
void label_destroy ( struct label * lab ) ;
2002-01-10 18:01:58 +03: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 14:42:30 +03:00
2002-01-10 18:01:58 +03:00
# endif