Open SCAP Library
Loading...
Searching...
No Matches
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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
33typedef struct {
34 SEXP_t *cobj;
35 union {
36 SEXP_t *item;
37 pthread_cond_t *cond;
38 } p;
40
41typedef 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;
55
56typedef struct {
57 SEXP_t **item;
58 uint16_t count;
60
61probe_icache_t *probe_icache_new(void);
62int probe_icache_add(probe_icache_t *cache, SEXP_t *cobj, SEXP_t *item);
63int probe_icache_nop(probe_icache_t *cache);
64void probe_icache_free(probe_icache_t *cache);
65
66#endif /* ICACHE_H */
Definition sexp-types.h:82
Definition icache.h:56
Definition icache.h:41
Definition icache.h:33
Definition rbt_common.h:129