示例#1
0
        /// <summary>
        /// Mount root partition to VFS
        /// </summary>
        /// <param name="node">Partition node</param>
        /// <param name="name">Mount name</param>
        /// <param name="fsType">Filesystem type</param>
        /// <returns>Status</returns>
        public static DiskMountResult Mount(Node node, string name, string fsType)
        {
            IFilesystem fs = (IFilesystem)mFilesystems.Get(fsType);

            if (fs == null)
            {
                return(DiskMountResult.FS_TYPE_NOT_FOUND);
            }

            Node retNode = fs.Init(node);

            if (retNode == null)
            {
                return(DiskMountResult.INIT_FAIL);
            }

            RootPoint point = VFS.RootMountPoint.GetEntry(name);

            if (point != null)
            {
                return(DiskMountResult.MOUNT_POINT_ALREADY_USED);
            }

            RootPoint dev = new RootPoint(name, retNode);

            VFS.RootMountPoint.AddEntry(dev);

            return(DiskMountResult.SUCCESS);
        }