亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mkcramfs.c

?? 在win(2000/2003)下面制作CRAMFS映像文件 專門用于嵌入式Linux開發(fā) 由于網(wǎng)絡(luò)上沒有類似的軟件 索性自己寫了一個(gè) 經(jīng)過測(cè)試OK 全部源代碼
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/* * mkcramfs - make a cramfs file system * * Copyright (C) 1999-2002 Transmeta Corporation * * 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 of the License, 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, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA *//* * If you change the disk format of cramfs, please update fs/cramfs/README. */#include <sys/types.h>#include <stdio.h>#include <sys/stat.h>#include <unistd.h>#include <sys/mman.h>#include <fcntl.h>#include <dirent.h>#include <stdlib.h>#include <errno.h>#include <string.h>#include <stdarg.h>#include <linux/cramfs_fs.h>#include <zlib.h>/* Exit codes used by mkfs-type programs */#define MKFS_OK          0	/* No errors */#define MKFS_ERROR       8	/* Operational error */#define MKFS_USAGE       16	/* Usage or syntax error *//* The kernel only supports PAD_SIZE of 0 and 512. */#define PAD_SIZE 512/* The kernel assumes PAGE_CACHE_SIZE as block size. */#define PAGE_CACHE_SIZE (4096)/* * The longest filename component to allow for in the input directory tree. * ext2fs (and many others) allow up to 255 bytes.  A couple of filesystems * allow longer (e.g. smbfs 1024), but there isn't much use in supporting * >255-byte names in the input directory tree given that such names get * truncated to CRAMFS_MAXPATHLEN (252 bytes) when written to cramfs. * * Old versions of mkcramfs generated corrupted filesystems if any input * filenames exceeded CRAMFS_MAXPATHLEN (252 bytes), however old * versions of cramfsck seem to have been able to detect the corruption. */#define MAX_INPUT_NAMELEN 255/* * Maximum size fs you can create is roughly 256MB.  (The last file's * data must begin within 256MB boundary but can extend beyond that.) * * Note that if you want it to fit in a ROM then you're limited to what the * hardware and kernel can support. */#define MAXFSLEN ((((1 << CRAMFS_OFFSET_WIDTH) - 1) << 2) /* offset */ \		  + (1 << CRAMFS_SIZE_WIDTH) - 1 /* filesize */ \		  + (1 << CRAMFS_SIZE_WIDTH) * 4 / PAGE_CACHE_SIZE /* block pointers */ )static const char *progname = "mkcramfs";static unsigned int blksize = PAGE_CACHE_SIZE;static long total_blocks = 0, total_nodes = 1; /* pre-count the root node */static int image_length = 0;/* * If opt_holes is set, then mkcramfs can create explicit holes in the * data, which saves 26 bytes per hole (which is a lot smaller a * saving than most most filesystems). * * Note that kernels up to at least 2.3.39 don't support cramfs holes, * which is why this is turned off by default. * * If opt_verbose is 1, be verbose.  If it is higher, be even more verbose. */static u32 opt_edition = 0;static int opt_errors = 0;static int opt_holes = 0;static int opt_pad = 0;static int opt_verbose = 0;static char *opt_image = NULL;static char *opt_name = NULL;static int warn_dev, warn_gid, warn_namelen, warn_skip, warn_size, warn_uid;/* In-core version of inode / directory entry. */struct entry {	/* stats */	unsigned char *name;	unsigned int mode, size, uid, gid;	/* these are only used for non-empty files */	char *path;		/* always null except non-empty files */	int fd;			/* temporarily open files while mmapped */	/* FS data */	void *uncompressed;	/* points to other identical file */	struct entry *same;	unsigned int offset;		/* pointer to compressed data in archive */	unsigned int dir_offset;	/* Where in the archive is the directory entry? */	/* organization */	struct entry *child; /* null for non-directories and empty directories */	struct entry *next;};/* Input status of 0 to print help and exit without an error. */static void usage(int status){	FILE *stream = status ? stderr : stdout;	fprintf(stream, "usage: %s [-h] [-e edition] [-i file] [-n name] dirname outfile\n"		" -h         print this help\n"		" -E         make all warnings errors (non-zero exit status)\n"		" -e edition set edition number (part of fsid)\n"		" -i file    insert a file image into the filesystem (requires >= 2.4.0)\n"		" -n name    set name of cramfs filesystem\n"		" -p         pad by %d bytes for boot code\n"		" -s         sort directory entries (old option, ignored)\n"		" -v         be more verbose\n"		" -z         make explicit holes (requires >= 2.3.39)\n"		" dirname    root of the directory tree to be compressed\n"		" outfile    output file\n", progname, PAD_SIZE);	exit(status);}static void die(int status, int syserr, const char *fmt, ...){	va_list arg_ptr;	int save = errno;	fflush(0);	va_start(arg_ptr, fmt);	fprintf(stderr, "%s: ", progname);	vfprintf(stderr, fmt, arg_ptr);	if (syserr) {		fprintf(stderr, ": %s", strerror(save));	}	fprintf(stderr, "\n");	va_end(arg_ptr);	exit(status);}static void map_entry(struct entry *entry){	if (entry->path) {		entry->fd = open(entry->path, O_RDONLY);		if (entry->fd < 0) {			die(MKFS_ERROR, 1, "open failed: %s", entry->path);		}		entry->uncompressed = mmap(NULL, entry->size, PROT_READ, MAP_PRIVATE, entry->fd, 0);		if (entry->uncompressed == MAP_FAILED) {			die(MKFS_ERROR, 1, "mmap failed: %s", entry->path);		}	}}static void unmap_entry(struct entry *entry){	if (entry->path) {		if (munmap(entry->uncompressed, entry->size) < 0) {			die(MKFS_ERROR, 1, "munmap failed: %s", entry->path);		}		close(entry->fd);	}}static int find_identical_file(struct entry *orig, struct entry *newfile){	if (orig == newfile)		return 1;	if (!orig)		return 0;	if (orig->size == newfile->size && (orig->path || orig->uncompressed))	{		map_entry(orig);		map_entry(newfile);		if (!memcmp(orig->uncompressed, newfile->uncompressed, orig->size))		{			newfile->same = orig;			unmap_entry(newfile);			unmap_entry(orig);			return 1;		}		unmap_entry(newfile);		unmap_entry(orig);	}	return (find_identical_file(orig->child, newfile) ||		find_identical_file(orig->next, newfile));}static void eliminate_doubles(struct entry *root, struct entry *orig) {	if (orig) {		if (orig->size && (orig->path || orig->uncompressed))			find_identical_file(root, orig);		eliminate_doubles(root, orig->child);		eliminate_doubles(root, orig->next);	}}/* * We define our own sorting function instead of using alphasort which * uses strcoll and changes ordering based on locale information. */static int cramsort (const void *a, const void *b){	return strcmp ((*(const struct dirent **) a)->d_name,		       (*(const struct dirent **) b)->d_name);}static unsigned int parse_directory(struct entry *root_entry, const char *name, struct entry **prev, loff_t *fslen_ub){	struct dirent **dirlist;	int totalsize = 0, dircount, dirindex;	char *path, *endpath;	size_t len = strlen(name);	/* Set up the path. */	/* TODO: Reuse the parent's buffer to save memcpy'ing and duplication. */	path = malloc(len + 1 + MAX_INPUT_NAMELEN + 1);	if (!path) {		die(MKFS_ERROR, 1, "malloc failed");	}	memcpy(path, name, len);	endpath = path + len;	*endpath = '/';	endpath++;	/* read in the directory and sort */	dircount = scandir(name, &dirlist, 0, cramsort);	if (dircount < 0) {		die(MKFS_ERROR, 1, "scandir failed: %s", name);	}	/* process directory */	for (dirindex = 0; dirindex < dircount; dirindex++) {		struct dirent *dirent;		struct entry *entry;		struct stat st;		int size;		size_t namelen;		dirent = dirlist[dirindex];		/* Ignore "." and ".." - we won't be adding them to the archive */		if (dirent->d_name[0] == '.') {			if (dirent->d_name[1] == '\0')				continue;			if (dirent->d_name[1] == '.') {				if (dirent->d_name[2] == '\0')					continue;			}		}		namelen = strlen(dirent->d_name);		if (namelen > MAX_INPUT_NAMELEN) {			die(MKFS_ERROR, 0,				"very long (%u bytes) filename found: %s\n"				"please increase MAX_INPUT_NAMELEN in mkcramfs.c and recompile",				namelen, dirent->d_name);		}		memcpy(endpath, dirent->d_name, namelen + 1);		if (lstat(path, &st) < 0) {			warn_skip = 1;			continue;		}		entry = calloc(1, sizeof(struct entry));		if (!entry) {			die(MKFS_ERROR, 1, "calloc failed");		}		entry->name = strdup(dirent->d_name);		if (!entry->name) {			die(MKFS_ERROR, 1, "strdup failed");		}		/* truncate multi-byte UTF-8 filenames on character boundary */		if (namelen > CRAMFS_MAXPATHLEN) {			namelen = CRAMFS_MAXPATHLEN;			warn_namelen = 1;			/* the first lost byte must not be a trail byte */			while ((entry->name[namelen] & 0xc0) == 0x80) {				namelen--;				/* are we reasonably certain it was UTF-8 ? */				if (entry->name[namelen] < 0x80 || !namelen) {					die(MKFS_ERROR, 0, "cannot truncate filenames not encoded in UTF-8");				}			}			entry->name[namelen] = '\0';		}		entry->mode = st.st_mode;		entry->size = st.st_size;		entry->uid = st.st_uid;		if (entry->uid >= 1 << CRAMFS_UID_WIDTH)			warn_uid = 1;		entry->gid = st.st_gid;		if (entry->gid >= 1 << CRAMFS_GID_WIDTH)			/* TODO: We ought to replace with a default			   gid instead of truncating; otherwise there			   are security problems.  Maybe mode should			   be &= ~070.  Same goes for uid once Linux			   supports >16-bit uids. */			warn_gid = 1;		size = sizeof(struct cramfs_inode) + ((namelen + 3) & ~3);		*fslen_ub += size;		if (S_ISDIR(st.st_mode)) {			entry->size = parse_directory(root_entry, path, &entry->child, fslen_ub);		} else if (S_ISREG(st.st_mode)) {			if (entry->size) {				if (access(path, R_OK) < 0) {					warn_skip = 1;					continue;				}				entry->path = strdup(path);				if (!entry->path) {					die(MKFS_ERROR, 1, "strdup failed");				}				if ((entry->size >= 1 << CRAMFS_SIZE_WIDTH)) {					warn_size = 1;					entry->size = (1 << CRAMFS_SIZE_WIDTH) - 1;				}			}		} else if (S_ISLNK(st.st_mode)) {			entry->uncompressed = malloc(entry->size);			if (!entry->uncompressed) {				die(MKFS_ERROR, 1, "malloc failed");			}			if (readlink(path, entry->uncompressed, entry->size) < 0) {				warn_skip = 1;				continue;			}		} else if (S_ISFIFO(st.st_mode) || S_ISSOCK(st.st_mode)) {			/* maybe we should skip sockets */			entry->size = 0;		} else if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)) {			entry->size = st.st_rdev;			if (entry->size & -(1<<CRAMFS_SIZE_WIDTH))				warn_dev = 1;		} else {			die(MKFS_ERROR, 0, "bogus file type: %s", entry->name);		}		if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {			int blocks = ((entry->size - 1) / blksize + 1);			/* block pointers & data expansion allowance + data */			if (entry->size)				*fslen_ub += (4+26)*blocks + entry->size + 3;		}		/* Link it into the list */		*prev = entry;		prev = &entry->next;		totalsize += size;	}	free(path);	free(dirlist);		/* allocated by scandir() with malloc() */	return totalsize;}/* Returns sizeof(struct cramfs_super), which includes the root inode. */static unsigned int write_superblock(struct entry *root, char *base, int size){	struct cramfs_super *super = (struct cramfs_super *) base;	unsigned int offset = sizeof(struct cramfs_super) + image_length;	offset += opt_pad;	/* 0 if no padding */	super->magic = CRAMFS_MAGIC;	super->flags = CRAMFS_FLAG_FSID_VERSION_2 | CRAMFS_FLAG_SORTED_DIRS;	if (opt_holes)		super->flags |= CRAMFS_FLAG_HOLES;	if (image_length > 0)		super->flags |= CRAMFS_FLAG_SHIFTED_ROOT_OFFSET;	super->size = size;	memcpy(super->signature, CRAMFS_SIGNATURE, sizeof(super->signature));	super->fsid.crc = crc32(0L, Z_NULL, 0);	super->fsid.edition = opt_edition;	super->fsid.blocks = total_blocks;	super->fsid.files = total_nodes;	memset(super->name, 0x00, sizeof(super->name));	if (opt_name)		strncpy(super->name, opt_name, sizeof(super->name));	else		strncpy(super->name, "Compressed", sizeof(super->name));	super->root.mode = root->mode;	super->root.uid = root->uid;	super->root.gid = root->gid;	super->root.size = root->size;	super->root.offset = offset >> 2;	return offset;}static void set_data_offset(struct entry *entry, char *base, unsigned long offset){	struct cramfs_inode *inode = (struct cramfs_inode *) (base + entry->dir_offset);	if ((offset & 3) != 0) {		die(MKFS_ERROR, 0, "illegal offset of %lu bytes", offset);	}	if (offset >= (1 << (2 + CRAMFS_OFFSET_WIDTH))) {		die(MKFS_ERROR, 0, "filesystem too big");	}	inode->offset = (offset >> 2);}/* * TODO: Does this work for chars >= 0x80?  Most filesystems use UTF-8 * encoding for filenames, whereas the console is a single-byte * character set like iso-latin-1. */static void print_node(struct entry *e){	char info[10];	char type = '?';	if (S_ISREG(e->mode)) type = 'f';	else if (S_ISDIR(e->mode)) type = 'd';	else if (S_ISLNK(e->mode)) type = 'l';	else if (S_ISCHR(e->mode)) type = 'c';	else if (S_ISBLK(e->mode)) type = 'b';	else if (S_ISFIFO(e->mode)) type = 'p';

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人avav影音| 亚洲私人黄色宅男| 欧美一区二区三区婷婷月色| 在线中文字幕一区| 成人激情免费网站| 国产成人午夜片在线观看高清观看| 亚洲国产精品久久久久秋霞影院| 综合网在线视频| 国产黑丝在线一区二区三区| 久久电影网站中文字幕| 日本欧洲一区二区| 欧美精品久久久久久久多人混战 | 国产精品一区2区| 精品欧美乱码久久久久久| 91精品国产欧美一区二区18 | 94-欧美-setu| 97久久超碰国产精品| 99视频精品在线| 97久久久精品综合88久久| 一道本成人在线| 亚洲成人一区二区| 日本欧美韩国一区三区| 蜜臀av一级做a爰片久久| 老司机精品视频导航| 国产精品香蕉一区二区三区| 高清久久久久久| 91福利在线免费观看| 欧美高清视频在线高清观看mv色露露十八| 538prom精品视频线放| 日韩激情一区二区| 精品国产乱码久久久久久免费| 日韩一区二区免费视频| 国产免费观看久久| 亚洲嫩草精品久久| 久久se精品一区二区| 成人免费视频免费观看| 91国在线观看| 精品成a人在线观看| 亚洲女性喷水在线观看一区| 日韩电影一区二区三区四区| 久久久国际精品| 夜夜爽夜夜爽精品视频| 麻豆精品视频在线观看免费| 东方aⅴ免费观看久久av| 欧美日韩免费观看一区三区| 26uuu国产日韩综合| 一区二区三区色| 国产精品资源站在线| 欧美专区日韩专区| 国产色产综合产在线视频| 久久99国产精品麻豆| 99久久久久久| 精品少妇一区二区三区在线播放 | 2020国产精品久久精品美国| 一区二区三区在线免费观看| 国产一区二区三区美女| 欧美理论片在线| 色婷婷香蕉在线一区二区| 精品成人在线观看| 青青草国产精品97视觉盛宴| 在线影视一区二区三区| 中文字幕av一区二区三区| 久久国产精品露脸对白| 欧美日韩不卡在线| 一区二区在线免费观看| 不卡的av中国片| 欧美—级在线免费片| 国产亚洲综合在线| 精品一区二区综合| 欧美成人伊人久久综合网| 天天操天天干天天综合网| 欧美在线观看视频一区二区三区| 国产精品视频麻豆| 成人黄页在线观看| 国产精品久久久久久久久免费樱桃 | 一本在线高清不卡dvd| 成人欧美一区二区三区视频网页 | 国产网站一区二区三区| 国产一区二区视频在线| 久久久亚洲综合| 国产馆精品极品| 欧美国产日本韩| 国产精品国产精品国产专区不片| 国产成人在线影院| 国产区在线观看成人精品| 国产成人精品三级麻豆| 国产精品丝袜久久久久久app| gogogo免费视频观看亚洲一| 亚洲人成影院在线观看| 色婷婷综合久久久久中文一区二区| 综合激情成人伊人| 91福利国产成人精品照片| 日韩1区2区3区| 久久99精品国产| 国产精品初高中害羞小美女文 | 精品在线免费观看| 国产精品天天摸av网| 在线观看国产精品网站| 秋霞午夜av一区二区三区| 久久伊人蜜桃av一区二区| 91在线观看地址| 天堂一区二区在线免费观看| 久久久激情视频| 亚洲高清免费观看| 久久久久综合网| 欧美性猛交xxxx乱大交退制版| 青青草成人在线观看| 国产精品美女一区二区三区| 欧美日韩一区不卡| 国产盗摄女厕一区二区三区| 亚洲午夜精品网| 国产无遮挡一区二区三区毛片日本| 91福利国产成人精品照片| 国产一区日韩二区欧美三区| 欧美日韩精品综合在线| 风间由美一区二区av101| 午夜一区二区三区视频| 国产精品久久久久一区二区三区 | 日韩欧美中文一区二区| 色综合色综合色综合色综合色综合| 久久9热精品视频| 亚洲福利一区二区三区| 国产女人18水真多18精品一级做| 欧美日韩精品免费| 91麻豆产精品久久久久久| 久久综合色天天久久综合图片| 欧美日韩视频在线第一区| 91看片淫黄大片一级| 成人深夜在线观看| 国产精品夜夜嗨| 国产美女一区二区三区| 久久成人免费日本黄色| 视频一区国产视频| 亚洲成av人片一区二区三区| 亚洲综合色婷婷| 亚洲欧美日韩国产综合| 国产精品萝li| 99久久综合精品| 国产sm精品调教视频网站| 国产精品一二三区在线| 激情av综合网| 狠狠色狠狠色合久久伊人| 激情综合色丁香一区二区| 日韩精品一二三四| 婷婷丁香激情综合| 午夜av区久久| 日韩精品91亚洲二区在线观看 | 久久久天堂av| 26uuu国产在线精品一区二区| 精品国产91乱码一区二区三区 | 欧美精品一区二区三区很污很色的 | 91麻豆精品国产91久久久久| 欧美久久一区二区| 日韩久久精品一区| 久久久噜噜噜久久人人看| 欧美激情一区二区在线| 亚洲三级电影全部在线观看高清| 亚洲综合色网站| 日韩午夜小视频| 久久蜜臀中文字幕| 日韩一区日韩二区| 丝袜诱惑亚洲看片| 国产精品99久久久久久似苏梦涵| 成人黄色免费短视频| 欧美日韩在线观看一区二区| 精品国产免费视频| 中文字幕亚洲成人| 日韩激情在线观看| 国产成人午夜高潮毛片| 欧洲激情一区二区| 麻豆国产精品一区二区三区| 午夜视黄欧洲亚洲| 国产网站一区二区| 亚洲视频图片小说| 青青草97国产精品免费观看无弹窗版 | 天堂在线亚洲视频| 国产精品18久久久久久久网站| 色婷婷精品大视频在线蜜桃视频| 欧美一区二区三区在线电影| 国产精品情趣视频| 秋霞午夜av一区二区三区| 99视频国产精品| 久久国产乱子精品免费女| 91亚洲精品一区二区乱码| 精品国产乱子伦一区| 亚洲一区二区五区| 丁香桃色午夜亚洲一区二区三区| 777亚洲妇女| 亚洲精品福利视频网站| 懂色中文一区二区在线播放| 日韩欧美国产麻豆| 天堂精品中文字幕在线| 一本大道久久a久久精品综合| 国产农村妇女毛片精品久久麻豆 | 日韩电影在线观看一区| 91麻豆精品在线观看| 久久青草欧美一区二区三区| 日韩不卡一区二区| 欧美精品国产精品| 亚洲网友自拍偷拍|