On Wed, Dec 01, 2010 at 11:25:16AM -0800, Sage Weil wrote:
Sorry, I got distracted by a snowstorm knocking out my power for a few
days and then a holliday :)
What's wrong with:
for snap in `ls /sys/bus/rbd/devices/$id/snap_*`; do ...
instead?
And you would be using libudev ideally for a .c file, and iterating over
the devices is pretty trivial that way from what I have seen.
It's not preferable as that "snaps" directory is a "blank" in the device
tree, not showing the heiarchy properly. You can't walk the devices
back from the devices in snaps/ to the parent properly (i.e. you would
get stuck at the snaps/ directory as it's not a struct device, but a
random kobject.
Hope this helps,
greg k-h
--