2013-12-09 09:14:24 -07:00
|
|
|
#ifndef __API_FS__
|
|
|
|
#define __API_FS__
|
2012-09-10 16:14:58 -06:00
|
|
|
|
2015-09-02 01:56:42 -06:00
|
|
|
#include <stdbool.h>
|
2016-02-14 09:03:43 -07:00
|
|
|
#include <unistd.h>
|
2015-09-02 01:56:42 -06:00
|
|
|
|
2015-09-02 01:56:37 -06: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 01:56:41 -06:00
|
|
|
#define FS(name) \
|
|
|
|
const char *name##__mountpoint(void); \
|
2015-09-02 01:56:42 -06:00
|
|
|
const char *name##__mount(void); \
|
|
|
|
bool name##__configured(void); \
|
2015-09-02 01:56:41 -06:00
|
|
|
|
|
|
|
FS(sysfs)
|
|
|
|
FS(procfs)
|
|
|
|
FS(debugfs)
|
|
|
|
FS(tracefs)
|
2016-09-05 22:58:28 -06:00
|
|
|
FS(hugetlbfs)
|
2017-01-26 14:20:00 -07:00
|
|
|
FS(bpf_fs)
|
2015-09-02 01:56:41 -06:00
|
|
|
|
|
|
|
#undef FS
|
|
|
|
|
2014-12-11 09:17:46 -07:00
|
|
|
|
|
|
|
int filename__read_int(const char *filename, int *value);
|
2015-09-10 08:58:50 -06:00
|
|
|
int filename__read_ull(const char *filename, unsigned long long *value);
|
2016-02-14 09:03:43 -07:00
|
|
|
int filename__read_str(const char *filename, char **buf, size_t *sizep);
|
2015-09-10 08:58:50 -06:00
|
|
|
|
2017-05-26 13:05:37 -06:00
|
|
|
int filename__write_int(const char *filename, int value);
|
|
|
|
|
2016-04-26 09:31:16 -06:00
|
|
|
int procfs__read_str(const char *entry, char **buf, size_t *sizep);
|
|
|
|
|
2014-12-11 09:37:10 -07:00
|
|
|
int sysctl__read_int(const char *sysctl, int *value);
|
2015-09-10 08:58:50 -06:00
|
|
|
int sysfs__read_int(const char *entry, int *value);
|
|
|
|
int sysfs__read_ull(const char *entry, unsigned long long *value);
|
2016-02-14 09:03:44 -07:00
|
|
|
int sysfs__read_str(const char *entry, char **buf, size_t *sizep);
|
2017-03-16 10:41:59 -06:00
|
|
|
int sysfs__read_bool(const char *entry, bool *value);
|
2017-05-26 13:05:37 -06:00
|
|
|
|
|
|
|
int sysfs__write_int(const char *entry, int value);
|
2013-12-09 09:14:24 -07:00
|
|
|
#endif /* __API_FS__ */
|