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

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

?? ldm.c

?? linux和2410結合開發 用他可以生成2410所需的zImage文件
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * ldm - Part of the Linux-NTFS project. * * Copyright (C) 2001 Richard Russon <ldm@flatcap.org> * Copyright (C) 2001 Anton Altaparmakov <antona@users.sf.net> (AIA) * * Documentation is available at http://linux-ntfs.sf.net/ldm * * 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 (in the main directory of the Linux-NTFS source * in the file COPYING); if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * * 28/10/2001 - Added sorting of ldm partitions. (AIA) */#include <linux/types.h>#include <asm/unaligned.h>#include <asm/byteorder.h>#include <linux/genhd.h>#include <linux/blkdev.h>#include <linux/slab.h>#include "check.h"#include "ldm.h"#include "msdos.h"#if 0 /* Fool kernel-doc since it doesn't do macros yet. *//** * ldm_debug - output an error message if debugging was enabled at compile time * @f:		a printf format string containing the message * @...:	the variables to substitute into @f * * ldm_debug() writes a DEBUG level message to the syslog but only if the * driver was compiled with debug enabled. Otherwise, the call turns into a NOP. */static void ldm_debug(const char *f, ...);#endif#ifdef CONFIG_LDM_DEBUG#define ldm_debug(f, a...)						\	{								\		printk(LDM_DEBUG " DEBUG (%s, %d): %s: ",		\				__FILE__, __LINE__, __FUNCTION__);	\		printk(f, ##a);						\	}#else	/* !CONFIG_LDM_DEBUG */#define ldm_debug(f, a...)	do {} while (0)#endif	/* !CONFIG_LDM_DEBUG *//* Necessary forward declarations. */static int create_partition(struct gendisk *, int, int, int);static int parse_privhead(const u8 *, struct privhead *);static u64 get_vnum(const u8 *, int *);static int get_vstr(const u8 *, u8 *, const int);/** * parse_vblk_part - parse a LDM database vblk partition record * @buffer:	vblk partition record loaded from the LDM database * @buf_size:	size of @buffer in bytes * @vb:		in memory vblk structure to return parsed information in * * This parses the LDM database vblk record of type VBLK_PART, i.e. a partition * record, supplied in @buffer and sets up the in memory vblk structure @vb * with the obtained information. * * Return 1 on success and -1 on error, in which case @vb is undefined. */static int parse_vblk_part(const u8 *buffer, const int buf_size,		struct vblk *vb){	int err, rel_objid, rel_name, rel_size, rel_parent;	if (0x34 >= buf_size)		return -1;	/* Calculate relative offsets. */	rel_objid  = 1 + buffer[0x18];	if (0x18 + rel_objid >= buf_size)		return -1;	rel_name   = 1 + buffer[0x18 + rel_objid] + rel_objid;	if (0x34 + rel_name >= buf_size)		return -1;	rel_size   = 1 + buffer[0x34 + rel_name] + rel_name;	if (0x34 + rel_size >= buf_size)		return -1;	rel_parent = 1 + buffer[0x34 + rel_size] + rel_size;	if (0x34 + rel_parent >= buf_size)		return -1;	/* Setup @vb. */	vb->vblk_type    = VBLK_PART;	vb->obj_id       = get_vnum(buffer + 0x18, &err);	if (err || 0x34 + rel_parent + buffer[0x34 + rel_parent] >= buf_size)		return -1;	vb->disk_id      = get_vnum(buffer + 0x34 + rel_parent, &err);	if (err || 0x24 + rel_name + 8 > buf_size)		return -1;	vb->start_sector = BE64(buffer + 0x24 + rel_name);	if (0x34 + rel_name + buffer[0x34 + rel_name] >= buf_size)		return -1;	vb->num_sectors  = get_vnum(buffer + 0x34 + rel_name, &err);	if (err || 0x18 + rel_objid + buffer[0x18 + rel_objid] >= buf_size)		return -1;	err = get_vstr(buffer + 0x18 + rel_objid, vb->name, sizeof(vb->name));	if (err == -1)		return err;	ldm_debug("Parsed Partition VBLK successfully.\n");	return 1;}/** * parse_vblk - parse a LDM database vblk record * @buffer:	vblk record loaded from the LDM database * @buf_size:	size of @buffer in bytes * @vb:		in memory vblk structure to return parsed information in * * This parses the LDM database vblk record supplied in @buffer and sets up * the in memory vblk structure @vb with the obtained information. * * Return 1 on success, 0 if successful but record not in use, and -1 on error. * If the return value is 0 or -1, @vb is undefined. * * NOTE: Currently the only record type we handle is VBLK_PART, i.e. records * describing a partition. For all others, we just set @vb->vblk_type to 0 and * return success. This of course means that if @vb->vblk_type is zero, all * other fields in @vb are undefined. */static int parse_vblk(const u8 *buffer, const int buf_size, struct vblk *vb){	int err = 1;	if (buf_size < 0x14)		return -1;	if (MAGIC_VBLK != BE32(buffer)) {		printk(LDM_CRIT "Cannot find VBLK, database may be corrupt.\n");		return -1;	}	if ((BE16(buffer + 0x0E) == 0) ||       /* Record is not in use. */	    (BE16(buffer + 0x0C) != 0))         /* Part 2 of an ext. record */		return 0;	/* FIXME: What about extended VBLKs? */	switch (buffer[0x13]) {	case VBLK_PART:		err = parse_vblk_part(buffer, buf_size, vb);		break;	default:		vb->vblk_type = 0;	}	if (err != -1)		ldm_debug("Parsed VBLK successfully.\n");	return err;}/** * add_partition_to_list - insert partition into a partition list * @pl:		sorted list of partitions * @hd:		gendisk structure to which the data partition belongs * @disk_minor:	minor number of the disk device * @start:	first sector within the disk device * @size:	number of sectors on the partition device * * This sanity checks the partition specified by @start and @size against the * device specified by @hd and inserts the partition into the sorted partition * list @pl if the checks pass. * * On success return 1, otherwise return -1. * * TODO: Add sanity check for overlapping partitions. (AIA) */ static int add_partition_to_list(struct list_head *pl, const struct gendisk *hd,		const int disk_minor, const unsigned long start,		const unsigned long size){	struct ldm_part *lp, *lptmp;	struct list_head *tmp;	if (!hd->part)		return -1;	if ((start < 1) || ((start + size) > hd->part[disk_minor].nr_sects)) {		printk(LDM_CRIT "LDM partition exceeds physical disk. "				"Skipping.\n");		return -1;	}	lp = (struct ldm_part*)kmalloc(sizeof(struct ldm_part), GFP_KERNEL);	if (!lp) {		printk(LDM_CRIT "Not enough memory! Aborting LDM partition "				"parsing.\n");		return -2;	}	INIT_LIST_HEAD(&lp->part_list);	lp->start = start;	lp->size = size;	list_for_each(tmp, pl) {		lptmp = list_entry(tmp, struct ldm_part, part_list);		if (start > lptmp->start)			continue;		if (start < lptmp->start)			break;		printk(LDM_CRIT "Duplicate LDM partition entry! Skipping.\n");		kfree(lp);		return -1;	}	list_add_tail(&lp->part_list, tmp);	ldm_debug("Added LDM partition successfully.\n");	return 1;}/** * create_data_partitions - create the data partition devices * @hd:			gendisk structure in which to create the data partitions * @first_sector:	first sector within the disk device * @first_part_minor:	first minor number of data partition devices * @dev:		partition device holding the LDM database * @vm:			in memory vmdb structure of @dev * @ph:			in memory privhead structure of the disk device * @dk:			in memory ldmdisk structure of the disk device * * The database contains ALL the partitions for ALL the disks, so we need to * filter out this specific disk. Using the disk's object id, we can find all * the partitions in the database that belong to this disk. * * For each found partition, we create a corresponding partition device starting * with minor number @first_part_minor. But we do this in such a way that we * actually sort the partitions in order of on-disk position. Any invalid * partitions are completely ignored/skipped (an error is output but that's * all). * * Return 1 on success and -1 on error. */static int create_data_partitions(struct gendisk *hd,		const unsigned long first_sector, int first_part_minor,		struct block_device *bdev, const struct vmdb *vm,		const struct privhead *ph, const struct ldmdisk *dk,		unsigned long base){	Sector sect;	unsigned char *data;	struct vblk *vb;	LIST_HEAD(pl);		/* Sorted list of partitions. */	struct ldm_part *lp;	struct list_head *tmp;	int vblk;	int vsize;		/* VBLK size. */	int perbuf;		/* VBLKs per buffer. */	int buffer, lastbuf, lastofs, err, disk_minor;	vb = (struct vblk*)kmalloc(sizeof(struct vblk), GFP_KERNEL);	if (!vb)		goto no_mem;	vsize   = vm->vblk_size;	if (vsize < 1 || vsize > 512)		goto err_out;	perbuf  = 512 / vsize;	if (perbuf < 1 || 512 % vsize)		goto err_out;					/* 512 == VMDB size */	lastbuf = vm->last_vblk_seq / perbuf - 1;	lastofs = vm->last_vblk_seq % perbuf;	if (lastofs)		lastbuf++;	if (OFF_VBLK * LDM_BLOCKSIZE + vm->last_vblk_seq * vsize >			ph->config_size * 512)		goto err_out;	/*	 * Get the minor number of the parent device so we can check we don't	 * go beyond the end of the device.	 */	disk_minor = (first_part_minor >> hd->minor_shift) << hd->minor_shift;	for (buffer = 0; buffer < lastbuf; buffer++) {		data = read_dev_sector(bdev, base + 2*OFF_VBLK + buffer, &sect);		if (!data)			goto read_err;		for (vblk = 0; vblk < perbuf; vblk++) {			u8 *block;						if (lastofs && buffer == lastbuf - 1 && vblk >= lastofs)				break;			block = data + vsize * vblk;			if (block + vsize > data + 512)				goto brelse_out;			if (parse_vblk(block, vsize, vb) != 1)				continue;			if (vb->vblk_type != VBLK_PART)				continue;			if (dk->obj_id != vb->disk_id)				continue;			/* Ignore invalid partition errors. */			if (add_partition_to_list(&pl, hd, disk_minor,					first_sector + vb->start_sector +					ph->logical_disk_start,					vb->num_sectors) < -1)				goto brelse_out;		}		put_dev_sector(sect);	}	err = 1;out:	/* Finally create the nicely sorted data partitions. */	printk(" <");	list_for_each(tmp, &pl) {		lp = list_entry(tmp, struct ldm_part, part_list);		add_gd_partition(hd, first_part_minor++, lp->start, lp->size);	}	printk(" >\n");	if (!list_empty(&pl)) {		struct list_head *tmp2;		/* Cleanup the partition list which is now superfluous. */		list_for_each_safe(tmp, tmp2, &pl) {			lp = list_entry(tmp, struct ldm_part, part_list);			list_del(tmp);			kfree(lp);		}	}	kfree(vb);	return err;brelse_out:	put_dev_sector(sect);	goto err_out;no_mem:	printk(LDM_CRIT "Not enough memory to allocate required buffers.\n");	goto err_out;read_err:	printk(LDM_CRIT "Disk read failed in create_partitions.\n");err_out:	err = -1;	goto out;}/** * get_vnum - convert a variable-width, big endian number, to cpu u64 one * @block:	pointer to the variable-width number to convert * @err:	address of an integer into which to return the error code. * * This converts a variable-width, big endian number into a 64-bit, CPU format * number and returns the result with err set to 0. If an error occurs return 0 * with err set to -1. * * The first byte of a variable-width number is the size of the number in bytes. */static u64 get_vnum(const u8 *block, int *err){	u64 tmp = 0ULL;	u8 length = *block++;	if (length && length <= 8) {		while (length--)			tmp = (tmp << 8) | *block++;		*err = 0;	} else {		printk(LDM_ERR "Illegal length in get_vnum(): %d.\n", length);		*err = 1;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品毛片久久久久久| 国产在线播放一区| 美女高潮久久久| 成人av高清在线| 欧美三级中文字幕在线观看| 精品国产露脸精彩对白| 亚洲精品欧美激情| 韩国三级在线一区| 欧美日韩一区久久| 日韩伦理免费电影| 国产精品中文欧美| 日韩欧美久久久| 亚洲国产欧美在线| 99久久精品国产网站| 精品国产凹凸成av人导航| 亚洲二区视频在线| 一本大道久久a久久综合婷婷 | 91麻豆高清视频| 久久久91精品国产一区二区精品| 日本伊人色综合网| 91久久线看在观草草青青| 中文字幕在线不卡| 国产揄拍国内精品对白| 日韩欧美亚洲国产精品字幕久久久| 亚洲第一会所有码转帖| 色呦呦国产精品| 亚洲女爱视频在线| 91碰在线视频| 中文字幕在线不卡一区二区三区| 国产一区二区三区黄视频 | 制服.丝袜.亚洲.中文.综合| 亚洲日本一区二区| www.爱久久.com| 欧美激情综合五月色丁香| 国产精品综合av一区二区国产馆| 日韩精品一区二区三区四区视频| 日韩激情视频网站| 欧美一二三区在线观看| 免费在线观看精品| 欧美一级日韩免费不卡| 日本系列欧美系列| 日韩写真欧美这视频| 午夜精品福利一区二区三区av | 国产原创一区二区| 国产午夜亚洲精品理论片色戒 | wwwwxxxxx欧美| 麻豆精品久久精品色综合| 欧美一区二区三区啪啪| 美女在线观看视频一区二区| 欧美v亚洲v综合ⅴ国产v| 国产一区二区h| 日本一区二区三区高清不卡| 在线看不卡av| 亚洲一级二级三级在线免费观看| 欧美视频日韩视频| 美国毛片一区二区三区| 欧美国产一区在线| 色婷婷久久99综合精品jk白丝| 一区二区理论电影在线观看| 在线播放欧美女士性生活| 狠狠色丁香九九婷婷综合五月| 国产视频一区二区三区在线观看| 91在线播放网址| 视频一区在线播放| 欧美激情在线观看视频免费| 99在线精品一区二区三区| 一区二区在线看| 欧美成va人片在线观看| 成人激情黄色小说| 午夜国产精品一区| 国产日本亚洲高清| 欧美日本国产一区| 岛国精品一区二区| 亚洲动漫第一页| 欧美激情一区二区三区四区| 91福利视频久久久久| 麻豆成人av在线| 中文字幕一区三区| 91麻豆精品国产91| 国产成人aaa| 日本在线观看不卡视频| 一色屋精品亚洲香蕉网站| 欧美人牲a欧美精品| 成人av片在线观看| 激情综合网天天干| 亚洲成人激情av| 国产精品久久久久一区二区三区| 日本乱人伦aⅴ精品| 国产高清成人在线| 日本aⅴ亚洲精品中文乱码| 国产精品午夜电影| 精品91自产拍在线观看一区| 欧美日韩国产高清一区二区| 国产美女主播视频一区| 亚洲一区二区在线免费观看视频| 久久综合久久综合九色| 欧美日韩一区视频| 91麻豆国产自产在线观看| 丁香网亚洲国际| 蜜桃久久久久久久| 亚洲香蕉伊在人在线观| 国产精品嫩草久久久久| 久久久精品免费观看| 欧美成人免费网站| 日韩三级电影网址| 欧美群妇大交群中文字幕| 色猫猫国产区一区二在线视频| 成人免费高清视频| 国产精品996| 国产精品99久久久久久有的能看| 免费看精品久久片| 久久精品国产亚洲一区二区三区| 亚洲va欧美va人人爽午夜| 亚洲综合久久av| 亚洲男人的天堂一区二区| ●精品国产综合乱码久久久久| 国产精品午夜免费| 国产精品欧美极品| 国产精品久久夜| 亚洲国产视频一区二区| 亚洲免费观看高清完整版在线观看熊| 国产日韩欧美精品一区| 欧美国产精品一区二区| 中文字幕精品—区二区四季| 亚洲精品在线三区| 久久综合给合久久狠狠狠97色69| 精品国产123| 久久综合久久综合久久| 久久精品一区二区| 国产欧美中文在线| 成人欧美一区二区三区黑人麻豆| 亚洲欧美日韩在线| 亚洲成在线观看| 青椒成人免费视频| 国产乱色国产精品免费视频| 成人一区在线看| 99精品视频中文字幕| 在线观看视频一区| 91精品欧美福利在线观看| 日韩欧美www| 国产精品乱码一区二区三区软件| 中文字幕日本乱码精品影院| 一区二区欧美在线观看| 三级亚洲高清视频| 国产伦精一区二区三区| 97se亚洲国产综合自在线| 色婷婷av一区二区| 欧美日韩精品福利| 久久一留热品黄| 日韩毛片视频在线看| 亚洲成人免费影院| 国产麻豆精品95视频| 91麻豆福利精品推荐| 日韩亚洲国产中文字幕欧美| 国产精品美女久久久久久久久 | 丝袜美腿亚洲一区二区图片| 视频一区在线播放| 国产成人av一区二区三区在线| 色综合婷婷久久| 日韩一区二区三区av| 国产精品成人免费| 日本大胆欧美人术艺术动态| 成人av在线一区二区三区| 欧美浪妇xxxx高跟鞋交| 国产偷v国产偷v亚洲高清| 亚洲国产一区在线观看| 国产传媒日韩欧美成人| 51精品秘密在线观看| 一区二区中文视频| 国产在线视视频有精品| 欧美三级日韩三级| 国产精品久久久久婷婷| 精品在线观看视频| 欧美精品 国产精品| 国产精品成人一区二区艾草| 蜜桃av噜噜一区二区三区小说| 色天天综合久久久久综合片| 精品国产成人在线影院| 性做久久久久久免费观看| 99久久久无码国产精品| 久久久久久久久久久99999| 亚洲va国产天堂va久久en| www.爱久久.com| 国产亚洲一区二区在线观看| 热久久国产精品| 欧美偷拍一区二区| 亚洲免费在线电影| www.爱久久.com| 亚洲国产精品精华液2区45| 久久99国产精品久久99果冻传媒| 欧美蜜桃一区二区三区| 亚洲一区二区精品视频| 一本色道久久综合亚洲91| 国产精品久久久久一区二区三区| 国产美女精品在线| 久久久久久久久久久久久夜| 美女性感视频久久| 日韩欧美国产一区二区三区 | 国产精品久久久久久久久免费桃花| 国产一区在线看|