• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/fstools/libblkid-tiny/probe.c

  1 /*
  2  * Low-level libblkid probing API
  3  *
  4  * Copyright (C) 2008-2009 Karel Zak <kzak@redhat.com>
  5  *
  6  * This file may be redistributed under the terms of the
  7  * GNU Lesser General Public License.
  8  */
  9 
 10 #include <stdlib.h>
 11 
 12 #include "blkidP.h"
 13 #include "libblkid-tiny.h"
 14 
 15 static int blkid_probe_reset_buffers(struct blkid_struct_probe *pr);
 16 
 17 struct blkid_struct_probe *blkidtiny_new_probe(void)
 18 {
 19         struct blkid_struct_probe *pr;
 20 
 21         pr = calloc(1, sizeof(struct blkid_struct_probe));
 22         if (!pr)
 23                 return NULL;
 24 
 25         INIT_LIST_HEAD(&pr->buffers);
 26 
 27         return pr;
 28 }
 29 
 30 void blkidtiny_free_probe(struct blkid_struct_probe *pr)
 31 {
 32         if (!pr)
 33                 return;
 34 
 35         blkid_probe_reset_buffers(pr);
 36 
 37         free(pr);
 38 }
 39 
 40 static int blkid_probe_reset_buffers(struct blkid_struct_probe *pr)
 41 {
 42         if (list_empty(&pr->buffers))
 43                 return 0;
 44 
 45         while (!list_empty(&pr->buffers)) {
 46                 struct blkid_bufinfo *bf = list_first_entry(&pr->buffers, struct blkid_bufinfo, bufs);
 47 
 48                 list_del(&bf->bufs);
 49 
 50                 free(bf);
 51         }
 52 
 53         return 0;
 54 }
 55 

This page was automatically generated by LXR 0.3.1.  •  OpenWrt