mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
Add dm_event_handler_[gs]et_timeout functions.
Streamline dm_report_field_* interface.
This commit is contained in:
parent
f4bd12e8e9
commit
63e4217271
@ -1,5 +1,7 @@
|
|||||||
Version 1.02.16 -
|
Version 1.02.16 -
|
||||||
===================================
|
===================================
|
||||||
|
Add dm_event_handler_[gs]et_timeout functions.
|
||||||
|
Streamline dm_report_field_* interface.
|
||||||
Add cmdline debug & version options to dmeventd.
|
Add cmdline debug & version options to dmeventd.
|
||||||
Add DM_LIB_VERSION definition to configure.h.
|
Add DM_LIB_VERSION definition to configure.h.
|
||||||
Suppress 'Unrecognised field' error if report field is 'help'.
|
Suppress 'Unrecognised field' error if report field is 'help'.
|
||||||
|
@ -15,3 +15,5 @@ dm_event_handler_get_event_mask
|
|||||||
dm_event_register_handler
|
dm_event_register_handler
|
||||||
dm_event_unregister_handler
|
dm_event_unregister_handler
|
||||||
dm_event_get_registered_device
|
dm_event_get_registered_device
|
||||||
|
dm_event_handler_set_timeout
|
||||||
|
dm_event_handler_get_timeout
|
||||||
|
@ -41,6 +41,8 @@
|
|||||||
#ifdef linux
|
#ifdef linux
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
|
|
||||||
|
# define OOM_ADJ_FILE "/proc/self/oom_adj"
|
||||||
|
|
||||||
/* From linux/oom.h */
|
/* From linux/oom.h */
|
||||||
# define OOM_DISABLE (-17)
|
# define OOM_DISABLE (-17)
|
||||||
# define OOM_ADJUST_MIN (-16)
|
# define OOM_ADJUST_MIN (-16)
|
||||||
@ -64,7 +66,6 @@ static int _debug = 0;
|
|||||||
#define UNLINK_THREAD(x) UNLINK(x)
|
#define UNLINK_THREAD(x) UNLINK(x)
|
||||||
|
|
||||||
#define DAEMON_NAME "dmeventd"
|
#define DAEMON_NAME "dmeventd"
|
||||||
#define OOM_ADJ_FILE "/proc/self/oom_adj"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Global mutex for thread list access. Has to be held when:
|
Global mutex for thread list access. Has to be held when:
|
||||||
@ -192,7 +193,7 @@ static void _debuglog(const char *fmt, ...)
|
|||||||
va_start(ap,fmt);
|
va_start(ap,fmt);
|
||||||
|
|
||||||
time(&P);
|
time(&P);
|
||||||
fprintf(stderr, "dmeventd[%x]: %.15s ", (int)pthread_self(), ctime(&P)+4 );
|
fprintf(stderr, "dmeventd[%p]: %.15s ", (void *) pthread_self(), ctime(&P)+4 );
|
||||||
vfprintf(stderr, fmt, ap);
|
vfprintf(stderr, fmt, ap);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
@ -449,14 +450,14 @@ static void _exit_dm_lib(void)
|
|||||||
dm_lib_exit();
|
dm_lib_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _exit_timeout(void *unused)
|
static void _exit_timeout(void *unused __attribute((unused)))
|
||||||
{
|
{
|
||||||
_timeout_running = 0;
|
_timeout_running = 0;
|
||||||
pthread_mutex_unlock(&_timeout_mutex);
|
pthread_mutex_unlock(&_timeout_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wake up monitor threads every so often. */
|
/* Wake up monitor threads every so often. */
|
||||||
static void *_timeout_thread(void *unused)
|
static void *_timeout_thread(void *unused __attribute((unused)))
|
||||||
{
|
{
|
||||||
struct timespec timeout;
|
struct timespec timeout;
|
||||||
time_t curr_time;
|
time_t curr_time;
|
||||||
@ -468,16 +469,16 @@ static void *_timeout_thread(void *unused)
|
|||||||
while (!list_empty(&_timeout_registry)) {
|
while (!list_empty(&_timeout_registry)) {
|
||||||
struct thread_status *thread;
|
struct thread_status *thread;
|
||||||
|
|
||||||
timeout.tv_sec = (time_t) -1;
|
timeout.tv_sec = 0;
|
||||||
curr_time = time(NULL);
|
curr_time = time(NULL);
|
||||||
|
|
||||||
list_iterate_items_gen(thread, &_timeout_registry, timeout_list) {
|
list_iterate_items_gen(thread, &_timeout_registry, timeout_list) {
|
||||||
if (thread->next_time < curr_time) {
|
if (thread->next_time <= curr_time) {
|
||||||
thread->next_time = curr_time + thread->timeout;
|
thread->next_time = curr_time + thread->timeout;
|
||||||
pthread_kill(thread->thread, SIGALRM);
|
pthread_kill(thread->thread, SIGALRM);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thread->next_time < timeout.tv_sec)
|
if (thread->next_time < timeout.tv_sec || !timeout.tv_sec)
|
||||||
timeout.tv_sec = thread->next_time;
|
timeout.tv_sec = thread->next_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -682,6 +683,23 @@ static void _monitor_unregister(void *arg)
|
|||||||
_unlock_mutex();
|
_unlock_mutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct dm_task *_get_device_status(struct thread_status *ts)
|
||||||
|
{
|
||||||
|
struct dm_task *dmt = dm_task_create(DM_DEVICE_STATUS);
|
||||||
|
|
||||||
|
if (!dmt)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
dm_task_set_uuid(dmt, ts->device.uuid);
|
||||||
|
|
||||||
|
if (!dm_task_run(dmt)) {
|
||||||
|
dm_task_destroy(dmt);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dmt;
|
||||||
|
}
|
||||||
|
|
||||||
/* Device monitoring thread. */
|
/* Device monitoring thread. */
|
||||||
static void *_monitor_thread(void *arg)
|
static void *_monitor_thread(void *arg)
|
||||||
{
|
{
|
||||||
@ -708,6 +726,18 @@ static void *_monitor_thread(void *arg)
|
|||||||
if (wait_error == DM_WAIT_FATAL)
|
if (wait_error == DM_WAIT_FATAL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* Timeout occurred, task is not filled properly.
|
||||||
|
* We get device status here for processing it in DSO.
|
||||||
|
*/
|
||||||
|
if (wait_error == DM_WAIT_INTR &&
|
||||||
|
thread->current_events & DM_EVENT_TIMEOUT) {
|
||||||
|
dm_task_destroy(task);
|
||||||
|
task = _get_device_status(thread);
|
||||||
|
/* FIXME: syslog fail here ? */
|
||||||
|
if (!(thread->current_task = task))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We know that wait succeeded and stored a
|
* We know that wait succeeded and stored a
|
||||||
* pointer to dm_task with device status into task.
|
* pointer to dm_task with device status into task.
|
||||||
@ -798,8 +828,7 @@ static struct dso_data *_lookup_dso(struct message_data *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup DSO symbols we need. */
|
/* Lookup DSO symbols we need. */
|
||||||
static int _lookup_symbol(void *dl, struct dso_data *data,
|
static int _lookup_symbol(void *dl, void **symbol, const char *name)
|
||||||
void **symbol, const char *name)
|
|
||||||
{
|
{
|
||||||
if ((*symbol = dlsym(dl, name)))
|
if ((*symbol = dlsym(dl, name)))
|
||||||
return 1;
|
return 1;
|
||||||
@ -809,11 +838,11 @@ static int _lookup_symbol(void *dl, struct dso_data *data,
|
|||||||
|
|
||||||
static int lookup_symbols(void *dl, struct dso_data *data)
|
static int lookup_symbols(void *dl, struct dso_data *data)
|
||||||
{
|
{
|
||||||
return _lookup_symbol(dl, data, (void *) &data->process_event,
|
return _lookup_symbol(dl, (void *) &data->process_event,
|
||||||
"process_event") &&
|
"process_event") &&
|
||||||
_lookup_symbol(dl, data, (void *) &data->register_device,
|
_lookup_symbol(dl, (void *) &data->register_device,
|
||||||
"register_device") &&
|
"register_device") &&
|
||||||
_lookup_symbol(dl, data, (void *) &data->unregister_device,
|
_lookup_symbol(dl, (void *) &data->unregister_device,
|
||||||
"unregister_device");
|
"unregister_device");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -909,7 +938,7 @@ static int _register_for_event(struct message_data *message_data)
|
|||||||
usually means we are so starved on resources that we are
|
usually means we are so starved on resources that we are
|
||||||
almost as good as dead already... */
|
almost as good as dead already... */
|
||||||
if (thread_new->events & DM_EVENT_TIMEOUT) {
|
if (thread_new->events & DM_EVENT_TIMEOUT) {
|
||||||
ret = -_register_for_timeout(thread);
|
ret = -_register_for_timeout(thread_new);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
_unlock_mutex();
|
_unlock_mutex();
|
||||||
goto out;
|
goto out;
|
||||||
@ -1426,7 +1455,7 @@ static void _cleanup_unused_threads(void)
|
|||||||
_unlock_mutex();
|
_unlock_mutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _sig_alarm(int signum)
|
static void _sig_alarm(int signum __attribute((unused)))
|
||||||
{
|
{
|
||||||
pthread_testcancel();
|
pthread_testcancel();
|
||||||
}
|
}
|
||||||
@ -1458,7 +1487,7 @@ static void _init_thread_signals(void)
|
|||||||
* Set the global variable which the process should
|
* Set the global variable which the process should
|
||||||
* be watching to determine when to exit.
|
* be watching to determine when to exit.
|
||||||
*/
|
*/
|
||||||
static void _exit_handler(int sig)
|
static void _exit_handler(int sig __attribute((unused)))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We exit when '_exit_now' is set.
|
* We exit when '_exit_now' is set.
|
||||||
@ -1492,6 +1521,7 @@ static int _lock_pidfile(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef linux
|
||||||
/*
|
/*
|
||||||
* Protection against OOM killer if kernel supports it
|
* Protection against OOM killer if kernel supports it
|
||||||
*/
|
*/
|
||||||
@ -1519,6 +1549,7 @@ static int _set_oom_adj(int val)
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void _daemonize(void)
|
static void _daemonize(void)
|
||||||
{
|
{
|
||||||
@ -1643,8 +1674,10 @@ int main(int argc, char *argv[])
|
|||||||
signal(SIGHUP, &_exit_handler);
|
signal(SIGHUP, &_exit_handler);
|
||||||
signal(SIGQUIT, &_exit_handler);
|
signal(SIGQUIT, &_exit_handler);
|
||||||
|
|
||||||
|
#ifdef linux
|
||||||
if (!_set_oom_adj(OOM_DISABLE) && !_set_oom_adj(OOM_ADJUST_MIN))
|
if (!_set_oom_adj(OOM_DISABLE) && !_set_oom_adj(OOM_ADJUST_MIN))
|
||||||
syslog(LOG_ERR, "Failed to set oom_adj to protect against OOM killer");
|
syslog(LOG_ERR, "Failed to set oom_adj to protect against OOM killer");
|
||||||
|
#endif
|
||||||
|
|
||||||
_init_thread_signals();
|
_init_thread_signals();
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ struct dm_event_handler {
|
|||||||
char *uuid;
|
char *uuid;
|
||||||
int major;
|
int major;
|
||||||
int minor;
|
int minor;
|
||||||
|
uint32_t timeout;
|
||||||
|
|
||||||
enum dm_event_mask mask;
|
enum dm_event_mask mask;
|
||||||
};
|
};
|
||||||
@ -62,6 +63,7 @@ struct dm_event_handler *dm_event_handler_create(void)
|
|||||||
dmevh->dso = dmevh->dev_name = dmevh->uuid = NULL;
|
dmevh->dso = dmevh->dev_name = dmevh->uuid = NULL;
|
||||||
dmevh->major = dmevh->minor = 0;
|
dmevh->major = dmevh->minor = 0;
|
||||||
dmevh->mask = 0;
|
dmevh->mask = 0;
|
||||||
|
dmevh->timeout = 0;
|
||||||
|
|
||||||
return dmevh;
|
return dmevh;
|
||||||
}
|
}
|
||||||
@ -140,6 +142,11 @@ void dm_event_handler_set_event_mask(struct dm_event_handler *dmevh,
|
|||||||
dmevh->mask = evmask;
|
dmevh->mask = evmask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dm_event_handler_set_timeout(struct dm_event_handler *dmevh, int timeout)
|
||||||
|
{
|
||||||
|
dmevh->timeout = timeout;
|
||||||
|
}
|
||||||
|
|
||||||
const char *dm_event_handler_get_dso(const struct dm_event_handler *dmevh)
|
const char *dm_event_handler_get_dso(const struct dm_event_handler *dmevh)
|
||||||
{
|
{
|
||||||
return dmevh->dso;
|
return dmevh->dso;
|
||||||
@ -165,6 +172,11 @@ int dm_event_handler_get_minor(const struct dm_event_handler *dmevh)
|
|||||||
return dmevh->minor;
|
return dmevh->minor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int dm_event_handler_get_timeout(const struct dm_event_handler *dmevh)
|
||||||
|
{
|
||||||
|
return dmevh->timeout;
|
||||||
|
}
|
||||||
|
|
||||||
enum dm_event_mask dm_event_handler_get_event_mask(const struct dm_event_handler *dmevh)
|
enum dm_event_mask dm_event_handler_get_event_mask(const struct dm_event_handler *dmevh)
|
||||||
{
|
{
|
||||||
return dmevh->mask;
|
return dmevh->mask;
|
||||||
@ -484,8 +496,8 @@ failed:
|
|||||||
|
|
||||||
/* Handle the event (de)registration call and return negative error codes. */
|
/* Handle the event (de)registration call and return negative error codes. */
|
||||||
static int _do_event(int cmd, struct dm_event_daemon_message *msg,
|
static int _do_event(int cmd, struct dm_event_daemon_message *msg,
|
||||||
const char *dso_name, const char *dev_name,
|
const char *dso_name, const char *dev_name,
|
||||||
enum dm_event_mask evmask, uint32_t timeout)
|
enum dm_event_mask evmask, uint32_t timeout)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct dm_event_fifos fifos;
|
struct dm_event_fifos fifos;
|
||||||
@ -519,7 +531,7 @@ int dm_event_register_handler(const struct dm_event_handler *dmevh)
|
|||||||
uuid = dm_task_get_uuid(dmt);
|
uuid = dm_task_get_uuid(dmt);
|
||||||
|
|
||||||
if ((err = _do_event(DM_EVENT_CMD_REGISTER_FOR_EVENT, &msg,
|
if ((err = _do_event(DM_EVENT_CMD_REGISTER_FOR_EVENT, &msg,
|
||||||
dmevh->dso, uuid, dmevh->mask, 0)) < 0) {
|
dmevh->dso, uuid, dmevh->mask, dmevh->timeout)) < 0) {
|
||||||
log_error("%s: event registration failed: %s",
|
log_error("%s: event registration failed: %s",
|
||||||
dm_task_get_name(dmt),
|
dm_task_get_name(dmt),
|
||||||
msg.data ? msg.data : strerror(-err));
|
msg.data ? msg.data : strerror(-err));
|
||||||
@ -549,7 +561,7 @@ int dm_event_unregister_handler(const struct dm_event_handler *dmevh)
|
|||||||
uuid = dm_task_get_uuid(dmt);
|
uuid = dm_task_get_uuid(dmt);
|
||||||
|
|
||||||
if ((err = _do_event(DM_EVENT_CMD_UNREGISTER_FOR_EVENT, &msg,
|
if ((err = _do_event(DM_EVENT_CMD_UNREGISTER_FOR_EVENT, &msg,
|
||||||
dmevh->dso, uuid, dmevh->mask, 0)) < 0) {
|
dmevh->dso, uuid, dmevh->mask, dmevh->timeout)) < 0) {
|
||||||
log_error("%s: event deregistration failed: %s",
|
log_error("%s: event deregistration failed: %s",
|
||||||
dm_task_get_name(dmt),
|
dm_task_get_name(dmt),
|
||||||
msg.data ? msg.data : strerror(-err));
|
msg.data ? msg.data : strerror(-err));
|
||||||
@ -690,8 +702,9 @@ int dm_event_set_timeout(const char *device_path, uint32_t timeout)
|
|||||||
|
|
||||||
if (!device_exists(device_path))
|
if (!device_exists(device_path))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
return _do_event(DM_EVENT_CMD_SET_TIMEOUT, &msg,
|
return _do_event(DM_EVENT_CMD_SET_TIMEOUT, &msg,
|
||||||
NULL, device_path, 0, timeout);
|
NULL, device_path, 0, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dm_event_get_timeout(const char *device_path, uint32_t *timeout)
|
int dm_event_get_timeout(const char *device_path, uint32_t *timeout)
|
||||||
|
@ -71,6 +71,7 @@ int dm_event_handler_set_uuid(struct dm_event_handler *dmevh, const char *uuid);
|
|||||||
|
|
||||||
void dm_event_handler_set_major(struct dm_event_handler *dmevh, int major);
|
void dm_event_handler_set_major(struct dm_event_handler *dmevh, int major);
|
||||||
void dm_event_handler_set_minor(struct dm_event_handler *dmevh, int minor);
|
void dm_event_handler_set_minor(struct dm_event_handler *dmevh, int minor);
|
||||||
|
void dm_event_handler_set_timeout(struct dm_event_handler *dmevh, int timeout);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Specify mask for events to monitor.
|
* Specify mask for events to monitor.
|
||||||
@ -83,6 +84,7 @@ const char *dm_event_handler_get_dev_name(const struct dm_event_handler *dmevh);
|
|||||||
const char *dm_event_handler_get_uuid(const struct dm_event_handler *dmevh);
|
const char *dm_event_handler_get_uuid(const struct dm_event_handler *dmevh);
|
||||||
int dm_event_handler_get_major(const struct dm_event_handler *dmevh);
|
int dm_event_handler_get_major(const struct dm_event_handler *dmevh);
|
||||||
int dm_event_handler_get_minor(const struct dm_event_handler *dmevh);
|
int dm_event_handler_get_minor(const struct dm_event_handler *dmevh);
|
||||||
|
int dm_event_handler_get_timeout(const struct dm_event_handler *dmevh);
|
||||||
enum dm_event_mask dm_event_handler_get_event_mask(const struct dm_event_handler *dmevh);
|
enum dm_event_mask dm_event_handler_get_event_mask(const struct dm_event_handler *dmevh);
|
||||||
|
|
||||||
/* FIXME Review interface (what about this next thing?) */
|
/* FIXME Review interface (what about this next thing?) */
|
||||||
|
@ -230,12 +230,14 @@ void dm_hash_wipe(struct dm_hash_table *t)
|
|||||||
t->num_nodes = 0u;
|
t->num_nodes = 0u;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *dm_hash_get_key(struct dm_hash_table *t, struct dm_hash_node *n)
|
char *dm_hash_get_key(struct dm_hash_table *t __attribute((unused)),
|
||||||
|
struct dm_hash_node *n)
|
||||||
{
|
{
|
||||||
return n->key;
|
return n->key;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *dm_hash_get_data(struct dm_hash_table *t, struct dm_hash_node *n)
|
void *dm_hash_get_data(struct dm_hash_table *t __attribute((unused)),
|
||||||
|
struct dm_hash_node *n)
|
||||||
{
|
{
|
||||||
return n->data;
|
return n->data;
|
||||||
}
|
}
|
||||||
|
@ -687,26 +687,27 @@ int dm_report_object(struct dm_report *rh, void *object);
|
|||||||
int dm_report_output(struct dm_report *rh);
|
int dm_report_output(struct dm_report *rh);
|
||||||
void dm_report_free(struct dm_report *rh);
|
void dm_report_free(struct dm_report *rh);
|
||||||
|
|
||||||
/* report functions for common types */
|
/*
|
||||||
int dm_report_field_string(struct dm_report *rh, struct dm_pool *mem,
|
* Report functions are provided for simple data types.
|
||||||
struct dm_report_field *field, const void *data);
|
* They take care of allocating copies of the data.
|
||||||
int dm_report_field_int32(struct dm_report *rh, struct dm_pool *mem,
|
*/
|
||||||
struct dm_report_field *field, const void *data);
|
int dm_report_field_string(struct dm_report *rh, struct dm_report_field *field,
|
||||||
int dm_report_field_uint32(struct dm_report *rh, struct dm_pool *mem,
|
const char **data);
|
||||||
struct dm_report_field *field, const void *data);
|
int dm_report_field_int32(struct dm_report *rh, struct dm_report_field *field,
|
||||||
int dm_report_field_int(struct dm_report *rh, struct dm_pool *mem,
|
const int32_t *data);
|
||||||
struct dm_report_field *field, const void *data);
|
int dm_report_field_uint32(struct dm_report *rh, struct dm_report_field *field,
|
||||||
int dm_report_field_uint64(struct dm_report *rh, struct dm_pool *mem,
|
const uint32_t *data);
|
||||||
struct dm_report_field *field, const void *data);
|
int dm_report_field_int(struct dm_report *rh, struct dm_report_field *field,
|
||||||
|
const int *data);
|
||||||
|
int dm_report_field_uint64(struct dm_report *rh, struct dm_report_field *field,
|
||||||
|
const uint64_t *data);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper function for custom reporting functions
|
* For custom fields, allocate the data in 'mem' and use
|
||||||
|
* dm_report_field_set_value().
|
||||||
|
* 'sortvalue' may be NULL if it matches 'value'
|
||||||
*/
|
*/
|
||||||
|
void dm_report_field_set_value(struct dm_report_field *field, const void *value,
|
||||||
/*
|
const void *sortvalue);
|
||||||
* sortvalue may be NULL if it's the same as value
|
|
||||||
*/
|
|
||||||
void dm_report_field_set_value(struct dm_report_field *field,
|
|
||||||
const void *value, const void *sortvalue);
|
|
||||||
|
|
||||||
#endif /* LIB_DEVICE_MAPPER_H */
|
#endif /* LIB_DEVICE_MAPPER_H */
|
||||||
|
@ -38,8 +38,8 @@ static int _verbose = 0;
|
|||||||
* Library users can provide their own logging
|
* Library users can provide their own logging
|
||||||
* function.
|
* function.
|
||||||
*/
|
*/
|
||||||
static void _default_log(int level, const char *file, int line,
|
static void _default_log(int level, const char *file __attribute((unused)),
|
||||||
const char *f, ...)
|
int line __attribute((unused)), const char *f, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
@ -1212,7 +1212,9 @@ static int _build_dev_string(char *devbuf, size_t bufsize, struct dm_tree_node *
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _emit_areas_line(struct dm_task *dmt, struct load_segment *seg, char *params, size_t paramsize, int *pos)
|
static int _emit_areas_line(struct dm_task *dmt __attribute((unused)),
|
||||||
|
struct load_segment *seg, char *params,
|
||||||
|
size_t paramsize, int *pos)
|
||||||
{
|
{
|
||||||
struct seg_area *area;
|
struct seg_area *area;
|
||||||
char devbuf[10];
|
char devbuf[10];
|
||||||
|
@ -99,12 +99,12 @@ static const struct dm_report_object_type *_find_type(struct dm_report *rh,
|
|||||||
* Data-munging functions to prepare each data type for display and sorting
|
* Data-munging functions to prepare each data type for display and sorting
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int dm_report_field_string(struct dm_report *rh, struct dm_pool *mem,
|
int dm_report_field_string(struct dm_report *rh,
|
||||||
struct dm_report_field *field, const void *data)
|
struct dm_report_field *field, const char **data)
|
||||||
{
|
{
|
||||||
char *repstr;
|
char *repstr;
|
||||||
|
|
||||||
if (!(repstr = dm_pool_strdup(rh->mem, *(const char **) data))) {
|
if (!(repstr = dm_pool_strdup(rh->mem, *data))) {
|
||||||
log_error("dm_report_field_string: dm_pool_strdup failed");
|
log_error("dm_report_field_string: dm_pool_strdup failed");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -115,10 +115,10 @@ int dm_report_field_string(struct dm_report *rh, struct dm_pool *mem,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dm_report_field_int(struct dm_report *rh, struct dm_pool *mem,
|
int dm_report_field_int(struct dm_report *rh,
|
||||||
struct dm_report_field *field, const void *data)
|
struct dm_report_field *field, const int *data)
|
||||||
{
|
{
|
||||||
const int value = *(const int *) data;
|
const int value = *data;
|
||||||
uint64_t *sortval;
|
uint64_t *sortval;
|
||||||
char *repstr;
|
char *repstr;
|
||||||
|
|
||||||
@ -144,10 +144,10 @@ int dm_report_field_int(struct dm_report *rh, struct dm_pool *mem,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dm_report_field_uint32(struct dm_report *rh, struct dm_pool *mem,
|
int dm_report_field_uint32(struct dm_report *rh,
|
||||||
struct dm_report_field *field, const void *data)
|
struct dm_report_field *field, const uint32_t *data)
|
||||||
{
|
{
|
||||||
const uint32_t value = *(const uint32_t *) data;
|
const uint32_t value = *data;
|
||||||
uint64_t *sortval;
|
uint64_t *sortval;
|
||||||
char *repstr;
|
char *repstr;
|
||||||
|
|
||||||
@ -173,10 +173,10 @@ int dm_report_field_uint32(struct dm_report *rh, struct dm_pool *mem,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dm_report_field_int32(struct dm_report *rh, struct dm_pool *mem,
|
int dm_report_field_int32(struct dm_report *rh,
|
||||||
struct dm_report_field *field, const void *data)
|
struct dm_report_field *field, const int32_t *data)
|
||||||
{
|
{
|
||||||
const int32_t value = *(const int32_t *) data;
|
const int32_t value = *data;
|
||||||
uint64_t *sortval;
|
uint64_t *sortval;
|
||||||
char *repstr;
|
char *repstr;
|
||||||
|
|
||||||
@ -202,10 +202,10 @@ int dm_report_field_int32(struct dm_report *rh, struct dm_pool *mem,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dm_report_field_uint64(struct dm_report *rh, struct dm_pool *mem,
|
int dm_report_field_uint64(struct dm_report *rh,
|
||||||
struct dm_report_field *field, const void *data)
|
struct dm_report_field *field, const uint64_t *data)
|
||||||
{
|
{
|
||||||
const int value = *(const uint64_t *) data;
|
const int value = *data;
|
||||||
uint64_t *sortval;
|
uint64_t *sortval;
|
||||||
char *repstr;
|
char *repstr;
|
||||||
|
|
||||||
|
@ -37,7 +37,8 @@ static int _isword(int c)
|
|||||||
* Split buffer into NULL-separated words in argv.
|
* Split buffer into NULL-separated words in argv.
|
||||||
* Returns number of words.
|
* Returns number of words.
|
||||||
*/
|
*/
|
||||||
int dm_split_words(char *buffer, unsigned max, unsigned ignore_comments,
|
int dm_split_words(char *buffer, unsigned max,
|
||||||
|
unsigned ignore_comments __attribute((unused)),
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
unsigned arg;
|
unsigned arg;
|
||||||
|
@ -231,7 +231,8 @@ void dm_bounds_check_debug(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *dm_malloc_aux(size_t s, const char *file, int line)
|
void *dm_malloc_aux(size_t s, const char *file __attribute((unused)),
|
||||||
|
int line __attribute((unused)))
|
||||||
{
|
{
|
||||||
if (s > 50000000) {
|
if (s > 50000000) {
|
||||||
log_error("Huge memory allocation (size %" PRIsize_t
|
log_error("Huge memory allocation (size %" PRIsize_t
|
||||||
|
@ -1705,7 +1705,8 @@ error:
|
|||||||
/*
|
/*
|
||||||
* create a table for a mapped device using the loop target.
|
* create a table for a mapped device using the loop target.
|
||||||
*/
|
*/
|
||||||
static int _loop_table(char *table, size_t tlen, char *file, char *dev, off_t off)
|
static int _loop_table(char *table, size_t tlen, char *file,
|
||||||
|
char *dev __attribute((unused)), off_t off)
|
||||||
{
|
{
|
||||||
struct stat fbuf;
|
struct stat fbuf;
|
||||||
off_t size, sectors;
|
off_t size, sectors;
|
||||||
|
Loading…
Reference in New Issue
Block a user