/*
* Create a squashfs filesystem. This is a highly compressed read only
* filesystem.
*
* Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
* 2012, 2013, 2014, 2017, 2019, 2021, 2022, 2023
* Phillip Lougher <phillip@squashfs.org.uk>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2,
* or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* mksquashfs.c
*/
#define FALSE 0
#define TRUE 1
#define MAX_LINE 16384
#include <pwd.h>
#include <grp.h>
#include <time.h>
#include <unistd.h>
#include <stdio.h>
#include <stddef.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <dirent.h>
#include <string.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <pthread.h>
#include <regex.h>
#include <sys/wait.h>
#include <limits.h>
#include <ctype.h>
#ifdef __linux__
#include <sys/sysinfo.h>
#include <sys/sysmacros.h>
#include <sched.h>
#else
#include <sys/sysctl.h>
#endif
#include "squashfs_fs.h"
#include "squashfs_swap.h"
#include "mksquashfs.h"
#include "sort.h"
#include "pseudo.h"
#include "compressor.h"
#include "xattr.h"
#include "action.h"
#include "mksquashfs_error.h"
#include "progressbar.h"
#include "info.h"
#include "caches-queues-lists.h"
#include "read_fs.h"
#include "restore.h"
#include "process_fragments.h"
#include "fnmatch_compat.h"
#include "tar.h"
#include "merge_sort.h"
/* Compression options */
int noF = FALSE;
int noI = FALSE;
int noId = FALSE;
int noD = FALSE;
int noX = FALSE;
/* block size used to build filesystem */
int block_size = SQUASHFS_FILE_SIZE;
int block_log;
/* Fragment options, are fragments in filesystem and are they used for tailends? */
int no_fragments = FALSE;
int always_use_fragments = FALSE;
/* Are duplicates detected in fileystem ? */
int duplicate_checking = TRUE;
/* Are filesystems exportable via NFS? */
int exportable = TRUE;
/* Are sparse files detected and stored? */
int sparse_files = TRUE;
/* Options which override root inode settings */
int root_mode_opt = FALSE;
mode_t root_mode;
int root_uid_opt = FALSE;
unsigned int root_uid;
int root_gid_opt = FALSE;
unsigned int root_gid;
unsigned int root_time;
int root_time_opt = FALSE;
/* Values that override uids and gids for all files and directories */
int global_uid_opt = FALSE;
unsigned int global_uid;
int global_gid_opt = FALSE;
unsigned int global_gid;
/* Do pseudo uids and guids override -all-root, -force-uid and -force-gid? */
int pseudo_override = FALSE;
/* Time value over-ride options */
unsigned int mkfs_time;
int mkfs_time_opt = FALSE;
unsigned int all_time;
int all_time_opt = FALSE;
int clamping = TRUE;
/* Is max depth option in effect, and max depth to descend into directories */
int max_depth_opt = FALSE;
unsigned int max_depth;
/* how should Mksquashfs treat the source files? */
int tarstyle = FALSE;
int keep_as_directory = FALSE;
/* should Mksquashfs read files from stdin, like cpio? */
int cpiostyle = FALSE;
char filename_terminator = '\n';
/* Should Mksquashfs detect hardlinked files? */
int no_hardlinks = FALSE;
/* Should Mksquashfs cross filesystem boundaries? */
int one_file_system = FALSE;
int one_file_system_x = FALSE;
dev_t *source_dev;
dev_t cur_dev;
/* Is Mksquashfs processing a tarfile? */
int tarfile = FALSE;
/* Is Mksquashfs reading a pseudo file from stdin? */
int pseudo_stdin = FALSE;
/* Is Mksquashfs storing Xattrs, or excluding/including xattrs using regexs? */
int no_xattrs = XATTR_DEF;
unsigned int xattr_bytes = 0, total_xattr_bytes = 0;
regex_t *xattr_exclude_preg = NULL;
regex_t *xattr_include_preg = NULL;
/* Does Mksquashfs print a summary and other information when running? */
int quiet = FALSE;
/* Does Mksquashfs display filenames as they are archived? */
int silent = TRUE;
/* Is Mksquashfs using the older non-wildcard exclude code? */
int old_exclude = TRUE;
/* Is Mksquashfs using regexs in exclude file matching (default wildcards)? */
int use_regex = FALSE;
/* Will Mksquashfs pad the filesystem to a multiple of 4 Kbytes? */
int nopad = FALSE;
/* Should Mksquashfs treat normally ignored errors as fatal? */
int exit_on_error = FALSE;
/* Is filesystem stored at an offset from the start of the block device/file? */
long long start_offset = 0;
/* File count statistics used to print summary and fill in superblock */
unsigned int file_count = 0, sym_count = 0, dev_count = 0, dir_count = 0,
fifo_count = 0, sock_count = 0, id_count = 0;
long long hardlnk_count = 0;
/* superblock attributes */
struct squashfs_super_block sBlk;
/* write position within data section */
long long bytes = 0, total_bytes = 0;
/* in memory directory table - possibly compressed */
char *directory_table = NULL;
long long directory_bytes = 0, directory_size = 0, total_directory_bytes = 0;
/* cached directory table */
char *directory_data_cache = NULL;
unsigned int directory_cache_bytes = 0, directory_cache_size = 0;
/* in memory inode table - possibly compressed */
char *inode_table = NULL;
long long inode_bytes = 0, inode_size = 0, total_inode_bytes = 0;
/* cached inode table */
char *data_cache = NULL;
unsigned int cache_bytes = 0, cache_size = 0, inode_count = 0;
/* inode lookup table */
squashfs_inode *inode_lookup_table = NULL;
struct inode_info *inode_info[INODE_HASH_SIZE];
/* hash tables used to do fast duplicate searches in duplicate check */
struct file_info **dupl_frag;
struct file_info **dupl_block;
unsigned int dup_files = 0;
int exclude = 0;
struct exclude_info *exclude_paths = NULL;
struct path_entry {
char *name;
regex_t *preg;
struct pathname *paths;
};
struct pathnames *paths = NULL;
struct pathname *path = NULL;
struct pathname *stickypath = NULL;
unsigned int fragments = 0;
struct squashfs_fragment_entry *fragment_table = NULL;
int fragments_outstanding = 0;
int fragments_locked = FALSE;
/* current inode number for directories and non directories */
unsigned int inode_no = 1;
unsigned int root_inode_number = 0;
/* list of source dirs/files */
int source = 0;
char **source_path;
int option_offset;
/* flag whether destination file is a block device */
int block_device = FALSE;
/* flag indicating whether files are sorted using sort list(s) */
int sorted = FALSE;
/* save destination file name for deleting on error */
char *destination_file = NULL;
struct id *id_hash_table[ID_ENTRIES];
struct id *id_table[SQUASHFS_IDS], *sid_table[SQUASHFS_IDS];
unsigned int uid_count = 0, guid_count = 0;
unsigned int sid_count = 0, suid_count = 0, sguid_count = 0;
/* caches used to store buffers being worked on, and queues
* used to send buffers between threads */
struct cache *reader_buffer, *fragment_buffer, *reserve_cache;
struct cache *bwriter_buffer, *fwriter_buffer;
struct queue *to_reader, *to_deflate, *to_writer, *from_writer,
*to_frag, *locked_fragment, *to_process_frag;
struct seq_queue *to_main;
/* pthread threads and mutexes */
pthread_t reader_thread, writer_thread, main_thread;
pthread_t *deflator_thread, *frag_deflator_thread, *frag_thread;
pthread_t *restore_thread = NULL;
pthread_mutex_t fragment_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t pos_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t dup_mutex = PTHREAD_MUTEX_INITIALIZER;
/* reproducible image queues and threads */
struct seq_queue *to_order;
pthread_t order_thread;
pthread_cond_t fragment_waiting = PTHREAD_COND_INITIALIZER;
int
没有合适的资源?快使用搜索试试~ 我知道了~
创建和提取Squashfs文件系统的工具___下载.zip
共102个文件
c:37个
h:32个
sh:6个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 7 浏览量
2023-04-19
00:42:40
上传
评论
收藏 376KB ZIP 举报
温馨提示
创建和提取Squashfs文件系统的工具___下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
创建和提取Squashfs文件系统的工具___下载.zip (102个子文件)
mksquashfs.1 22KB
sqfstar.1 16KB
unsquashfs.1 11KB
sqfscat.1 4KB
USAGE-MKSQUASHFS-4.6 44KB
USAGE-SQFSTAR-4.6 33KB
USAGE-UNSQUASHFS-4.6 20KB
README-4.6 14KB
USAGE-4.6 3KB
USAGE-SQFSCAT-4.6 3KB
ACKNOWLEDGEMENTS 6KB
ACTIONS-README 24KB
mksquashfs.c 250KB
unsquashfs.c 117KB
action.c 78KB
tar.c 40KB
read_fs.c 31KB
xattr.c 31KB
pseudo.c 31KB
unsquash-4.c 24KB
unsquash-3.c 23KB
unsquash-2.c 20KB
reader.c 16KB
unsquash-1.c 16KB
caches-queues-lists.c 16KB
xz_wrapper.c 14KB
gzip_wrapper.c 13KB
read_xattrs.c 12KB
lzo_wrapper.c 12KB
process_fragments.c 10KB
sort.c 10KB
lz4_wrapper.c 8KB
unsquashfs_xattr.c 8KB
zstd_wrapper.c 7KB
progressbar.c 6KB
unsquash-34.c 5KB
restore.c 4KB
info.c 4KB
pseudo_xattr.c 4KB
lzma_xz_wrapper.c 4KB
lzma_wrapper.c 3KB
compressor.c 3KB
tar_xattr.c 3KB
date.c 3KB
unsquashfs_info.c 3KB
swap.c 2KB
unsquash-1234.c 2KB
unsquash-123.c 2KB
unsquash-12.c 1KB
CHANGES 39KB
COPYING 18KB
pseudo-file.example 3KB
.gitattributes 168B
.gitattributes 22B
.gitignore 42B
squashfs_compat.h 26KB
squashfs_swap.h 20KB
squashfs_fs.h 13KB
unsquashfs.h 8KB
mksquashfs.h 7KB
action.h 7KB
xattr.h 6KB
caches-queues-lists.h 6KB
compressor.h 4KB
merge_sort.h 3KB
tar.h 3KB
pseudo.h 3KB
lzo_wrapper.h 2KB
mksquashfs_error.h 2KB
gzip_wrapper.h 2KB
unsquashfs_error.h 2KB
xz_wrapper.h 1KB
read_fs.h 1KB
signals.h 1KB
lz4_wrapper.h 1KB
error.h 1KB
progressbar.h 1KB
sort.h 1KB
reader.h 1KB
zstd_wrapper.h 1KB
unsquashfs_info.h 1KB
info.h 1013B
endian_compat.h 1013B
process_fragments.h 988B
restore.h 967B
date.h 959B
fnmatch_compat.h 936B
mksquashfs.h2m 7KB
sqfstar.h2m 4KB
unsquashfs.h2m 4KB
sqfscat.h2m 1KB
INSTALL 2KB
Makefile 13KB
version.mk 55B
README 443B
mksquashfs-manpage.sh 7KB
sqfstar-manpage.sh 6KB
unsquashfs-manpage.sh 5KB
sqfscat-manpage.sh 5KB
install-manpages.sh 2KB
共 102 条
- 1
- 2
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9156
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功