]> sourceware.org Git - lvm2.git/blob - tools/lvm2cmd.h
Reinstate accidentally-deleted line.
[lvm2.git] / tools / lvm2cmd.h
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 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 #ifndef _LVM_LOG_H
24 typedef void (*lvm2_log_fn_t) (int level, const char *file, int line,
25 int dm_errno, const char *message);
26
27 #endif
28
29 #define LVM2_LOG_SUPPRESS 0
30
31 /* Logging levels */
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
38
39 /*
40 * Define external function to replace the built-in logging function.
41 * It receives output line-by-line.
42 *
43 * level is the logging level (see above)
44 * file & line refer to the source code where the message originates.
45 */
46 void lvm2_log_fn(lvm2_log_fn_t log_fn);
47
48 /*
49 * Initialise library.
50 * Returns a handle so repeated use of lvm2_run is more efficient.
51 */
52 void *lvm2_init(void);
53
54 /*
55 * Disable any dmeventd calls that the library may otherwise do. Useful to avoid
56 * recursive calls from dmeventd to itself.
57 */
58 void lvm2_disable_dmeventd_monitoring(void *handle);
59
60 /*
61 * Set log level (as above) if using built-in logging function.
62 * Default is LVM2_LOG_PRINT. Use LVM2_LOG_SUPPRESS to suppress output.
63 */
64 void lvm2_log_level(void *handle, int level);
65
66 /*
67 * Run an LVM2 command.
68 * Use NULL handle if the call is a one-off and you don't want to bother
69 * calling lvm2_init/lvm2_exit.
70 */
71 int lvm2_run(void *handle, const char *cmdline);
72
73 /* Release handle */
74 void lvm2_exit(void *handle);
75
76 #ifdef __cplusplus
77 }
78 #endif
79 #endif
This page took 0.037204 seconds and 5 git commands to generate.