mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Cleanup gcc warning: cast discards qualifiers from pointer target type
API of the library should remain the same as the 'const' is not mangled into the function name in C.
This commit is contained in:
parent
f7b692d29f
commit
04bde319a9
@ -307,23 +307,23 @@ struct dm_tree_node *dm_tree_find_node_by_uuid(struct dm_tree *tree,
|
|||||||
* Set inverted to use inverted tree.
|
* Set inverted to use inverted tree.
|
||||||
*/
|
*/
|
||||||
struct dm_tree_node *dm_tree_next_child(void **handle,
|
struct dm_tree_node *dm_tree_next_child(void **handle,
|
||||||
struct dm_tree_node *parent,
|
const struct dm_tree_node *parent,
|
||||||
uint32_t inverted);
|
uint32_t inverted);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get properties of a node.
|
* Get properties of a node.
|
||||||
*/
|
*/
|
||||||
const char *dm_tree_node_get_name(struct dm_tree_node *node);
|
const char *dm_tree_node_get_name(const struct dm_tree_node *node);
|
||||||
const char *dm_tree_node_get_uuid(struct dm_tree_node *node);
|
const char *dm_tree_node_get_uuid(const struct dm_tree_node *node);
|
||||||
const struct dm_info *dm_tree_node_get_info(struct dm_tree_node *node);
|
const struct dm_info *dm_tree_node_get_info(const struct dm_tree_node *node);
|
||||||
void *dm_tree_node_get_context(struct dm_tree_node *node);
|
void *dm_tree_node_get_context(const struct dm_tree_node *node);
|
||||||
int dm_tree_node_size_changed(struct dm_tree_node *dnode);
|
int dm_tree_node_size_changed(const struct dm_tree_node *dnode);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the number of children of the given node (excluding the root node).
|
* Returns the number of children of the given node (excluding the root node).
|
||||||
* Set inverted for the number of parents.
|
* Set inverted for the number of parents.
|
||||||
*/
|
*/
|
||||||
int dm_tree_node_num_children(struct dm_tree_node *node, uint32_t inverted);
|
int dm_tree_node_num_children(const struct dm_tree_node *node, uint32_t inverted);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Deactivate a device plus all dependencies.
|
* Deactivate a device plus all dependencies.
|
||||||
|
@ -201,8 +201,8 @@ void dm_tree_free(struct dm_tree *dtree)
|
|||||||
dm_free(dtree);
|
dm_free(dtree);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _nodes_are_linked(struct dm_tree_node *parent,
|
static int _nodes_are_linked(const struct dm_tree_node *parent,
|
||||||
struct dm_tree_node *child)
|
const struct dm_tree_node *child)
|
||||||
{
|
{
|
||||||
struct dm_tree_link *dlink;
|
struct dm_tree_link *dlink;
|
||||||
|
|
||||||
@ -665,32 +665,32 @@ int dm_tree_add_dev_with_udev_flags(struct dm_tree *dtree, uint32_t major,
|
|||||||
return _add_dev(dtree, &dtree->root, major, minor, udev_flags) ? 1 : 0;
|
return _add_dev(dtree, &dtree->root, major, minor, udev_flags) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *dm_tree_node_get_name(struct dm_tree_node *node)
|
const char *dm_tree_node_get_name(const struct dm_tree_node *node)
|
||||||
{
|
{
|
||||||
return node->info.exists ? node->name : "";
|
return node->info.exists ? node->name : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *dm_tree_node_get_uuid(struct dm_tree_node *node)
|
const char *dm_tree_node_get_uuid(const struct dm_tree_node *node)
|
||||||
{
|
{
|
||||||
return node->info.exists ? node->uuid : "";
|
return node->info.exists ? node->uuid : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct dm_info *dm_tree_node_get_info(struct dm_tree_node *node)
|
const struct dm_info *dm_tree_node_get_info(const struct dm_tree_node *node)
|
||||||
{
|
{
|
||||||
return &node->info;
|
return &node->info;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *dm_tree_node_get_context(struct dm_tree_node *node)
|
void *dm_tree_node_get_context(const struct dm_tree_node *node)
|
||||||
{
|
{
|
||||||
return node->context;
|
return node->context;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dm_tree_node_size_changed(struct dm_tree_node *dnode)
|
int dm_tree_node_size_changed(const struct dm_tree_node *dnode)
|
||||||
{
|
{
|
||||||
return dnode->props.size_changed;
|
return dnode->props.size_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dm_tree_node_num_children(struct dm_tree_node *node, uint32_t inverted)
|
int dm_tree_node_num_children(const struct dm_tree_node *node, uint32_t inverted)
|
||||||
{
|
{
|
||||||
if (inverted) {
|
if (inverted) {
|
||||||
if (_nodes_are_linked(&node->dtree->root, node))
|
if (_nodes_are_linked(&node->dtree->root, node))
|
||||||
@ -806,11 +806,11 @@ struct dm_tree_node *dm_tree_find_node_by_uuid(struct dm_tree *dtree,
|
|||||||
* Set inverted to invert the tree.
|
* Set inverted to invert the tree.
|
||||||
*/
|
*/
|
||||||
struct dm_tree_node *dm_tree_next_child(void **handle,
|
struct dm_tree_node *dm_tree_next_child(void **handle,
|
||||||
struct dm_tree_node *parent,
|
const struct dm_tree_node *parent,
|
||||||
uint32_t inverted)
|
uint32_t inverted)
|
||||||
{
|
{
|
||||||
struct dm_list **dlink = (struct dm_list **) handle;
|
struct dm_list **dlink = (struct dm_list **) handle;
|
||||||
struct dm_list *use_list;
|
const struct dm_list *use_list;
|
||||||
|
|
||||||
if (inverted)
|
if (inverted)
|
||||||
use_list = &parent->used_by;
|
use_list = &parent->used_by;
|
||||||
|
@ -2094,7 +2094,7 @@ static int _dm_info_devno_disp(struct dm_report *rh, struct dm_pool *mem,
|
|||||||
void *private)
|
void *private)
|
||||||
{
|
{
|
||||||
char buf[DM_MAX_TYPE_NAME], *repstr;
|
char buf[DM_MAX_TYPE_NAME], *repstr;
|
||||||
struct dm_info *info = (struct dm_info *) data;
|
const struct dm_info *info = data;
|
||||||
|
|
||||||
if (!dm_pool_begin_object(mem, 8)) {
|
if (!dm_pool_begin_object(mem, 8)) {
|
||||||
log_error("dm_pool_begin_object failed");
|
log_error("dm_pool_begin_object failed");
|
||||||
@ -2125,7 +2125,8 @@ static int _dm_tree_names(struct dm_report *rh, struct dm_pool *mem,
|
|||||||
struct dm_report_field *field, const void *data,
|
struct dm_report_field *field, const void *data,
|
||||||
void *private, unsigned inverted)
|
void *private, unsigned inverted)
|
||||||
{
|
{
|
||||||
struct dm_tree_node *node = (struct dm_tree_node *) data, *parent;
|
const struct dm_tree_node *node = data;
|
||||||
|
struct dm_tree_node *parent;
|
||||||
void *t = NULL;
|
void *t = NULL;
|
||||||
const char *name;
|
const char *name;
|
||||||
int first_node = 1;
|
int first_node = 1;
|
||||||
@ -2186,7 +2187,8 @@ static int _dm_tree_parents_devs_disp(struct dm_report *rh, struct dm_pool *mem,
|
|||||||
struct dm_report_field *field,
|
struct dm_report_field *field,
|
||||||
const void *data, void *private)
|
const void *data, void *private)
|
||||||
{
|
{
|
||||||
struct dm_tree_node *node = (struct dm_tree_node *) data, *parent;
|
const struct dm_tree_node *node = data;
|
||||||
|
struct dm_tree_node *parent;
|
||||||
void *t = NULL;
|
void *t = NULL;
|
||||||
const struct dm_info *info;
|
const struct dm_info *info;
|
||||||
int first_node = 1;
|
int first_node = 1;
|
||||||
@ -2237,7 +2239,7 @@ static int _dm_tree_parents_count_disp(struct dm_report *rh,
|
|||||||
struct dm_report_field *field,
|
struct dm_report_field *field,
|
||||||
const void *data, void *private)
|
const void *data, void *private)
|
||||||
{
|
{
|
||||||
struct dm_tree_node *node = (struct dm_tree_node *) data;
|
const struct dm_tree_node *node = data;
|
||||||
int num_parent = dm_tree_node_num_children(node, 1);
|
int num_parent = dm_tree_node_num_children(node, 1);
|
||||||
|
|
||||||
return dm_report_field_int(rh, field, &num_parent);
|
return dm_report_field_int(rh, field, &num_parent);
|
||||||
|
Loading…
Reference in New Issue
Block a user