2 * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
3 * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
5 * This file is part of LVM2.
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.
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
24 typedef void (*lvm2_log_fn_t) (int level, const char *file, int line,
25 int dm_errno, const char *message);
29 #define LVM2_LOG_SUPPRESS 0
32 #define LVM2_LOG_FATAL 2
33 #define LVM2_LOG_ERROR 3
34 #define LVM2_LOG_PRINT 4
35 #define LVM2_LOG_VERBOSE 5
36 #define LVM2_LOG_VERY_VERBOSE 6
37 #define LVM2_LOG_DEBUG 7
40 * Define external function to replace the built-in logging function.
41 * It receives output line-by-line.
43 * level is the logging level (see above)
44 * file & line refer to the source code where the message originates.
46 void lvm2_log_fn(lvm2_log_fn_t log_fn);
50 * Returns a handle so repeated use of lvm2_run is more efficient.
52 void *lvm2_init(void);
55 * Set log level (as above) if using built-in logging function.
56 * Default is LVM2_LOG_PRINT. Use LVM2_LOG_SUPPRESS to suppress output.
58 void lvm2_log_level(void *handle, int level);
61 * Run an LVM2 command.
62 * Use NULL handle if the call is a one-off and you don't want to bother
63 * calling lvm2_init/lvm2_exit.
65 int lvm2_run(void *handle, const char *cmdline);
68 void lvm2_exit(void *handle);