VOP_BMAP(9)
π VOP_BMAP β the manual page, but make it make sense π
okay bestie, so this is VOP_BMAP(9) from the Kernel Developer's Manual, and it's literally the glow-up of logical-to-physical block number conversion. iykyk. let's get into it β¨
β¨ NAME β¨
VOP_BMAP β Logical to physical block number conversion π¦
πΈ SYNOPSIS πΈ
no cap, this is exactly how you call it:
#include <sys/param.h>
#include <sys/vnode.h>
int
VOP_BMAP(struct vnode *vp, daddr_t bn, struct bufobj **bop,
daddr_t *bnp, int *runp, int *runb);
π DESCRIPTION π
so this vnode call is the moment where you find out the physical block number of the file system's underlying device where a given logical block of a file is actually stored. it's giving "where does this data LIVE, actually". main character energy fr fr.
and here's every single argument, because we don't gatekeep:
vpβ the vnode of the file. your file's whole identity, honestly πbnβ the logical block number within the file identified byvp. the vibe-check location you're asking about.bopβ return storage for the buffer object associated with the file system's underlying device. like, the device's bufobj goes here πbnpβ return storage for the physical block number. the actual answer, periodt.runpβ return storage for the number of succeeding logical blocks that may be efficiently read at the same time as the requested block. usually this is the number of logical blocks whose physical blocks are contiguously allocated. BUT β and this is important β a file system is free to define "efficient" as it sees fit. so it's a vibe, not a promise πrunbβ likerunpbut for preceding rather than succeeding blocks. same energy, opposite direction π¦
and here's the tea: any of the return arguments may be NULL to indicate that the caller does not care about that information. not me being allowed to just... not care. iconic.
π LOCKS π
the vnode will be locked on entry and should remain locked on return. do not let go of the lock bestie, it's holding the whole situation together π
β RETURN VALUES β
zero is returned on success, otherwise an error code is returned. that's it, that's the whole thing. zero = slay, anything else = something went wrong π
π SEE ALSO π
(and that's the whole list, no crumbs left behind π)
π HISTORY π
a bmap() function first appeared in 4.2BSD. a true elder, we respect the ancestry π
π«Ά AUTHORS π«Ά
this manual page was written by Alan Somers. thank you for your service, king π
and that's the whole page, bestie β brought to you by Debian, dated June 19, 2019. go forth and convert those blocks logically AND physically. mwah π β¨π
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- π the page's license: BSD-2-Clause-FreeBSD
- Copyright (c) 2019 The FreeBSD Foundation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms