Simplify readdir
This commit is contained in:
parent
d8d35ae462
commit
9af5f72665
@ -260,21 +260,19 @@ int CryFuse::fsync(const path &path, int datasync, fuse_file_info *fileinfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int CryFuse::opendir(const path &path, fuse_file_info *fileinfo) {
|
int CryFuse::opendir(const path &path, fuse_file_info *fileinfo) {
|
||||||
|
UNUSED(path);
|
||||||
|
UNUSED(fileinfo);
|
||||||
//printf("opendir(%s, _)\n", path.c_str());
|
//printf("opendir(%s, _)\n", path.c_str());
|
||||||
try {
|
//We don't need opendir, because readdir works directly on the path
|
||||||
fileinfo->fh = _device->openDir(path);
|
|
||||||
return 0;
|
return 0;
|
||||||
} catch(CryErrnoException &e) {
|
|
||||||
return -e.getErrno();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CryFuse::readdir(const path &path, void *buf, fuse_fill_dir_t filler, off_t offset, fuse_file_info *fileinfo) {
|
int CryFuse::readdir(const path &path, void *buf, fuse_fill_dir_t filler, off_t offset, fuse_file_info *fileinfo) {
|
||||||
UNUSED(path);
|
UNUSED(fileinfo);
|
||||||
//printf("readdir(%s, _, _, %zu, _)\n", path.c_str(), offset);
|
//printf("readdir(%s, _, _, %zu, _)\n", path.c_str(), offset);
|
||||||
UNUSED(offset);
|
UNUSED(offset);
|
||||||
try {
|
try {
|
||||||
auto entries = _device->readDir(fileinfo->fh);
|
auto entries = _device->readDir(path);
|
||||||
for (const auto &entry : *entries) {
|
for (const auto &entry : *entries) {
|
||||||
//We could pass file metadata to filler() in its third parameter,
|
//We could pass file metadata to filler() in its third parameter,
|
||||||
//but it doesn't help performance since fuse seems to ignore it.
|
//but it doesn't help performance since fuse seems to ignore it.
|
||||||
@ -290,14 +288,11 @@ int CryFuse::readdir(const path &path, void *buf, fuse_fill_dir_t filler, off_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
int CryFuse::releasedir(const path &path, fuse_file_info *fileinfo) {
|
int CryFuse::releasedir(const path &path, fuse_file_info *fileinfo) {
|
||||||
//printf("releasedir(%s, _)\n", path.c_str());
|
|
||||||
UNUSED(path);
|
UNUSED(path);
|
||||||
try {
|
UNUSED(fileinfo);
|
||||||
_device->closeDir(fileinfo->fh);
|
//printf("releasedir(%s, _)\n", path.c_str());
|
||||||
|
//We don't need releasedir, because readdir works directly on the path
|
||||||
return 0;
|
return 0;
|
||||||
} catch (CryErrnoException &e) {
|
|
||||||
return -e.getErrno();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
Loading…
x
Reference in New Issue
Block a user