xref: /netbsd-src/external/gpl2/lvm2/dist/liblvm/lvm_pv.c (revision 7c604eea85b4f330dc75ffe65e947f4d73758aa0)
1*7c604eeaShaad /*	$NetBSD: lvm_pv.c,v 1.1.1.1 2009/12/02 00:26:15 haad Exp $	*/
2*7c604eeaShaad 
3*7c604eeaShaad /*
4*7c604eeaShaad  * Copyright (C) 2008,2009 Red Hat, Inc. All rights reserved.
5*7c604eeaShaad  *
6*7c604eeaShaad  * This file is part of LVM2.
7*7c604eeaShaad  *
8*7c604eeaShaad  * This copyrighted material is made available to anyone wishing to use,
9*7c604eeaShaad  * modify, copy, or redistribute it subject to the terms and conditions
10*7c604eeaShaad  * of the GNU Lesser General Public License v.2.1.
11*7c604eeaShaad  *
12*7c604eeaShaad  * You should have received a copy of the GNU Lesser General Public License
13*7c604eeaShaad  * along with this program; if not, write to the Free Software Foundation,
14*7c604eeaShaad  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15*7c604eeaShaad  */
16*7c604eeaShaad 
17*7c604eeaShaad #include "lib.h"
18*7c604eeaShaad #include "lvm2app.h"
19*7c604eeaShaad #include "metadata-exported.h"
20*7c604eeaShaad #include "lvm-string.h"
21*7c604eeaShaad 
lvm_pv_get_uuid(const pv_t pv)22*7c604eeaShaad char *lvm_pv_get_uuid(const pv_t pv)
23*7c604eeaShaad {
24*7c604eeaShaad 	char uuid[64] __attribute((aligned(8)));
25*7c604eeaShaad 
26*7c604eeaShaad 	if (!id_write_format(&pv->id, uuid, sizeof(uuid))) {
27*7c604eeaShaad 		log_error("Internal error converting uuid");
28*7c604eeaShaad 		return NULL;
29*7c604eeaShaad 	}
30*7c604eeaShaad 	return strndup((const char *)uuid, 64);
31*7c604eeaShaad }
32*7c604eeaShaad 
lvm_pv_get_name(const pv_t pv)33*7c604eeaShaad char *lvm_pv_get_name(const pv_t pv)
34*7c604eeaShaad {
35*7c604eeaShaad 	char *name;
36*7c604eeaShaad 
37*7c604eeaShaad 	name = dm_malloc(NAME_LEN + 1);
38*7c604eeaShaad 	strncpy(name, (const char *)pv_dev_name(pv), NAME_LEN);
39*7c604eeaShaad 	name[NAME_LEN] = '\0';
40*7c604eeaShaad 	return name;
41*7c604eeaShaad }
42*7c604eeaShaad 
lvm_pv_get_mda_count(const pv_t pv)43*7c604eeaShaad uint64_t lvm_pv_get_mda_count(const pv_t pv)
44*7c604eeaShaad {
45*7c604eeaShaad 	return (uint64_t) pv_mda_count(pv);
46*7c604eeaShaad }
47*7c604eeaShaad 
lvm_pv_resize(const pv_t pv,uint64_t new_size)48*7c604eeaShaad int lvm_pv_resize(const pv_t pv, uint64_t new_size)
49*7c604eeaShaad {
50*7c604eeaShaad 	/* FIXME: add pv resize code here */
51*7c604eeaShaad 	log_error("NOT IMPLEMENTED YET");
52*7c604eeaShaad 	return -1;
53*7c604eeaShaad }
54