2004-03-26 17:56:41 +03:00
/*
2004-03-30 23:35:44 +04:00
* Copyright ( C ) 2003 - 2004 Sistina Software , Inc . All rights reserved .
* Copyright ( C ) 2004 Red Hat , Inc . All rights reserved .
2004-03-26 17:56:41 +03:00
*
2004-03-30 23:35:44 +04:00
* This file is part of LVM2 .
*
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
2007-08-21 00:55:30 +04:00
* of the GNU Lesser General Public License v .2 .1 .
2004-03-30 23:35:44 +04:00
*
2007-08-21 00:55:30 +04:00
* You should have received a copy of the GNU Lesser General Public License
2004-03-30 23:35:44 +04:00
* along with this program ; if not , write to the Free Software Foundation ,
* Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
2004-03-26 17:56:41 +03:00
*/
# ifndef _LVM_CMDLIB_H
# define _LVM_CMDLIB_H
2010-06-16 17:01:25 +04:00
# ifdef __cplusplus
extern " C " {
# endif
2004-03-26 17:56:41 +03:00
# ifndef _LVM_LOG_H
typedef void ( * lvm2_log_fn_t ) ( int level , const char * file , int line ,
2009-09-26 04:29:13 +04:00
int dm_errno , const char * message ) ;
2004-03-26 17:56:41 +03:00
# endif
# define LVM2_LOG_SUPPRESS 0
/* Logging levels */
# define LVM2_LOG_FATAL 2
# define LVM2_LOG_ERROR 3
# define LVM2_LOG_PRINT 4
# define LVM2_LOG_VERBOSE 5
# define LVM2_LOG_VERY_VERBOSE 6
# define LVM2_LOG_DEBUG 7
/*
* Define external function to replace the built - in logging function .
* It receives output line - by - line .
*
* level is the logging level ( see above )
* file & line refer to the source code where the message originates .
*/
void lvm2_log_fn ( lvm2_log_fn_t log_fn ) ;
/*
* Initialise library .
* Returns a handle so repeated use of lvm2_run is more efficient .
*/
void * lvm2_init ( void ) ;
/*
* Set log level ( as above ) if using built - in logging function .
* Default is LVM2_LOG_PRINT . Use LVM2_LOG_SUPPRESS to suppress output .
*/
void lvm2_log_level ( void * handle , int level ) ;
/*
* Run an LVM2 command .
* Use NULL handle if the call is a one - off and you don ' t want to bother
* calling lvm2_init / lvm2_exit .
*/
int lvm2_run ( void * handle , const char * cmdline ) ;
/* Release handle */
void lvm2_exit ( void * handle ) ;
2010-06-16 17:01:25 +04:00
# ifdef __cplusplus
}
# endif
2004-03-26 17:56:41 +03:00
# endif