| Index: embios/trunk/panic.c |
| — | — | @@ -31,12 +31,26 @@ |
| 32 | 32 | #include "contextswitch.h"
|
| 33 | 33 |
|
| 34 | 34 |
|
| | 35 | +extern struct scheduler_thread* scheduler_threads;
|
| | 36 | +extern struct scheduler_thread* current_thread;
|
| 35 | 37 | void hang();
|
| 36 | 38 |
|
| 37 | 39 |
|
| 38 | 40 | void handle_panic(enum panic_severity severity)
|
| 39 | 41 | {
|
| 40 | | - thread_exit();
|
| | 42 | + int i;
|
| | 43 | + if (severity == PANIC_KILLTHREAD) thread_exit();
|
| | 44 | + else
|
| | 45 | + {
|
| | 46 | + uint32_t mode = enter_critical_section();
|
| | 47 | + for (i = 0; i < MAX_THREADS; i++)
|
| | 48 | + if (scheduler_threads[i].type == USER_THREAD)
|
| | 49 | + scheduler_threads[i].state = THREAD_SUSPENDED;
|
| | 50 | + current_thread->state = THREAD_DEFUNCT_ACK;
|
| | 51 | + current_thread->block_type = THREAD_DEFUNCT_PANIC;
|
| | 52 | + leave_critical_section(mode);
|
| | 53 | + context_switch();
|
| | 54 | + }
|
| 41 | 55 | }
|
| 42 | 56 |
|
| 43 | 57 | void panic(enum panic_severity severity, const char* string)
|
| Index: embios/trunk/disk.c |
| — | — | @@ -84,7 +84,7 @@ |
| 85 | 85 | /* check that the boot sector is initialized */ |
| 86 | 86 | if ( (sector[510] != 0x55) || |
| 87 | 87 | (sector[511] != 0xaa)) { |
| 88 | | - DEBUGF("Bad boot sector signature\n"); |
| | 88 | + DEBUGF("Bad boot sector signature"); |
| 89 | 89 | return NULL; |
| 90 | 90 | } |
| 91 | 91 | |
| — | — | @@ -95,7 +95,7 @@ |
| 96 | 96 | pinfo[i].start = BYTES2INT32(ptr, 8); |
| 97 | 97 | pinfo[i].size = BYTES2INT32(ptr, 12); |
| 98 | 98 | |
| 99 | | - DEBUGF("Part%d: Type %02x, start: %08lx size: %08lx\n", |
| | 99 | + DEBUGF("Part%d: Type %02x, start: %08lx size: %08lx", |
| 100 | 100 | i,pinfo[i].type,pinfo[i].start,pinfo[i].size); |
| 101 | 101 | |
| 102 | 102 | /* extended? */ |
| — | — | @@ -196,7 +196,7 @@ |
| 197 | 197 | |
| 198 | 198 | if (mounted == 0 && volume != -1) /* none of the 4 entries worked? */ |
| 199 | 199 | { /* try "superfloppy" mode */ |
| 200 | | - DEBUGF("No partition found, trying to mount sector 0.\n"); |
| | 200 | + DEBUGF("No partition found, trying to mount sector 0."); |
| 201 | 201 | if (!fat_mount(IF_MV2(volume,) IF_MD2(drive,) 0)) |
| 202 | 202 | { |
| 203 | 203 | mounted = 1; |
| Index: embios/trunk/panic.h |
| — | — | @@ -31,7 +31,7 @@ |
| 32 | 32 | enum panic_severity
|
| 33 | 33 | {
|
| 34 | 34 | PANIC_KILLTHREAD = 0,
|
| 35 | | - PANIC_KILLPROCESS = 1,
|
| | 35 | + PANIC_KILLUSERTHREADS = 1,
|
| 36 | 36 | PANIC_FATAL = 2
|
| 37 | 37 | };
|
| 38 | 38 |
|
| Index: embios/trunk/fat.c |
| — | — | @@ -236,7 +236,7 @@ |
| 237 | 237 | |
| 238 | 238 | if (cluster > (long)(fat_bpb->dataclusters + 1)) |
| 239 | 239 | { |
| 240 | | - DEBUGF( "cluster2sec() - Bad cluster number (%ld)\n", cluster); |
| | 240 | + DEBUGF( "cluster2sec() - Bad cluster number (%ld)", cluster); |
| 241 | 241 | return -1; |
| 242 | 242 | } |
| 243 | 243 | |
| — | — | @@ -309,7 +309,7 @@ |
| 310 | 310 | rc = storage_read_sectors(IF_MD2(drive,) startsector,1,buf); |
| 311 | 311 | if(rc) |
| 312 | 312 | { |
| 313 | | - DEBUGF( "fat_mount() - Couldn't read BPB (error code %d)\n", rc); |
| | 313 | + DEBUGF( "fat_mount() - Couldn't read BPB (error code %d)", rc); |
| 314 | 314 | return rc * 10 - 1; |
| 315 | 315 | } |
| 316 | 316 | |
| — | — | @@ -379,11 +379,11 @@ |
| 380 | 380 | fat_bpb->is_fat16 = true; |
| 381 | 381 | if (fat_bpb->dataclusters < 4085) |
| 382 | 382 | { /* FAT12 */ |
| 383 | | - DEBUGF("This is FAT12. Go away!\n"); |
| | 383 | + DEBUGF("This is FAT12. Go away!"); |
| 384 | 384 | return -2; |
| 385 | 385 | } |
| 386 | 386 | #else /* #ifdef HAVE_FAT16SUPPORT */ |
| 387 | | - DEBUGF("This is not FAT32. Go away!\n"); |
| | 387 | + DEBUGF("This is not FAT32. Go away!"); |
| 388 | 388 | return -2; |
| 389 | 389 | #endif /* #ifndef HAVE_FAT16SUPPORT */ |
| 390 | 390 | } |
| — | — | @@ -414,7 +414,7 @@ |
| 415 | 415 | rc = bpb_is_sane(IF_MV(fat_bpb)); |
| 416 | 416 | if (rc < 0) |
| 417 | 417 | { |
| 418 | | - DEBUGF( "fat_mount() - BPB is not sane\n"); |
| | 418 | + DEBUGF( "fat_mount() - BPB is not sane"); |
| 419 | 419 | return rc * 10 - 3; |
| 420 | 420 | } |
| 421 | 421 | |
| — | — | @@ -432,7 +432,7 @@ |
| 433 | 433 | startsector + fat_bpb->bpb_fsinfo, 1, buf); |
| 434 | 434 | if (rc < 0) |
| 435 | 435 | { |
| 436 | | - DEBUGF( "fat_mount() - Couldn't read FSInfo (error code %d)\n", rc); |
| | 436 | + DEBUGF( "fat_mount() - Couldn't read FSInfo (error code %d)", rc); |
| 437 | 437 | return rc * 10 - 4; |
| 438 | 438 | } |
| 439 | 439 | fat_bpb->fsinfo.freecount = BYTES2INT32(buf, FSINFO_FREECOUNT); |
| — | — | @@ -445,11 +445,11 @@ |
| 446 | 446 | fat_recalc_free(IF_MV(volume)); |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | | - DEBUGF("Freecount: %ld\n",fat_bpb->fsinfo.freecount); |
| 450 | | - DEBUGF("Nextfree: 0x%lx\n",fat_bpb->fsinfo.nextfree); |
| 451 | | - DEBUGF("Cluster count: 0x%lx\n",fat_bpb->dataclusters); |
| 452 | | - DEBUGF("Sectors per cluster: %d\n",fat_bpb->bpb_secperclus); |
| 453 | | - DEBUGF("FAT sectors: 0x%lx\n",fat_bpb->fatsize); |
| | 449 | + DEBUGF("Freecount: %ld",fat_bpb->fsinfo.freecount); |
| | 450 | + DEBUGF("Nextfree: 0x%lx",fat_bpb->fsinfo.nextfree); |
| | 451 | + DEBUGF("Cluster count: 0x%lx",fat_bpb->dataclusters); |
| | 452 | + DEBUGF("Sectors per cluster: %d",fat_bpb->bpb_secperclus); |
| | 453 | + DEBUGF("FAT sectors: 0x%lx",fat_bpb->fatsize); |
| 454 | 454 | |
| 455 | 455 | #ifdef HAVE_MULTIVOLUME |
| 456 | 456 | fat_bpb->mounted = true; |
| — | — | @@ -556,7 +556,7 @@ |
| 557 | 557 | #endif |
| 558 | 558 | if(fat_bpb->bpb_bytspersec % SECTOR_SIZE) |
| 559 | 559 | { |
| 560 | | - DEBUGF( "bpb_is_sane() - Error: sector size is not sane (%d)\n", |
| | 560 | + DEBUGF( "bpb_is_sane() - Error: sector size is not sane (%d)", |
| 561 | 561 | fat_bpb->bpb_bytspersec); |
| 562 | 562 | return -1; |
| 563 | 563 | } |
| — | — | @@ -564,7 +564,7 @@ |
| 565 | 565 | > 128L*1024L) |
| 566 | 566 | { |
| 567 | 567 | DEBUGF( "bpb_is_sane() - Error: cluster size is larger than 128K " |
| 568 | | - "(%d * %d = %d)\n", |
| | 568 | + "(%d * %d = %d)", |
| 569 | 569 | fat_bpb->bpb_bytspersec, fat_bpb->bpb_secperclus, |
| 570 | 570 | fat_bpb->bpb_bytspersec * fat_bpb->bpb_secperclus); |
| 571 | 571 | return -2; |
| — | — | @@ -571,19 +571,19 @@ |
| 572 | 572 | } |
| 573 | 573 | if(fat_bpb->bpb_numfats != 2) |
| 574 | 574 | { |
| 575 | | - DEBUGF( "bpb_is_sane() - Warning: NumFATS is not 2 (%d)\n", |
| | 575 | + DEBUGF( "bpb_is_sane() - Warning: NumFATS is not 2 (%d)", |
| 576 | 576 | fat_bpb->bpb_numfats); |
| 577 | 577 | } |
| 578 | 578 | if(fat_bpb->bpb_media != 0xf0 && fat_bpb->bpb_media < 0xf8) |
| 579 | 579 | { |
| 580 | 580 | DEBUGF( "bpb_is_sane() - Warning: Non-standard " |
| 581 | | - "media type (0x%02x)\n", |
| | 581 | + "media type (0x%02x)", |
| 582 | 582 | fat_bpb->bpb_media); |
| 583 | 583 | } |
| 584 | 584 | if(fat_bpb->last_word != 0xaa55) |
| 585 | 585 | { |
| 586 | 586 | DEBUGF( "bpb_is_sane() - Error: Last word is not " |
| 587 | | - "0xaa55 (0x%04x)\n", fat_bpb->last_word); |
| | 587 | + "0xaa55 (0x%04x)", fat_bpb->last_word); |
| 588 | 588 | return -3; |
| 589 | 589 | } |
| 590 | 590 | |
| — | — | @@ -592,7 +592,7 @@ |
| 593 | 593 | fat_bpb->bpb_secperclus) |
| 594 | 594 | { |
| 595 | 595 | DEBUGF( "bpb_is_sane() - Error: FSInfo.Freecount > disk size " |
| 596 | | - "(0x%04lx)\n", fat_bpb->fsinfo.freecount); |
| | 596 | + "(0x%04lx)", fat_bpb->fsinfo.freecount); |
| 597 | 597 | return -4; |
| 598 | 598 | } |
| 599 | 599 | |
| — | — | @@ -618,8 +618,8 @@ |
| 619 | 619 | sectorbuf); |
| 620 | 620 | if(rc < 0) |
| 621 | 621 | { |
| 622 | | - panicf("flush_fat_sector() - Could not write sector %ld" |
| 623 | | - " (error %d)\n", |
| | 622 | + panicf(PANIC_KILLUSERTHREADS, "flush_fat_sector() - Could not write sector %ld" |
| | 623 | + " (error %d)", |
| 624 | 624 | secnum, rc); |
| 625 | 625 | } |
| 626 | 626 | #ifdef HAVE_MULTIVOLUME |
| — | — | @@ -638,8 +638,8 @@ |
| 639 | 639 | secnum, 1, sectorbuf); |
| 640 | 640 | if(rc < 0) |
| 641 | 641 | { |
| 642 | | - panicf("flush_fat_sector() - Could not write sector %ld" |
| 643 | | - " (error %d)\n", |
| | 642 | + panicf(PANIC_KILLUSERTHREADS, "flush_fat_sector() - Could not write sector %ld" |
| | 643 | + " (error %d)", |
| 644 | 644 | secnum, rc); |
| 645 | 645 | } |
| 646 | 646 | } |
| — | — | @@ -686,7 +686,7 @@ |
| 687 | 687 | if(rc < 0) |
| 688 | 688 | { |
| 689 | 689 | DEBUGF( "cache_fat_sector() - Could not read sector %ld" |
| 690 | | - " (error %d)\n", secnum, rc); |
| | 690 | + " (error %d)", secnum, rc); |
| 691 | 691 | mutex_unlock(&cache_mutex); |
| 692 | 692 | return NULL; |
| 693 | 693 | } |
| — | — | @@ -732,7 +732,7 @@ |
| 733 | 733 | cluster numbers out of bounds */ |
| 734 | 734 | if ( c < 2 || c > fat_bpb->dataclusters+1 ) |
| 735 | 735 | continue; |
| 736 | | - DEBUGF("find_free_cluster(%x) == %x\n",startcluster,c); |
| | 736 | + DEBUGF("find_free_cluster(%x) == %x",startcluster,c); |
| 737 | 737 | fat_bpb->fsinfo.nextfree = c; |
| 738 | 738 | return c; |
| 739 | 739 | } |
| — | — | @@ -760,7 +760,7 @@ |
| 761 | 761 | cluster numbers out of bounds */ |
| 762 | 762 | if ( c < 2 || c > fat_bpb->dataclusters+1 ) |
| 763 | 763 | continue; |
| 764 | | - DEBUGF("find_free_cluster(%lx) == %lx\n",startcluster,c); |
| | 764 | + DEBUGF("find_free_cluster(%lx) == %lx",startcluster,c); |
| 765 | 765 | fat_bpb->fsinfo.nextfree = c; |
| 766 | 766 | return c; |
| 767 | 767 | } |
| — | — | @@ -769,7 +769,7 @@ |
| 770 | 770 | } |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | | - DEBUGF("find_free_cluster(%lx) == 0\n",startcluster); |
| | 773 | + DEBUGF("find_free_cluster(%lx) == 0",startcluster); |
| 774 | 774 | return 0; /* 0 is an illegal cluster number */ |
| 775 | 775 | } |
| 776 | 776 | |
| — | — | @@ -788,18 +788,18 @@ |
| 789 | 789 | |
| 790 | 790 | val &= 0xFFFF; |
| 791 | 791 | |
| 792 | | - DEBUGF("update_fat_entry(%x,%x)\n",entry,val); |
| | 792 | + DEBUGF("update_fat_entry(%x,%x)",entry,val); |
| 793 | 793 | |
| 794 | 794 | if (entry==val) |
| 795 | | - panicf("Creating FAT loop: %lx,%lx\n",entry,val); |
| | 795 | + panicf(PANIC_KILLUSERTHREADS, "Creating FAT loop: %lx,%lx",entry,val); |
| 796 | 796 | |
| 797 | 797 | if ( entry < 2 ) |
| 798 | | - panicf("Updating reserved FAT entry %ld.\n",entry); |
| | 798 | + panicf(PANIC_KILLUSERTHREADS, "Updating reserved FAT entry %ld.",entry); |
| 799 | 799 | |
| 800 | 800 | sec = cache_fat_sector(IF_MV2(fat_bpb,) sector, true); |
| 801 | 801 | if (!sec) |
| 802 | 802 | { |
| 803 | | - DEBUGF( "update_fat_entry() - Could not cache sector %d\n", sector); |
| | 803 | + DEBUGF( "update_fat_entry() - Could not cache sector %d", sector); |
| 804 | 804 | return -1; |
| 805 | 805 | } |
| 806 | 806 | |
| — | — | @@ -812,7 +812,7 @@ |
| 813 | 813 | fat_bpb->fsinfo.freecount++; |
| 814 | 814 | } |
| 815 | 815 | |
| 816 | | - DEBUGF("update_fat_entry: %d free clusters\n", |
| | 816 | + DEBUGF("update_fat_entry: %d free clusters", |
| 817 | 817 | fat_bpb->fsinfo.freecount); |
| 818 | 818 | |
| 819 | 819 | sec[offset] = htole16(val); |
| — | — | @@ -824,18 +824,18 @@ |
| 825 | 825 | int offset = entry % CLUSTERS_PER_FAT_SECTOR; |
| 826 | 826 | unsigned long* sec; |
| 827 | 827 | |
| 828 | | - DEBUGF("update_fat_entry(%lx,%lx)\n",entry,val); |
| | 828 | + DEBUGF("update_fat_entry(%lx,%lx)",entry,val); |
| 829 | 829 | |
| 830 | 830 | if (entry==val) |
| 831 | | - panicf("Creating FAT loop: %lx,%lx\n",entry,val); |
| | 831 | + panicf(PANIC_KILLUSERTHREADS, "Creating FAT loop: %lx,%lx",entry,val); |
| 832 | 832 | |
| 833 | 833 | if ( entry < 2 ) |
| 834 | | - panicf("Updating reserved FAT entry %ld.\n",entry); |
| | 834 | + panicf(PANIC_KILLUSERTHREADS, "Updating reserved FAT entry %ld.",entry); |
| 835 | 835 | |
| 836 | 836 | sec = cache_fat_sector(IF_MV2(fat_bpb,) sector, true); |
| 837 | 837 | if (!sec) |
| 838 | 838 | { |
| 839 | | - DEBUGF("update_fat_entry() - Could not cache sector %ld\n", sector); |
| | 839 | + DEBUGF("update_fat_entry() - Could not cache sector %ld", sector); |
| 840 | 840 | return -1; |
| 841 | 841 | } |
| 842 | 842 | |
| — | — | @@ -849,7 +849,7 @@ |
| 850 | 850 | fat_bpb->fsinfo.freecount++; |
| 851 | 851 | } |
| 852 | 852 | |
| 853 | | - DEBUGF("update_fat_entry: %ld free clusters\n", |
| | 853 | + DEBUGF("update_fat_entry: %ld free clusters", |
| 854 | 854 | fat_bpb->fsinfo.freecount); |
| 855 | 855 | |
| 856 | 856 | /* don't change top 4 bits */ |
| — | — | @@ -875,7 +875,7 @@ |
| 876 | 876 | sec = cache_fat_sector(IF_MV2(fat_bpb,) sector, false); |
| 877 | 877 | if (!sec) |
| 878 | 878 | { |
| 879 | | - DEBUGF( "read_fat_entry() - Could not cache sector %d\n", sector); |
| | 879 | + DEBUGF( "read_fat_entry() - Could not cache sector %d", sector); |
| 880 | 880 | return -1; |
| 881 | 881 | } |
| 882 | 882 | |
| — | — | @@ -891,7 +891,7 @@ |
| 892 | 892 | sec = cache_fat_sector(IF_MV2(fat_bpb,) sector, false); |
| 893 | 893 | if (!sec) |
| 894 | 894 | { |
| 895 | | - DEBUGF( "read_fat_entry() - Could not cache sector %ld\n", sector); |
| | 895 | + DEBUGF( "read_fat_entry() - Could not cache sector %ld", sector); |
| 896 | 896 | return -1; |
| 897 | 897 | } |
| 898 | 898 | |
| — | — | @@ -943,7 +943,7 @@ |
| 944 | 944 | fat_bpb->startsector + fat_bpb->bpb_fsinfo, 1,fsinfo); |
| 945 | 945 | if (rc < 0) |
| 946 | 946 | { |
| 947 | | - DEBUGF( "flush_fat() - Couldn't read FSInfo (error code %d)\n", rc); |
| | 947 | + DEBUGF( "flush_fat() - Couldn't read FSInfo (error code %d)", rc); |
| 948 | 948 | return rc * 10 - 1; |
| 949 | 949 | } |
| 950 | 950 | intptr = (long*)&(fsinfo[FSINFO_FREECOUNT]); |
| — | — | @@ -956,7 +956,7 @@ |
| 957 | 957 | fat_bpb->startsector + fat_bpb->bpb_fsinfo,1,fsinfo); |
| 958 | 958 | if (rc < 0) |
| 959 | 959 | { |
| 960 | | - DEBUGF( "flush_fat() - Couldn't write FSInfo (error code %d)\n", rc); |
| | 960 | + DEBUGF( "flush_fat() - Couldn't write FSInfo (error code %d)", rc); |
| 961 | 961 | return rc * 10 - 2; |
| 962 | 962 | } |
| 963 | 963 | |
| — | — | @@ -968,7 +968,7 @@ |
| 969 | 969 | int i; |
| 970 | 970 | int rc; |
| 971 | 971 | unsigned char *sec; |
| 972 | | - DEBUGF("flush_fat()\n"); |
| | 972 | + DEBUGF("flush_fat()"); |
| 973 | 973 | |
| 974 | 974 | mutex_lock(&cache_mutex); |
| 975 | 975 | for(i = 0;i < FAT_CACHE_SIZE;i++) |
| — | — | @@ -1108,7 +1108,7 @@ |
| 1109 | 1109 | int rc; |
| 1110 | 1110 | unsigned short name_utf16[namelen + 1]; |
| 1111 | 1111 | |
| 1112 | | - DEBUGF("write_long_name(file:%lx, first:%d, num:%d, name:%s)\n", |
| | 1112 | + DEBUGF("write_long_name(file:%lx, first:%d, num:%d, name:%s)", |
| 1113 | 1113 | file->firstcluster, firstentry, numentries, name); |
| 1114 | 1114 | |
| 1115 | 1115 | rc = fat_seek(file, sector); |
| — | — | @@ -1149,7 +1149,7 @@ |
| 1150 | 1150 | /* read next sector */ |
| 1151 | 1151 | rc = fat_readwrite(file, 1, buf, false); |
| 1152 | 1152 | if (rc<0) { |
| 1153 | | - DEBUGF("Failed writing new sector: %d\n",rc); |
| | 1153 | + DEBUGF("Failed writing new sector: %d",rc); |
| 1154 | 1154 | return rc * 10 - 5; |
| 1155 | 1155 | } |
| 1156 | 1156 | if (rc==0) |
| — | — | @@ -1164,7 +1164,7 @@ |
| 1165 | 1165 | |
| 1166 | 1166 | /* verify this entry is free */ |
| 1167 | 1167 | if (entry[0] && entry[0] != 0xe5 ) |
| 1168 | | - panicf("Dir entry %d in sector %x is not free! " |
| | 1168 | + panicf(PANIC_KILLUSERTHREADS, "Dir entry %d in sector %x is not free! " |
| 1169 | 1169 | "%02x %02x %02x %02x", |
| 1170 | 1170 | idx, sector, |
| 1171 | 1171 | entry[0], entry[1], entry[2], entry[3]); |
| — | — | @@ -1202,12 +1202,12 @@ |
| 1203 | 1203 | entry[FATDIR_FSTCLUSLO] = 0; |
| 1204 | 1204 | entry[FATLONG_TYPE] = 0; |
| 1205 | 1205 | entry[FATLONG_CHKSUM] = chksum; |
| 1206 | | - DEBUGF("Longname entry %d: %s\n", idx, name+nameidx); |
| | 1206 | + DEBUGF("Longname entry %d: %s", idx, name+nameidx); |
| 1207 | 1207 | } |
| 1208 | 1208 | else { |
| 1209 | 1209 | /* shortname entry */ |
| 1210 | 1210 | unsigned short date=0, time=0, tenth=0; |
| 1211 | | - DEBUGF("Shortname entry: %s\n", shortname); |
| | 1211 | + DEBUGF("Shortname entry: %s", shortname); |
| 1212 | 1212 | memcpy(entry + FATDIR_NAME, shortname, 11); |
| 1213 | 1213 | entry[FATDIR_ATTR] = is_directory?FAT_ATTR_DIRECTORY:0; |
| 1214 | 1214 | entry[FATDIR_NTRES] = 0; |
| — | — | @@ -1277,7 +1277,7 @@ |
| 1278 | 1278 | int entries_needed, entries_found = 0; |
| 1279 | 1279 | int firstentry; |
| 1280 | 1280 | |
| 1281 | | - DEBUGF( "add_dir_entry(%s,%lx)\n", |
| | 1281 | + DEBUGF( "add_dir_entry(%s,%lx)", |
| 1282 | 1282 | name, file->firstcluster); |
| 1283 | 1283 | |
| 1284 | 1284 | /* Don't check dotdirs name for validity */ |
| — | — | @@ -1325,12 +1325,12 @@ |
| 1326 | 1326 | rc = fat_readwrite(&dir->file, 1, buf, false); |
| 1327 | 1327 | if (rc < 0) { |
| 1328 | 1328 | DEBUGF( "add_dir_entry() - Couldn't read dir" |
| 1329 | | - " (error code %d)\n", rc); |
| | 1329 | + " (error code %d)", rc); |
| 1330 | 1330 | return rc * 10 - 3; |
| 1331 | 1331 | } |
| 1332 | 1332 | |
| 1333 | 1333 | if (rc == 0) { /* current end of dir reached */ |
| 1334 | | - DEBUGF("End of dir on cluster boundary\n"); |
| | 1334 | + DEBUGF("End of dir on cluster boundary"); |
| 1335 | 1335 | break; |
| 1336 | 1336 | } |
| 1337 | 1337 | |
| — | — | @@ -1340,7 +1340,7 @@ |
| 1341 | 1341 | switch (buf[i * DIR_ENTRY_SIZE]) { |
| 1342 | 1342 | case 0: |
| 1343 | 1343 | entries_found += DIR_ENTRIES_PER_SECTOR - i; |
| 1344 | | - DEBUGF("Found end of dir %d\n", |
| | 1344 | + DEBUGF("Found end of dir %d", |
| 1345 | 1345 | sector * DIR_ENTRIES_PER_SECTOR + i); |
| 1346 | 1346 | i = DIR_ENTRIES_PER_SECTOR - 1; |
| 1347 | 1347 | done = true; |
| — | — | @@ -1348,7 +1348,7 @@ |
| 1349 | 1349 | |
| 1350 | 1350 | case 0xe5: |
| 1351 | 1351 | entries_found++; |
| 1352 | | - DEBUGF("Found free entry %d (%d/%d)\n", |
| | 1352 | + DEBUGF("Found free entry %d (%d/%d)", |
| 1353 | 1353 | sector * DIR_ENTRIES_PER_SECTOR + i, |
| 1354 | 1354 | entries_found, entries_needed); |
| 1355 | 1355 | break; |
| — | — | @@ -1360,7 +1360,7 @@ |
| 1361 | 1361 | if (!strncmp(shortname, buf + i * DIR_ENTRY_SIZE, 11)) { |
| 1362 | 1362 | /* shortname exists already, make a new one */ |
| 1363 | 1363 | randomize_dos_name(shortname); |
| 1364 | | - DEBUGF("Duplicate shortname, changing to %s\n", |
| | 1364 | + DEBUGF("Duplicate shortname, changing to %s", |
| 1365 | 1365 | shortname); |
| 1366 | 1366 | |
| 1367 | 1367 | /* name has changed, we need to restart search */ |
| — | — | @@ -1377,7 +1377,7 @@ |
| 1378 | 1378 | /* step 2: extend the dir if necessary */ |
| 1379 | 1379 | if (firstentry < 0) |
| 1380 | 1380 | { |
| 1381 | | - DEBUGF("Adding new sector(s) to dir\n"); |
| | 1381 | + DEBUGF("Adding new sector(s) to dir"); |
| 1382 | 1382 | rc = fat_seek(&dir->file, sector); |
| 1383 | 1383 | if (rc < 0) |
| 1384 | 1384 | return rc * 10 - 4; |
| — | — | @@ -1402,7 +1402,7 @@ |
| 1403 | 1403 | |
| 1404 | 1404 | /* step 3: add entry */ |
| 1405 | 1405 | sector = firstentry / DIR_ENTRIES_PER_SECTOR; |
| 1406 | | - DEBUGF("Adding longname to entry %d in sector %d\n", |
| | 1406 | + DEBUGF("Adding longname to entry %d in sector %d", |
| 1407 | 1407 | firstentry, sector); |
| 1408 | 1408 | |
| 1409 | 1409 | rc = write_long_name(&dir->file, firstentry, |
| — | — | @@ -1414,7 +1414,7 @@ |
| 1415 | 1415 | file->direntry = firstentry + entries_needed - 1; |
| 1416 | 1416 | file->direntries = entries_needed; |
| 1417 | 1417 | file->dircluster = dir->file.firstcluster; |
| 1418 | | - DEBUGF("Added new dir entry %d, using %d slots.\n", |
| | 1418 | + DEBUGF("Added new dir entry %d, using %d slots.", |
| 1419 | 1419 | file->direntry, file->direntries); |
| 1420 | 1420 | |
| 1421 | 1421 | return 0; |
| — | — | @@ -1535,7 +1535,7 @@ |
| 1536 | 1536 | struct fat_file dir; |
| 1537 | 1537 | int rc; |
| 1538 | 1538 | |
| 1539 | | - DEBUGF("update_file_size(cluster:%lx entry:%d size:%ld)\n", |
| | 1539 | + DEBUGF("update_file_size(cluster:%lx entry:%d size:%ld)", |
| 1540 | 1540 | file->firstcluster, file->direntry, size); |
| 1541 | 1541 | |
| 1542 | 1542 | /* create a temporary file handle for the dir holding this file */ |
| — | — | @@ -1552,7 +1552,7 @@ |
| 1553 | 1553 | return rc * 10 - 3; |
| 1554 | 1554 | |
| 1555 | 1555 | if (!entry[0] || entry[0] == 0xe5) |
| 1556 | | - panicf("Updating size on empty dir entry %d\n", file->direntry); |
| | 1556 | + panicf(PANIC_KILLUSERTHREADS, "Updating size on empty dir entry %d", file->direntry); |
| 1557 | 1557 | |
| 1558 | 1558 | entry[FATDIR_ATTR] = attr & 0xFF; |
| 1559 | 1559 | |
| — | — | @@ -1656,12 +1656,12 @@ |
| 1657 | 1657 | /* fixme: remove error check when done */ |
| 1658 | 1658 | if (volume >= NUM_VOLUMES || !fat_bpbs[volume].mounted) |
| 1659 | 1659 | { |
| 1660 | | - DEBUGF("fat_open() illegal volume %d\n", volume); |
| | 1660 | + DEBUGF("fat_open() illegal volume %d", volume); |
| 1661 | 1661 | return -1; |
| 1662 | 1662 | } |
| 1663 | 1663 | #endif |
| 1664 | 1664 | |
| 1665 | | - DEBUGF("fat_open(%lx), entry %d\n",startcluster,file->direntry); |
| | 1665 | + DEBUGF("fat_open(%lx), entry %d",startcluster,file->direntry); |
| 1666 | 1666 | return 0; |
| 1667 | 1667 | } |
| 1668 | 1668 | |
| — | — | @@ -1671,7 +1671,7 @@ |
| 1672 | 1672 | { |
| 1673 | 1673 | int rc; |
| 1674 | 1674 | |
| 1675 | | - DEBUGF("fat_create_file(\"%s\",%lx,%lx)\n",name,(long)file,(long)dir); |
| | 1675 | + DEBUGF("fat_create_file(\"%s\",%lx,%lx)",name,(long)file,(long)dir); |
| 1676 | 1676 | rc = add_dir_entry(dir, file, name, false, false); |
| 1677 | 1677 | if (!rc) { |
| 1678 | 1678 | file->firstcluster = 0; |
| — | — | @@ -1700,7 +1700,7 @@ |
| 1701 | 1701 | int rc; |
| 1702 | 1702 | struct fat_file dummyfile; |
| 1703 | 1703 | |
| 1704 | | - DEBUGF("fat_create_dir(\"%s\",%lx,%lx)\n",name,(long)newdir,(long)dir); |
| | 1704 | + DEBUGF("fat_create_dir(\"%s\",%lx,%lx)",name,(long)newdir,(long)dir); |
| 1705 | 1705 | |
| 1706 | 1706 | memset(newdir, 0, sizeof(struct fat_dir)); |
| 1707 | 1707 | memset(&dummyfile, 0, sizeof(struct fat_file)); |
| — | — | @@ -1765,7 +1765,7 @@ |
| 1766 | 1766 | struct bpb* fat_bpb = &fat_bpbs[file->volume]; |
| 1767 | 1767 | #endif |
| 1768 | 1768 | |
| 1769 | | - DEBUGF("fat_truncate(%lx, %lx)\n", file->firstcluster, last); |
| | 1769 | + DEBUGF("fat_truncate(%lx, %lx)", file->firstcluster, last); |
| 1770 | 1770 | |
| 1771 | 1771 | for ( last = get_next_cluster(IF_MV2(fat_bpb,) last); last; last = next ) { |
| 1772 | 1772 | next = get_next_cluster(IF_MV2(fat_bpb,) last); |
| — | — | @@ -1783,7 +1783,7 @@ |
| 1784 | 1784 | #ifdef HAVE_MULTIVOLUME |
| 1785 | 1785 | struct bpb* fat_bpb = &fat_bpbs[file->volume]; |
| 1786 | 1786 | #endif |
| 1787 | | - DEBUGF("fat_closewrite(size=%ld)\n",size); |
| | 1787 | + DEBUGF("fat_closewrite(size=%ld)",size); |
| 1788 | 1788 | |
| 1789 | 1789 | if (!size) { |
| 1790 | 1790 | /* empty file */ |
| — | — | @@ -1814,16 +1814,16 @@ |
| 1815 | 1815 | long next; |
| 1816 | 1816 | for ( next = file->firstcluster; next; |
| 1817 | 1817 | next = get_next_cluster(IF_MV2(fat_bpb,) next) ) { |
| 1818 | | - DEBUGF("cluster %ld: %lx\n", count, next); |
| | 1818 | + DEBUGF("cluster %ld: %lx", count, next); |
| 1819 | 1819 | count++; |
| 1820 | 1820 | } |
| 1821 | 1821 | len = count * fat_bpb->bpb_secperclus * SECTOR_SIZE; |
| 1822 | | - DEBUGF("File is %ld clusters (chainlen=%ld, size=%ld)\n", |
| | 1822 | + DEBUGF("File is %ld clusters (chainlen=%ld, size=%ld)", |
| 1823 | 1823 | count, len, size ); |
| 1824 | 1824 | if ( len > size + fat_bpb->bpb_secperclus * SECTOR_SIZE) |
| 1825 | | - panicf("Cluster chain is too long\n"); |
| | 1825 | + panicf(PANIC_KILLUSERTHREADS, "Cluster chain is too long"); |
| 1826 | 1826 | if ( len < size ) |
| 1827 | | - panicf("Cluster chain is too short\n"); |
| | 1827 | + panicf(PANIC_KILLUSERTHREADS, "Cluster chain is too short"); |
| 1828 | 1828 | } |
| 1829 | 1829 | #endif |
| 1830 | 1830 | |
| — | — | @@ -1854,7 +1854,7 @@ |
| 1855 | 1855 | return rc * 10 - 3; |
| 1856 | 1856 | |
| 1857 | 1857 | for (i=0; i < numentries; i++) { |
| 1858 | | - DEBUGF("Clearing dir entry %d (%d/%d)\n", |
| | 1858 | + DEBUGF("Clearing dir entry %d (%d/%d)", |
| 1859 | 1859 | entry, i+1, numentries); |
| 1860 | 1860 | buf[(entry % DIR_ENTRIES_PER_SECTOR) * DIR_ENTRY_SIZE] = 0xe5; |
| 1861 | 1861 | entry++; |
| — | — | @@ -1901,7 +1901,7 @@ |
| 1902 | 1902 | struct bpb* fat_bpb = &fat_bpbs[file->volume]; |
| 1903 | 1903 | #endif |
| 1904 | 1904 | |
| 1905 | | - DEBUGF("fat_remove(%lx)\n",last); |
| | 1905 | + DEBUGF("fat_remove(%lx)",last); |
| 1906 | 1906 | |
| 1907 | 1907 | while ( last ) { |
| 1908 | 1908 | next = get_next_cluster(IF_MV2(fat_bpb,) last); |
| — | — | @@ -1942,7 +1942,7 @@ |
| 1943 | 1943 | struct bpb* fat_bpb = &fat_bpbs[file->volume]; |
| 1944 | 1944 | |
| 1945 | 1945 | if (file->volume != dir->file.volume) { |
| 1946 | | - DEBUGF("No rename across volumes!\n"); |
| | 1946 | + DEBUGF("No rename across volumes!"); |
| 1947 | 1947 | return -1; |
| 1948 | 1948 | } |
| 1949 | 1949 | #else |
| — | — | @@ -1950,7 +1950,7 @@ |
| 1951 | 1951 | #endif |
| 1952 | 1952 | |
| 1953 | 1953 | if ( !file->dircluster ) { |
| 1954 | | - DEBUGF("File has no dir cluster!\n"); |
| | 1954 | + DEBUGF("File has no dir cluster!"); |
| 1955 | 1955 | return -2; |
| 1956 | 1956 | } |
| 1957 | 1957 | |
| — | — | @@ -2006,7 +2006,7 @@ |
| 2007 | 2007 | if(strncmp(".. ", entry, 11)) |
| 2008 | 2008 | { |
| 2009 | 2009 | /* .. entry must be second entry according to FAT spec (p.29) */ |
| 2010 | | - DEBUGF("Second dir entry is not double-dot!\n"); |
| | 2010 | + DEBUGF("Second dir entry is not double-dot!"); |
| 2011 | 2011 | return rc * 10 - 9; |
| 2012 | 2012 | } |
| 2013 | 2013 | clusptr = (short*)(entry + FATDIR_FSTCLUSHI); |
| — | — | @@ -2040,7 +2040,7 @@ |
| 2041 | 2041 | long cluster = 0; |
| 2042 | 2042 | long sector; |
| 2043 | 2043 | |
| 2044 | | - DEBUGF("next_write_cluster(%lx,%lx)\n",file->firstcluster, oldcluster); |
| | 2044 | + DEBUGF("next_write_cluster(%lx,%lx)",file->firstcluster, oldcluster); |
| 2045 | 2045 | |
| 2046 | 2046 | if (oldcluster) |
| 2047 | 2047 | cluster = get_next_cluster(IF_MV2(fat_bpb,) oldcluster); |
| — | — | @@ -2066,10 +2066,10 @@ |
| 2067 | 2067 | else { |
| 2068 | 2068 | #ifdef TEST_FAT |
| 2069 | 2069 | if (fat_bpb->fsinfo.freecount>0) |
| 2070 | | - panicf("There is free space, but find_free_cluster() " |
| 2071 | | - "didn't find it!\n"); |
| | 2070 | + panicf(PANIC_KILLUSERTHREADS, "There is free space, but find_free_cluster() " |
| | 2071 | + "didn't find it!"); |
| 2072 | 2072 | #endif |
| 2073 | | - DEBUGF("next_write_cluster(): Disk full!\n"); |
| | 2073 | + DEBUGF("next_write_cluster(): Disk full!"); |
| 2074 | 2074 | return 0; |
| 2075 | 2075 | } |
| 2076 | 2076 | } |
| — | — | @@ -2089,7 +2089,7 @@ |
| 2090 | 2090 | #endif |
| 2091 | 2091 | int rc; |
| 2092 | 2092 | |
| 2093 | | - DEBUGF("transfer(s=%lx, c=%lx, %s)\n", |
| | 2093 | + DEBUGF("transfer(s=%lx, c=%lx, %s)", |
| 2094 | 2094 | start+ fat_bpb->startsector, count, write?"write":"read"); |
| 2095 | 2095 | if (write) { |
| 2096 | 2096 | unsigned long firstallowed; |
| — | — | @@ -2101,9 +2101,9 @@ |
| 2102 | 2102 | firstallowed = fat_bpb->firstdatasector; |
| 2103 | 2103 | |
| 2104 | 2104 | if (start < firstallowed) |
| 2105 | | - panicf("Write %ld before data\n", firstallowed - start); |
| | 2105 | + panicf(PANIC_KILLUSERTHREADS, "Write %ld before data", firstallowed - start); |
| 2106 | 2106 | if (start + count > fat_bpb->totalsectors) |
| 2107 | | - panicf("Write %ld after data\n", |
| | 2107 | + panicf(PANIC_KILLUSERTHREADS, "Write %ld after data", |
| 2108 | 2108 | start + count - fat_bpb->totalsectors); |
| 2109 | 2109 | rc = storage_write_sectors(IF_MD2(fat_bpb->drive,) |
| 2110 | 2110 | start + fat_bpb->startsector, count, buf); |
| — | — | @@ -2113,7 +2113,7 @@ |
| 2114 | 2114 | start + fat_bpb->startsector, count, buf); |
| 2115 | 2115 | if (rc < 0) { |
| 2116 | 2116 | DEBUGF( "transfer() - Couldn't %s sector %lx" |
| 2117 | | - " (error code %d)\n", |
| | 2117 | + " (error code %d)", |
| 2118 | 2118 | write ? "write":"read", start, rc); |
| 2119 | 2119 | return rc; |
| 2120 | 2120 | } |
| — | — | @@ -2138,9 +2138,9 @@ |
| 2139 | 2139 | long i; |
| 2140 | 2140 | int rc; |
| 2141 | 2141 | |
| 2142 | | - DEBUGF( "fat_readwrite(file:%lx,count:0x%lx,buf:%lx,%s)\n", |
| | 2142 | + DEBUGF( "fat_readwrite(file:%lx,count:0x%lx,buf:%lx,%s)", |
| 2143 | 2143 | file->firstcluster,sectorcount,(long)buf,write?"write":"read"); |
| 2144 | | - DEBUGF( "fat_readwrite: sec=%lx numsec=%ld eof=%d\n", |
| | 2144 | + DEBUGF( "fat_readwrite: sec=%lx numsec=%ld eof=%d", |
| 2145 | 2145 | sector,numsec, eof?1:0); |
| 2146 | 2146 | |
| 2147 | 2147 | if ( eof && !write) |
| — | — | @@ -2232,7 +2232,7 @@ |
| 2233 | 2233 | if (eof) |
| 2234 | 2234 | i--; |
| 2235 | 2235 | |
| 2236 | | - DEBUGF("Sectors written: %ld\n", i); |
| | 2236 | + DEBUGF("Sectors written: %ld", i); |
| 2237 | 2237 | return i; |
| 2238 | 2238 | } |
| 2239 | 2239 | |
| — | — | @@ -2270,7 +2270,7 @@ |
| 2271 | 2271 | cluster = get_next_cluster(IF_MV2(fat_bpb,) cluster); |
| 2272 | 2272 | if (!cluster) { |
| 2273 | 2273 | DEBUGF("Seeking beyond the end of the file! " |
| 2274 | | - "(sector %ld, cluster %ld)\n", seeksector, i); |
| | 2274 | + "(sector %ld, cluster %ld)", seeksector, i); |
| 2275 | 2275 | return -1; |
| 2276 | 2276 | } |
| 2277 | 2277 | } |
| — | — | @@ -2281,7 +2281,7 @@ |
| 2282 | 2282 | sectornum = -1; |
| 2283 | 2283 | } |
| 2284 | 2284 | |
| 2285 | | - DEBUGF("fat_seek(%lx, %lx) == %lx, %lx, %lx\n", |
| | 2285 | + DEBUGF("fat_seek(%lx, %lx) == %lx, %lx, %lx", |
| 2286 | 2286 | file->firstcluster, seeksector, cluster, sector, sectornum); |
| 2287 | 2287 | |
| 2288 | 2288 | file->lastcluster = cluster; |
| — | — | @@ -2300,7 +2300,7 @@ |
| 2301 | 2301 | /* fixme: remove error check when done */ |
| 2302 | 2302 | if (volume >= NUM_VOLUMES || !fat_bpbs[volume].mounted) |
| 2303 | 2303 | { |
| 2304 | | - DEBUGF("fat_open() illegal volume %d\n", volume); |
| | 2304 | + DEBUGF("fat_open() illegal volume %d", volume); |
| 2305 | 2305 | return -1; |
| 2306 | 2306 | } |
| 2307 | 2307 | #else |
| — | — | @@ -2315,7 +2315,7 @@ |
| 2316 | 2316 | if(rc) |
| 2317 | 2317 | { |
| 2318 | 2318 | DEBUGF( "fat_opendir() - Couldn't open dir" |
| 2319 | | - " (error code %d)\n", rc); |
| | 2319 | + " (error code %d)", rc); |
| 2320 | 2320 | return rc * 10 - 1; |
| 2321 | 2321 | } |
| 2322 | 2322 | |
| — | — | @@ -2356,7 +2356,7 @@ |
| 2357 | 2357 | } |
| 2358 | 2358 | if (rc < 0) { |
| 2359 | 2359 | DEBUGF( "fat_getnext() - Couldn't read dir" |
| 2360 | | - " (error code %d)\n", rc); |
| | 2360 | + " (error code %d)", rc); |
| 2361 | 2361 | return rc * 10 - 1; |
| 2362 | 2362 | } |
| 2363 | 2363 | dir->sector = dir->file.lastsector; |
| Index: embios/trunk/thread.h |
| — | — | @@ -58,7 +58,8 @@ |
| 59 | 59 | THREAD_BLOCK_SLEEP,
|
| 60 | 60 | THREAD_BLOCK_MUTEX,
|
| 61 | 61 | THREAD_BLOCK_WAKEUP,
|
| 62 | | - THREAD_DEFUNCT_STKOV
|
| | 62 | + THREAD_DEFUNCT_STKOV,
|
| | 63 | + THREAD_DEFUNCT_PANIC
|
| 63 | 64 | };
|
| 64 | 65 |
|
| 65 | 66 | enum thread_type
|
| Index: embios/trunk/dir.c |
| — | — | @@ -72,7 +72,7 @@ |
| 73 | 73 | #endif |
| 74 | 74 | |
| 75 | 75 | if ( name[0] != '/' ) { |
| 76 | | - DEBUGF("Only absolute paths supported right now\n"); |
| | 76 | + DEBUGF("Only absolute paths supported right now"); |
| 77 | 77 | return NULL; |
| 78 | 78 | } |
| 79 | 79 | |
| — | — | @@ -82,7 +82,7 @@ |
| 83 | 83 | break; |
| 84 | 84 | |
| 85 | 85 | if ( dd == MAX_OPEN_DIRS ) { |
| 86 | | - DEBUGF("Too many dirs open\n"); |
| | 86 | + DEBUGF("Too many dirs open"); |
| 87 | 87 | errno = EMFILE; |
| 88 | 88 | return NULL; |
| 89 | 89 | } |
| — | — | @@ -98,7 +98,7 @@ |
| 99 | 99 | #endif |
| 100 | 100 | |
| 101 | 101 | if ( fat_opendir(IF_MV2(volume,) &pdir->fatdir, 0, NULL) < 0 ) { |
| 102 | | - DEBUGF("Failed opening root dir\n"); |
| | 102 | + DEBUGF("Failed opening root dir"); |
| 103 | 103 | pdir->busy = false; |
| 104 | 104 | return NULL; |
| 105 | 105 | } |
| — | — | @@ -128,7 +128,7 @@ |
| 129 | 129 | &pdir->fatdir, |
| 130 | 130 | entry.firstcluster, |
| 131 | 131 | &pdir->fatdir) < 0 ) { |
| 132 | | - DEBUGF("Failed opening dir '%s' (%ld)\n", |
| | 132 | + DEBUGF("Failed opening dir '%s' (%ld)", |
| 133 | 133 | part, entry.firstcluster); |
| 134 | 134 | pdir->busy = false; |
| 135 | 135 | return NULL; |
| — | — | @@ -208,7 +208,7 @@ |
| 209 | 209 | int rc; |
| 210 | 210 | |
| 211 | 211 | if ( name[0] != '/' ) { |
| 212 | | - DEBUGF("mkdir: Only absolute paths supported right now\n"); |
| | 212 | + DEBUGF("mkdir: Only absolute paths supported right now"); |
| 213 | 213 | return -1; |
| 214 | 214 | } |
| 215 | 215 | |
| — | — | @@ -224,17 +224,17 @@ |
| 225 | 225 | else |
| 226 | 226 | parent = namecopy; |
| 227 | 227 | |
| 228 | | - DEBUGF("mkdir: parent: %s, name: %s\n", parent, basename); |
| | 228 | + DEBUGF("mkdir: parent: %s, name: %s", parent, basename); |
| 229 | 229 | |
| 230 | 230 | dir = opendir(parent); |
| 231 | 231 | |
| 232 | 232 | if(!dir) { |
| 233 | | - DEBUGF("mkdir: can't open parent dir\n"); |
| | 233 | + DEBUGF("mkdir: can't open parent dir"); |
| 234 | 234 | return -2; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | if(basename[0] == 0) { |
| 238 | | - DEBUGF("mkdir: Empty dir name\n"); |
| | 238 | + DEBUGF("mkdir: Empty dir name"); |
| 239 | 239 | errno = EINVAL; |
| 240 | 240 | return -3; |
| 241 | 241 | } |
| — | — | @@ -242,7 +242,7 @@ |
| 243 | 243 | /* Now check if the name already exists */ |
| 244 | 244 | while ((entry = readdir(dir))) { |
| 245 | 245 | if ( !strcasecmp(basename, entry->d_name) ) { |
| 246 | | - DEBUGF("mkdir error: file exists\n"); |
| | 246 | + DEBUGF("mkdir error: file exists"); |
| 247 | 247 | errno = EEXIST; |
| 248 | 248 | closedir(dir); |
| 249 | 249 | return - 4; |
| — | — | @@ -276,7 +276,7 @@ |
| 277 | 277 | if (strcmp(entry->d_name, ".") && |
| 278 | 278 | strcmp(entry->d_name, "..")) |
| 279 | 279 | { |
| 280 | | - DEBUGF("rmdir error: not empty\n"); |
| | 280 | + DEBUGF("rmdir error: not empty"); |
| 281 | 281 | errno = ENOTEMPTY; |
| 282 | 282 | closedir(dir); |
| 283 | 283 | return -2; |
| — | — | @@ -285,7 +285,7 @@ |
| 286 | 286 | |
| 287 | 287 | rc = fat_remove(&(dir->fatdir.file)); |
| 288 | 288 | if ( rc < 0 ) { |
| 289 | | - DEBUGF("Failed removing dir: %d\n", rc); |
| | 289 | + DEBUGF("Failed removing dir: %d", rc); |
| 290 | 290 | errno = EIO; |
| 291 | 291 | rc = rc * 10 - 3; |
| 292 | 292 | } |
| Index: embios/trunk/file.c |
| — | — | @@ -73,11 +73,11 @@ |
| 74 | 74 | (void)use_cache; |
| 75 | 75 | #endif |
| 76 | 76 | |
| 77 | | - DEBUGF("open(\"%s\",%d)\n",pathname,flags); |
| | 77 | + DEBUGF("open(\"%s\",%d)",pathname,flags); |
| 78 | 78 | |
| 79 | 79 | if ( pathname[0] != '/' ) { |
| 80 | | - DEBUGF("'%s' is not an absolute path.\n",pathname); |
| 81 | | - DEBUGF("Only absolute pathnames supported at the moment\n"); |
| | 80 | + DEBUGF("'%s' is not an absolute path.",pathname); |
| | 81 | + DEBUGF("Only absolute pathnames supported at the moment"); |
| 82 | 82 | errno = EINVAL; |
| 83 | 83 | return -1; |
| 84 | 84 | } |
| — | — | @@ -88,7 +88,7 @@ |
| 89 | 89 | break; |
| 90 | 90 | |
| 91 | 91 | if ( fd == MAX_OPEN_FILES ) { |
| 92 | | - DEBUGF("Too many files open\n"); |
| | 92 | + DEBUGF("Too many files open"); |
| 93 | 93 | errno = EMFILE; |
| 94 | 94 | return -2; |
| 95 | 95 | } |
| — | — | @@ -148,7 +148,7 @@ |
| 149 | 149 | name = pathnamecopy+1; |
| 150 | 150 | } |
| 151 | 151 | if (!dir) { |
| 152 | | - DEBUGF("Failed opening dir\n"); |
| | 152 | + DEBUGF("Failed opening dir"); |
| 153 | 153 | errno = EIO; |
| 154 | 154 | file->busy = false; |
| 155 | 155 | return -4; |
| — | — | @@ -155,7 +155,7 @@ |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | if(name[0] == 0) { |
| 159 | | - DEBUGF("Empty file name\n"); |
| | 159 | + DEBUGF("Empty file name"); |
| 160 | 160 | errno = EINVAL; |
| 161 | 161 | file->busy = false; |
| 162 | 162 | closedir(dir); |
| — | — | @@ -176,13 +176,13 @@ |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | if ( !entry ) { |
| 180 | | - DEBUGF("Didn't find file %s\n",name); |
| | 180 | + DEBUGF("Didn't find file %s",name); |
| 181 | 181 | if ( file->write && (flags & O_CREAT) ) { |
| 182 | 182 | rc = fat_create_file(name, |
| 183 | 183 | &(file->fatfile), |
| 184 | 184 | &(dir->fatdir)); |
| 185 | 185 | if (rc < 0) { |
| 186 | | - DEBUGF("Couldn't create %s in %s\n",name,pathnamecopy); |
| | 186 | + DEBUGF("Couldn't create %s in %s",name,pathnamecopy); |
| 187 | 187 | errno = EIO; |
| 188 | 188 | file->busy = false; |
| 189 | 189 | closedir(dir); |
| — | — | @@ -195,7 +195,7 @@ |
| 196 | 196 | file->attr = 0; |
| 197 | 197 | } |
| 198 | 198 | else { |
| 199 | | - DEBUGF("Couldn't find %s in %s\n",name,pathnamecopy); |
| | 199 | + DEBUGF("Couldn't find %s in %s",name,pathnamecopy); |
| 200 | 200 | errno = ENOENT; |
| 201 | 201 | file->busy = false; |
| 202 | 202 | closedir(dir); |
| — | — | @@ -239,7 +239,7 @@ |
| 240 | 240 | struct filedesc* file = &openfiles[fd]; |
| 241 | 241 | int rc = 0; |
| 242 | 242 | |
| 243 | | - DEBUGF("close(%d)\n", fd); |
| | 243 | + DEBUGF("close(%d)", 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 | | - DEBUGF("fsync(%d)\n", fd); |
| | 272 | + DEBUGF("fsync(%d)", fd); |
| 273 | 273 | |
| 274 | 274 | if (fd < 0 || fd > MAX_OPEN_FILES-1) { |
| 275 | 275 | errno = EINVAL; |
| — | — | @@ -324,7 +324,7 @@ |
| 325 | 325 | #endif |
| 326 | 326 | rc = fat_remove(&(file->fatfile)); |
| 327 | 327 | if ( rc < 0 ) { |
| 328 | | - DEBUGF("Failed removing file: %d\n", rc); |
| | 328 | + DEBUGF("Failed removing file: %d", rc); |
| 329 | 329 | errno = EIO; |
| 330 | 330 | return rc * 10 - 3; |
| 331 | 331 | } |
| — | — | @@ -403,7 +403,7 @@ |
| 404 | 404 | if ( rc == -1) { |
| 405 | 405 | close(fd); |
| 406 | 406 | closedir(dir); |
| 407 | | - DEBUGF("Failed renaming file across volumnes: %d\n", rc); |
| | 407 | + DEBUGF("Failed renaming file across volumnes: %d", rc); |
| 408 | 408 | errno = EXDEV; |
| 409 | 409 | return -6; |
| 410 | 410 | } |
| — | — | @@ -411,7 +411,7 @@ |
| 412 | 412 | if ( rc < 0 ) { |
| 413 | 413 | close(fd); |
| 414 | 414 | closedir(dir); |
| 415 | | - DEBUGF("Failed renaming file: %d\n", rc); |
| | 415 | + DEBUGF("Failed renaming file: %d", rc); |
| 416 | 416 | errno = EIO; |
| 417 | 417 | return rc * 10 - 7; |
| 418 | 418 | } |
| — | — | @@ -471,7 +471,7 @@ |
| 472 | 472 | struct filedesc* file = &openfiles[fd]; |
| 473 | 473 | long sector = file->fileoffset / SECTOR_SIZE; |
| 474 | 474 | |
| 475 | | - DEBUGF("Flushing dirty sector cache\n"); |
| | 475 | + DEBUGF("Flushing dirty sector cache"); |
| 476 | 476 | |
| 477 | 477 | /* make sure we are on correct sector */ |
| 478 | 478 | rc = fat_seek(&(file->fatfile), sector); |
| — | — | @@ -516,7 +516,7 @@ |
| 517 | 517 | return -1; |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | | - DEBUGF( "readwrite(%d,%lx,%ld,%s)\n", |
| | 520 | + DEBUGF( "readwrite(%d,%lx,%ld,%s)", |
| 521 | 521 | fd,(long)buf,count,write?"write":"read"); |
| 522 | 522 | |
| 523 | 523 | /* attempt to read past EOF? */ |
| — | — | @@ -564,10 +564,10 @@ |
| 565 | 565 | rc = fat_readwrite(&(file->fatfile), sectors, |
| 566 | 566 | (unsigned char*)buf+nread, write ); |
| 567 | 567 | if ( rc < 0 ) { |
| 568 | | - DEBUGF("Failed read/writing %ld sectors\n",sectors); |
| | 568 | + DEBUGF("Failed read/writing %ld sectors",sectors); |
| 569 | 569 | errno = EIO; |
| 570 | 570 | if(write && file->fatfile.eof) { |
| 571 | | - DEBUGF("No space left on device\n"); |
| | 571 | + DEBUGF("No space left on device"); |
| 572 | 572 | errno = ENOSPC; |
| 573 | 573 | } else { |
| 574 | 574 | file->fileoffset += nread; |
| — | — | @@ -606,10 +606,10 @@ |
| 607 | 607 | if (write) { |
| 608 | 608 | if ( file->fileoffset + nread < file->size ) { |
| 609 | 609 | /* sector is only partially filled. copy-back from disk */ |
| 610 | | - DEBUGF("Copy-back tail cache\n"); |
| | 610 | + DEBUGF("Copy-back tail cache"); |
| 611 | 611 | rc = fat_readwrite(&(file->fatfile), 1, file->cache, false ); |
| 612 | 612 | if ( rc < 0 ) { |
| 613 | | - DEBUGF("Failed writing\n"); |
| | 613 | + DEBUGF("Failed writing"); |
| 614 | 614 | errno = EIO; |
| 615 | 615 | file->fileoffset += nread; |
| 616 | 616 | file->cacheoffset = -1; |
| — | — | @@ -628,7 +628,7 @@ |
| 629 | 629 | (file->fileoffset + nread) / |
| 630 | 630 | SECTOR_SIZE); |
| 631 | 631 | if ( rc < 0 ) { |
| 632 | | - DEBUGF("fat_seek() failed\n"); |
| | 632 | + DEBUGF("fat_seek() failed"); |
| 633 | 633 | errno = EIO; |
| 634 | 634 | file->fileoffset += nread; |
| 635 | 635 | file->cacheoffset = -1; |
| — | — | @@ -649,7 +649,7 @@ |
| 650 | 650 | else { |
| 651 | 651 | rc = fat_readwrite(&(file->fatfile), 1, file->cache,false); |
| 652 | 652 | if (rc < 1 ) { |
| 653 | | - DEBUGF("Failed caching sector\n"); |
| | 653 | + DEBUGF("Failed caching sector"); |
| 654 | 654 | errno = EIO; |
| 655 | 655 | file->fileoffset += nread; |
| 656 | 656 | file->cacheoffset = -1; |
| — | — | @@ -663,7 +663,7 @@ |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | file->fileoffset += nread; |
| 667 | | - DEBUGF("fileoffset: %ld\n", file->fileoffset); |
| | 667 | + DEBUGF("fileoffset: %ld", 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 | | - DEBUGF("lseek(%d,%ld,%d)\n",fd,offset,whence); |
| | 705 | + DEBUGF("lseek(%d,%ld,%d)",fd,offset,whence); |
| 706 | 706 | |
| 707 | 707 | if (fd < 0 || fd > MAX_OPEN_FILES-1) { |
| 708 | 708 | errno = EINVAL; |