directory.c
ubixfs/ubixfs.h
vfs/file.h
vfs/mount.h
ubixos/types.h
lib/kmalloc.h
lib/kprintf.h
lib/string.h
sys/thread.h
ubixos/sched.h
src/sys/ubixfs/directory.c
ubixos/types.h
sys/_types.h
lib/string.h
vfs/file.h
sys/tss.h
lib/kmalloc.h
mpi/mpi.h
vfs/vfs.h
vfs/mount.h
lib/kprintf.h
ubixfs/ubixfs.h
ubixfs/dirCache.h
sys/sysproto.h
sys/signal.h
ubixos/tty.h
sys/device.h
int int addDirEntry (struct directoryEntry *dir, fileDescriptor *fd) addDirEntry struct directoryEntry * dir fileDescriptor * fd kmalloc kprintf memcpy fileDescriptorStruct::offset readUbixFS fileDescriptorStruct::size writeUbixFS x1000 ubixFSmkDir
dirList_t dirList_t ubixFSLoadDir (char *data) ubixFSLoadDir char * data directoryList::dirCache dirList directoryList::dirName kmalloc directoryList::next directoryList::prev sprintf strcmp
int int ubixFSmkDir (char *directory, fileDescriptor *fd) ubixFSmkDir char * directory fileDescriptor * fd addDirEntry directoryEntry::attributes ubixFSInfo::blockAllocationTable blockSize vfs_mountPoint::device device_node::devInfo vfs_mountPoint::diskLabel directoryEntry::fileName vfs_mountPoint::fsInfo getFreeBlocks device_interface::info kfree kmalloc fileDescriptorStruct::mp vfs_mountPoint::partition ubixDiskLabel::partitions directoryEntry::permissions blockAllocationTableEntry::realSector directoryEntry::size sprintf directoryEntry::startCluster typeDirectory UBIXFS_BLOCKSIZE_BYTES device_interface::write ubixfs_init
dirList_t dirList_t dirList dirList 0x0 ubixfs_cacheFind ubixfs_findName ubixFSLoadDir

    /*****************************************************************************************
    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: directory_8c.xml 88 2016-01-12 00:11:29Z reddawg $

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

    #include<ubixfs/ubixfs.h>
    #include<vfs/file.h>
    #include<vfs/mount.h>
    #include<ubixos/types.h>
    #include<lib/kmalloc.h>
    #include<lib/kprintf.h>
    #include<lib/string.h>

    staticdirList_tdirList=0x0;

    dirList_t
    ubixFSLoadDir(char*data){
    dirList_ttmpDir=0x0;

    tmpDir=(dirList_t)kmalloc(sizeof(structdirectoryList));

    sprintf(tmpDir->dirName,"%s",data);

    if(0x0==dirList){
    dirList=tmpDir;
    }
    else{
    tmpDir->next=dirList;
    tmpDir->prev=0x0;
    dirList->prev=tmpDir;
    dirList=tmpDir;
    }

    if(!strcmp(":",data)){
    tmpDir->dirCache=(char*)kmalloc(0x4000);
    }

    return(tmpDir);
    }

    int
    addDirEntry(structdirectoryEntry*dir,fileDescriptor*fd){
    uInt32i=0x0;
    uInt32entries=0x0;
    structdirectoryEntry*tmp=0x0;

    tmp=(structdirectoryEntry*)kmalloc(fd->size);

    readUbixFS(fd,(char*)tmp,fd->offset,fd->size);
    entries=fd->size/sizeof(structdirectoryEntry);
    for(i=0;(tmp[i].attributes!=0x0)&&(i<entries);i++);

    if(i==entries){
    tmp=(structdirectoryEntry*)kmalloc(0x1000);
    i=0x0;
    }
    else{
    fd->offset=0x0;
    }
    memcpy(&tmp[i],dir,sizeof(structdirectoryEntry));

    if(writeUbixFS(fd,(char*)tmp,fd->offset,fd->size)==0x0){
    kprintf("ErrorCreatingDirectory\n");
    }

    return(0x0);
    }

    int
    ubixFSmkDir(char*directory,fileDescriptor*fd){
    intblock=0x0;

    structdirectoryEntry*dir=0x0;
    structdirectoryEntry*entry=0x0;
    structubixFSInfo*fsInfo=fd->mp->fsInfo;

    //kprintf("CreatingDirectory:%s",directory);

    block=getFreeBlocks(1,fd);
    if(block!=0x0){
    dir=(structdirectoryEntry*)kmalloc(UBIXFS_BLOCKSIZE_BYTES);
    entry=(structdirectoryEntry*)kmalloc(sizeof(structdirectoryEntry));

    entry->startCluster=block;
    entry->size=UBIXFS_BLOCKSIZE_BYTES;
    entry->attributes=typeDirectory;
    entry->permissions=0xEAA;
    sprintf(entry->fileName,directory);

    //dir->attributes=typeDirectory;
    //sprintf(dir->fileName,"TestEntry");

    fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,
    dir,
    fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[block].realSector,
    blockSize);
    addDirEntry(entry,fd);
    kfree(dir);
    kfree(entry);
    }

    return(0x0);
    }

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

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

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

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

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

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

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

    Revision1.92004/07/1620:17:29flameshadow
    chg:broketheufsstuff
    chg:changedvfsRegisterFS()toacceptafileSystemstruct
    chg:modifiedcallstovfsRegisterFS()topassfileSystemstruct

    Revision1.82004/06/2903:59:47reddawg
    Fixedafewissueswithsubdirectoriestheyareworkingmuchbetternow

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

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

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

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

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

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

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

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

    END
    ***/