Commit Graph

10 Commits

Author SHA1 Message Date
David Sterba c9ebef41ec btrfs-progs: use unsigned type for bit shift values
Bit shifts should be done on unsigned types, do that in remaining code.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-03 18:04:37 +01:00
David Sterba 39c63831a0 btrfs-progs: add support for dry-run options
Some commands could be run in a dry-run mode, i.e. not doing any
write/change actions, only printing the steps and ignoring errors.

There are two possibilities where to put the option:

- as a global one: btrfs --dry-run subvolume delete /path
- local option:    btrfs subvolume delete --dry-run /path

As we have several global options already, let's put it there, dry-run
should not be very common so the slight inconvenience of writing the
option out of order of command arguments should be acceptable.

Issue: #629
Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-03 18:04:37 +01:00
David Sterba 900d56f1b9 btrfs-progs: add new group reflink and command
Add initial reflink group with example command 'clone' to test the
interface. Work in progress, experimental build needed.

Issue: #396
Signed-off-by: David Sterba <dsterba@suse.com>
2022-12-07 01:43:30 +01:00
David Sterba f6a212b8e6 btrfs-progs: unify naming of subvolume command definitions
Use full 'subvolume' in all cmd defintions to unify that with other
commands.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-25 20:45:00 +02:00
David Sterba 03650851c5 btrfs-progs: split subvolume list to its own file
The main functionality of subvolume listing is now in btrfs-list.c but
there are no other commands using the API so this will be merged. It's a
lot of code so split it to another file.

Signed-off-by: David Sterba <dsterba@suse.com>
2021-10-08 20:47:03 +02:00
David Sterba 33543eb2b1 btrfs-progs: remove stale command declarations
The declarations do not correspond to any command descriptors as they
have been moved to other command groups.

Signed-off-by: David Sterba <dsterba@suse.com>
2021-08-20 14:24:55 +02:00
David Sterba 54fbdafdc5 btrfs-progs: help: define helper for command with flags
Add macro to define a simple command that also gets some non-default
flags, eg. the output formats.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-03 20:49:04 +02:00
David Sterba 17aee13fcd btrfs-progs: define new output format: json
Add the definition, the format is not implemented in any command.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-03 20:49:04 +02:00
Jeff Mahoney a1a5000984 btrfs-progs: add support for output formats
This adds a global --format option to request extended output formats
from each command.

We currently only support text mode.  Command help reports what
output formats are available for each command.  Global help reports
what valid formats are.

If an invalid format is requested, an error is reported and lists the
valid formats.

Each command sets a bitmask that describes which formats it is capable
of outputting.  If a globally valid format is requested of a command
that doesn't support it, an error is reported and command usage dumped.

Commands don't need to specify that they support text output.  All
commands are required to output text.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
[ use global config instead of passing cmd_context ]
Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-03 20:49:04 +02:00
David Sterba aac564aca6 btrfs-progs: move commonh to common/
Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-03 20:49:03 +02:00