VOP_ALLOCATE(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

okay bestie, welcome to the VOP_ALLOCATE(9) glow-up πŸ’… this page is from the Kernel Developer's Manual, section 9, and it's giving β€œallocate storage for a file” energy. no cap, we're gonna go through every lil detail together. 🫢

✨ NAME ✨

VOP_ALLOCATE β€” allocate storage for a file πŸ’Ύβœ¨

🌸 SYNOPSIS 🌸

       #include <sys/param.h>
       #include <sys/vnode.h>

       int
       VOP_ALLOCATE(struct vnode *vp, off_t *offset, off_t *len, int ioflag,
           struct ucred *cred);

πŸ’– DESCRIPTION πŸ’–

This call allocates storage for a range of offsets in a file. It is used to implement the posix_fallocate(2) system call. literally the whole vibe is reserving space in a file, and the file's contents are not changed. πŸŽ€

Its arguments are:

  • vp β€” The vnode of the file. the main character vnode, honestly. πŸ‘‘
  • offset β€” The start of the range to allocate storage for in the file. where the storage party begins. πŸ“
  • len β€” The length of the range to allocate storage for in the file. how long the storage party goes. πŸ“
  • ioflag β€” Directives and hints to be given to the file system. lil instructions for the fs bestie. 🫑
  • cred β€” The credentials of the caller. who's asking, basically. πŸͺͺ

The offset and len arguments are updated to reflect the portion of the range that still needs to be allocated on return. A partial allocation is considered a successful operation. The file's contents are not changed. periodt. πŸ’…

πŸ”’ LOCKS πŸ”’

The file should be exclusively locked on entry and will still be locked on exit. no sneaky lock drops here, bestie. πŸ”

🫢 RETURN VALUES 🫢

Zero is returned if the call is successful, otherwise an appropriate error code is returned. slay if it's zero; if not, bestie check the error. 😭

πŸ’€ ERRORS πŸ’€

  • [EFBIG] β€” An attempt was made to write a file that exceeds the process's file size limit or the maximum file size. πŸ’€
  • [ENOSPC] β€” The file system is full. no room, no vibes. 😭
  • [EPERM] β€” An append-only flag is set on the file, but the caller is attempting to write before the current end of file. permission said absolutely not. πŸ™ˆ

🌈 SEE ALSO 🌈

go read these next, iykyk. πŸ“šβœ¨

πŸ’– that's the whole page, bestie. it's from Debian, dated November 8, 2021, and it's the VOP_ALLOCATE(9) manual page. mwah πŸ’‹

πŸ“¦ where this page comes from