GetDevice() public method

获取此文件系统的存储介质操作对象
public GetDevice ( ) : AbstractDevice
return AbstractDevice
Example #1
0
        /// <summary>
        /// 从存储介质中获取 inode
        /// </summary>
        /// <param name="vfs"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        public static INode Load(VFSCore vfs, UInt32 index)
        {
            if (index >= vfs.GetSuperBlock().data.inodeCapacity)
            {
                throw new Exception("无效 inode 编号");
            }

            INode inode = null;

            if (inodeInstances.ContainsKey(index))
            {
                inode = inodeInstances[index];
                return(inode);
            }
            else
            {
                _INode data = vfs.GetDevice().Read <_INode>(GetPosition(vfs, index));
                inode = new INode(vfs, data, index);
                inodeInstances[index] = inode;
            }

            inode.data.accessTime = (UInt64)DateTime.Now.Ticks;
            inode.Save();
            return(inode);
        }
Example #2
0
        /// <summary>
        /// 从存储介质上还原 SuperBlock
        /// </summary>
        /// <param name="vfs"></param>
        /// <returns></returns>
        public static SuperBlock Load(VFSCore vfs)
        {
            var _superBlock = vfs.GetDevice().Read <_SuperBlock>(0);

            return(new SuperBlock(vfs, _superBlock));
        }
Example #3
0
 /// <summary>
 /// 将 superblock 写入存储介质
 /// </summary>
 /// <param name="vfs"></param>
 public void Save()
 {
     vfs.GetDevice().Write(0, data);
 }
Example #4
0
 /// <summary>
 /// 将 inode 数据写入存储介质
 /// </summary>
 /// <param name="vfs"></param>
 public void Save()
 {
     vfs.GetDevice().Write(GetPosition(), data);
 }
Example #5
0
 public DeviceAdapter.AbstractDevice GetDevice()
 {
     return(vfs.GetDevice());
 }
Example #6
0
 /// <summary>
 /// 从存储介质上还原 SuperBlock
 /// </summary>
 /// <param name="vfs"></param>
 /// <returns></returns>
 public static SuperBlock Load(VFSCore vfs)
 {
     var _superBlock = vfs.GetDevice().Read<_SuperBlock>(0);
     return new SuperBlock(vfs, _superBlock);
 }
Example #7
0
        /// <summary>
        /// 从存储介质中获取 inode
        /// </summary>
        /// <param name="vfs"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        public static INode Load(VFSCore vfs, UInt32 index)
        {
            if (index >= vfs.GetSuperBlock().data.inodeCapacity)
            {
                throw new Exception("无效 inode 编号");
            }

            INode inode = null;

            if (inodeInstances.ContainsKey(index))
            {
                inode = inodeInstances[index];
                return inode;
            }
            else
            {
                _INode data = vfs.GetDevice().Read<_INode>(GetPosition(vfs, index));
                inode = new INode(vfs, data, index);
                inodeInstances[index] = inode;
            }

            inode.data.accessTime = (UInt64)DateTime.Now.Ticks;
            inode.Save();
            return inode;
        }