1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 10:25:13 +03:00

cleanup: simplify dev_cache_exit

Just set whole _cache struct into unitialized state just
like with lib init start usage.
Lists are initialized with dev_cache_init().
This commit is contained in:
Zdenek Kabelac 2014-12-06 23:56:14 +01:00
parent 5a4676fea9
commit dccbc3b621

View File

@ -819,23 +819,13 @@ int dev_cache_exit(void)
if ((num_open = _check_for_open_devices(1)) > 0)
log_error(INTERNAL_ERROR "%d device(s) were left open and have been closed.", num_open);
if (_cache.preferred_names_matcher)
_cache.preferred_names_matcher = NULL;
if (_cache.mem) {
if (_cache.mem)
dm_pool_destroy(_cache.mem);
_cache.mem = NULL;
}
if (_cache.names) {
if (_cache.names)
dm_hash_destroy(_cache.names);
_cache.names = NULL;
}
_cache.devices = NULL;
_cache.has_scanned = 0;
dm_list_init(&_cache.dirs);
dm_list_init(&_cache.files);
memset(&_cache, 0, sizeof(_cache));
return (!num_open);
}