Exemplo n.º 1
0
        private void InitializeFileSystem()
        {
            Inodes.Inode inode = new Inodes.Inode()
            {
                fileType              = 0x02,   // Каталог
                inodeId               = 1,      // root-каталог
                userId                = 1,      // root пользователь
                groupId               = 1,      // root группа
                permissions           = 0x01FD, // rwx|rwx|r-x
                attributes            = 0x2,    // Системный
                fileSize              = _diskClusterSize,
                datetimeFileCreated   = Utils.GetTimestamp(),
                datetimeFileModified  = Utils.GetTimestamp(),
                datetimeInodeModified = Utils.GetTimestamp(),
                firstClusterIndex     = 0x0 // Корневой каталог
            };

            _inodes[0] = inode;

            for (int i = 1; i < _inodes.GetCount(); i++)
            {
                inode = new Inodes.Inode()
                {
                    fileType = 0xFF,
                    inodeId  = i + 1,
                    datetimeInodeModified = Utils.GetTimestamp()
                };

                _inodes[i] = inode;
            }

            _superblock.bitMapAddress     = Marshal.SizeOf <Superblock>();
            _superblock.inodeArrayAddress = _superblock.bitMapAddress + _bitMap.GetLength();
            _superblock.rootAddress       = _superblock.inodeArrayAddress + _inodes.GetLength();
            _superblock.dataAddress       = _superblock.rootAddress + _rootDirectory.GetLength();
        }
Exemplo n.º 2
0
        private void InitializeFileSystem()
        {
            Inodes.Inode inode = new Inodes.Inode()
            {
                fileType = 0x02, // Каталог
                inodeId = 1, // root-каталог
                userId = 1, // root пользователь
                groupId = 1, // root группа
                permissions = 0x01FD, // rwx|rwx|r-x
                attributes = 0x2, // Системный
                fileSize = _diskClusterSize,
                datetimeFileCreated = Utils.GetTimestamp(),
                datetimeFileModified = Utils.GetTimestamp(),
                datetimeInodeModified = Utils.GetTimestamp(),
                firstClusterIndex = 0x0 // Корневой каталог
            };

            _inodes[0] = inode;

            for (int i = 1; i < _inodes.GetCount(); i++)
            {
                inode = new Inodes.Inode()
                {
                    fileType = 0xFF,
                    inodeId = i + 1,
                    datetimeInodeModified = Utils.GetTimestamp()
                };

                _inodes[i] = inode;
            }

            _superblock.bitMapAddress = Marshal.SizeOf<Superblock>();
            _superblock.inodeArrayAddress = _superblock.bitMapAddress + _bitMap.GetLength();
            _superblock.rootAddress = _superblock.inodeArrayAddress + _inodes.GetLength();
            _superblock.dataAddress = _superblock.rootAddress + _rootDirectory.GetLength();
        }