diff options
Diffstat (limited to 'daemons/lvmpolld')
-rw-r--r-- | daemons/lvmpolld/lvmpolld-cmd-utils.c | 10 | ||||
-rw-r--r-- | daemons/lvmpolld/lvmpolld-core.c | 16 | ||||
-rw-r--r-- | daemons/lvmpolld/lvmpolld-data-utils.c | 54 |
3 files changed, 40 insertions, 40 deletions
diff --git a/daemons/lvmpolld/lvmpolld-cmd-utils.c b/daemons/lvmpolld/lvmpolld-cmd-utils.c index 601338fff..865b47ec9 100644 --- a/daemons/lvmpolld/lvmpolld-cmd-utils.c +++ b/daemons/lvmpolld/lvmpolld-cmd-utils.c @@ -36,7 +36,7 @@ static int add_to_cmd_arr(const char ***cmdargv, const char *str, unsigned *ind) const char **newargv; if (*ind && !(*ind % MIN_ARGV_SIZE)) { - newargv = dm_realloc(*cmdargv, (*ind / MIN_ARGV_SIZE + 1) * MIN_ARGV_SIZE * sizeof(char *)); + newargv = realloc(*cmdargv, (*ind / MIN_ARGV_SIZE + 1) * MIN_ARGV_SIZE * sizeof(char *)); if (!newargv) return 0; *cmdargv = newargv; @@ -50,7 +50,7 @@ static int add_to_cmd_arr(const char ***cmdargv, const char *str, unsigned *ind) const char **cmdargv_ctr(const struct lvmpolld_lv *pdlv, const char *lvm_binary, unsigned abort_polling, unsigned handle_missing_pvs) { unsigned i = 0; - const char **cmd_argv = dm_malloc(MIN_ARGV_SIZE * sizeof(char *)); + const char **cmd_argv = malloc(MIN_ARGV_SIZE * sizeof(char *)); if (!cmd_argv) return NULL; @@ -98,7 +98,7 @@ const char **cmdargv_ctr(const struct lvmpolld_lv *pdlv, const char *lvm_binary, return cmd_argv; err: - dm_free(cmd_argv); + free(cmd_argv); return NULL; } @@ -122,7 +122,7 @@ static int copy_env(const char ***cmd_envp, unsigned *i, const char *exclude) const char **cmdenvp_ctr(const struct lvmpolld_lv *pdlv) { unsigned i = 0; - const char **cmd_envp = dm_malloc(MIN_ARGV_SIZE * sizeof(char *)); + const char **cmd_envp = malloc(MIN_ARGV_SIZE * sizeof(char *)); if (!cmd_envp) return NULL; @@ -141,6 +141,6 @@ const char **cmdenvp_ctr(const struct lvmpolld_lv *pdlv) return cmd_envp; err: - dm_free(cmd_envp); + free(cmd_envp); return NULL; } diff --git a/daemons/lvmpolld/lvmpolld-core.c b/daemons/lvmpolld/lvmpolld-core.c index fd7327241..3aac65f23 100644 --- a/daemons/lvmpolld/lvmpolld-core.c +++ b/daemons/lvmpolld/lvmpolld-core.c @@ -530,7 +530,7 @@ static response progress_info(client_handle h, struct lvmpolld_state *ls, reques pdst_unlock(pdst); - dm_free(id); + free(id); if (pdlv) { if (st.error) @@ -673,7 +673,7 @@ static response poll_init(client_handle h, struct lvmpolld_state *ls, request re PD_LOG_PREFIX, "poll operation type mismatch on LV identified by", id, polling_op(pdlv_get_type(pdlv)), polling_op(type)); - dm_free(id); + free(id); return reply(LVMPD_RESP_EINVAL, REASON_DIFFERENT_OPERATION_IN_PROGRESS); } @@ -683,14 +683,14 @@ static response poll_init(client_handle h, struct lvmpolld_state *ls, request re lvname, sysdir, type, abort_polling, 2 * uinterval); if (!pdlv) { pdst_unlock(pdst); - dm_free(id); + free(id); return reply(LVMPD_RESP_FAILED, REASON_ENOMEM); } if (!pdst_locked_insert(pdst, id, pdlv)) { pdlv_destroy(pdlv); pdst_unlock(pdst); ERROR(ls, "%s: %s", PD_LOG_PREFIX, "couldn't store internal LV data structure"); - dm_free(id); + free(id); return reply(LVMPD_RESP_FAILED, REASON_ENOMEM); } if (!spawn_detached_thread(pdlv)) { @@ -698,7 +698,7 @@ static response poll_init(client_handle h, struct lvmpolld_state *ls, request re pdst_locked_remove(pdst, id); pdlv_destroy(pdlv); pdst_unlock(pdst); - dm_free(id); + free(id); return reply(LVMPD_RESP_FAILED, REASON_ENOMEM); } @@ -709,7 +709,7 @@ static response poll_init(client_handle h, struct lvmpolld_state *ls, request re pdst_unlock(pdst); - dm_free(id); + free(id); return daemon_reply_simple(LVMPD_RESP_OK, NULL); } @@ -806,7 +806,7 @@ static int printout_raw_response(const char *prefix, const char *msg) char *buf; char *pos; - buf = dm_strdup(msg); + buf = strdup(msg); pos = buf; if (!buf) @@ -819,7 +819,7 @@ static int printout_raw_response(const char *prefix, const char *msg) _log_line(pos, &b); pos = next ? next + 1 : 0; } - dm_free(buf); + free(buf); return 1; } diff --git a/daemons/lvmpolld/lvmpolld-data-utils.c b/daemons/lvmpolld/lvmpolld-data-utils.c index d5e113936..23e316a96 100644 --- a/daemons/lvmpolld/lvmpolld-data-utils.c +++ b/daemons/lvmpolld/lvmpolld-data-utils.c @@ -27,12 +27,12 @@ static char *_construct_full_lvname(const char *vgname, const char *lvname) size_t l; l = strlen(vgname) + strlen(lvname) + 2; /* vg/lv and \0 */ - name = (char *) dm_malloc(l * sizeof(char)); + name = (char *) malloc(l * sizeof(char)); if (!name) return NULL; if (dm_snprintf(name, l, "%s/%s", vgname, lvname) < 0) { - dm_free(name); + free(name); name = NULL; } @@ -47,7 +47,7 @@ static char *_construct_lvm_system_dir_env(const char *sysdir) * just single char to store NULL byte */ size_t l = sysdir ? strlen(sysdir) + 16 : 1; - char *env = (char *) dm_malloc(l * sizeof(char)); + char *env = (char *) malloc(l * sizeof(char)); if (!env) return NULL; @@ -55,7 +55,7 @@ static char *_construct_lvm_system_dir_env(const char *sysdir) *env = '\0'; if (sysdir && dm_snprintf(env, l, "%s%s", LVM_SYSTEM_DIR, sysdir) < 0) { - dm_free(env); + free(env); env = NULL; } @@ -74,7 +74,7 @@ char *construct_id(const char *sysdir, const char *uuid) size_t l; l = strlen(uuid) + (sysdir ? strlen(sysdir) : 0) + 1; - id = (char *) dm_malloc(l * sizeof(char)); + id = (char *) malloc(l * sizeof(char)); if (!id) return NULL; @@ -82,7 +82,7 @@ char *construct_id(const char *sysdir, const char *uuid) dm_snprintf(id, l, "%s", uuid); if (r < 0) { - dm_free(id); + free(id); id = NULL; } @@ -95,7 +95,7 @@ struct lvmpolld_lv *pdlv_create(struct lvmpolld_state *ls, const char *id, const char *sinterval, unsigned pdtimeout, struct lvmpolld_store *pdst) { - char *lvmpolld_id = dm_strdup(id), /* copy */ + char *lvmpolld_id = strdup(id), /* copy */ *full_lvname = _construct_full_lvname(vgname, lvname), /* copy */ *lvm_system_dir_env = _construct_lvm_system_dir_env(sysdir); /* copy */ @@ -106,12 +106,12 @@ struct lvmpolld_lv *pdlv_create(struct lvmpolld_state *ls, const char *id, .lvid = _get_lvid(lvmpolld_id, sysdir), .lvname = full_lvname, .lvm_system_dir_env = lvm_system_dir_env, - .sinterval = dm_strdup(sinterval), /* copy */ + .sinterval = strdup(sinterval), /* copy */ .pdtimeout = pdtimeout < MIN_POLLING_TIMEOUT ? MIN_POLLING_TIMEOUT : pdtimeout, .cmd_state = { .retcode = -1, .signal = 0 }, .pdst = pdst, .init_rq_count = 1 - }, *pdlv = (struct lvmpolld_lv *) dm_malloc(sizeof(struct lvmpolld_lv)); + }, *pdlv = (struct lvmpolld_lv *) malloc(sizeof(struct lvmpolld_lv)); if (!pdlv || !tmp.lvid || !tmp.lvname || !tmp.lvm_system_dir_env || !tmp.sinterval) goto err; @@ -124,27 +124,27 @@ struct lvmpolld_lv *pdlv_create(struct lvmpolld_state *ls, const char *id, return pdlv; err: - dm_free((void *)full_lvname); - dm_free((void *)lvmpolld_id); - dm_free((void *)lvm_system_dir_env); - dm_free((void *)tmp.sinterval); - dm_free((void *)pdlv); + free((void *)full_lvname); + free((void *)lvmpolld_id); + free((void *)lvm_system_dir_env); + free((void *)tmp.sinterval); + free((void *)pdlv); return NULL; } void pdlv_destroy(struct lvmpolld_lv *pdlv) { - dm_free((void *)pdlv->lvmpolld_id); - dm_free((void *)pdlv->lvname); - dm_free((void *)pdlv->sinterval); - dm_free((void *)pdlv->lvm_system_dir_env); - dm_free((void *)pdlv->cmdargv); - dm_free((void *)pdlv->cmdenvp); + free((void *)pdlv->lvmpolld_id); + free((void *)pdlv->lvname); + free((void *)pdlv->sinterval); + free((void *)pdlv->lvm_system_dir_env); + free((void *)pdlv->cmdargv); + free((void *)pdlv->cmdenvp); pthread_mutex_destroy(&pdlv->lock); - dm_free((void *)pdlv); + free((void *)pdlv); } unsigned pdlv_get_polling_finished(struct lvmpolld_lv *pdlv) @@ -194,7 +194,7 @@ void pdlv_set_polling_finished(struct lvmpolld_lv *pdlv, unsigned finished) struct lvmpolld_store *pdst_init(const char *name) { - struct lvmpolld_store *pdst = (struct lvmpolld_store *) dm_malloc(sizeof(struct lvmpolld_store)); + struct lvmpolld_store *pdst = (struct lvmpolld_store *) malloc(sizeof(struct lvmpolld_store)); if (!pdst) return NULL; @@ -212,7 +212,7 @@ struct lvmpolld_store *pdst_init(const char *name) err_mutex: dm_hash_destroy(pdst->store); err_hash: - dm_free(pdst); + free(pdst); return NULL; } @@ -223,7 +223,7 @@ void pdst_destroy(struct lvmpolld_store *pdst) dm_hash_destroy(pdst->store); pthread_mutex_destroy(&pdst->lock); - dm_free(pdst); + free(pdst); } void pdst_locked_lock_all_pdlvs(const struct lvmpolld_store *pdst) @@ -321,7 +321,7 @@ void pdst_locked_destroy_all_pdlvs(const struct lvmpolld_store *pdst) struct lvmpolld_thread_data *lvmpolld_thread_data_constructor(struct lvmpolld_lv *pdlv) { - struct lvmpolld_thread_data *data = (struct lvmpolld_thread_data *) dm_malloc(sizeof(struct lvmpolld_thread_data)); + struct lvmpolld_thread_data *data = (struct lvmpolld_thread_data *) malloc(sizeof(struct lvmpolld_thread_data)); if (!data) return NULL; @@ -368,7 +368,7 @@ void lvmpolld_thread_data_destroy(void *thread_private) pdst_unlock(data->pdlv->pdst); } - /* may get reallocated in getline(). dm_free must not be used */ + /* may get reallocated in getline(). free must not be used */ free(data->line); if (data->fout && !fclose(data->fout)) @@ -389,5 +389,5 @@ void lvmpolld_thread_data_destroy(void *thread_private) if (data->errpipe[1] >= 0) (void) close(data->errpipe[1]); - dm_free(data); + free(data); } |