• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef MKSQUASHFS_H
2 #define MKSQUASHFS_H
3 /*
4  * Squashfs
5  *
6  * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
7  * 2012, 2013, 2014
8  * Phillip Lougher <phillip@squashfs.org.uk>
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2,
13  * or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23  *
24  * mksquashfs.h
25  *
26  */
27 /* ANDROID CHANGES START*/
28 #ifdef ANDROID
29 #include <stdint.h>
30 #endif
31 /* ANDROID CHANGES END */
32 #include <pthread.h>
33 
34 struct dir_info {
35 	char			*pathname;
36 	char			*subpath;
37 	unsigned int		count;
38 	unsigned int		directory_count;
39 	int			depth;
40 	unsigned int		excluded;
41 	char			dir_is_ldir;
42 	struct dir_ent		*dir_ent;
43 	struct dir_ent		*list;
44 	DIR			*linuxdir;
45 };
46 
47 struct dir_ent {
48 	char			*name;
49 	char			*source_name;
50 	char			*nonstandard_pathname;
51 	struct inode_info	*inode;
52 	struct dir_info		*dir;
53 	struct dir_info		*our_dir;
54 	struct dir_ent		*next;
55 /* ANDROID CHANGES START*/
56 #ifdef ANDROID
57 	uint64_t capabilities;
58 #endif
59 /* ANDROID CHANGES END */
60 };
61 
62 struct inode_info {
63 	struct stat		buf;
64 	struct inode_info	*next;
65 	squashfs_inode		inode;
66 	unsigned int		inode_number;
67 	unsigned int		nlink;
68 	int			pseudo_id;
69 	char			type;
70 	char			read;
71 	char			root_entry;
72 	char			pseudo_file;
73 	char			no_fragments;
74 	char			always_use_fragments;
75 	char			noD;
76 	char			noF;
77 	char			symlink[0];
78 };
79 
80 /* in memory file info */
81 struct file_info {
82 	long long		file_size;
83 	long long		bytes;
84 	long long		start;
85 	unsigned int		*block_list;
86 	struct file_info	*next;
87 	struct fragment		*fragment;
88 	unsigned short		checksum;
89 	unsigned short		fragment_checksum;
90 	char			have_frag_checksum;
91 	char			have_checksum;
92 };
93 
94 /* fragment block data structures */
95 struct fragment {
96 	unsigned int		index;
97 	int			offset;
98 	int			size;
99 };
100 
101 /* in memory uid tables */
102 #define ID_ENTRIES 256
103 #define ID_HASH(id) (id & (ID_ENTRIES - 1))
104 #define ISA_UID 1
105 #define ISA_GID 2
106 
107 struct id {
108 	unsigned int id;
109 	int	index;
110 	char	flags;
111 	struct id *next;
112 };
113 
114 /* fragment to file mapping used when appending */
115 struct append_file {
116 	struct file_info *file;
117 	struct append_file *next;
118 };
119 
120 #define PSEUDO_FILE_OTHER	1
121 #define PSEUDO_FILE_PROCESS	2
122 
123 #define IS_PSEUDO(a)		((a)->pseudo_file)
124 #define IS_PSEUDO_PROCESS(a)	((a)->pseudo_file & PSEUDO_FILE_PROCESS)
125 #define IS_PSEUDO_OTHER(a)	((a)->pseudo_file & PSEUDO_FILE_OTHER)
126 
127 /*
128  * Amount of physical memory to use by default, and the default queue
129  * ratios
130  */
131 #define SQUASHFS_TAKE 4
132 #define SQUASHFS_READQ_MEM 4
133 #define SQUASHFS_BWRITEQ_MEM 4
134 #define SQUASHFS_FWRITEQ_MEM 4
135 
136 /*
137  * Lowest amount of physical memory considered viable for Mksquashfs
138  * to run in Mbytes
139  */
140 #define SQUASHFS_LOWMEM 64
141 
142 /* offset of data in compressed metadata blocks (allowing room for
143  * compressed size */
144 #define BLOCK_OFFSET 2
145 
146 extern struct cache *reader_buffer, *fragment_buffer, *reserve_cache;
147 struct cache *bwriter_buffer, *fwriter_buffer;
148 extern struct queue *to_reader, *to_deflate, *to_writer, *from_writer,
149 	*to_frag, *locked_fragment, *to_process_frag;
150 extern struct append_file **file_mapping;
151 extern struct seq_queue *to_main;
152 extern pthread_mutex_t fragment_mutex, dup_mutex;
153 extern struct squashfs_fragment_entry *fragment_table;
154 extern struct compressor *comp;
155 extern int block_size;
156 extern struct file_info *dupl[];
157 extern int read_fs_bytes(int, long long, int, void *);
158 extern void add_file(long long, long long, long long, unsigned int *, int,
159 	unsigned int, int, int);
160 extern struct id *create_id(unsigned int);
161 extern unsigned int get_uid(unsigned int, int);
162 extern unsigned int get_guid(unsigned int, int);
163 extern int read_bytes(int, void *, int);
164 extern unsigned short get_checksum_mem(char *, int);
165 #endif
166