X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Flib%2Ftree.h;h=e92c567216b24996776dcd5c922427b1b244aa80;hb=8c70e59cf3d24422154d2351bf742852d04c4302;hp=2fd3386b02f61c02e3abca4c412bca8a4d24b03e;hpb=84a05f3bfbde64c606b014d68b45b2d060e2a478;p=bacula%2Fbacula diff --git a/bacula/src/lib/tree.h b/bacula/src/lib/tree.h index 2fd3386b02..e92c567216 100644 --- a/bacula/src/lib/tree.h +++ b/bacula/src/lib/tree.h @@ -31,12 +31,17 @@ struct s_mem { char first[1]; /* first byte */ }; +/* + * Keep this node as small as possible because + * there is one for each file. + */ struct s_tree_node { char *fname; /* file name */ int32_t FileIndex; /* file index */ uint32_t JobId; /* JobId */ - short type; /* node type */ - short extract; /* set if extracting */ + uint16_t fname_len; /* length of string */ + uint8_t type; /* node type */ + bool extract; /* set if extracting */ struct s_tree_node *parent; struct s_tree_node *sibling; struct s_tree_node *child; @@ -48,8 +53,9 @@ struct s_tree_root { char *fname; /* file name */ int32_t FileIndex; /* file index */ uint32_t JobId; /* JobId */ - short type; /* node type */ - short extract; /* set if extracting */ + uint16_t fname_len; /* length of string */ + uint8_t type; /* node type */ + bool extract; /* set if extracting */ struct s_tree_node *parent; struct s_tree_node *sibling; struct s_tree_node *child; @@ -59,6 +65,8 @@ struct s_tree_root { struct s_tree_node *first; /* first entry in the tree */ struct s_tree_node *last; /* last entry in tree */ struct s_mem *mem; /* tree memory */ + uint32_t total_size; /* total bytes allocated */ + uint32_t blocks; /* total mallocs */ int cached_path_len; /* length of cached path */ char *cached_path; /* cached current path */ TREE_NODE *cached_parent; /* cached parent for above path */ @@ -77,11 +85,17 @@ TREE_NODE *new_tree_node(TREE_ROOT *root, int type); TREE_NODE *insert_tree_node(char *fname, TREE_NODE *node, TREE_ROOT *root, TREE_NODE *parent); TREE_NODE *make_tree_path(char *path, TREE_ROOT *root); -TREE_NODE *first_tree_node(TREE_ROOT *root); -TREE_NODE *next_tree_node(TREE_NODE *node); TREE_NODE *tree_cwd(char *path, TREE_ROOT *root, TREE_NODE *node); TREE_NODE *tree_relcwd(char *path, TREE_ROOT *root, TREE_NODE *node); void append_tree_node(char *path, TREE_NODE *node, TREE_ROOT *root, TREE_NODE *parent); void print_tree(char *path, TREE_NODE *root); void free_tree(TREE_ROOT *root); int tree_getpath(TREE_NODE *node, char *buf, int buf_size); + +#ifdef SLOW_WAY +TREE_NODE *first_tree_node(TREE_ROOT *root); +TREE_NODE *next_tree_node(TREE_NODE *node); +#else + #define first_tree_node(r) (r)->first + #define next_tree_node(n) (n)->next +#endif