kdave / btrfs-progs

Development of userspace BTRFS tools
GNU General Public License v2.0
527 stars 239 forks source link

Feature request: global option to print offsets and such in hexadecimal #749

Open chillenb opened 4 months ago

kdave commented 4 months ago

Do you have suggestion for the option name and format? I think there would need to be list of value categories where this applies, ie. not for inode numbers. I don't know how much flexible the format should be, we can do a preselected list of values where hex format would make sense. If this there's a need to make it more flexible (like adding exceptions for certain types) then the specifier can be enhanced.

Possible format: --units=hex

Zygo commented 4 months ago

For reference, I find these notations most useful (in bees and some other tools I developed):

I didn't find lengths in hex to be very useful compared to the range notation. Range notation in hex shows clearly whether the end of the range is page-aligned regardless of the start of the range. It's also more convenient when overlapping matching ends of ranges.

For device offsets I find units of 1024M with 3 fixed decimal places are useful. 1 GiB-aligned dev_extents are "xxx.001" in that notation. That's really obscure, though, and I don't know of a btrfs-progs tool that even outputs that information other than btrfs ins dump-tree.

chillenb commented 4 months ago

I would be quite happy with what Zygo suggested and don't have very much to add. Range notation would be especially handy! A simple option like --units-hex would be adequate at least for me, and I'd prefer this over a flexible system that requires more typing.