VOP_REMOVE(9)

πŸ’– VOP_REMOVE(9) πŸ’–

okay bestie, welcome to the Kernel Developer's Manual ✨ this one's about VOP_REMOVE and VOP_RMDIR β€” the vnode operations that yeet files and directories out of existence πŸ—‘οΈπŸ’…


🌸 NAME 🌸

VOP_REMOVE, VOP_RMDIR β€” remove a file or directory


✨ 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);

πŸ¦‹ DESCRIPTION πŸ¦‹

So these two entry points are the moment of truth: they remove files and directories, respectively. VOP_REMOVE handles the files, VOP_RMDIR handles the dirs, and honestly? iconic behaviour πŸ’–

The arguments are:

  • dvp β€” the vnode of the directory πŸ‘‘ (yes, the directory that's holding the thing you're deleting, she's the main character here)
  • vp β€” the vnode of the file to be removed 🌸
  • cnp β€” pathname information about the file, iykyk πŸŽ€

πŸ”’ LOCKS πŸ”’

Both dvp and vp should be locked on entry and remain locked on return. no cap. don't be out here unlocking mid-operation, that's not the vibe πŸ™ˆ

🌈 RETURN VALUES 🌈

Zero is returned on success πŸŽ‰ otherwise an error code is returned 😭


πŸ’€ ERRORS πŸ’€

  • [EPERM] β€” The file is immutable. she cannot be moved, she cannot be removed, she said no periodt βœ‹
  • [ENOTEMPTY] β€” An attempt was made to remove a directory which is not empty. like bestie you gotta empty her out first, you can't just rmdir a whole folder full of stuff 😭

πŸ‘€ SEE ALSO πŸ‘€

vnode(9), VOP_LOOKUP(9)


🫢 AUTHORS 🫢

This manual page was written by Doug Rabson. thank you king πŸ’œ


and that's the whole page bestie, slay ✨ this lil guide came from the Debian release, dated July 24, 1996 πŸŽ€ β€” yep, a vintage queen, and she's still out here handling VOP_REMOVE(9) business like it's nothing πŸ’…πŸŒΈ

πŸ“¦ where this page comes from