Loading src/client/fuse/fuse_client.cpp +13 −1 Original line number Diff line number Diff line Loading @@ -251,6 +251,18 @@ open_handler(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) { fuse_reply_open(req, fi); } static void lseek_handler(fuse_req_t req, fuse_ino_t ino, off_t off, int whence, struct fuse_file_info* fi) { fuse_log(FUSE_LOG_DEBUG, "lseek handler \n"); int lc = gkfs::syscall::gkfs_lseek(fi->fh, off, whence); if(lc < 0) { fuse_reply_err(req, 1); return; } fuse_reply_lseek(req, lc); } static void read_handler(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info* fi) { Loading Loading @@ -657,6 +669,7 @@ init_ll_ops(fuse_lowlevel_ops* ops) { ops->release = release_handler; // ops->fsync // ops->write_buf ops->lseek = lseek_handler; // xattr // ops->setxattr Loading Loading @@ -695,7 +708,6 @@ init_ll_ops(fuse_lowlevel_ops* ops) { // ops->retrive_reply // ops->fallocate // ops->copy_file_range // ops->lseek // ops->tmpfile // ops->statx } Loading src/client/gkfs_functions.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -809,7 +809,7 @@ gkfs_statvfs(struct statvfs* buf) { * @param fd * @param offset * @param whence * @return 0 on success, -1 on failure * @return position on success, -1 on failure */ off_t gkfs_lseek(unsigned int fd, off_t offset, unsigned int whence) { Loading @@ -822,7 +822,7 @@ gkfs_lseek(unsigned int fd, off_t offset, unsigned int whence) { * @param gkfs_fd * @param offset * @param whence * @return 0 on success, -1 on failure * @return position on success, -1 on failure */ off_t gkfs_lseek(shared_ptr<gkfs::filemap::OpenFile> gkfs_fd, off_t offset, Loading tests/integration/fuse/test_basic_operations.py +13 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ from harness.logger import logger nonexisting = "nonexisting" # somehow are multiple test causing an error in the fuse client... def test_read(gkfs_daemon, fuse_client): file = gkfs_daemon.mountdir / "file" Loading @@ -66,3 +67,15 @@ def test_read(gkfs_daemon, fuse_client): sh.rmdir("foo") sh.rm(str(file2)) assert sh.ls(fuse_client.mountdir) == "dir file\n" # lseek test path = gkfs_daemon.mountdir / "lseek_file" with open(path, "wb") as f: f.write(b"HelloWorld") # 10 bytes fd = os.open(path, os.O_RDONLY) pos = os.lseek(fd, 5, os.SEEK_SET) # absolute seek assert pos == 5 data = os.read(fd, 5) assert data == b"World" os.close(fd) os.remove(path) Loading
src/client/fuse/fuse_client.cpp +13 −1 Original line number Diff line number Diff line Loading @@ -251,6 +251,18 @@ open_handler(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) { fuse_reply_open(req, fi); } static void lseek_handler(fuse_req_t req, fuse_ino_t ino, off_t off, int whence, struct fuse_file_info* fi) { fuse_log(FUSE_LOG_DEBUG, "lseek handler \n"); int lc = gkfs::syscall::gkfs_lseek(fi->fh, off, whence); if(lc < 0) { fuse_reply_err(req, 1); return; } fuse_reply_lseek(req, lc); } static void read_handler(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info* fi) { Loading Loading @@ -657,6 +669,7 @@ init_ll_ops(fuse_lowlevel_ops* ops) { ops->release = release_handler; // ops->fsync // ops->write_buf ops->lseek = lseek_handler; // xattr // ops->setxattr Loading Loading @@ -695,7 +708,6 @@ init_ll_ops(fuse_lowlevel_ops* ops) { // ops->retrive_reply // ops->fallocate // ops->copy_file_range // ops->lseek // ops->tmpfile // ops->statx } Loading
src/client/gkfs_functions.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -809,7 +809,7 @@ gkfs_statvfs(struct statvfs* buf) { * @param fd * @param offset * @param whence * @return 0 on success, -1 on failure * @return position on success, -1 on failure */ off_t gkfs_lseek(unsigned int fd, off_t offset, unsigned int whence) { Loading @@ -822,7 +822,7 @@ gkfs_lseek(unsigned int fd, off_t offset, unsigned int whence) { * @param gkfs_fd * @param offset * @param whence * @return 0 on success, -1 on failure * @return position on success, -1 on failure */ off_t gkfs_lseek(shared_ptr<gkfs::filemap::OpenFile> gkfs_fd, off_t offset, Loading
tests/integration/fuse/test_basic_operations.py +13 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ from harness.logger import logger nonexisting = "nonexisting" # somehow are multiple test causing an error in the fuse client... def test_read(gkfs_daemon, fuse_client): file = gkfs_daemon.mountdir / "file" Loading @@ -66,3 +67,15 @@ def test_read(gkfs_daemon, fuse_client): sh.rmdir("foo") sh.rm(str(file2)) assert sh.ls(fuse_client.mountdir) == "dir file\n" # lseek test path = gkfs_daemon.mountdir / "lseek_file" with open(path, "wb") as f: f.write(b"HelloWorld") # 10 bytes fd = os.open(path, os.O_RDONLY) pos = os.lseek(fd, 5, os.SEEK_SET) # absolute seek assert pos == 5 data = os.read(fd, 5) assert data == b"World" os.close(fd) os.remove(path)