Commit graph

16 commits

Author SHA1 Message Date
Josef Bacik d729048be6 btrfs-progs: stop using btrfs_root_item_v0
This isn't defined in the kernel, we simply check if the root item size
is less than btrfs_root_item, so adjust the user of btrfs_root_item_v0
to make a similar check.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2022-11-28 18:57:43 +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 b2729396d2 btrfs-progs: cmds: use bool for status variables
Using bool for on/off variables is cleaner, convert all in cmds/ .

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-11 09:08:12 +02:00
David Sterba b0fcdb9224 btrfs-progs: cmds: remove unnecessary casts for u64
The (unsigned long long) type casts can be dropped, printf understands
%llu and u64 and does not warn. In cases where the type is not u64 keep
the cast.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-11 09:08:11 +02:00
David Sterba 032e68ba34 btrfs-progs: subvol list: use pr_verbose for messages
Replace printf by the level-aware helper. No change for commands that
don't have the global -q/-v options, otherwise the output can be
quieted.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-11 09:08:11 +02:00
David Sterba c2be0e2ce0 btrfs-progs: use template for out of memory error messages
Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-11 09:08:09 +02:00
David Sterba 40c4ba74ec btrfs-progs: cmds: update include lists
The tool IWYU (include what you use) suggests to remove and add some
includes.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-11 09:07:59 +02:00
David Sterba 6edd4b2121 btrfs-progs: factor string helpers out of utils.c
Utils is the catch-all file, we can now separate some string utility
functions.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-11 09:06:13 +02:00
David Sterba 649ccbfa2e btrfs-progs: subvol list: open code list_subvol_fill_paths in its caller
The helper is quite simple and there's only one caller, so merge them.

Signed-off-by: David Sterba <dsterba@suse.com>
2021-10-08 20:47:04 +02:00
David Sterba fad9a54f88 btrfs-progs: subvol list: move sort order to the caller
All the comparators switch the result based on is_descending, but that
can be factored to the caller to simplify the comparators.

Signed-off-by: David Sterba <dsterba@suse.com>
2021-10-08 20:47:04 +02:00
David Sterba 26f8e56194 btrfs-progs: subvol list: constify comparator parameters
Signed-off-by: David Sterba <dsterba@suse.com>
2021-10-08 20:47:04 +02:00
David Sterba 92c53aa50f btrfs-progs: subvol list: simplify root lookup structures
The struct root_lookup wraps only the rb-tree node which is pointless
indirection, so replace the type.

Signed-off-by: David Sterba <dsterba@suse.com>
2021-10-08 20:47:04 +02:00
David Sterba 7e0a8f3401 btrfs-progs: subvol list: merge the rest of btrfs-list.c
The remaining functions are too entangled to be moved separately without
too much churn making them exported and not, so move all the code at
once. No refactoring or coding style fixups.

Signed-off-by: David Sterba <dsterba@suse.com>
2021-10-08 20:47:03 +02:00
David Sterba 2c63c90517 btrfs-progs: subvol list: copy btrfs_list_alloc_filter_set from btrfs-list.c
There's only one caller of btrfs_list_alloc_filter_set so move it there.
Also move the definitions of BTRFS_LIST_* to the header so they can be
used by both btrfs-list and subvolume.c.

Signed-off-by: David Sterba <dsterba@suse.com>
2021-10-08 20:47:03 +02:00
David Sterba acefefce61 btrfs-progs: subvol list: copy btrfs_list_alloc_comparer_set from btrfs-list.c
There's only one caller of btrfs_list_alloc_comparer_set so move it
there. Also move the definitions of BTRFS_LIST_* to the header so they
can be used by both btrfs-list and subvolume.c.

Signed-off-by: David Sterba <dsterba@suse.com>
2021-10-08 20:47:03 +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