mount.c
vfs/mount.h
ubixos/vitals.h
ubixos/kpanic.h
lib/kmalloc.h
lib/kprintf.h
lib/string.h
sys/device.h
sys/thread.h
ubixos/kpanic.h
ubixos/sched.h
ubixos/vitals.h
ubixos/types.h
sys/_types.h
lib/string.h
ubixos/time.h
vfs/file.h
sys/tss.h
lib/kmalloc.h
vfs/vfs.h
vfs/mount.h
lib/kprintf.h
ubixos/ubthread.h
ubixfs/dirCache.h
src/sys/vfs/mount.c
sys/sysproto.h
sys/signal.h
ubixos/tty.h
sys/io.h
sys/device.h
int int vfs_addMount (struct vfs_mountPoint *mp) vfs_addMount struct vfs_mountPoint * mp vitalsStruct::mountPoints vfs_mountPoint::next vfs_mountPoint::prev systemVitals vfs_mount
vfs_mountPoint * struct vfs_mountPoint* vfs_findMount (char *mountPoint) vfs_findMount char * mountPoint vfs_mountPoint::mountPoint vitalsStruct::mountPoints vfs_mountPoint::next NULL strcmp systemVitals devfs_makeNode fopen unlink
int int vfs_mount (int major, int minor, int partition, int vfsType, char *mountPoint, char *perms) vfs_mount int major int minor int partition int vfsType char * mountPoint char * perms vfs_mountPoint::device device_find vfs_mountPoint::fs kfree kmalloc kprintf vfs_mountPoint::mountPoint NULL vfs_mountPoint::partition vfs_mountPoint::perms sprintf vfs_addMount vfsFindFS fileSystem::vfsInitFS x1 devfs_init kmain

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

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

    #include<vfs/mount.h>
    #include<ubixos/vitals.h>
    #include<ubixos/kpanic.h>
    #include<lib/kmalloc.h>
    #include<lib/kprintf.h>
    #include<lib/string.h>
    #include<sys/device.h>

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

    Function:mount(intdriveId,intpartition,intfsType,char*mountPoint,char*perms)

    Description:mountaddsamountpointandreturns0ifsuccessful1ifitfails

    Notes:

    ************************************************************************/
    intvfs_mount(intmajor,intminor,intpartition,intvfsType,char*mountPoint,char*perms){
    structvfs_mountPoint*mp=0x0;
    structdevice_node*device=0x0;

    /*AllocateMemoryForMountPoint*/
    if((mp=(structvfs_mountPoint*)kmalloc(sizeof(structvfs_mountPoint)))==NULL)
    kprintf("vfs_mount:failedtoallocatemp\n");

    /*CopyMountPointIntoBuffer*/
    sprintf(mp->mountPoint,mountPoint);

    /*SetPointerToPhysicalDrive*/
    device=device_find(major,minor);

    /*SetUpMpDefaults*/
    mp->device=device;
    mp->fs=vfsFindFS(vfsType);
    mp->partition=partition;
    mp->perms=*perms;

    if(mp->fs==0x0){
    /*sysErr(systemErr,"FileSystemType:%iNotFound\n",fsType);*/
    kprintf("FileSystemType:%iNotFound\n",vfsType);
    return(0x1);
    }
    /*Whatisthisfor?10/6/2006*/
    /*
    if(device!=0x0){
    mp->diskLabel=(structubixDiskLabel*)kmalloc(512);
    mp->device->devInfo->read(mp->device->devInfo->info,mp->diskLabel,1,1);
    kprintf("READINGSECTOR");
    }
    */

    /*AddMountpointIfItFailsFreeAndReturn*/
    if(vfs_addMount(mp)!=0x0){
    kfree(mp);
    return(0x1);
    }

    /*InitializeTheFileSystemIfItFailsReturn*/
    if(mp->fs->vfsInitFS(mp)==0x0){
    kfree(mp);
    return(0x1);
    }
    /*Return*/
    return(0x0);
    }

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

    Function:vfs_addMount(structvfs_mountPoint*mp)

    Description:Thisfunctionaddsamountpointtothesystem

    Notes:

    ************************************************************************/
    intvfs_addMount(structvfs_mountPoint*mp){

    /*IfThereAreNoExistingMountsMakeItTheFirst*/
    if(systemVitals->mountPoints==0x0){
    mp->prev=0x0;
    mp->next=0x0;
    systemVitals->mountPoints=mp;
    }
    else{
    mp->next=systemVitals->mountPoints;
    systemVitals->mountPoints->prev=mp;
    mp->prev=0x0;
    systemVitals->mountPoints=mp;
    }
    /*Return*/
    return(0x0);
    }

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

    Function:vfs_findMount(char*mountPoint)

    Description:Thisfunctionfindsaparticularmountpoint

    Notes:

    ************************************************************************/
    structvfs_mountPoint*vfs_findMount(char*mountPoint){
    structvfs_mountPoint*tmpMp=0x0;

    for(tmpMp=systemVitals->mountPoints;tmpMp;tmpMp=tmpMp->next){
    if(strcmp(tmpMp->mountPoint,mountPoint)==0x0){
    return(tmpMp);
    }
    }
    /*ReturnNULLIfMountPointNotFound*/
    returnNULL;
    }

    /***
    END
    ***/