2013-12-09 23:14:24 +07:00
|
|
|
#ifndef __API_FS__
|
|
|
|
#define __API_FS__
|
2012-09-11 05:14:58 +07:00
|
|
|
|
2015-09-02 14:56:42 +07:00
|
|
|
#include <stdbool.h>
|
2016-02-14 23:03:43 +07:00
|
|
|
#include <unistd.h>
|
2015-09-02 14:56:42 +07:00
|
|
|
|
2015-09-02 14:56:37 +07:00
|
|
|
/*
|
|
|
|
* On most systems <limits.h> would have given us this, but not on some systems
|
|
|
|
* (e.g. GNU/Hurd).
|
|
|
|
*/
|
|
|
|
#ifndef PATH_MAX
|
|
|
|
#define PATH_MAX 4096
|
|
|
|
#endif
|
|
|
|
|
2015-09-02 14:56:41 +07:00
|
|
|
#define FS(name) \
|
|
|
|
const char *name##__mountpoint(void); \
|
2015-09-02 14:56:42 +07:00
|
|
|
const char *name##__mount(void); \
|
|
|
|
bool name##__configured(void); \
|
2015-09-02 14:56:41 +07:00
|
|
|
|
|
|
|
FS(sysfs)
|
|
|
|
FS(procfs)
|
|
|
|
FS(debugfs)
|
|
|
|
FS(tracefs)
|
2016-09-06 11:58:28 +07:00
|
|
|
FS(hugetlbfs)
|
2017-01-27 04:20:00 +07:00
|
|
|
FS(bpf_fs)
|
2015-09-02 14:56:41 +07:00
|
|
|
|
|
|
|
#undef FS
|
|
|
|
|
2014-12-11 23:17:46 +07:00
|
|
|
|
|
|
|
int filename__read_int(const char *filename, int *value);
|
2015-09-10 21:58:50 +07:00
|
|
|
int filename__read_ull(const char *filename, unsigned long long *value);
|
2016-02-14 23:03:43 +07:00
|
|
|
int filename__read_str(const char *filename, char **buf, size_t *sizep);
|
2015-09-10 21:58:50 +07:00
|
|
|
|
2017-05-27 02:05:37 +07:00
|
|
|
int filename__write_int(const char *filename, int value);
|
|
|
|
|
2016-04-26 22:31:16 +07:00
|
|
|
int procfs__read_str(const char *entry, char **buf, size_t *sizep);
|
|
|
|
|
2014-12-11 23:37:10 +07:00
|
|
|
int sysctl__read_int(const char *sysctl, int *value);
|
2015-09-10 21:58:50 +07:00
|
|
|
int sysfs__read_int(const char *entry, int *value);
|
|
|
|
int sysfs__read_ull(const char *entry, unsigned long long *value);
|
2016-02-14 23:03:44 +07:00
|
|
|
int sysfs__read_str(const char *entry, char **buf, size_t *sizep);
|
2017-03-16 23:41:59 +07:00
|
|
|
int sysfs__read_bool(const char *entry, bool *value);
|
2017-05-27 02:05:37 +07:00
|
|
|
|
|
|
|
int sysfs__write_int(const char *entry, int value);
|
2013-12-09 23:14:24 +07:00
|
|
|
#endif /* __API_FS__ */
|