rmdir
This commit is contained in:
parent
afd4066ef7
commit
8561d90de0
@ -100,12 +100,13 @@ int CryFuse::unlink(const path &path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO
|
|
||||||
int CryFuse::rmdir(const path &path) {
|
int CryFuse::rmdir(const path &path) {
|
||||||
//printf("rmdir(%s)\n", path.c_str());
|
try {
|
||||||
auto real_path = _device->RootDir() / path;
|
_device->rmdir(path);
|
||||||
int retstat = ::rmdir(real_path.c_str());
|
return 0;
|
||||||
return errcode_map(retstat);
|
} catch(cryfs::CryErrnoException &e) {
|
||||||
|
return -e.getErrno();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
@ -112,6 +112,11 @@ void CryDevice::mkdir(const bf::path &path, mode_t mode) {
|
|||||||
dir->createDir(path.filename().native(), mode);
|
dir->createDir(path.filename().native(), mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CryDevice::rmdir(const bf::path &path) {
|
||||||
|
auto dir = LoadDir(path);
|
||||||
|
dir->rmdir();
|
||||||
|
}
|
||||||
|
|
||||||
void CryDevice::unlink(const bf::path &path) {
|
void CryDevice::unlink(const bf::path &path) {
|
||||||
auto file = LoadFile(path);
|
auto file = LoadFile(path);
|
||||||
file->unlink();
|
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 rmdir(const bf::path &path);
|
||||||
void unlink(const bf::path &path);
|
void unlink(const bf::path &path);
|
||||||
|
|
||||||
const bf::path &RootDir() const;
|
const bf::path &RootDir() const;
|
||||||
|
@ -39,4 +39,9 @@ unique_ptr<CryDir> CryDir::createDir(const string &name, mode_t mode) {
|
|||||||
return make_unique<CryDir>(device(), path() / name);
|
return make_unique<CryDir>(device(), path() / name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CryDir::rmdir() {
|
||||||
|
int retval = ::rmdir(base_path().c_str());
|
||||||
|
CHECK_RETVAL(retval);
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace cryfs */
|
} /* namespace cryfs */
|
||||||
|
@ -18,6 +18,7 @@ public:
|
|||||||
|
|
||||||
std::unique_ptr<CryFile> createFile(const std::string &name, mode_t mode);
|
std::unique_ptr<CryFile> createFile(const std::string &name, mode_t mode);
|
||||||
std::unique_ptr<CryDir> createDir(const std::string &name, mode_t mode);
|
std::unique_ptr<CryDir> createDir(const std::string &name, mode_t mode);
|
||||||
|
void rmdir();
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(CryDir);
|
DISALLOW_COPY_AND_ASSIGN(CryDir);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user