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

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

?? yaffs_mtdif1.c

?? yaffs文件系統的源程序,這個用來移植yaffs文件系統,本人已經在linux2.6.14內核上移植成功
?? C
字號:
/* * YAFFS: Yet another FFS. A NAND-flash specific file system. * yaffs_mtdif1.c  NAND mtd interface functions for small-page NAND. * * Copyright (C) 2002 Aleph One Ltd. *   for Toby Churchill Ltd and Brightstar Engineering * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. *//* * This module provides the interface between yaffs_nand.c and the * MTD API.  This version is used when the MTD interface supports the * 'mtd_oob_ops' style calls to read_oob and write_oob, circa 2.6.17, * and we have small-page NAND device. * * These functions are invoked via function pointers in yaffs_nand.c. * This replaces functionality provided by functions in yaffs_mtdif.c * and the yaffs_TagsCompatability functions in yaffs_tagscompat.c that are * called in yaffs_mtdif.c when the function pointers are NULL. * We assume the MTD layer is performing ECC (useNANDECC is true). */#include "yportenv.h"#include "yaffs_guts.h"#include "yaffs_packedtags1.h"#include "yaffs_tagscompat.h"	// for yaffs_CalcTagsECC#include "linux/kernel.h"#include "linux/version.h"#include "linux/types.h"#include "linux/mtd/mtd.h"/* Don't compile this module if we don't have MTD's mtd_oob_ops interface */#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))const char *yaffs_mtdif1_c_version = "$Id: yaffs_mtdif1.c,v 1.2 2007/07/23 19:14:04 imcd Exp $";#ifndef CONFIG_YAFFS_9BYTE_TAGS# define YTAG1_SIZE 8#else# define YTAG1_SIZE 9#endif#if 0/* Use the following nand_ecclayout with MTD when using * CONFIG_YAFFS_9BYTE_TAGS and the older on-NAND tags layout. * If you have existing Yaffs images and the byte order differs from this, * adjust 'oobfree' to match your existing Yaffs data. * * This nand_ecclayout scatters/gathers to/from the old-yaffs layout with the * pageStatus byte (at NAND spare offset 4) scattered/gathered from/to * the 9th byte. * * Old-style on-NAND format: T0,T1,T2,T3,P,B,T4,T5,E0,E1,E2,T6,T7,E3,E4,E5 * We have/need PackedTags1 plus pageStatus: T0,T1,T2,T3,T4,T5,T6,T7,P * where Tn are the tag bytes, En are MTD's ECC bytes, P is the pageStatus * byte and B is the small-page bad-block indicator byte. */static struct nand_ecclayout nand_oob_16 = {	.eccbytes = 6,	.eccpos = { 8, 9, 10, 13, 14, 15 },	.oobavail = 9,	.oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } }};#endif/* Write a chunk (page) of data to NAND. * * Caller always provides ExtendedTags data which are converted to a more * compact (packed) form for storage in NAND.  A mini-ECC runs over the * contents of the tags meta-data; used to valid the tags when read. * *  - Pack ExtendedTags to PackedTags1 form *  - Compute mini-ECC for PackedTags1 *  - Write data and packed tags to NAND. * * Note: Due to the use of the PackedTags1 meta-data which does not include * a full sequence number (as found in the larger PackedTags2 form) it is * necessary for Yaffs to re-write a chunk/page (just once) to mark it as * discarded and dirty.  This is not ideal: newer NAND parts are supposed * to be written just once.  When Yaffs performs this operation, this * function is called with a NULL data pointer -- calling MTD write_oob * without data is valid usage (2.6.17). * * Any underlying MTD error results in YAFFS_FAIL. * Returns YAFFS_OK or YAFFS_FAIL. */int nandmtd1_WriteChunkWithTagsToNAND(yaffs_Device *dev,	int chunkInNAND, const __u8 * data, const yaffs_ExtendedTags * etags){	struct mtd_info * mtd = dev->genericDevice;	int chunkBytes = dev->nDataBytesPerChunk;	loff_t addr = ((loff_t)chunkInNAND) * chunkBytes;	struct mtd_oob_ops ops;	yaffs_PackedTags1 pt1;	int retval;	/* we assume that PackedTags1 and yaffs_Tags are compatible */	compile_time_assertion(sizeof(yaffs_PackedTags1) == 12);	compile_time_assertion(sizeof(yaffs_Tags) == 8);	dev->nPageWrites++;	yaffs_PackTags1(&pt1, etags);	yaffs_CalcTagsECC((yaffs_Tags *)&pt1);	/* When deleting a chunk, the upper layer provides only skeletal	 * etags, one with chunkDeleted set.  However, we need to update the	 * tags, not erase them completely.  So we use the NAND write property	 * that only zeroed-bits stick and set tag bytes to all-ones and	 * zero just the (not) deleted bit.	 */#ifndef CONFIG_YAFFS_9BYTE_TAGS	if (etags->chunkDeleted) {		memset(&pt1, 0xff, 8);		/* clear delete status bit to indicate deleted */		pt1.deleted = 0;	}#else	((__u8 *)&pt1)[8] = 0xff;	if (etags->chunkDeleted) {		memset(&pt1, 0xff, 8);		/* zero pageStatus byte to indicate deleted */		((__u8 *)&pt1)[8] = 0;	}#endif	memset(&ops, 0, sizeof(ops));	ops.mode = MTD_OOB_AUTO;	ops.len = (data) ? chunkBytes : 0;	ops.ooblen = YTAG1_SIZE;	ops.datbuf = (__u8 *)data;	ops.oobbuf = (__u8 *)&pt1;	retval = mtd->write_oob(mtd, addr, &ops);	if (retval) {		yaffs_trace(YAFFS_TRACE_MTD,			"write_oob failed, chunk %d, mtd error %d\n",			chunkInNAND, retval);	}	return retval ? YAFFS_FAIL : YAFFS_OK;}/* Return with empty ExtendedTags but add eccResult. */static int rettags(yaffs_ExtendedTags * etags, int eccResult, int retval){	if (etags) {		memset(etags, 0, sizeof(*etags));		etags->eccResult = eccResult;	}	return retval;}/* Read a chunk (page) from NAND. * * Caller expects ExtendedTags data to be usable even on error; that is, * all members except eccResult and blockBad are zeroed. * *  - Check ECC results for data (if applicable) *  - Check for blank/erased block (return empty ExtendedTags if blank) *  - Check the PackedTags1 mini-ECC (correct if necessary/possible) *  - Convert PackedTags1 to ExtendedTags *  - Update eccResult and blockBad members to refect state. * * Returns YAFFS_OK or YAFFS_FAIL. */int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_Device *dev,	int chunkInNAND, __u8 * data, yaffs_ExtendedTags * etags){	struct mtd_info * mtd = dev->genericDevice;	int chunkBytes = dev->nDataBytesPerChunk;	loff_t addr = ((loff_t)chunkInNAND) * chunkBytes;	int eccres = YAFFS_ECC_RESULT_NO_ERROR;	struct mtd_oob_ops ops;	yaffs_PackedTags1 pt1;	int retval;	int deleted;	dev->nPageReads++;	memset(&ops, 0, sizeof(ops));	ops.mode = MTD_OOB_AUTO;	ops.len = (data) ? chunkBytes : 0;	ops.ooblen = YTAG1_SIZE;	ops.datbuf = data;	ops.oobbuf = (__u8 *)&pt1;#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))	/* In MTD 2.6.18 to 2.6.19 nand_base.c:nand_do_read_oob() has a bug;	 * help it out with ops.len = ops.ooblen when ops.datbuf == NULL.	 */	ops.len = (ops.datbuf) ? ops.len : ops.ooblen;#endif	/* Read page and oob using MTD.	 * Check status and determine ECC result.	 */	retval = mtd->read_oob(mtd, addr, &ops);	if (retval) {		yaffs_trace(YAFFS_TRACE_MTD,			"read_oob failed, chunk %d, mtd error %d\n",			chunkInNAND, retval);	}	switch (retval) {	case 0:		/* no error */		break;	case -EUCLEAN:		/* MTD's ECC fixed the data */		eccres = YAFFS_ECC_RESULT_FIXED;		dev->eccFixed++;		break;	case -EBADMSG:		/* MTD's ECC could not fix the data */		dev->eccUnfixed++;		/* fall into... */	default:		rettags(etags, YAFFS_ECC_RESULT_UNFIXED, 0);		etags->blockBad = (mtd->block_isbad)(mtd, addr);		return YAFFS_FAIL;	}	/* Check for a blank/erased chunk.	 */	if (yaffs_CheckFF((__u8 *)&pt1, 8)) {		/* when blank, upper layers want eccResult to be <= NO_ERROR */		return rettags(etags, YAFFS_ECC_RESULT_NO_ERROR, YAFFS_OK);	}#ifndef CONFIG_YAFFS_9BYTE_TAGS	/* Read deleted status (bit) then return it to it's non-deleted	 * state before performing tags mini-ECC check. pt1.deleted is	 * inverted.	 */	deleted = !pt1.deleted;	pt1.deleted = 1;#else	deleted = (yaffs_CountBits(((__u8 *)&pt1)[8]) < 7);#endif	/* Check the packed tags mini-ECC and correct if necessary/possible.	 */	retval = yaffs_CheckECCOnTags((yaffs_Tags *)&pt1);	switch (retval) {	case 0:		/* no tags error, use MTD result */		break;	case 1:		/* recovered tags-ECC error */		dev->tagsEccFixed++;		if (eccres == YAFFS_ECC_RESULT_NO_ERROR)			eccres = YAFFS_ECC_RESULT_FIXED;		break;	default:		/* unrecovered tags-ECC error */		dev->tagsEccUnfixed++;		return rettags(etags, YAFFS_ECC_RESULT_UNFIXED, YAFFS_FAIL);	}	/* Unpack the tags to extended form and set ECC result.	 * [set shouldBeFF just to keep yaffs_UnpackTags1 happy]	 */	pt1.shouldBeFF = 0xFFFFFFFF;	yaffs_UnpackTags1(etags, &pt1);	etags->eccResult = eccres;	/* Set deleted state */	etags->chunkDeleted = deleted;	return YAFFS_OK;}/* Mark a block bad. * * This is a persistant state. * Use of this function should be rare. * * Returns YAFFS_OK or YAFFS_FAIL. */int nandmtd1_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo){	struct mtd_info * mtd = dev->genericDevice;	int blocksize = dev->nChunksPerBlock * dev->nDataBytesPerChunk;	int retval;	yaffs_trace(YAFFS_TRACE_BAD_BLOCKS, "marking block %d bad", blockNo);	retval = mtd->block_markbad(mtd, (loff_t)blocksize * blockNo);	return (retval) ? YAFFS_FAIL : YAFFS_OK;}/* Check any MTD prerequists. *  * Returns YAFFS_OK or YAFFS_FAIL. */static int nandmtd1_TestPrerequists(struct mtd_info * mtd){	/* 2.6.18 has mtd->ecclayout->oobavail */	/* 2.6.21 has mtd->ecclayout->oobavail and mtd->oobavail */	int oobavail = mtd->ecclayout->oobavail;	if (oobavail < YTAG1_SIZE) {		yaffs_trace(YAFFS_TRACE_ERROR,			"mtd device has only %d bytes for tags, need %d\n",			oobavail, YTAG1_SIZE);		return YAFFS_FAIL;	}	return YAFFS_OK;}/* Query for the current state of a specific block. * * Examine the tags of the first chunk of the block and return the state: *  - YAFFS_BLOCK_STATE_DEAD, the block is marked bad *  - YAFFS_BLOCK_STATE_NEEDS_SCANNING, the block is in use *  - YAFFS_BLOCK_STATE_EMPTY, the block is clean * * Always returns YAFFS_OK. */int nandmtd1_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo,	yaffs_BlockState * pState, int *pSequenceNumber){	struct mtd_info * mtd = dev->genericDevice;	int chunkNo = blockNo * dev->nChunksPerBlock;	yaffs_ExtendedTags etags;	int state = YAFFS_BLOCK_STATE_DEAD;	int seqnum = 0;	int retval;	/* We don't yet have a good place to test for MTD config prerequists.	 * Do it here as we are called during the initial scan.	 */	if (nandmtd1_TestPrerequists(mtd) != YAFFS_OK) {		return YAFFS_FAIL;	}	retval = nandmtd1_ReadChunkWithTagsFromNAND(dev, chunkNo, NULL, &etags);	if (etags.blockBad) {		yaffs_trace(YAFFS_TRACE_BAD_BLOCKS,			"block %d is marked bad", blockNo);		state = YAFFS_BLOCK_STATE_DEAD;	}	else if (etags.chunkUsed) {		state = YAFFS_BLOCK_STATE_NEEDS_SCANNING;		seqnum = etags.sequenceNumber;	}	else {		state = YAFFS_BLOCK_STATE_EMPTY;	}	*pState = state;	*pSequenceNumber = seqnum;	/* query always succeeds */	return YAFFS_OK;}#endif /*KERNEL_VERSION*/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美草草影院在线视频| 日本不卡一区二区| 欧美精品一区二区在线播放| 日本大香伊一区二区三区| 成人听书哪个软件好| 国产高清精品久久久久| 国产乱码精品1区2区3区| 免费观看成人av| 久久精品国产精品亚洲精品| 秋霞影院一区二区| 久久精品国产精品亚洲精品| 久久精品国产亚洲aⅴ | 麻豆成人av在线| 亚洲电影欧美电影有声小说| 亚洲网友自拍偷拍| 日韩不卡一区二区| 麻豆精品国产传媒mv男同| 日本欧美肥老太交大片| 六月丁香婷婷色狠狠久久| 美女精品自拍一二三四| 国产一区二区精品久久91| 国产精品白丝jk黑袜喷水| 成人av网站在线观看| 色综合久久久久网| 91精品国产综合久久久久久漫画| 欧美一二三区在线观看| xnxx国产精品| 国产精品久久久久久久久快鸭| 综合久久久久久| 夜夜亚洲天天久久| 日本va欧美va瓶| 国产成人精品www牛牛影视| 91啪亚洲精品| 91.xcao| 久久久99久久| 亚洲美腿欧美偷拍| 免费成人av在线| av一区二区三区在线| 欧美视频三区在线播放| 日韩免费看的电影| 亚洲美女视频在线| 毛片av一区二区三区| av亚洲产国偷v产偷v自拍| 欧美日韩国产高清一区二区| 久久综合狠狠综合久久综合88 | 国产精品1区二区.| 在线观看欧美黄色| 久久一留热品黄| 亚洲一区二区黄色| 国产v综合v亚洲欧| 777色狠狠一区二区三区| 国产亚洲欧美激情| 日韩成人午夜精品| 91亚洲精品一区二区乱码| 日韩三级免费观看| 亚洲精品国产一区二区三区四区在线| 久久精品二区亚洲w码| 日本韩国欧美三级| 欧美国产一区视频在线观看| 视频精品一区二区| 91老师片黄在线观看| 久久精子c满五个校花| 日韩精品亚洲专区| 久久精品视频免费| 日本亚洲欧美天堂免费| 91行情网站电视在线观看高清版| 久久影院视频免费| 久久激情五月激情| 欧美日韩电影一区| 亚洲一区二区av在线| av电影在线不卡| 国产精品私房写真福利视频| 精品综合免费视频观看| 在线播放亚洲一区| 婷婷综合五月天| 欧美综合一区二区三区| 亚洲精品国产视频| 91丨porny丨最新| 欧美国产综合一区二区| 国产成人鲁色资源国产91色综| 日韩亚洲欧美高清| 久久精品国产精品亚洲红杏| 91精品国产色综合久久| 日韩高清欧美激情| 91精品国产91久久久久久一区二区 | 国产成人自拍网| 亚洲精品一区二区三区影院| 青青国产91久久久久久| 欧美一级黄色片| 日韩成人一级大片| 久久这里都是精品| 成人的网站免费观看| 国产精品美女一区二区三区 | 2020日本不卡一区二区视频| 久久精品国产免费| 国产日产亚洲精品系列| 风间由美一区二区三区在线观看| 亚洲国产精品av| 99久久久久久| 性做久久久久久免费观看欧美| 欧美性受xxxx| 久久国产剧场电影| 欧美国产一区视频在线观看| 97成人超碰视| 日本不卡视频一二三区| 2020国产精品| 欧美在线你懂的| 免费观看在线色综合| 国产精品久久精品日日| 欧美性猛片aaaaaaa做受| 免费精品99久久国产综合精品| 2020国产精品久久精品美国| 99久久精品一区二区| 视频在线观看一区| 国产精品天天看| 欧美一区二区网站| 国产成人av电影在线| 亚洲二区在线视频| 国产视频一区在线观看| 91激情五月电影| 国产一区二区三区在线看麻豆| 亚洲色欲色欲www| 6080午夜不卡| 91香蕉视频污| 激情久久久久久久久久久久久久久久| 中文字幕一区二区三区蜜月| 欧美一区二区精品| 91亚洲永久精品| 国产精品一级片在线观看| 亚洲国产精品久久不卡毛片 | 国产日韩高清在线| 宅男噜噜噜66一区二区66| 白白色亚洲国产精品| 蜜臂av日日欢夜夜爽一区| 一区二区高清视频在线观看| 久久久精品欧美丰满| 91麻豆精品国产91久久久使用方法 | 亚洲欧洲精品成人久久奇米网| 日韩午夜中文字幕| 欧美视频三区在线播放| av在线不卡观看免费观看| 理论片日本一区| 日韩一区精品视频| 亚洲综合无码一区二区| 中文字幕一区二区三区在线观看| 久久夜色精品一区| 精品国产成人在线影院| 欧美一区二区三区在线视频| 欧美影院一区二区三区| 91麻豆文化传媒在线观看| 成人国产视频在线观看| 国产福利不卡视频| 国内久久精品视频| 另类中文字幕网| 91免费小视频| av高清不卡在线| 99国产精品视频免费观看| 国产91露脸合集magnet| 国产成人综合在线观看| 国产乱对白刺激视频不卡| 精品一区二区三区在线观看国产| 日日夜夜精品视频免费| 午夜精品一区在线观看| 五月天国产精品| 奇米综合一区二区三区精品视频 | 色一区在线观看| 91成人在线免费观看| 色偷偷成人一区二区三区91| 色综合天天综合网天天看片| 99久久免费视频.com| av在线播放成人| 欧美偷拍一区二区| 欧美夫妻性生活| 26uuu成人网一区二区三区| 久久这里只有精品6| 国产精品情趣视频| 一区二区激情小说| 日韩国产在线观看| 精品一区二区久久久| 成人美女视频在线观看18| 91免费在线播放| 91精品国产91综合久久蜜臀| 久久综合色播五月| 18欧美乱大交hd1984| 亚洲大尺度视频在线观看| 蜜桃一区二区三区四区| 高清不卡一区二区在线| 色94色欧美sute亚洲线路一久 | 丝袜亚洲精品中文字幕一区| 日本欧美在线看| 成人免费毛片高清视频| 欧美性大战xxxxx久久久| 亚洲亚洲人成综合网络| 男女男精品网站| www.日韩av| 日韩视频在线你懂得| 国产精品成人网| 肉色丝袜一区二区| 成人app软件下载大全免费| 精品视频一区 二区 三区|