Open SCAP Library: icache.h Source File

Open SCAP Library

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

icache.h
1 /*
2 * Copyright 2011 Red Hat Inc., Durham, North Carolina.
3 * All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * Authors:
20 * Daniel Kopecek <dkopecek@redhat.com>
21 */
22 #ifndef ICACHE_H
23 #define ICACHE_H
24
25 #include <stddef.h>
26 #include <sexp.h>
27 #include "../SEAP/generic/rbt/rbt.h"
28
29 #ifndef PROBE_IQUEUE_CAPACITY
30 #define PROBE_IQUEUE_CAPACITY 1024
31 #endif
32
33 typedef struct {
34 SEXP_t *cobj;
35 union {
36 SEXP_t *item;
37 pthread_cond_t *cond;
38 } p;
39 } probe_iqpair_t;
40
41 typedef struct {
42 rbt_t *tree; /* XXX: rewrite to extensible or linear hashing */
43 pthread_t thid;
44
45 pthread_mutex_t queue_mutex;
46 pthread_cond_t queue_notempty;
47 pthread_cond_t queue_notfull;
48
49 probe_iqpair_t queue[PROBE_IQUEUE_CAPACITY];
50 uint16_t queue_beg;
51 uint16_t queue_end;
52 uint16_t queue_cnt;
53 uint16_t queue_max;
54 } probe_icache_t;
55
56 typedef struct {
57 SEXP_t **item;
58 uint16_t count;
59 } probe_citem_t;
60
61 probe_icache_t *probe_icache_new(void);
62 int probe_icache_add(probe_icache_t *cache, SEXP_t *cobj, SEXP_t *item);
63 int probe_icache_nop(probe_icache_t *cache);
64 void probe_icache_free(probe_icache_t *cache);
65
66 #endif /* ICACHE_H */
probe_iqpair_t
Definition: icache.h:33
probe_icache_t
Definition: icache.h:41
probe_citem_t
Definition: icache.h:56
rbt
Definition: rbt_common.h:129
SEXP
Definition: sexp-types.h:82