LVM2 libdm/libdevmapper.h libdm/libdm-deptree. ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2012-01-23 17:46:32
Modified files:
libdm : libdevmapper.h libdm-deptree.c lib/metadata : thin_manip.c lib/config : config.c lib/commands : toolcontext.c
Log message:
Reorder fns in libdm-deptree.
Tweak dm_config interface and remove FIXMEs.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.176&r2=1.177
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.150&r2=1.151
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/thin_manip.c.diff?cvsroot=lvm2&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.111&r2=1.112
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.146&r2=1.147
libdm/libdevmapper.h +29 -46
@@ -1337,26 +1337,26 @@void dm_report_field_set_value (struct dm_report_field *field,const void *value,const void *sortvalue); -/************************* * config file parse/print *************************/ -// FIXME AGK Review this interface before inclusion in a release. -enum { -DM_CFG_STRING , -DM_CFG_FLOAT , +typedef enum {DM_CFG_INT , +DM_CFG_FLOAT , +DM_CFG_STRING ,DM_CFG_EMPTY_ARRAY -}; +}dm_config_value_type_t ;struct dm_config_value { -int type; +dm_config_value_type_t type; +union {int64_t i;float f; -double d;/* For completeness. (Unused.) */ +double d;/* Unused. */ const char *str; } v; +struct dm_config_value *next;/* For arrays */ };
@@ -1366,7 +1366,6 @@struct dm_config_value *v; }; -/* FIXME Move cascade to dm_config_node and remove this struct */ struct dm_config_tree {struct dm_config_node *root;struct dm_config_tree *cascade;
@@ -1382,22 +1381,22 @@void dm_config_set_custom (struct dm_config_tree *cft,void *custom);/* -* If there's a cascaded dm_config_tree, remove the top layer -* and return the layer below. Otherwise return NULL. +* When searching, first_cft is checked before second_cft. */ -struct dm_config_tree *dm_config_remove_cascaded_tree (struct dm_config_tree *cft); +struct dm_config_tree *dm_config_insert_cascaded_tree (struct dm_config_tree *first_cft,struct dm_config_tree *second_cft);/* -* When searching, first_cft is checked before second_cft. +* If there's a cascaded dm_config_tree, remove the top layer +* and return the layer below. Otherwise return NULL. */ -struct dm_config_tree *dm_config_insert_cascaded_tree (struct dm_config_tree *first_cft,struct dm_config_tree *second_cft); +struct dm_config_tree *dm_config_remove_cascaded_tree (struct dm_config_tree *cft);void dm_config_destroy (struct dm_config_tree *cft);typedef int (*dm_putline_fn )(const char *line,void *baton);int dm_config_write_node (const struct dm_config_node *cn,dm_putline_fn putline,void *baton); -struct dm_config_node *dm_config_find_node (struct dm_config_node *cn,const char *path); +struct dm_config_node *dm_config_find_node (const struct dm_config_node *cn,const char *path);int dm_config_has_node (const struct dm_config_node *cn,const char *path);const char *dm_config_find_str (const struct dm_config_node *cn,const char *path,const char *fail);const char *dm_config_find_str_allow_empty (const struct dm_config_node *cn,const char *path,const char *fail);
@@ -1405,18 +1404,12 @@float dm_config_find_float (const struct dm_config_node *cn,const char *path,float fail);const struct dm_config_node *dm_config_tree_find_node (const struct dm_config_tree *cft,const char *path); -const char *dm_config_tree_find_str (const struct dm_config_tree *cft, -const char *path,const char *fail); -const char *dm_config_tree_find_str_allow_empty (const struct dm_config_tree *cft, -const char *path,const char *fail); -int dm_config_tree_find_int (const struct dm_config_tree *cft, -const char *path,int fail); -int64_t dm_config_tree_find_int64 (const struct dm_config_tree *cft, -const char *path,int64_t fail); -float dm_config_tree_find_float (const struct dm_config_tree *cft, -const char *path,float fail); -int dm_config_tree_find_bool (const struct dm_config_tree *cft, -const char *path,int fail); +const char *dm_config_tree_find_str (const struct dm_config_tree *cft,const char *path,const char *fail); +const char *dm_config_tree_find_str_allow_empty (const struct dm_config_tree *cft,const char *path,const char *fail); +int dm_config_tree_find_int (const struct dm_config_tree *cft,const char *path,int fail); +int64_t dm_config_tree_find_int64 (const struct dm_config_tree *cft,const char *path,int64_t fail); +float dm_config_tree_find_float (const struct dm_config_tree *cft,const char *path,float fail); +int dm_config_tree_find_bool (const struct dm_config_tree *cft,const char *path,int fail);/* * Understands (0, ~0), (y, n), (yes, no), (on,
@@ -1424,36 +1417,25 @@*/ int dm_config_find_bool (const struct dm_config_node *cn,const char *path,int fail); -int dm_config_get_uint32 (const struct dm_config_node *cn,const char *path, -uint32_t *result); - -int dm_config_get_uint64 (const struct dm_config_node *cn,const char *path, -uint64_t *result); - -int dm_config_get_str (const struct dm_config_node *cn,const char *path, -const char **result); -int dm_config_get_list (const struct dm_config_node *cn,const char *path, -const struct dm_config_value **result); -int dm_config_get_section (const struct dm_config_node *cn,const char *path, -const struct dm_config_node **result); +int dm_config_get_uint32 (const struct dm_config_node *cn,const char *path,uint32_t *result); +int dm_config_get_uint64 (const struct dm_config_node *cn,const char *path,uint64_t *result); +int dm_config_get_str (const struct dm_config_node *cn,const char *path,const char **result); +int dm_config_get_list (const struct dm_config_node *cn,const char *path,const struct dm_config_value **result); +int dm_config_get_section (const struct dm_config_node *cn,const char *path,const struct dm_config_node **result);unsigned dm_config_maybe_section (const char *str,unsigned len);const char *dm_config_parent_name (const struct dm_config_node *n); -struct dm_config_node *dm_config_clone_node_with_mem (struct dm_pool *mem, -const struct dm_config_node *node, -int siblings); +struct dm_config_node *dm_config_clone_node_with_mem (struct dm_pool *mem,const struct dm_config_node *node,int siblings);struct dm_config_node *dm_config_create_node (struct dm_config_tree *cft,const char *key);struct dm_config_value *dm_config_create_value (struct dm_config_tree *cft); -struct dm_config_node *dm_config_clone_node (struct dm_config_tree *cft, -const struct dm_config_node *cn, -int siblings); +struct dm_config_node *dm_config_clone_node (struct dm_config_tree *cft,const struct dm_config_node *cn,int siblings);struct dm_pool *dm_config_memory (struct dm_config_tree *cft); -/* Cookie prefixes. +* * The cookie value consists of a prefix (16 bits) and a base (16 bits). * We can use the prefix to store the flags. These flags are sent to * kernel within given dm task. When returned back to userspace in
@@ -1461,6 +1443,7 @@* of udev rules we use by decoding the cookie prefix. When doing the * notification, we replace the cookie prefix with DM_COOKIE_MAGIC, * so we notify the right semaphore. +* * It is still possible to use cookies for passing the flags to udev * rules even when udev_sync is disabled. The base part of the cookie * will be zero (there's no notification semaphore) and prefix will be
libdm/libdm-deptree.c +502 -502
1,100 lines not on this page · raw message
lib/metadata/thin_manip.c +1 -1
@@ -234,7 +234,7 @@ max_id = sl->seg->device_id;if (++max_id >DM_THIN_MAX_DEVICE_ID ) { -// FIXME: try to find empty holes.... +/* FIXME Find empty holes instead of aborting! */ log_error ("Cannot find free device_id." );return 0 ; }
lib/config/config.c +0 -3
@@ -160,7 +160,6 @@*/ struct dm_config_tree *remove_overridden_config_tree (struct cmd_context *cmd) { -// FIXME Replace cmd->cft with clean copy of merged lvm*.conf tree struct dm_config_tree *old_cft = cmd->cft;struct dm_config_tree *cft =dm_config_remove_cascaded_tree (cmd->cft);
@@ -172,8 +171,6 @@return old_cft; } -// FIXME Retain a copy of the string (or tree?) in cmd->cft_cmdline -// FIXME and merge into cmd->cft int override_config_tree_from_string (struct cmd_context *cmd,const char *config_settings) {
lib/commands/toolcontext.c +1 -8
@@ -620,7 +620,6 @@struct config_tree_list *cfl;struct dm_config_tree *cft_cmdline =NULL , *cft; -// FIXME No need for this - only one config tree now cft =dm_config_remove_cascaded_tree (cmd->cft);if (cft) { cft_cmdline = cmd->cft;
@@ -1452,7 +1451,7 @@ }dev_cache_exit ();_destroy_tags (cmd); -// FIXME Use cmd->cft_cmdline instead here. + cft_cmdline =_destroy_tag_configs (cmd); cmd->config_valid =0 ;
@@ -1465,7 +1464,6 @@/* Temporary duplicate cft pointer holding lvm.conf - replaced later */ cft_tmp = cmd->cft;if (cft_cmdline) -// FIXME Use cmd->cft_cmdline (convert string to cft again?) and merge instead cmd->cft =dm_config_insert_cascaded_tree (cft_cmdline, cft_tmp);/* Uses cmd->cft i.e. cft_cmdline + lvm.conf */
@@ -1479,15 +1477,11 @@if (!_init_tag_configs (cmd))return 0 ; -// FIXME Will need to use a fresh copy of the lvm.conf cft as the original -// FIXME got destroyed when cft_cmdline was merged into it /* Merge all the tag config files with lvm.conf, returning a * fresh cft pointer in place of cft_tmp. */ if (!(cmd->cft =_merge_config_files (cmd, cft_tmp)))return 0 ; -// FIXME Merge instead - but keep a clean copy of cmd->cft at this point -// FIXME so we can easily 'remove' the effect of cft_cmdline after each cmd /* Finally we can make the proper, fully-merged, cmd->cft */ if (cft_cmdline) cmd->cft =dm_config_insert_cascaded_tree (cft_cmdline, cmd->cft);
@@ -1539,7 +1533,6 @@dev_cache_exit ();_destroy_tags (cmd); -// FIXME destroy_tag_configs handles this itself again if ((cft_cmdline =_destroy_tag_configs (cmd)))dm_config_destroy (cft_cmdline);if (cmd->libmem)