Index: embios/trunk/target/ipodnano2g/ftl.c |
— | — | @@ -482,7 +482,7 @@ |
483 | 483 | if (page == 0) return 1;
|
484 | 484 | pagebase = page & ~(ftl_nand_type->pagesperblock - 1);
|
485 | 485 | if ((nand_read_page(bank, page, ftl_buffer,
|
486 | | - (uint32_t*)0, 1, 0) & 0x11F) != 0) return 1;
|
| 486 | + NULL, 1, 0) & 0x11F) != 0) return 1;
|
487 | 487 | if (memcmp(&ftl_buffer[0x18], "BBT", 4) != 0) return 1;
|
488 | 488 | unk1 = ((uint16_t*)ftl_buffer)[0x10];
|
489 | 489 | unk2 = ((uint16_t*)ftl_buffer)[0x11];
|
— | — | @@ -496,7 +496,7 @@ |
497 | 497 | if (page2 >= (uint32_t)(ftl_nand_type->pagesperblock - 8))
|
498 | 498 | break;
|
499 | 499 | if ((nand_read_page(bank, pagebase + page2, ftl_buffer,
|
500 | | - (void*)0, 1, 0) & 0x11F) == 0)
|
| 500 | + NULL, 1, 0) & 0x11F) == 0)
|
501 | 501 | {
|
502 | 502 | memcpy(bbt, ftl_buffer, 0x410);
|
503 | 503 | return 0;
|
— | — | @@ -628,7 +628,7 @@ |
629 | 629 | static struct ftl_vfl_cxt_type* ftl_vfl_get_newest_cxt(void)
|
630 | 630 | {
|
631 | 631 | uint32_t i, maxusn;
|
632 | | - struct ftl_vfl_cxt_type* cxt = (struct ftl_vfl_cxt_type*)0;
|
| 632 | + struct ftl_vfl_cxt_type* cxt = NULL;
|
633 | 633 | maxusn = 0;
|
634 | 634 | for (i = 0; i < ftl_banks; i++)
|
635 | 635 | if (ftl_vfl_cxt[i].usn >= maxusn)
|
— | — | @@ -920,8 +920,8 @@ |
921 | 921 | {
|
922 | 922 | for (i = 0; i < ftl_banks; i++)
|
923 | 923 | {
|
924 | | - void* databuf = (void*)0;
|
925 | | - void* sparebuf = (void*)0;
|
| 924 | + void* databuf = NULL;
|
| 925 | + void* sparebuf = NULL;
|
926 | 926 | if (buffer) databuf = (void*)((uint32_t)buffer + 0x800 * i);
|
927 | 927 | if (sparebuffer) sparebuf = (void*)((uint32_t)sparebuffer + 0x40 * i);
|
928 | 928 | uint32_t ret = ftl_vfl_read(vpage + i, databuf, sparebuf, checkempty, remaponfail);
|
— | — | @@ -1299,7 +1299,7 @@ |
1300 | 1300 | if (ftl_log[i].scatteredvblock == 0xFFFF) continue;
|
1301 | 1301 | if (ftl_log[i].logicalvblock == block) return &ftl_log[i];
|
1302 | 1302 | }
|
1303 | | - return (struct ftl_log_type*)0;
|
| 1303 | + return NULL;
|
1304 | 1304 | }
|
1305 | 1305 | #endif
|
1306 | 1306 |
|
— | — | @@ -1338,7 +1338,7 @@ |
1339 | 1339 | uint32_t abspage = ftl_map[block] * ppb + page;
|
1340 | 1340 | #ifndef FTL_READONLY
|
1341 | 1341 | struct ftl_log_type* logentry = ftl_get_log_entry(block);
|
1342 | | - if (logentry != (struct ftl_log_type*)0)
|
| 1342 | + if (logentry != NULL)
|
1343 | 1343 | {
|
1344 | 1344 | #ifdef FTL_TRACE
|
1345 | 1345 | DEBUGF("FTL: Block %d has a log entry", block);
|
— | — | @@ -1358,7 +1358,7 @@ |
1359 | 1359 |
|
1360 | 1360 | #ifndef FTL_READONLY
|
1361 | 1361 | if (count >= i + ftl_banks && !(page & (ftl_banks - 1))
|
1362 | | - && logentry == (struct ftl_log_type*)0)
|
| 1362 | + && logentry == NULL)
|
1363 | 1363 | #else
|
1364 | 1364 | if (count >= i + ftl_banks && !(page & (ftl_banks - 1)))
|
1365 | 1365 | #endif
|
— | — | @@ -1797,7 +1797,7 @@ |
1798 | 1798 | uint32_t i;
|
1799 | 1799 | uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks;
|
1800 | 1800 | uint32_t age = 0xFFFFFFFF, used = 0;
|
1801 | | - if (entry == (struct ftl_log_type*)0)
|
| 1801 | + if (entry == NULL)
|
1802 | 1802 | {
|
1803 | 1803 | for (i = 0; i < 0x11; i++)
|
1804 | 1804 | {
|
— | — | @@ -1812,7 +1812,7 @@ |
1813 | 1813 | entry = &ftl_log[i];
|
1814 | 1814 | }
|
1815 | 1815 | }
|
1816 | | - if (entry == (struct ftl_log_type*)0) return 1;
|
| 1816 | + if (entry == NULL) return 1;
|
1817 | 1817 | }
|
1818 | 1818 | else if (entry->pagescurrent < ppb / 2)
|
1819 | 1819 | {
|
— | — | @@ -1845,7 +1845,7 @@ |
1846 | 1846 | {
|
1847 | 1847 | uint32_t i;
|
1848 | 1848 | struct ftl_log_type* entry = ftl_get_log_entry(block);
|
1849 | | - if (entry != (struct ftl_log_type*)0)
|
| 1849 | + if (entry != NULL)
|
1850 | 1850 | {
|
1851 | 1851 | entry->usn = ftl_cxt.nextblockusn - 1;
|
1852 | 1852 | return entry;
|
— | — | @@ -1861,17 +1861,17 @@ |
1862 | 1862 | }
|
1863 | 1863 | }
|
1864 | 1864 |
|
1865 | | - if (entry == (struct ftl_log_type*)0)
|
| 1865 | + if (entry == NULL)
|
1866 | 1866 | {
|
1867 | 1867 | if (ftl_cxt.freecount < 3) panicf(PANIC_FATAL, "FTL: Detected a pool block leak!");
|
1868 | 1868 | else if (ftl_cxt.freecount == 3)
|
1869 | | - if (ftl_remove_scattered_block((struct ftl_log_type*)0) != 0)
|
1870 | | - return (struct ftl_log_type*)0;
|
| 1869 | + if (ftl_remove_scattered_block(NULL) != 0)
|
| 1870 | + return NULL;
|
1871 | 1871 | entry = ftl_log;
|
1872 | 1872 | while (entry->scatteredvblock != 0xFFFF) entry = &entry[1];
|
1873 | 1873 | entry->scatteredvblock = ftl_allocate_pool_block();
|
1874 | 1874 | if (entry->scatteredvblock == 0xFFFF)
|
1875 | | - return (struct ftl_log_type*)0;
|
| 1875 | + return NULL;
|
1876 | 1876 | }
|
1877 | 1877 |
|
1878 | 1878 | ftl_init_log_entry(entry);
|
— | — | @@ -1949,7 +1949,7 @@ |
1950 | 1950 | for (i = 0; i < ftl_nand_type->userblocks; i++)
|
1951 | 1951 | {
|
1952 | 1952 | if (ftl_erasectr[ftl_map[i]] > max) max = ftl_erasectr[ftl_map[i]];
|
1953 | | - if (ftl_get_log_entry(i) != (struct ftl_log_type*)0) continue;
|
| 1953 | + if (ftl_get_log_entry(i) != NULL) continue;
|
1954 | 1954 | if (ftl_erasectr[ftl_map[i]] < min)
|
1955 | 1955 | {
|
1956 | 1956 | minidx = i;
|
— | — | @@ -2028,7 +2028,7 @@ |
2029 | 2029 | uint32_t page = (sector + i) % ppb;
|
2030 | 2030 |
|
2031 | 2031 | struct ftl_log_type* logentry = ftl_allocate_log_entry(block);
|
2032 | | - if (logentry == (struct ftl_log_type*)0)
|
| 2032 | + if (logentry == NULL)
|
2033 | 2033 | {
|
2034 | 2034 | mutex_unlock(&ftl_mtx);
|
2035 | 2035 | return -5;
|
— | — | @@ -2089,7 +2089,7 @@ |
2090 | 2090 | #endif
|
2091 | 2091 | ftl_remove_scattered_block(logentry);
|
2092 | 2092 | logentry = ftl_allocate_log_entry(block);
|
2093 | | - if (logentry == (struct ftl_log_type*)0)
|
| 2093 | + if (logentry == NULL)
|
2094 | 2094 | {
|
2095 | 2095 | mutex_unlock(&ftl_mtx);
|
2096 | 2096 | return -7;
|
— | — | @@ -2532,7 +2532,7 @@ |
2533 | 2533 | blockwiped = 1;
|
2534 | 2534 | for (i = 0; i < ftl_nand_type->pagesperblock; i++)
|
2535 | 2535 | {
|
2536 | | - result = nand_read_page(0, i, ftl_buffer, (uint32_t*)0, 1, 1);
|
| 2536 | + result = nand_read_page(0, i, ftl_buffer, NULL, 1, 1);
|
2537 | 2537 | if ((result & 0x11F) == 0)
|
2538 | 2538 | {
|
2539 | 2539 | blockwiped = 0;
|