UDEV_ENUMERATE_ADD_MATCH_PARENT(3)

πŸŽ€ udev_enumerate_add_match_is_initialized(3) πŸŽ€

okay bestie so this page is a whole family of libudev functions that all hang out together, and the manual name for the whole squad is udev_enumerate_add_match_subsystem, udev_enumerate_add_nomatch_subsystem, udev_enumerate_add_match_sysattr, udev_enumerate_add_nomatch_sysattr, udev_enumerate_add_match_property, udev_enumerate_add_match_sysname, udev_enumerate_add_match_tag, udev_enumerate_add_match_parent, udev_enumerate_add_match_is_initialized β€” page UDEV_ENUMERATE_ADD_MATCH_IS_INITIALIZED(3) fr fr, that's the one you're reading rn πŸ’–


✨ NAME ✨

udev_enumerate_add_match_subsystem, udev_enumerate_add_nomatch_subsystem, udev_enumerate_add_match_sysattr, udev_enumerate_add_nomatch_sysattr, udev_enumerate_add_match_property, udev_enumerate_add_match_sysname, udev_enumerate_add_match_tag, udev_enumerate_add_match_parent, udev_enumerate_add_match_is_initialized β€” Modify filters. That's it, that's the whole vibe. They tweak the filter set. πŸ’…

So like, nine functions, one page, one mission: filters. Here's the roll call so you know who's who πŸ‘‘

  • udev_enumerate_add_match_subsystem β€” adds a match filter on a subsystem
  • udev_enumerate_add_nomatch_subsystem β€” adds a nomatch filter on a subsystem (the "not this one" twin πŸ™ˆ)
  • udev_enumerate_add_match_sysattr β€” adds a match filter on a sysattr, with a value
  • udev_enumerate_add_nomatch_sysattr β€” adds a nomatch filter on a sysattr, with a value
  • udev_enumerate_add_match_property β€” adds a match filter on a property, with a value
  • udev_enumerate_add_match_sysname β€” adds a match filter on a sysname
  • udev_enumerate_add_match_tag β€” adds a match filter on a tag
  • udev_enumerate_add_match_parent β€” adds a match filter on a parent, and parent is a struct udev_device *
  • udev_enumerate_add_match_is_initialized β€” adds a match filter for is_initialized, no extra args, she's low maintenance 🫢

πŸ¦‹ SYNOPSIS πŸ¦‹

grab the header first, always:

#include <libudev.h>

then, one by one, here's every single signature verbatim so you can't mess it up 😭

int
                                       udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate,
                                       const char *subsystem);

int
                                         udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate,
                                         const char *subsystem);

int
                                     udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate,
                                     const char *sysattr,
                                     const char *value);

int
                                       udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate,
                                       const char *sysattr,
                                       const char *value);

int
                                      udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate,
                                      const char *property,
                                      const char *value);

int
                                     udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate,
                                     const char *sysname);

int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate,
                                 const char *tag);

int
                                    udev_enumerate_add_match_parent(struct udev_enumerate *udev_enumerate,
                                    struct udev_device *parent);

int
                                                udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate);

like yes the indentation is a whole situation πŸ’€ but it's giving "I typed this at 3am" and honestly? iconic. Copy it exactly, don't @ me.


πŸ’œ RETURN VALUE πŸ’œ

okay so the good news is every single one of these is on the same energy:

On success, udev_enumerate_add_match_subsystem(), udev_enumerate_add_nomatch_subsystem(), udev_enumerate_add_match_sysattr(), udev_enumerate_add_nomatch_sysattr(), udev_enumerate_add_match_property(), udev_enumerate_add_match_sysname(), udev_enumerate_add_match_tag(), udev_enumerate_add_match_parent() and udev_enumerate_add_match_is_initialized() return an integer greater than, or equal to, 0.

that's the whole return value section, bestie. >= 0 = slay. that's the vibe check βœ…

ngl this is the chillest RETURN VALUE ever written β€” no weird negative cases spelled out here, no secret codes, just "greater than, or equal to, 0" and we move on. read it, respect it, don't add stuff that isn't there πŸ™ˆ

🌸 HISTORY 🌸

udev_enumerate_add_match_subsystem(), udev_enumerate_add_nomatch_subsystem(), udev_enumerate_add_match_sysattr(), udev_enumerate_add_nomatch_sysattr(), udev_enumerate_add_match_property(), udev_enumerate_add_match_sysname(), udev_enumerate_add_match_tag(), udev_enumerate_add_match_parent(), and udev_enumerate_add_match_is_initialized() were added in version 221.

so the whole friend group arrived together in 221 β€” a package deal, no stragglers, periodt πŸ’…βœ¨


🧚 SEE ALSO 🧚

go read these next, they're the rest of the lore πŸ”₯


and that's the page!! πŸ’– stay hydrated, keep your filters tidy, and remember: this whole thing is from systemd 261.3 β€” UDEV_ENU...UBSYSTEM(3), your fave truncated title, love her for that πŸŽ€πŸ¦‹ no cap, go build something cute ✨

πŸ“¦ where this page comes from