fs_ftype_to_dtype(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… fs_ftype_to_dtype(9) β€” from the Kernel API Manual, bestie 🫢

Okay so picture this: you're deep in the kernel, you've got an on-disk file type just sitting there being all FT_*, and you need a dirent type DT_* instead. That's literally this function. It's the translator of the filesystem world and it ate, no cap. ✨


🌸 NAME 🌸

fs_ftype_to_dtype β€” the glow-up where an fs on-disk file type becomes a dirent type. πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

unsigned char fs_ftype_to_dtype (unsigned int filetype );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • filetype β€” the on-disk file type you want converted. That's the one. That's the input. πŸ‘‘

✨ DESCRIPTION ✨

So what does it do, you ask? Obsessed that you asked. πŸ₯° This function converts the on-disk file type value (the FT_* girlies) into the directory entry type (the DT_* girlies). It's giving translator, it's giving middle management, it's giving "I speak both languages fluently". 🌈

Basically FT_* in, DT_* out. Simple. Iconic. Periodt. πŸ’…


🧚 CONTEXT 🧚

Any context. Literally any. Call it from anywhere, she doesn't care, she's flexible like that. πŸ’œ


πŸ”₯ RETURN πŸ”₯

Here's the whole menu of what you might get back, and every single one is on the list, no skipping, we don't do that here 🫢:

  • DT_UNKNOWN β€” unknown type, the mystery era πŸ™ˆ
  • DT_FIFO β€” FIFO
  • DT_CHR β€” character device
  • DT_DIR β€” directory πŸ“
  • DT_BLK β€” block device
  • DT_REG β€” regular file
  • DT_LNK β€” symbolic link πŸ”—
  • DT_SOCK β€” local-domain socket 🧦

⭐ SEE ALSO ⭐

Go be nosy, bestie, the whole friend group is right here:


πŸ’€ Real talk for a sec: keep the FT_* β†’ DT_* mapping straight in your head, because that's the entire personality of this function and there is no plan B. iykyk.

That's the whole page, bestie! 🌈 Brought to you straight outta ./fs πŸ’– and dated October 2026 πŸŽ€ β€” go forth and convert those file types, you absolute main character. πŸ‘‘βœ¨

πŸ“¦ where this page comes from