1ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher#ifndef SQUASHFS_FS_SB
2ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher#define SQUASHFS_FS_SB
3ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher/*
4ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher * Squashfs
5ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher *
6ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008
7d7f2ff6718efa155fd92e481a5960496d084c63fPhillip Lougher * Phillip Lougher <phillip@squashfs.org.uk>
8ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher *
9ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher * This program is free software; you can redistribute it and/or
10ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher * modify it under the terms of the GNU General Public License
11ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher * as published by the Free Software Foundation; either version 2,
12ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher * or (at your option) any later version.
13ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher *
14ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher * This program is distributed in the hope that it will be useful,
15ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher * but WITHOUT ANY WARRANTY; without even the implied warranty of
16ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher * GNU General Public License for more details.
18ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher *
19ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher * You should have received a copy of the GNU General Public License
20ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher * along with this program; if not, write to the Free Software
21ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher *
23ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher * squashfs_fs_sb.h
24ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher */
25ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher
26ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher#include "squashfs_fs.h"
27ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher
28ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougherstruct squashfs_cache {
29ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	char			*name;
30ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	int			entries;
31d7fbd893388d9e86d29b7cfbd5457bcf03496fbfAjeet Yadav	int			curr_blk;
32ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	int			next_blk;
33ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	int			num_waiters;
34ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	int			unused;
35ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	int			block_size;
36ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	int			pages;
37ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	spinlock_t		lock;
38ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	wait_queue_head_t	wait_queue;
39ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	struct squashfs_cache_entry *entry;
40ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher};
41ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher
42ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougherstruct squashfs_cache_entry {
43ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	u64			block;
44ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	int			length;
45ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	int			refcount;
46ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	u64			next_index;
47ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	int			pending;
48ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	int			error;
49ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	int			num_waiters;
50ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	wait_queue_head_t	wait_queue;
51ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	struct squashfs_cache	*cache;
52ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher	void			**data;
53846b730e99518a1c9945afcb2afbe4d08a02ed80Phillip Lougher	struct squashfs_page_actor	*actor;
54ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher};
55ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher
56ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougherstruct squashfs_sb_info {
574c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	const struct squashfs_decompressor	*decompressor;
584c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	int					devblksize;
594c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	int					devblksize_log2;
604c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	struct squashfs_cache			*block_cache;
614c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	struct squashfs_cache			*fragment_cache;
624c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	struct squashfs_cache			*read_page;
634c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	int					next_meta_index;
644c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	__le64					*id_table;
654c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	__le64					*fragment_index;
664b5397dc24ab12afaac85be3d0863b7f6eb8b0f0Phillip Lougher	__le64					*xattr_id_table;
674c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	struct mutex				meta_index_mutex;
684c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	struct meta_index			*meta_index;
699508c6b90b3f57ecea4e7a896cf8325400fc0c6ePhillip Lougher	struct squashfs_stream			*stream;
704c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	__le64					*inode_lookup_table;
714c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	u64					inode_table;
724c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	u64					directory_table;
734b5397dc24ab12afaac85be3d0863b7f6eb8b0f0Phillip Lougher	u64					xattr_table;
744c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	unsigned int				block_size;
754c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	unsigned short				block_log;
764c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	long long				bytes_used;
774c0f0bb2351bee3de8dd7715ee199454a59f1230Phillip Lougher	unsigned int				inodes;
784b5397dc24ab12afaac85be3d0863b7f6eb8b0f0Phillip Lougher	int					xattr_ids;
79ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher};
80ffae2cd73a9e828b1a188f83c5dedce16f7c0c68Phillip Lougher#endif
81