freemyipod r488 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r487‎ | r488 | r489 >
Date:19:51, 22 January 2011
Author:theseven
Status:new
Tags:
Comment:
emCORE: Fix lost ATA BBT allocation on iPod Classic, add some debugging output
Modified paths:
  • /emcore/trunk/dir.c (modified) (history)
  • /emcore/trunk/fat.c (modified) (history)
  • /emcore/trunk/target/ipodclassic/storage_ata.c (modified) (history)
  • /emcore/trunk/tools/emcore.py (modified) (history)

Diff [purge]

Index: emcore/trunk/tools/emcore.py
@@ -1038,7 +1038,7 @@
10391039 try:
10401040 self.logger.info("Downloading file " + remotename + " to " + localname + "...")
10411041 while size > 0:
1042 - bytes = self.emcore.file_read(fd, buffsize, buffer)
 1042+ bytes = self.emcore.file_read(fd, buffsize, buffer).rc
10431043 f.write(self.emcore.read(buffer, bytes))
10441044 size = size - bytes
10451045 finally:
Index: emcore/trunk/target/ipodclassic/storage_ata.c
@@ -552,6 +552,7 @@
553553 break;
554554 ata_bbt_read_sectors(phys, cnt, ata_bbt[i << 6]);
555555 }
 556+ reownalloc(ata_bbt, NULL);
556557 }
557558 else ata_virtual_sectors = ata_total_sectors;
558559 free(buf);
Index: emcore/trunk/fat.c
@@ -2399,12 +2399,13 @@
24002400 rc = fat_readwrite(&dir->file, 1, dir->sectorcache, false);
24012401 if (rc == 0) {
24022402 /* eof */
 2403+ DEBUGF("fat_getnext() - Reached end of dir cluster chain");
24032404 entry->name[0] = 0;
24042405 break;
24052406 }
24062407 if (rc < 0) {
2407 - DEBUGF( "fat_getnext() - Couldn't read dir"
2408 - " (error code %d)", rc);
 2408+ DEBUGF("fat_getnext() - Couldn't read dir"
 2409+ " (error code %d)", rc);
24092410 return rc * 10 - 1;
24102411 }
24112412 dir->sector = dir->file.lastsector;
@@ -2425,6 +2426,7 @@
24262427
24272428 if (firstbyte == 0) {
24282429 /* last entry */
 2430+ DEBUGF("fat_getnext() - Reached final directory entry");
24292431 entry->name[0] = 0;
24302432 dir->entrycount = 0;
24312433 return 0;
Index: emcore/trunk/dir.c
@@ -85,7 +85,11 @@
8686 }
8787
8888 pdir = (DIR*)memalign(0x10, sizeof(DIR));
89 - if (!pdir) return NULL;
 89+ if (!pdir)
 90+ {
 91+ DEBUGF("Failed to allocate directory handle");
 92+ return NULL;
 93+ }
9094 pdir->process = current_thread;
9195
9296 #ifdef HAVE_MULTIVOLUME
@@ -108,6 +112,7 @@
109113 while (1) {
110114 if ((fat_getnext(&pdir->fatdir,&entry) < 0) ||
111115 (!entry.name[0])) {
 116+ DEBUGF("Directory not found");
112117 free(pdir);
113118 return NULL;
114119 }