Ejemplo n.º 1
0
 public InodeBlock()
 {
     for (int i = 0; i < 256 / 64; i++)
     {
         iNode[i] = new Inode();
     }
 }
Ejemplo n.º 2
0
 public int add(Inode iNode, int fileName, int _fileDescriptor)
 {
     if (bitmap[_fileDescriptor] != 0)
     {
         return(-1);
     }
     else
     {
         bitmap[_fileDescriptor]         = 1;
         fileDescriptor[_fileDescriptor] = new FileDescriptor(iNode, fileName);
         return(0);
     }
 }
Ejemplo n.º 3
0
 //This method is not currently used
 public void read(int blockNumber, Inode iNode)
 {
     myPFS = System.IO.File.Open(path, FileMode.Open);
     seekBlock(blockNumber);
     using (StreamReader sReader = new StreamReader(myPFS))
     {
         iNode.InodeFlag = Convert.ToInt32(sReader.Read());
         iNode.FileOwner = Convert.ToInt32(sReader.Read());
         //iNode.FileCreatedTime = Convert.ToDateTime(sReader.Read());
         //iNode.FileCreatedDate = Convert.ToDateTime(sReader.Read());
         iNode.FileSize = Convert.ToInt32(sReader.Read());
         iNode.Remarks  = Convert.ToString(sReader.Read());
         for (int j = 0; j < 13; j++)
         {
             iNode[j] = Convert.ToInt32(sReader.Read());
         }
     }
 }
Ejemplo n.º 4
0
 //This method is not currently used
 public void write(int blockNumber, Inode iNode)
 {
     myPFS = System.IO.File.Open(path, FileMode.Open);
     seekBlock(blockNumber);
     using (StreamWriter sWriter = new StreamWriter(myPFS))
     {
         sWriter.Write(iNode.InodeFlag);
         sWriter.Write(iNode.FileOwner);
         sWriter.Write(iNode.FileCreatedDate);
         sWriter.Write(iNode.FileCreatedTime);
         sWriter.Write(iNode.FileSize);
         sWriter.Write(iNode.Remarks);
         for (int j = 0; j < 13; j++)
         {
             sWriter.Write(iNode[j]);
         }
         foreach (var item in iNode.dataBlocks)
         {
             sWriter.Write(item);
         }
     }
 }
Ejemplo n.º 5
0
 public FileDescriptor(Inode _iNode, int _fileName)
 {
     this.iNode    = _iNode;
     this.fileName = _fileName;
 }