VOP_REMOVE(9)

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

πŸ’… VOP_REMOVE(9) β€” the Kernel Developer's Manual, bestie edition πŸŽ€

okay so welcome to the Kernel Developer's Manual, specifically the page about yeeting files and directories out of existence. this is VOP_REMOVE, and its partner in crime VOP_RMDIR. they're literally the "delete" buttons of the vnode world. no cap.


✨ NAME ✨

VOP_REMOVE, VOP_RMDIR β€” remove a file or directory πŸ—‘οΈβœ¨

like, one of them removes a file, the other removes a directory, and honestly? iconic behavior.


🌸 SYNOPSIS 🌸

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

int
VOP_REMOVE(struct vnode *dvp, struct vnode *vp,
    struct componentname *cnp);

int
VOP_RMDIR(struct vnode *dvp, struct vnode *vp,
    struct componentname *cnp);

these are the exact signatures, don't come for me, copy them character for character bestie πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so these entry points remove files and directories respectively. that's it. that's the vibe. VOP_REMOVE handles files, VOP_RMDIR handles directories, and they both take the same three arguments.

the arguments are:

  • dvp β€” the vnode of the directory πŸ‘‘ (the parent, the one holding the door open)
  • vp β€” the vnode of the file to be removed 🌸 (the one getting evicted)
  • cnp β€” pathname information about the file πŸŽ€ (all the name-y details)

πŸ”’ LOCKS πŸ”’

both dvp and vp should be locked on entry and remain locked on return. like, they walk in locked, they walk out locked. no unlocking on the way through, periodt. πŸ”


⭐ RETURN VALUES ⭐

zero is returned on success πŸ₯³ otherwise an error code is returned 😭 β€” that's the whole deal.


πŸ’€ ERRORS πŸ’€

  • [EPERM] β€” the file is immutable. it said "not today", bestie, it cannot be changed or removed πŸ™ˆ
  • [ENOTEMPTY] β€” an attempt was made to remove a directory which is not empty. you can't just rmdir a folder full of stuff, the folder is giving "I have attachments" energy πŸ’…

🌈 SEE ALSO 🌈

go read those too, iykyk 🫢


πŸ‘‘ AUTHORS πŸ‘‘

this manual page was written by Doug Rabson. thank you Doug, you ate πŸ”₯


and that's the whole page, babes β€” this little beauty came from the Debian crowd and it's dated July 24, 1996, which is honestly vintage in the most iconic way πŸŽ€βœ¨πŸ’œ

πŸ“¦ where this page comes from