STRUCT W1_REG_NUM(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct w1_reg_num(9) β€” Kernel API Manual

okay so real talk bestie, this one's from the Kernel API Manual and it's about struct w1_reg_num β€” literally just a "broken out slave device id". that's the whole vibe. it's the 1-Wire slave's ID, all sliced up into neat little bitfields so you can actually get at the pieces. πŸŽ€


✨ NAME ✨

struct w1_reg_num β€” broken out slave device id πŸ¦‹


🌸 SYNOPSIS 🌸

struct w1_reg_num {
  #if defined(__LITTLE_ENDIAN_BITFIELD);
    __u64 family:8, id:48, crc:8;
  #elif defined(__BIG_ENDIAN_BITFIELD);
    __u64 crc:8, id:48, family:8;
  #else;
  #error Pleasefix<asm/byteorder.h>";"
  #endif;
 };

like, yes, there's a stray #error Pleasefix<asm/byteorder.h>";" in there β€” that is literally what the page says, so I'm not touching it. if your byteorder header isn't playing nice, the compiler is gonna yell at you. not my problem, bestie. πŸ’€


🧚 Members 🧚

so the members show up twice in the source, once per endianness branch, and honestly? iconic of it. here's the full list in order, no crumbs left behind:

  • family β€” identifies the type of device πŸ‘‘
  • id β€” along with family is the unique device id
  • crc β€” checksum of the other bytes
  • crc β€” checksum of the other bytes (yes, again β€” that's the big-endian branch, slay)
  • id β€” along with family is the unique device id
  • family β€” identifies the type of device
🫢 notice how little-endian puts family, id, crc and big-endian flips it to crc, id, family? same three things, different order. that's the whole point, no cap.

🌈 SEE ALSO 🌈

go read these next, i'm obsessed:

  • Kernel file ./include/linux/w1.h
  • struct w1_slave(9)
  • struct w1_bus_master(9)
  • enum w1_master_flags(9)
  • struct w1_master(9)
  • struct w1_family_ops(9)
  • struct w1_family(9)
  • module_w1_family(9)

and that's the whole page, bestie, we ate and left no crumbs πŸ“πŸ’… β€” this one lives over in ./include/linux and it's stamped October 2026, page struct w1_reg_num(9), periodt. ⭐

πŸ“¦ where this page comes from