summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-08-07 09:06:05 +0000
committerJim Meyering <jim@meyering.net>2007-08-07 09:06:05 +0000
commit08c9ff434bc9c2cd6bf69f577252affd42d8021a (patch)
treef7b8316b7017b880fee40fa7d9444e2c78783907 /tools
parent41a94b54005c81b53501040bc4d886c9b0a3d763 (diff)
downloadlvm2-08c9ff434bc9c2cd6bf69f577252affd42d8021a.tar.gz
lvm2-08c9ff434bc9c2cd6bf69f577252affd42d8021a.tar.xz
lvm2-08c9ff434bc9c2cd6bf69f577252affd42d8021a.zip
Add "const" attributes where possible: first cut.
Diffstat (limited to 'tools')
-rw-r--r--tools/toollib.c19
-rw-r--r--tools/toollib.h28
-rw-r--r--tools/tools.h2
-rw-r--r--tools/vgdisplay.c7
4 files changed, 30 insertions, 26 deletions
diff --git a/tools/toollib.c b/tools/toollib.c
index 5510e8ee..5753aff6 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -25,7 +25,7 @@
#define MIRROR_DISK_VERSION 2
/* Command line args */
-unsigned arg_count(struct cmd_context *cmd, int a)
+unsigned arg_count(const struct cmd_context *cmd, int a)
{
return cmd->args[a].count;
}
@@ -142,12 +142,12 @@ char *skip_dev_dir(struct cmd_context *cmd, const char *vg_name,
/*
* Metadata iteration functions
*/
-int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
- struct list *arg_lvnames, struct list *tags,
+int process_each_lv_in_vg(struct cmd_context *cmd,
+ const struct volume_group *vg,
+ const struct list *arg_lvnames,
+ const struct list *tags,
void *handle,
- int (*process_single) (struct cmd_context * cmd,
- struct logical_volume * lv,
- void *handle))
+ process_single_lv_fn_t process_single)
{
int ret_max = 0;
int ret = 0;
@@ -603,11 +603,8 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
}
int process_each_pv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
- struct list *tags, void *handle,
- int (*process_single) (struct cmd_context * cmd,
- struct volume_group * vg,
- struct physical_volume * pv,
- void *handle))
+ const struct list *tags, void *handle,
+ process_single_pv_fn_t process_single)
{
int ret_max = 0;
int ret = 0;
diff --git a/tools/toollib.h b/tools/toollib.h
index b67fc403..93ab5b33 100644
--- a/tools/toollib.h
+++ b/tools/toollib.h
@@ -60,19 +60,25 @@ int process_each_segment_in_lv(struct cmd_context *cmd,
struct lv_segment * seg,
void *handle));
+typedef int (*process_single_pv_fn_t) (struct cmd_context *cmd,
+ struct volume_group *vg,
+ struct physical_volume *pv,
+ void *handle);
+
int process_each_pv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
- struct list *tags, void *handle,
- int (*process_single) (struct cmd_context * cmd,
- struct volume_group * vg,
- struct physical_volume * pv,
- void *handle));
-
-int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
- struct list *arg_lvnames, struct list *tags,
+ const struct list *tags, void *handle,
+ process_single_pv_fn_t process_single);
+
+typedef int (*process_single_lv_fn_t) (struct cmd_context *cmd,
+ struct logical_volume *lv,
+ void *handle);
+
+int process_each_lv_in_vg(struct cmd_context *cmd,
+ const struct volume_group *vg,
+ const struct list *arg_lvnames,
+ const struct list *tags,
void *handle,
- int (*process_single) (struct cmd_context * cmd,
- struct logical_volume * lv,
- void *handle));
+ process_single_lv_fn_t process_single);
char *default_vgname(struct cmd_context *cmd);
const char *extract_vgname(struct cmd_context *cmd, const char *lv_name);
diff --git a/tools/tools.h b/tools/tools.h
index bba7e9e3..eac7c028 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -147,7 +147,7 @@ int alloc_arg(struct cmd_context *cmd, struct arg *a);
char yes_no_prompt(const char *prompt, ...);
/* we use the enums to access the switches */
-unsigned int arg_count(struct cmd_context *cmd, int a);
+unsigned int arg_count(const struct cmd_context *cmd, int a);
const char *arg_value(struct cmd_context *cmd, int a);
const char *arg_str_value(struct cmd_context *cmd, int a, const char *def);
int32_t arg_int_value(struct cmd_context *cmd, int a, const int32_t def);
diff --git a/tools/vgdisplay.c b/tools/vgdisplay.c
index aa02129f..0881906a 100644
--- a/tools/vgdisplay.c
+++ b/tools/vgdisplay.c
@@ -46,10 +46,11 @@ static int vgdisplay_single(struct cmd_context *cmd, const char *vg_name,
vgdisplay_extents(vg);
process_each_lv_in_vg(cmd, vg, NULL, NULL, NULL,
- &lvdisplay_full);
+ (process_single_lv_fn_t)lvdisplay_full);
log_print("--- Physical volumes ---");
- process_each_pv_in_vg(cmd, vg, NULL, NULL, &pvdisplay_short);
+ process_each_pv_in_vg(cmd, vg, NULL, NULL,
+ (process_single_pv_fn_t)pvdisplay_short);
}
check_current_backup(vg);
@@ -98,7 +99,7 @@ int vgdisplay(struct cmd_context *cmd, int argc, char **argv)
**********/
process_each_vg(cmd, argc, argv, LCK_VG_READ, 0, NULL,
- &vgdisplay_single);
+ vgdisplay_single);
/******** FIXME Need to count number processed
Add this to process_each_vg if arg_count(cmd,activevolumegroups_ARG) ?