1 /* $NetBSD: freeseg.c,v 1.1.1.1 2008/12/22 00:18:01 haad Exp $ */
4 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
6 * This file is part of LVM2.
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.
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
18 #include "toolcontext.h"
21 #include "text_export.h"
22 #include "text_import.h"
26 #include "lvm-string.h"
31 static const char *_freeseg_name(const struct lv_segment *seg)
33 return seg->segtype->name;
36 static void _freeseg_destroy(const struct segment_type *segtype)
38 dm_free((void *)segtype);
41 static struct segtype_handler _freeseg_ops = {
42 .name = _freeseg_name,
43 .destroy = _freeseg_destroy,
46 struct segment_type *init_free_segtype(struct cmd_context *cmd)
48 struct segment_type *segtype = dm_malloc(sizeof(*segtype));
54 segtype->ops = &_freeseg_ops;
55 segtype->name = "free";
56 segtype->private = NULL;
57 segtype->flags = SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED;
59 log_very_verbose("Initialised segtype: %s", segtype->name);