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

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

?? erase.c

?? uclinux的jffs2文件系統(tǒng)
?? C
字號(hào):
/* * JFFS2 -- Journalling Flash File System, Version 2. * * Copyright (C) 2001 Red Hat, Inc. * * Created by David Woodhouse <dwmw2@cambridge.redhat.com> * * The original JFFS, from which the design for JFFS2 was derived, * was designed and implemented by Axis Communications AB. * * The contents of this file are subject to the Red Hat eCos Public * License Version 1.1 (the "Licence"); you may not use this file * except in compliance with the Licence.  You may obtain a copy of * the Licence at http://www.redhat.com/ * * Software distributed under the Licence is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. * See the Licence for the specific language governing rights and * limitations under the Licence. * * The Original Code is JFFS2 - Journalling Flash File System, version 2 * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License version 2 (the "GPL"), in * which case the provisions of the GPL are applicable instead of the * above.  If you wish to allow the use of your version of this file * only under the terms of the GPL and not to allow others to use your * version of this file under the RHEPL, indicate your decision by * deleting the provisions above and replace them with the notice and * other provisions required by the GPL.  If you do not delete the * provisions above, a recipient may use your version of this file * under either the RHEPL or the GPL. * * $Id: erase.c,v 1.24 2001/12/06 16:38:38 dwmw2 Exp $ * */#include <linux/kernel.h>#include <linux/slab.h>#include <linux/mtd/mtd.h>#include <linux/jffs2.h>#include <linux/interrupt.h>#include "nodelist.h"#include "crc32.h"struct erase_priv_struct {	struct jffs2_eraseblock *jeb;	struct jffs2_sb_info *c;};      static void jffs2_erase_callback(struct erase_info *);static void jffs2_free_all_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb);void jffs2_erase_block(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb){	struct erase_info *instr;	int ret;	instr = kmalloc(sizeof(struct erase_info) + sizeof(struct erase_priv_struct), GFP_KERNEL);	if (!instr) {		printk(KERN_WARNING "kmalloc for struct erase_info in jffs2_erase_block failed. Refiling block for later\n");		spin_lock_bh(&c->erase_completion_lock);		list_del(&jeb->list);		list_add(&jeb->list, &c->erase_pending_list);		c->erasing_size -= c->sector_size;		spin_unlock_bh(&c->erase_completion_lock);		return;	}	memset(instr, 0, sizeof(*instr));	instr->mtd = c->mtd;	instr->addr = jeb->offset;	instr->len = c->sector_size;	instr->callback = jffs2_erase_callback;	instr->priv = (unsigned long)(&instr[1]);		((struct erase_priv_struct *)instr->priv)->jeb = jeb;	((struct erase_priv_struct *)instr->priv)->c = c;	ret = c->mtd->erase(c->mtd, instr);	if (!ret) {		return;	}	if (ret == -ENOMEM || ret == -EAGAIN) {		/* Erase failed immediately. Refile it on the list */		D1(printk(KERN_DEBUG "Erase at 0x%08x failed: %d. Refiling on erase_pending_list\n", jeb->offset, ret));		spin_lock_bh(&c->erase_completion_lock);		list_del(&jeb->list);		list_add(&jeb->list, &c->erase_pending_list);		c->erasing_size -= c->sector_size;		spin_unlock_bh(&c->erase_completion_lock);		kfree(instr);		return;	}	if (ret == -EROFS) 		printk(KERN_WARNING "Erase at 0x%08x failed immediately: -EROFS. Is the sector locked?\n", jeb->offset);	else		printk(KERN_WARNING "Erase at 0x%08x failed immediately: errno %d\n", jeb->offset, ret);	spin_lock_bh(&c->erase_completion_lock);	list_del(&jeb->list);	list_add(&jeb->list, &c->bad_list);	c->nr_erasing_blocks--;	c->bad_size += c->sector_size;	c->erasing_size -= c->sector_size;	spin_unlock_bh(&c->erase_completion_lock);	wake_up(&c->erase_wait);	kfree(instr);}void jffs2_erase_pending_blocks(struct jffs2_sb_info *c){	struct jffs2_eraseblock *jeb;	spin_lock_bh(&c->erase_completion_lock);	while (!list_empty(&c->erase_pending_list)) {		jeb = list_entry(c->erase_pending_list.next, struct jffs2_eraseblock, list);		D1(printk(KERN_DEBUG "Starting erase of pending block 0x%08x\n", jeb->offset));		list_del(&jeb->list);		c->erasing_size += c->sector_size;		c->free_size -= jeb->free_size;		c->used_size -= jeb->used_size;		c->dirty_size -= jeb->dirty_size;		jeb->used_size = jeb->dirty_size = jeb->free_size = 0;		jffs2_free_all_node_refs(c, jeb);		list_add(&jeb->list, &c->erasing_list);		spin_unlock_bh(&c->erase_completion_lock);				jffs2_erase_block(c, jeb);		/* Be nice */		if (current->need_resched)			schedule();		spin_lock_bh(&c->erase_completion_lock);	}	spin_unlock_bh(&c->erase_completion_lock);	D1(printk(KERN_DEBUG "jffs2_erase_pending_blocks completed\n"));}static void jffs2_erase_callback(struct erase_info *instr){	struct erase_priv_struct *priv = (void *)instr->priv;	if(instr->state != MTD_ERASE_DONE) {		printk(KERN_WARNING "Erase at 0x%08x finished, but state != MTD_ERASE_DONE. State is 0x%x instead.\n", instr->addr, instr->state);		spin_lock(&priv->c->erase_completion_lock);		priv->c->erasing_size -= priv->c->sector_size;		priv->c->bad_size += priv->c->sector_size;		list_del(&priv->jeb->list);		list_add(&priv->jeb->list, &priv->c->bad_list);		priv->c->nr_erasing_blocks--;		spin_unlock(&priv->c->erase_completion_lock);		wake_up(&priv->c->erase_wait);	} else {		D1(printk(KERN_DEBUG "Erase completed successfully at 0x%08x\n", instr->addr));		spin_lock(&priv->c->erase_completion_lock);		list_del(&priv->jeb->list);		list_add_tail(&priv->jeb->list, &priv->c->erase_complete_list);		spin_unlock(&priv->c->erase_completion_lock);	}		/* Make sure someone picks up the block off the erase_complete list */	OFNI_BS_2SFFJ(priv->c)->s_dirt = 1;	kfree(instr);}/* Hmmm. Maybe we should accept the extra space it takes and make   this a standard doubly-linked list? */static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c,			struct jffs2_raw_node_ref *ref, struct jffs2_eraseblock *jeb){	struct jffs2_inode_cache *ic = NULL;	struct jffs2_raw_node_ref **prev;	prev = &ref->next_in_ino;	/* Walk the inode's list once, removing any nodes from this eraseblock */	while (1) {		if (!(*prev)->next_in_ino) {			/* We're looking at the jffs2_inode_cache, which is 			   at the end of the linked list. Stash it and continue			   from the beginning of the list */			ic = (struct jffs2_inode_cache *)(*prev);			prev = &ic->nodes;			continue;		} 		if (((*prev)->flash_offset & ~(c->sector_size -1)) == jeb->offset) {			/* It's in the block we're erasing */			struct jffs2_raw_node_ref *this;			this = *prev;			*prev = this->next_in_ino;			this->next_in_ino = NULL;			if (this == ref)				break;			continue;		}		/* Not to be deleted. Skip */		prev = &((*prev)->next_in_ino);	}	/* PARANOIA */	if (!ic) {		printk(KERN_WARNING "inode_cache not found in remove_node_refs()!!\n");		return;	}	D1(printk(KERN_DEBUG "Removed nodes in range 0x%08x-0x%08x from ino #%u\n",		  jeb->offset, jeb->offset + c->sector_size, ic->ino));	D2({		int i=0;		struct jffs2_raw_node_ref *this;		printk(KERN_DEBUG "After remove_node_refs_from_ino_list: \n" KERN_DEBUG);		this = ic->nodes;	   		while(this) {			printk( "0x%08x(%d)->", this->flash_offset & ~3, this->flash_offset &3);			if (++i == 5) {				printk("\n" KERN_DEBUG);				i=0;			}			this = this->next_in_ino;		}		printk("\n");	});	if (ic->nodes == (void *)ic) {		D1(printk(KERN_DEBUG "inocache for ino #%u is all gone now. Freeing\n", ic->ino));		jffs2_del_ino_cache(c, ic);		jffs2_free_inode_cache(ic);	}}static void jffs2_free_all_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb){	struct jffs2_raw_node_ref *ref;	D1(printk(KERN_DEBUG "Freeing all node refs for eraseblock offset 0x%08x\n", jeb->offset));	while(jeb->first_node) {		ref = jeb->first_node;		jeb->first_node = ref->next_phys;				/* Remove from the inode-list */		if (ref->next_in_ino)			jffs2_remove_node_refs_from_ino_list(c, ref, jeb);		/* else it was a non-inode node or already removed, so don't bother */		jffs2_free_raw_node_ref(ref);	}	jeb->last_node = NULL;}void jffs2_erase_pending_trigger(struct jffs2_sb_info *c){	OFNI_BS_2SFFJ(c)->s_dirt = 1;}void jffs2_mark_erased_blocks(struct jffs2_sb_info *c){	static struct jffs2_unknown_node marker = {JFFS2_MAGIC_BITMASK, JFFS2_NODETYPE_CLEANMARKER, sizeof(struct jffs2_unknown_node)};	struct jffs2_eraseblock *jeb;	struct jffs2_raw_node_ref *marker_ref;	unsigned char *ebuf;	ssize_t retlen;	int ret;	marker.hdr_crc = crc32(0, &marker, sizeof(struct jffs2_unknown_node)-4);	spin_lock_bh(&c->erase_completion_lock);	while (!list_empty(&c->erase_complete_list)) {		jeb = list_entry(c->erase_complete_list.next, struct jffs2_eraseblock, list);		list_del(&jeb->list);		spin_unlock_bh(&c->erase_completion_lock);		marker_ref = jffs2_alloc_raw_node_ref();		if (!marker_ref) {			printk(KERN_WARNING "Failed to allocate raw node ref for clean marker\n");			/* Come back later */			jffs2_erase_pending_trigger(c);			return;		}		ebuf = kmalloc(PAGE_SIZE, GFP_KERNEL);		if (!ebuf) {			printk(KERN_WARNING "Failed to allocate page buffer for verifying erase at 0x%08x. Assuming it worked\n", jeb->offset);		} else {			__u32 ofs = jeb->offset;			D1(printk(KERN_DEBUG "Verifying erase at 0x%08x\n", jeb->offset));			while(ofs < jeb->offset + c->sector_size) {				__u32 readlen = min((__u32)PAGE_SIZE, jeb->offset + c->sector_size - ofs);				int i;				ret = c->mtd->read(c->mtd, ofs, readlen, &retlen, ebuf);				if (ret < 0) {					printk(KERN_WARNING "Read of newly-erased block at 0x%08x failed: %d. Putting on bad_list\n", ofs, ret);					goto bad;				}				if (retlen != readlen) {					printk(KERN_WARNING "Short read from newly-erased block at 0x%08x. Wanted %d, got %d\n", ofs, readlen, retlen);					goto bad;				}				for (i=0; i<readlen; i += sizeof(unsigned long)) {					/* It's OK. We know it's properly aligned */					unsigned long datum = *(unsigned long *)(&ebuf[i]);					if (datum + 1) {						printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08x\n", datum, ofs + i);					bad: 						jffs2_free_raw_node_ref(marker_ref);						kfree(ebuf);					bad2:						spin_lock_bh(&c->erase_completion_lock);						c->erasing_size -= c->sector_size;						c->bad_size += c->sector_size;						list_add_tail(&jeb->list, &c->bad_list);						c->nr_erasing_blocks--;						spin_unlock_bh(&c->erase_completion_lock);						wake_up(&c->erase_wait);						return;					}				}				ofs += readlen;			}			kfree(ebuf);		}							/* Write the erase complete marker */			D1(printk(KERN_DEBUG "Writing erased marker to block at 0x%08x\n", jeb->offset));		ret = c->mtd->write(c->mtd, jeb->offset, sizeof(marker), &retlen, (char *)&marker);		if (ret) {			printk(KERN_WARNING "Write clean marker to block at 0x%08x failed: %d\n",			       jeb->offset, ret);			goto bad2;		}		if (retlen != sizeof(marker)) {			printk(KERN_WARNING "Short write to newly-erased block at 0x%08x: Wanted %d, got %d\n",			       jeb->offset, sizeof(marker), retlen);			goto bad2;		}		marker_ref->next_in_ino = NULL;		marker_ref->next_phys = NULL;		marker_ref->flash_offset = jeb->offset;		marker_ref->totlen = PAD(sizeof(marker));		jeb->first_node = jeb->last_node = marker_ref;		jeb->free_size = c->sector_size - marker_ref->totlen;		jeb->used_size = marker_ref->totlen;		jeb->dirty_size = 0;		spin_lock_bh(&c->erase_completion_lock);		c->erasing_size -= c->sector_size;		c->free_size += jeb->free_size;		c->used_size += jeb->used_size;		ACCT_SANITY_CHECK(c,jeb);		ACCT_PARANOIA_CHECK(jeb);		list_add_tail(&jeb->list, &c->free_list);		c->nr_erasing_blocks--;		c->nr_free_blocks++;		wake_up(&c->erase_wait);	}	spin_unlock_bh(&c->erase_completion_lock);}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美腿丝袜亚洲色图| 蜜臀va亚洲va欧美va天堂| 欧美精品在线视频| 国产精品一区二区久久不卡 | 国产一区二区三区香蕉| 日韩美女视频一区二区| 久久蜜桃香蕉精品一区二区三区| 91小视频在线观看| 国产激情一区二区三区| 亚洲sss视频在线视频| 1区2区3区欧美| 久久久亚洲高清| 日韩一级高清毛片| 欧美另类高清zo欧美| 91亚洲男人天堂| 大胆亚洲人体视频| 韩国欧美一区二区| 免费观看30秒视频久久| 午夜视频在线观看一区| 亚洲精品欧美专区| 国产精品国产三级国产有无不卡 | 黑人巨大精品欧美一区| 丝袜脚交一区二区| 亚洲成人一二三| 亚洲影视在线播放| 亚洲欧美日韩中文字幕一区二区三区| 2020国产成人综合网| 欧美一区二区三区的| 欧美另类变人与禽xxxxx| 欧美丝袜丝nylons| 精品1区2区3区| 在线亚洲人成电影网站色www| caoporm超碰国产精品| 成人高清免费在线播放| 成人永久aaa| 国产99久久久久久免费看农村| 久久草av在线| 国产在线精品不卡| 国产乱子伦一区二区三区国色天香| 日本成人在线电影网| 日本欧美韩国一区三区| 蜜臀91精品一区二区三区| 免费人成网站在线观看欧美高清| 免费观看一级欧美片| 另类小说一区二区三区| 国产主播一区二区三区| 国产激情91久久精品导航 | 91视频在线看| 91国偷自产一区二区三区成为亚洲经典 | 欧美韩国日本综合| 国产精品久久久一本精品| 国产精品乱人伦中文| 亚洲欧美日本韩国| 亚洲午夜免费福利视频| 五月综合激情网| 另类小说综合欧美亚洲| 国产大陆a不卡| 99re66热这里只有精品3直播| 色综合久久88色综合天天6| 欧美综合一区二区三区| 555www色欧美视频| 久久久影视传媒| 国产精品麻豆99久久久久久| 亚洲一区二区在线视频| 老司机一区二区| 国产99久久久国产精品免费看 | 成人激情视频网站| 欧美性色黄大片| 精品国产凹凸成av人网站| 国产精品视频在线看| 亚洲伊人色欲综合网| 精品一区二区三区日韩| 9l国产精品久久久久麻豆| 在线观看日韩一区| 欧美va在线播放| 中文字幕一区三区| 美腿丝袜亚洲一区| 91尤物视频在线观看| 欧美一级高清片| 成人免费在线视频| 久久er99热精品一区二区| 99re66热这里只有精品3直播| 777久久久精品| 国产精品女同一区二区三区| 婷婷综合久久一区二区三区| 床上的激情91.| 3d动漫精品啪啪一区二区竹菊| 欧美经典一区二区三区| 偷拍日韩校园综合在线| 丰满少妇在线播放bd日韩电影| 欧美久久久久免费| 国产精品国产a| 麻豆国产精品官网| 欧美自拍偷拍一区| 国产亚洲一区二区三区在线观看| 亚洲中国最大av网站| 成人在线一区二区三区| 日韩一区二区精品葵司在线| 亚洲女子a中天字幕| 国产在线播放一区| 7777精品伊人久久久大香线蕉的| 国产精品国产三级国产普通话99| 久久精品国产亚洲aⅴ | 精品蜜桃在线看| 亚洲国产综合视频在线观看| 成人app网站| 精品三级av在线| 亚洲不卡一区二区三区| 91色|porny| 国产精品欧美久久久久一区二区| 麻豆国产欧美一区二区三区| 欧美日韩国产bt| 亚洲三级电影网站| 成人午夜伦理影院| 国产日韩欧美综合一区| 韩国精品一区二区| 日韩三级视频在线看| 丝袜美腿亚洲一区| 欧美日韩你懂得| 亚洲午夜一区二区| 在线精品视频小说1| 亚洲女女做受ⅹxx高潮| av不卡在线播放| 国产婷婷色一区二区三区四区 | 国产日产欧产精品推荐色| 久久精品99国产精品| 91精品国产一区二区人妖| 亚洲国产婷婷综合在线精品| 色av成人天堂桃色av| 成人免费一区二区三区在线观看| 粉嫩一区二区三区在线看| 国产日韩欧美麻豆| 成人精品免费视频| 中文字幕av不卡| 99久久99久久精品免费观看 | 美脚の诱脚舐め脚责91| 日韩视频国产视频| 九九**精品视频免费播放| 日韩一区二区电影网| 激情深爱一区二区| 国产女人18毛片水真多成人如厕 | 日韩精品1区2区3区| 日韩一区二区免费在线电影| 青青草视频一区| 日韩精品一区二区三区三区免费 | 国产亚洲一本大道中文在线| 激情av综合网| 欧美国产一区二区在线观看| 成人午夜精品在线| 亚洲欧美日韩国产一区二区三区| 欧美综合在线视频| 奇米影视一区二区三区| 久久久久一区二区三区四区| 国产91富婆露脸刺激对白| 综合av第一页| 欧美色大人视频| 老司机精品视频在线| 久久精品一区二区| 91女厕偷拍女厕偷拍高清| 亚洲电影第三页| 精品国产伦一区二区三区观看体验| 国产精品一二二区| 一区二区成人在线观看| 欧美一区二区三区喷汁尤物| 国产精品中文有码| 亚洲精品乱码久久久久久久久 | 成人开心网精品视频| 亚洲视频一二区| 欧美日韩美女一区二区| 国产一区美女在线| 一区二区在线观看视频| 欧美一二三区在线| www.爱久久.com| 日韩国产在线一| 国产欧美一区二区三区鸳鸯浴| 91视频在线看| 久久99九九99精品| 亚洲日本乱码在线观看| 日韩欧美久久久| 91色九色蝌蚪| 激情久久久久久久久久久久久久久久| 国产精品网曝门| 欧美一区二区三区免费大片| av亚洲产国偷v产偷v自拍| 日本欧美韩国一区三区| 亚洲三级在线观看| 精品国产成人系列| 欧美吻胸吃奶大尺度电影| 国产精品中文欧美| 午夜精品福利一区二区三区av| 中文字幕精品一区| 欧美一区二区三区四区高清| www.欧美精品一二区| 久久99精品一区二区三区三区| 亚洲精品老司机| 国产精品欧美久久久久无广告 | 天堂资源在线中文精品| 国产精品你懂的在线欣赏| 91精品国产综合久久福利| 色婷婷一区二区|