Sync usage with man page.
[netbsd-mini2440.git] / external / gpl2 / lvm2 / dist / lib / misc / lvm-globals.c
blob70bebc7d1064080dcc4dd0c61fb34b980b6df6d8
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
5 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
7 * This file is part of LVM2.
9 * This copyrighted material is made available to anyone wishing to use,
10 * modify, copy, or redistribute it subject to the terms and conditions
11 * of the GNU Lesser General Public License v.2.1.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, write to the Free Software Foundation,
15 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #include "lib.h"
19 #include "device.h"
20 #include "memlock.h"
21 #include "lvm-string.h"
22 #include "lvm-file.h"
23 #include "defaults.h"
25 #include <stdarg.h>
27 static int _verbose_level = VERBOSE_BASE_LEVEL;
28 static int _test = 0;
29 static int _md_filtering = 0;
30 static int _pvmove = 0;
31 static int _full_scan_done = 0; /* Restrict to one full scan during each cmd */
32 static int _trust_cache = 0; /* Don't scan when incomplete VGs encountered */
33 static int _debug_level = 0;
34 static int _log_cmd_name = 0;
35 static int _ignorelockingfailure = 0;
36 static int _security_level = SECURITY_LEVEL;
37 static char _cmd_name[30] = "";
38 static int _mirror_in_sync = 0;
39 static int _dmeventd_monitor = DEFAULT_DMEVENTD_MONITOR;
40 static int _ignore_suspended_devices = 0;
41 static int _error_message_produced = 0;
42 static unsigned _is_static = 0;
44 void init_verbose(int level)
46 _verbose_level = level;
49 void init_test(int level)
51 if (!_test && level)
52 log_print("Test mode: Metadata will NOT be updated.");
53 _test = level;
56 void init_md_filtering(int level)
58 _md_filtering = level;
61 void init_pvmove(int level)
63 _pvmove = level;
66 void init_full_scan_done(int level)
68 _full_scan_done = level;
71 void init_trust_cache(int trustcache)
73 _trust_cache = trustcache;
76 void init_ignorelockingfailure(int level)
78 _ignorelockingfailure = level;
81 void init_security_level(int level)
83 _security_level = level;
86 void init_mirror_in_sync(int in_sync)
88 _mirror_in_sync = in_sync;
91 void init_dmeventd_monitor(int reg)
93 _dmeventd_monitor = reg;
96 void init_ignore_suspended_devices(int ignore)
98 _ignore_suspended_devices = ignore;
101 void init_cmd_name(int status)
103 _log_cmd_name = status;
106 void init_is_static(unsigned value)
108 _is_static = value;
111 void set_cmd_name(const char *cmd)
113 strncpy(_cmd_name, cmd, sizeof(_cmd_name));
114 _cmd_name[sizeof(_cmd_name) - 1] = '\0';
117 const char *log_command_name()
119 if (!_log_cmd_name)
120 return "";
122 return _cmd_name;
125 void init_error_message_produced(int value)
127 _error_message_produced = value;
130 int error_message_produced(void)
132 return _error_message_produced;
135 int test_mode()
137 return _test;
140 int md_filtering()
142 return _md_filtering;
145 int pvmove_mode()
147 return _pvmove;
150 int full_scan_done()
152 return _full_scan_done;
155 int trust_cache()
157 return _trust_cache;
160 int ignorelockingfailure()
162 return _ignorelockingfailure;
165 int security_level()
167 return _security_level;
170 int mirror_in_sync(void)
172 return _mirror_in_sync;
175 int dmeventd_monitor_mode(void)
177 return _dmeventd_monitor;
180 int ignore_suspended_devices(void)
182 return _ignore_suspended_devices;
185 void init_debug(int level)
187 _debug_level = level;
190 int verbose_level()
192 return _verbose_level;
195 int debug_level()
197 return _debug_level;
200 unsigned is_static(void)
202 return _is_static;