00001
00008
00009
00010
00011
00012 #ifndef __L4VFS_INCLUDE_TREE_HELPER_H_
00013 #define __L4VFS_INCLUDE_TREE_HELPER_H_
00014
00015 #include <l4/l4vfs/types.h>
00016
00017 enum object_type_e {L4VFS_TH_TYPE_OBJECT, L4VFS_TH_TYPE_DIRECTORY};
00018
00019 typedef struct l4vfs_th_node_s
00020 {
00021 int type;
00022 struct l4vfs_th_node_s * next;
00023 struct l4vfs_th_node_s * first_child;
00024 struct l4vfs_th_node_s * parent;
00025 local_object_id_t id;
00026 char * name;
00027 void * data;
00028 int usage_count;
00029 } l4vfs_th_node_t;
00030
00031 EXTERN_C_BEGIN
00032
00033 l4vfs_th_node_t * l4vfs_th_new_node(const char * name, int type,
00034 l4vfs_th_node_t * parent,
00035 void * data);
00036
00037
00038
00039
00040
00041
00042
00043 int l4vfs_th_destroy_child(l4vfs_th_node_t * parent,
00044 l4vfs_th_node_t * child);
00045
00046
00047
00048
00049
00050
00051 int l4vfs_th_free_node(l4vfs_th_node_t * node);
00052
00053 l4vfs_th_node_t * l4vfs_th_child_for_name(l4vfs_th_node_t * parent,
00054 const char * name);
00055 l4vfs_th_node_t * l4vfs_th_node_for_id(local_object_id_t id);
00056 local_object_id_t l4vfs_th_resolve(local_object_id_t base, const char * name);
00057 local_object_id_t l4vfs_th_local_resolve(local_object_id_t base,
00058 const char * name);
00059 char * l4vfs_th_rev_resolve(local_object_id_t base, local_object_id_t * parent);
00060 void l4vfs_th_init(void);
00061 void l4vfs_th_dir_to_dirent(const l4vfs_th_node_t * node,
00062 l4vfs_dirent_t * entry);
00063 int l4vfs_th_dir_dirent_size(const l4vfs_th_node_t * node);
00064
00079 int l4vfs_th_dir_fill_dirents(const l4vfs_th_node_t * node, int index,
00080 l4vfs_dirent_t * entry, int * length);
00081
00082 int l4vfs_th_is_absolute_path(const char * path);
00083 char * l4vfs_th_get_first_path(const char * name);
00084 char * l4vfs_th_get_remainder_path(const char * name);
00085
00086 EXTERN_C_END
00087
00088 #endif