Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chillenb opened this issue Feb 23, 2024 · 3 comments
Open

Comments

@chillenb
Copy link

No description provided.

@kdave
Copy link
Owner

kdave commented Feb 26, 2024

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
Copy link

Zygo commented Feb 26, 2024

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

  • hexadecimal ("0x" prefix followed by a variable number of hex digits) for device offsets, file offsets, and extent bytenrs, where it's useful to represent a page-aligned value as a round hex number.
  • range notation (0xbegin..0xend) instead of a pair of start offset and length.
  • no bare hex numbers. The "0x" ensures no ambiguity with a hex number that happens to contain only decimal digits.
  • human-readable units for sizes and lengths (2K, 4.01MiB, etc), powers-of-2 units (KiB, MiB, etc) preferred over power-of-10 units.
  • decimal for non-contiguous object identifiers (subvol/root, inode, devid). The only special numbers for those are 5 and 256, and they don't require special notation to spot.

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
Copy link
Author

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.

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

No branches or pull requests

3 participants