39 #include <sys/types.h>
45 #define SYSFS_STRING_BUFFER_LENGTH 16
60 int ret = access(sysfs_path, F_OK);
66 if (errno == ENOENT) {
77 char const *
const sysfs_export_file,
int value) {
92 char const *
const sysfs_unexport_file,
int value) {
107 int fd = open(sysfs_file, O_WRONLY);
112 int len = strlen(value);
113 int ret = write(fd, value, len);
123 int fd = open(sysfs_file, O_RDONLY);
128 int len = read(fd, value, length);
137 string_buffer[0] = 0;
151 if (strlen(string_buffer) <= 0) {
154 *value = atoi(string_buffer);
int sysfs_write_string(char const *const sysfs_file, char const *const value)
int sysfs_read_int(char const *const sysfs_file, int *const value)
int sysfs_read_string(char const *const sysfs_file, char *const value, int length)
int sysfs_unexport(char const *const sysfs_file, int value)
#define SYSFS_STRING_BUFFER_LENGTH
String buffer size for dynamic string operations.
int sysfs_write_int(char const *const sysfs_file, int value)
int sysfs_unexport_exported(char const *const sysfs_path, char const *const sysfs_unexport_file, int value)
int sysfs_export_unexported(char const *const sysfs_path, char const *const sysfs_export_file, int value)
int sysfs_export(char const *const sysfs_file, int value)
int sysfs_is_exported(char const *const sysfs_path)