rossi.fstools.fs.reiserfs
Class ReiserSuperBlock

java.lang.Object
  extended byrossi.fstools.fs.reiserfs.ReiserSuperBlock
All Implemented Interfaces:
DiskStructure, SuperBlock

public class ReiserSuperBlock
extends java.lang.Object
implements SuperBlock

Representation of ReiserFS superblock.

  On disk the superblock looks like this:

        31        24        16       8       0
        --------------------------------------
  0000  |        Block Count                 |
        --------------------------------------
  0004  |        Free Blocks                 |
        --------------------------------------
  0008  |        Root Block                  |
        --------------------------------------
  000C  |        Journal Block               |
        --------------------------------------
  0010  |        Journal Device              |
        --------------------------------------
  0014  |        Orig Journal Size           |
        --------------------------------------
  0018  |        Journal Trans Max           |
        --------------------------------------
  001C  |        Journal Block Count         |
        --------------------------------------
  0020  |        Journal Max Batch           |
        --------------------------------------
  0024  |        Journal Commit Age          |
        --------------------------------------
  0028  |        Journal Trans Age           |
        --------------------------------------
  002C  |     Block Size    | Old Max Size   |
        --------------------------------------
  0030  |     Curr Size     |   State        |
        --------------------------------------
  0034  |       Magic                        |
        --------------------------------------
  0038  |       Magic  (cont)                |
        --------------------------------------
  003C  |       Magic  (cont)                |
        --------------------------------------
  0040  |             Hash Func              | For V1, this is omitted
        --------------------------------------
  0044  |     Tree Height   | Bitmap Blocks  |
        --------------------------------------
  0048  |     Version       |  Reserved      | Remaining fields omitted in V1
        --------------------------------------
  004C  |              Inode Gen             | 
        --------------------------------------
  0050  |               Flags                |  
        --------------------------------------
  0054  |     Filesystem Unique Id           |  
        --------------------------------------
  0058  |     Filesystem Unique Id           |  
        --------------------------------------
  005C  |     Filesystem Unique Id           |  
        --------------------------------------
  0060` |     Filesystem Unique Id           |  
        --------------------------------------
  0064  |        Volume Label                |  
        --------------------------------------
  0068  |        Volume Label                |  
        --------------------------------------
  006C  |        Volume Label                |  
        --------------------------------------
  0070  |        Volume Label                |  
        --------------------------------------

 


Field Summary
protected  int bitmapBlocks
           
protected  long blockCount
           
protected  int blockSize
           
protected  int currSize
           
protected  long flags
           
protected  long freeBlocks
           
protected  long hashFunc
           
protected  long inodeGen
           
protected  long journalBlock
           
protected  long journalBlockCount
           
protected  long journalCommitAge
           
protected  long journalDev
           
protected  long journalMaxBatch
           
protected  long journalTransAge
           
protected  long journalTransMax
           
protected  byte[] label
           
protected  byte[] magic
           
protected  int oldMaxSize
           
protected  long origJournalSize
           
protected  int reserved
           
protected  long rootBlock
           
protected  int state
           
protected  int treeHeight
           
protected  byte[] uniqueID
           
protected  int version
           
 
Constructor Summary
ReiserSuperBlock()
           
 
Method Summary
 int getBitmapBlocks()
           
 long getBlockCount()
           
 int getBlockSize()
           
 int getCurrSize()
           
 int getDataSize()
          Get the size in bytes of the structure.
 long getFlags()
           
 long getFreeBlocks()
           
 long getHashFunc()
           
 long getInodeGen()
           
 long getJournalBlock()
           
 long getJournalBlockCount()
           
 long getJournalCommitAge()
           
 long getJournalDev()
           
 long getJournalMaxBatch()
           
 long getJournalTransAge()
           
 long getJournalTransMax()
           
 byte[] getLabel()
           
 byte[] getMagic()
           
 int getOldMaxSize()
           
 long getOrigJournalSize()
           
 int getReserved()
           
 long getRootBlock()
           
 int getState()
           
 int getTreeHeight()
           
 byte[] getUniqueID()
           
 int getVersion()
           
 void loadFromBuffer(byte[] buffer, int offset)
          Load from a buffer containint the superblock.
 void setBitmapBlocks(int aBitmapBlocks)
           
 void setBlockCount(long aBlockCount)
           
 void setBlockSize(int aBlockSize)
           
 void setCurrSize(int aCurrSize)
           
 void setFlags(long aFlags)
           
 void setFreeBlocks(long aFreeBlocks)
           
 void setHashFunc(long aHashFunc)
           
 void setInodeGen(long aInodeGen)
           
 void setJournalBlock(long aJournalBlock)
           
 void setJournalBlockCount(long aJournalBlockCount)
           
 void setJournalCommitAge(long aJournalCommitAge)
           
 void setJournalDev(long aJournalDev)
           
 void setJournalMaxBatch(long aJournalMaxBatch)
           
 void setJournalTransAge(long aJournalTransAge)
           
 void setJournalTransMax(long aJournalTransMax)
           
 void setLabel(byte[] aLabel)
           
 void setMagic(byte[] aMagic)
           
 void setOldMaxSize(int aOldMaxSize)
           
 void setOrigJournalSize(long aOrigJournalSize)
           
 void setReserved(int aReserved)
           
 void setRootBlock(long aRootBlock)
           
 void setState(int aState)
           
 void setTreeHeight(int aTreeHeight)
           
 void setUniqueID(byte[] aUniqueID)
           
 void setVersion(int aVersion)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

blockCount

protected long blockCount

freeBlocks

protected long freeBlocks

rootBlock

protected long rootBlock

journalBlock

protected long journalBlock

journalDev

protected long journalDev

origJournalSize

protected long origJournalSize

journalTransMax

protected long journalTransMax

journalBlockCount

protected long journalBlockCount

journalMaxBatch

protected long journalMaxBatch

journalCommitAge

protected long journalCommitAge

journalTransAge

protected long journalTransAge

blockSize

protected int blockSize

oldMaxSize

protected int oldMaxSize

currSize

protected int currSize

state

protected int state

magic

protected byte[] magic

hashFunc

protected long hashFunc

treeHeight

protected int treeHeight

bitmapBlocks

protected int bitmapBlocks

version

protected int version

reserved

protected int reserved

inodeGen

protected long inodeGen

flags

protected long flags

uniqueID

protected byte[] uniqueID

label

protected byte[] label
Constructor Detail

ReiserSuperBlock

public ReiserSuperBlock()
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.

getBlockCount

public long getBlockCount()

setBlockCount

public void setBlockCount(long aBlockCount)

getFreeBlocks

public long getFreeBlocks()

setFreeBlocks

public void setFreeBlocks(long aFreeBlocks)

getRootBlock

public long getRootBlock()

setRootBlock

public void setRootBlock(long aRootBlock)

getJournalBlock

public long getJournalBlock()

setJournalBlock

public void setJournalBlock(long aJournalBlock)

getJournalDev

public long getJournalDev()

setJournalDev

public void setJournalDev(long aJournalDev)

getOrigJournalSize

public long getOrigJournalSize()

setOrigJournalSize

public void setOrigJournalSize(long aOrigJournalSize)

getJournalTransMax

public long getJournalTransMax()

setJournalTransMax

public void setJournalTransMax(long aJournalTransMax)

getJournalBlockCount

public long getJournalBlockCount()

setJournalBlockCount

public void setJournalBlockCount(long aJournalBlockCount)

getJournalMaxBatch

public long getJournalMaxBatch()

setJournalMaxBatch

public void setJournalMaxBatch(long aJournalMaxBatch)

getJournalCommitAge

public long getJournalCommitAge()

setJournalCommitAge

public void setJournalCommitAge(long aJournalCommitAge)

getJournalTransAge

public long getJournalTransAge()

setJournalTransAge

public void setJournalTransAge(long aJournalTransAge)

getBlockSize

public int getBlockSize()

setBlockSize

public void setBlockSize(int aBlockSize)

getOldMaxSize

public int getOldMaxSize()

setOldMaxSize

public void setOldMaxSize(int aOldMaxSize)

getCurrSize

public int getCurrSize()

setCurrSize

public void setCurrSize(int aCurrSize)

getState

public int getState()

setState

public void setState(int aState)

getMagic

public byte[] getMagic()

setMagic

public void setMagic(byte[] aMagic)

getHashFunc

public long getHashFunc()

setHashFunc

public void setHashFunc(long aHashFunc)

getTreeHeight

public int getTreeHeight()

setTreeHeight

public void setTreeHeight(int aTreeHeight)

getBitmapBlocks

public int getBitmapBlocks()

setBitmapBlocks

public void setBitmapBlocks(int aBitmapBlocks)

getVersion

public int getVersion()

setVersion

public void setVersion(int aVersion)

getReserved

public int getReserved()

setReserved

public void setReserved(int aReserved)

getInodeGen

public long getInodeGen()

setInodeGen

public void setInodeGen(long aInodeGen)

getFlags

public long getFlags()

setFlags

public void setFlags(long aFlags)

getUniqueID

public byte[] getUniqueID()

setUniqueID

public void setUniqueID(byte[] aUniqueID)

getLabel

public byte[] getLabel()

setLabel

public void setLabel(byte[] aLabel)

loadFromBuffer

public void loadFromBuffer(byte[] buffer,
                           int offset)
                    throws FsException
Load from a buffer containint the superblock. We assume that the superblock begins at the specified offset within the 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.