STRUCT W1_REG_NUM(9)
π 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 withfamilyis the unique device idcrcβ checksum of the other bytescrcβ checksum of the other bytes (yes, again β that's the big-endian branch, slay)idβ along withfamilyis the unique device idfamilyβ identifies the type of device
π«Ά notice how little-endian putsfamily,id,crcand big-endian flips it tocrc,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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms