STRUCT W1_SLAVE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ STRUCT W1_SLAVE(9) β€” the manual, but make it cute πŸ¦‹

okay so bestie, we're in the Kernel API Manual today and we're talking about struct w1_slave(9). it's a lil kernel struct, it's giving "one (1) whole entire slave device on the bus" energy. iconic. let's get into it πŸ’…


✨ NAME ✨

struct w1_slave β€” literally just holds a single slave device on the bus. that's her job. that's what she does. πŸŽ€


🌸 SYNOPSIS 🌸

struct w1_slave {
    struct module           *owner;
    unsigned char           name[W1_MAXNAMELEN];
    struct list_head        w1_slave_entry;
    struct w1_reg_num       reg_num;
    atomic_t refcnt;
    int ttl;
    unsigned long           flags;
    struct w1_master        *master;
    struct w1_family        *family;
    void *family_data;
    struct device           dev;
    struct device           *hwmon;
 };

no cap, that's the whole vibe right there. every field, every one, copied exactly β€” we do not play about the struct definition πŸ’–


πŸ’… MEMBERS πŸ’…

okay now the fun part, let's meet the cast 🫢 every single member, none skipped, we're thorough besties:

  • owner β€” points to the one wire "wire" kernel module. she's the owner, she's the main character ✨
  • name β€” the device id, and it's ascii. simple, readable, slay 🌈
  • w1_slave_entry β€” data for the linked list. yes bestie, she's linked πŸ’€
  • reg_num β€” the slave id, but in binary this time. same info, different fit πŸ”₯
  • refcnt β€” reference count, and the rule is delete when it hits 0. goodbye when the count says goodbye πŸ‘‹
  • ttl β€” decrement per search this slave isn't found, deatch at 0. so if nobody finds her, her time-to-live ticks down each search until she's gone 😭
  • flags β€” bit flags for W1_SLAVE_ACTIVE and W1_SLAVE_DETACH. little status bits doing little status bit things πŸŽ€
  • master β€” the bus which this slave is on. know your bus, respect your bus 🚌
  • family β€” module for the device family type. found family fr fr πŸ’œ
  • family_data β€” pointer for use by the family module. it's their data, hands off 🫢
  • dev β€” the kernel device identifier πŸ¦‹
  • hwmon β€” pointer to the hwmon device ⭐

πŸ” SEE ALSO πŸ”

go read these too, iykyk, they're all in the kernel file ./include/linux/w1.h:

  • struct w1_reg_num(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)

ngl bestie, if you're poking at one-wire stuff in the kernel, read these before you touch anything. future you will be obsessed with past you. πŸ’–

and that's the page!! mwah πŸ’‹ this one lives in ./include/linux, from October 2026, and it's struct w1_slave(9) β€” periodt. πŸ§šβ€β™€οΈβœ¨

πŸ“¦ where this page comes from