LCOV - code coverage report
Current view: top level - misc/kabi/lvm2.git/lib/freeseg - freeseg.c (source / functions) Hit Total Coverage
Test: unnamed Lines: 13 16 81.2 %
Date: 2010-04-13 Functions: 2 3 66.7 %
Branches: 1 2 50.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
       3                 :            :  *
       4                 :            :  * This file is part of LVM2.
       5                 :            :  *
       6                 :            :  * This copyrighted material is made available to anyone wishing to use,
       7                 :            :  * modify, copy, or redistribute it subject to the terms and conditions
       8                 :            :  * of the GNU Lesser General Public License v.2.1.
       9                 :            :  *
      10                 :            :  * You should have received a copy of the GNU Lesser General Public License
      11                 :            :  * along with this program; if not, write to the Free Software Foundation,
      12                 :            :  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
      13                 :            :  */
      14                 :            : 
      15                 :            : #include "lib.h"
      16                 :            : #include "toolcontext.h"
      17                 :            : #include "segtype.h"
      18                 :            : #include "display.h"
      19                 :            : #include "text_export.h"
      20                 :            : #include "text_import.h"
      21                 :            : #include "config.h"
      22                 :            : #include "str_list.h"
      23                 :            : #include "targets.h"
      24                 :            : #include "lvm-string.h"
      25                 :            : #include "activate.h"
      26                 :            : #include "str_list.h"
      27                 :            : #include "metadata.h"
      28                 :            : 
      29                 :          0 : static const char *_freeseg_name(const struct lv_segment *seg)
      30                 :            : {
      31                 :          0 :         return seg->segtype->name;
      32                 :            : }
      33                 :            : 
      34                 :          3 : static void _freeseg_destroy(const struct segment_type *segtype)
      35                 :            : {
      36                 :          3 :         dm_free((void *)segtype);
      37                 :          3 : }
      38                 :            : 
      39                 :            : static struct segtype_handler _freeseg_ops = {
      40                 :            :         .name = _freeseg_name,
      41                 :            :         .destroy = _freeseg_destroy,
      42                 :            : };
      43                 :            : 
      44                 :          3 : struct segment_type *init_free_segtype(struct cmd_context *cmd)
      45                 :            : {
      46                 :          3 :         struct segment_type *segtype = dm_malloc(sizeof(*segtype));
      47                 :            : 
      48         [ -  + ]:          3 :         if (!segtype)
      49                 :          0 :                 return_NULL;
      50                 :            : 
      51                 :          3 :         segtype->cmd = cmd;
      52                 :          3 :         segtype->ops = &_freeseg_ops;
      53                 :          3 :         segtype->name = "free";
      54                 :          3 :         segtype->private = NULL;
      55                 :          3 :         segtype->flags = SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED;
      56                 :            : 
      57                 :          3 :         log_very_verbose("Initialised segtype: %s", segtype->name);
      58                 :            : 
      59                 :          3 :         return segtype;
      60                 :            : }

Generated by: LCOV version 1.8