6 * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
7 * 2012, 2013, 2014, 2019
8 * Phillip Lougher <phillip@squashfs.org.uk>
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.
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.
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.
32 unsigned int directory_count
;
34 unsigned int excluded
;
36 struct dir_ent
*dir_ent
;
44 char *nonstandard_pathname
;
45 struct inode_info
*inode
;
47 struct dir_info
*our_dir
;
53 struct inode_info
*next
;
55 unsigned int inode_number
;
63 char always_use_fragments
;
69 /* in memory file info */
74 unsigned int *block_list
;
75 struct file_info
*next
;
76 struct fragment
*fragment
;
77 unsigned short checksum
;
78 unsigned short fragment_checksum
;
79 char have_frag_checksum
;
83 /* fragment block data structures */
90 /* in memory uid tables */
91 #define ID_ENTRIES 256
92 #define ID_HASH(id) (id & (ID_ENTRIES - 1))
103 /* fragment to file mapping used when appending */
105 struct file_info
*file
;
106 struct append_file
*next
;
109 #define PSEUDO_FILE_OTHER 1
110 #define PSEUDO_FILE_PROCESS 2
112 #define IS_PSEUDO(a) ((a)->pseudo_file)
113 #define IS_PSEUDO_PROCESS(a) ((a)->pseudo_file & PSEUDO_FILE_PROCESS)
114 #define IS_PSEUDO_OTHER(a) ((a)->pseudo_file & PSEUDO_FILE_OTHER)
117 * Amount of physical memory to use by default, and the default queue
120 #define SQUASHFS_TAKE 4
121 #define SQUASHFS_READQ_MEM 4
122 #define SQUASHFS_BWRITEQ_MEM 4
123 #define SQUASHFS_FWRITEQ_MEM 4
126 * Lowest amount of physical memory considered viable for Mksquashfs
129 #define SQUASHFS_LOWMEM 64
131 /* offset of data in compressed metadata blocks (allowing room for
133 #define BLOCK_OFFSET 2
135 #ifdef REPRODUCIBLE_DEFAULT
137 #define REP_STR " (default)"
140 #define NOREP_STR " (default)"
145 extern struct cache
*reader_buffer
, *fragment_buffer
, *reserve_cache
;
146 struct cache
*bwriter_buffer
, *fwriter_buffer
;
147 extern struct queue
*to_reader
, *to_deflate
, *to_writer
, *from_writer
,
148 *to_frag
, *locked_fragment
, *to_process_frag
;
149 extern struct append_file
**file_mapping
;
150 extern struct seq_queue
*to_main
, *to_order
;
151 extern pthread_mutex_t fragment_mutex
, dup_mutex
;
152 extern struct squashfs_fragment_entry
*fragment_table
;
153 extern struct compressor
*comp
;
154 extern int block_size
;
155 extern struct file_info
*dupl
[];
156 extern int read_fs_bytes(int, long long, int, void *);
157 extern void add_file(long long, long long, long long, unsigned int *, int,
158 unsigned int, int, int);
159 extern struct id
*create_id(unsigned int);
160 extern unsigned int get_uid(unsigned int);
161 extern unsigned int get_guid(unsigned int);
162 extern int read_bytes(int, void *, int);
163 extern unsigned short get_checksum_mem(char *, int);
164 extern int reproducible
;