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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mkcramfs.c

?? 制作cramfs文件系統的工具
?? C
?? 第 1 頁 / 共 2 頁
字號:
	else if (S_ISSOCK(e->mode)) type = 's';	if (S_ISCHR(e->mode) || (S_ISBLK(e->mode))) {		/* major/minor numbers can be as high as 2^12 or 4096 */		snprintf(info, 10, "%4d,%4d", major(e->size), minor(e->size));	}	else {		/* size be as high as 2^24 or 16777216 */		snprintf(info, 10, "%9d", e->size);	}	printf("%c %04o %s %5d:%-3d %s\n",	       type, e->mode & ~S_IFMT, info, e->uid, e->gid, e->name);}/* * We do a width-first printout of the directory * entries, using a stack to remember the directories * we've seen. */static unsigned int write_directory_structure(struct entry *entry, char *base, unsigned int offset){	int stack_entries = 0;	int stack_size = 64;	struct entry **entry_stack;	entry_stack = malloc(stack_size * sizeof(struct entry *));	if (!entry_stack) {		die(MKFS_ERROR, 1, "malloc failed");	}	if (opt_verbose) {		printf("root:\n");	}	for (;;) {		int dir_start = stack_entries;		while (entry) {			struct cramfs_inode *inode = (struct cramfs_inode *) (base + offset);			size_t len = strlen(entry->name);			entry->dir_offset = offset;			inode->mode = entry->mode;			inode->uid = entry->uid;			inode->gid = entry->gid;			inode->size = entry->size;			inode->offset = 0;			/* Non-empty directories, regfiles and symlinks will			   write over inode->offset later. */			offset += sizeof(struct cramfs_inode);			total_nodes++;	/* another node */			memcpy(base + offset, entry->name, len);			/* Pad up the name to a 4-byte boundary */			while (len & 3) {				*(base + offset + len) = '\0';				len++;			}			inode->namelen = len >> 2;			offset += len;			if (opt_verbose)				print_node(entry);			if (entry->child) {				if (stack_entries >= stack_size) {					stack_size *= 2;					entry_stack = realloc(entry_stack, stack_size * sizeof(struct entry *));					if (!entry_stack) {						die(MKFS_ERROR, 1, "realloc failed");					}				}				entry_stack[stack_entries] = entry;				stack_entries++;			}			entry = entry->next;		}		/*		 * Reverse the order the stack entries pushed during		 * this directory, for a small optimization of disk		 * access in the created fs.  This change makes things		 * `ls -UR' order.		 */		{			struct entry **lo = entry_stack + dir_start;			struct entry **hi = entry_stack + stack_entries;			struct entry *tmp;			while (lo < --hi) {				tmp = *lo;				*lo++ = *hi;				*hi = tmp;			}		}		/* Pop a subdirectory entry from the stack, and recurse. */		if (!stack_entries)			break;		stack_entries--;		entry = entry_stack[stack_entries];		set_data_offset(entry, base, offset);		if (opt_verbose) {			printf("%s:\n", entry->name);		}		entry = entry->child;	}	free(entry_stack);	return offset;}static int is_zero(char const *begin, unsigned len){	/* Returns non-zero iff the first LEN bytes from BEGIN are all NULs. */	return (len-- == 0 ||		(begin[0] == '\0' &&		 (len-- == 0 ||		  (begin[1] == '\0' &&		   (len-- == 0 ||		    (begin[2] == '\0' &&		     (len-- == 0 ||		      (begin[3] == '\0' &&		       memcmp(begin, begin + 4, len) == 0))))))));}/* * One 4-byte pointer per block and then the actual blocked * output. The first block does not need an offset pointer, * as it will start immediately after the pointer block; * so the i'th pointer points to the end of the i'th block * (i.e. the start of the (i+1)'th block or past EOF). * * Note that size > 0, as a zero-sized file wouldn't ever * have gotten here in the first place. */static unsigned int do_compress(char *base, unsigned int offset, char const *name, char *uncompressed, unsigned int size){	unsigned long original_size = size;	unsigned long original_offset = offset;	unsigned long new_size;	unsigned long blocks = (size - 1) / blksize + 1;	unsigned long curr = offset + 4 * blocks;	int change;	total_blocks += blocks;	do {		unsigned long len = 2 * blksize;		unsigned int input = size;		int err;		if (input > blksize)			input = blksize;		size -= input;		if (!(opt_holes && is_zero (uncompressed, input))) {			err = compress2(base + curr, &len, uncompressed, input, Z_BEST_COMPRESSION);			if (err != Z_OK) {				die(MKFS_ERROR, 0, "compression error: %s", zError(err));			}			curr += len;		}		uncompressed += input;		if (len > blksize*2) {			/* (I don't think this can happen with zlib.) */			die(MKFS_ERROR, 0, "AIEEE: block \"compressed\" to > 2*blocklength (%ld)", len);		}		*(u32 *) (base + offset) = curr;		offset += 4;	} while (size);	curr = (curr + 3) & ~3;	new_size = curr - original_offset;	/* TODO: Arguably, original_size in these 2 lines should be	   st_blocks * 512.  But if you say that then perhaps	   administrative data should also be included in both. */	change = new_size - original_size;	if (opt_verbose > 1) {		printf("%6.2f%% (%+d bytes)\t%s\n",		       (change * 100) / (double) original_size, change, name);	}	return curr;}/* * Traverse the entry tree, writing data for every item that has * non-null entry->path (i.e. every non-empty regfile) and non-null * entry->uncompressed (i.e. every symlink). */static unsigned int write_data(struct entry *entry, char *base, unsigned int offset){	do {		if (entry->path || entry->uncompressed) {			if (entry->same) {				set_data_offset(entry, base, entry->same->offset);				entry->offset = entry->same->offset;			}			else {				set_data_offset(entry, base, offset);				entry->offset = offset;				map_entry(entry);				offset = do_compress(base, offset, entry->name, entry->uncompressed, entry->size);				unmap_entry(entry);			}		}		else if (entry->child)			offset = write_data(entry->child, base, offset);		entry=entry->next;	} while (entry);	return offset;}static unsigned int write_file(char *file, char *base, unsigned int offset){	int fd;	char *buf;	fd = open(file, O_RDONLY);	if (fd < 0) {		die(MKFS_ERROR, 1, "open failed: %s", file);	}	buf = mmap(NULL, image_length, PROT_READ, MAP_PRIVATE, fd, 0);	if (buf == MAP_FAILED) {		die(MKFS_ERROR, 1, "mmap failed");	}	memcpy(base + offset, buf, image_length);	munmap(buf, image_length);	close (fd);	/* Pad up the image_length to a 4-byte boundary */	while (image_length & 3) {		*(base + offset + image_length) = '\0';		image_length++;	}	return (offset + image_length);}int main(int argc, char **argv){	struct stat st;		/* used twice... */	struct entry *root_entry;	char *rom_image;	ssize_t offset, written;	int fd;	/* initial guess (upper-bound) of required filesystem size */	loff_t fslen_ub = sizeof(struct cramfs_super);	char const *dirname, *outfile;	u32 crc;	int c;			/* for getopt */	char *ep;		/* for strtoul */	total_blocks = 0;	if (argc)		progname = argv[0];	/* command line options */	while ((c = getopt(argc, argv, "hEe:i:n:psvz")) != EOF) {		switch (c) {		case 'h':			usage(MKFS_OK);		case 'E':			opt_errors = 1;			break;		case 'e':			errno = 0;			opt_edition = strtoul(optarg, &ep, 10);			if (errno || optarg[0] == '\0' || *ep != '\0')				usage(MKFS_USAGE);			break;		case 'i':			opt_image = optarg;			if (lstat(opt_image, &st) < 0) {				die(MKFS_ERROR, 1, "lstat failed: %s", opt_image);			}			image_length = st.st_size; /* may be padded later */			fslen_ub += (image_length + 3); /* 3 is for padding */			break;		case 'n':			opt_name = optarg;			break;		case 'p':			opt_pad = PAD_SIZE;			fslen_ub += PAD_SIZE;			break;		case 's':			/* old option, ignored */			break;		case 'v':			opt_verbose++;			break;		case 'z':			opt_holes = 1;			break;		}	}	if ((argc - optind) != 2)		usage(MKFS_USAGE);	dirname = argv[optind];	outfile = argv[optind + 1];	if (stat(dirname, &st) < 0) {		die(MKFS_USAGE, 1, "stat failed: %s", dirname);	}	fd = open(outfile, O_WRONLY | O_CREAT | O_TRUNC, 0666);	if (fd < 0) {		die(MKFS_USAGE, 1, "open failed: %s", outfile);	}	root_entry = calloc(1, sizeof(struct entry));	if (!root_entry) {		die(MKFS_ERROR, 1, "calloc failed");	}	root_entry->mode = st.st_mode;	root_entry->uid = st.st_uid;	root_entry->gid = st.st_gid;	root_entry->size = parse_directory(root_entry, dirname, &root_entry->child, &fslen_ub);	/* always allocate a multiple of blksize bytes because that's	   what we're going to write later on */	fslen_ub = ((fslen_ub - 1) | (blksize - 1)) + 1;	if (fslen_ub > MAXFSLEN) {		fprintf(stderr,			"warning: estimate of required size (upper bound) is %LdMB, but maximum image size is %uMB, we might die prematurely\n",			fslen_ub >> 20,			MAXFSLEN >> 20);		fslen_ub = MAXFSLEN;	}	/* find duplicate files. TODO: uses the most inefficient algorithm	   possible. */	eliminate_doubles(root_entry, root_entry);	/* TODO: Why do we use a private/anonymous mapping here	   followed by a write below, instead of just a shared mapping	   and a couple of ftruncate calls?  Is it just to save us	   having to deal with removing the file afterwards?  If we	   really need this huge anonymous mapping, we ought to mmap	   in smaller chunks, so that the user doesn't need nn MB of	   RAM free.  If the reason is to be able to write to	   un-mmappable block devices, then we could try shared mmap	   and revert to anonymous mmap if the shared mmap fails. */	rom_image = mmap(NULL, fslen_ub?fslen_ub:1, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);	if (rom_image == MAP_FAILED) {		die(MKFS_ERROR, 1, "mmap failed");	}	/* Skip the first opt_pad bytes for boot loader code */	offset = opt_pad;	memset(rom_image, 0x00, opt_pad);	/* Skip the superblock and come back to write it later. */	offset += sizeof(struct cramfs_super);	/* Insert a file image. */	if (opt_image) {		printf("Including: %s\n", opt_image);		offset = write_file(opt_image, rom_image, offset);	}	offset = write_directory_structure(root_entry->child, rom_image, offset);	printf("Directory data: %d bytes\n", offset);	offset = write_data(root_entry, rom_image, offset);	/* We always write a multiple of blksize bytes, so that	   losetup works. */	offset = ((offset - 1) | (blksize - 1)) + 1;	printf("Everything: %d kilobytes\n", offset >> 10);	/* Write the superblock now that we can fill in all of the fields. */	write_superblock(root_entry, rom_image+opt_pad, offset);	printf("Super block: %d bytes\n", sizeof(struct cramfs_super));	/* Put the checksum in. */	crc = crc32(0L, Z_NULL, 0);	crc = crc32(crc, (rom_image+opt_pad), (offset-opt_pad));	((struct cramfs_super *) (rom_image+opt_pad))->fsid.crc = crc;	printf("CRC: %x\n", crc);	/* Check to make sure we allocated enough space. */	if (fslen_ub < offset) {		die(MKFS_ERROR, 0, "not enough space allocated for ROM image (%Ld allocated, %d used)", fslen_ub, offset);	}	written = write(fd, rom_image, offset);	if (written < 0) {		die(MKFS_ERROR, 1, "write failed");	}	if (offset != written) {		die(MKFS_ERROR, 0, "ROM image write failed (wrote %d of %d bytes)", written, offset);	}	/* (These warnings used to come at the start, but they scroll off the	   screen too quickly.) */	if (warn_namelen)		fprintf(stderr, /* bytes, not chars: think UTF-8. */			"warning: filenames truncated to %d bytes (possibly less if multi-byte UTF-8)\n",			CRAMFS_MAXPATHLEN);	if (warn_skip)		fprintf(stderr, "warning: files were skipped due to errors\n");	if (warn_size)		fprintf(stderr,			"warning: file sizes truncated to %luMB (minus 1 byte)\n",			1L << (CRAMFS_SIZE_WIDTH - 20));	if (warn_uid) /* (not possible with current Linux versions) */		fprintf(stderr,			"warning: uids truncated to %u bits (this may be a security concern)\n",			CRAMFS_UID_WIDTH);	if (warn_gid)		fprintf(stderr,			"warning: gids truncated to %u bits (this may be a security concern)\n",			CRAMFS_GID_WIDTH);	if (warn_dev)		fprintf(stderr,			"WARNING: device numbers truncated to %u bits (this almost certainly means\n"			"that some device files will be wrong)\n",			CRAMFS_OFFSET_WIDTH);	if (opt_errors &&	    (warn_namelen||warn_skip||warn_size||warn_uid||warn_gid||warn_dev))		exit(MKFS_ERROR);	exit(MKFS_OK);}/* * Local variables: * c-file-style: "linux" * End: */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲乱码国产乱码精品精98午夜| 国产精品影视在线观看| av电影在线观看一区| 奇米影视一区二区三区| 亚洲欧美激情插| 中文字幕在线观看不卡| 精品女同一区二区| 91久久久免费一区二区| 成人深夜视频在线观看| 精品亚洲成a人| 日韩电影免费在线| 亚洲影院在线观看| 亚洲乱码中文字幕| 国产精品高潮呻吟| 国产精品乱子久久久久| 久久久久久久网| 欧美白人最猛性xxxxx69交| 欧美精品第1页| 色老汉av一区二区三区| 色视频欧美一区二区三区| 成人综合激情网| av中文字幕亚洲| 不卡av在线网| 色综合视频在线观看| 成人国产免费视频| 成人h动漫精品一区二区| 成人性生交大片免费看中文| 亚洲成人一区在线| 亚洲专区一二三| 麻豆成人免费电影| 99麻豆久久久国产精品免费| 欧美三级中文字幕在线观看| 日韩免费性生活视频播放| 欧美激情艳妇裸体舞| 一区二区三区在线观看欧美| 蜜乳av一区二区| 成人a区在线观看| 欧美福利一区二区| 国产精品色哟哟| 日本欧美一区二区三区| 成人精品电影在线观看| 欧美理论电影在线| 国产精品不卡一区| 秋霞午夜鲁丝一区二区老狼| 成人av中文字幕| 884aa四虎影成人精品一区| 国产清纯美女被跳蛋高潮一区二区久久w| 亚洲国产成人午夜在线一区| 午夜精品影院在线观看| 国产精品一区二区在线看| 欧美日韩成人一区| 亚洲国产成人自拍| 美日韩一区二区| 在线精品国精品国产尤物884a | www激情久久| 亚洲黄色录像片| 高清免费成人av| 日韩免费高清av| 视频在线在亚洲| 色哦色哦哦色天天综合| 中文字幕免费不卡在线| 韩国午夜理伦三级不卡影院| 欧美日韩成人综合| 亚洲国产视频一区| 色婷婷久久久久swag精品| 中文幕一区二区三区久久蜜桃| 美女视频一区二区三区| 色老综合老女人久久久| 国产精品美女久久久久久久久久久| 日本视频中文字幕一区二区三区| 91高清在线观看| 亚洲人快播电影网| 菠萝蜜视频在线观看一区| 久久精品一区二区三区av| 激情综合色综合久久综合| 日韩精品一区二区三区视频 | 亚洲男人的天堂在线观看| 国产成人综合网站| 久久精品在线免费观看| 国产成人在线视频网站| 国产精品青草久久| eeuss鲁片一区二区三区在线看| 久久免费国产精品| 豆国产96在线|亚洲| 欧美激情一区在线观看| 99久久er热在这里只有精品66| 中文一区二区在线观看| 成人av网站在线| 亚洲三级小视频| 欧美中文一区二区三区| 亚洲国产成人porn| 欧美一激情一区二区三区| 日本不卡高清视频| 欧美精品一区二区三区高清aⅴ| 国产自产高清不卡| 国产精品久久久久久久久晋中 | 久久精品人人做人人爽人人| 狠狠v欧美v日韩v亚洲ⅴ| 国产亚洲精品免费| 99精品视频在线播放观看| 亚洲自拍偷拍欧美| 日韩三级视频中文字幕| 国产成人av资源| 日韩毛片精品高清免费| 欧美日韩电影在线| 国产裸体歌舞团一区二区| 中文字幕一区日韩精品欧美| 欧美探花视频资源| 韩国毛片一区二区三区| 亚洲三级小视频| 欧美一级生活片| av爱爱亚洲一区| 人人爽香蕉精品| 椎名由奈av一区二区三区| 91精品国产综合久久久蜜臀粉嫩 | 一区二区三区四区视频精品免费 | 国产亚洲欧美日韩在线一区| 99re这里只有精品首页| 日产精品久久久久久久性色| 国产欧美va欧美不卡在线| 欧美人与z0zoxxxx视频| 岛国一区二区在线观看| 丝袜美腿亚洲色图| 亚洲欧美视频在线观看视频| 久久久一区二区三区| 欧美日韩在线免费视频| 成人三级伦理片| 久久精品国产亚洲高清剧情介绍| 国产精品激情偷乱一区二区∴| 日韩美女一区二区三区| 欧美日韩视频一区二区| 成人丝袜18视频在线观看| 久久国产精品免费| 日韩影院在线观看| 亚洲免费观看高清完整| 国产欧美一区二区精品性| 欧美一级黄色片| 欧美在线视频你懂得| 不卡的电影网站| 国产成+人+日韩+欧美+亚洲 | 久久久久久久久免费| 51精品秘密在线观看| 色婷婷综合五月| 国产成人夜色高潮福利影视| 蜜桃一区二区三区四区| 日本中文在线一区| 天天av天天翘天天综合网 | 精品乱码亚洲一区二区不卡| 欧美日韩美女一区二区| 91久久精品网| 色婷婷av一区二区三区大白胸| 不卡视频免费播放| 波多野结衣中文字幕一区| 国产精品亚洲第一区在线暖暖韩国| 激情图片小说一区| 激情av综合网| 国产一区二区三区久久久| 精品一区二区三区在线播放| 免费成人你懂的| 久久精品国产秦先生| 麻豆精品一区二区av白丝在线| 免费在线成人网| 久久国产欧美日韩精品| 国产乱码精品一品二品| 国产成人在线电影| 99久久久久久99| 欧美视频一区在线| 欧美日韩性生活| 日韩欧美一区二区在线视频| 精品福利一二区| 久久久99精品久久| 国产精品午夜电影| 亚洲欧美日韩在线| 亚洲成人精品影院| 美女国产一区二区三区| 国产馆精品极品| 91论坛在线播放| 欧美日韩不卡视频| 精品国产乱码久久久久久久| 中文幕一区二区三区久久蜜桃| 亚洲视频每日更新| 日韩电影免费在线看| 国产91露脸合集magnet| 一本一本久久a久久精品综合麻豆| 欧美性猛交xxxx乱大交退制版| 欧美挠脚心视频网站| 久久精品视频免费| 亚洲一线二线三线视频| 韩国在线一区二区| 色先锋资源久久综合| 欧美变态tickle挠乳网站| 亚洲视频精选在线| 日韩精品高清不卡| a级精品国产片在线观看| 欧美精品久久一区| 亚洲视频在线观看一区| 麻豆成人av在线| 色综合中文字幕国产| 欧美精品三级日韩久久| 日本一区二区三级电影在线观看|