Skip to main content

classify_magic

Function classify_magic 

Source
pub fn classify_magic(f_type: u64) -> FilesystemKind
Expand description

What: Map the f_type of a statfs answer to a kind. u64 is the widest unsigned integer; siblings u32 and i64 are what the C field is on some targets. Why: The C field is a signed word on some targets and an unsigned one on others, so only its low 32 bits are compared with the magic numbers, which are all 32-bit values.

In TS you’d write (pseudocode):

function classifyMagic(fType: bigint): FilesystemKind { const low = fType & 0xffffffffn; ... }