mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-17 06:04:23 +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:
parent
5a4676fea9
commit
dccbc3b621
@ -819,23 +819,13 @@ int dev_cache_exit(void)
|
|||||||
if ((num_open = _check_for_open_devices(1)) > 0)
|
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);
|
log_error(INTERNAL_ERROR "%d device(s) were left open and have been closed.", num_open);
|
||||||
|
|
||||||
if (_cache.preferred_names_matcher)
|
if (_cache.mem)
|
||||||
_cache.preferred_names_matcher = NULL;
|
|
||||||
|
|
||||||
if (_cache.mem) {
|
|
||||||
dm_pool_destroy(_cache.mem);
|
dm_pool_destroy(_cache.mem);
|
||||||
_cache.mem = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_cache.names) {
|
if (_cache.names)
|
||||||
dm_hash_destroy(_cache.names);
|
dm_hash_destroy(_cache.names);
|
||||||
_cache.names = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
_cache.devices = NULL;
|
memset(&_cache, 0, sizeof(_cache));
|
||||||
_cache.has_scanned = 0;
|
|
||||||
dm_list_init(&_cache.dirs);
|
|
||||||
dm_list_init(&_cache.files);
|
|
||||||
|
|
||||||
return (!num_open);
|
return (!num_open);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user