rossi.fstools.fs.ext2fs
Class GroupDesc

java.lang.Object
  extended byrossi.fstools.fs.ext2fs.GroupDesc
All Implemented Interfaces:
DiskStructure

public class GroupDesc
extends java.lang.Object
implements DiskStructure

Representation of ext2/3 group descriptor.

  On disk the superblock looks like this:

        31        24        16       8       0
        --------------------------------------
  0000  |        Block Bitmap Block          |
        --------------------------------------
  0004  |        Inode Bitmap Block          |
        --------------------------------------
  0008  |        Inode table                 |
        --------------------------------------
  000C  | Free Blocks   |  Free Inodes       |
        --------------------------------------
  0010  |  Used Dirs    |  Pad               |
        --------------------------------------
  0014  |        Reserved                    |
        --------------------------------------
  0018  |        Reserved                    |
        --------------------------------------
  001C  |        Reserved                    |
        --------------------------------------


Field Summary
protected  long blockBitmap
           
protected  int freeBlocks
           
protected  int freeInodes
           
protected  long inodeBitmap
           
protected  long inodeTable
           
protected  int usedDirs
           
 
Constructor Summary
GroupDesc()
           
 
Method Summary
 long getBlockBitmap()
          Get the location of the block bitmap block for this group.
 int getDataSize()
          Get the size in bytes of the structure.
 int getFreeBlocks()
          Get the number of free blocks in this group.
 int getFreeInodes()
          Get the number of free inodes in this group.
 long getInodeBitmap()
          Get the location of the inode bitmap block for this group.
 long getInodeTable()
          Get the location of the inode table for this group.
 int getUsedDirs()
          Get the number of directories in this group.
 void loadFromBuffer(byte[] buffer, int offset)
          Loads the object from a memory buffer
 void setBlockBitmap(long aBlockBitmap)
           
 void setFreeBlocks(int aFreeBlocks)
           
 void setFreeInodes(int aFreeInodes)
           
 void setInodeBitmap(long aInodeBitmap)
           
 void setInodeTable(long aInodeTable)
           
 void setUsedDirs(int aUsedDirs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

blockBitmap

protected long blockBitmap

inodeBitmap

protected long inodeBitmap

inodeTable

protected long inodeTable

freeBlocks

protected int freeBlocks

freeInodes

protected int freeInodes

usedDirs

protected int usedDirs
Constructor Detail

GroupDesc

public GroupDesc()
Method Detail

getDataSize

public int getDataSize()
Description copied from interface: DiskStructure
Get the size in bytes of the structure. For variable length sturctures this may represent the minimum length rather than the actual length.

Specified by:
getDataSize in interface DiskStructure
Returns:
the size of the structure.

getBlockBitmap

public long getBlockBitmap()
Get the location of the block bitmap block for this group.

Returns:
long

setBlockBitmap

public void setBlockBitmap(long aBlockBitmap)

getInodeBitmap

public long getInodeBitmap()
Get the location of the inode bitmap block for this group.

Returns:
long

setInodeBitmap

public void setInodeBitmap(long aInodeBitmap)

getInodeTable

public long getInodeTable()
Get the location of the inode table for this group.

Returns:
long

setInodeTable

public void setInodeTable(long aInodeTable)

getFreeBlocks

public int getFreeBlocks()
Get the number of free blocks in this group.

Returns:
long

setFreeBlocks

public void setFreeBlocks(int aFreeBlocks)

getFreeInodes

public int getFreeInodes()
Get the number of free inodes in this group.

Returns:
long

setFreeInodes

public void setFreeInodes(int aFreeInodes)

getUsedDirs

public int getUsedDirs()
Get the number of directories in this group.

Returns:
long

setUsedDirs

public void setUsedDirs(int aUsedDirs)

loadFromBuffer

public void loadFromBuffer(byte[] buffer,
                           int offset)
                    throws FsException
Description copied from interface: DiskStructure
Loads the object from a memory buffer

Specified by:
loadFromBuffer in interface DiskStructure
Parameters:
buffer - a byte[] containing data to be read in populating the object
offset - a int indicating the offset within the buffer to start parsing.
Throws:
FsException - if a parse error occurs.