mirror of
git://sourceware.org/git/lvm2.git
synced 2025-10-25 03:33:16 +03:00
export bitset, pool, hash, malloc
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
#include "libdm-targets.h"
|
||||
#include "libdm-common.h"
|
||||
#include "libdm-file.h"
|
||||
#include "bitset.h"
|
||||
|
||||
#ifdef DM_COMPAT
|
||||
# include "libdm-compat.h"
|
||||
@@ -63,7 +62,7 @@
|
||||
static int _dm_version = DM_VERSION_MAJOR;
|
||||
static int _log_suppress = 0;
|
||||
|
||||
static bitset_t _dm_bitset = NULL;
|
||||
static dm_bitset_t _dm_bitset = NULL;
|
||||
static int _control_fd = -1;
|
||||
static int _version_checked = 0;
|
||||
static int _version_ok = 1;
|
||||
@@ -148,7 +147,7 @@ static int _get_proc_number(const char *file, const char *name,
|
||||
fclose(fl);
|
||||
return 1;
|
||||
}
|
||||
bit_set(_dm_bitset, num);
|
||||
dm_bit_set(_dm_bitset, num);
|
||||
}
|
||||
} else do {
|
||||
c = fgetc(fl);
|
||||
@@ -253,11 +252,11 @@ static int _create_dm_bitset(void)
|
||||
if (_dm_bitset)
|
||||
return 1;
|
||||
|
||||
if (!(_dm_bitset = bitset_create(NULL, NUMBER_OF_MAJORS)))
|
||||
if (!(_dm_bitset = dm_bitset_create(NULL, NUMBER_OF_MAJORS)))
|
||||
return 0;
|
||||
|
||||
if (!_get_proc_number(PROC_DEVICES, DM_NAME, NULL)) {
|
||||
bitset_destroy(_dm_bitset);
|
||||
dm_bitset_destroy(_dm_bitset);
|
||||
_dm_bitset = NULL;
|
||||
return 0;
|
||||
}
|
||||
@@ -273,7 +272,7 @@ int dm_is_dm_major(uint32_t major)
|
||||
if (!_create_dm_bitset())
|
||||
return 0;
|
||||
|
||||
return bit(_dm_bitset, major) ? 1 : 0;
|
||||
return dm_bit(_dm_bitset, major) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int _open_control(void)
|
||||
@@ -320,27 +319,27 @@ void dm_task_destroy(struct dm_task *dmt)
|
||||
|
||||
for (t = dmt->head; t; t = n) {
|
||||
n = t->next;
|
||||
dbg_free(t->params);
|
||||
dbg_free(t->type);
|
||||
dbg_free(t);
|
||||
dm_free(t->params);
|
||||
dm_free(t->type);
|
||||
dm_free(t);
|
||||
}
|
||||
|
||||
if (dmt->dev_name)
|
||||
dbg_free(dmt->dev_name);
|
||||
dm_free(dmt->dev_name);
|
||||
|
||||
if (dmt->newname)
|
||||
dbg_free(dmt->newname);
|
||||
dm_free(dmt->newname);
|
||||
|
||||
if (dmt->message)
|
||||
dbg_free(dmt->message);
|
||||
dm_free(dmt->message);
|
||||
|
||||
if (dmt->dmi.v4)
|
||||
dbg_free(dmt->dmi.v4);
|
||||
dm_free(dmt->dmi.v4);
|
||||
|
||||
if (dmt->uuid)
|
||||
dbg_free(dmt->uuid);
|
||||
dm_free(dmt->uuid);
|
||||
|
||||
dbg_free(dmt);
|
||||
dm_free(dmt);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -521,7 +520,7 @@ static struct dm_ioctl_v1 *_flatten_v1(struct dm_task *dmt)
|
||||
if (len < min_size)
|
||||
len = min_size;
|
||||
|
||||
if (!(dmi = dbg_malloc(len)))
|
||||
if (!(dmi = dm_malloc(len)))
|
||||
return NULL;
|
||||
|
||||
memset(dmi, 0, len);
|
||||
@@ -570,7 +569,7 @@ static struct dm_ioctl_v1 *_flatten_v1(struct dm_task *dmt)
|
||||
return dmi;
|
||||
|
||||
bad:
|
||||
dbg_free(dmi);
|
||||
dm_free(dmi);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -721,7 +720,7 @@ static int _dm_task_run_v1(struct dm_task *dmt)
|
||||
dmt->type = DM_DEVICE_INFO;
|
||||
if (!dm_task_run(dmt))
|
||||
goto bad;
|
||||
dbg_free(dmi); /* We'll use what info returned */
|
||||
dm_free(dmi); /* We'll use what info returned */
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -729,7 +728,7 @@ static int _dm_task_run_v1(struct dm_task *dmt)
|
||||
return 1;
|
||||
|
||||
bad:
|
||||
dbg_free(dmi);
|
||||
dm_free(dmi);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -969,7 +968,7 @@ int dm_task_set_ro(struct dm_task *dmt)
|
||||
|
||||
int dm_task_set_newname(struct dm_task *dmt, const char *newname)
|
||||
{
|
||||
if (!(dmt->newname = dbg_strdup(newname))) {
|
||||
if (!(dmt->newname = dm_strdup(newname))) {
|
||||
log_error("dm_task_set_newname: strdup(%s) failed", newname);
|
||||
return 0;
|
||||
}
|
||||
@@ -979,7 +978,7 @@ int dm_task_set_newname(struct dm_task *dmt, const char *newname)
|
||||
|
||||
int dm_task_set_message(struct dm_task *dmt, const char *message)
|
||||
{
|
||||
if (!(dmt->message = dbg_strdup(message))) {
|
||||
if (!(dmt->message = dm_strdup(message))) {
|
||||
log_error("dm_task_set_message: strdup(%s) failed", message);
|
||||
return 0;
|
||||
}
|
||||
@@ -1018,7 +1017,7 @@ int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr)
|
||||
struct target *create_target(uint64_t start, uint64_t len, const char *type,
|
||||
const char *params)
|
||||
{
|
||||
struct target *t = dbg_malloc(sizeof(*t));
|
||||
struct target *t = dm_malloc(sizeof(*t));
|
||||
|
||||
if (!t) {
|
||||
log_error("create_target: malloc(%d) failed", sizeof(*t));
|
||||
@@ -1027,12 +1026,12 @@ struct target *create_target(uint64_t start, uint64_t len, const char *type,
|
||||
|
||||
memset(t, 0, sizeof(*t));
|
||||
|
||||
if (!(t->params = dbg_strdup(params))) {
|
||||
if (!(t->params = dm_strdup(params))) {
|
||||
log_error("create_target: strdup(params) failed");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (!(t->type = dbg_strdup(type))) {
|
||||
if (!(t->type = dm_strdup(type))) {
|
||||
log_error("create_target: strdup(type) failed");
|
||||
goto bad;
|
||||
}
|
||||
@@ -1042,9 +1041,9 @@ struct target *create_target(uint64_t start, uint64_t len, const char *type,
|
||||
return t;
|
||||
|
||||
bad:
|
||||
dbg_free(t->params);
|
||||
dbg_free(t->type);
|
||||
dbg_free(t);
|
||||
dm_free(t->params);
|
||||
dm_free(t->type);
|
||||
dm_free(t);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1142,7 +1141,7 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
|
||||
while (repeat_count--)
|
||||
len *= 2;
|
||||
|
||||
if (!(dmi = dbg_malloc(len)))
|
||||
if (!(dmi = dm_malloc(len)))
|
||||
return NULL;
|
||||
|
||||
memset(dmi, 0, len);
|
||||
@@ -1200,7 +1199,7 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
|
||||
return dmi;
|
||||
|
||||
bad:
|
||||
dbg_free(dmi);
|
||||
dm_free(dmi);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1335,7 +1334,7 @@ static int _create_and_load_v4(struct dm_task *dmt)
|
||||
|
||||
/* Use the original structure last so the info will be correct */
|
||||
dmt->type = DM_DEVICE_RESUME;
|
||||
dbg_free(dmt->uuid);
|
||||
dm_free(dmt->uuid);
|
||||
dmt->uuid = NULL;
|
||||
|
||||
r = dm_task_run(dmt);
|
||||
@@ -1383,7 +1382,7 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
|
||||
log_error("device-mapper ioctl "
|
||||
"cmd %d failed: %s",
|
||||
_IOC_NR(command), strerror(errno));
|
||||
dbg_free(dmi);
|
||||
dm_free(dmi);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1435,7 +1434,7 @@ repeat_ioctl:
|
||||
case DM_DEVICE_TABLE:
|
||||
case DM_DEVICE_WAITEVENT:
|
||||
_ioctl_buffer_double_factor++;
|
||||
dbg_free(dmi);
|
||||
dm_free(dmi);
|
||||
goto repeat_ioctl;
|
||||
default:
|
||||
log_error("Warning: libdevmapper buffer too small for data");
|
||||
@@ -1481,7 +1480,7 @@ repeat_ioctl:
|
||||
return 1;
|
||||
|
||||
bad:
|
||||
dbg_free(dmi);
|
||||
dm_free(dmi);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1498,9 +1497,9 @@ void dm_lib_exit(void)
|
||||
{
|
||||
dm_lib_release();
|
||||
if (_dm_bitset)
|
||||
bitset_destroy(_dm_bitset);
|
||||
dm_bitset_destroy(_dm_bitset);
|
||||
_dm_bitset = NULL;
|
||||
dump_memory();
|
||||
dm_dump_memory();
|
||||
_version_ok = 1;
|
||||
_version_checked = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user