1a96ba00226795862b5e1cb7d8242d4576c374adaplougher#ifndef SQUASHFS_FS_SB
2a96ba00226795862b5e1cb7d8242d4576c374adaplougher#define SQUASHFS_FS_SB
3a96ba00226795862b5e1cb7d8242d4576c374adaplougher/*
4a96ba00226795862b5e1cb7d8242d4576c374adaplougher * Squashfs
5a96ba00226795862b5e1cb7d8242d4576c374adaplougher *
6a96ba00226795862b5e1cb7d8242d4576c374adaplougher * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008
7a96ba00226795862b5e1cb7d8242d4576c374adaplougher * Phillip Lougher <phillip@lougher.demon.co.uk>
8a96ba00226795862b5e1cb7d8242d4576c374adaplougher *
9a96ba00226795862b5e1cb7d8242d4576c374adaplougher * This program is free software; you can redistribute it and/or
10a96ba00226795862b5e1cb7d8242d4576c374adaplougher * modify it under the terms of the GNU General Public License
11a96ba00226795862b5e1cb7d8242d4576c374adaplougher * as published by the Free Software Foundation; either version 2,
12a96ba00226795862b5e1cb7d8242d4576c374adaplougher * or (at your option) any later version.
13a96ba00226795862b5e1cb7d8242d4576c374adaplougher *
14a96ba00226795862b5e1cb7d8242d4576c374adaplougher * This program is distributed in the hope that it will be useful,
15a96ba00226795862b5e1cb7d8242d4576c374adaplougher * but WITHOUT ANY WARRANTY; without even the implied warranty of
16a96ba00226795862b5e1cb7d8242d4576c374adaplougher * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17a96ba00226795862b5e1cb7d8242d4576c374adaplougher * GNU General Public License for more details.
18a96ba00226795862b5e1cb7d8242d4576c374adaplougher *
19a96ba00226795862b5e1cb7d8242d4576c374adaplougher * You should have received a copy of the GNU General Public License
20a96ba00226795862b5e1cb7d8242d4576c374adaplougher * along with this program; if not, write to the Free Software
21a96ba00226795862b5e1cb7d8242d4576c374adaplougher * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22a96ba00226795862b5e1cb7d8242d4576c374adaplougher *
23a96ba00226795862b5e1cb7d8242d4576c374adaplougher * squashfs_fs_sb.h
24a96ba00226795862b5e1cb7d8242d4576c374adaplougher */
25a96ba00226795862b5e1cb7d8242d4576c374adaplougher
26a96ba00226795862b5e1cb7d8242d4576c374adaplougher#include "squashfs_fs.h"
27a96ba00226795862b5e1cb7d8242d4576c374adaplougher
289798f1e43e2fbc8f288a5dc901377f07cec054c1plougherstruct squashfs_cache {
299798f1e43e2fbc8f288a5dc901377f07cec054c1plougher	char			*name;
309798f1e43e2fbc8f288a5dc901377f07cec054c1plougher	int			entries;
319798f1e43e2fbc8f288a5dc901377f07cec054c1plougher	int			next_blk;
3225e0a3fb4ce73fa690fc77cb85246226020bff22plougher	int			num_waiters;
339798f1e43e2fbc8f288a5dc901377f07cec054c1plougher	int			unused;
349798f1e43e2fbc8f288a5dc901377f07cec054c1plougher	int			block_size;
359798f1e43e2fbc8f288a5dc901377f07cec054c1plougher	int			pages;
369798f1e43e2fbc8f288a5dc901377f07cec054c1plougher	spinlock_t		lock;
379798f1e43e2fbc8f288a5dc901377f07cec054c1plougher	wait_queue_head_t	wait_queue;
389798f1e43e2fbc8f288a5dc901377f07cec054c1plougher	struct squashfs_cache_entry *entry;
399798f1e43e2fbc8f288a5dc901377f07cec054c1plougher};
409798f1e43e2fbc8f288a5dc901377f07cec054c1plougher
41a96ba00226795862b5e1cb7d8242d4576c374adaplougherstruct squashfs_cache_entry {
42f006b96e65d7092838983913afbd69fd8199d793plougher	u64			block;
43a96ba00226795862b5e1cb7d8242d4576c374adaplougher	int			length;
44b294ad2b9d77567ed538bba3ac37c5a44d04aac9plougher	int			refcount;
45f006b96e65d7092838983913afbd69fd8199d793plougher	u64			next_index;
46f744e8c409cf4d65c01c36c4036d09e3e096a3f9plougher	int			pending;
47f744e8c409cf4d65c01c36c4036d09e3e096a3f9plougher	int			error;
4825e0a3fb4ce73fa690fc77cb85246226020bff22plougher	int			num_waiters;
49a96ba00226795862b5e1cb7d8242d4576c374adaplougher	wait_queue_head_t	wait_queue;
509798f1e43e2fbc8f288a5dc901377f07cec054c1plougher	struct squashfs_cache	*cache;
519798f1e43e2fbc8f288a5dc901377f07cec054c1plougher	void			**data;
52a96ba00226795862b5e1cb7d8242d4576c374adaplougher};
53a96ba00226795862b5e1cb7d8242d4576c374adaplougher
54a96ba00226795862b5e1cb7d8242d4576c374adaplougherstruct squashfs_sb_info {
55a96ba00226795862b5e1cb7d8242d4576c374adaplougher	int			devblksize;
56a96ba00226795862b5e1cb7d8242d4576c374adaplougher	int			devblksize_log2;
57a96ba00226795862b5e1cb7d8242d4576c374adaplougher	struct squashfs_cache	*block_cache;
58a96ba00226795862b5e1cb7d8242d4576c374adaplougher	struct squashfs_cache	*fragment_cache;
5993911cbac69fbc999c52939d8d8b10698cb14051plougher	struct squashfs_cache	*read_page;
60a96ba00226795862b5e1cb7d8242d4576c374adaplougher	int			next_meta_index;
61a96ba00226795862b5e1cb7d8242d4576c374adaplougher	__le64			*id_table;
62a96ba00226795862b5e1cb7d8242d4576c374adaplougher	__le64			*fragment_index;
63a96ba00226795862b5e1cb7d8242d4576c374adaplougher	unsigned int		*fragment_index_2;
64a96ba00226795862b5e1cb7d8242d4576c374adaplougher	struct mutex		read_data_mutex;
65a96ba00226795862b5e1cb7d8242d4576c374adaplougher	struct mutex		meta_index_mutex;
66a96ba00226795862b5e1cb7d8242d4576c374adaplougher	struct meta_index	*meta_index;
67a96ba00226795862b5e1cb7d8242d4576c374adaplougher	z_stream		stream;
68a96ba00226795862b5e1cb7d8242d4576c374adaplougher	__le64			*inode_lookup_table;
69f006b96e65d7092838983913afbd69fd8199d793plougher	u64			inode_table;
70f006b96e65d7092838983913afbd69fd8199d793plougher	u64			directory_table;
71a96ba00226795862b5e1cb7d8242d4576c374adaplougher	unsigned int		block_size;
72a96ba00226795862b5e1cb7d8242d4576c374adaplougher	unsigned short		block_log;
73a96ba00226795862b5e1cb7d8242d4576c374adaplougher	long long		bytes_used;
74a96ba00226795862b5e1cb7d8242d4576c374adaplougher	unsigned int		inodes;
75a96ba00226795862b5e1cb7d8242d4576c374adaplougher};
76a96ba00226795862b5e1cb7d8242d4576c374adaplougher#endif
77