]>
Commit | Line | Data |
---|---|---|
1 | /* SPDX-License-Identifier: LGPL-2.1+ */ | |
2 | ||
3 | #ifndef __LXC_PARSE_H | |
4 | #define __LXC_PARSE_H | |
5 | ||
6 | #include "config.h" | |
7 | ||
8 | #include <stdio.h> | |
9 | #include <sys/types.h> | |
10 | ||
11 | #include "compiler.h" | |
12 | ||
13 | typedef int (*lxc_dir_cb)(const char *name, const char *directory, | |
14 | const char *file, void *data); | |
15 | ||
16 | typedef int (*lxc_file_cb)(char *buffer, void *data); | |
17 | ||
18 | __hidden __hot extern int lxc_file_for_each_line(const char *file, lxc_file_cb callback, void *data); | |
19 | ||
20 | __hidden __hot extern int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, | |
21 | void *data); | |
22 | ||
23 | /* mmap() wrapper. lxc_strmmap() will take care to \0-terminate files so that | |
24 | * normal string-handling functions can be used on the buffer. */ | |
25 | __hidden extern void *lxc_strmmap(void *addr, size_t length, int prot, int flags, int fd, | |
26 | off_t offset); | |
27 | /* munmap() wrapper. Use it to free memory mmap()ed with lxc_strmmap(). */ | |
28 | __hidden extern int lxc_strmunmap(void *addr, size_t length); | |
29 | ||
30 | #endif /* __LXC_PARSE_H */ |