mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Modify directoryExists function of FsAccess class
Signed-off-by: Mayank Raghuwanshi <mayank.raghuwanshi@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
8810547d3a
commit
f592a82fea
@@ -278,12 +278,10 @@ bool FsAccess::isRootUser() {
|
||||
}
|
||||
|
||||
bool FsAccess::directoryExists(const std::string path) {
|
||||
::DIR *pDir = ::opendir(path.c_str());
|
||||
if (pDir != NULL) {
|
||||
::closedir(pDir);
|
||||
return true;
|
||||
if (accessSyscall(path.c_str(), F_OK)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Procfs Access
|
||||
@@ -564,7 +562,7 @@ bool SysfsAccess::fileExists(const std::string file) {
|
||||
}
|
||||
|
||||
bool SysfsAccess::directoryExists(const std::string path) {
|
||||
return FsAccess::fileExists(fullPath(path).c_str());
|
||||
return FsAccess::directoryExists(fullPath(path).c_str());
|
||||
}
|
||||
|
||||
bool SysfsAccess::isMyDeviceFile(const std::string dev) {
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/os_interface/linux/sys_calls.h"
|
||||
|
||||
#include "level_zero/ze_api.h"
|
||||
#include "level_zero/zet_api.h"
|
||||
|
||||
@@ -52,6 +54,7 @@ class FsAccess {
|
||||
|
||||
protected:
|
||||
FsAccess();
|
||||
decltype(&NEO::SysCalls::access) accessSyscall = NEO::SysCalls::access;
|
||||
};
|
||||
|
||||
class ProcfsAccess : private FsAccess {
|
||||
@@ -77,7 +80,7 @@ class ProcfsAccess : private FsAccess {
|
||||
static const std::string fdDir;
|
||||
};
|
||||
|
||||
class SysfsAccess : private FsAccess {
|
||||
class SysfsAccess : protected FsAccess {
|
||||
public:
|
||||
static SysfsAccess *create(const std::string file);
|
||||
SysfsAccess() = default;
|
||||
|
||||
Reference in New Issue
Block a user