Index: embios/trunk/disk.c |
— | — | @@ -19,7 +19,6 @@ |
20 | 20 | * |
21 | 21 | ****************************************************************************/ |
22 | 22 | #include <stdio.h> |
23 | | -#include "kernel.h" |
24 | 23 | #include "storage.h" |
25 | 24 | #include "debug.h" |
26 | 25 | #include "fat.h" |
— | — | @@ -67,8 +66,8 @@ |
68 | 67 | int i; |
69 | 68 | unsigned char sector[SECTOR_SIZE]; |
70 | 69 | #ifdef HAVE_MULTIDRIVE |
71 | | - /* For each drive, start at a different position, in order not to destroy |
72 | | - the first entry of drive 0. |
| 70 | + /* For each drive, start at a different position, in order not to destroy |
| 71 | + the first entry of drive 0. |
73 | 72 | That one is needed to calculate config sector position. */ |
74 | 73 | struct partinfo* pinfo = &part[drive*4]; |
75 | 74 | if ((size_t)drive >= sizeof(part)/sizeof(*part)/4) |
Index: embios/trunk/SOURCES |
— | — | @@ -35,3 +35,5 @@ |
36 | 36 | usb/usb.c
|
37 | 37 | shutdown.c
|
38 | 38 | syscall.c
|
| 39 | +disk.c
|
| 40 | +fat32.c
|
Index: embios/trunk/fat.c |
— | — | @@ -31,8 +31,6 @@ |
32 | 32 | #include "timefuncs.h" |
33 | 33 | #include "kernel.h" |
34 | 34 | #include "rbunicode.h" |
35 | | -/*#define LOGF_ENABLE*/ |
36 | | -#include "logf.h" |
37 | 35 | |
38 | 36 | #define BYTES2INT16(array,pos) \ |
39 | 37 | (array[pos] | (array[pos+1] << 8 )) |
— | — | @@ -450,11 +448,11 @@ |
451 | 449 | fat_recalc_free(IF_MV(volume)); |
452 | 450 | } |
453 | 451 | |
454 | | - LDEBUGF("Freecount: %ld\n",fat_bpb->fsinfo.freecount); |
455 | | - LDEBUGF("Nextfree: 0x%lx\n",fat_bpb->fsinfo.nextfree); |
456 | | - LDEBUGF("Cluster count: 0x%lx\n",fat_bpb->dataclusters); |
457 | | - LDEBUGF("Sectors per cluster: %d\n",fat_bpb->bpb_secperclus); |
458 | | - LDEBUGF("FAT sectors: 0x%lx\n",fat_bpb->fatsize); |
| 452 | + DEBUGF("Freecount: %ld\n",fat_bpb->fsinfo.freecount); |
| 453 | + DEBUGF("Nextfree: 0x%lx\n",fat_bpb->fsinfo.nextfree); |
| 454 | + DEBUGF("Cluster count: 0x%lx\n",fat_bpb->dataclusters); |
| 455 | + DEBUGF("Sectors per cluster: %d\n",fat_bpb->bpb_secperclus); |
| 456 | + DEBUGF("FAT sectors: 0x%lx\n",fat_bpb->fatsize); |
459 | 457 | |
460 | 458 | #ifdef HAVE_MULTIVOLUME |
461 | 459 | fat_bpb->mounted = true; |
— | — | @@ -737,7 +735,7 @@ |
738 | 736 | cluster numbers out of bounds */ |
739 | 737 | if ( c < 2 || c > fat_bpb->dataclusters+1 ) |
740 | 738 | continue; |
741 | | - LDEBUGF("find_free_cluster(%x) == %x\n",startcluster,c); |
| 739 | + DEBUGF("find_free_cluster(%x) == %x\n",startcluster,c); |
742 | 740 | fat_bpb->fsinfo.nextfree = c; |
743 | 741 | return c; |
744 | 742 | } |
— | — | @@ -765,7 +763,7 @@ |
766 | 764 | cluster numbers out of bounds */ |
767 | 765 | if ( c < 2 || c > fat_bpb->dataclusters+1 ) |
768 | 766 | continue; |
769 | | - LDEBUGF("find_free_cluster(%lx) == %lx\n",startcluster,c); |
| 767 | + DEBUGF("find_free_cluster(%lx) == %lx\n",startcluster,c); |
770 | 768 | fat_bpb->fsinfo.nextfree = c; |
771 | 769 | return c; |
772 | 770 | } |
— | — | @@ -774,7 +772,7 @@ |
775 | 773 | } |
776 | 774 | } |
777 | 775 | |
778 | | - LDEBUGF("find_free_cluster(%lx) == 0\n",startcluster); |
| 776 | + DEBUGF("find_free_cluster(%lx) == 0\n",startcluster); |
779 | 777 | return 0; /* 0 is an illegal cluster number */ |
780 | 778 | } |
781 | 779 | |
— | — | @@ -793,7 +791,7 @@ |
794 | 792 | |
795 | 793 | val &= 0xFFFF; |
796 | 794 | |
797 | | - LDEBUGF("update_fat_entry(%x,%x)\n",entry,val); |
| 795 | + DEBUGF("update_fat_entry(%x,%x)\n",entry,val); |
798 | 796 | |
799 | 797 | if (entry==val) |
800 | 798 | panicf("Creating FAT loop: %lx,%lx\n",entry,val); |
— | — | @@ -817,7 +815,7 @@ |
818 | 816 | fat_bpb->fsinfo.freecount++; |
819 | 817 | } |
820 | 818 | |
821 | | - LDEBUGF("update_fat_entry: %d free clusters\n", |
| 819 | + DEBUGF("update_fat_entry: %d free clusters\n", |
822 | 820 | fat_bpb->fsinfo.freecount); |
823 | 821 | |
824 | 822 | sec[offset] = htole16(val); |
— | — | @@ -829,7 +827,7 @@ |
830 | 828 | int offset = entry % CLUSTERS_PER_FAT_SECTOR; |
831 | 829 | unsigned long* sec; |
832 | 830 | |
833 | | - LDEBUGF("update_fat_entry(%lx,%lx)\n",entry,val); |
| 831 | + DEBUGF("update_fat_entry(%lx,%lx)\n",entry,val); |
834 | 832 | |
835 | 833 | if (entry==val) |
836 | 834 | panicf("Creating FAT loop: %lx,%lx\n",entry,val); |
— | — | @@ -854,7 +852,7 @@ |
855 | 853 | fat_bpb->fsinfo.freecount++; |
856 | 854 | } |
857 | 855 | |
858 | | - LDEBUGF("update_fat_entry: %ld free clusters\n", |
| 856 | + DEBUGF("update_fat_entry: %ld free clusters\n", |
859 | 857 | fat_bpb->fsinfo.freecount); |
860 | 858 | |
861 | 859 | /* don't change top 4 bits */ |
— | — | @@ -973,7 +971,7 @@ |
974 | 972 | int i; |
975 | 973 | int rc; |
976 | 974 | unsigned char *sec; |
977 | | - LDEBUGF("flush_fat()\n"); |
| 975 | + DEBUGF("flush_fat()\n"); |
978 | 976 | |
979 | 977 | mutex_lock(&cache_mutex); |
980 | 978 | for(i = 0;i < FAT_CACHE_SIZE;i++) |
— | — | @@ -1113,7 +1111,7 @@ |
1114 | 1112 | int rc; |
1115 | 1113 | unsigned short name_utf16[namelen + 1]; |
1116 | 1114 | |
1117 | | - LDEBUGF("write_long_name(file:%lx, first:%d, num:%d, name:%s)\n", |
| 1115 | + DEBUGF("write_long_name(file:%lx, first:%d, num:%d, name:%s)\n", |
1118 | 1116 | file->firstcluster, firstentry, numentries, name); |
1119 | 1117 | |
1120 | 1118 | rc = fat_seek(file, sector); |
— | — | @@ -1154,7 +1152,7 @@ |
1155 | 1153 | /* read next sector */ |
1156 | 1154 | rc = fat_readwrite(file, 1, buf, false); |
1157 | 1155 | if (rc<0) { |
1158 | | - LDEBUGF("Failed writing new sector: %d\n",rc); |
| 1156 | + DEBUGF("Failed writing new sector: %d\n",rc); |
1159 | 1157 | return rc * 10 - 5; |
1160 | 1158 | } |
1161 | 1159 | if (rc==0) |
— | — | @@ -1207,12 +1205,12 @@ |
1208 | 1206 | entry[FATDIR_FSTCLUSLO] = 0; |
1209 | 1207 | entry[FATLONG_TYPE] = 0; |
1210 | 1208 | entry[FATLONG_CHKSUM] = chksum; |
1211 | | - LDEBUGF("Longname entry %d: %s\n", idx, name+nameidx); |
| 1209 | + DEBUGF("Longname entry %d: %s\n", idx, name+nameidx); |
1212 | 1210 | } |
1213 | 1211 | else { |
1214 | 1212 | /* shortname entry */ |
1215 | 1213 | unsigned short date=0, time=0, tenth=0; |
1216 | | - LDEBUGF("Shortname entry: %s\n", shortname); |
| 1214 | + DEBUGF("Shortname entry: %s\n", shortname); |
1217 | 1215 | memcpy(entry + FATDIR_NAME, shortname, 11); |
1218 | 1216 | entry[FATDIR_ATTR] = is_directory?FAT_ATTR_DIRECTORY:0; |
1219 | 1217 | entry[FATDIR_NTRES] = 0; |
— | — | @@ -1282,7 +1280,7 @@ |
1283 | 1281 | int entries_needed, entries_found = 0; |
1284 | 1282 | int firstentry; |
1285 | 1283 | |
1286 | | - LDEBUGF( "add_dir_entry(%s,%lx)\n", |
| 1284 | + DEBUGF( "add_dir_entry(%s,%lx)\n", |
1287 | 1285 | name, file->firstcluster); |
1288 | 1286 | |
1289 | 1287 | /* Don't check dotdirs name for validity */ |
— | — | @@ -1335,7 +1333,7 @@ |
1336 | 1334 | } |
1337 | 1335 | |
1338 | 1336 | if (rc == 0) { /* current end of dir reached */ |
1339 | | - LDEBUGF("End of dir on cluster boundary\n"); |
| 1337 | + DEBUGF("End of dir on cluster boundary\n"); |
1340 | 1338 | break; |
1341 | 1339 | } |
1342 | 1340 | |
— | — | @@ -1345,7 +1343,7 @@ |
1346 | 1344 | switch (buf[i * DIR_ENTRY_SIZE]) { |
1347 | 1345 | case 0: |
1348 | 1346 | entries_found += DIR_ENTRIES_PER_SECTOR - i; |
1349 | | - LDEBUGF("Found end of dir %d\n", |
| 1347 | + DEBUGF("Found end of dir %d\n", |
1350 | 1348 | sector * DIR_ENTRIES_PER_SECTOR + i); |
1351 | 1349 | i = DIR_ENTRIES_PER_SECTOR - 1; |
1352 | 1350 | done = true; |
— | — | @@ -1353,7 +1351,7 @@ |
1354 | 1352 | |
1355 | 1353 | case 0xe5: |
1356 | 1354 | entries_found++; |
1357 | | - LDEBUGF("Found free entry %d (%d/%d)\n", |
| 1355 | + DEBUGF("Found free entry %d (%d/%d)\n", |
1358 | 1356 | sector * DIR_ENTRIES_PER_SECTOR + i, |
1359 | 1357 | entries_found, entries_needed); |
1360 | 1358 | break; |
— | — | @@ -1365,7 +1363,7 @@ |
1366 | 1364 | if (!strncmp(shortname, buf + i * DIR_ENTRY_SIZE, 11)) { |
1367 | 1365 | /* shortname exists already, make a new one */ |
1368 | 1366 | randomize_dos_name(shortname); |
1369 | | - LDEBUGF("Duplicate shortname, changing to %s\n", |
| 1367 | + DEBUGF("Duplicate shortname, changing to %s\n", |
1370 | 1368 | shortname); |
1371 | 1369 | |
1372 | 1370 | /* name has changed, we need to restart search */ |
— | — | @@ -1382,7 +1380,7 @@ |
1383 | 1381 | /* step 2: extend the dir if necessary */ |
1384 | 1382 | if (firstentry < 0) |
1385 | 1383 | { |
1386 | | - LDEBUGF("Adding new sector(s) to dir\n"); |
| 1384 | + DEBUGF("Adding new sector(s) to dir\n"); |
1387 | 1385 | rc = fat_seek(&dir->file, sector); |
1388 | 1386 | if (rc < 0) |
1389 | 1387 | return rc * 10 - 4; |
— | — | @@ -1407,7 +1405,7 @@ |
1408 | 1406 | |
1409 | 1407 | /* step 3: add entry */ |
1410 | 1408 | sector = firstentry / DIR_ENTRIES_PER_SECTOR; |
1411 | | - LDEBUGF("Adding longname to entry %d in sector %d\n", |
| 1409 | + DEBUGF("Adding longname to entry %d in sector %d\n", |
1412 | 1410 | firstentry, sector); |
1413 | 1411 | |
1414 | 1412 | rc = write_long_name(&dir->file, firstentry, |
— | — | @@ -1419,7 +1417,7 @@ |
1420 | 1418 | file->direntry = firstentry + entries_needed - 1; |
1421 | 1419 | file->direntries = entries_needed; |
1422 | 1420 | file->dircluster = dir->file.firstcluster; |
1423 | | - LDEBUGF("Added new dir entry %d, using %d slots.\n", |
| 1421 | + DEBUGF("Added new dir entry %d, using %d slots.\n", |
1424 | 1422 | file->direntry, file->direntries); |
1425 | 1423 | |
1426 | 1424 | return 0; |
— | — | @@ -1540,7 +1538,7 @@ |
1541 | 1539 | struct fat_file dir; |
1542 | 1540 | int rc; |
1543 | 1541 | |
1544 | | - LDEBUGF("update_file_size(cluster:%lx entry:%d size:%ld)\n", |
| 1542 | + DEBUGF("update_file_size(cluster:%lx entry:%d size:%ld)\n", |
1545 | 1543 | file->firstcluster, file->direntry, size); |
1546 | 1544 | |
1547 | 1545 | /* create a temporary file handle for the dir holding this file */ |
— | — | @@ -1661,12 +1659,12 @@ |
1662 | 1660 | /* fixme: remove error check when done */ |
1663 | 1661 | if (volume >= NUM_VOLUMES || !fat_bpbs[volume].mounted) |
1664 | 1662 | { |
1665 | | - LDEBUGF("fat_open() illegal volume %d\n", volume); |
| 1663 | + DEBUGF("fat_open() illegal volume %d\n", volume); |
1666 | 1664 | return -1; |
1667 | 1665 | } |
1668 | 1666 | #endif |
1669 | 1667 | |
1670 | | - LDEBUGF("fat_open(%lx), entry %d\n",startcluster,file->direntry); |
| 1668 | + DEBUGF("fat_open(%lx), entry %d\n",startcluster,file->direntry); |
1671 | 1669 | return 0; |
1672 | 1670 | } |
1673 | 1671 | |
— | — | @@ -1676,7 +1674,7 @@ |
1677 | 1675 | { |
1678 | 1676 | int rc; |
1679 | 1677 | |
1680 | | - LDEBUGF("fat_create_file(\"%s\",%lx,%lx)\n",name,(long)file,(long)dir); |
| 1678 | + DEBUGF("fat_create_file(\"%s\",%lx,%lx)\n",name,(long)file,(long)dir); |
1681 | 1679 | rc = add_dir_entry(dir, file, name, false, false); |
1682 | 1680 | if (!rc) { |
1683 | 1681 | file->firstcluster = 0; |
— | — | @@ -1705,7 +1703,7 @@ |
1706 | 1704 | int rc; |
1707 | 1705 | struct fat_file dummyfile; |
1708 | 1706 | |
1709 | | - LDEBUGF("fat_create_dir(\"%s\",%lx,%lx)\n",name,(long)newdir,(long)dir); |
| 1707 | + DEBUGF("fat_create_dir(\"%s\",%lx,%lx)\n",name,(long)newdir,(long)dir); |
1710 | 1708 | |
1711 | 1709 | memset(newdir, 0, sizeof(struct fat_dir)); |
1712 | 1710 | memset(&dummyfile, 0, sizeof(struct fat_file)); |
— | — | @@ -1770,7 +1768,7 @@ |
1771 | 1769 | struct bpb* fat_bpb = &fat_bpbs[file->volume]; |
1772 | 1770 | #endif |
1773 | 1771 | |
1774 | | - LDEBUGF("fat_truncate(%lx, %lx)\n", file->firstcluster, last); |
| 1772 | + DEBUGF("fat_truncate(%lx, %lx)\n", file->firstcluster, last); |
1775 | 1773 | |
1776 | 1774 | for ( last = get_next_cluster(IF_MV2(fat_bpb,) last); last; last = next ) { |
1777 | 1775 | next = get_next_cluster(IF_MV2(fat_bpb,) last); |
— | — | @@ -1788,7 +1786,7 @@ |
1789 | 1787 | #ifdef HAVE_MULTIVOLUME |
1790 | 1788 | struct bpb* fat_bpb = &fat_bpbs[file->volume]; |
1791 | 1789 | #endif |
1792 | | - LDEBUGF("fat_closewrite(size=%ld)\n",size); |
| 1790 | + DEBUGF("fat_closewrite(size=%ld)\n",size); |
1793 | 1791 | |
1794 | 1792 | if (!size) { |
1795 | 1793 | /* empty file */ |
— | — | @@ -1819,11 +1817,11 @@ |
1820 | 1818 | long next; |
1821 | 1819 | for ( next = file->firstcluster; next; |
1822 | 1820 | next = get_next_cluster(IF_MV2(fat_bpb,) next) ) { |
1823 | | - LDEBUGF("cluster %ld: %lx\n", count, next); |
| 1821 | + DEBUGF("cluster %ld: %lx\n", count, next); |
1824 | 1822 | count++; |
1825 | 1823 | } |
1826 | 1824 | len = count * fat_bpb->bpb_secperclus * SECTOR_SIZE; |
1827 | | - LDEBUGF("File is %ld clusters (chainlen=%ld, size=%ld)\n", |
| 1825 | + DEBUGF("File is %ld clusters (chainlen=%ld, size=%ld)\n", |
1828 | 1826 | count, len, size ); |
1829 | 1827 | if ( len > size + fat_bpb->bpb_secperclus * SECTOR_SIZE) |
1830 | 1828 | panicf("Cluster chain is too long\n"); |
— | — | @@ -1859,7 +1857,7 @@ |
1860 | 1858 | return rc * 10 - 3; |
1861 | 1859 | |
1862 | 1860 | for (i=0; i < numentries; i++) { |
1863 | | - LDEBUGF("Clearing dir entry %d (%d/%d)\n", |
| 1861 | + DEBUGF("Clearing dir entry %d (%d/%d)\n", |
1864 | 1862 | entry, i+1, numentries); |
1865 | 1863 | buf[(entry % DIR_ENTRIES_PER_SECTOR) * DIR_ENTRY_SIZE] = 0xe5; |
1866 | 1864 | entry++; |
— | — | @@ -1906,7 +1904,7 @@ |
1907 | 1905 | struct bpb* fat_bpb = &fat_bpbs[file->volume]; |
1908 | 1906 | #endif |
1909 | 1907 | |
1910 | | - LDEBUGF("fat_remove(%lx)\n",last); |
| 1908 | + DEBUGF("fat_remove(%lx)\n",last); |
1911 | 1909 | |
1912 | 1910 | while ( last ) { |
1913 | 1911 | next = get_next_cluster(IF_MV2(fat_bpb,) last); |
— | — | @@ -2045,7 +2043,7 @@ |
2046 | 2044 | long cluster = 0; |
2047 | 2045 | long sector; |
2048 | 2046 | |
2049 | | - LDEBUGF("next_write_cluster(%lx,%lx)\n",file->firstcluster, oldcluster); |
| 2047 | + DEBUGF("next_write_cluster(%lx,%lx)\n",file->firstcluster, oldcluster); |
2050 | 2048 | |
2051 | 2049 | if (oldcluster) |
2052 | 2050 | cluster = get_next_cluster(IF_MV2(fat_bpb,) oldcluster); |
— | — | @@ -2094,7 +2092,7 @@ |
2095 | 2093 | #endif |
2096 | 2094 | int rc; |
2097 | 2095 | |
2098 | | - LDEBUGF("transfer(s=%lx, c=%lx, %s)\n", |
| 2096 | + DEBUGF("transfer(s=%lx, c=%lx, %s)\n", |
2099 | 2097 | start+ fat_bpb->startsector, count, write?"write":"read"); |
2100 | 2098 | if (write) { |
2101 | 2099 | unsigned long firstallowed; |
— | — | @@ -2143,9 +2141,9 @@ |
2144 | 2142 | long i; |
2145 | 2143 | int rc; |
2146 | 2144 | |
2147 | | - LDEBUGF( "fat_readwrite(file:%lx,count:0x%lx,buf:%lx,%s)\n", |
| 2145 | + DEBUGF( "fat_readwrite(file:%lx,count:0x%lx,buf:%lx,%s)\n", |
2148 | 2146 | file->firstcluster,sectorcount,(long)buf,write?"write":"read"); |
2149 | | - LDEBUGF( "fat_readwrite: sec=%lx numsec=%ld eof=%d\n", |
| 2147 | + DEBUGF( "fat_readwrite: sec=%lx numsec=%ld eof=%d\n", |
2150 | 2148 | sector,numsec, eof?1:0); |
2151 | 2149 | |
2152 | 2150 | if ( eof && !write) |
— | — | @@ -2286,7 +2284,7 @@ |
2287 | 2285 | sectornum = -1; |
2288 | 2286 | } |
2289 | 2287 | |
2290 | | - LDEBUGF("fat_seek(%lx, %lx) == %lx, %lx, %lx\n", |
| 2288 | + DEBUGF("fat_seek(%lx, %lx) == %lx, %lx, %lx\n", |
2291 | 2289 | file->firstcluster, seeksector, cluster, sector, sectornum); |
2292 | 2290 | |
2293 | 2291 | file->lastcluster = cluster; |
— | — | @@ -2305,7 +2303,7 @@ |
2306 | 2304 | /* fixme: remove error check when done */ |
2307 | 2305 | if (volume >= NUM_VOLUMES || !fat_bpbs[volume].mounted) |
2308 | 2306 | { |
2309 | | - LDEBUGF("fat_open() illegal volume %d\n", volume); |
| 2307 | + DEBUGF("fat_open() illegal volume %d\n", volume); |
2310 | 2308 | return -1; |
2311 | 2309 | } |
2312 | 2310 | #else |
— | — | @@ -2405,7 +2403,7 @@ |
2406 | 2404 | else { |
2407 | 2405 | /* check orphan entry */ |
2408 | 2406 | if (nb_longs == 0) { |
2409 | | - logf("fat warning: orphan LFN entry"); |
| 2407 | + DEBUGF("fat warning: orphan LFN entry"); |
2410 | 2408 | /* ignore */ |
2411 | 2409 | continue; |
2412 | 2410 | } |
— | — | @@ -2412,7 +2410,7 @@ |
2413 | 2411 | |
2414 | 2412 | /* check order */ |
2415 | 2413 | if (order != (last_long_ord - 1)) { |
2416 | | - logf("fat warning: wrong LFN ordinal"); |
| 2414 | + DEBUGF("fat warning: wrong LFN ordinal"); |
2417 | 2415 | /* ignore the whole LFN, will trigger lots of warnings */ |
2418 | 2416 | nb_longs = 0; |
2419 | 2417 | } |
— | — | @@ -2485,15 +2483,15 @@ |
2486 | 2484 | Beware: this file will be shown with strange |
2487 | 2485 | glyphs in file browser since unicode 0x80 to 0x9F |
2488 | 2486 | are control characters. */ |
2489 | | - logf("SN-DOS: %s", shortname); |
| 2487 | + DEBUGF("SN-DOS: %s", shortname); |
2490 | 2488 | unsigned char *utf8; |
2491 | 2489 | utf8 = iso_decode(shortname, entry->name, -1, |
2492 | 2490 | strlen(shortname)); |
2493 | 2491 | *utf8 = 0; |
2494 | | - logf("SN: %s", entry->name); |
| 2492 | + DEBUGF("SN: %s", entry->name); |
2495 | 2493 | } else { |
2496 | | - logf("LN: %s", entry->name); |
2497 | | - logf("LNLen: %d", longname_utf8len); |
| 2494 | + DEBUGF("LN: %s", entry->name); |
| 2495 | + DEBUGF("LNLen: %d", longname_utf8len); |
2498 | 2496 | } |
2499 | 2497 | } |
2500 | 2498 | done = true; |
Index: embios/trunk/fat.h |
— | — | @@ -115,13 +115,13 @@ |
116 | 116 | extern int fat_create_file(const char* name, |
117 | 117 | struct fat_file* ent, |
118 | 118 | struct fat_dir* dir); |
119 | | -extern long fat_readwrite(struct fat_file *ent, long sectorcount, |
| 119 | +extern long fat_readwrite(struct fat_file *ent, long sectorcount, |
120 | 120 | void* buf, bool write ); |
121 | 121 | extern int fat_closewrite(struct fat_file *ent, long size, int attr); |
122 | 122 | extern int fat_seek(struct fat_file *ent, unsigned long sector ); |
123 | 123 | extern int fat_remove(struct fat_file *ent); |
124 | 124 | extern int fat_truncate(const struct fat_file *ent); |
125 | | -extern int fat_rename(struct fat_file* file, |
| 125 | +extern int fat_rename(struct fat_file* file, |
126 | 126 | struct fat_dir* dir, |
127 | 127 | const unsigned char* newname, |
128 | 128 | long size, int attr); |
Index: embios/trunk/file.c |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | |
36 | 36 | Since the fat32 driver only manages sectors, we maintain a one-sector |
37 | 37 | cache for each open file. This way we can provide byte access without |
38 | | - having to re-read the sector each time. |
| 38 | + having to re-read the sector each time. |
39 | 39 | The penalty is the RAM used for the cache and slightly more complex code. |
40 | 40 | */ |
41 | 41 | |
— | — | @@ -73,7 +73,7 @@ |
74 | 74 | (void)use_cache; |
75 | 75 | #endif |
76 | 76 | |
77 | | - LDEBUGF("open(\"%s\",%d)\n",pathname,flags); |
| 77 | + DEBUGF("open(\"%s\",%d)\n",pathname,flags); |
78 | 78 | |
79 | 79 | if ( pathname[0] != '/' ) { |
80 | 80 | DEBUGF("'%s' is not an absolute path.\n",pathname); |
— | — | @@ -176,7 +176,7 @@ |
177 | 177 | } |
178 | 178 | |
179 | 179 | if ( !entry ) { |
180 | | - LDEBUGF("Didn't find file %s\n",name); |
| 180 | + DEBUGF("Didn't find file %s\n",name); |
181 | 181 | if ( file->write && (flags & O_CREAT) ) { |
182 | 182 | rc = fat_create_file(name, |
183 | 183 | &(file->fatfile), |
— | — | @@ -239,7 +239,7 @@ |
240 | 240 | struct filedesc* file = &openfiles[fd]; |
241 | 241 | int rc = 0; |
242 | 242 | |
243 | | - LDEBUGF("close(%d)\n", fd); |
| 243 | + DEBUGF("close(%d)\n", fd); |
244 | 244 | |
245 | 245 | if (fd < 0 || fd > MAX_OPEN_FILES-1) { |
246 | 246 | errno = EINVAL; |
— | — | @@ -268,7 +268,7 @@ |
269 | 269 | struct filedesc* file = &openfiles[fd]; |
270 | 270 | int rc = 0; |
271 | 271 | |
272 | | - LDEBUGF("fsync(%d)\n", fd); |
| 272 | + DEBUGF("fsync(%d)\n", fd); |
273 | 273 | |
274 | 274 | if (fd < 0 || fd > MAX_OPEN_FILES-1) { |
275 | 275 | errno = EINVAL; |
— | — | @@ -516,7 +516,7 @@ |
517 | 517 | return -1; |
518 | 518 | } |
519 | 519 | |
520 | | - LDEBUGF( "readwrite(%d,%lx,%ld,%s)\n", |
| 520 | + DEBUGF( "readwrite(%d,%lx,%ld,%s)\n", |
521 | 521 | fd,(long)buf,count,write?"write":"read"); |
522 | 522 | |
523 | 523 | /* attempt to read past EOF? */ |
— | — | @@ -606,7 +606,7 @@ |
607 | 607 | if (write) { |
608 | 608 | if ( file->fileoffset + nread < file->size ) { |
609 | 609 | /* sector is only partially filled. copy-back from disk */ |
610 | | - LDEBUGF("Copy-back tail cache\n"); |
| 610 | + DEBUGF("Copy-back tail cache\n"); |
611 | 611 | rc = fat_readwrite(&(file->fatfile), 1, file->cache, false ); |
612 | 612 | if ( rc < 0 ) { |
613 | 613 | DEBUGF("Failed writing\n"); |
— | — | @@ -663,7 +663,7 @@ |
664 | 664 | } |
665 | 665 | |
666 | 666 | file->fileoffset += nread; |
667 | | - LDEBUGF("fileoffset: %ld\n", file->fileoffset); |
| 667 | + DEBUGF("fileoffset: %ld\n", file->fileoffset); |
668 | 668 | |
669 | 669 | /* adjust file size to length written */ |
670 | 670 | if ( write && file->fileoffset > file->size ) |
— | — | @@ -701,7 +701,7 @@ |
702 | 702 | int rc; |
703 | 703 | struct filedesc* file = &openfiles[fd]; |
704 | 704 | |
705 | | - LDEBUGF("lseek(%d,%ld,%d)\n",fd,offset,whence); |
| 705 | + DEBUGF("lseek(%d,%ld,%d)\n",fd,offset,whence); |
706 | 706 | |
707 | 707 | if (fd < 0 || fd > MAX_OPEN_FILES-1) { |
708 | 708 | errno = EINVAL; |