GSoC/GCI Archive
Google Code-in 2010 DragonFly BSD

code: write a devattr tool

completed by: Nagato Yuki

mentors: Alex Hornung

This task involves writing a tool based on libdevattr (similar API to Linux' libudev) that will have the following features:

 

  • Listing all devices
  • Listing all devices except aliases
  • Listing all properties of a single device
  • Listing all devices matching a specific property
  • Listing all devices not matching a specific property
  • Listing a specific property of a specific device
  • Listing a specific property of all devices
Ideally some more advanced features should also be implemented:
  • Listing all devices matching a set of properties (match and nomatch, as well as regex and wildcards, ...)
  • ...

This task is relatively easy but a bit extensive. The required information can be found in the devattr manpages which cover the complete API needed for this. Some knowledge of proplib will also need to be acquired (specifically to iterate through the prop_dictionary of the device(s) to find all properties). The proplib man page (prop_dictionary in this case) covers this extensively.
Some code examples are also available (the *test*.c file in lib/libdevattr, and sbin/fsid/fsid.c).