X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=btrfs-list.h;h=6e5fc7784fb1531a408bd0ccd134bed6933d3178;hb=f37ae8d275c2f988c9fc967f8272648fb0118d3d;hp=cde4b3ccfad647bc73e1c9d1574c21211b2383fd;hpb=a1e89891eb6af5381539d9875b85c196150171b6;p=platform%2Fupstream%2Fbtrfs-progs.git diff --git a/btrfs-list.h b/btrfs-list.h index cde4b3c..6e5fc77 100644 --- a/btrfs-list.h +++ b/btrfs-list.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Fujitsu. All rights reserved. + * Copyright (C) 2012 FUJITSU LIMITED. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -16,9 +16,76 @@ * Boston, MA 021110-1307, USA. */ +#ifndef __BTRFS_LIST_H__ +#define __BTRFS_LIST_H__ + +#if BTRFS_FLAT_INCLUDES #include "kerncompat.h" +#include "rbtree.h" +#include "ioctl.h" +#else +#include +#include +#include +#endif /* BTRFS_FLAT_INCLUDES */ + +#include + +enum btrfs_list_layout { + BTRFS_LIST_LAYOUT_DEFAULT = 0, + BTRFS_LIST_LAYOUT_TABLE, + BTRFS_LIST_LAYOUT_RAW +}; + +/* + * one of these for each root we find. + */ +struct root_info { + struct rb_node rb_node; + struct rb_node sort_node; + + /* this root's id */ + u64 root_id; + + /* equal the offset of the root's key */ + u64 root_offset; + + /* flags of the root */ + u64 flags; + + /* the id of the root that references this one */ + u64 ref_tree; -struct root_info; + /* the dir id we're in from ref_tree */ + u64 dir_id; + + u64 top_id; + + /* generation when the root is created or last updated */ + u64 gen; + + /* creation generation of this root in sec*/ + u64 ogen; + + /* creation time of this root in sec*/ + time_t otime; + + u8 uuid[BTRFS_UUID_SIZE]; + u8 puuid[BTRFS_UUID_SIZE]; + u8 ruuid[BTRFS_UUID_SIZE]; + + /* path from the subvol we live in to this root, including the + * root's name. This is null until we do the extra lookup ioctl. + */ + char *path; + + /* the name of this root in the directory it lives in */ + char *name; + + char *full_path; + + int deleted; +}; typedef int (*btrfs_list_filter_func)(struct root_info *, u64); typedef int (*btrfs_list_comp_func)(struct root_info *, struct root_info *, @@ -37,6 +104,7 @@ struct btrfs_list_comparer { struct btrfs_list_filter_set { int total; int nfilters; + int only_deleted; struct btrfs_list_filter filters[0]; }; @@ -53,6 +121,8 @@ enum btrfs_list_column_enum { BTRFS_LIST_PARENT, BTRFS_LIST_TOP_LEVEL, BTRFS_LIST_OTIME, + BTRFS_LIST_PUUID, + BTRFS_LIST_RUUID, BTRFS_LIST_UUID, BTRFS_LIST_PATH, BTRFS_LIST_ALL, @@ -71,6 +141,9 @@ enum btrfs_list_filter_enum { BTRFS_LIST_FILTER_CGEN_LESS, BTRFS_LIST_FILTER_CGEN_MORE, BTRFS_LIST_FILTER_TOPID_EQUAL, + BTRFS_LIST_FILTER_FULL_PATH, + BTRFS_LIST_FILTER_BY_PARENT, + BTRFS_LIST_FILTER_DELETED, BTRFS_LIST_FILTER_MAX, }; @@ -89,19 +162,19 @@ int btrfs_list_parse_filter_string(char *optarg, 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_free_filter_set(struct btrfs_list_filter_set *filter_set); -int btrfs_list_setup_filter(struct btrfs_list_filter_set **filter_set, +void btrfs_list_setup_filter(struct btrfs_list_filter_set **filter_set, enum btrfs_list_filter_enum filter, u64 data); struct btrfs_list_comparer_set *btrfs_list_alloc_comparer_set(void); -void btrfs_list_free_comparer_set(struct btrfs_list_comparer_set *comp_set); -int btrfs_list_setup_comparer(struct btrfs_list_comparer_set **comp_set, - enum btrfs_list_comp_enum comparer, - int is_descending); -int btrfs_list_subvols(int fd, struct btrfs_list_filter_set *filter_set, +int btrfs_list_subvols_print(int fd, struct btrfs_list_filter_set *filter_set, struct btrfs_list_comparer_set *comp_set, - int is_tab_result); + enum btrfs_list_layout layot, int full_path, + const char *raw_prefix); int btrfs_list_find_updated_files(int fd, u64 root_id, u64 oldest_gen); int btrfs_list_get_default_subvolume(int fd, u64 *default_id); char *btrfs_list_path_for_root(int fd, u64 root); -u64 btrfs_list_get_path_rootid(int fd); +int btrfs_list_get_path_rootid(int fd, u64 *treeid); +int btrfs_get_subvol(int fd, struct root_info *the_ri); +int btrfs_get_toplevel_subvol(int fd, struct root_info *the_ri); + +#endif