Loading examples/gfind/gkfs_lib_example.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,24 @@ main(int argc, char** argv) { read_file("/test.tmp"); write_file("/secondfile.tmp"); auto f_list = gkfs::syscall::gkfs_get_file_list("/"); for(auto f : f_list) { cout << "File: " << f << endl; struct stat buf; memset(&buf, 0, sizeof(struct stat)); gkfs::syscall::gkfs_stat("/" + f, &buf, true); cout << "Size: " << buf.st_size << " Mode: " << buf.st_mode << endl; cout << "Atime: " << buf.st_atime << " Mtime: " << buf.st_mtime << " Ctime: " << buf.st_ctime << endl << " ****** " << endl; } res = gkfs_end(); cout << "End result " << res << endl; Loading include/client/gkfs_functions.hpp +3 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,9 @@ gkfs_rmdir(const std::string& path); int gkfs_close(unsigned int fd); std::vector<std::string> gkfs_get_file_list(const std::string& path); #ifdef HAS_RENAME int gkfs_rename(const std::string& old_path, const std::string& new_path); Loading include/client/user_functions.hpp +5 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,11 @@ gkfs_pread_ws(int fd, void* buf, size_t count, off64_t offset); int gkfs_stat(const std::string& path, struct stat* buf, bool follow_links = true); int gkfs_remove(const std::string& path); std::vector<std::string> gkfs_get_file_list(const std::string& path); } // namespace gkfs::syscall Loading src/client/gkfs_functions.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -1504,6 +1504,28 @@ gkfs_readlink(const std::string& path, char* buf, int bufsize) { #endif #endif std::vector<std::string> gkfs_get_file_list(const std::string& path) { auto ret = gkfs::rpc::forward_get_dirents(path); auto err = ret.first; if(err) { errno = err; return {}; } auto open_dir = ret.second; std::vector<std::string> file_list; unsigned int pos = 0; while(pos < open_dir->size()) { auto de = open_dir->getdent(pos++); file_list.push_back(de.name()); } return file_list; } } // namespace gkfs::syscall Loading Loading
examples/gfind/gkfs_lib_example.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,24 @@ main(int argc, char** argv) { read_file("/test.tmp"); write_file("/secondfile.tmp"); auto f_list = gkfs::syscall::gkfs_get_file_list("/"); for(auto f : f_list) { cout << "File: " << f << endl; struct stat buf; memset(&buf, 0, sizeof(struct stat)); gkfs::syscall::gkfs_stat("/" + f, &buf, true); cout << "Size: " << buf.st_size << " Mode: " << buf.st_mode << endl; cout << "Atime: " << buf.st_atime << " Mtime: " << buf.st_mtime << " Ctime: " << buf.st_ctime << endl << " ****** " << endl; } res = gkfs_end(); cout << "End result " << res << endl; Loading
include/client/gkfs_functions.hpp +3 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,9 @@ gkfs_rmdir(const std::string& path); int gkfs_close(unsigned int fd); std::vector<std::string> gkfs_get_file_list(const std::string& path); #ifdef HAS_RENAME int gkfs_rename(const std::string& old_path, const std::string& new_path); Loading
include/client/user_functions.hpp +5 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,11 @@ gkfs_pread_ws(int fd, void* buf, size_t count, off64_t offset); int gkfs_stat(const std::string& path, struct stat* buf, bool follow_links = true); int gkfs_remove(const std::string& path); std::vector<std::string> gkfs_get_file_list(const std::string& path); } // namespace gkfs::syscall Loading
src/client/gkfs_functions.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -1504,6 +1504,28 @@ gkfs_readlink(const std::string& path, char* buf, int bufsize) { #endif #endif std::vector<std::string> gkfs_get_file_list(const std::string& path) { auto ret = gkfs::rpc::forward_get_dirents(path); auto err = ret.first; if(err) { errno = err; return {}; } auto open_dir = ret.second; std::vector<std::string> file_list; unsigned int pos = 0; while(pos < open_dir->size()) { auto de = open_dir->getdent(pos++); file_list.push_back(de.name()); } return file_list; } } // namespace gkfs::syscall Loading