CTOD(9)
β¨ NAME β¨
ctod β macros related to bytes, pages, and disk blocks. okay bestie, this is the ctod(9) page from the Kernel Developerβs Manual, and itβs lowkey your cheat sheet for all those conversions π
πΈ SYNOPSIS πΈ
#include <sys/param.h>
size
ctod(size x);
size
dtoc(size x);
size
ctob(size x);
size
btoc(size x);
size
dbtob(size x);
size
btodb(size x);
π¦ DESCRIPTION π¦
The ctod family of macros can be used to convert between bytes, pages (βclicksβ), and disk blocks. yes, pages are literally nicknamed βclicksβ here β iykyk β¨
The possible conversions are giving a whole map, bestie β no cap, every single one:
ctod()β from pages to disk blocksdtoc()β from disk blocks to pagesctob()β from pages to bytesbtoc()β from bytes to pagesdbtob()β from disk blocks to bytesbtodb()β from bytes to disk blocks
These are typical macros that may appear with different names in other operating systems. Examples include btop() and btopr() in Solaris. not me spotting a crossover episode π
π SEE ALSO π
param(3)β go peek at this too, bestie π«Ά
π HISTORY π
Some of these macros appeared in Version 7 AT&T UNIX. periodt β vintage icon behavior π
π CAVEATS π
bestie, hear me: the described macros make no assumptions about the type of the input parameter. A caller should ensure that neither integer overflow nor integer underflow are possible. fr fr, do your vibe check on the numbers before you send them π
π thatβs the whole page, bestie β Debian, April 8, 2011, CTOD(9) signing off! π
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2010 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms