예제 #1
0
파일: File.cs 프로젝트: RainsSoft/VFS-2
        //创建文件
        public File(String name, Directory parent)
        {
            this.name = name;
            this.parent = parent;

            //寻找空闲的inode
            for (int i = 0; i < Config.GROUPS; i++ )
            {
                if (VFS.BLOCK_GROUPS[i].hasFreeINode())
                {
                    this.inode = VFS.BLOCK_GROUPS[i].getFreeInode();
                    break;
                }
            }

            updateCTime();
        }
예제 #2
0
        public BlockGroup(int block_group_index)
        {
            this.block_group_index = block_group_index;

            this.super_block = new SuperBlock();

            this.g_free_blocks_count = Config.BLOCKS_PER_GROUP;
            this.g_free_inodes_count = Config.INODES_PER_GROUP;

            this.block_index = new bool[Config.BLOCKS_PER_GROUP];
            this.inode_index = new bool[Config.INODES_PER_GROUP];

            this.blocks = new Block[Config.BLOCKS_PER_GROUP];
            this.inodes = new INode[Config.INODES_PER_GROUP];

            for (int i = 0; i < Config.BLOCKS_PER_GROUP; i++)
                blocks[i] = new Block(this.block_group_index, i);
            for (int i = 0; i < Config.INODES_PER_GROUP; i++)
                inodes[i] = new INode(this.block_group_index, i);
        }