]>
Commit | Line | Data |
---|---|---|
3b5a3233 CB |
1 | #ifndef __LXCFS_BINDINGS_H |
2 | #define __LXCFS_BINDINGS_H | |
3 | ||
17e0e368 | 4 | #include "macro.h" |
71f17cd2 | 5 | #include "sysfs_fuse.h" |
17e0e368 | 6 | |
237e200e | 7 | /* directory under which we mount the controllers - /run/lxcfs/controllers */ |
cc97d34c | 8 | #define BASEDIR RUNTIME_PATH "/lxcfs/controllers" |
8cb31294 | 9 | #define ROOTDIR RUNTIME_PATH "/lxcfs/root" |
237e200e | 10 | |
71f17cd2 YB |
11 | /* Maximum number for 64 bit integer is a string with 21 digits: 2^64 - 1 = 21 */ |
12 | #define LXCFS_NUMSTRLEN64 21 | |
13 | ||
71f17cd2 YB |
14 | enum lxcfs_virt_t { |
15 | LXC_TYPE_CGDIR, | |
16 | LXC_TYPE_CGFILE, | |
17 | LXC_TYPE_PROC_MEMINFO, | |
18 | LXC_TYPE_PROC_CPUINFO, | |
19 | LXC_TYPE_PROC_UPTIME, | |
20 | LXC_TYPE_PROC_STAT, | |
21 | LXC_TYPE_PROC_DISKSTATS, | |
22 | LXC_TYPE_PROC_SWAPS, | |
23 | LXC_TYPE_PROC_LOADAVG, | |
24 | LXC_TYPE_SYS_DEVICES, | |
25 | LXC_TYPE_SYS_DEVICES_SYSTEM, | |
26 | LXC_TYPE_SYS_DEVICES_SYSTEM_CPU, | |
27 | LXC_TYPE_SYS_DEVICES_SYSTEM_CPU_ONLINE, | |
28 | }; | |
29 | ||
30 | struct file_info { | |
31 | char *controller; | |
32 | char *cgroup; | |
33 | char *file; | |
34 | int type; | |
35 | char *buf; // unused as of yet | |
36 | int buflen; | |
37 | int size; //actual data size | |
38 | int cached; | |
39 | }; | |
40 | ||
7e60aa1b | 41 | struct lxcfs_opts { |
42 | bool swap_off; | |
43 | }; | |
44 | ||
237e200e SH |
45 | extern int cg_write(const char *path, const char *buf, size_t size, off_t offset, |
46 | struct fuse_file_info *fi); | |
47 | extern int cg_mkdir(const char *path, mode_t mode); | |
48 | extern int cg_chown(const char *path, uid_t uid, gid_t gid); | |
49 | extern int cg_rmdir(const char *path); | |
50 | extern int cg_chmod(const char *path, mode_t mode); | |
51 | extern int cg_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, | |
52 | struct fuse_file_info *fi); | |
53 | extern int cg_releasedir(const char *path, struct fuse_file_info *fi); | |
54 | extern int cg_release(const char *path, struct fuse_file_info *fi); | |
55 | extern int cg_read(const char *path, char *buf, size_t size, off_t offset, | |
56 | struct fuse_file_info *fi); | |
57 | extern int cg_opendir(const char *path, struct fuse_file_info *fi); | |
58 | extern int cg_getattr(const char *path, struct stat *sb); | |
59 | extern int cg_open(const char *path, struct fuse_file_info *fi); | |
bddbb106 | 60 | extern int cg_access(const char *path, int mode); |
237e200e SH |
61 | |
62 | extern int proc_getattr(const char *path, struct stat *sb); | |
63 | extern int proc_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, | |
64 | struct fuse_file_info *fi); | |
65 | extern int proc_release(const char *path, struct fuse_file_info *fi); | |
66 | extern int proc_open(const char *path, struct fuse_file_info *fi); | |
67 | extern int proc_read(const char *path, char *buf, size_t size, off_t offset, | |
68 | struct fuse_file_info *fi); | |
bddbb106 | 69 | extern int proc_access(const char *path, int mask); |
6db4f7a3 | 70 | extern pthread_t load_daemon(int load_use); |
a83618e2 | 71 | extern int stop_load_daemon(pthread_t pid); |
3b5a3233 | 72 | |
71f17cd2 YB |
73 | extern pid_t lookup_initpid_in_store(pid_t qpid); |
74 | extern char *get_pid_cgroup(pid_t pid, const char *contrl); | |
5fbea8a6 CB |
75 | extern int read_file_fuse(const char *path, char *buf, size_t size, |
76 | struct file_info *d); | |
71f17cd2 YB |
77 | extern void prune_init_slice(char *cg); |
78 | extern char *get_cpuset(const char *cg); | |
71f17cd2 YB |
79 | extern int max_cpu_count(const char *cg); |
80 | extern void do_release_file_info(struct fuse_file_info *fi); | |
1e14fd04 | 81 | extern int cpu_number_in_cpuset(const char *cpuset); |
71f17cd2 | 82 | |
17e0e368 | 83 | #endif /* __LXCFS_BINDINGS_H */ |