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
21 #include "lvm-string.h"
27 static int _verbose_level
= VERBOSE_BASE_LEVEL
;
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
)
52 log_print("Test mode: Metadata will NOT be updated.");
56 void init_md_filtering(int level
)
58 _md_filtering
= level
;
61 void init_pvmove(int 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
)
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()
125 void init_error_message_produced(int value
)
127 _error_message_produced
= value
;
130 int error_message_produced(void)
132 return _error_message_produced
;
142 return _md_filtering
;
152 return _full_scan_done
;
160 int ignorelockingfailure()
162 return _ignorelockingfailure
;
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
;
192 return _verbose_level
;
200 unsigned is_static(void)