ubixfs.c
ubixfs/ubixfs.h
ubixfs/dirCache.h
vfs/vfs.h
ubixos/types.h
ubixos/sched.h
ubixos/kpanic.h
ubixos/exec.h
lib/kmalloc.h
lib/string.h
lib/kprintf.h
assert.h
sys/thread.h
ubixos/kpanic.h
ubixos/sched.h
ubixos/types.h
sys/_types.h
lib/string.h
vfs/file.h
sys/tss.h
lib/kmalloc.h
mpi/mpi.h
src/sys/ubixfs/ubixfs.c
vfs/vfs.h
vfs/mount.h
lib/kprintf.h
ubixfs/ubixfs.h
assert.h
ubixfs/dirCache.h
ubixos/exec.h
sys/sysproto.h
sys/signal.h
ubixos/tty.h
sys/device.h
int static int openFileUbixFS (const char *file, fileDescriptor *fd) openFileUbixFS const char * file fileDescriptor * fd assert fileDescriptorStruct::cacheNode vfs_mountPoint::device device_node::devInfo ubixFSInfo::dirCache fileRead fileWrite vfs_mountPoint::fsInfo cacheNode::info kmalloc kprintf fileDescriptorStruct::mode fileDescriptorStruct::mp NULL cacheNode::permissions fileDescriptorStruct::perms cacheNode::present device_interface::read fileDescriptorStruct::size cacheNode::size fileDescriptorStruct::start cacheNode::startCluster UBIXFS_ALIGN ubixfs_cacheFind ubixfs_loadData x1 ubixfs_init
int int readUbixFS (fileDescriptor *fd, char *data, uInt32 offset, long size) readUbixFS fileDescriptor * fd char * data uInt32 offset long size assert fileDescriptorStruct::cacheNode fdEof vfs_mountPoint::fsInfo cacheNode::info kpanic fileDescriptorStruct::mp NULL cacheNode::present fileDescriptorStruct::size fileDescriptorStruct::status addDirEntry ubixfs_init
int int ubixfs_init () ubixfs_init kpanic NULL openFileUbixFS readUbixFS ubixfs_initialize ubixFSmkDir ubixFSUnlink vfsRegisterFS writeUbixFS x1
int int ubixfs_initialize (struct vfs_mountPoint *mp) ubixfs_initialize struct vfs_mountPoint * mp assert cacheNode::attributes ubixFSInfo::batEntries ubixFSInfo::blockAllocationTable vfs_mountPoint::device device_node::devInfo ubixFSInfo::dirCache vfs_mountPoint::diskLabel vfs_mountPoint::fsInfo cacheNode::info device_interface::info kmalloc kprintf ubixDiskLabel::magicNum ubixDiskLabel::magicNum2 vfs_mountPoint::partition ubixDiskLabel::partitions ubixDiskLabel::ubixPartitions::pBatSize cacheNode::permissions cacheNode::present device_interface::read ubixFSInfo::rootDir cacheNode::size cacheNode::startCluster UBIXDISKMAGIC ubixfs_cacheNew x1
int static int ubixfs_loadData (fileDescriptor *fd, char *data, uInt32 size, uInt32 batIndex) ubixfs_loadData fileDescriptor * fd char * data uInt32 size uInt32 batIndex assert ubixFSInfo::blockAllocationTable blockSize vfs_mountPoint::device device_node::devInfo vfs_mountPoint::diskLabel vfs_mountPoint::fsInfo device_interface::info fileDescriptorStruct::mp blockAllocationTableEntry::nextBlock NULL vfs_mountPoint::partition ubixDiskLabel::partitions device_interface::read blockAllocationTableEntry::realSector UBIXFS_ALIGN UBIXFS_BLOCKSIZE_BYTES openFileUbixFS
void void ubixFSUnlink (char *path, struct vfs_mountPoint *mp) ubixFSUnlink char * path struct vfs_mountPoint * mp ubixFSInfo::blockAllocationTable vfs_mountPoint::device device_node::devInfo vfs_mountPoint::diskLabel directoryEntry::fileName vfs_mountPoint::fsInfo device_interface::info kmalloc kprintf vfs_mountPoint::partition ubixDiskLabel::partitions device_interface::read ubixFSInfo::rootDir strcmp typeDeleted device_interface::write x1000 ubixfs_init
int int writeFileByte (int ch, fileDescriptor *fd, long offset) writeFileByte int ch fileDescriptor * fd long offset assert ubixFSInfo::blockAllocationTable vfs_mountPoint::diskLabel fdOpen fdRead vfs_mountPoint::fsInfo fileDescriptorStruct::mp blockAllocationTableEntry::nextBlock NULL vfs_mountPoint::partition ubixDiskLabel::partitions ubixDiskLabel::ubixPartitions::pBatSize fileDescriptorStruct::start fileDescriptorStruct::status
int int writeUbixFS (fileDescriptor *fd, char *data, long offset, long size) writeUbixFS fileDescriptor * fd char * data long offset long size assert ubixFSInfo::blockAllocationTable blockSize fileDescriptorStruct::buffer vfs_mountPoint::device device_node::devInfo vfs_mountPoint::diskLabel EOBC fileDescriptorStruct::fileName directoryEntry::fileName vfs_mountPoint::fsInfo getFreeBlocks device_interface::info kfree kmalloc fileDescriptorStruct::mp blockAllocationTableEntry::nextBlock NULL vfs_mountPoint::partition ubixDiskLabel::partitions device_interface::read blockAllocationTableEntry::realSector directoryEntry::size fileDescriptorStruct::size fileDescriptorStruct::start directoryEntry::startCluster strcmp device_interface::write x1000 addDirEntry ubixfs_init

    /*****************************************************************************************
    Copyright(c)2002-2004TheUbixOSProject
    Allrightsreserved.

    Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are
    permittedprovidedthatthefollowingconditionsaremet:

    Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof
    conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary
    formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing
    disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided
    withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits
    contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware
    withoutspecificpriorwrittenpermission.

    THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY
    EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF
    MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL
    THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,
    SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT
    OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)
    HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR
    TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS
    SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE.

    $Id: ubixfs_8c.xml 88 2016-01-12 00:11:29Z reddawg $

    *****************************************************************************************/

    #include<ubixfs/ubixfs.h>
    #include<ubixfs/dirCache.h>
    #include<vfs/vfs.h>
    #include<ubixos/types.h>
    #include<ubixos/sched.h>
    #include<ubixos/kpanic.h>
    #include<ubixos/exec.h>
    #include<lib/kmalloc.h>
    #include<lib/string.h>
    #include<lib/kprintf.h>
    #include<assert.h>

    /*Staticdefines*/
    staticintubixfs_loadData(fileDescriptor*fd,char*data,uInt32size,uInt32batIndex);

    staticintopenFileUbixFS(constchar*file,fileDescriptor*fd){
    //intx=0;
    /*mjistructdirectoryEntry*dirEntry=(structdirectoryEntry*)kmalloc(0x4000);*/
    structcacheNode*cacheNode=NULL;
    //structdirectoryEntry*dirEntry=NULL;
    structubixFSInfo*fsInfo=fd->mp->fsInfo;

    /*kprintf("openFileUbixFS(%s),cwd:%s\n",file,_current->oInfo.cwd);*/

    //if(fsInfo->dirCache==NULL)kprintf("dirCacheisnull!\n");
    assert(fd);
    assert(fd->mp);
    assert(fd->mp->device);
    assert(fd->mp->device->devInfo);
    assert(fd->mp->device->devInfo->read);
    assert(fsInfo);
    assert(fsInfo->dirCache);
    assert(file);

    if((fd->mode&fileRead)==fileRead){
    do{
    cacheNode=ubixfs_cacheFind(fsInfo->dirCache,(char*)file);
    if(cacheNode==NULL)return0;
    if(cacheNode->present==1)break;
    assert(cacheNode->size);
    if(*cacheNode->size!=0&&cacheNode->info==NULL){
    //kprintf("cachingname(size):%s(%d)\n",cacheNode->name,*cacheNode->size);
    cacheNode->info=kmalloc(UBIXFS_ALIGN(*cacheNode->size));
    fd->size=*cacheNode->size;
    assert(cacheNode->startCluster);
    ubixfs_loadData(fd,
    cacheNode->info,
    *cacheNode->size,
    *cacheNode->startCluster);
    cacheNode->present=1;
    }/*if*/
    }while(1);

    assert(cacheNode);
    if(cacheNode==NULL)return0;/*thisshouldbecaughtabove*/

    fd->start=*cacheNode->startCluster;
    fd->size=*cacheNode->size;
    fd->perms=*cacheNode->permissions;
    fd->cacheNode=cacheNode;/*DirectoryStartSector*/
    /*
    if(cacheNode->size!=0x0&&cacheNode->info==NULL){
    cacheNode->info=kmalloc(UBIXFS_ALIGN(*cacheNode->size));
    ubixfs_loadData(fd,cacheNode->info,cacheNode->size,cacheNode->startCluster);
    cacheNode->present=0x1;
    }
    */
    return(0x1);
    }
    else
    if((fd->mode&fileWrite)==fileWrite){
    kprintf("Ouch!infilewrite!\n");
    #if0
    fd->start=dirEntry->startCluster;
    fd->size=dirEntry->size;
    fd->perms=dirEntry->permissions;
    //fd->dirBlock=0x0;/*DirectoryStartSector*/
    #endif
    return(0x1);
    }

    return0;

    }

    intwriteFileByte(intch,fileDescriptor*fd,longoffset){

    intblockCount=0x0,batIndex=0x0,batIndexPrev=0x0;
    uInt32i=0x0;
    structdirectoryEntry*dirEntry=0x0;
    structubixFSInfo*fsInfo=NULL;

    assert(fd);
    assert(fd->mp);
    assert(fd->mp->diskLabel);

    batIndexPrev=fd->start;
    fsInfo=fd->mp->fsInfo;

    /*FindOutHowManyBlocksLongThisFileIs*/
    blockCount=(offset/4096);

    /*FindTheBlockIfItDoesn'tExistWeWillHaveToAllocateOne*/
    for(i=0x0;i<=fd->mp->diskLabel->partitions[fd->mp->partition].pBatSize;
    i++){
    batIndex=fsInfo->blockAllocationTable[batIndexPrev].nextBlock;
    if(batIndex==0x0){
    break;
    }
    batIndexPrev=batIndex;
    }

    if((offset%4096==0)&&(fd->status==fdRead)){
    fd->status=fdOpen;
    }

    /*IfbatIndex==0x0ThenWeMustAllocateANewBlock*/
    if(batIndex==0x0){
    for(i=1;i<fsInfo->batEntries;i++){
    if(fsInfo->blockAllocationTable[i].attributes==0x0){
    fsInfo->blockAllocationTable[batIndexPrev].nextBlock=i;
    fsInfo->blockAllocationTable[batIndex].nextBlock=-1;
    batIndex=i;
    fd->start=i;
    break;
    }
    }
    /*fd->mp->drive->read(fd->mp->drive->driveInfoStruct,diskLabel->partitions[0].pOffset+blockAllocationTable[batIndex].realSector,8,fd->buffer);*/
    fd->buffer[offset-(blockCount*4096)]=ch;
    fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8);
    }
    else{
    if(fd->status!=fdRead){
    fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8);
    fd->status=fdRead;
    }
    fd->buffer[offset-(blockCount*4096)]=ch;
    fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8);
    }
    if((uInt32)offset>fd->size){
    fd->size=offset;
    dirEntry=(structdirectoryEntry*)kmalloc(4096);
    /*
    fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),8);
    */
    for(i=0x0;i<(4096/sizeof(structdirectoryEntry));i++){
    if((int)!strcmp(dirEntry[i].fileName,fd->fileName))
    break;
    }
    dirEntry[i].size=fd->size;
    /*
    fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),8);
    */
    kfree(dirEntry);
    }
    return(ch);
    }

    /*VerifiedFunctions*/

    intreadUbixFS(fileDescriptor*fd,char*data,uInt32offset,longsize){
    inti=0x0;
    char*buffer=0x0;
    structubixFSInfo*fsInfo=NULL;

    assert(fd);
    assert(fd->mp);
    assert(fd->mp->fsInfo);

    fsInfo=fd->mp->fsInfo;

    if(fd->cacheNode->present!=1)
    kpanic("ERRORwithcachenode\n");

    buffer=(char*)fd->cacheNode->info;

    for(i=0x0;i<size;i++){
    if(offset>fd->size){
    /*SetFileEOFIfThereIsNothingToDo*/
    /*data[i]='\0';Isthissafe?*/
    fd->status=fdEof;
    return(size);
    }
    /*CopyDataFromBufferToData*/
    data[i]=buffer[i+offset];
    }
    /*Return*/
    return(size);
    }

    /************************************************************************

    Function:intwriteUbixFS(fileDescriptor*fd,char*data,longoffset,longsize)
    Description:WriteDataIntoFile
    Notes:

    ************************************************************************/
    intwriteUbixFS(fileDescriptor*fd,char*data,longoffset,longsize){
    uInt32blockOffset=0x0;
    uInt32blockIndex;
    uInt32blockIndexPrev;
    uInt32i=0x0;
    structubixFSInfo*fsInfo=NULL;
    structdirectoryEntry*dirEntry=0x0;

    assert(fd);
    assert(fd->mp);
    assert(fd->mp->fsInfo);
    assert(fd->mp->device);
    assert(fd->mp->device->devInfo);

    blockIndex=blockIndexPrev=fd->start;
    fsInfo=fd->mp->fsInfo;

    blockOffset=(offset/0x1000);

    if(fd->size!=0x0){
    for(i=0x0;i<blockOffset;i++){
    blockIndex=fsInfo->blockAllocationTable[blockIndexPrev].nextBlock;
    if((int)blockIndex==EOBC){
    blockIndex=getFreeBlocks(1,fd);
    fsInfo->blockAllocationTable[blockIndexPrev].nextBlock=blockIndex;
    fsInfo->blockAllocationTable[blockIndex].nextBlock=EOBC;
    break;
    }
    blockIndexPrev=blockIndex;
    }
    }

    fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize);
    for(i=0x0;i<(uInt32)size;i++){

    fd->buffer[(offset-(blockOffset*0x1000))]=data[i];
    offset++;

    if(offset%4096==0x0){
    blockOffset++;
    fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize);

    if(fsInfo->blockAllocationTable[blockIndex].nextBlock==EOBC){
    blockIndexPrev=blockIndex;
    blockIndex=getFreeBlocks(1,fd);
    fsInfo->blockAllocationTable[blockIndexPrev].nextBlock=blockIndex;
    fsInfo->blockAllocationTable[blockIndex].nextBlock=EOBC;
    }
    else{
    blockIndex=fsInfo->blockAllocationTable[blockIndex].nextBlock;
    fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize);
    }
    }
    }
    fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize);

    if((uInt32)offset>fd->size){
    fd->size=offset;
    dirEntry=(structdirectoryEntry*)kmalloc(4096);
    /*
    fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),blockSize);
    */
    for(i=0x0;i<(4096/sizeof(structdirectoryEntry));i++){
    if((int)!strcmp(dirEntry[i].fileName,fd->fileName))
    break;
    }
    dirEntry[i].size=fd->size;
    dirEntry[i].startCluster=fd->start;
    /*
    fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),blockSize);
    */
    kfree(dirEntry);
    }
    /*Return*/
    return(size);
    }

    voidubixFSUnlink(char*path,structvfs_mountPoint*mp){
    intx=0;
    structdirectoryEntry*dirEntry=(structdirectoryEntry*)kmalloc(0x1000);
    structubixFSInfo*fsInfo=mp->fsInfo;

    mp->device->devInfo->read(mp->device->devInfo->info,dirEntry,(mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),8);

    for(x=0;(uInt32)x<(4096/sizeof(structdirectoryEntry));x++){
    if((int)!strcmp(dirEntry[x].fileName,path)){
    dirEntry[x].attributes|=typeDeleted;
    dirEntry[x].fileName[0]='?';
    mp->device->devInfo->write(mp->device->devInfo->info,dirEntry,(mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),8);
    return;
    }
    }
    kprintf("FileNotFound\n");
    return;
    }

    /*****************************************************************************************

    Function:static
    intubixfs_loadData(fileDescriptor*fd,char*data,uInt32size,uInt32batIndex)

    Description:Thiswillloadthenodedatainfromthedisk

    Notes:
    07/23/2004-Thisloadscompleteblocksfromdisksoitisalignedto0x1000notthe
    actualfilesize

    *****************************************************************************************/
    staticintubixfs_loadData(fileDescriptor*fd,char*data,uInt32size,uInt32batIndex){
    uInt32i=0x0;

    structubixFSInfo*fsInfo=NULL;

    assert(fd);
    assert(fd->mp);
    assert(fd->mp->fsInfo);

    fsInfo=fd->mp->fsInfo;

    size=UBIXFS_ALIGN(size);
    /*Loopbyblocksize*/

    for(i=0x0;i<size;i+=(UBIXFS_BLOCKSIZE_BYTES)){
    /*Getnextblockifwearereadyforit*/
    if(i!=0x0)
    batIndex=fsInfo->blockAllocationTable[batIndex].nextBlock;
    /*Readdatainfrommedia*/
    fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,data+i,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,blockSize);
    }
    /*Return*/
    return(0x0);
    }

    /*****************************************************************************************

    Function:intubixfs_initialize()

    Description:ThiswillinitializeamountpointitloadstheBATandCachestherootDir

    Notes:

    *****************************************************************************************/
    intubixfs_initialize(structvfs_mountPoint*mp){
    structubixFSInfo*fsInfo=0x0;

    assert(mp);
    assert(mp->diskLabel);
    assert(mp->diskLabel->partitions);

    mp->fsInfo=(structubixFSInfo*)kmalloc(sizeof(structubixFSInfo));
    assert(mp->fsInfo);

    fsInfo=mp->fsInfo;
    fsInfo->rootDir=0x0;/*Rootdirectoryisalways0x0ontheUbixFS*/

    /*
    CheckthedisklabeltoensurethisisanUbixFSpartition
    */
    if((mp->diskLabel->magicNum==UBIXDISKMAGIC)&&(mp->diskLabel->magicNum2==UBIXDISKMAGIC)){

    /*AllocatememoryforBAT*/
    fsInfo->blockAllocationTable=(structblockAllocationTableEntry*)kmalloc(mp->diskLabel->partitions[mp->partition].pBatSize*512);
    assert(fsInfo->blockAllocationTable);

    /*SetuptheamountofBATentries*/
    fsInfo->batEntries=(mp->diskLabel->partitions[mp->partition].pBatSize*512)/sizeof(structblockAllocationTableEntry);

    /*ReadtheBATtomemory*/
    assert(mp->device->devInfo->read);
    mp->device->devInfo->read(mp->device->devInfo->info,
    fsInfo->blockAllocationTable,
    mp->diskLabel->partitions[mp->partition].pOffset,
    mp->diskLabel->partitions[mp->partition].pBatSize);

    /*Setuprootdirectorycache*/
    fsInfo->dirCache=ubixfs_cacheNew("/");
    assert(fsInfo->dirCache);
    fsInfo->dirCache->info=(structdirectoryEntry*)kmalloc(0x4000);/*allocaterootdir*/
    fsInfo->dirCache->present=1;
    fsInfo->dirCache->size=kmalloc(sizeof(fsInfo->dirCache->size));
    fsInfo->dirCache->startCluster=kmalloc(sizeof(fsInfo->dirCache->startCluster));
    fsInfo->dirCache->attributes=kmalloc(sizeof(fsInfo->dirCache->attributes));
    fsInfo->dirCache->permissions=kmalloc(sizeof(fsInfo->dirCache->permissions));

    *fsInfo->dirCache->size=0x4000;
    *fsInfo->dirCache->startCluster=fsInfo->rootDir;

    assert(fsInfo->dirCache->info);
    /*Readrootdirinfromdiskitisalways0x4000byteslong*/
    mp->device->devInfo->read(mp->device->devInfo->info,
    fsInfo->dirCache->info,
    (mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),
    0x4000/512);

    /*Startourubixfs_threadtomanagethemountpoint*/
    /*
    UBUdisablefornow
    execThread(ubixfs_Thread,(uInt32)(kmalloc(0x2000)+0x2000),0x0);
    */
    kprintf("Offset:[%i],Partition:[%i]\n",
    mp->diskLabel->partitions[mp->partition].pOffset,mp->partition);
    kprintf("UbixFSInitialized\n");
    return(0x1);
    }

    kprintf("NotavalidUbixFSdisk.\n");
    /*Return*/
    return(0x0);
    }

    /*****************************************************************************************

    Function:intubixfs_init()

    Description:ThisisthemasterinitializationfortheUbixFileSystemitwillmakethe
    OSUbixFSaware.
    Itdoesnotinanywayshapeorformconnectamountpointanmediumthatis
    uptotheubixfs_initialize()function

    Notes:

    *****************************************************************************************/
    intubixfs_init(){
    /*Setupourfilesystemstructure*/
    structfileSystemubixFileSystem=
    {NULL,/*prev*/
    NULL,/*next*/
    (void*)ubixfs_initialize,/*vfsInitFS*/
    (void*)readUbixFS,/*vfsRead*/
    (void*)writeUbixFS,/*vfsWrite*/
    (void*)openFileUbixFS,/*vfsOpenFile*/
    (void*)ubixFSUnlink,/*vfsUnlink*/
    (void*)ubixFSmkDir,/*vfsMakeDir*/
    NULL,/*vfsRemDir*/
    NULL,/*vfsSync*/
    0/*vfsType*/
    };/*ubixFileSystem*/

    /*AddUbixFS*/
    if(vfsRegisterFS(ubixFileSystem)!=0x0){
    kpanic("UnableToEnableUbixFS");
    return(0x1);
    }

    /*Return*/
    return(0x0);
    }

    /***
    $Log: ubixfs_8c.xml,v $
    Revision 1.6  2006/12/19 14:12:53  reddawg
    rtld-elf almost workign

    Revision1.22006/12/0514:10:21reddawg
    WorkignDistro

    Revision1.1.1.12006/06/0112:46:17reddawg
    ubix2

    Revision1.22005/10/1200:13:37reddawg
    Removed

    Revision1.1.1.12005/09/2617:24:42reddawg
    nomessage

    Revision1.442004/08/2622:51:19reddawg
    TCAtouchedme:(ithinkhelikesmen....

    sched.h:kTask_taddedparentPid
    endtask.c:fixedtermbacktoparentPid
    exec.c:cleanedwarnings
    fork.c:fixedtermtochildPid
    sched.c:cleanupfordeadtasks
    systemtask.c:cleanupdeadtasks
    kmalloc.c:cleanedupwarnings
    udp.c:cleanedupwarnings
    bot.c:cleanedupwarnings
    shell.c:cleanedupwarnings
    tcpdump.c:tookadump
    hd.c:cleanedupwarnings
    ubixfs.c:stoppedprningdebuginfo

    Revision1.432004/08/1411:23:02reddawg
    Changes

    Revision1.422004/08/0912:58:05reddawg
    letmeknowwhenyougotthesurce

    Revision1.412004/08/0117:58:39flameshadow
    chg:fixedstringallocationbuginubixfs_cacheNew()

    Revision1.402004/07/2817:07:29flameshadow
    chg:re-addedmovingcachednodestothefrontofthelistwhenfound
    add:addedanassert()inubixfs.c

    Revision1.392004/07/2719:24:31flameshadow
    chg:reducedthenumberofdebuggingstatementsinthekernel.

    Revision1.382004/07/2712:02:01reddawg
    chg:fixedmarksbugreadFiledidalookupwhichiswhyitlookedlikeitwaslooppingsomuch

    Revision1.372004/07/2709:05:43flameshadow
    chg:fixedfilenotfoundbug.Stillcan'tfindloopingissue

    Revision1.362004/07/2704:05:20flameshadow
    chg:kindafixedit.Addedbunchesofdebuginfo

    Revision1.352004/07/2619:15:49reddawg
    testcode,fixesandthelike

    Revision1.342004/07/2423:04:44reddawg
    Changes...markletmeknowifyoufaultatpid185whenyoutypestress

    Revision1.332004/07/2309:10:06reddawg
    ubixfs:cleanedupsomefunctionsplayedwiththecachingabit
    vfs:renamedabunchoffunctions
    cleanedupafewmiscbugs

    Revision1.322004/07/2223:01:51reddawg
    OkcheckinginbeforeIsleep

    Revision1.312004/07/2222:37:03reddawg
    CachingisworkingnowtheFSisextremelyfastbutneedstobeoptimizedtodo32bitcopiesover8bit

    Revision1.302004/07/2219:01:59flameshadow
    chg:moredirectoryandfilecaching

    Revision1.292004/07/2216:34:32flameshadow
    add:fileanddircachingkindawork

    Revision1.282004/07/2122:07:18flameshadow
    chg:renamedcachingfunctions(again)

    Revision1.272004/07/2121:08:05flameshadow
    add:addedprovisionsforfilecaching

    Revision1.262004/07/2023:21:31flameshadow
    syncing

    Revision1.252004/07/2021:39:53reddawg
    ubixfs:doesproppercachingnowproblemwasyoudidnotseekrealSectorhowevertheosstartsbutIamgettingasegfaultcouldbefromanythinghaven'tlookedintoitrightquick

    Revision1.242004/07/2021:38:08flameshadow
    trynow

    Revision1.232004/07/2021:35:09reddawg
    Letmecommitbeforewestarttooverlap

    Revision1.222004/07/2021:28:16flameshadow
    oops

    Revision1.202004/07/2019:36:49reddawg
    UBUTags

    Revision1.192004/07/2018:09:37flameshadow
    add:directorycachingrelatedstuff

    Revision1.182004/07/1703:21:34flameshadow
    chg:cleanedupcode;addedassert()statements

    Revision1.152004/07/1412:21:49reddawg
    ubixfs:enableUbixFstoubixfs_init
    ChangedStartupRoutines

    Revision1.142004/06/2823:12:58reddawg
    fileformatnowcontainer:/path/to/file

    Revision1.132004/06/2818:12:44reddawg
    Weneedthesefiles

    Revision1.122004/06/2811:57:58reddawg
    FixingUpFilesystem

    Revision1.102004/06/0413:20:22reddawg
    ubixFSmkDir():playedwithitabittoseeifitstillworked

    Revision1.92004/06/0410:19:42reddawg
    notes:wecompileagain,thankg-danywaysiwasabouttocry

    Revision1.82004/06/0100:04:53reddawg
    Trynowmark

    Revision1.72004/05/1915:20:06reddawg
    Fixedreferenceproblemsduetochangesindrivesubsystem

    Revision1.62004/05/1904:07:43reddawg
    kmalloc(size,pid)nomoreitisnokmalloc(size);thewayitshouldofbeen

    Revision1.52004/04/2915:45:19reddawg
    Fixedsomebugssonowtheautomadeimageswillworkcorrectly

    Revision1.42004/04/2821:10:40reddawg
    LotsOfchangestomakeitworkwithexistingos

    Revision1.32004/04/2813:33:09reddawg
    OverhaultoubixfsandbootloaderandMBRtoworkwellwithourschema
    nowBATanddirandfileentriesarealloffset64Sectorsfromthestartofthepartition

    Revision1.22004/04/2802:22:55reddawg
    Thisisafiarlylargecommitbutwearestartingtousenewdrivermodel
    allaround

    Revision1.1.1.12004/04/1512:07:08reddawg
    UbixOSv1.0

    Revision1.312004/04/1316:36:34reddawg
    Changedourcopyright,itisallnowunderaBSD-Stylelicense

    END
    ***/