DEVICE_ULONG_ATTR(9)
π DEVICE_ULONG_ATTR(9) β¨
okay so bestie, welcome to the Kernel API Manual π β like, the actual manual page for DEVICE_ULONG_ATTR(9), and no, that's not a typo, it's literally the name. buckle up π¦
β¨ NAME β¨
DEVICE_ULONG_ATTR β the macro that defines a device attribute backed by an unsigned long. that's it, that's the whole vibe π
πΈ SYNOPSIS πΈ
DEVICE_ULONG_ATTR (_name , _mode , _var );
like, yes, the spacing is weird, but that's literally how it's written, i don't make the rules π
π¦ ARGUMENTS π¦
_nameβ the attribute name π·οΈ literally what you're gonna call this thing._modeβ the file mode. you know, the permission bits β¨_varβ the identifier of the unsigned long. this is the actual variable in question, the main character π
π DESCRIPTION π
okay so here's the tea π: this is just like DEVICE_ATTR, but _show and _store get provided for you automatically β no cap, you don't write them yourself.
what that means, bestie: when userspace reads from the attribute, it affects _var. when userspace writes to it, it also affects _var. so the whole read/write pipeline is just... handled. slay π
the variable is literally living its best life, being read and written from the other side and you didn't have to lift a finger π«Ά
π SEE ALSO π
like, there's a lot here β it's giving "i know everybody at this party" energy π but here we go, every single one:
- Kernel file
./include/linux/device.h struct subsys_interface(9)struct device_attribute(9)struct dev_ext_attribute(9)DEVICE_ATTR(9)DEVICE_ATTR_RW(9)DEVICE_ATTR_ADMIN_RW(9)DEVICE_ATTR_RW_NAMED(9)DEVICE_ATTR_RO(9)DEVICE_ATTR_ADMIN_RO(9)DEVICE_ATTR_RO_NAMED(9)DEVICE_ATTR_WO(9)DEVICE_ATTR_WO_NAMED(9)DEVICE_INT_ATTR(9)DEVICE_BOOL_ATTR(9)DEVICE_STRING_ATTR_RO(9)enum device_link_state(9)enum dl_dev_state(9)enum device_removable(9)struct dev_links_info(9)struct dev_msi_info(9)enum device_physical_location_panel(9)enum device_physical_location_vertical_position(9)enum device_physical_location_horizontal_position(9)struct device_physical_location(9)enum struct_device_flags(9)struct device(9)struct device_link(9)device_set_driver_override(9)device_has_driver_override(9)device_match_driver_override(9)device_iommu_mapped(9)dev_name(9)dev_bus_name(9)device_find_child_by_name(9)device_find_any_child(9)device_lock_set_class(9)device_lock_reset_class(9)
π ngl, if you were looking for struct device lore, you are so in the right place, this list ate and left no crumbs π₯
mwah π β this page lives in ./include/linux, it's stamped October 2026, and it'll always answer to the name DEVICE_ULONG_ATTR(9). iykyk π§π
π¦ 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