diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2005-06-30 18:01:09 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-06-30 18:01:09 -0400 |
commit | 747aead34de65c25765da79825ce2c08d8257b10 (patch) | |
tree | 1edbf084b3e08fc0623431278f5dc0fda67ef634 /drivers/mtd/afs.c | |
parent | abaf48a05a8f097654e746af2a5afb2ab95861a1 (diff) |
[PATCH] ARM: 2780/1: AFS partition length calculation fix
Patch from Catalin Marinas
This patch calculates the AFS partition length by expanding the image
length information to the nearest erase block boundary. This
eliminates the problems with JFFS2 erasing the footer.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mtd/afs.c')
-rw-r--r-- | drivers/mtd/afs.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/drivers/mtd/afs.c b/drivers/mtd/afs.c index 801e6c7d0892..7363e101eb0f 100644 --- a/drivers/mtd/afs.c +++ b/drivers/mtd/afs.c | |||
@@ -219,7 +219,7 @@ static int parse_afs_partitions(struct mtd_info *mtd, | |||
219 | */ | 219 | */ |
220 | for (idx = off = 0; off < mtd->size; off += mtd->erasesize) { | 220 | for (idx = off = 0; off < mtd->size; off += mtd->erasesize) { |
221 | struct image_info_struct iis; | 221 | struct image_info_struct iis; |
222 | u_int iis_ptr, img_ptr, size; | 222 | u_int iis_ptr, img_ptr; |
223 | 223 | ||
224 | /* Read the footer. */ | 224 | /* Read the footer. */ |
225 | ret = afs_read_footer(mtd, &img_ptr, &iis_ptr, off, mask); | 225 | ret = afs_read_footer(mtd, &img_ptr, &iis_ptr, off, mask); |
@@ -236,21 +236,9 @@ static int parse_afs_partitions(struct mtd_info *mtd, | |||
236 | continue; | 236 | continue; |
237 | 237 | ||
238 | strcpy(str, iis.name); | 238 | strcpy(str, iis.name); |
239 | size = mtd->erasesize + off - img_ptr; | ||
240 | |||
241 | /* | ||
242 | * In order to support JFFS2 partitions on this layout, | ||
243 | * we must lie to MTD about the real size of JFFS2 | ||
244 | * partitions; this ensures that the AFS flash footer | ||
245 | * won't be erased by JFFS2. Please ensure that your | ||
246 | * JFFS2 partitions are given image numbers between | ||
247 | * 1000 and 2000 inclusive. | ||
248 | */ | ||
249 | if (iis.imageNumber >= 1000 && iis.imageNumber < 2000) | ||
250 | size -= mtd->erasesize; | ||
251 | 239 | ||
252 | parts[idx].name = str; | 240 | parts[idx].name = str; |
253 | parts[idx].size = size; | 241 | parts[idx].size = (iis.length + mtd->erasesize - 1) & ~(mtd->erasesize - 1); |
254 | parts[idx].offset = img_ptr; | 242 | parts[idx].offset = img_ptr; |
255 | parts[idx].mask_flags = 0; | 243 | parts[idx].mask_flags = 0; |
256 | 244 | ||