package system // DFUsedPercent is the used percentage the way `df` prints it: used / (used + available). The blocks reserved for root // (5 % on ext4 by default) are in neither term, so a full disk reads 100 % here. Every disk percent the box shows or // alarms on is computed by this one function (R-889, operator ruling 2026-10-06 — `09` §3 decision 138): until then // the box divided by the whole filesystem and read ~5 points LOW on a full disk (61.8 of 68.7 GB = 90 % where `df` // said 95 %). `df` rounds up; this does not, so the two agree within one point. Units only need to match. // Pinned by TestDFUsedPercent_MatchesDFOnRealNumbers and TestR889_EveryDiskPercentIsTheDFOne. func DFUsedPercent(used, avail float64) float64 { if used <= 0 && avail <= 0 { return 0 } if used < 0 { used = 0 } if avail < 0 { avail = 0 } return used / (used + avail) * 100 }