mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-06 10:00:40 +03:00
Right, a simple build (without options) is working again.
This commit is contained in:
parent
28f60ff82f
commit
2c44337bd5
@ -46,7 +46,9 @@ daemons: lib
|
||||
tools: lib
|
||||
po: tools daemons
|
||||
|
||||
libdm.device-mapper: include.device-mapper
|
||||
tools.device-mapper: libdm.device-mapper
|
||||
device-mapper: tools.device-mapper
|
||||
|
||||
ifeq ("@INTL@", "yes")
|
||||
lib.pofile: include.pofile
|
||||
|
4
configure
vendored
4
configure
vendored
@ -11798,14 +11798,14 @@ fi
|
||||
echo "${ECHO_T}$interface" >&6; }
|
||||
|
||||
################################################################################
|
||||
DM_LIB_VERSION="\"`cat VERSION_LIB 2>/dev/null || echo Unknown`\""
|
||||
DM_LIB_VERSION="\"`cat VERSION_DM 2>/dev/null || echo Unknown`\""
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define DM_LIB_VERSION $DM_LIB_VERSION
|
||||
_ACEOF
|
||||
|
||||
|
||||
DM_LIB_PATCHLEVEL=`cat VERSION_LIB | awk -F '[-. ]' '{printf "%s.%s.%s",$1,$2,$3}'`
|
||||
DM_LIB_PATCHLEVEL=`cat VERSION_DM | awk -F '[-. ]' '{printf "%s.%s.%s",$1,$2,$3}'`
|
||||
|
||||
LVM_VERSION="\"`cat VERSION 2>/dev/null || echo Unknown`\""
|
||||
|
||||
|
@ -718,10 +718,10 @@ fi
|
||||
AC_MSG_RESULT($interface)
|
||||
|
||||
################################################################################
|
||||
DM_LIB_VERSION="\"`cat VERSION_LIB 2>/dev/null || echo Unknown`\""
|
||||
DM_LIB_VERSION="\"`cat VERSION_DM 2>/dev/null || echo Unknown`\""
|
||||
AC_DEFINE_UNQUOTED(DM_LIB_VERSION, $DM_LIB_VERSION, [Library version])
|
||||
|
||||
DM_LIB_PATCHLEVEL=`cat VERSION_LIB | awk -F '[[-. ]]' '{printf "%s.%s.%s",$1,$2,$3}'`
|
||||
DM_LIB_PATCHLEVEL=`cat VERSION_DM | awk -F '[[-. ]]' '{printf "%s.%s.%s",$1,$2,$3}'`
|
||||
|
||||
LVM_VERSION="\"`cat VERSION 2>/dev/null || echo Unknown`\""
|
||||
|
||||
|
@ -75,7 +75,7 @@ static unsigned max_cluster_member_name_len;
|
||||
|
||||
/* Structure of items on the LVM thread list */
|
||||
struct lvm_thread_cmd {
|
||||
struct list list;
|
||||
struct dm_list list;
|
||||
|
||||
struct local_client *client;
|
||||
struct clvm_header *msg;
|
||||
@ -90,7 +90,7 @@ static pthread_t lvm_thread;
|
||||
static pthread_mutex_t lvm_thread_mutex;
|
||||
static pthread_cond_t lvm_thread_cond;
|
||||
static pthread_mutex_t lvm_start_mutex;
|
||||
static struct list lvm_cmd_head;
|
||||
static struct dm_list lvm_cmd_head;
|
||||
static volatile sig_atomic_t quit = 0;
|
||||
static volatile sig_atomic_t reread_config = 0;
|
||||
static int child_pipe[2];
|
||||
@ -352,7 +352,7 @@ int main(int argc, char *argv[])
|
||||
sigprocmask(SIG_BLOCK, &ss, NULL);
|
||||
|
||||
/* Initialise the LVM thread variables */
|
||||
list_init(&lvm_cmd_head);
|
||||
dm_list_init(&lvm_cmd_head);
|
||||
pthread_mutex_init(&lvm_thread_mutex, NULL);
|
||||
pthread_cond_init(&lvm_thread_cond, NULL);
|
||||
pthread_mutex_init(&lvm_start_mutex, NULL);
|
||||
@ -1749,7 +1749,7 @@ static int process_work_item(struct lvm_thread_cmd *cmd)
|
||||
*/
|
||||
static __attribute__ ((noreturn)) void *lvm_thread_fn(void *arg)
|
||||
{
|
||||
struct list *cmdl, *tmp;
|
||||
struct dm_list *cmdl, *tmp;
|
||||
sigset_t ss;
|
||||
int using_gulm = (int)(long)arg;
|
||||
|
||||
@ -1775,15 +1775,15 @@ static __attribute__ ((noreturn)) void *lvm_thread_fn(void *arg)
|
||||
DEBUGLOG("LVM thread waiting for work\n");
|
||||
|
||||
pthread_mutex_lock(&lvm_thread_mutex);
|
||||
if (list_empty(&lvm_cmd_head))
|
||||
if (dm_list_empty(&lvm_cmd_head))
|
||||
pthread_cond_wait(&lvm_thread_cond, &lvm_thread_mutex);
|
||||
|
||||
list_iterate_safe(cmdl, tmp, &lvm_cmd_head) {
|
||||
dm_list_iterate_safe(cmdl, tmp, &lvm_cmd_head) {
|
||||
struct lvm_thread_cmd *cmd;
|
||||
|
||||
cmd =
|
||||
list_struct_base(cmdl, struct lvm_thread_cmd, list);
|
||||
list_del(&cmd->list);
|
||||
dm_list_struct_base(cmdl, struct lvm_thread_cmd, list);
|
||||
dm_list_del(&cmd->list);
|
||||
pthread_mutex_unlock(&lvm_thread_mutex);
|
||||
|
||||
process_work_item(cmd);
|
||||
@ -1833,7 +1833,7 @@ static int add_to_lvmqueue(struct local_client *client, struct clvm_header *msg,
|
||||
("add_to_lvmqueue: cmd=%p. client=%p, msg=%p, len=%d, csid=%p, xid=%d\n",
|
||||
cmd, client, msg, msglen, csid, cmd->xid);
|
||||
pthread_mutex_lock(&lvm_thread_mutex);
|
||||
list_add(&lvm_cmd_head, &cmd->list);
|
||||
dm_list_add(&lvm_cmd_head, &cmd->list);
|
||||
pthread_cond_signal(&lvm_thread_cond);
|
||||
pthread_mutex_unlock(&lvm_thread_mutex);
|
||||
|
||||
|
@ -58,11 +58,11 @@ static volatile sig_atomic_t _thread_registries_empty = 1; /* registries are emp
|
||||
static int _debug = 0;
|
||||
|
||||
/* List (un)link macros. */
|
||||
#define LINK(x, head) list_add(head, &(x)->list)
|
||||
#define LINK(x, head) dm_list_add(head, &(x)->list)
|
||||
#define LINK_DSO(dso) LINK(dso, &_dso_registry)
|
||||
#define LINK_THREAD(thread) LINK(thread, &_thread_registry)
|
||||
|
||||
#define UNLINK(x) list_del(&(x)->list)
|
||||
#define UNLINK(x) dm_list_del(&(x)->list)
|
||||
#define UNLINK_DSO(x) UNLINK(x)
|
||||
#define UNLINK_THREAD(x) UNLINK(x)
|
||||
|
||||
@ -101,7 +101,7 @@ static pthread_mutex_t _global_mutex;
|
||||
|
||||
/* Data kept about a DSO. */
|
||||
struct dso_data {
|
||||
struct list list;
|
||||
struct dm_list list;
|
||||
|
||||
char *dso_name; /* DSO name (eg, "evms", "dmraid", "lvm2"). */
|
||||
|
||||
@ -143,7 +143,7 @@ struct dso_data {
|
||||
int (*unregister_device)(const char *device, const char *uuid,
|
||||
int major, int minor, void **user);
|
||||
};
|
||||
static LIST_INIT(_dso_registry);
|
||||
static DM_LIST_INIT(_dso_registry);
|
||||
|
||||
/* Structure to keep parsed register variables from client message. */
|
||||
struct message_data {
|
||||
@ -168,7 +168,7 @@ struct message_data {
|
||||
* occurs and the event processing function of the DSO gets called.
|
||||
*/
|
||||
struct thread_status {
|
||||
struct list list;
|
||||
struct dm_list list;
|
||||
|
||||
pthread_t thread;
|
||||
|
||||
@ -189,14 +189,14 @@ struct thread_status {
|
||||
struct dm_task *current_task;
|
||||
time_t next_time;
|
||||
uint32_t timeout;
|
||||
struct list timeout_list;
|
||||
struct dm_list timeout_list;
|
||||
void *dso_private; /* dso per-thread status variable */
|
||||
};
|
||||
static LIST_INIT(_thread_registry);
|
||||
static LIST_INIT(_thread_registry_unused);
|
||||
static DM_LIST_INIT(_thread_registry);
|
||||
static DM_LIST_INIT(_thread_registry_unused);
|
||||
|
||||
static int _timeout_running;
|
||||
static LIST_INIT(_timeout_registry);
|
||||
static DM_LIST_INIT(_timeout_registry);
|
||||
static pthread_mutex_t _timeout_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_cond_t _timeout_cond = PTHREAD_COND_INITIALIZER;
|
||||
|
||||
@ -239,7 +239,7 @@ static struct thread_status *_alloc_thread_status(struct message_data *data,
|
||||
ret->dso_data = dso_data;
|
||||
ret->events = data->events.field;
|
||||
ret->timeout = data->timeout.secs;
|
||||
list_init(&ret->timeout_list);
|
||||
dm_list_init(&ret->timeout_list);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -459,7 +459,7 @@ static struct thread_status *_lookup_thread_status(struct message_data *data)
|
||||
{
|
||||
struct thread_status *thread;
|
||||
|
||||
list_iterate_items(thread, &_thread_registry)
|
||||
dm_list_iterate_items(thread, &_thread_registry)
|
||||
if (!strcmp(data->device_uuid, thread->device.uuid))
|
||||
return thread;
|
||||
|
||||
@ -489,13 +489,13 @@ static void *_timeout_thread(void *unused __attribute((unused)))
|
||||
pthread_cleanup_push(_exit_timeout, NULL);
|
||||
pthread_mutex_lock(&_timeout_mutex);
|
||||
|
||||
while (!list_empty(&_timeout_registry)) {
|
||||
while (!dm_list_empty(&_timeout_registry)) {
|
||||
struct thread_status *thread;
|
||||
|
||||
timeout.tv_sec = 0;
|
||||
curr_time = time(NULL);
|
||||
|
||||
list_iterate_items_gen(thread, &_timeout_registry, timeout_list) {
|
||||
dm_list_iterate_items_gen(thread, &_timeout_registry, timeout_list) {
|
||||
if (thread->next_time <= curr_time) {
|
||||
thread->next_time = curr_time + thread->timeout;
|
||||
pthread_kill(thread->thread, SIGALRM);
|
||||
@ -522,8 +522,8 @@ static int _register_for_timeout(struct thread_status *thread)
|
||||
|
||||
thread->next_time = time(NULL) + thread->timeout;
|
||||
|
||||
if (list_empty(&thread->timeout_list)) {
|
||||
list_add(&_timeout_registry, &thread->timeout_list);
|
||||
if (dm_list_empty(&thread->timeout_list)) {
|
||||
dm_list_add(&_timeout_registry, &thread->timeout_list);
|
||||
if (_timeout_running)
|
||||
pthread_cond_signal(&_timeout_cond);
|
||||
}
|
||||
@ -543,9 +543,9 @@ static int _register_for_timeout(struct thread_status *thread)
|
||||
static void _unregister_for_timeout(struct thread_status *thread)
|
||||
{
|
||||
pthread_mutex_lock(&_timeout_mutex);
|
||||
if (!list_empty(&thread->timeout_list)) {
|
||||
list_del(&thread->timeout_list);
|
||||
list_init(&thread->timeout_list);
|
||||
if (!dm_list_empty(&thread->timeout_list)) {
|
||||
dm_list_del(&thread->timeout_list);
|
||||
dm_list_init(&thread->timeout_list);
|
||||
}
|
||||
pthread_mutex_unlock(&_timeout_mutex);
|
||||
}
|
||||
@ -698,7 +698,7 @@ static void _monitor_unregister(void *arg)
|
||||
}
|
||||
/* we may have been relinked to unused registry since we were
|
||||
called, so check that */
|
||||
list_iterate_items(thread_iter, &_thread_registry_unused)
|
||||
dm_list_iterate_items(thread_iter, &_thread_registry_unused)
|
||||
if (thread_iter == thread) {
|
||||
thread->status = DM_THREAD_DONE;
|
||||
_unlock_mutex();
|
||||
@ -839,7 +839,7 @@ static struct dso_data *_lookup_dso(struct message_data *data)
|
||||
{
|
||||
struct dso_data *dso_data, *ret = NULL;
|
||||
|
||||
list_iterate_items(dso_data, &_dso_registry)
|
||||
dm_list_iterate_items(dso_data, &_dso_registry)
|
||||
if (!strcmp(data->dso_name, dso_data->dso_name)) {
|
||||
_lib_get(dso_data);
|
||||
ret = dso_data;
|
||||
@ -1110,7 +1110,7 @@ static int _get_registered_dev(struct message_data *message_data, int next)
|
||||
_lock_mutex();
|
||||
|
||||
/* Iterate list of threads checking if we want a particular one. */
|
||||
list_iterate_items(thread, &_thread_registry)
|
||||
dm_list_iterate_items(thread, &_thread_registry)
|
||||
if (_want_registered_device(message_data->dso_name,
|
||||
message_data->device_uuid,
|
||||
thread)) {
|
||||
@ -1133,10 +1133,10 @@ static int _get_registered_dev(struct message_data *message_data, int next)
|
||||
thread = hit;
|
||||
|
||||
while (1) {
|
||||
if (list_end(&_thread_registry, &thread->list))
|
||||
if (dm_list_end(&_thread_registry, &thread->list))
|
||||
goto out;
|
||||
|
||||
thread = list_item(thread->list.n, struct thread_status);
|
||||
thread = dm_list_item(thread->list.n, struct thread_status);
|
||||
if (_want_registered_device(message_data->dso_name, NULL, thread)) {
|
||||
hit = thread;
|
||||
break;
|
||||
@ -1440,12 +1440,12 @@ static void _process_request(struct dm_event_fifos *fifos)
|
||||
static void _cleanup_unused_threads(void)
|
||||
{
|
||||
int ret;
|
||||
struct list *l;
|
||||
struct dm_list *l;
|
||||
struct thread_status *thread;
|
||||
|
||||
_lock_mutex();
|
||||
while ((l = list_first(&_thread_registry_unused))) {
|
||||
thread = list_item(l, struct thread_status);
|
||||
while ((l = dm_list_first(&_thread_registry_unused))) {
|
||||
thread = dm_list_item(l, struct thread_status);
|
||||
if (thread->processing)
|
||||
break; /* cleanup on the next round */
|
||||
|
||||
@ -1470,7 +1470,7 @@ static void _cleanup_unused_threads(void)
|
||||
break;
|
||||
}
|
||||
|
||||
list_del(l);
|
||||
dm_list_del(l);
|
||||
syslog(LOG_ERR,
|
||||
"thread can't be on unused list unless !thread->events");
|
||||
thread->status = DM_THREAD_RUNNING;
|
||||
@ -1480,7 +1480,7 @@ static void _cleanup_unused_threads(void)
|
||||
}
|
||||
|
||||
if (thread->status == DM_THREAD_DONE) {
|
||||
list_del(l);
|
||||
dm_list_del(l);
|
||||
pthread_join(thread->thread, NULL);
|
||||
_lib_put(thread->dso_data);
|
||||
_free_thread_status(thread);
|
||||
@ -1741,8 +1741,8 @@ int main(int argc, char *argv[])
|
||||
while (!_exit_now) {
|
||||
_process_request(&fifos);
|
||||
_cleanup_unused_threads();
|
||||
if (!list_empty(&_thread_registry)
|
||||
|| !list_empty(&_thread_registry_unused))
|
||||
if (!dm_list_empty(&_thread_registry)
|
||||
|| !dm_list_empty(&_thread_registry_unused))
|
||||
_thread_registries_empty = 0;
|
||||
else
|
||||
_thread_registries_empty = 1;
|
||||
|
@ -27,6 +27,8 @@ else
|
||||
LIB_SHARED = libdevmapper-event-lvm2mirror.so
|
||||
endif
|
||||
|
||||
LIB_VERSION = $(LIB_VERSION_LVM)
|
||||
|
||||
include $(top_srcdir)/make.tmpl
|
||||
|
||||
install: libdevmapper-event-lvm2mirror.$(LIB_SUFFIX)
|
||||
|
@ -27,6 +27,8 @@ else
|
||||
LIB_SHARED = libdevmapper-event-lvm2snapshot.so
|
||||
endif
|
||||
|
||||
LIB_VERSION = $(LIB_VERSION_LVM)
|
||||
|
||||
include $(top_srcdir)/make.tmpl
|
||||
|
||||
install: libdevmapper-event-lvm2snapshot.$(LIB_SUFFIX)
|
||||
|
@ -52,11 +52,11 @@ int lvm1_present(struct cmd_context *cmd)
|
||||
}
|
||||
|
||||
int list_segment_modules(struct dm_pool *mem, const struct lv_segment *seg,
|
||||
struct list *modules)
|
||||
struct dm_list *modules)
|
||||
{
|
||||
unsigned int s;
|
||||
struct lv_segment *seg2, *snap_seg;
|
||||
struct list *snh;
|
||||
struct dm_list *snh;
|
||||
|
||||
if (seg->segtype->ops->modules_needed &&
|
||||
!seg->segtype->ops->modules_needed(mem, seg, modules)) {
|
||||
@ -65,9 +65,9 @@ int list_segment_modules(struct dm_pool *mem, const struct lv_segment *seg,
|
||||
}
|
||||
|
||||
if (lv_is_origin(seg->lv))
|
||||
list_iterate(snh, &seg->lv->snapshot_segs)
|
||||
dm_list_iterate(snh, &seg->lv->snapshot_segs)
|
||||
if (!list_lv_modules(mem,
|
||||
list_struct_base(snh,
|
||||
dm_list_struct_base(snh,
|
||||
struct lv_segment,
|
||||
origin_list)->cow,
|
||||
modules))
|
||||
@ -100,11 +100,11 @@ int list_segment_modules(struct dm_pool *mem, const struct lv_segment *seg,
|
||||
}
|
||||
|
||||
int list_lv_modules(struct dm_pool *mem, const struct logical_volume *lv,
|
||||
struct list *modules)
|
||||
struct dm_list *modules)
|
||||
{
|
||||
struct lv_segment *seg;
|
||||
|
||||
list_iterate_items(seg, &lv->segments)
|
||||
dm_list_iterate_items(seg, &lv->segments)
|
||||
if (!list_segment_modules(mem, seg, modules))
|
||||
return_0;
|
||||
|
||||
@ -264,7 +264,7 @@ static int _passes_activation_filter(struct cmd_context *cmd,
|
||||
|
||||
if (!(cn = find_config_tree_node(cmd, "activation/volume_list"))) {
|
||||
/* If no host tags defined, activate */
|
||||
if (list_empty(&cmd->tags))
|
||||
if (dm_list_empty(&cmd->tags))
|
||||
return 1;
|
||||
|
||||
/* If any host tag matches any LV or VG tag, activate */
|
||||
@ -517,7 +517,7 @@ int lv_mirror_percent(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
|
||||
/* If mirrored LV is temporarily shrinked to 1 area (= linear),
|
||||
* it should be considered in-sync. */
|
||||
if (list_size(&lv->segments) == 1 && first_seg(lv)->area_count == 1) {
|
||||
if (dm_list_size(&lv->segments) == 1 && first_seg(lv)->area_count == 1) {
|
||||
*percent = 100.0;
|
||||
return 1;
|
||||
}
|
||||
@ -639,7 +639,7 @@ static int _lvs_in_vg_activated(struct volume_group *vg, unsigned by_uuid_only)
|
||||
if (!activation())
|
||||
return 0;
|
||||
|
||||
list_iterate_items(lvl, &vg->lvs) {
|
||||
dm_list_iterate_items(lvl, &vg->lvs) {
|
||||
if (lvl->lv->status & VISIBLE_LV)
|
||||
count += (_lv_active(vg->cmd, lvl->lv, by_uuid_only) == 1);
|
||||
}
|
||||
@ -665,7 +665,7 @@ int lvs_in_vg_opened(const struct volume_group *vg)
|
||||
if (!activation())
|
||||
return 0;
|
||||
|
||||
list_iterate_items(lvl, &vg->lvs) {
|
||||
dm_list_iterate_items(lvl, &vg->lvs) {
|
||||
if (lvl->lv->status & VISIBLE_LV)
|
||||
count += (_lv_open_count(vg->cmd, lvl->lv) > 0);
|
||||
}
|
||||
@ -715,7 +715,7 @@ int monitor_dev_for_events(struct cmd_context *cmd,
|
||||
#ifdef DMEVENTD
|
||||
int i, pending = 0, monitored;
|
||||
int r = 1;
|
||||
struct list *tmp, *snh, *snht;
|
||||
struct dm_list *tmp, *snh, *snht;
|
||||
struct lv_segment *seg;
|
||||
int (*monitor_fn) (struct lv_segment *s, int e);
|
||||
uint32_t s;
|
||||
@ -745,15 +745,15 @@ int monitor_dev_for_events(struct cmd_context *cmd,
|
||||
* TODO: This may change when snapshots of mirrors are allowed.
|
||||
*/
|
||||
if (lv_is_origin(lv)) {
|
||||
list_iterate_safe(snh, snht, &lv->snapshot_segs)
|
||||
if (!monitor_dev_for_events(cmd, list_struct_base(snh,
|
||||
dm_list_iterate_safe(snh, snht, &lv->snapshot_segs)
|
||||
if (!monitor_dev_for_events(cmd, dm_list_struct_base(snh,
|
||||
struct lv_segment, origin_list)->cow, monitor))
|
||||
r = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
list_iterate(tmp, &lv->segments) {
|
||||
seg = list_item(tmp, struct lv_segment);
|
||||
dm_list_iterate(tmp, &lv->segments) {
|
||||
seg = dm_list_item(tmp, struct lv_segment);
|
||||
|
||||
/* Recurse for AREA_LV */
|
||||
for (s = 0; s < seg->area_count; s++) {
|
||||
|
@ -45,9 +45,9 @@ int target_present(const char *target_name, int use_modprobe);
|
||||
int target_version(const char *target_name, uint32_t *maj,
|
||||
uint32_t *min, uint32_t *patchlevel);
|
||||
int list_segment_modules(struct dm_pool *mem, const struct lv_segment *seg,
|
||||
struct list *modules);
|
||||
struct dm_list *modules);
|
||||
int list_lv_modules(struct dm_pool *mem, const struct logical_volume *lv,
|
||||
struct list *modules);
|
||||
struct dm_list *modules);
|
||||
|
||||
void activation_release(void);
|
||||
void activation_exit(void);
|
||||
|
@ -330,7 +330,7 @@ static int _percent_run(struct dev_manager *dm, const char *name,
|
||||
uint64_t start, length;
|
||||
char *type = NULL;
|
||||
char *params = NULL;
|
||||
struct list *segh = &lv->segments;
|
||||
struct dm_list *segh = &lv->segments;
|
||||
struct lv_segment *seg = NULL;
|
||||
struct segment_type *segtype;
|
||||
|
||||
@ -358,12 +358,12 @@ static int _percent_run(struct dev_manager *dm, const char *name,
|
||||
next = dm_get_next_target(dmt, next, &start, &length, &type,
|
||||
¶ms);
|
||||
if (lv) {
|
||||
if (!(segh = list_next(&lv->segments, segh))) {
|
||||
if (!(segh = dm_list_next(&lv->segments, segh))) {
|
||||
log_error("Number of segments in active LV %s "
|
||||
"does not match metadata", lv->name);
|
||||
goto out;
|
||||
}
|
||||
seg = list_item(segh, struct lv_segment);
|
||||
seg = dm_list_item(segh, struct lv_segment);
|
||||
}
|
||||
|
||||
if (!type || !params || strcmp(type, target_type))
|
||||
@ -381,7 +381,7 @@ static int _percent_run(struct dev_manager *dm, const char *name,
|
||||
|
||||
} while (next);
|
||||
|
||||
if (lv && (segh = list_next(&lv->segments, segh))) {
|
||||
if (lv && (segh = dm_list_next(&lv->segments, segh))) {
|
||||
log_error("Number of segments in active LV %s does not "
|
||||
"match metadata", lv->name);
|
||||
goto out;
|
||||
@ -576,7 +576,7 @@ static int _belong_to_vg(const char *vgname, const char *name)
|
||||
old_origin = snap_seg->origin;
|
||||
|
||||
/* Was this the last active snapshot with this origin? */
|
||||
list_iterate_items(lvl, active_head) {
|
||||
dm_list_iterate_items(lvl, active_head) {
|
||||
active = lvl->lv;
|
||||
if ((snap_seg = find_cow(active)) &&
|
||||
snap_seg->origin == old_origin) {
|
||||
@ -657,7 +657,7 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree, struc
|
||||
static struct dm_tree *_create_partial_dtree(struct dev_manager *dm, struct logical_volume *lv)
|
||||
{
|
||||
struct dm_tree *dtree;
|
||||
struct list *snh, *snht;
|
||||
struct dm_list *snh, *snht;
|
||||
struct lv_segment *seg;
|
||||
uint32_t s;
|
||||
|
||||
@ -670,12 +670,12 @@ static struct dm_tree *_create_partial_dtree(struct dev_manager *dm, struct logi
|
||||
goto_bad;
|
||||
|
||||
/* Add any snapshots of this LV */
|
||||
list_iterate_safe(snh, snht, &lv->snapshot_segs)
|
||||
if (!_add_lv_to_dtree(dm, dtree, list_struct_base(snh, struct lv_segment, origin_list)->cow))
|
||||
dm_list_iterate_safe(snh, snht, &lv->snapshot_segs)
|
||||
if (!_add_lv_to_dtree(dm, dtree, dm_list_struct_base(snh, struct lv_segment, origin_list)->cow))
|
||||
goto_bad;
|
||||
|
||||
/* Add any LVs used by segments in this LV */
|
||||
list_iterate_items(seg, &lv->segments)
|
||||
dm_list_iterate_items(seg, &lv->segments)
|
||||
for (s = 0; s < seg->area_count; s++)
|
||||
if (seg_type(seg, s) == AREA_LV && seg_lv(seg, s)) {
|
||||
if (!_add_lv_to_dtree(dm, dtree, seg_lv(seg, s)))
|
||||
@ -699,7 +699,7 @@ static char *_add_error_device(struct dev_manager *dm, struct dm_tree *dtree,
|
||||
int segno = -1, i = 0;;
|
||||
uint64_t size = seg->len * seg->lv->vg->extent_size;
|
||||
|
||||
list_iterate_items(seg_i, &seg->lv->segments) {
|
||||
dm_list_iterate_items(seg_i, &seg->lv->segments) {
|
||||
if (seg == seg_i)
|
||||
segno = i;
|
||||
++i;
|
||||
@ -862,7 +862,7 @@ static int _add_segment_to_dtree(struct dev_manager *dm,
|
||||
const char *layer)
|
||||
{
|
||||
uint32_t s;
|
||||
struct list *snh;
|
||||
struct dm_list *snh;
|
||||
struct lv_segment *seg_present;
|
||||
|
||||
/* Ensure required device-mapper targets are loaded */
|
||||
@ -915,8 +915,8 @@ static int _add_segment_to_dtree(struct dev_manager *dm,
|
||||
|
||||
if (lv_is_origin(seg->lv) && !layer)
|
||||
/* Add any snapshots of this LV */
|
||||
list_iterate(snh, &seg->lv->snapshot_segs)
|
||||
if (!_add_new_lv_to_dtree(dm, dtree, list_struct_base(snh, struct lv_segment, origin_list)->cow, NULL))
|
||||
dm_list_iterate(snh, &seg->lv->snapshot_segs)
|
||||
if (!_add_new_lv_to_dtree(dm, dtree, dm_list_struct_base(snh, struct lv_segment, origin_list)->cow, NULL))
|
||||
return_0;
|
||||
|
||||
return 1;
|
||||
@ -970,7 +970,7 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
|
||||
|
||||
/* Create table */
|
||||
dm->pvmove_mirror_count = 0u;
|
||||
list_iterate_items(seg, &lv->segments) {
|
||||
dm_list_iterate_items(seg, &lv->segments) {
|
||||
if (!_add_segment_to_dtree(dm, dtree, dnode, seg, layer))
|
||||
return_0;
|
||||
/* These aren't real segments in the LVM2 metadata */
|
||||
|
@ -243,10 +243,10 @@ static int _do_fs_op(fs_op_t type, const char *dev_dir, const char *vg_name,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static LIST_INIT(_fs_ops);
|
||||
static DM_LIST_INIT(_fs_ops);
|
||||
|
||||
struct fs_op_parms {
|
||||
struct list list;
|
||||
struct dm_list list;
|
||||
fs_op_t type;
|
||||
char *dev_dir;
|
||||
char *vg_name;
|
||||
@ -286,21 +286,21 @@ static int _stack_fs_op(fs_op_t type, const char *dev_dir, const char *vg_name,
|
||||
_store_str(&pos, &fsp->dev, dev);
|
||||
_store_str(&pos, &fsp->old_lv_name, old_lv_name);
|
||||
|
||||
list_add(&_fs_ops, &fsp->list);
|
||||
dm_list_add(&_fs_ops, &fsp->list);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void _pop_fs_ops(void)
|
||||
{
|
||||
struct list *fsph, *fspht;
|
||||
struct dm_list *fsph, *fspht;
|
||||
struct fs_op_parms *fsp;
|
||||
|
||||
list_iterate_safe(fsph, fspht, &_fs_ops) {
|
||||
fsp = list_item(fsph, struct fs_op_parms);
|
||||
dm_list_iterate_safe(fsph, fspht, &_fs_ops) {
|
||||
fsp = dm_list_item(fsph, struct fs_op_parms);
|
||||
_do_fs_op(fsp->type, fsp->dev_dir, fsp->vg_name, fsp->lv_name,
|
||||
fsp->dev, fsp->old_lv_name);
|
||||
list_del(&fsp->list);
|
||||
dm_list_del(&fsp->list);
|
||||
dm_free(fsp);
|
||||
}
|
||||
}
|
||||
|
82
lib/cache/lvmcache.c
vendored
82
lib/cache/lvmcache.c
vendored
@ -30,7 +30,7 @@ static struct dm_hash_table *_pvid_hash = NULL;
|
||||
static struct dm_hash_table *_vgid_hash = NULL;
|
||||
static struct dm_hash_table *_vgname_hash = NULL;
|
||||
static struct dm_hash_table *_lock_hash = NULL;
|
||||
static struct list _vginfos;
|
||||
static struct dm_list _vginfos;
|
||||
static int _scanning_in_progress = 0;
|
||||
static int _has_scanned = 0;
|
||||
static int _vgs_locked = 0;
|
||||
@ -38,7 +38,7 @@ static int _vg_global_lock_held = 0; /* Global lock held when cache wiped? */
|
||||
|
||||
int lvmcache_init(void)
|
||||
{
|
||||
list_init(&_vginfos);
|
||||
dm_list_init(&_vginfos);
|
||||
|
||||
if (!(_vgname_hash = dm_hash_create(128)))
|
||||
return 0;
|
||||
@ -117,7 +117,7 @@ static void _update_cache_vginfo_lock_state(struct lvmcache_vginfo *vginfo,
|
||||
struct lvmcache_info *info;
|
||||
int cached_vgmetadata_valid = 1;
|
||||
|
||||
list_iterate_items(info, &vginfo->infos)
|
||||
dm_list_iterate_items(info, &vginfo->infos)
|
||||
_update_cache_info_lock_state(info, locked,
|
||||
&cached_vgmetadata_valid);
|
||||
|
||||
@ -151,7 +151,7 @@ static void _drop_metadata(const char *vgname)
|
||||
*/
|
||||
|
||||
if (!vginfo->precommitted)
|
||||
list_iterate_items(info, &vginfo->infos)
|
||||
dm_list_iterate_items(info, &vginfo->infos)
|
||||
info->status |= CACHE_INVALID;
|
||||
|
||||
_free_cached_vgmetadata(vginfo);
|
||||
@ -226,14 +226,14 @@ static void _vginfo_attach_info(struct lvmcache_vginfo *vginfo,
|
||||
return;
|
||||
|
||||
info->vginfo = vginfo;
|
||||
list_add(&vginfo->infos, &info->list);
|
||||
dm_list_add(&vginfo->infos, &info->list);
|
||||
}
|
||||
|
||||
static void _vginfo_detach_info(struct lvmcache_info *info)
|
||||
{
|
||||
if (!list_empty(&info->list)) {
|
||||
list_del(&info->list);
|
||||
list_init(&info->list);
|
||||
if (!dm_list_empty(&info->list)) {
|
||||
dm_list_del(&info->list);
|
||||
dm_list_init(&info->list);
|
||||
}
|
||||
|
||||
info->vginfo = NULL;
|
||||
@ -267,8 +267,8 @@ const struct format_type *fmt_from_vgname(const char *vgname, const char *vgid)
|
||||
struct lvmcache_vginfo *vginfo;
|
||||
struct lvmcache_info *info;
|
||||
struct label *label;
|
||||
struct list *devh, *tmp;
|
||||
struct list devs;
|
||||
struct dm_list *devh, *tmp;
|
||||
struct dm_list devs;
|
||||
struct device_list *devl;
|
||||
char vgid_found[ID_LEN + 1] __attribute((aligned(8)));
|
||||
|
||||
@ -277,22 +277,22 @@ const struct format_type *fmt_from_vgname(const char *vgname, const char *vgid)
|
||||
|
||||
/* This function is normally called before reading metadata so
|
||||
* we check cached labels here. Unfortunately vginfo is volatile. */
|
||||
list_init(&devs);
|
||||
list_iterate_items(info, &vginfo->infos) {
|
||||
dm_list_init(&devs);
|
||||
dm_list_iterate_items(info, &vginfo->infos) {
|
||||
if (!(devl = dm_malloc(sizeof(*devl)))) {
|
||||
log_error("device_list element allocation failed");
|
||||
return NULL;
|
||||
}
|
||||
devl->dev = info->dev;
|
||||
list_add(&devs, &devl->list);
|
||||
dm_list_add(&devs, &devl->list);
|
||||
}
|
||||
|
||||
memcpy(vgid_found, vginfo->vgid, sizeof(vgid_found));
|
||||
|
||||
list_iterate_safe(devh, tmp, &devs) {
|
||||
devl = list_item(devh, struct device_list);
|
||||
dm_list_iterate_safe(devh, tmp, &devs) {
|
||||
devl = dm_list_item(devh, struct device_list);
|
||||
label_read(devl->dev, &label, UINT64_C(0));
|
||||
list_del(&devl->list);
|
||||
dm_list_del(&devl->list);
|
||||
dm_free(devl);
|
||||
}
|
||||
|
||||
@ -362,7 +362,7 @@ static int _vginfo_is_valid(struct lvmcache_vginfo *vginfo)
|
||||
struct lvmcache_info *info;
|
||||
|
||||
/* Invalid if any info is invalid */
|
||||
list_iterate_items(info, &vginfo->infos)
|
||||
dm_list_iterate_items(info, &vginfo->infos)
|
||||
if (!_info_is_valid(info))
|
||||
return 0;
|
||||
|
||||
@ -374,7 +374,7 @@ static int _vginfo_is_invalid(struct lvmcache_vginfo *vginfo)
|
||||
{
|
||||
struct lvmcache_info *info;
|
||||
|
||||
list_iterate_items(info, &vginfo->infos)
|
||||
dm_list_iterate_items(info, &vginfo->infos)
|
||||
if (_info_is_valid(info))
|
||||
return 0;
|
||||
|
||||
@ -458,7 +458,7 @@ int lvmcache_label_scan(struct cmd_context *cmd, int full_scan)
|
||||
_has_scanned = 1;
|
||||
|
||||
/* Perform any format-specific scanning e.g. text files */
|
||||
list_iterate_items(fmt, &cmd->formats) {
|
||||
dm_list_iterate_items(fmt, &cmd->formats) {
|
||||
if (fmt->ops->scan && !fmt->ops->scan(fmt))
|
||||
goto out;
|
||||
}
|
||||
@ -516,9 +516,9 @@ struct volume_group *lvmcache_get_vg(const char *vgid, unsigned precommitted)
|
||||
return vg;
|
||||
}
|
||||
|
||||
struct list *lvmcache_get_vgids(struct cmd_context *cmd, int full_scan)
|
||||
struct dm_list *lvmcache_get_vgids(struct cmd_context *cmd, int full_scan)
|
||||
{
|
||||
struct list *vgids;
|
||||
struct dm_list *vgids;
|
||||
struct lvmcache_vginfo *vginfo;
|
||||
|
||||
lvmcache_label_scan(cmd, full_scan);
|
||||
@ -528,7 +528,7 @@ struct list *lvmcache_get_vgids(struct cmd_context *cmd, int full_scan)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
list_iterate_items(vginfo, &_vginfos) {
|
||||
dm_list_iterate_items(vginfo, &_vginfos) {
|
||||
if (!str_list_add(cmd->mem, vgids,
|
||||
dm_pool_strdup(cmd->mem, vginfo->vgid))) {
|
||||
log_error("strlist allocation failed");
|
||||
@ -539,9 +539,9 @@ struct list *lvmcache_get_vgids(struct cmd_context *cmd, int full_scan)
|
||||
return vgids;
|
||||
}
|
||||
|
||||
struct list *lvmcache_get_vgnames(struct cmd_context *cmd, int full_scan)
|
||||
struct dm_list *lvmcache_get_vgnames(struct cmd_context *cmd, int full_scan)
|
||||
{
|
||||
struct list *vgnames;
|
||||
struct dm_list *vgnames;
|
||||
struct lvmcache_vginfo *vginfo;
|
||||
|
||||
lvmcache_label_scan(cmd, full_scan);
|
||||
@ -551,7 +551,7 @@ struct list *lvmcache_get_vgnames(struct cmd_context *cmd, int full_scan)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
list_iterate_items(vginfo, &_vginfos) {
|
||||
dm_list_iterate_items(vginfo, &_vginfos) {
|
||||
if (!str_list_add(cmd->mem, vgnames,
|
||||
dm_pool_strdup(cmd->mem, vginfo->vgname))) {
|
||||
log_error("strlist allocation failed");
|
||||
@ -562,10 +562,10 @@ struct list *lvmcache_get_vgnames(struct cmd_context *cmd, int full_scan)
|
||||
return vgnames;
|
||||
}
|
||||
|
||||
struct list *lvmcache_get_pvids(struct cmd_context *cmd, const char *vgname,
|
||||
struct dm_list *lvmcache_get_pvids(struct cmd_context *cmd, const char *vgname,
|
||||
const char *vgid)
|
||||
{
|
||||
struct list *pvids;
|
||||
struct dm_list *pvids;
|
||||
struct lvmcache_vginfo *vginfo;
|
||||
struct lvmcache_info *info;
|
||||
|
||||
@ -577,7 +577,7 @@ struct list *lvmcache_get_pvids(struct cmd_context *cmd, const char *vgname,
|
||||
if (!(vginfo = vginfo_from_vgname(vgname, vgid)))
|
||||
return pvids;
|
||||
|
||||
list_iterate_items(info, &vginfo->infos) {
|
||||
dm_list_iterate_items(info, &vginfo->infos) {
|
||||
if (!str_list_add(cmd->mem, pvids,
|
||||
dm_pool_strdup(cmd->mem, info->dev->pvid))) {
|
||||
log_error("strlist allocation failed");
|
||||
@ -664,7 +664,7 @@ static int _free_vginfo(struct lvmcache_vginfo *vginfo)
|
||||
vginfo_from_vgid(vginfo->vgid) == vginfo)
|
||||
dm_hash_remove(_vgid_hash, vginfo->vgid);
|
||||
|
||||
list_del(&vginfo->list);
|
||||
dm_list_del(&vginfo->list);
|
||||
|
||||
dm_free(vginfo);
|
||||
|
||||
@ -681,7 +681,7 @@ static int _drop_vginfo(struct lvmcache_info *info, struct lvmcache_vginfo *vgin
|
||||
|
||||
/* vginfo still referenced? */
|
||||
if (!vginfo || is_orphan_vg(vginfo->vgname) ||
|
||||
!list_empty(&vginfo->infos))
|
||||
!dm_list_empty(&vginfo->infos))
|
||||
return 1;
|
||||
|
||||
if (!_free_vginfo(vginfo))
|
||||
@ -904,7 +904,7 @@ static int _lvmcache_update_vgname(struct lvmcache_info *info,
|
||||
log_error("cache vgname alloc failed for %s", vgname);
|
||||
return 0;
|
||||
}
|
||||
list_init(&vginfo->infos);
|
||||
dm_list_init(&vginfo->infos);
|
||||
|
||||
/*
|
||||
* If we're scanning and there's an invalidated entry, remove it.
|
||||
@ -912,13 +912,13 @@ static int _lvmcache_update_vgname(struct lvmcache_info *info,
|
||||
*/
|
||||
while ((primary_vginfo = vginfo_from_vgname(vgname, NULL)) &&
|
||||
_scanning_in_progress && _vginfo_is_invalid(primary_vginfo))
|
||||
list_iterate_items_safe(info2, info3, &primary_vginfo->infos) {
|
||||
dm_list_iterate_items_safe(info2, info3, &primary_vginfo->infos) {
|
||||
orphan_vginfo = vginfo_from_vgname(primary_vginfo->fmt->orphan_vg_name, NULL);
|
||||
_drop_vginfo(info2, primary_vginfo);
|
||||
_vginfo_attach_info(orphan_vginfo, info2);
|
||||
if (info2->mdas.n)
|
||||
sprintf(mdabuf, " with %u mdas",
|
||||
list_size(&info2->mdas));
|
||||
dm_list_size(&info2->mdas));
|
||||
else
|
||||
mdabuf[0] = '\0';
|
||||
log_debug("lvmcache: %s: now in VG %s%s%s%s%s",
|
||||
@ -936,9 +936,9 @@ static int _lvmcache_update_vgname(struct lvmcache_info *info,
|
||||
}
|
||||
/* Ensure orphans appear last on list_iterate */
|
||||
if (is_orphan_vg(vgname))
|
||||
list_add(&_vginfos, &vginfo->list);
|
||||
dm_list_add(&_vginfos, &vginfo->list);
|
||||
else
|
||||
list_add_h(&_vginfos, &vginfo->list);
|
||||
dm_list_add_h(&_vginfos, &vginfo->list);
|
||||
/***
|
||||
}
|
||||
***/
|
||||
@ -956,7 +956,7 @@ static int _lvmcache_update_vgname(struct lvmcache_info *info,
|
||||
|
||||
if (info) {
|
||||
if (info->mdas.n)
|
||||
sprintf(mdabuf, " with %u mdas", list_size(&info->mdas));
|
||||
sprintf(mdabuf, " with %u mdas", dm_list_size(&info->mdas));
|
||||
else
|
||||
mdabuf[0] = '\0';
|
||||
log_debug("lvmcache: %s: now in VG %s%s%s%s%s",
|
||||
@ -1027,7 +1027,7 @@ int lvmcache_update_vgname_and_id(struct lvmcache_info *info,
|
||||
}
|
||||
|
||||
/* If PV without mdas is already in a real VG, don't make it orphan */
|
||||
if (is_orphan_vg(vgname) && info->vginfo && !list_size(&info->mdas) &&
|
||||
if (is_orphan_vg(vgname) && info->vginfo && !dm_list_size(&info->mdas) &&
|
||||
!is_orphan_vg(info->vginfo->vgname) && memlock())
|
||||
return 1;
|
||||
|
||||
@ -1053,7 +1053,7 @@ int lvmcache_update_vg(struct volume_group *vg, unsigned precommitted)
|
||||
|
||||
pvid_s[sizeof(pvid_s) - 1] = '\0';
|
||||
|
||||
list_iterate_items(pvl, &vg->pvs) {
|
||||
dm_list_iterate_items(pvl, &vg->pvs) {
|
||||
strncpy(pvid_s, (char *) &pvl->pv->id, sizeof(pvid_s) - 1);
|
||||
/* FIXME Could pvl->pv->dev->pvid ever be different? */
|
||||
if ((info = info_from_pvid(pvid_s, 0)) &&
|
||||
@ -1101,7 +1101,7 @@ struct lvmcache_info *lvmcache_add(struct labeller *labeller, const char *pvid,
|
||||
|
||||
label->info = info;
|
||||
info->label = label;
|
||||
list_init(&info->list);
|
||||
dm_list_init(&info->list);
|
||||
info->dev = dev;
|
||||
} else {
|
||||
if (existing->dev != dev) {
|
||||
@ -1246,9 +1246,9 @@ void lvmcache_destroy(struct cmd_context *cmd, int retain_orphans)
|
||||
_lock_hash = NULL;
|
||||
}
|
||||
|
||||
if (!list_empty(&_vginfos))
|
||||
if (!dm_list_empty(&_vginfos))
|
||||
log_error("Internal error: _vginfos list should be empty");
|
||||
list_init(&_vginfos);
|
||||
dm_list_init(&_vginfos);
|
||||
|
||||
if (retain_orphans)
|
||||
init_lvmcache_orphans(cmd);
|
||||
|
16
lib/cache/lvmcache.h
vendored
16
lib/cache/lvmcache.h
vendored
@ -35,8 +35,8 @@ struct volume_group;
|
||||
|
||||
/* One per VG */
|
||||
struct lvmcache_vginfo {
|
||||
struct list list; /* Join these vginfos together */
|
||||
struct list infos; /* List head for lvmcache_infos */
|
||||
struct dm_list list; /* Join these vginfos together */
|
||||
struct dm_list infos; /* List head for lvmcache_infos */
|
||||
const struct format_type *fmt;
|
||||
char *vgname; /* "" == orphan */
|
||||
uint32_t status;
|
||||
@ -50,9 +50,9 @@ struct lvmcache_vginfo {
|
||||
|
||||
/* One per device */
|
||||
struct lvmcache_info {
|
||||
struct list list; /* Join VG members together */
|
||||
struct list mdas; /* list head for metadata areas */
|
||||
struct list das; /* list head for data areas */
|
||||
struct dm_list list; /* Join VG members together */
|
||||
struct dm_list mdas; /* list head for metadata areas */
|
||||
struct dm_list das; /* list head for data areas */
|
||||
struct lvmcache_vginfo *vginfo; /* NULL == unknown */
|
||||
struct label *label;
|
||||
const struct format_type *fmt;
|
||||
@ -98,14 +98,14 @@ int vgname_is_locked(const char *vgname);
|
||||
|
||||
/* Returns list of struct str_lists containing pool-allocated copy of vgnames */
|
||||
/* Set full_scan to 1 to reread every filtered device label */
|
||||
struct list *lvmcache_get_vgnames(struct cmd_context *cmd, int full_scan);
|
||||
struct dm_list *lvmcache_get_vgnames(struct cmd_context *cmd, int full_scan);
|
||||
|
||||
/* Returns list of struct str_lists containing pool-allocated copy of vgids */
|
||||
/* Set full_scan to 1 to reread every filtered device label */
|
||||
struct list *lvmcache_get_vgids(struct cmd_context *cmd, int full_scan);
|
||||
struct dm_list *lvmcache_get_vgids(struct cmd_context *cmd, int full_scan);
|
||||
|
||||
/* Returns list of struct str_lists containing pool-allocated copy of pvids */
|
||||
struct list *lvmcache_get_pvids(struct cmd_context *cmd, const char *vgname,
|
||||
struct dm_list *lvmcache_get_pvids(struct cmd_context *cmd, const char *vgname,
|
||||
const char *vgid);
|
||||
|
||||
/* Returns cached volume group metadata. */
|
||||
|
@ -410,7 +410,7 @@ static int _load_config_file(struct cmd_context *cmd, const char *tag)
|
||||
/* Is there a config file? */
|
||||
if (stat(config_file, &info) == -1) {
|
||||
if (errno == ENOENT) {
|
||||
list_add(&cmd->config_files, &cfl->list);
|
||||
dm_list_add(&cmd->config_files, &cfl->list);
|
||||
goto out;
|
||||
}
|
||||
log_sys_error("stat", config_file);
|
||||
@ -425,7 +425,7 @@ static int _load_config_file(struct cmd_context *cmd, const char *tag)
|
||||
return 0;
|
||||
}
|
||||
|
||||
list_add(&cmd->config_files, &cfl->list);
|
||||
dm_list_add(&cmd->config_files, &cfl->list);
|
||||
|
||||
out:
|
||||
if (*tag)
|
||||
@ -461,7 +461,7 @@ static int _init_tag_configs(struct cmd_context *cmd)
|
||||
struct str_list *sl;
|
||||
|
||||
/* Tag list may grow while inside this loop */
|
||||
list_iterate_items(sl, &cmd->tags) {
|
||||
dm_list_iterate_items(sl, &cmd->tags) {
|
||||
if (!_load_config_file(cmd, sl->str))
|
||||
return_0;
|
||||
}
|
||||
@ -481,7 +481,7 @@ static int _merge_config_files(struct cmd_context *cmd)
|
||||
}
|
||||
}
|
||||
|
||||
list_iterate_items(cfl, &cmd->config_files) {
|
||||
dm_list_iterate_items(cfl, &cmd->config_files) {
|
||||
/* Merge all config trees into cmd->cft using merge/tag rules */
|
||||
if (!merge_config_tree(cmd, cmd->cft, cfl->cft))
|
||||
return_0;
|
||||
@ -492,10 +492,10 @@ static int _merge_config_files(struct cmd_context *cmd)
|
||||
|
||||
static void _destroy_tags(struct cmd_context *cmd)
|
||||
{
|
||||
struct list *slh, *slht;
|
||||
struct dm_list *slh, *slht;
|
||||
|
||||
list_iterate_safe(slh, slht, &cmd->tags) {
|
||||
list_del(slh);
|
||||
dm_list_iterate_safe(slh, slht, &cmd->tags) {
|
||||
dm_list_del(slh);
|
||||
}
|
||||
}
|
||||
|
||||
@ -503,7 +503,7 @@ int config_files_changed(struct cmd_context *cmd)
|
||||
{
|
||||
struct config_tree_list *cfl;
|
||||
|
||||
list_iterate_items(cfl, &cmd->config_files) {
|
||||
dm_list_iterate_items(cfl, &cmd->config_files) {
|
||||
if (config_file_changed(cfl->cft))
|
||||
return 1;
|
||||
}
|
||||
@ -520,11 +520,11 @@ static void _destroy_tag_configs(struct cmd_context *cmd)
|
||||
cmd->cft = NULL;
|
||||
}
|
||||
|
||||
list_iterate_items(cfl, &cmd->config_files) {
|
||||
dm_list_iterate_items(cfl, &cmd->config_files) {
|
||||
destroy_config_tree(cfl->cft);
|
||||
}
|
||||
|
||||
list_init(&cmd->config_files);
|
||||
dm_list_init(&cmd->config_files);
|
||||
}
|
||||
|
||||
static int _init_dev_cache(struct cmd_context *cmd)
|
||||
@ -725,14 +725,14 @@ static int _init_formats(struct cmd_context *cmd)
|
||||
if (!(fmt = init_lvm1_format(cmd)))
|
||||
return 0;
|
||||
fmt->library = NULL;
|
||||
list_add(&cmd->formats, &fmt->list);
|
||||
dm_list_add(&cmd->formats, &fmt->list);
|
||||
#endif
|
||||
|
||||
#ifdef POOL_INTERNAL
|
||||
if (!(fmt = init_pool_format(cmd)))
|
||||
return 0;
|
||||
fmt->library = NULL;
|
||||
list_add(&cmd->formats, &fmt->list);
|
||||
dm_list_add(&cmd->formats, &fmt->list);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBDL
|
||||
@ -764,7 +764,7 @@ static int _init_formats(struct cmd_context *cmd)
|
||||
if (!(fmt = init_format_fn(cmd)))
|
||||
return 0;
|
||||
fmt->library = lib;
|
||||
list_add(&cmd->formats, &fmt->list);
|
||||
dm_list_add(&cmd->formats, &fmt->list);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -772,14 +772,14 @@ static int _init_formats(struct cmd_context *cmd)
|
||||
if (!(fmt = create_text_format(cmd)))
|
||||
return 0;
|
||||
fmt->library = NULL;
|
||||
list_add(&cmd->formats, &fmt->list);
|
||||
dm_list_add(&cmd->formats, &fmt->list);
|
||||
|
||||
cmd->fmt_backup = fmt;
|
||||
|
||||
format = find_config_tree_str(cmd, "global/format",
|
||||
DEFAULT_FORMAT);
|
||||
|
||||
list_iterate_items(fmt, &cmd->formats) {
|
||||
dm_list_iterate_items(fmt, &cmd->formats) {
|
||||
if (!strcasecmp(fmt->name, format) ||
|
||||
(fmt->alias && !strcasecmp(fmt->alias, format))) {
|
||||
cmd->default_settings.fmt = fmt;
|
||||
@ -795,7 +795,7 @@ int init_lvmcache_orphans(struct cmd_context *cmd)
|
||||
{
|
||||
struct format_type *fmt;
|
||||
|
||||
list_iterate_items(fmt, &cmd->formats)
|
||||
dm_list_iterate_items(fmt, &cmd->formats)
|
||||
if (!lvmcache_add_orphan_vginfo(fmt->orphan_vg_name, fmt))
|
||||
return_0;
|
||||
|
||||
@ -813,35 +813,35 @@ static int _init_segtypes(struct cmd_context *cmd)
|
||||
if (!(segtype = init_striped_segtype(cmd)))
|
||||
return 0;
|
||||
segtype->library = NULL;
|
||||
list_add(&cmd->segtypes, &segtype->list);
|
||||
dm_list_add(&cmd->segtypes, &segtype->list);
|
||||
|
||||
if (!(segtype = init_zero_segtype(cmd)))
|
||||
return 0;
|
||||
segtype->library = NULL;
|
||||
list_add(&cmd->segtypes, &segtype->list);
|
||||
dm_list_add(&cmd->segtypes, &segtype->list);
|
||||
|
||||
if (!(segtype = init_error_segtype(cmd)))
|
||||
return 0;
|
||||
segtype->library = NULL;
|
||||
list_add(&cmd->segtypes, &segtype->list);
|
||||
dm_list_add(&cmd->segtypes, &segtype->list);
|
||||
|
||||
if (!(segtype = init_free_segtype(cmd)))
|
||||
return 0;
|
||||
segtype->library = NULL;
|
||||
list_add(&cmd->segtypes, &segtype->list);
|
||||
dm_list_add(&cmd->segtypes, &segtype->list);
|
||||
|
||||
#ifdef SNAPSHOT_INTERNAL
|
||||
if (!(segtype = init_snapshot_segtype(cmd)))
|
||||
return 0;
|
||||
segtype->library = NULL;
|
||||
list_add(&cmd->segtypes, &segtype->list);
|
||||
dm_list_add(&cmd->segtypes, &segtype->list);
|
||||
#endif
|
||||
|
||||
#ifdef MIRRORED_INTERNAL
|
||||
if (!(segtype = init_mirrored_segtype(cmd)))
|
||||
return 0;
|
||||
segtype->library = NULL;
|
||||
list_add(&cmd->segtypes, &segtype->list);
|
||||
dm_list_add(&cmd->segtypes, &segtype->list);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBDL
|
||||
@ -874,16 +874,16 @@ static int _init_segtypes(struct cmd_context *cmd)
|
||||
if (!(segtype = init_segtype_fn(cmd)))
|
||||
return 0;
|
||||
segtype->library = lib;
|
||||
list_add(&cmd->segtypes, &segtype->list);
|
||||
dm_list_add(&cmd->segtypes, &segtype->list);
|
||||
|
||||
list_iterate_items(segtype2, &cmd->segtypes) {
|
||||
dm_list_iterate_items(segtype2, &cmd->segtypes) {
|
||||
if ((segtype == segtype2) ||
|
||||
strcmp(segtype2->name, segtype->name))
|
||||
continue;
|
||||
log_error("Duplicate segment type %s: "
|
||||
"unloading shared library %s",
|
||||
segtype->name, cv->v.str);
|
||||
list_del(&segtype->list);
|
||||
dm_list_del(&segtype->list);
|
||||
segtype->ops->destroy(segtype);
|
||||
dlclose(lib);
|
||||
}
|
||||
@ -1008,10 +1008,10 @@ struct cmd_context *create_toolcontext(struct arg *the_args, unsigned is_static,
|
||||
cmd->is_long_lived = is_long_lived;
|
||||
cmd->handles_missing_pvs = 0;
|
||||
cmd->hosttags = 0;
|
||||
list_init(&cmd->formats);
|
||||
list_init(&cmd->segtypes);
|
||||
list_init(&cmd->tags);
|
||||
list_init(&cmd->config_files);
|
||||
dm_list_init(&cmd->formats);
|
||||
dm_list_init(&cmd->segtypes);
|
||||
dm_list_init(&cmd->tags);
|
||||
dm_list_init(&cmd->config_files);
|
||||
|
||||
strcpy(cmd->sys_dir, DEFAULT_SYS_DIR);
|
||||
|
||||
@ -1088,15 +1088,15 @@ struct cmd_context *create_toolcontext(struct arg *the_args, unsigned is_static,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void _destroy_formats(struct list *formats)
|
||||
static void _destroy_formats(struct dm_list *formats)
|
||||
{
|
||||
struct list *fmtl, *tmp;
|
||||
struct dm_list *fmtl, *tmp;
|
||||
struct format_type *fmt;
|
||||
void *lib;
|
||||
|
||||
list_iterate_safe(fmtl, tmp, formats) {
|
||||
fmt = list_item(fmtl, struct format_type);
|
||||
list_del(&fmt->list);
|
||||
dm_list_iterate_safe(fmtl, tmp, formats) {
|
||||
fmt = dm_list_item(fmtl, struct format_type);
|
||||
dm_list_del(&fmt->list);
|
||||
lib = fmt->library;
|
||||