Changeset 1094 for Whitix

Show
Ignore:
Timestamp:
10/05/08 14:08:18 (2 months ago)
Author:
mwhitworth
Message:

Fix partition request restart logic (there wasn't any), add TODO for mkfatfs and information on crash.

Location:
Whitix/branches/keobject
Files:
9 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/keobject/arch/i386/kernel/ints.c

    r950 r1094  
    225225                                KePrint("\nNULL POINTER EXCEPTION (address = %#.8X)\n", address); 
    226226                        else 
    227                                 KePrint("KERNEL EXCEPTION\nProcessor exception: %s\n",exceptionName[irq]); 
     227                                KePrint("KERNEL EXCEPTION\nProcessor exception: %s (%#X)\n",exceptionName[irq], address); 
    228228                        ThrArchPrintContext(curr); 
    229229                        hlt(); 
  • Whitix/branches/keobject/devices/kedev/sdevice.c

    r1081 r1094  
    173173 
    174174        /* And add to list */ 
    175         ListAddTail(&request->list,&dev->requestList); 
     175        ListAddTail(&request->list, &dev->requestList); 
    176176 
    177177        SpinUnlockIrq(&requestLock); 
     
    180180        if (isEmpty) 
    181181                err=dev->request(dev->priv); 
    182  
     182                 
    183183        return err; 
    184184} 
     
    194194         
    195195        request->ioStatus=status; 
     196         
     197        SpinLockIrq(&requestLock); 
    196198        ListRemove(&request->list); 
     199        SpinUnlockIrq(&requestLock); 
    197200 
    198201        if (status > 0) 
  • Whitix/branches/keobject/devices/storage/ata/ata-disk.c

    r658 r1094  
    100100                        return -EIO; 
    101101                } 
     102                 
     103//              KePrint("Copying over: %#X, %#X, %#X %#X\n", command.block, p, drive, drive->parent); 
    102104 
    103105                for (i=0; i<256; i++) 
  • Whitix/branches/keobject/devices/storage/ata/ata.c

    r1057 r1094  
    299299} 
    300300 
    301 /* Fairly hacky */ 
     301/* Fairly hacky. TODO: Replace with a better data structure. */ 
    302302 
    303303static int AtaPartitionRequest(void* data) 
     
    306306        struct StorageDevice* partDev=part->partDev; 
    307307        struct Request* request=StorageGetCurrRequest(partDev); 
     308        struct Request newRequest; 
    308309        int err; 
    309         struct ListHead head; 
     310//      struct ListHead head; 
    310311 
    311312        if (!request) 
    312313                return 0; 
    313314 
     315again: 
    314316        if (request->sector > part->secLen) 
    315317                return -EIO; 
    316318 
    317319        request->sector+=part->startSector; 
    318         memcpy(&head,&request->list, sizeof(struct ListHead)); 
    319         err=BlockSendRequestRaw(part->sDev, request); 
    320         memcpy(&request->list,&head, sizeof(struct ListHead)); 
     320//      memcpy(&head,&request->list, sizeof(struct ListHead)); 
     321         
     322        memcpy(&newRequest, request, sizeof(struct Request)); 
     323 
     324        newRequest.sector += part->startSector; 
     325         
     326        err=BlockSendRequestRaw(part->sDev, &newRequest); 
     327//      memcpy(&request->list,&head, sizeof(struct ListHead)); 
     328 
     329//      request->sector-=part->startSector; 
    321330 
    322331        StorageEndRequest(partDev,-err); 
     332         
     333        request = StorageGetCurrRequest(partDev); 
     334         
     335        if (request) 
     336                goto again; 
     337         
    323338        return err; 
    324339} 
     
    354369        sDevice->totalSectors=newPart->secLen; 
    355370 
    356 #if 0 
    357         sprintf(buf,"Storage/HardDrive%c%d",'A'+base,i); 
    358  
    359 //      DevAddDevice(buf, 4, (base*64)+i+1, DEVICE_BLOCK, sDevice); 
    360  
    361         StorageDeviceAdd(sDevice, "HardDrive%c%d", 'A'+base, i); 
    362  
     371        StorageDeviceInit(sDevice, DEV_ID_MAKE(4, ((base*64)+i+1)));     
     372        StorageDeviceAdd(sDevice, "AtaDisk%c%d", 'A'+base, i); 
     373         
    363374        KePrint("Partition found: %#X, %u, %u\n",(DWORD)part[i].system,part[i].startSectorAbs,part[i].sectorCount); 
    364 #endif 
    365375 
    366376        return 0; 
  • Whitix/branches/keobject/fs/devfs/devfs.c

    r1063 r1094  
    7979                copyOffset+=readSize; 
    8080                file->position+=readSize; 
     81                 
     82                BufferRelease(buff); 
    8183        } 
    8284 
  • Whitix/branches/keobject/fs/vfs/bcache.c

    r1061 r1094  
    3131#include <request.h> 
    3232#include <devices/sdevice.h> 
     33#include <devices/class.h> 
    3334 
    3435/* Speed this all up. It's quite a dumb cache at the moment. Readahead? */ 
     
    3839struct Thread* bufferFlusher=NULL; 
    3940DWORD cacheSize=0; 
    40  
    41 extern struct ListHead sDeviceList; 
     41extern struct DevClass storageClass; 
    4242 
    4343static void BufferWait(struct Buffer* buffer); 
     
    105105                ThrSchedule(); 
    106106        }while (BufferLocked(buffer)); 
    107  
     107         
    108108        BufferRelease(buffer); 
    109109} 
     
    186186static void BlockBufferRemove(struct Buffer* buff) 
    187187{ 
    188         WaitForBuffer(buff); 
     188//      WaitForBuffer(buff); /* TODO: Have a wait parameter. */ 
    189189        MemFree(buff->data); 
    190190        ListRemove(&buff->list); 
     
    397397                        if (BufferDirty(buff)) 
    398398                        { 
    399                                 WaitForBuffer(buff); 
    400                                  
    401399                                /* For each block, call the respective StorageDevice write function */ 
    402400                                DoBlockWrite(buff->device,buff); 
     
    416414 
    417415        /* Sync all vnodes */ 
    418         extern void VNodeSyncAll(); 
    419         VNodeSyncAll(); 
    420  
    421 //      ListForEachEntry(sDevice, &sDeviceList, list) 
    422 //              BlockSyncDevice(sDevice); 
     416//      extern void VNodeSyncAll(); 
     417//      VNodeSyncAll(); 
     418 
     419        struct StorageDevice* sDevice; 
     420        struct KeObject* object, *object2; 
     421 
     422        ListForEachEntrySafe(object, object2, &storageClass.set.head, next) 
     423        { 
     424                sDevice = KeObjectToStorageDev(object); 
     425                BlockSyncDevice(sDevice); 
     426        } 
    423427 
    424428        return 0; 
     
    439443int DoBlockWrite(struct StorageDevice* sDevice,struct Buffer* buffer) 
    440444{ 
     445        BufferLock(buffer); 
    441446        return BlockSendRequest(sDevice,buffer,REQUEST_WRITE); 
    442447} 
     
    451456static void BufferFlusher() 
    452457{ 
    453 //      struct StorageDevice* sDevice; 
    454458        ThrSetPriority(currThread,1); 
    455459 
     
    458462                ThrSuspendThread(currThread); 
    459463                ThrSchedule(); 
    460  
    461                 /* FIXME: TEMP */ 
    462 //              ListForEachEntry(sDevice,&sDeviceList,list) 
    463 //                      BlockSyncDevice(sDevice); 
     464                 
     465                BlockSyncAll(); 
    464466        } 
    465467} 
     
    512514int BlockInit() 
    513515{ 
    514         blockCache=MemCacheCreate("Block cache",sizeof(struct Buffer),NULL,NULL,0); 
     516        blockCache=MemCacheCreate("Block cache",sizeof(struct Buffer),NULL,NULL, 0); 
    515517        if (!blockCache) 
    516518                return -ENOMEM; 
  • Whitix/branches/keobject/fs/vfs/super.c

    r1079 r1094  
    160160                VNodeRelease(mountNode); 
    161161                VNodeRelease(deviceNode); 
    162                 KePrint("VfsMount: Failed to mount %s\n",mountPoint); 
    163162                return -ENOENT; 
    164163        } 
  • Whitix/branches/keobject/user/makefs/fat/main.c

    r608 r1094  
    9797 
    9898        if (err) 
     99        { 
     100                printf("Error: could not retrieve information about the file\n"); 
    99101                goto statFailed; 
     102        } 
    100103         
    101104        /* Does not make much sense */ 
     
    114117        if (stat.mode & _SYS_STAT_BLOCK) 
    115118        { 
    116                 err=SysIoCtl(deviceFd,IOCTL_BLOCK_GETBLKSIZE,&blockSize); 
    117                 if (err) 
    118                         return err; 
     119                printf("Block device: TODO. Get sector size\n"); 
     120                blockSize=512; 
    119121        }else 
    120122                blockSize=1024; /* A good default */ 
  • Whitix/branches/keobject/user/system/startup.c

    r1040 r1094  
    5353         
    5454        /* Move to FS thread? */ 
     55        ModuleLoad("Filesystems/fatfs"); 
    5556        pid=ModuleLoad("Filesystems/icfs"); 
    5657