unlink
This commit is contained in:
parent
c112def985
commit
afd4066ef7
@ -90,12 +90,14 @@ int CryFuse::mkdir(const path &path, mode_t mode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO
|
|
||||||
int CryFuse::unlink(const path &path) {
|
int CryFuse::unlink(const path &path) {
|
||||||
//printf("unlink(%s)\n", path.c_str());
|
//printf("unlink(%s)\n", path.c_str());
|
||||||
auto real_path = _device->RootDir() / path;
|
try {
|
||||||
int retstat = ::unlink(real_path.c_str());
|
_device->unlink(path);
|
||||||
return errcode_map(retstat);
|
return 0;
|
||||||
|
} catch(cryfs::CryErrnoException &e) {
|
||||||
|
return -e.getErrno();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
@ -111,3 +111,8 @@ void CryDevice::mkdir(const bf::path &path, mode_t mode) {
|
|||||||
auto dir = LoadDir(path.parent_path());
|
auto dir = LoadDir(path.parent_path());
|
||||||
dir->createDir(path.filename().native(), mode);
|
dir->createDir(path.filename().native(), mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CryDevice::unlink(const bf::path &path) {
|
||||||
|
auto file = LoadFile(path);
|
||||||
|
file->unlink();
|
||||||
|
}
|
||||||
|
@ -35,6 +35,7 @@ public:
|
|||||||
void access(const bf::path &path, int mask);
|
void access(const bf::path &path, int mask);
|
||||||
int createAndOpenFile(const bf::path &path, mode_t mode);
|
int createAndOpenFile(const bf::path &path, mode_t mode);
|
||||||
void mkdir(const bf::path &path, mode_t mode);
|
void mkdir(const bf::path &path, mode_t mode);
|
||||||
|
void unlink(const bf::path &path);
|
||||||
|
|
||||||
const bf::path &RootDir() const;
|
const bf::path &RootDir() const;
|
||||||
private:
|
private:
|
||||||
|
@ -25,4 +25,9 @@ void CryFile::truncate(off_t size) const {
|
|||||||
CHECK_RETVAL(retval);
|
CHECK_RETVAL(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CryFile::unlink() {
|
||||||
|
int retval = ::unlink(base_path().c_str());
|
||||||
|
CHECK_RETVAL(retval);
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace cryfs */
|
} /* namespace cryfs */
|
||||||
|
@ -18,6 +18,7 @@ public:
|
|||||||
|
|
||||||
std::unique_ptr<CryOpenFile> open(int flags) const;
|
std::unique_ptr<CryOpenFile> open(int flags) const;
|
||||||
void truncate(off_t size) const;
|
void truncate(off_t size) const;
|
||||||
|
void unlink();
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(CryFile);
|
DISALLOW_COPY_AND_ASSIGN(CryFile);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user