Files
zvfs/src/hook/zvfs_hook_seek.h
2026-04-14 07:40:56 +00:00

34 lines
1.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef __ZVFS_HOOK_SEEK_H__
#define __ZVFS_HOOK_SEEK_H__
#include <sys/types.h>
#include <unistd.h>
/*
* lseek更新 daemon handle 上的共享 offset。
*
* 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__