mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-11-24 12:44:17 +08:00
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>
This commit is contained in:
parent
acefefce61
commit
2c63c90517
18
btrfs-list.c
18
btrfs-list.c
@ -872,24 +872,6 @@ static btrfs_list_filter_func all_filter_funcs[] = {
|
||||
[BTRFS_LIST_FILTER_DELETED] = filter_deleted,
|
||||
};
|
||||
|
||||
struct btrfs_list_filter_set *btrfs_list_alloc_filter_set(void)
|
||||
{
|
||||
struct btrfs_list_filter_set *set;
|
||||
int size;
|
||||
|
||||
size = sizeof(struct btrfs_list_filter_set) +
|
||||
BTRFS_LIST_NFILTERS_INCREASE * sizeof(struct btrfs_list_filter);
|
||||
set = calloc(1, size);
|
||||
if (!set) {
|
||||
fprintf(stderr, "memory allocation failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
set->total = BTRFS_LIST_NFILTERS_INCREASE;
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup list filters. Exit if there's not enough memory, as we can't continue
|
||||
* without the structures set up properly.
|
||||
|
@ -157,7 +157,6 @@ int btrfs_list_parse_filter_string(char *optarg,
|
||||
struct btrfs_list_filter_set **filters,
|
||||
enum btrfs_list_filter_enum type);
|
||||
void btrfs_list_setup_print_column(enum btrfs_list_column_enum column);
|
||||
struct btrfs_list_filter_set *btrfs_list_alloc_filter_set(void);
|
||||
void btrfs_list_setup_filter(struct btrfs_list_filter_set **filter_set,
|
||||
enum btrfs_list_filter_enum filter, u64 data);
|
||||
|
||||
|
@ -69,6 +69,24 @@ static const char * const cmd_subvol_list_usage[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct btrfs_list_filter_set *btrfs_list_alloc_filter_set(void)
|
||||
{
|
||||
struct btrfs_list_filter_set *set;
|
||||
int size;
|
||||
|
||||
size = sizeof(struct btrfs_list_filter_set) +
|
||||
BTRFS_LIST_NFILTERS_INCREASE * sizeof(struct btrfs_list_filter);
|
||||
set = calloc(1, size);
|
||||
if (!set) {
|
||||
fprintf(stderr, "memory allocation failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
set->total = BTRFS_LIST_NFILTERS_INCREASE;
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
static struct btrfs_list_comparer_set *btrfs_list_alloc_comparer_set(void)
|
||||
{
|
||||
struct btrfs_list_comparer_set *set;
|
||||
|
Loading…
Reference in New Issue
Block a user