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