Initial Commit
[Projects.git] / pkgbuilds / wiifuse / src / wiifuse-0.2.0 / tree.h
blob9e342d9219838be5657c4f21f0d47ec475ead2e9
1 /*
2 * Copyright (C) 2008 dhewg, #wiidev efnet
3 * based on code by:
4 * Copyright (C) 2005 Janusz Dziemidowicz (rraptorr@nails.eu.org)
6 * this file is part of wiifuse
7 * http://wiibrew.org/index.php?title=Wiifuse
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #ifndef _TREE_H_
25 #define _TREE_H_
27 #include "global.h"
29 enum tree_type {
30 TREE_RAW_FILE = 0,
31 TREE_FILE,
32 TREE_DIR,
33 TREE_MEM,
34 TREE_UINT,
35 TREE_HEX_UINT8,
36 TREE_HEX_UINT16,
37 TREE_HEX_UINT32,
38 TREE_HEX_UINT64,
39 TREE_CHAR,
40 TREE_STRING,
41 TREE_SYMLINK
44 struct tree {
45 u32 part;
46 enum tree_type type;
47 char *name;
48 u64 v1;
49 u64 v2;
50 u16 nsubdirs;
51 struct tree *sub;
52 struct tree *next;
55 struct tree *tree_add_dir (u32 part, struct tree *root, const char *name);
56 struct tree *tree_add_filler (u32 part, struct tree *root, const char *name);
57 struct tree *tree_add_raw_file (u32 part, struct tree *root, const char *name,
58 u64 offset, u64 size);
59 struct tree *tree_add_file (u32 part, struct tree *root, const char *name,
60 u64 offset, u64 size);
61 struct tree *tree_add_mem (u32 part, struct tree *root, const char *name,
62 void *ptr, size_t size);
63 struct tree *tree_add_char (u32 part, struct tree *root, const char *name,
64 const char c);
65 struct tree *tree_add_bool (u32 part, struct tree *root, const char *name,
66 const u8 b);
67 struct tree *tree_add_string (u32 part, struct tree *root, const char *name,
68 const char *str, size_t size);
69 struct tree *tree_add_hex_uint8 (u32 part, struct tree *root, const char *name,
70 const u8 value);
71 struct tree *tree_add_hex_uint16 (u32 part, struct tree *root, const char *name,
72 const u16 value);
73 struct tree *tree_add_hex_uint32 (u32 part, struct tree *root, const char *name,
74 const u32 value);
75 struct tree *tree_add_hex_uint64 (u32 part, struct tree *root, const char *name,
76 const u64 value);
77 struct tree *tree_add_uint (u32 part, struct tree *root, const char *name,
78 const u64 value);
79 struct tree *tree_add_symlink (u32 part, struct tree *root, const char *name,
80 const char *dst);
82 struct tree *tree_find_entry (struct tree *root, const char *path);
83 void tree_free (struct tree *root);
84 struct tree *tree_empty (void);
86 #endif