2
* thd_sys_fs.h: sysfs class interface
4
* Copyright (C) 2012 Intel Corporation. All rights reserved.
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License version
8
* 2 or later as published by the Free Software Foundation.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21
* Author Name <Srinivas.Pandruvada@linux.intel.com>
28
#include <sys/types.h>
40
std::string base_path;
47
csys_fs(const char *path) :
51
/* write data to base path (dir) + provided path */
52
int write(const std::string &path, const std::string &buf);
53
int write(const std::string &path, unsigned int data);
54
int write(const std::string &path, unsigned int position,
55
unsigned long long data);
57
/* read data from base path (dir) + provided path */
58
int read(const std::string &path, char *buf, int len);
59
int read(const std::string &path, std::string &buf);
60
int read(const std::string &path, unsigned int *ptr_val);
61
int read(const std::string &path, unsigned int position, char *buf,
64
const char *get_base_path() {
65
return base_path.c_str();
67
int read_symbolic_link_value(const std::string &path, char *buf, int len);
69
bool exists(const std::string &path);
72
void update_path(std::string path) {
77
#endif /* THD_SYS_FS_H_ */