Skip to contentSkip to conversation

master - device_mapper: remove dbg_malloc.

PATCH Joe Thornber 1 participant 1 message Jun 8, 2018 MD RAID

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d5da55ed85248adb066d293c2a1b863ce17d2779
Commit:        d5da55ed85248adb066d293c2a1b863ce17d2779
Parent:        c78239d8605f333915543c0e0c3ccf4f4ef5ee8f
Author:        Joe Thornber <[email protected]>
AuthorDate:    Fri Jun 8 13:40:53 2018 +0100
Committer:     Joe Thornber <[email protected]>
CommitterDate: Fri Jun 8 13:40:53 2018 +0100

device_mapper: remove dbg_malloc.

I wrote dbg_malloc before we had valgrind. These days there's just no need.

---
 daemons/cmirrord/functions.c           |   14 +-
 daemons/dmeventd/dmeventd.c            |   72 +++---
 daemons/dmeventd/libdevmapper-event.c  |   64 +++---
 daemons/dmfilemapd/dmfilemapd.c        |   14 +-
 daemons/lvmetad/lvmetad-core.c         |   78 +++---
 daemons/lvmpolld/lvmpolld-cmd-utils.c  |   10 +-
 daemons/lvmpolld/lvmpolld-core.c       |   16 +-
 daemons/lvmpolld/lvmpolld-data-utils.c |   54 ++--
 device_mapper/Makefile                 |    1 -
 device_mapper/all.h                    |   44 +---
 device_mapper/datastruct/bitset.c      |    5 +-
 device_mapper/datastruct/hash.c        |   21 +-
 device_mapper/ioctl/libdm-iface.c      |   56 +++---
 device_mapper/libdm-common.c           |   57 +++---
 device_mapper/libdm-config.c           |    8 +-
 device_mapper/libdm-deptree.c          |    5 +-
 device_mapper/libdm-file.c             |    4 +-
 device_mapper/libdm-report.c           |   45 ++--
 device_mapper/libdm-stats.c            |  119 +++++-----
 device_mapper/libdm-string.c           |   12 +-
 device_mapper/libdm-timestamp.c        |    7 +-
 device_mapper/mm/dbg_malloc.c          |  413 --------------------------------
 device_mapper/mm/pool-debug.c          |   20 +-
 device_mapper/mm/pool-fast.c           |    9 +-
 lib/activate/activate.c                |    2 +-
 lib/activate/dev_manager.c             |    4 +-
 lib/activate/fs.c                      |    4 +-
 lib/cache/lvmcache.c                   |   57 +++---
 lib/cache/lvmetad.c                    |    4 +-
 lib/cache_segtype/cache.c              |    7 +-
 lib/commands/toolcontext.c             |   15 +-
 lib/config/config.c                    |   16 +-
 lib/device/bcache.c                    |   40 ++--
 lib/device/dev-cache.c                 |   29 ++-
 lib/device/dev-io.c                    |    4 +-
 lib/device/dev-type.c                  |    5 +-
 lib/device/device.h                    |    2 +-
 lib/error/errseg.c                     |    5 +-
 lib/filters/filter-composite.c         |   11 +-
 lib/filters/filter-fwraid.c            |    5 +-
 lib/filters/filter-internal.c          |    5 +-
 lib/filters/filter-md.c                |    5 +-
 lib/filters/filter-mpath.c             |    5 +-
 lib/filters/filter-partitioned.c       |    5 +-
 lib/filters/filter-persistent.c        |   19 +-
 lib/filters/filter-signature.c         |    5 +-
 lib/filters/filter-type.c              |    5 +-
 lib/filters/filter-usable.c            |   11 +-
 lib/format_text/archiver.c             |    8 +-
 lib/format_text/export.c               |   33 ++--
 lib/format_text/flags.c                |    4 +-
 lib/format_text/format-text.c          |   32 ++--
 lib/format_text/text_label.c           |   19 +-
 lib/freeseg/freeseg.c                  |    5 +-
 lib/label/label.c                      |   21 +-
 lib/log/log.c                          |   10 +-
 lib/lvmpolld/lvmpolld-client.c         |    4 +-
 lib/metadata/lv_manip.c                |    6 +-
 lib/metadata/metadata-liblvm.c         |    6 +-
 lib/mirror/mirrored.c                  |    7 +-
 lib/misc/lib.h                         |    1 +
 lib/misc/lvm-file.c                    |   10 +-
 lib/misc/lvm-flock.c                   |   14 +-
 lib/mm/memlock.c                       |    4 +-
 lib/raid/raid.c                        |   11 +-
 lib/snapshot/snapshot.c                |    7 +-
 lib/striped/striped.c                  |    5 +-
 lib/thin/thin.c                        |    7 +-
 lib/unknown/unknown.c                  |   11 +-
 lib/zero/zero.c                        |    5 +-
 libdaemon/client/config-util.c         |   10 +-
 libdaemon/client/daemon-client.c       |    6 +-
 libdaemon/server/daemon-log.c          |   12 +-
 libdaemon/server/daemon-server.c       |    4 +-
 tools/command.c                        |   36 ++--
 tools/dmsetup.c                        |   95 ++++----
 tools/lvmcmdlib.c                      |    4 +-
 tools/pvck.c                           |    3 +-
 tools/toollib.c                        |    2 +-
 tools/vgcfgbackup.c                    |   12 +-
 80 files changed, 714 insertions(+), 1118 deletions(-)
