home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / lvm2cmd.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-10-04  |  1.8 KB  |  66 lines

  1. /*
  2.  * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.  
  3.  * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
  4.  *
  5.  * This file is part of LVM2.
  6.  *
  7.  * This copyrighted material is made available to anyone wishing to use,
  8.  * modify, copy, or redistribute it subject to the terms and conditions
  9.  * of the GNU Lesser General Public License v.2.1.
  10.  *
  11.  * You should have received a copy of the GNU Lesser General Public License
  12.  * along with this program; if not, write to the Free Software Foundation,
  13.  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  14.  */
  15.  
  16. #ifndef _LVM_CMDLIB_H
  17. #define _LVM_CMDLIB_H
  18.  
  19. #ifndef _LVM_LOG_H
  20. typedef void (*lvm2_log_fn_t) (int level, const char *file, int line,
  21.                    const char *message);
  22. #endif
  23.  
  24. #define LVM2_LOG_SUPPRESS    0
  25.  
  26. /* Logging levels */
  27. #define LVM2_LOG_FATAL        2
  28. #define LVM2_LOG_ERROR        3
  29. #define LVM2_LOG_PRINT        4
  30. #define LVM2_LOG_VERBOSE     5
  31. #define LVM2_LOG_VERY_VERBOSE    6
  32. #define LVM2_LOG_DEBUG        7
  33.  
  34. /*
  35.  * Define external function to replace the built-in logging function.
  36.  * It receives output line-by-line.
  37.  *
  38.  * level is the logging level (see above)
  39.  * file & line refer to the source code where the message originates.
  40.  */
  41. void lvm2_log_fn(lvm2_log_fn_t log_fn);
  42.  
  43. /*
  44.  * Initialise library.
  45.  * Returns a handle so repeated use of lvm2_run is more efficient.
  46.  */ 
  47. void *lvm2_init(void);
  48.  
  49. /*
  50.  * Set log level (as above) if using built-in logging function. 
  51.  * Default is LVM2_LOG_PRINT.  Use LVM2_LOG_SUPPRESS to suppress output.
  52.  */
  53. void lvm2_log_level(void *handle, int level);
  54.  
  55. /*
  56.  * Run an LVM2 command. 
  57.  * Use NULL handle if the call is a one-off and you don't want to bother 
  58.  * calling lvm2_init/lvm2_exit.
  59.  */
  60. int lvm2_run(void *handle, const char *cmdline);
  61.  
  62. /* Release handle */
  63. void lvm2_exit(void *handle);
  64.  
  65. #endif
  66.