Fix vitastor-cli rm-data removing data outside the requested range or pool #93

Closed
koolkhel wants to merge 2 commits from koolkhel/vitastor:cli-rm-data into master

2 Commits

Author SHA1 Message Date
1742cdc081 Accept pool names and hex inode numbers in vitastor-cli rm-data
rm-data read --pool and --inode with uint64_value(), so a pool name
became 0 and the pool was silently taken from the inode's pool bits,
i.e. "--pool <other pool> --inode <full inode number>" removed data in
a different pool than requested. A hex --inode became 0 and rm-data
"removed" inode 0, reporting success.

Resolve pool names like ls does (ENOENT for an unknown pool), parse
--inode as decimal or 0x hex, and fail with EINVAL on anything else
before removing data.
2026-10-20 10:57:41 +03:00
66434e3220 Fix vitastor-cli rm-data ignoring offsets with size suffixes
rm-data read --min-offset and --max-offset with uint64_value(), which
returns 0 for "8M", "-8M" or "0x1000", and 0 means "from the start" and
"no upper limit". So a range given with a suffix removed the whole
inode instead of a part of it, and the command reported success.

Parse offsets as decimal or 0x hex with an optional K/M/G/T suffix,
reject signs and values that overflow 64 bits, and fail with EINVAL
before removing anything if a value is invalid, the range is empty or
reversed, or --max-offset is explicitly 0 (omit it for no limit).
2026-10-20 10:57:41 +03:00