daemons/cmirrord/functions.c +7 -7
index 5e43e1a..61bcf16 100644
@@ -435,7 +435,7 @@ static int _clog_ctr(char *uuid, uint64_t luid,
 			block_on_error = 1;
 	}
 
-	lc = dm_zalloc(sizeof(*lc));
+	lc = zalloc(sizeof(*lc));
 	if (!lc) {
 		LOG_ERROR("Unable to allocate cluster log context");
 		r = -ENOMEM;
@@ -532,9 +532,9 @@ fail:
 			LOG_ERROR("Close device error, %s: %s",
 				  disk_path, strerror(errno));
 		free(lc->disk_buffer);
-		dm_free(lc->sync_bits);
-		dm_free(lc->clean_bits);
-		dm_free(lc);
+		free(lc->sync_bits);
+		free(lc->clean_bits);
+		free(lc);
 	}
 	return r;
 }
@@ -659,9 +659,9 @@ static int clog_dtr(struct dm_ulog_request *rq)
 			  strerror(errno));
 	if (lc->disk_buffer)
 		free(lc->disk_buffer);
-	dm_free(lc->clean_bits);
-	dm_free(lc->sync_bits);
-	dm_free(lc);
+	free(lc->clean_bits);
+	free(lc->sync_bits);
+	free(lc);
 
 	return 0;
 }
daemons/dmeventd/dmeventd.c +36 -36

220 lines not on this page · raw message

daemons/dmeventd/libdevmapper-event.c +32 -32

202 lines not on this page · raw message

daemons/dmfilemapd/dmfilemapd.c +7 -7
index 4e048ff..726ad6e 100644
@@ -311,7 +311,7 @@ static int _parse_args(int argc, char **argv, struct filemap_monitor *fm)
 		return 0;
 	}
 
-	fm->path = dm_strdup(argv[0]);
+	fm->path = strdup(argv[0]);
 	if (!fm->path) {
 		_early_log("Could not allocate memory for path argument.");
 		return 0;
@@ -538,8 +538,8 @@ static void _filemap_monitor_destroy(struct filemap_monitor *fm)
 		_filemap_monitor_end_notify(fm);
 		_filemap_monitor_close_fd(fm);
 	}
-	dm_free((void *) fm->program_id);
-	dm_free(fm->path);
+	free((void *) fm->program_id);
+	free(fm->path);
 }
 
 static int _filemap_monitor_check_same_file(int fd1, int fd2)
@@ -699,7 +699,7 @@ static int _update_regions(struct dm_stats *dms, struct filemap_monitor *fm)
 			 fm->group_id, regions[0]);
 		fm->group_id = regions[0];
 	}
-	dm_free(regions);
+	free(regions);
 	fm->nr_regions = nr_regions;
 	return 1;
 }
@@ -741,7 +741,7 @@ static int _dmfilemapd(struct filemap_monitor *fm)
 	 */
 	program_id = dm_stats_get_region_program_id(dms, fm->group_id);
 	if (program_id)
-		fm->program_id = dm_strdup(program_id);
+		fm->program_id = strdup(program_id);
 	else
 		fm->program_id = NULL;
 	dm_stats_set_program_id(dms, 1, program_id);
