block.c
ubixfs/ubixfs.h
vfs/file.h
vfs/mount.h
sys/thread.h
ubixos/sched.h
ubixos/types.h
sys/_types.h
vfs/file.h
sys/tss.h
src/sys/ubixfs/block.c
mpi/mpi.h
vfs/vfs.h
vfs/mount.h
ubixfs/ubixfs.h
ubixfs/dirCache.h
sys/sysproto.h
sys/signal.h
ubixos/tty.h
sys/device.h
int int freeBlocks (int block, fileDescriptor *fd) freeBlocks int block fileDescriptor * fd blockAllocationTableEntry::attributes ubixFSInfo::blockAllocationTable vfs_mountPoint::fsInfo fileDescriptorStruct::mp blockAllocationTableEntry::nextBlock syncBat
int int getFreeBlocks (int count, fileDescriptor *fd) getFreeBlocks int count fileDescriptor * fd blockAllocationTableEntry::attributes ubixFSInfo::batEntries ubixFSInfo::blockAllocationTable vfs_mountPoint::fsInfo fileDescriptorStruct::mp blockAllocationTableEntry::nextBlock syncBat x1 ubixFSmkDir writeUbixFS
void void syncBat (struct vfs_mountPoint *mp) syncBat struct vfs_mountPoint * mp ubixFSInfo::blockAllocationTable vfs_mountPoint::device device_node::devInfo vfs_mountPoint::diskLabel vfs_mountPoint::fsInfo device_interface::info vfs_mountPoint::partition ubixDiskLabel::partitions device_interface::write freeBlocks getFreeBlocks

    /*****************************************************************************************
    Copyright(c)2002TheUbixOSProject
    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.

    $Log: block_8c.xml,v $
    Revision 1.6  2006/12/19 14:12:50  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:39reddawg
    nomessage

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

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

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

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

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

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

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

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

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

    #include<ubixfs/ubixfs.h>
    #include<vfs/file.h>
    #include<vfs/mount.h>

    voidsyncBat(structvfs_mountPoint*mp){
    structubixFSInfo*fsInfo=mp->fsInfo;
    mp->device->devInfo->write(mp->device->devInfo->info,fsInfo->blockAllocationTable,mp->diskLabel->partitions[mp->partition].pOffset,mp->diskLabel->partitions[mp->partition].pBatSize);
    }

    intfreeBlocks(intblock,fileDescriptor*fd){
    inti=block;

    structubixFSInfo*fsInfo=fd->mp->fsInfo;

    while(i!=0x0){
    block=fsInfo->blockAllocationTable[i].nextBlock;

    fsInfo->blockAllocationTable[i].attributes=0x0;
    fsInfo->blockAllocationTable[i].nextBlock=0x0;

    i=block;
    }
    syncBat(fd->mp);
    return(i);
    }

    intgetFreeBlocks(intcount,fileDescriptor*fd){
    uInt32i=0x0;
    uInt32x=0x0;

    structubixFSInfo*fsInfo=fd->mp->fsInfo;

    getBlocks:
    for(i=1;i<fsInfo->batEntries;i++){
    if(fsInfo->blockAllocationTable[i].attributes==0x0){
    for(x=1;x<(uInt32)count;x++){
    if(fsInfo->blockAllocationTable[i+x].attributes!=0x0){
    gotogetBlocks;
    }
    }
    for(x=i;x<i+count;x++){
    fsInfo->blockAllocationTable[x].attributes=0x1;
    if((x+1)==(i+count)){
    fsInfo->blockAllocationTable[x].nextBlock=-1;
    }
    else{
    fsInfo->blockAllocationTable[x].nextBlock=x+1;
    }
    }
    syncBat(fd->mp);
    return(i);
    }
    }
    return(0x0);
    }

    /***
    END
    ***/