DEVICE_ATTR_RO_NAMED(9)
π DEVICE_ATTR_RO_NAMED(9) π
okay so this is a page from the Kernel API Manual and it's literally about one little macro that lets you name your sysfs attribute whatever you want instead of being stuck with your function's name. bestie, the freedom. π¦
β¨ NAME β¨
DEVICE_ATTR_RO_NAMED β define a read-only device attribute, but the sysfs name gets to be different from the function name. icon behaviour, honestly π
πΈ SYNOPSIS πΈ
DEVICE_ATTR_RO_NAMED (_name , _attrname );
π ARGUMENTS π
_nameβ the attribute function preface, i.e. the name of the function doing the work π«Ά_attrnameβ the attribute name as it will be exposed in the sysfs. this is the one the world actually sees β¨
π DESCRIPTION π
so it's giving DEVICE_ATTR_RO energy, right? same read-only vibe. but the glow-up here is that it lets you reuse names under separate paths within the same driver π
like yes you can have the same attribute name living in two different spots and nothing is fighting. main character macro behaviour, no cap.
ngl it's the "same name, different path" friend. very much iykyk.
π SEE ALSO π
the whole friend group, fr fr β plus the 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_WO(9)DEVICE_ATTR_WO_NAMED(9)DEVICE_ULONG_ATTR(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)
and that's the whole page, bestie, you ate that ππ
this one came out of ./include/linux in October 2026 β mwah, sending you off with a kiss and a DEVICE_ATTR_RO_NAMED(9) π
π¦ 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