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

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

?? ldm.c

?? ARM 嵌入式 系統 設計與實例開發 實驗教材 二源碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
	if (err != 1)		printk(LDM_CRIT "First and third TOCBLOCKs don't match.\n");	else		ldm_debug("Validated TOCBLOCKs successfully.\n");out:	kfree(toc2);	kfree(toc3);	kfree(toc4);	return err;no_mem:	printk(LDM_CRIT "Not enough memory to allocate required buffers.\n");err_out:	err = -1;	goto out;}/** * compare_privheads - compare two privheads * @ph1:	first privhead * @ph2:	second privhead * * This compares the two privheads @ph1 and @ph2. * * Return 1 if @ph1 and @ph2 are equal and -1 otherwise. */static int compare_privheads(const struct privhead *ph1,		const struct privhead *ph2){	if ((ph1->ver_major == ph2->ver_major)			 &&	    (ph1->ver_minor == ph2->ver_minor)			 &&	    (ph1->logical_disk_start == ph2->logical_disk_start) &&	    (ph1->logical_disk_size  == ph2->logical_disk_size)	 &&	    (ph1->config_start == ph2->config_start)		 &&	    (ph1->config_size  == ph2->config_size)		 &&	    !strncmp(ph1->disk_id, ph2->disk_id, sizeof(ph1->disk_id)))		return 1;	return -1;}/** * validate_privheads - compare the privhead backups to the first one * @dev:	partition device holding the LDM database * @ph1:	first privhead which we have already validated before * * We already have one privhead from the beginning of the disk. * Now we compare the two other copies for safety. * * Return 1 on succes and -1 on error. */static int validate_privheads(struct block_device *bdev,			      const struct privhead *ph1,			      unsigned long base){	Sector sect;	unsigned char *data;	struct privhead *ph2 = NULL, *ph3 = NULL;	int err;	ph2 = (struct privhead*)kmalloc(sizeof(*ph2), GFP_KERNEL);	if (!ph2)		goto no_mem;	ph3 = (struct privhead*)kmalloc(sizeof(*ph3), GFP_KERNEL);	if (!ph3)		goto no_mem;	data = read_dev_sector(bdev, base + OFF_PRIVHEAD2 * 2, &sect);	if (!data) {		printk(LDM_CRIT "Disk read 1 failed in validate_privheads.\n");		goto err_out;	}	err = parse_privhead(data, ph2);	put_dev_sector(sect);	if (err != 1)		goto out;	data = read_dev_sector(bdev, base + OFF_PRIVHEAD3 * 2 + 1, &sect);	if (!data) {		printk(LDM_CRIT "Disk read 2 failed in validate_privheads.\n");		goto err_out;	}	err = parse_privhead(data, ph3);	put_dev_sector(sect);	if (err != 1)		goto out;	err = compare_privheads(ph1, ph2);	if (err != 1) {		printk(LDM_CRIT "First and second PRIVHEADs don't match.\n");		goto out;	}	err = compare_privheads(ph1, ph3);	if (err != 1)		printk(LDM_CRIT "First and third PRIVHEADs don't match.\n");	else		/* We _could_ have checked more. */		ldm_debug("Validated PRIVHEADs successfully.\n");out:	kfree(ph2);	kfree(ph3);	return err;no_mem:	printk(LDM_CRIT "Not enough memory to allocate required buffers.\n");err_out:	err = -1;	goto out;}/** * create_partition - validate input and create a kernel partition device * @hd:		gendisk structure in which to create partition * @minor:	minor number for device to create * @start:	starting offset of the partition into the parent device * @size:	size of the partition * * This validates the range, then puts an entry into the kernel's partition * table. * * @start and @size are numbers of sectors. * * Return 1 on succes and -1 on error. */static int create_partition(struct gendisk *hd, const int minor,		const int start, const int size){	int disk_minor;	if (!hd->part)		return -1;	/*	 * Get the minor number of the parent device so we can check we don't	 * go beyond the end of the device.	 */	disk_minor = (minor >> hd->minor_shift) << hd->minor_shift;	if ((start < 1) || ((start + size) > hd->part[disk_minor].nr_sects)) {		printk(LDM_CRIT "LDM Partition exceeds physical disk. "				"Aborting.\n");		return -1;	}	add_gd_partition(hd, minor, start, size);	ldm_debug("Created partition successfully.\n");	return 1;}/** * parse_privhead - parse the LDM database PRIVHEAD structure * @buffer:	LDM database privhead structure loaded from the device * @ph:		in memory privhead structure to return parsed information in * * This parses the LDM database PRIVHEAD structure supplied in @buffer and * sets up the in memory privhead structure @ph with the obtained information. * * Return 1 on succes and -1 on error, in which case @ph is undefined. */static int parse_privhead(const u8 *buffer, struct privhead *ph){	if (MAGIC_PRIVHEAD != BE64(buffer)) {		printk(LDM_ERR "Cannot find PRIVHEAD structure. LDM database "				"is corrupt. Aborting.\n");		return -1;	}	ph->ver_major = BE16(buffer + 0x000C);	ph->ver_minor = BE16(buffer + 0x000E);	if ((ph->ver_major != 2) || (ph->ver_minor != 11)) {		printk(LDM_ERR "Expected PRIVHEAD version %d.%d, got %d.%d. "				"Aborting.\n", 2, 11, ph->ver_major,				ph->ver_minor);		return -1;	}	ph->config_start = BE64(buffer + 0x012B);	ph->config_size  = BE64(buffer + 0x0133);	if (ph->config_size != LDM_DB_SIZE) {	/* 1 MiB in sectors. */		printk(LDM_ERR "Database should be %u bytes, claims to be %Lu "				"bytes. Aborting.\n", LDM_DB_SIZE,				ph->config_size);		return -1;	}	ph->logical_disk_start = BE64(buffer + 0x011B);	ph->logical_disk_size  = BE64(buffer + 0x0123);	if (!ph->logical_disk_size ||	    ph->logical_disk_start + ph->logical_disk_size > ph->config_start)		return -1;	memcpy(ph->disk_id, buffer + 0x0030, sizeof(ph->disk_id));	ldm_debug("Parsed PRIVHEAD successfully.\n");	return 1;}/** * create_db_partition - create a dedicated partition for our database * @hd:		gendisk structure in which to create partition * @dev:	device of which to create partition * @ph:		@dev's LDM database private header * * Find the primary private header, locate the LDM database, then create a * partition to wrap it. * * Return 1 on succes, 0 if device is not a dynamic disk and -1 on error. */static int create_db_partition(struct gendisk *hd, struct block_device *bdev,		const unsigned long first_sector, const int first_part_minor,		struct privhead *ph){	Sector sect;	unsigned char *data;	int err;	data = read_dev_sector(bdev, OFF_PRIVHEAD1*2, &sect);	if (!data) {		printk(LDM_CRIT __FUNCTION__ "(): Device read failed.\n");		return -1;	}	if (BE64(data) != MAGIC_PRIVHEAD) {		ldm_debug("Cannot find PRIVHEAD structure. Not a dynamic disk "				"or corrupt LDM database.\n");		return 0;	}	err = parse_privhead(data, ph);	if (err == 1)		err = create_partition(hd, first_part_minor, first_sector +				ph->config_start, ph->config_size);	put_dev_sector(sect);	return err;}/** * validate_patition_table - check whether @dev is a dynamic disk * @dev:	device to test * * Check whether @dev is a dynamic disk by looking for an MS-DOS-style partition * table with one or more entries of type 0x42 (the former Secure File System * (Landis) partition type, now recycled by Microsoft for dynamic disks) in it. * If this succeeds we assume we have a dynamic disk, and not otherwise. * * Return 1 if @dev is a dynamic disk, 0 if not and -1 on error. */static int validate_partition_table(struct block_device *bdev){	Sector sect;	unsigned char *data;	struct partition *p;	int i, nr_sfs;	data = read_dev_sector(bdev, 0, &sect);	if (!data)		return -1;	if (*(u16*)(data + 0x01FE) != cpu_to_le16(MSDOS_LABEL_MAGIC)) {		ldm_debug("No MS-DOS partition found.\n");		goto no_msdos_partition;	}	nr_sfs = 0;	p = (struct partition*)(data + 0x01BE);	for (i = 0; i < 4; i++) {		if (!SYS_IND(p+i) || SYS_IND(p+i) == WIN2K_EXTENDED_PARTITION)			continue;		if (SYS_IND(p+i) == WIN2K_DYNAMIC_PARTITION) {			nr_sfs++;			continue;		}		goto not_dynamic_disk;	}	if (!nr_sfs)		goto not_dynamic_disk;	ldm_debug("Parsed partition table successfully.\n");	put_dev_sector(sect);	return 1;not_dynamic_disk://	ldm_debug("Found basic MS-DOS partition, not a dynamic disk.\n");no_msdos_partition:	put_dev_sector(sect);	return 0;}/** * ldm_partition - find out whether a device is a dynamic disk and handle it * @hd:			gendisk structure in which to return the handled disk * @dev:		device we need to look at * @first_sector:	first sector within the device * @first_part_minor:	first minor number of partitions for the device * * Description: * * This determines whether the device @dev is a dynamic disk and if so creates * the partitions necessary in the gendisk structure pointed to by @hd. * * We create a dummy device 1, which contains the LDM database, we skip * devices 2-4 and then create each partition described by the LDM database * in sequence as devices 5 and following. For example, if the device is hda, * we would have: hda1: LDM database, hda2-4: nothing, hda5-following: the * actual data containing partitions. * * Return values: * *	 1 if @dev is a dynamic disk and we handled it, *	 0 if @dev is not a dynamic disk, *	-1 if an error occured. */int ldm_partition(struct gendisk *hd, struct block_device *bdev,		unsigned long first_sector, int first_part_minor){	struct privhead *ph  = NULL;	struct tocblock *toc = NULL;	struct vmdb     *vm  = NULL;	struct ldmdisk  *dk  = NULL;	unsigned long db_first;	int err;	if (!hd)		return 0;	/* Check the partition table. */	err = validate_partition_table(bdev);	if (err != 1)		return err;	if (!(ph = (struct privhead*)kmalloc(sizeof(*ph), GFP_KERNEL)))		goto no_mem;	/* Create the LDM database device. */	err = create_db_partition(hd, bdev, first_sector, first_part_minor, ph);	if (err != 1)		goto out;	db_first = hd->part[first_part_minor].start_sect;	/* Check the backup privheads. */	err = validate_privheads(bdev, ph, db_first);	if (err != 1)		goto out;	/* Check the table of contents and its backups. */	if (!(toc = (struct tocblock*)kmalloc(sizeof(*toc), GFP_KERNEL)))		goto no_mem;	err = validate_tocblocks(bdev, toc, db_first);	if (err != 1)		goto out;	/* Check the vmdb. */	if (!(vm = (struct vmdb*)kmalloc(sizeof(*vm), GFP_KERNEL)))		goto no_mem;	err = validate_vmdb(bdev, vm, db_first);	if (err != 1)		goto out;	/* Find the object id for @dev in the LDM database. */	if (!(dk = (struct ldmdisk*)kmalloc(sizeof(*dk), GFP_KERNEL)))		goto no_mem;	err = get_disk_objid(bdev, vm, ph, dk, db_first);	if (err != 1)		goto out;	/* Finally, create the data partition devices. */	err = create_data_partitions(hd, first_sector, first_part_minor +			LDM_FIRST_PART_OFFSET, bdev, vm, ph, dk, db_first);	if (err == 1)		ldm_debug("Parsed LDM database successfully.\n");out:	kfree(ph);	kfree(toc);	kfree(vm);	kfree(dk);	return err;no_mem:	printk(LDM_CRIT "Not enough memory to allocate required buffers.\n");	err = -1;	goto out;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色综合久久综合网97色综合| 337p亚洲精品色噜噜狠狠| 欧美三级午夜理伦三级中视频| 国产精品伦理一区二区| 日韩和的一区二区| 成人av一区二区三区| 精品日产卡一卡二卡麻豆| 亚洲一区二区在线免费看| 成人夜色视频网站在线观看| 日韩精品一区二区在线观看| 亚洲一区av在线| 色综合久久久久综合99| 欧美国产亚洲另类动漫| 久久99精品久久久久婷婷| 欧美精品免费视频| 亚洲女性喷水在线观看一区| 成人国产一区二区三区精品| 精品噜噜噜噜久久久久久久久试看| 五月天一区二区三区| 欧美亚洲动漫精品| 亚洲另类在线一区| 97成人超碰视| 国产精品美女久久久久久久 | 欧美精品久久一区二区三区| 亚洲品质自拍视频| 99久久99久久综合| 国产精品卡一卡二| 成人av综合一区| 欧美激情中文不卡| 国产成人鲁色资源国产91色综| 久久综合久久99| 国产一区二区三区免费| 久久色成人在线| 国产精品影视在线观看| 久久女同性恋中文字幕| 丁香婷婷综合色啪| 国产精品日韩精品欧美在线| av在线不卡网| 午夜一区二区三区视频| 欧美日韩你懂得| 免费高清在线视频一区·| 日韩久久久精品| 国产成人在线观看| 亚洲婷婷国产精品电影人久久| 一本色道综合亚洲| 亚洲成人免费在线| 欧美成人综合网站| 国产91丝袜在线播放九色| 中文字幕字幕中文在线中不卡视频| 亚洲天堂福利av| 秋霞国产午夜精品免费视频| 欧美第一区第二区| 成人91在线观看| 亚洲综合色成人| 日韩一区二区三区电影在线观看| 蜜桃一区二区三区在线观看| 国产无一区二区| av中文字幕不卡| 日韩激情视频在线观看| 久久久一区二区三区| 色哟哟精品一区| 日本免费在线视频不卡一不卡二| 国产亚洲欧洲997久久综合 | 欧美精品一二三四| 国产激情一区二区三区桃花岛亚洲| 亚洲人成影院在线观看| 欧美精品一二三| 成人免费视频一区二区| 五月天亚洲婷婷| 国产精品视频yy9299一区| 欧美日韩国产一级| 国产99久久久国产精品免费看| 午夜私人影院久久久久| 国产欧美日本一区视频| 欧美高清精品3d| youjizz国产精品| 久久精品国产久精国产| 亚洲免费观看高清完整版在线观看 | 亚洲国产色一区| 亚洲二区视频在线| 欧美电影在线免费观看| 国产精品一二二区| 婷婷久久综合九色综合伊人色| 中文一区二区完整视频在线观看| 欧美日韩精品三区| 色综合久久天天综合网| 精品一区二区在线视频| 首页综合国产亚洲丝袜| 亚洲人吸女人奶水| 国产精品你懂的在线| 精品国精品自拍自在线| 欧美日韩国产片| 在线观看国产91| 成人av网站免费观看| 国产毛片精品国产一区二区三区| 午夜精品123| 亚洲制服丝袜在线| 亚洲精品视频自拍| 亚洲日本欧美天堂| 国产精品高潮久久久久无| 久久精品视频免费观看| 精品免费国产二区三区 | 欧美天堂一区二区三区| 91网站在线播放| 日韩一区二区精品在线观看| 国产91精品一区二区麻豆亚洲| 午夜久久福利影院| 亚洲午夜久久久久久久久久久| 国产精品乱码妇女bbbb| 久久丝袜美腿综合| 日本一区二区免费在线 | 国产视频在线观看一区二区三区| 欧美一区二区三区的| 欧美疯狂做受xxxx富婆| 欧美美女喷水视频| 欧美另类变人与禽xxxxx| 欧美日韩国产影片| 91麻豆精品国产91久久久| 欧美日韩亚洲丝袜制服| 欧美精品 日韩| 日韩一级视频免费观看在线| 91黄色激情网站| caoporm超碰国产精品| 99精品桃花视频在线观看| 色综合天天天天做夜夜夜夜做| 色综合久久久久综合| 在线观看视频一区二区欧美日韩| 精品裸体舞一区二区三区| 精品欧美一区二区在线观看| 国产午夜亚洲精品羞羞网站| 国产精品久久久久一区 | 国产精品国产三级国产aⅴ入口| 中文字幕亚洲一区二区av在线| 国产精品成人网| 一区二区三区四区不卡在线| 天堂久久久久va久久久久| 美女在线观看视频一区二区| 国产精品自拍在线| 99久久精品国产一区二区三区| 欧洲一区在线观看| 精品少妇一区二区三区在线播放| 久久久亚洲高清| 亚洲精品一卡二卡| 久久精品国产网站| 99视频国产精品| 欧美一区二区三区免费视频| 久久精品亚洲精品国产欧美kt∨| 中文字幕日韩欧美一区二区三区| 国产日韩精品一区| 亚洲色图20p| 麻豆久久一区二区| 成人黄动漫网站免费app| 欧美日韩精品一区二区| 久久亚洲二区三区| 亚洲一区二区成人在线观看| 激情文学综合插| 欧美性猛交xxxxxx富婆| 精品国产成人系列| 亚洲午夜三级在线| 成人免费看片app下载| 欧美高清一级片在线| 成人免费在线视频| 久久99国产精品麻豆| 欧美色精品在线视频| 国产欧美一区二区三区在线老狼 | 欧美日韩另类一区| 国产欧美日韩中文久久| 青椒成人免费视频| 在线这里只有精品| 中文字幕免费一区| 成人黄色777网| 国产亚洲精品资源在线26u| 午夜久久久久久久久 | 成人手机在线视频| 这里只有精品99re| 欧美二区乱c少妇| 亚洲精品写真福利| 国产成人综合在线| 91精品午夜视频| 午夜精品一区在线观看| 成人成人成人在线视频| 久久久久久久网| 久久不见久久见免费视频1| 欧美日韩在线综合| 亚洲精品久久久蜜桃| 99久久99精品久久久久久| 国产欧美日韩精品在线| 国产一区二区在线观看免费| 日韩一卡二卡三卡四卡| 男男成人高潮片免费网站| 欧美疯狂做受xxxx富婆| 一区二区日韩av| 在线观看91精品国产入口| 又紧又大又爽精品一区二区| 99九九99九九九视频精品| 亚洲欧洲日韩一区二区三区| 国产精品一级黄| 国产女主播视频一区二区| 国产黄色精品网站| 国产精品污网站|