VOP_COPY_FILE_RANGE(9)
β¨ VOP_COPY_FILE_RANGE(9) β¨
okay so welcome to the manual page for VOP_COPY_FILE_RANGE(9) from the Kernel Developer's Manual β grab a lil snack bestie, we're getting into it π«Ά
π NAME π
VOP_COPY_FILE_RANGE β copy a byte range within a file or from one file to another in a single file system or between multiple file systems π«
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/vnode.h>
int
VOP_COPY_FILE_RANGE(struct vnode *invp, off_t *inoff,
struct vnode *outvp, off_t *outoff, size_t *len, unsigned int flags,
struct ucred *incred, struct ucred *outcred,
struct thread *fsize_td);
π¦ DESCRIPTION π¦
so this entry point literally copies a byte range from one regular file to another, or within one file in a single file system. <pink>invp</pink> and <pink>outvp</pink> can refer to the same file β and for this case, the byte ranges defined by *inoff, *outoff and *len will not overlap, okay? no chaos π
the arguments are:
invpβ the vnode of the input file, aka where the bytes are coming from πinoffβ a pointer to the file offset for the input fileoutvpβ the vnode of the output file, aka where the bytes are going πoutoffβ a pointer to the file offset for the output filelenβ a pointer to the byte count for the copyflagsβ flags, and bestie they should be set to0for now π«Άincredβ the credentials used to readinvpoutcredβ the credentials used to writeoutvpfsize_tdβ the thread pointer to be passed tovn_rlimit_fsize(). this will beNULLfor a server thread without limits, such as for the NFS server, orcurthreadotherwise β¨
on entry and on return, the <pink>inoff</pink> and <pink>outoff</pink> arguments point to the locations of the file offsets. these file offsets should be updated by the number of bytes copied. the <pink>len</pink> argument points to the location that stores the number of bytes to be copied. upon a successful return <pink>len</pink> will be updated to the number of bytes actually copied β normally this will be the number of bytes requested to be copied, however a copy of fewer bytes than requested is permitted. this does not necessarily indicate that the copy reached EOF on the input file. however, if the value pointed to by the <pink>len</pink> argument is zero upon a successful return, it indicates that the offset pointed to by <pink>inoff</pink> is at or beyond EOF on the input file. iykyk π
π LOCKS π
heads up: the vnode are unlocked on entry and must be unlocked on return β no cap. also the byte ranges for both <pink>invp</pink> and <pink>outvp</pink> should be range locked when this call is done. periodt π
β RETURN VALUES β
zero is returned on success β slay π otherwise an error code is returned π
π ERRORS π
[EFBIG]β if the copy exceeds the process's file size limit or the maximum file size for the file systeminvpandoutvpreside on[EINTR]β a signal interrupted theVOPcall before it could be completed[EIO]β an I/O error occurred while reading/writing the files[EINTEGRITY]β corrupted data was detected while reading/writing the files[ENOSPC]β the file system is full
π SEE ALSO π
vn_rdwr(9), vnode(9)
and that's the whole vibe!! this iconic page is brought to you by Debian, dated March 30, 2020 β gonna go touch some grass now, bestie π§π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- π the page's license: BSD-2-Clause
- Copyright (c) 2019 Rick Macklem
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms