VN_ISDISK(9)

πŸ’– VN_ISDISK(9) πŸ’–

okay so bestie, welcome to the Kernel Developer's Manual β€” section 9, kernel-adjacent girlies only 🫢. today we're learning about a lil function called vn_isdisk, and no cap, it's literally just asking "hey… is this thing a disk?" πŸ”₯


✨ NAME ✨

vn_isdisk β€” the vibe check that tells you if a vnode is actually a disk πŸ’…


🌸 SYNOPSIS 🌸

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

int
vn_isdisk(struct vnode *vp, int *errp);

like, include both headers, don't skip the second one, it's giving "necessary" πŸ’€


πŸ¦‹ DESCRIPTION πŸ¦‹

so vn_isdisk() checks whether vp represents a disk. that's the whole job. main character energy, honestly πŸ‘‘

but here's the tea β€” for vp to actually count as a disk, all three of these gotta be true, no exceptions:

  1. it has to be a character device
  2. v_rdev has to be valid
  3. the cdevsw entry's flags have to have D_DISK set

miss one and it's not a disk, periodt. πŸ™ˆ

the arguments, bestie πŸŽ€

  • vp β€” the vnode you're checking. the one on trial, fr fr.
  • errp β€” an integer pointer, and if the call fails, that's where the error number gets stored. it's the lil receipt of what went wrong 😭

⭐ RETURN VALUES ⭐

  • if the vnode is a disk β†’ 1 is returned. slay πŸ’…βœ¨
  • otherwise β†’ 0 is returned, and errp will contain the error number.

that's it. binary. iconic.


πŸ‘‘ AUTHORS πŸ‘‘

this manual page was written by Chad David <davidc@acns.ab.ca>. king behavior, we love a credited author 🫢


ok that's the whole page, nothing skipped, every flag and fact intact πŸ’œ go forth and check ur disks, bestie.

this came to you from the Debian edition of the manual, dated July 9, 2001 β€” yes she's vintage, she's still serving 🌈✨ bye pookie πŸŽ€

πŸ“¦ where this page comes from