/// <summary> /// Mount a device /// </summary> /// <param name="devicePath">Path to device</param> /// <param name="mountname">Name of mount , eg "D"</param> /// <param name="fsType">Filesystem type, eg "Fat16b"</param> /// <returns>Success?</returns> public static unsafe int Mount(string devicePath, string mountname, string fsType) { if (mountname.IndexOf(":") > 0) { return(-(int)ErrorCode.ENOTDIR); } Node node = VFS.GetByAbsolutePath(devicePath); if (node == null) { return(-(int)ErrorCode.ENOENT); } // TODO: maybe check if block device? Console.WriteLine(devicePath); Console.WriteLine(mountname); Console.WriteLine(fsType); DiskMountResult res = Disk.Mount(node, mountname, fsType); if (res == DiskMountResult.FS_TYPE_NOT_FOUND) { return(-(int)ErrorCode.ENODEV); } if (res == DiskMountResult.MOUNT_POINT_ALREADY_USED) { return(-(int)ErrorCode.EBUSY); } if (res == DiskMountResult.INIT_FAIL) { return(-(int)ErrorCode.ENODEV); } return(0); }
private static void mountBootPartition() { string bootDevice = BootParams.GetParam("--bootdev"); string bootFS = BootParams.GetParam("--boottype"); if (bootDevice == null) { Panic.DoPanic("No bootdevice specified."); } if (bootFS == null) { Panic.DoPanic("No boot filesystem specified."); } Console.Write("[Init] Mounting bootdevice "); Console.Write(bootDevice); Console.Write(":"); Console.Write(bootFS); Console.WriteLine(""); Node hddNode = VFS.GetByAbsolutePath(bootDevice, 0); if (hddNode == null) { Panic.DoPanic("Bootdevice not found."); } DiskMountResult res = Disk.Mount(hddNode, "C", bootFS); if (res != DiskMountResult.SUCCESS) { Panic.DoPanic("Failed to mount bootdevice."); } Tasking.CurrentTask.CurrentDirectory = "C://"; }