mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-22 18:25:05 +08:00
Revert "[Sysman]: Remove not used functions in fsAccess"
This reverts commit d47c1de7aa.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
5d04c15297
commit
8bce514403
@@ -199,6 +199,15 @@ bool FsAccess::fileExists(const std::string file) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ze_result_t FsAccess::getFileMode(const std::string file, ::mode_t &mode) {
|
||||||
|
struct stat sb;
|
||||||
|
if (0 != stat(file.c_str(), &sb)) {
|
||||||
|
return getResult(errno);
|
||||||
|
}
|
||||||
|
mode = sb.st_mode;
|
||||||
|
return ZE_RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
ze_result_t FsAccess::readSymLink(const std::string path, std::string &val) {
|
ze_result_t FsAccess::readSymLink(const std::string path, std::string &val) {
|
||||||
// returns the value of symlink at path
|
// returns the value of symlink at path
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
@@ -407,6 +416,11 @@ ze_result_t SysfsAccess::canWrite(const std::string file) {
|
|||||||
return FsAccess::canWrite(fullPath(file));
|
return FsAccess::canWrite(fullPath(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ze_result_t SysfsAccess::getFileMode(const std::string file, ::mode_t &mode) {
|
||||||
|
// Prepend sysfs directory path and call the base getFileMode
|
||||||
|
return FsAccess::getFileMode(fullPath(file), mode);
|
||||||
|
}
|
||||||
|
|
||||||
ze_result_t SysfsAccess::read(const std::string file, std::string &val) {
|
ze_result_t SysfsAccess::read(const std::string file, std::string &val) {
|
||||||
// Prepend sysfs directory path and call the base read
|
// Prepend sysfs directory path and call the base read
|
||||||
return FsAccess::read(fullPath(file).c_str(), val);
|
return FsAccess::read(fullPath(file).c_str(), val);
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class FsAccess {
|
|||||||
|
|
||||||
virtual ze_result_t canRead(const std::string file);
|
virtual ze_result_t canRead(const std::string file);
|
||||||
virtual ze_result_t canWrite(const std::string file);
|
virtual ze_result_t canWrite(const std::string file);
|
||||||
|
virtual ze_result_t getFileMode(const std::string file, ::mode_t &mode);
|
||||||
|
|
||||||
virtual ze_result_t read(const std::string file, uint64_t &val);
|
virtual ze_result_t read(const std::string file, uint64_t &val);
|
||||||
virtual ze_result_t read(const std::string file, std::string &val);
|
virtual ze_result_t read(const std::string file, std::string &val);
|
||||||
@@ -89,6 +90,7 @@ class SysfsAccess : protected FsAccess {
|
|||||||
|
|
||||||
ze_result_t canRead(const std::string file) override;
|
ze_result_t canRead(const std::string file) override;
|
||||||
ze_result_t canWrite(const std::string file) override;
|
ze_result_t canWrite(const std::string file) override;
|
||||||
|
ze_result_t getFileMode(const std::string file, ::mode_t &mode) override;
|
||||||
|
|
||||||
ze_result_t read(const std::string file, std::string &val) override;
|
ze_result_t read(const std::string file, std::string &val) override;
|
||||||
ze_result_t read(const std::string file, int32_t &val) override;
|
ze_result_t read(const std::string file, int32_t &val) override;
|
||||||
|
|||||||
@@ -198,6 +198,15 @@ bool FsAccess::fileExists(const std::string file) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ze_result_t FsAccess::getFileMode(const std::string file, ::mode_t &mode) {
|
||||||
|
struct stat sb;
|
||||||
|
if (0 != stat(file.c_str(), &sb)) {
|
||||||
|
return getResult(errno);
|
||||||
|
}
|
||||||
|
mode = sb.st_mode;
|
||||||
|
return ZE_RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
ze_result_t FsAccess::readSymLink(const std::string path, std::string &val) {
|
ze_result_t FsAccess::readSymLink(const std::string path, std::string &val) {
|
||||||
// returns the value of symlink at path
|
// returns the value of symlink at path
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
@@ -406,6 +415,11 @@ ze_result_t SysfsAccess::canWrite(const std::string file) {
|
|||||||
return FsAccess::canWrite(fullPath(file));
|
return FsAccess::canWrite(fullPath(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ze_result_t SysfsAccess::getFileMode(const std::string file, ::mode_t &mode) {
|
||||||
|
// Prepend sysfs directory path and call the base getFileMode
|
||||||
|
return FsAccess::getFileMode(fullPath(file), mode);
|
||||||
|
}
|
||||||
|
|
||||||
ze_result_t SysfsAccess::read(const std::string file, std::string &val) {
|
ze_result_t SysfsAccess::read(const std::string file, std::string &val) {
|
||||||
// Prepend sysfs directory path and call the base read
|
// Prepend sysfs directory path and call the base read
|
||||||
return FsAccess::read(fullPath(file).c_str(), val);
|
return FsAccess::read(fullPath(file).c_str(), val);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class FsAccess {
|
|||||||
|
|
||||||
virtual ze_result_t canRead(const std::string file);
|
virtual ze_result_t canRead(const std::string file);
|
||||||
virtual ze_result_t canWrite(const std::string file);
|
virtual ze_result_t canWrite(const std::string file);
|
||||||
|
virtual ze_result_t getFileMode(const std::string file, ::mode_t &mode);
|
||||||
|
|
||||||
virtual ze_result_t read(const std::string file, uint64_t &val);
|
virtual ze_result_t read(const std::string file, uint64_t &val);
|
||||||
virtual ze_result_t read(const std::string file, std::string &val);
|
virtual ze_result_t read(const std::string file, std::string &val);
|
||||||
@@ -88,6 +89,7 @@ class SysfsAccess : protected FsAccess {
|
|||||||
|
|
||||||
ze_result_t canRead(const std::string file) override;
|
ze_result_t canRead(const std::string file) override;
|
||||||
ze_result_t canWrite(const std::string file) override;
|
ze_result_t canWrite(const std::string file) override;
|
||||||
|
ze_result_t getFileMode(const std::string file, ::mode_t &mode) override;
|
||||||
|
|
||||||
ze_result_t read(const std::string file, std::string &val) override;
|
ze_result_t read(const std::string file, std::string &val) override;
|
||||||
ze_result_t read(const std::string file, int32_t &val) override;
|
ze_result_t read(const std::string file, int32_t &val) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user