Skip to content

Conversation

@wu-zhao-min
Copy link

Optimize examples/fs_info and add path validity checks

@knorrie
Copy link
Owner

knorrie commented Dec 17, 2025

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants