Optimize examples/fs_info and add path validity checks
Optimize examples/fs_info and add path validity checks
Hi! Thanks, this makes sense yes. :-) One less ugly error message.
The stuff in examples/ is quite yolo, I mainly quickly created things to test some new functionality, since there's no proper automated test coverage yet. (Shame on me!). But yeah, I chose to do the whole big project of writing all of the API documentation first.
I have one minor remark: technically, btrfs allows calling IOCTL functions using any open file descriptor to anything that has an inode in the filesystem, not only directories. So, you can even do /fs_info.py ./fs_info.py! :-D
The very short help text uses <mountpoint> as a suggestion, but it does not have to be a directory.
So I suggest we also allow is_file(). Then, if a curious user goes messing around with the example script, we do not refuse operation while they would actually get proper results!