/// <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); }
/// <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(); }
/// <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; }