hos/kernel/fs/vfs.c

43 lines
681 B
C

// vfs.c
// Author: Josh Holtrop
// Date: 03/11/04
#include "vfs.h"
#include "hos_defines.h"
Volume *firstVolume = 0;
Volume *rootVolume = 0;
void vfs_init()
{
if(*(byte *)BOOT_HASRD) //bootloader loaded an initial ram disk
{
Volume *initrd = vfs_newVolume();
RamDisk *rd = rd_newDisk(0xC0200000, 1440*1024);
initrd->diskDevice = rd;
initrd->deviceType = VFS_RD;
strcpy(initrd->label, "rd0");
initrd->link = 0;
rootVolume = initrd;
}
}
Volume *vfs_newVolume()
{
Volume *vol = malloc(sizeof(Volume));
vfs_getLastVolume()->link = vol;
return vol;
}
Volume *vfs_getLastVolume()
{
Volume *vol = firstVolume;
while (vol)
vol = vol->link;
return vol;
}