device-mapper ./WHATS_NEW dmeventd/.exported_s ...
Subsystems (2)
CVSROOT: /cvs/dm
Module name: device-mapper
Changes by: [email protected] 2007-01-22 15:03:57
Modified files:
. : WHATS_NEW
dmeventd : .exported_symbols dmeventd.c
libdevmapper-event.c libdevmapper-event.h
dmsetup : dmsetup.c
lib : libdevmapper.h libdm-common.c libdm-deptree.c
libdm-report.c libdm-string.c
lib/datastruct : hash.c
lib/mm : dbg_malloc.c
Log message:
Add dm_event_handler_[gs]et_timeout functions. Streamline dm_report_field_* interface.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/WHATS_NEW.diff?cvsroot=dm&r1=1.155&r2=1.156
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/dmeventd/.exported_symbols.diff?cvsroot=dm&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/dmeventd/dmeventd.c.diff?cvsroot=dm&r1=1.42&r2=1.43
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/dmeventd/libdevmapper-event.c.diff?cvsroot=dm&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/dmeventd/libdevmapper-event.h.diff?cvsroot=dm&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/dmsetup/dmsetup.c.diff?cvsroot=dm&r1=1.77&r2=1.78
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdevmapper.h.diff?cvsroot=dm&r1=1.65&r2=1.66
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdm-common.c.diff?cvsroot=dm&r1=1.42&r2=1.43
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdm-deptree.c.diff?cvsroot=dm&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdm-report.c.diff?cvsroot=dm&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdm-string.c.diff?cvsroot=dm&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/datastruct/hash.c.diff?cvsroot=dm&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/mm/dbg_malloc.c.diff?cvsroot=dm&r1=1.9&r2=1.10
WHATS_NEW +2 -0
@@ -1,5 +1,7 @@ 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 DM_LIB_VERSION definition to configure.h. Suppress 'Unrecognised field' error if report field is 'help'.
dmeventd/.exported_symbols +2 -0
@@ -15,3 +15,5 @@ dm_event_register_handler dm_event_unregister_handler dm_event_get_registered_device +dm_event_handler_set_timeout +dm_event_handler_get_timeout
dmeventd/dmeventd.c +48 -15
170 lines not on this page · raw message
dmeventd/libdevmapper-event.c +18 -5
@@ -38,6 +38,7 @@char *uuid;int major;int minor; +uint32_t timeout;enum dm_event_mask mask; };
@@ -62,6 +63,7 @@ dmevh->dso = dmevh->dev_name = dmevh->uuid =NULL ; dmevh->major = dmevh->minor =0 ; dmevh->mask =0 ; + dmevh->timeout =0 ;return dmevh; }
@@ -140,6 +142,11 @@ 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) {return dmevh->dso;
@@ -165,6 +172,11 @@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) {return dmevh->mask;
@@ -484,8 +496,8 @@/* Handle the event (de)registration call and return negative error codes. */ static int _do_event (int cmd,struct dm_event_daemon_message *msg, -const char *dso_name,const char *dev_name, -enum dm_event_mask evmask,uint32_t timeout) +const char *dso_name,const char *dev_name, +enum dm_event_mask evmask,uint32_t timeout) {int ret;struct dm_event_fifos fifos;
@@ -519,7 +531,7 @@ uuid =dm_task_get_uuid (dmt);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" ,dm_task_get_name (dmt), msg.data ? msg.data :strerror (-err));
@@ -549,7 +561,7 @@ uuid =dm_task_get_uuid (dmt);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" ,dm_task_get_name (dmt), msg.data ? msg.data :strerror (-err));
@@ -690,8 +702,9 @@if (!device_exists (device_path))return -ENODEV ; +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)
dmeventd/libdevmapper-event.h +2 -0
@@ -71,6 +71,7 @@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_timeout (struct dm_event_handler *dmevh,int timeout);/* * Specify mask for events to monitor.
@@ -83,6 +84,7 @@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_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);/* FIXME Review interface (what about this next thing?) */
dmsetup/dmsetup.c +2 -1
@@ -1705,7 +1705,8 @@/* * 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;off_t size, sectors;
lib/libdevmapper.h +17 -16
@@ -687,26 +687,27 @@int dm_report_output (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, -struct dm_report_field *field,const void *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_uint32 (struct dm_report *rh,struct dm_pool *mem, -struct dm_report_field *field,const void *data); -int dm_report_field_int (struct dm_report *rh,struct dm_pool *mem, -struct dm_report_field *field,const void *data); -int dm_report_field_uint64 (struct dm_report *rh,struct dm_pool *mem, -struct dm_report_field *field,const void *data); -/* -* Helper function for custom reporting functions +* Report functions are provided for simple data types. +* They take care of allocating copies of the data. */ +int dm_report_field_string (struct dm_report *rh,struct dm_report_field *field, +const char **data); +int dm_report_field_int32 (struct dm_report *rh,struct dm_report_field *field, +const int32_t *data); +int dm_report_field_uint32 (struct dm_report *rh,struct dm_report_field *field, +const uint32_t *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);/* -* sortvalue may be NULL if it's the same as value +* 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); +void dm_report_field_set_value (struct dm_report_field *field,const void *value, +const void *sortvalue);#endif /* LIB_DEVICE_MAPPER_H */
lib/libdm-common.c +2 -2
@@ -38,8 +38,8 @@* Library users can provide their own logging * function. */ -static void _default_log (int level,const char *file,int line, -const char *f, ...) +static void _default_log (int level,const char *file __attribute((unused)), +int line __attribute((unused)),const char *f, ...) {va_list ap;
lib/libdm-deptree.c +3 -1
@@ -1212,7 +1212,9 @@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;char devbuf[10 ];
lib/libdm-report.c +15 -15
@@ -99,12 +99,12 @@* 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, -struct dm_report_field *field,const void *data) +int dm_report_field_string (struct dm_report *rh, +struct dm_report_field *field,const char **data) {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" );return 0 ; }
@@ -115,10 +115,10 @@return 1 ; } -int dm_report_field_int (struct dm_report *rh,struct dm_pool *mem, -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) { -const int value = *(const int *) data; +const int value = *data;uint64_t *sortval;char *repstr;
@@ -144,10 +144,10 @@return 1 ; } -int dm_report_field_uint32 (struct dm_report *rh,struct dm_pool *mem, -struct dm_report_field *field,const void *data) +int dm_report_field_uint32 (struct dm_report *rh, +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;char *repstr;
@@ -173,10 +173,10 @@return 1 ; } -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_int32 (struct dm_report *rh, +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;char *repstr;
@@ -202,10 +202,10 @@return 1 ; } -int dm_report_field_uint64 (struct dm_report *rh,struct dm_pool *mem, -struct dm_report_field *field,const void *data) +int dm_report_field_uint64 (struct dm_report *rh, +struct dm_report_field *field,const uint64_t *data) { -const int value = *(const uint64_t *) data; +const int value = *data;uint64_t *sortval;char *repstr;
lib/libdm-string.c +2 -1
@@ -37,7 +37,8 @@* Split buffer into NULL-separated words in argv. * 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) {unsigned arg;
lib/datastruct/hash.c +4 -2
@@ -230,12 +230,14 @@ 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; } -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; }
lib/mm/dbg_malloc.c +2 -1
@@ -231,7 +231,8 @@ } } -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 ) { log_error("Huge memory allocation (size %" PRIsize_t