VirtualFileSystem.VFSCore.AllocateINode C# (CSharp) Method

AllocateINode() public method

分配、初始化一个新的 inode
public AllocateINode ( UInt32 flags, UInt32 owner ) : INode
flags System.UInt32
owner System.UInt32
return INode
        public INode AllocateINode(UInt32 flags, UInt32 owner)
        {
            // 查找位图,寻找一个可用的 index
            UInt32 freeIndex = GetFreeINodeIndex();
            if (freeIndex == UInt32.MaxValue)
            {
                throw new Exception("inode 数量已满");
            }

            // 创建
            INode inode = INode.Create(this, freeIndex, flags, owner);

            // 置位
            SetBitmapAllocated(superBlock.pInodeBitVectors, inodeBitmaps, freeIndex);

            // 更新计数器
            superBlock.data.inodeAllocated++;
            superBlock.Save();

            return inode;
        }

Usage Example

示例#1
0
 /// <summary>
 /// 创建一个新目录
 /// </summary>
 /// <param name="vfs"></param>
 /// <returns></returns>
 public static INodeDirectory Create(VFSCore vfs)
 {
     INode inode = vfs.AllocateINode(1, 2333);
     INodeDirectory t = new INodeDirectory(vfs, inode);
     t.AddSelf();
     return t;
 }
All Usage Examples Of VirtualFileSystem.VFSCore::AllocateINode