@@ -817,7 +817,7 @@ int main(int argc, char **argv)
 	memset(&fm, 0, sizeof(fm));
 
 	if (!_parse_args(argc, argv, &fm)) {
-		dm_free(fm.path);
+		free(fm.path);
 		return 1;
 	}
 
@@ -828,7 +828,7 @@ int main(int argc, char **argv)
 		 _mode_names[fm.mode], fm.path);
 
 	if (!_foreground && !_daemonise(&fm)) {
-		dm_free(fm.path);
+		free(fm.path);
 		return 1;
 	}
 
daemons/lvmetad/lvmetad-core.c +39 -39

254 lines not on this page · raw message

daemons/lvmpolld/lvmpolld-cmd-utils.c +5 -5
index 601338f..865b47e 100644
@@ -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;
 }
daemons/lvmpolld/lvmpolld-core.c +8 -8
index fd73272..3aac65f 100644
@@ -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;
 }
daemons/lvmpolld/lvmpolld-data-utils.c +27 -27

153 lines not on this page · raw message

device_mapper/Makefile +0 -1
index 4036cb4..da97675 100644
@@ -22,7 +22,6 @@ DEVICE_MAPPER_SOURCE=\
 	device_mapper/libdm-string.c \
 	device_mapper/libdm-targets.c \
 	device_mapper/libdm-timestamp.c \
-	device_mapper/mm/dbg_malloc.c \
 	device_mapper/mm/pool.c \
 	device_mapper/regex/matcher.c \
 	device_mapper/regex/parse_rx.c \
device_mapper/all.h +7 -37

92 lines not on this page · raw message

device_mapper/datastruct/bitset.c +3 -2
index f093ac0..fc2c3c3 100644
@@ -14,6 +14,7 @@
  */
 
 #include "device_mapper/misc/dmlib.h"
+#include "base/memory/zalloc.h"
 
 #include <ctype.h>
 
@@ -29,7 +30,7 @@ dm_bitset_t dm_bitset_create(struct dm_pool *mem, unsigned num_bits)
 	if (mem)
 		bs = dm_pool_zalloc(mem, size);
 	else
-		bs = dm_zalloc(size);
+		bs = zalloc(size);
 
 	if (!bs)
 		return NULL;
@@ -41,7 +42,7 @@ dm_bitset_t dm_bitset_create(struct dm_pool *mem, unsigned num_bits)
 
 void dm_bitset_destroy(dm_bitset_t bs)
 {
-	dm_free(bs);
+	free(bs);
 }
 
 int dm_bitset_equal(dm_bitset_t in1, dm_bitset_t in2)
device_mapper/datastruct/hash.c +11 -10
index 59e719b..f16508a 100644
@@ -14,6 +14,7 @@
  */
 
 #include "device_mapper/misc/dmlib.h"
