// vfs.cpp // Author: Josh Holtrop // Date: 03/11/04 // Modified: 04/16/04 #include "hos_defines.h" #include "vfs.h" //#include "fs/vfat.h" //#include "block/rd.h" //#include "block/loop.h" #include "lang/LinkedList.h" #include "lang/string.h" #include "devfs.h" #include "kio.h" #include "Mount.h" LinkedList *mounts; void vfs_init() { mounts = new LinkedList; } void list() { LinkedList::iterator it = mounts->begin(); while (it != mounts->end()) { printf("%s\t%s\n", (*it).device.data(), (*it).mountPoint.data()); ++it; } } int vfs_mount(string device, string mountPoint) { Mount mount(device, mountPoint); LinkedList::iterator it = mounts->begin(); int i = 0; while (it != mounts->end() && (*it).mountPoint <= mount.mountPoint) { if (*it == mount) return 1; //device already mounted or mount point already taken i++; ++it; } mounts->insert(i, mount); return 0; }