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