1#ifndef MKSQUASHFS_H 2#define MKSQUASHFS_H 3/* 4 * Squashfs 5 * 6 * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 7 * Phillip Lougher <phillip@lougher.demon.co.uK> 8 * 9 * This program is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU General Public License 11 * as published by the Free Software Foundation; either version 2, 12 * or (at your option) any later version. 13 * 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. 18 * 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 * 23 * mksquashfs.h 24 * 25 */ 26 27#if __BYTE_ORDER == __BIG_ENDIAN 28#define SQUASHFS_SWAP_SHORTS(s, d, n) swap_le16_num(s, d, n) 29#define SQUASHFS_SWAP_INTS(s, d, n) swap_le32_num(s, d, n) 30#define SQUASHFS_SWAP_LONG_LONGS(s, d, n) swap_le64_num(s, d, n) 31 32#define SWAP_LE16(s, d) swap_le16(s, d) 33#define SWAP_LE32(s, d) swap_le32(s, d) 34#define SWAP_LE64(s, d) swap_le64(s, d) 35#else 36#define SQUASHFS_MEMCPY(s, d, n) memcpy(d, s, n) 37#define SQUASHFS_SWAP_SHORTS(s, d, n) memcpy(d, s, n * sizeof(short)) 38#define SQUASHFS_SWAP_INTS(s, d, n) memcpy(d, s, n * sizeof(int)) 39#define SQUASHFS_SWAP_LONG_LONGS(s, d, n) \ 40 memcpy(d, s, n * sizeof(long long)) 41#endif 42 43struct dir_info { 44 char *pathname; 45 unsigned int count; 46 unsigned int directory_count; 47 unsigned int current_count; 48 unsigned int byte_count; 49 char dir_is_ldir; 50 struct dir_ent *dir_ent; 51 struct dir_ent **list; 52 DIR *linuxdir; 53}; 54 55struct dir_ent { 56 char *name; 57 char *pathname; 58 struct inode_info *inode; 59 struct dir_info *dir; 60 struct dir_info *our_dir; 61}; 62 63struct inode_info { 64 struct stat buf; 65 struct inode_info *next; 66 squashfs_inode inode; 67 unsigned int inode_number; 68 unsigned int nlink; 69 int pseudo_id; 70 char type; 71 char read; 72 char root_entry; 73 char pseudo_file; 74}; 75#endif 76 77#define PSEUDO_FILE_OTHER 1 78#define PSEUDO_FILE_PROCESS 2 79 80#define IS_PSEUDO(a) ((a)->pseudo_file) 81#define IS_PSEUDO_PROCESS(a) ((a)->pseudo_file & PSEUDO_FILE_PROCESS) 82#define IS_PSEUDO_OTHER(a) ((a)->pseudo_file & PSEUDO_FILE_OTHER) 83 84/* offset of data in compressed metadata blocks (allowing room for 85 * compressed size */ 86#define BLOCK_OFFSET 2 87