xref: /netbsd-src/external/gpl2/lvm2/dist/tools/vgmknodes.c (revision 7c604eea85b4f330dc75ffe65e947f4d73758aa0)
1*7c604eeaShaad /*	$NetBSD: vgmknodes.c,v 1.1.1.3 2009/12/02 00:25:57 haad Exp $	*/
256a34939Shaad 
356a34939Shaad /*
456a34939Shaad  * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
556a34939Shaad  * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
656a34939Shaad  *
756a34939Shaad  * This file is part of LVM2.
856a34939Shaad  *
956a34939Shaad  * This copyrighted material is made available to anyone wishing to use,
1056a34939Shaad  * modify, copy, or redistribute it subject to the terms and conditions
1156a34939Shaad  * of the GNU Lesser General Public License v.2.1.
1256a34939Shaad  *
1356a34939Shaad  * You should have received a copy of the GNU Lesser General Public License
1456a34939Shaad  * along with this program; if not, write to the Free Software Foundation,
1556a34939Shaad  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1656a34939Shaad  */
1756a34939Shaad 
1856a34939Shaad #include "tools.h"
1956a34939Shaad 
_vgmknodes_single(struct cmd_context * cmd,struct logical_volume * lv,void * handle __attribute ((unused)))2056a34939Shaad static int _vgmknodes_single(struct cmd_context *cmd, struct logical_volume *lv,
2156a34939Shaad 			     void *handle __attribute((unused)))
2256a34939Shaad {
23bec4d750Shaad 	if (arg_count(cmd, refresh_ARG) && lv_is_visible(lv))
24*7c604eeaShaad 		if (!lv_refresh(cmd, lv)) {
25*7c604eeaShaad 			stack;
26bec4d750Shaad 			return ECMD_FAILED;
27*7c604eeaShaad 		}
28bec4d750Shaad 
29*7c604eeaShaad 	if (!lv_mknodes(cmd, lv)) {
30*7c604eeaShaad 		stack;
3156a34939Shaad 		return ECMD_FAILED;
32*7c604eeaShaad 	}
3356a34939Shaad 
3456a34939Shaad 	return ECMD_PROCESSED;
3556a34939Shaad }
3656a34939Shaad 
vgmknodes(struct cmd_context * cmd,int argc,char ** argv)3756a34939Shaad int vgmknodes(struct cmd_context *cmd, int argc, char **argv)
3856a34939Shaad {
39*7c604eeaShaad 	if (!lv_mknodes(cmd, NULL)) {
40*7c604eeaShaad 		stack;
41bec4d750Shaad 		return ECMD_FAILED;
42*7c604eeaShaad 	}
4356a34939Shaad 
44bec4d750Shaad 	return process_each_lv(cmd, argc, argv, LCK_VG_READ, NULL,
4556a34939Shaad 			    &_vgmknodes_single);
4656a34939Shaad }
47