projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[MTD] NAND Replace oobinfo by ecclayout
[powerpc.git]
/
drivers
/
mtd
/
inftlmount.c
diff --git
a/drivers/mtd/inftlmount.c
b/drivers/mtd/inftlmount.c
index
3dac53f
..
f89a037
100644
(file)
--- a/
drivers/mtd/inftlmount.c
+++ b/
drivers/mtd/inftlmount.c
@@
-1,14
+1,14
@@
-/*
+/*
* inftlmount.c -- INFTL mount code with extensive checks.
*
* Author: Greg Ungerer (gerg@snapgear.com)
* (C) Copyright 2002-2003, Greg Ungerer (gerg@snapgear.com)
*
* Based heavily on the nftlmount.c code which is:
* inftlmount.c -- INFTL mount code with extensive checks.
*
* Author: Greg Ungerer (gerg@snapgear.com)
* (C) Copyright 2002-2003, Greg Ungerer (gerg@snapgear.com)
*
* Based heavily on the nftlmount.c code which is:
- * Author: Fabrice Bellard (fabrice.bellard@netgem.com)
+ * Author: Fabrice Bellard (fabrice.bellard@netgem.com)
* Copyright (C) 2000 Netgem S.A.
*
* Copyright (C) 2000 Netgem S.A.
*
- * $Id: inftlmount.c,v 1.1
6 2004/11/22 13:50:53 kalev
Exp $
+ * $Id: inftlmount.c,v 1.1
8 2005/11/07 11:14:20 gleixner
Exp $
*
* 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
*
* 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
@@
-41,7
+41,7
@@
#include <linux/mtd/inftl.h>
#include <linux/mtd/compatmac.h>
#include <linux/mtd/inftl.h>
#include <linux/mtd/compatmac.h>
-char inftlmountrev[]="$Revision: 1.1
6
$";
+char inftlmountrev[]="$Revision: 1.1
8
$";
/*
* find_boot_record: Find the INFTL Media Header and its Spare copy which
/*
* find_boot_record: Find the INFTL Media Header and its Spare copy which
@@
-273,7
+273,7
@@
static int find_boot_record(struct INFTLrecord *inftl)
inftl->nb_boot_blocks);
return -1;
}
inftl->nb_boot_blocks);
return -1;
}
-
+
inftl->mbd.size = inftl->numvunits *
(inftl->EraseSize / SECTORSIZE);
inftl->mbd.size = inftl->numvunits *
(inftl->EraseSize / SECTORSIZE);
@@
-302,7
+302,7
@@
static int find_boot_record(struct INFTLrecord *inftl)
inftl->nb_blocks * sizeof(u16));
return -ENOMEM;
}
inftl->nb_blocks * sizeof(u16));
return -ENOMEM;
}
-
+
/* Mark the blocks before INFTL MediaHeader as reserved */
for (i = 0; i < inftl->nb_boot_blocks; i++)
inftl->PUtable[i] = BLOCK_RESERVED;
/* Mark the blocks before INFTL MediaHeader as reserved */
for (i = 0; i < inftl->nb_boot_blocks; i++)
inftl->PUtable[i] = BLOCK_RESERVED;
@@
-350,21
+350,21
@@
static int check_free_sectors(struct INFTLrecord *inftl, unsigned int address,
int len, int check_oob)
{
u8 buf[SECTORSIZE + inftl->mbd.mtd->oobsize];
int len, int check_oob)
{
u8 buf[SECTORSIZE + inftl->mbd.mtd->oobsize];
+ struct mtd_info *mtd = inftl->mbd.mtd;
size_t retlen;
int i;
size_t retlen;
int i;
- DEBUG(MTD_DEBUG_LEVEL3, "INFTL: check_free_sectors(inftl=%p,"
- "address=0x%x,len=%d,check_oob=%d)\n", inftl,
- address, len, check_oob);
-
for (i = 0; i < len; i += SECTORSIZE) {
for (i = 0; i < len; i += SECTORSIZE) {
- if (
MTD_READECC(inftl->mbd.mtd, address, SECTORSIZE, &retlen, buf, &buf[SECTORSIZE], &inftl->oobinfo) < 0
)
+ if (
mtd->read(mtd, address, SECTORSIZE, &retlen, buf)
)
return -1;
if (memcmpb(buf, 0xff, SECTORSIZE) != 0)
return -1;
if (check_oob) {
return -1;
if (memcmpb(buf, 0xff, SECTORSIZE) != 0)
return -1;
if (check_oob) {
- if (memcmpb(buf + SECTORSIZE, 0xff, inftl->mbd.mtd->oobsize) != 0)
+ if(mtd->read_oob(mtd, address, mtd->oobsize,
+ &retlen, &buf[SECTORSIZE]) < 0)
+ return -1;
+ if (memcmpb(buf + SECTORSIZE, 0xff, mtd->oobsize) != 0)
return -1;
}
address += SECTORSIZE;
return -1;
}
address += SECTORSIZE;
@@
-380,7
+380,7
@@
static int check_free_sectors(struct INFTLrecord *inftl, unsigned int address,
*
* Return: 0 when succeed, -1 on error.
*
*
* Return: 0 when succeed, -1 on error.
*
- * ToDo: 1. Is it neceressary to check_free_sector after erasing ??
+ * ToDo: 1. Is it neceressary to check_free_sector after erasing ??
*/
int INFTL_formatblock(struct INFTLrecord *inftl, int block)
{
*/
int INFTL_formatblock(struct INFTLrecord *inftl, int block)
{
@@
-563,7
+563,7
@@
int INFTL_mount(struct INFTLrecord *s)
/* Search for INFTL MediaHeader and Spare INFTL Media Header */
if (find_boot_record(s) < 0) {
printk(KERN_WARNING "INFTL: could not find valid boot record?\n");
/* Search for INFTL MediaHeader and Spare INFTL Media Header */
if (find_boot_record(s) < 0) {
printk(KERN_WARNING "INFTL: could not find valid boot record?\n");
- return -
1
;
+ return -
ENXIO
;
}
/* Init the logical to physical table */
}
/* Init the logical to physical table */
@@
-601,7
+601,7
@@
int INFTL_mount(struct INFTLrecord *s)
for (chain_length = 0; ; chain_length++) {
for (chain_length = 0; ; chain_length++) {
- if ((chain_length == 0) &&
+ if ((chain_length == 0) &&
(s->PUtable[block] != BLOCK_NOTEXPLORED)) {
/* Nothing to do here, onto next block */
break;
(s->PUtable[block] != BLOCK_NOTEXPLORED)) {
/* Nothing to do here, onto next block */
break;
@@
-748,7
+748,7
@@
int INFTL_mount(struct INFTLrecord *s)
"in virtual chain %d\n",
s->PUtable[block], logical_block);
s->PUtable[block] = BLOCK_NIL;
"in virtual chain %d\n",
s->PUtable[block], logical_block);
s->PUtable[block] = BLOCK_NIL;
-
+
}
if (ANACtable[block] != ANAC) {
/*
}
if (ANACtable[block] != ANAC) {
/*