• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

/home/pvrabec/project/openscap/openscap-0.6.6/src/OVAL/probes/SEAP/generic/bitmap.h

00001 /*
00002  * Copyright 2009 Red Hat Inc., Durham, North Carolina.
00003  * All Rights Reserved.
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  *
00019  * Authors:
00020  *      "Daniel Kopecek" <dkopecek@redhat.com>
00021  */
00022 
00023 #pragma once
00024 #ifndef BITMAP_H
00025 #define BITMAP_H
00026 
00027 #include <stdint.h>
00028 #include "../../../../common/util.h"
00029 
00030 OSCAP_HIDDEN_START;
00031 
00032 typedef uint32_t bitmap_cell_t;
00033 typedef uint16_t bitmap_size_t;
00034 typedef int32_t  bitmap_bitn_t;
00035 
00036 typedef struct {
00037 #if defined(SEAP_THREAD_SAFE)
00038         uint8_t   locked;
00039 #endif
00040         bitmap_size_t  size;  /* bit capacity = size * BITMAP_CELLSIZE */
00041         bitmap_size_t  realsize;
00042         bitmap_cell_t *cells;
00043         bitmap_bitn_t  count;
00044 } bitmap_t;
00045 
00046 #if defined(SEAP_THREAD_SAFE)
00047 # define BITMAP_INITIALIZER { 0, 128, 0, NULL, 0 }
00048 #else
00049 # define BITMAP_INITIALIZER { 128, 0, NULL, 0 }
00050 #endif
00051 
00052 #define BITMAP_CELLSIZE (sizeof (bitmap_cell_t) * 8)
00053 
00054 bitmap_t *bitmap_new (bitmap_size_t size);
00055 int      *bitmap_init (bitmap_t *bitmap, bitmap_size_t size);
00056 int      *bitmap_reinit (bitmap_t *bitmap, bitmap_size_t size);
00057 int       bitmap_set (bitmap_t *bitmap, bitmap_bitn_t bitn);
00058 int       bitmap_cas (bitmap_t *bitmap, bitmap_bitn_t bitn, int v);
00059 int       bitmap_unset (bitmap_t *bitmap, bitmap_bitn_t bitn);
00060 int       bitmap_clear (bitmap_t *bitmap);
00061 bitmap_bitn_t bitmap_setfree (bitmap_t *bitmap);
00062 bitmap_bitn_t bitmap_getfree (bitmap_t *bitmap);
00063 void      bitmap_free (bitmap_t *bitmap);
00064 
00065 OSCAP_HIDDEN_END;
00066 
00067 #endif

Generated on Thu Dec 9 2010 for Open SCAP Library by  doxygen 1.7.1