コード例 #1
0
        public List <TypeOf> List; // список содержащихся в папке файлов

        public catalog(inode attribut, string pname)
            : base(attribut, pname)
        {
            attributes = attribut;
            name       = pname;
            List       = new List <TypeOf>();
        }
コード例 #2
0
        public void mount()
        {
            Program.myForm.Log.Text += "Начало монтирования системы\n";
            CountBlocks              = (int)(StartMemoryHDD / Blocks_HDD); //Вычисление количества блоков
            inode_count              = Blocks_HDD / Inode_Memory;          //Вычисление количества инодов
            Program.myForm.Log.Text += "Количество памяти в байтах: " + StartMemoryHDD + "\n";
            Program.myForm.Log.Text += "Размер блока: " + Blocks_HDD + " байт\n";
            Program.myForm.Log.Text += "Размер inode: " + Inode_Memory + " байт\n\n";
            Program.myForm.Log.Text += "Количество созданных блоков: " + CountBlocks + "\n";
            Program.myForm.Log.Text += "Количество inode в блоках: " + inode_count + "\n";
            Program.myForm.Log.Text += "Размер одного кластера: " + claster + "\n\n";

            List <Block> Blocks = new List <Block>(CountBlocks);

            for (int i = 0; i < CountBlocks; i++)
            {
                inode[] ino = new inode[inode_count];
                for (int j = 0; j < inode_count; j++)
                {
                    ino[j] = new inode();
                }

                Block inod = new Block(ino, Blocks_HDD / claster);
                for (int j = 0; j < Blocks_HDD / claster; j++)
                {
                    inod.claster[j].SetNumber(i, j);
                }
                int c = 0;
                foreach (inode t in inod.InodeMap)
                {
                    c++;
                    t.inode_number = c;
                }
                Blocks.Add(inod);
            }
            Super = new Superblock(Blocks);

            Root.List                     = new List <TypeOf>();
            Root.name                     = "Root";
            Root.attributes               = function_inode.Search_free_inode();
            Root.attributes.di_uid        = "admin";
            Root.attributes.dimode.type   = "folder";
            Root.attributes.dimode.rights = "rw-rw";
            Root.attributes.di_size       = 0;
            Root.attributes.free          = false;

            Serializing.Ser(Blocks);
        }
コード例 #3
0
        public static inode Search_free_inode()
        {
            inode f = new inode();

            for (int i = 0; i < Main.Super.Blocks.Count; i++)                   // цикл по поиску блоков
            {
                for (int j = 0; j < Main.Super.Blocks[i].InodeMap.Count(); j++) // цикл по поиску свободного кластера
                {
                    if (Main.Super.Blocks[i].InodeMap[j].free)
                    {
                        return(Main.Super.Blocks[i].InodeMap[j]);
                    }
                }
            }
            Program.myForm.Log.Text += "Не удалось найти свободный Inode " + "\n Операция не выполнена\n\n";
            return(f);
        }
コード例 #4
0
 public catalog()
 {
     attributes = new inode();
     name       = "";
     List       = new List <TypeOf>();
 }
コード例 #5
0
 public file()
 {
     attributes = new inode();
     name       = "";
 }
コード例 #6
0
 public file(inode attribut, string pname)
     : base(attribut, pname)
 {
     attributes = attribut;
     name       = pname;
 }
コード例 #7
0
 public TypeOf()
 {
     attributes = new inode();
     name       = "";
 }
コード例 #8
0
 public TypeOf(inode attribut, string pname)
 {
     attributes = attribut;
     name       = pname;
 }