Save() 공개 메소드

将 superblock 写入存储介质
public Save ( ) : void
리턴 void
예제 #1
0
파일: SuperBlock.cs 프로젝트: bwbwbwbw/vfs
        /// <summary>
        /// 创建一个全新的 SuperBlock
        /// </summary>
        /// <param name="vfs"></param>
        /// <param name="inodeCapacity"></param>
        /// <param name="blockSize"></param>
        /// <param name="blockCapacity"></param>
        /// <returns></returns>
        public static SuperBlock Create(VFSCore vfs, UInt32 inodeCapacity, UInt16 blockSize, UInt32 blockCapacity)
        {
            var _superBlock = new _SuperBlock(inodeCapacity, blockSize, blockCapacity);
            var superBlock  = new SuperBlock(vfs, _superBlock);

            superBlock.Save();
            return(superBlock);
        }
예제 #2
0
 /// <summary>
 /// 预留指定数量的数据块
 /// </summary>
 /// <param name="blocksToPreserve"></param>
 public void PreserveBlock(UInt32 blocksToPreserve)
 {
     if (blocksToPreserve == 0)
     {
         return;
     }
     if (superBlock.data.blockPreserved + blocksToPreserve > superBlock.data.blockCapacity)
     {
         throw new Exception("block 数量已满");
     }
     superBlock.data.blockPreserved += blocksToPreserve;
     superBlock.Save();
 }
예제 #3
0
 /// <summary>
 /// 创建一个全新的 SuperBlock
 /// </summary>
 /// <param name="vfs"></param>
 /// <param name="inodeCapacity"></param>
 /// <param name="blockSize"></param>
 /// <param name="blockCapacity"></param>
 /// <returns></returns>
 public static SuperBlock Create(VFSCore vfs, UInt32 inodeCapacity, UInt16 blockSize, UInt32 blockCapacity)
 {
     var _superBlock = new _SuperBlock(inodeCapacity, blockSize, blockCapacity);
     var superBlock = new SuperBlock(vfs, _superBlock);
     superBlock.Save();
     return superBlock;
 }