2014-11-05 01:35:41 +01:00
|
|
|
#include "CryNode.h"
|
|
|
|
|
|
|
|
#include "CryDevice.h"
|
|
|
|
#include "CryErrnoException.h"
|
|
|
|
|
|
|
|
namespace cryfs {
|
|
|
|
|
|
|
|
CryNode::CryNode(CryDevice *device, const bf::path &path)
|
|
|
|
:_device(device), _path(path) {
|
|
|
|
}
|
|
|
|
|
|
|
|
CryNode::~CryNode() {
|
|
|
|
}
|
|
|
|
|
2014-11-10 22:42:17 +01:00
|
|
|
void CryNode::stat(struct ::stat *result) const {
|
2014-11-05 01:35:41 +01:00
|
|
|
int retval = ::lstat(base_path().c_str(), result);
|
|
|
|
CHECK_RETVAL(retval);
|
|
|
|
}
|
|
|
|
|
2014-11-10 23:47:41 +01:00
|
|
|
void CryNode::access(int mask) const {
|
|
|
|
int retval = ::access(base_path().c_str(), mask);
|
|
|
|
CHECK_RETVAL(retval);
|
|
|
|
}
|
|
|
|
|
2014-11-12 12:43:49 +01:00
|
|
|
void CryNode::rename(const bf::path &to) {
|
|
|
|
auto new_base_path = device()->RootDir() / to;
|
|
|
|
int retval = ::rename(base_path().c_str(), new_base_path.c_str());
|
|
|
|
CHECK_RETVAL(retval);
|
|
|
|
_path = to;
|
|
|
|
}
|
|
|
|
|
2014-11-05 01:35:41 +01:00
|
|
|
} /* namespace cryfs */
|