Expand PMF_FN_* macros.
[netbsd-mini2440.git] / external / gpl2 / lvm2 / dist / tools / vgscan.c
blob9f032011a014a585f01b0b0bfe15104b51cae318
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
5 * Copyright (C) 2004-2009 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
18 #include "tools.h"
20 static int vgscan_single(struct cmd_context *cmd, const char *vg_name,
21 struct volume_group *vg,
22 void *handle __attribute((unused)))
24 log_print("Found %svolume group \"%s\" using metadata type %s",
25 vg_is_exported(vg) ? "exported " : "", vg_name,
26 vg->fid->fmt->name);
28 check_current_backup(vg);
30 return ECMD_PROCESSED;
33 int vgscan(struct cmd_context *cmd, int argc, char **argv)
35 int maxret, ret;
37 if (argc) {
38 log_error("Too many parameters on command line");
39 return EINVALID_CMD_LINE;
42 if (!lock_vol(cmd, VG_GLOBAL, LCK_VG_WRITE)) {
43 log_error("Unable to obtain global lock.");
44 return ECMD_FAILED;
47 persistent_filter_wipe(cmd->filter);
48 lvmcache_destroy(cmd, 1);
50 log_print("Reading all physical volumes. This may take a while...");
52 maxret = process_each_vg(cmd, argc, argv, 0, NULL,
53 &vgscan_single);
55 if (arg_count(cmd, mknodes_ARG)) {
56 ret = vgmknodes(cmd, argc, argv);
57 if (ret > maxret)
58 maxret = ret;
61 unlock_vg(cmd, VG_GLOBAL);
62 return maxret;