4 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
5 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
7 * This file is part of LVM2.
9 * This copyrighted material is made available to anyone wishing to use,
10 * modify, copy, or redistribute it subject to the terms and conditions
11 * of the GNU Lesser General Public License v.2.1.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, write to the Free Software Foundation,
15 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 static int vgdisplay_single(struct cmd_context
*cmd
, const char *vg_name
,
21 struct volume_group
*vg
,
22 void *handle
__attribute((unused
)))
24 /* FIXME Do the active check here if activevolumegroups_ARG ? */
25 vg_check_status(vg
, EXPORTED_VG
);
27 if (arg_count(cmd
, colon_ARG
)) {
29 return ECMD_PROCESSED
;
32 if (arg_count(cmd
, short_ARG
)) {
34 return ECMD_PROCESSED
;
37 vgdisplay_full(vg
); /* was vg_show */
39 if (arg_count(cmd
, verbose_ARG
)) {
40 vgdisplay_extents(vg
);
42 process_each_lv_in_vg(cmd
, vg
, NULL
, NULL
, NULL
,
43 (process_single_lv_fn_t
)lvdisplay_full
);
45 log_print("--- Physical volumes ---");
46 process_each_pv_in_vg(cmd
, vg
, NULL
, NULL
,
47 (process_single_pv_fn_t
)pvdisplay_short
);
50 check_current_backup(vg
);
52 return ECMD_PROCESSED
;
55 int vgdisplay(struct cmd_context
*cmd
, int argc
, char **argv
)
57 if (arg_count(cmd
, columns_ARG
)) {
58 if (arg_count(cmd
, colon_ARG
) ||
59 arg_count(cmd
, activevolumegroups_ARG
) ||
60 arg_count(cmd
, short_ARG
)) {
61 log_error("Incompatible options selected");
62 return EINVALID_CMD_LINE
;
64 return vgs(cmd
, argc
, argv
);
65 } else if (arg_count(cmd
, aligned_ARG
) ||
66 arg_count(cmd
, noheadings_ARG
) ||
67 arg_count(cmd
, options_ARG
) ||
68 arg_count(cmd
, separator_ARG
) ||
69 arg_count(cmd
, sort_ARG
) || arg_count(cmd
, unbuffered_ARG
)) {
70 log_error("Incompatible options selected");
71 return EINVALID_CMD_LINE
;
74 if (arg_count(cmd
, colon_ARG
) && arg_count(cmd
, short_ARG
)) {
75 log_error("Option -c is not allowed with option -s");
76 return EINVALID_CMD_LINE
;
79 if (argc
&& arg_count(cmd
, activevolumegroups_ARG
)) {
80 log_error("Option -A is not allowed with volume group names");
81 return EINVALID_CMD_LINE
;
84 /********* FIXME: Do without this - or else 2(+) passes!
85 Figure out longest volume group name
86 for (c = opt; opt < argc; opt++) {
87 len = strlen(argv[opt]);
93 return process_each_vg(cmd
, argc
, argv
, 0, NULL
,
96 /******** FIXME Need to count number processed
97 Add this to process_each_vg if arg_count(cmd,activevolumegroups_ARG) ?
101 if (arg_count(cmd,activevolumegroups_ARG))
103 printf("volume groups found\n\n");