2 * Acess Micro - VFS Server version 1
9 int glVFS_MountList = 0;
11 tVFS_Mount *gRootMount = NULL;
15 * \fn int VFS_Mount(char *Device, char *MountPoint, char *Filesystem, char *ArgString)
16 * \brief Mount a device
17 * \param Device Device string to mount
18 * \param MountPoint Destination for the mount
19 * \param Filesystem Filesystem to use for the mount
20 * \param ArgString Options to be passed to the filesystem
21 * \return -1 on Invalid FS, -2 on No Mem, 0 on success
23 int VFS_Mount(char *Device, char *MountPoint, char *Filesystem, char *ArgString)
27 int deviceLen = strlen(Device);
28 int mountLen = strlen(MountPoint);
29 int argLen = strlen(ArgString);
32 fs = VFS_GetFSByName(Filesystem);
34 Warning("VFS_Mount - Unknown FS Type '%s'", Filesystem);
38 // Create mount information
39 mnt = malloc( sizeof(tVFS_Mount)+deviceLen+1+mountLen+1+argLen+1 );
44 // HACK: Forces VFS_ParsePath to fall back on root
45 if(mountLen == 1 && MountPoint[0] == '/')
46 mnt->MountPointLen = 0;
48 mnt->MountPointLen = mountLen;
53 mnt->Device = &mnt->StrData[0];
54 memcpy( mnt->Device, Device, deviceLen+1 );
56 mnt->MountPoint = &mnt->StrData[deviceLen+1];
57 memcpy( mnt->MountPoint, MountPoint, mountLen+1 );
59 mnt->Options = &mnt->StrData[deviceLen+1+mountLen+1];
60 memcpy( mnt->Options, ArgString, argLen+1 );
63 mnt->RootNode = fs->InitDevice(Device, ArgString);
70 if(!gRootMount) gRootMount = mnt;
73 LOCK( &glVFS_MountList );
76 RELEASE( &glVFS_MountList );
78 Log("VFS_Mount: Mounted '%s' to '%s' ('%s')", Device, MountPoint, Filesystem);