]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * libkmod - interface to kernel module operations | |
3 | * | |
4 | * Copyright (C) 2011-2013 ProFUSION embedded systems | |
5 | * | |
6 | * This library is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU Lesser General Public | |
8 | * License as published by the Free Software Foundation; either | |
9 | * version 2.1 of the License, or (at your option) any later version. | |
10 | * | |
11 | * This library is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * Lesser General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU Lesser General Public | |
17 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. | |
18 | */ | |
19 | ||
20 | #pragma once | |
21 | ||
22 | #include <inttypes.h> | |
23 | ||
24 | struct index_value { | |
25 | struct index_value *next; | |
26 | unsigned int priority; | |
27 | unsigned int len; | |
28 | char value[0]; | |
29 | }; | |
30 | ||
31 | /* In-memory index (depmod only) */ | |
32 | struct index_file; | |
33 | struct index_file *index_file_open(const char *filename); | |
34 | void index_file_close(struct index_file *idx); | |
35 | char *index_search(struct index_file *idx, const char *key); | |
36 | void index_dump(struct index_file *in, int fd, const char *prefix); | |
37 | struct index_value *index_searchwild(struct index_file *idx, const char *key); | |
38 | ||
39 | void index_values_free(struct index_value *values); | |
40 | ||
41 | /* Implementation using mmap */ | |
42 | struct index_mm; | |
43 | struct index_mm *index_mm_open(struct kmod_ctx *ctx, const char *filename, | |
44 | unsigned long long *stamp); | |
45 | void index_mm_close(struct index_mm *index); | |
46 | char *index_mm_search(struct index_mm *idx, const char *key); | |
47 | struct index_value *index_mm_searchwild(struct index_mm *idx, const char *key); | |
48 | void index_mm_dump(struct index_mm *idx, int fd, const char *prefix); |