This commit is contained in:
2026-03-09 07:53:06 +00:00
parent 975afaf3f0
commit 470412a1c2
82 changed files with 7094 additions and 5234 deletions

33
src/hook/zvfs_hook_seek.h Normal file
View File

@@ -0,0 +1,33 @@
#ifndef __ZVFS_HOOK_SEEK_H__
#define __ZVFS_HOOK_SEEK_H__
#include <sys/types.h>
#include <unistd.h>
/*
* lseek更新 of->offset非 O_APPEND fd
*
* truncate / ftruncate
* 更新 inode->logical_size同步 st_sizeftruncate 到真实 fd
* 若 new_size < old_size截断对 blob 的写入范围blob_resize
*
* fallocate / posix_fallocate
* zvfs 无"空洞"概念blob 按需增长。
* 对 zvfs fdfallocate 只更新 logical_size预占逻辑空间
* 不调用 blob_resize避免提前分配 SPDK cluster
* FALLOC_FL_KEEP_SIZE 模式:不改 logical_size直接返回 0。
* FALLOC_FL_PUNCH_HOLE暂不支持返回 ENOTSUP。
*/
off_t lseek(int fd, off_t offset, int whence);
off_t lseek64(int fd, off_t offset, int whence);
int truncate(const char *path, off_t length);
int truncate64(const char *path, off_t length);
int ftruncate(int fd, off_t length);
int ftruncate64(int fd, off_t length);
int fallocate(int fd, int mode, off_t offset, off_t len);
int posix_fallocate(int fd, off_t offset, off_t len);
#endif // __ZVFS_HOOK_SEEK_H__