diff options
author | Alasdair Kergon <agk@redhat.com> | 2002-11-18 14:04:08 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2002-11-18 14:04:08 +0000 |
commit | 5a52dca9c26ade9f233abcf5213300560d7a13a9 (patch) | |
tree | 9afbc621c07148c96a1ba1878a262dbd8aec613a /tools/vgdisplay.c | |
parent | d1d9800ef1c7ec38a5f72b8e2586f927ab68188c (diff) | |
download | lvm2-5a52dca9c26ade9f233abcf5213300560d7a13a9.tar.gz |
Some new features.
Diffstat (limited to 'tools/vgdisplay.c')
-rw-r--r-- | tools/vgdisplay.c | 88 |
1 files changed, 41 insertions, 47 deletions
diff --git a/tools/vgdisplay.c b/tools/vgdisplay.c index 13f301120..72bc3b388 100644 --- a/tools/vgdisplay.c +++ b/tools/vgdisplay.c @@ -20,7 +20,45 @@ #include "tools.h" -static int vgdisplay_single(struct cmd_context *cmd, const char *vg_name); +static int vgdisplay_single(struct cmd_context *cmd, const char *vg_name, + struct volume_group *vg, int consistent, + void *handle) +{ + /* FIXME Do the active check here if activevolumegroups_ARG ? */ + if (!vg) { + log_error("Volume group \"%s\" doesn't exist", vg_name); + return ECMD_FAILED; + } + + if (!consistent) + log_error("WARNING: Volume group \"%s\" inconsistent", vg_name); + + if (vg->status & EXPORTED_VG) + log_print("WARNING: volume group \"%s\" is exported", vg_name); + + if (arg_count(cmd, colon_ARG)) { + vgdisplay_colons(vg); + return 0; + } + + if (arg_count(cmd, short_ARG)) { + vgdisplay_short(vg); + return 0; + } + + vgdisplay_full(vg); /* was vg_show */ + + if (arg_count(cmd, verbose_ARG)) { + vgdisplay_extents(vg); + + process_each_lv_in_vg(cmd, vg, NULL, &lvdisplay_full); + + log_print("--- Physical volumes ---"); + process_each_pv_in_vg(cmd, vg, NULL, &pvdisplay_short); + } + + return 0; +} int vgdisplay(struct cmd_context *cmd, int argc, char **argv) { @@ -34,11 +72,6 @@ int vgdisplay(struct cmd_context *cmd, int argc, char **argv) return EINVALID_CMD_LINE; } - if (!driver_is_loaded()) - return ECMD_FAILED; - - /* FIXME -D disk_ARG is now redundant */ - /********* FIXME: Do without this - or else 2(+) passes! Figure out longest volume group name for (c = opt; opt < argc; opt++) { @@ -48,7 +81,8 @@ int vgdisplay(struct cmd_context *cmd, int argc, char **argv) } **********/ - process_each_vg(cmd, argc, argv, LCK_VG_READ, &vgdisplay_single); + process_each_vg(cmd, argc, argv, LCK_VG_READ, 0, NULL, + &vgdisplay_single); /******** FIXME Need to count number processed Add this to process_each_vg if arg_count(cmd,activevolumegroups_ARG) ? @@ -64,43 +98,3 @@ int vgdisplay(struct cmd_context *cmd, int argc, char **argv) return 0; } - -static int vgdisplay_single(struct cmd_context *cmd, const char *vg_name) -{ - - struct volume_group *vg; - - /* FIXME Do the active check here if activevolumegroups_ARG ? */ - - log_very_verbose("Finding volume group \"%s\"", vg_name); - if (!(vg = vg_read(cmd, vg_name))) { - log_error("Volume group \"%s\" doesn't exist", vg_name); - return ECMD_FAILED; - } - - if (vg->status & EXPORTED_VG) - log_print("WARNING: volume group \"%s\" is exported", vg_name); - - if (arg_count(cmd, colon_ARG)) { - vgdisplay_colons(vg); - return 0; - } - - if (arg_count(cmd, short_ARG)) { - vgdisplay_short(vg); - return 0; - } - - vgdisplay_full(vg); /* was vg_show */ - - if (arg_count(cmd, verbose_ARG)) { - vgdisplay_extents(vg); - - process_each_lv_in_vg(cmd, vg, &lvdisplay_full); - - log_print("--- Physical volumes ---"); - process_each_pv_in_vg(cmd, vg, &pvdisplay_short); - } - - return 0; -} |