+#include "base/memory/zalloc.h"
 
 struct dm_hash_node {
 	struct dm_hash_node *next;
@@ -59,7 +60,7 @@ static unsigned char _nums[] = {
 
 static struct dm_hash_node *_create_node(const char *str, unsigned len)
 {
-	struct dm_hash_node *n = dm_malloc(sizeof(*n) + len);
+	struct dm_hash_node *n = malloc(sizeof(*n) + len);
 
 	if (n) {
 		memcpy(n->key, str, len);
@@ -91,7 +92,7 @@ struct dm_hash_table *dm_hash_create(unsigned size_hint)
 {
 	size_t len;
 	unsigned new_size = 16u;
-	struct dm_hash_table *hc = dm_zalloc(sizeof(*hc));
+	struct dm_hash_table *hc = zalloc(sizeof(*hc));
 
 	if (!hc)
 		return_0;
@@ -102,14 +103,14 @@ struct dm_hash_table *dm_hash_create(unsigned size_hint)
 
 	hc->num_slots = new_size;
 	len = sizeof(*(hc->slots)) * new_size;
-	if (!(hc->slots = dm_zalloc(len)))
+	if (!(hc->slots = zalloc(len)))
 		goto_bad;
 
 	return hc;
 
       bad:
-	dm_free(hc->slots);
-	dm_free(hc);
+	free(hc->slots);
+	free(hc);
 	return 0;
 }
 
@@ -121,15 +122,15 @@ static void _free_nodes(struct dm_hash_table *t)
 	for (i = 0; i < t->num_slots; i++)
 		for (c = t->slots[i]; c; c = n) {
 			n = c->next;
-			dm_free(c);
+			free(c);
 		}
 }
 
 void dm_hash_destroy(struct dm_hash_table *t)
 {
 	_free_nodes(t);
-	dm_free(t->slots);
-	dm_free(t);
+	free(t->slots);
+	free(t);
 }
 
 static struct dm_hash_node **_find(struct dm_hash_table *t, const void *key,
@@ -187,7 +188,7 @@ void dm_hash_remove_binary(struct dm_hash_table *t, const void *key,
 	if (*c) {
 		struct dm_hash_node *old = *c;
 		*c = (*c)->next;
-		dm_free(old);
+		free(old);
 		t->num_nodes--;
 	}
 }
@@ -287,7 +288,7 @@ void dm_hash_remove_with_val(struct dm_hash_table *t, const char *key,
 	if (c && *c) {
 		struct dm_hash_node *old = *c;
 		*c = (*c)->next;
-		dm_free(old);
+		free(old);
 		t->num_nodes--;
 	}
 }
device_mapper/ioctl/libdm-iface.c +28 -28

151 lines not on this page · raw message

device_mapper/libdm-common.c +29 -28

163 lines not on this page · raw message

device_mapper/libdm-config.c +4 -4
index fd4d929..0928843 100644
@@ -269,11 +269,11 @@ static int _line_append(struct config_output *out, const char *fmt, ...)
 
 	if (!dm_pool_grow_object(out->mem, dyn_buf ? : buf, 0)) {
 		log_error("dm_pool_grow_object failed for config line");
-		dm_free(dyn_buf);
+		free(dyn_buf);
 		return 0;
 	}
 
-	dm_free(dyn_buf);
+	free(dyn_buf);
 
 	return 1;
 }
@@ -1441,12 +1441,12 @@ static int _enumerate(const char *path, struct dm_config_node *cn, int (*cb)(con
 		} else
 			if (!cb(sub, cn, baton))
 				goto_bad;
-		dm_free(sub);
+		free(sub);
 		cn = cn->sib;
 	}
 	return 1;
 bad:
-	dm_free(sub);
+	free(sub);
 	return 0;
 }
 
device_mapper/libdm-deptree.c +3 -2
index fab3e06..d177374 100644
@@ -19,6 +19,7 @@
 #include "misc/dm-ioctl.h"
 
 #include <stdarg.h>
+#include <string.h>
 #include <sys/param.h>
 #include <sys/utsname.h>
 
@@ -2660,7 +2661,7 @@ static int _emit_segment(struct dm_task *dmt, uint32_t major, uint32_t minor,
 	int ret;
 
 	do {
-		if (!(params = dm_malloc(paramsize))) {
+		if (!(params = malloc(paramsize))) {
 			log_error("Insufficient space for target parameters.");
 			return 0;
 		}
@@ -2668,7 +2669,7 @@ static int _emit_segment(struct dm_task *dmt, uint32_t major, uint32_t minor,
 		params[0] = '\0';
 		ret = _emit_segment_line(dmt, major, minor, seg, seg_start,
 					 params, paramsize);
-		dm_free(params);
+		free(params);
 
 		if (!ret)
 			stack;
device_mapper/libdm-file.c +2 -2
index 5c6d223..096c796 100644
@@ -45,7 +45,7 @@ static int _create_dir_recursive(const char *dir)
 
 	log_verbose("Creating directory \"%s\"", dir);
 	/* Create parent directories */
-	orig = s = dm_strdup(dir);
+	orig = s = strdup(dir);
 	if (!s) {
 		log_error("Failed to duplicate directory name.");
 		return 0;
@@ -84,7 +84,7 @@ static int _create_dir_recursive(const char *dir)
 
 	r = 1;
 out:
-	dm_free(orig);
+	free(orig);
 	return r;
 }
 
device_mapper/libdm-report.c +23 -22

156 lines not on this page · raw message

device_mapper/libdm-stats.c +60 -59

401 lines not on this page · raw message

device_mapper/libdm-string.c +6 -6
index 8bd6c2d..62629c7 100644
@@ -146,7 +146,7 @@ int dm_vasprintf(char **result, const char *format, va_list aq)
 {
 	int i, n, size = 16;
 	va_list ap;
-	char *buf = dm_malloc(size);
+	char *buf = malloc(size);
 
 	*result = 0;
 
@@ -161,20 +161,20 @@ int dm_vasprintf(char **result, const char *format, va_list aq)
 		if (0 <= n && n < size)
 			break;
 
-		dm_free(buf);
+		free(buf);
 		/* Up to glibc 2.0.6 returns -1 */
 		size = (n < 0) ? size * 2 : n + 1;
-		if (!(buf = dm_malloc(size)))
+		if (!(buf = malloc(size)))
 			return -1;
 	}
 
 	if (i > 1) {
 		/* Reallocating more then once? */
-		if (!(*result = dm_strdup(buf))) {
-			dm_free(buf);
+		if (!(*result = strdup(buf))) {
+			free(buf);
 			return -1;
 		}
-		dm_free(buf);
+		free(buf);
 	} else
 		*result = buf;
 
device_mapper/libdm-timestamp.c +4 -3
index c2d0ad8..236cf1a 100644
@@ -18,6 +18,7 @@
  * the results of these routines should stay in-core.  
  */
 
+#include "base/memory/zalloc.h"
 #include "misc/dmlib.h"
 
 #include <stdlib.h>
@@ -53,7 +54,7 @@ struct dm_timestamp *dm_timestamp_alloc(void)
 {
 	struct dm_timestamp *ts = NULL;
 
-	if (!(ts = dm_zalloc(sizeof(*ts))))
+	if (!(ts = zalloc(sizeof(*ts))))
 		stack;
 
 	return ts;
@@ -101,7 +102,7 @@ struct dm_timestamp *dm_timestamp_alloc(void)
 {
 	struct dm_timestamp *ts;
 
-	if (!(ts = dm_malloc(sizeof(*ts))))
+	if (!(ts = malloc(sizeof(*ts))))
 		stack;
 
 	return ts;
@@ -174,5 +175,5 @@ void dm_timestamp_copy(struct dm_timestamp *ts_new, struct dm_timestamp *ts_old)
 
 void dm_timestamp_destroy(struct dm_timestamp *ts)
 {
-	dm_free(ts);
+	free(ts);
 }
device_mapper/mm/dbg_malloc.c deleted +0 -413

413 lines not on this page · raw message

device_mapper/mm/pool-debug.c +10 -10
index c523238..c9484b7 100644
@@ -50,7 +50,7 @@ struct dm_pool {
 
 struct dm_pool *dm_pool_create(const char *name, size_t chunk_hint)
 {
-	struct dm_pool *mem = dm_zalloc(sizeof(*mem));
+	struct dm_pool *mem = zalloc(sizeof(*mem));
 
 	if (!mem) {
 		log_error("Couldn't create memory pool %s (size %"
@@ -82,8 +82,8 @@ static void _free_blocks(struct dm_pool *p, struct block *b)
 		p->stats.blocks_allocated--;
 
 		n = b->next;
-		dm_free(b->data);
-		dm_free(b);
+		free(b->data);
+		free(b);
 		b = n;
 	}
 }
@@ -105,7 +105,7 @@ void dm_pool_destroy(struct dm_pool *p)
 	_pool_stats(p, "Destroying");
 	_free_blocks(p, p->blocks);
 	dm_list_del(&p->list);
-	dm_free(p);
+	free(p);
 }
 
 void *dm_pool_alloc(struct dm_pool *p, size_t s)
@@ -139,7 +139,7 @@ static struct block *_new_block(size_t s, unsigned alignment)
 {
 	/* FIXME: I'm currently ignoring the alignment arg. */
 	size_t len = sizeof(struct block) + s;
-	struct block *b = dm_malloc(len);
+	struct block *b = malloc(len);
 
 	/*
 	 * Too lazy to implement alignment for debug version, and
@@ -153,9 +153,9 @@ static struct block *_new_block(size_t s, unsigned alignment)
 		return NULL;
 	}
 
-	if (!(b->data = dm_malloc(s))) {
+	if (!(b->data = malloc(s))) {
 		log_error("Out of memory");
-		dm_free(b);
+		free(b);
 		return NULL;
 	}
 
@@ -247,8 +247,8 @@ int dm_pool_grow_object(struct dm_pool *p, const void *extra, size_t delta)
 
 	if (p->object) {
 		memcpy(new->data, p->object->data, p->object->size);
-		dm_free(p->object->data);
-		dm_free(p->object);
+		free(p->object->data);
+		free(p->object);
 	}
 	p->object = new;
 
@@ -270,7 +270,7 @@ void *dm_pool_end_object(struct dm_pool *p)
 void dm_pool_abandon_object(struct dm_pool *p)
 {
 	assert(p->begun);
-	dm_free(p->object);
+	free(p->object);
 	p->begun = 0;
 	p->object = NULL;
 }
device_mapper/mm/pool-fast.c +5 -4
index b83c693..29bbc10 100644
@@ -17,6 +17,7 @@
 #include "memcheck.h"
 #endif
 
+#include "base/memory/zalloc.h"
 #include "device_mapper/misc/dmlib.h"
 #include <stddef.h>	/* For musl libc */
 #include <malloc.h>
@@ -48,7 +49,7 @@ static void _free_chunk(struct chunk *c);
 struct dm_pool *dm_pool_create(const char *name, size_t chunk_hint)
 {
 	size_t new_size = 1024;
-	struct dm_pool *p = dm_zalloc(sizeof(*p));
+	struct dm_pool *p = zalloc(sizeof(*p));
 
 	if (!p) {
 		log_error("Couldn't create memory pool %s (size %"
@@ -82,7 +83,7 @@ void dm_pool_destroy(struct dm_pool *p)
 	pthread_mutex_lock(&_dm_pools_mutex);
 	dm_list_del(&p->list);
 	pthread_mutex_unlock(&_dm_pools_mutex);
-	dm_free(p);
+	free(p);
 }
 
 void *dm_pool_alloc(struct dm_pool *p, size_t s)
@@ -281,7 +282,7 @@ static struct chunk *_new_chunk(struct dm_pool *p, size_t s)
 #  define aligned_malloc(s)	(posix_memalign((void**)&c, _pagesize, \
 						ALIGN_ON_PAGE(s)) == 0)
 #else
-#  define aligned_malloc(s)	(c = dm_malloc(s))
+#  define aligned_malloc(s)	(c = malloc(s))
 #endif /* DEBUG_ENFORCE_POOL_LOCKING */
 		if (!aligned_malloc(s)) {
 #undef aligned_malloc
@@ -315,7 +316,7 @@ static void _free_chunk(struct chunk *c)
 	/* since DEBUG_MEM is using own memory list */
 	free(c); /* for posix_memalign() */
 #else
-	dm_free(c);
+	free(c);
 #endif
 }
 
lib/activate/activate.c +1 -1
index a7e5fe3..ce67ec8 100644
@@ -1514,7 +1514,7 @@ char *get_monitor_dso_path(struct cmd_context *cmd, int id)
 
 	get_shared_library_path(cmd, libpath, path, sizeof(path));
 
-	return dm_strdup(path);
+	return strdup(path);
 }
 
 static char *_build_target_uuid(struct cmd_context *cmd, const struct logical_volume *lv)
lib/activate/dev_manager.c +2 -2
index 5dd0e6f..d0e1dac 100644
@@ -627,7 +627,7 @@ int device_is_usable(struct device *dev, struct dev_usable_check_params check)
 			goto out;
 		}
 
-		if (!(vgname = dm_strdup(name)) ||
+		if (!(vgname = strdup(name)) ||
 		    !dm_split_lvm_name(NULL, NULL, &vgname, &lvname, &layer))
 			goto_out;
 
@@ -735,7 +735,7 @@ int device_is_usable(struct device *dev, struct dev_usable_check_params check)
 	r = 1;
 
       out:
-	dm_free(vgname);
+	free(vgname);
 	dm_task_destroy(dmt);
 	return r;
 }
lib/activate/fs.c +2 -2
index 6e07eda..87bc724 100644
@@ -327,7 +327,7 @@ static void _del_fs_op(struct fs_op_parms *fsp)
 {
 	_count_fs_ops[fsp->type]--;
 	dm_list_del(&fsp->list);
-	dm_free(fsp);
+	free(fsp);
 }
 
 /* Check if there is other the type of fs operation stacked */
@@ -401,7 +401,7 @@ static int _stack_fs_op(fs_op_t type, const char *dev_dir, const char *vg_name,
 				_del_fs_op(fsp);
 		}
 
-	if (!(fsp = dm_malloc(sizeof(*fsp) + len))) {
+	if (!(fsp = malloc(sizeof(*fsp) + len))) {
 		log_error("No space to stack fs operation");
 		return 0;
 	}
lib/cache/lvmcache.c +29 -28

183 lines not on this page · raw message

lib/cache/lvmetad.c +2 -2
index fc46c07..238a7f1 100644
@@ -196,7 +196,7 @@ void lvmetad_set_token(const struct dm_config_value *filter)
 {
 	int ft = 0;
 
-	dm_free(_lvmetad_token);
+	free(_lvmetad_token);
 
 	while (filter && filter->type == DM_CFG_STRING) {
 		ft = calc_crc(ft, (const uint8_t *) filter->v.str, strlen(filter->v.str));
@@ -209,7 +209,7 @@ void lvmetad_set_token(const struct dm_config_value *filter)
 
 void lvmetad_release_token(void)
 {
-	dm_free(_lvmetad_token);
+	free(_lvmetad_token);
 	_lvmetad_token = NULL;
 }
 
lib/cache_segtype/cache.c +4 -3
index b7119d2..ab9f942 100644
@@ -12,6 +12,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "base/memory/zalloc.h"
 #include "lib/misc/lib.h"
 #include "lib/commands/toolcontext.h"
 #include "lib/metadata/segtype.h"
@@ -261,7 +262,7 @@ static int _cache_pool_text_export(const struct lv_segment *seg,
 
 static void _destroy(struct segment_type *segtype)
 {
-	dm_free((void *) segtype);
+	free((void *) segtype);
 }
 
 #ifdef DEVMAPPER_SUPPORT
@@ -611,7 +612,7 @@ int init_cache_segtypes(struct cmd_context *cmd,
 			struct segtype_library *seglib)
 #endif
 {
-	struct segment_type *segtype = dm_zalloc(sizeof(*segtype));
+	struct segment_type *segtype = zalloc(sizeof(*segtype));
 
 	if (!segtype) {
 		log_error("Failed to allocate memory for cache_pool segtype");
@@ -626,7 +627,7 @@ int init_cache_segtypes(struct cmd_context *cmd,
 		return_0;
 	log_very_verbose("Initialised segtype: %s", segtype->name);
 
-	segtype = dm_zalloc(sizeof(*segtype));
+	segtype = zalloc(sizeof(*segtype));
 	if (!segtype) {
 		log_error("Failed to allocate memory for cache segtype");
 		return 0;
lib/commands/toolcontext.c +8 -7
index 8eaece6..20a73b7 100644
@@ -13,6 +13,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "base/memory/zalloc.h"
 #include "lib/misc/lib.h"
 #include "lib/commands/toolcontext.h"
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

lib/config/config.c +8 -8
index c638d75..2e7e9b6 100644

Lines of this file are not shown. View the raw message.

lib/device/bcache.c +20 -20
index 561f68e..f4c0712 100644

Lines of this file are not shown. View the raw message.

lib/device/dev-cache.c +15 -14
index 4f7a7a0..d60454a 100644

Lines of this file are not shown. View the raw message.

lib/device/dev-io.c +2 -2
index 65b3db4..ffdf75e 100644

Lines of this file are not shown. View the raw message.

lib/device/dev-type.c +3 -2
index 718038c..0b7af1b 100644

Lines of this file are not shown. View the raw message.

lib/device/device.h +1 -1
index b9aec70..8f9ed55 100644

Lines of this file are not shown. View the raw message.

lib/error/errseg.c +3 -2
index 9f0262a..bbdf235 100644

Lines of this file are not shown. View the raw message.

lib/filters/filter-composite.c +6 -5
index 8d9e061..8691aeb 100644

Lines of this file are not shown. View the raw message.

lib/filters/filter-fwraid.c +3 -2
index 62022b3..03c63b3 100644

Lines of this file are not shown. View the raw message.

lib/filters/filter-internal.c +3 -2
index ebbee7e..85e04d4 100644

Lines of this file are not shown. View the raw message.

lib/filters/filter-md.c +3 -2
index b9d3bc8..4fcbca9 100644

Lines of this file are not shown. View the raw message.

lib/filters/filter-mpath.c +3 -2
index a7dc12e..785b518 100644

Lines of this file are not shown. View the raw message.

lib/filters/filter-partitioned.c +3 -2
index a85e182..34151fd 100644

Lines of this file are not shown. View the raw message.

lib/filters/filter-persistent.c +10 -9
index 8f6d584..643c349 100644

Lines of this file are not shown. View the raw message.

lib/filters/filter-signature.c +3 -2
index 3aa6284..d4b6ea3 100644

Lines of this file are not shown. View the raw message.

lib/filters/filter-type.c +3 -2
index 8ec3025..63d7c70 100644

Lines of this file are not shown. View the raw message.

lib/filters/filter-usable.c +6 -5
index 45c7832..498b90c 100644

Lines of this file are not shown. View the raw message.

lib/format_text/archiver.c +4 -4
index ab80117..5cdbf6d 100644

Lines of this file are not shown. View the raw message.

lib/format_text/export.c +17 -16
index 2924aea..a9a7e15 100644

Lines of this file are not shown. View the raw message.

lib/format_text/flags.c +2 -2
index 69d8afc..98894e7 100644

Lines of this file are not shown. View the raw message.

lib/format_text/format-text.c +16 -16
index c834335..907944a 100644

Lines of this file are not shown. View the raw message.

lib/format_text/text_label.c +10 -9
index a7eaa6e..1157b98 100644

Lines of this file are not shown. View the raw message.

lib/freeseg/freeseg.c +3 -2
index 90e9cd3..fa73e22 100644

Lines of this file are not shown. View the raw message.

lib/label/label.c +12 -9
index ce995d6..373df29 100644

Lines of this file are not shown. View the raw message.

lib/log/log.c +5 -5
index a040ca5..fd056b1 100644

Lines of this file are not shown. View the raw message.

lib/lvmpolld/lvmpolld-client.c +2 -2
index 78cf813..1a76485 100644

Lines of this file are not shown. View the raw message.

lib/metadata/lv_manip.c +3 -3
index dad5953..b2eba30 100644

Lines of this file are not shown. View the raw message.

lib/metadata/metadata-liblvm.c +3 -3
index 53934d2..ccea2e4 100644

Lines of this file are not shown. View the raw message.

lib/mirror/mirrored.c +4 -3
index 4110dec..1ca4037 100644

Lines of this file are not shown. View the raw message.

lib/misc/lib.h +1 -0
index 0d61f34..f7baf9d 100644

Lines of this file are not shown. View the raw message.

lib/misc/lvm-file.c +5 -5
index 5c23b0a..883b22d 100644

Lines of this file are not shown. View the raw message.

lib/misc/lvm-flock.c +7 -7
index 00d74de..88ea6c2 100644

Lines of this file are not shown. View the raw message.

lib/mm/memlock.c +2 -2
index 571caab..65f13c4 100644

Lines of this file are not shown. View the raw message.

lib/raid/raid.c +6 -5
index 2efaf19..e88a154 100644

Lines of this file are not shown. View the raw message.

lib/snapshot/snapshot.c +4 -3
index 4d9cd7e..3c30b35 100644

Lines of this file are not shown. View the raw message.

lib/striped/striped.c +3 -2
index a9854a2..efed169 100644

Lines of this file are not shown. View the raw message.

lib/thin/thin.c +4 -3
index 3c62008..d759b76 100644

Lines of this file are not shown. View the raw message.

lib/unknown/unknown.c +6 -5
index 7c2a54c..b7c06ac 100644

Lines of this file are not shown. View the raw message.

lib/zero/zero.c +3 -2
index f1e4831..cb204fc 100644

Lines of this file are not shown. View the raw message.

libdaemon/client/config-util.c +5 -5
index f8526d7..bdbdd3a 100644

Lines of this file are not shown. View the raw message.

libdaemon/client/daemon-client.c +3 -3
index 28d7c04..53f4495 100644

Lines of this file are not shown. View the raw message.

libdaemon/server/daemon-log.c +6 -6
index 8c2a208..864f504 100644

Lines of this file are not shown. View the raw message.

libdaemon/server/daemon-server.c +2 -2
index 4acb00e..78c8221 100644

Lines of this file are not shown. View the raw message.

tools/command.c +18 -18
index 377d03f..e1391a1 100644

Lines of this file are not shown. View the raw message.

tools/dmsetup.c +48 -47

95 lines not on this page · raw message

tools/lvmcmdlib.c +2 -2
index 9f94b5c..b787d09 100644

Lines of this file are not shown. View the raw message.

tools/pvck.c +2 -1
index 9030496..027df6d 100644

Lines of this file are not shown. View the raw message.

tools/toollib.c +1 -1
index a4dddd3..7da1703 100644

Lines of this file are not shown. View the raw message.

tools/vgcfgbackup.c +6 -6
index 814ed1d..7d061d5 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.