Sync usage with man page.
[netbsd-mini2440.git] / external / gpl2 / lvm2 / dist / lib / freeseg / freeseg.c
blob3070d2a33adfc1471cdf1b1c912551b657d51524
1 /* $NetBSD$ */
3 /*
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
17 #include "lib.h"
18 #include "toolcontext.h"
19 #include "segtype.h"
20 #include "display.h"
21 #include "text_export.h"
22 #include "text_import.h"
23 #include "config.h"
24 #include "str_list.h"
25 #include "targets.h"
26 #include "lvm-string.h"
27 #include "activate.h"
28 #include "str_list.h"
29 #include "metadata.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));
50 if (!segtype)
51 return_NULL;
53 segtype->cmd = cmd;
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);
61 return segtype;