chiark / gitweb /
Do no isolate in case of emergency or severe problems
[elogind.git] / src / readahead / readahead-common.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6   This file is part of systemd.
7
8   Copyright 2010 Lennart Poettering
9
10   systemd is free software; you can redistribute it and/or modify it
11   under the terms of the GNU Lesser General Public License as published by
12   the Free Software Foundation; either version 2.1 of the License, or
13   (at your option) any later version.
14
15   systemd is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 ***/
23
24 #include <sys/stat.h>
25 #include <sys/types.h>
26
27 #include "macro.h"
28 #include "util.h"
29
30 #define READAHEAD_FILE_SIZE_MAX (10*1024*1024)
31
32 #define READAHEAD_PACK_FILE_VERSION ";VERSION=2\n"
33
34 extern unsigned arg_files_max;
35 extern off_t arg_file_size_max;
36 extern usec_t arg_timeout;
37
38 int file_verify(int fd, const char *fn, off_t file_size_max, struct stat *st);
39
40 int fs_on_ssd(const char *p);
41 int fs_on_read_only(const char *p);
42
43 bool enough_ram(void);
44
45 int open_inotify(void);
46
47 typedef struct ReadaheadShared {
48         pid_t collect;
49         pid_t replay;
50 } _packed_ ReadaheadShared;
51
52 ReadaheadShared *shared_get(void);
53
54 int block_bump_request_nr(const char *p);
55
56 int block_get_readahead(const char *p, uint64_t *bytes);
57 int block_set_readahead(const char *p, uint64_t bytes);
58
59 int main_collect(const char *root);
60 int main_replay(const char *root);
61 int main_analyze(const char *pack_path);