Class: XFS::AllocationGroup
- Inherits:
-
Object
- Object
- XFS::AllocationGroup
- Defined in:
- lib/fs/xfs/allocation_group.rb
Overview
//////////////////////////////////////////////////////////////////////////// // Class.
Constant Summary collapse
- AG_FREESPACE_SIZE =
512
- AG_INODEINFO_SIZE =
512
- AG_FREELIST_SIZE =
512
- XFS_AGF_MAGIC =
0x58414746
- XFS_AGI_MAGIC =
0x58414749
- XFS_AGFL_MAGIC =
0x5841464c
Instance Attribute Summary collapse
-
#agf ⇒ Object
readonly
///////////////////////////////////////////////////////////////////////// // initialize.
-
#agfl ⇒ Object
readonly
///////////////////////////////////////////////////////////////////////// // initialize.
-
#agi ⇒ Object
readonly
///////////////////////////////////////////////////////////////////////// // initialize.
-
#allocation_group_block ⇒ Object
readonly
///////////////////////////////////////////////////////////////////////// // initialize.
-
#stream ⇒ Object
readonly
///////////////////////////////////////////////////////////////////////// // initialize.
Instance Method Summary collapse
-
#dump ⇒ Object
Dump object.
-
#initialize(stream, _agno, sb) ⇒ AllocationGroup
constructor
A new instance of AllocationGroup.
Constructor Details
#initialize(stream, _agno, sb) ⇒ AllocationGroup
Returns a new instance of AllocationGroup.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/fs/xfs/allocation_group.rb', line 105 def initialize(stream, _agno, sb) raise "XFS::AllocationGroup.initialize: Nil stream" if stream.nil? # # The stream should be pointing at the Allocation Group to be built on the disk. # @stream = stream @agf = AG_FREESPACE.decode(@stream.read(AG_FREESPACE_SIZE)) @stream.seek(AG_FREESPACE_SIZE, IO::SEEK_CUR) @agi = AG_INODEINFO.decode(@stream.read(AG_INODEINFO_SIZE)) @stream.seek(AG_INODEINFO_SIZE, IO::SEEK_CUR) @agfl = AG_FREELIST.decode(@stream.read(AG_FREELIST_SIZE)) @stream.seek(-(AG_FREESPACE_SIZE + AG_INODEINFO_SIZE + AG_FREELIST_SIZE)) @allocation_group_block = @stream.read(sb['block_size']) # Grab some quick facts & make sure there's nothing wrong. Tight qualification. if @agf['magic_num'] != XFS_AGF_MAGIC raise "XFS::AllocationGroup.initialize: Invalid AGF magic number=[#{@agf['magic_num']}]" elsif @agi['magic_num'] != XFS_AGI_MAGIC raise "XFS::AllocationGroup.initialize: Invalid AGI magic number=[#{@agi['magic_num']}]" elsif @agfl['magic_num'] != XFS_AGFL_MAGIC raise "XFS::AllocationGroup.initialize: Invalid AGFL magic number=[#{@agfl['magic_num']}]" end end |
Instance Attribute Details
#agf ⇒ Object (readonly)
///////////////////////////////////////////////////////////////////////// // initialize
103 104 105 |
# File 'lib/fs/xfs/allocation_group.rb', line 103 def agf @agf end |
#agfl ⇒ Object (readonly)
///////////////////////////////////////////////////////////////////////// // initialize
103 104 105 |
# File 'lib/fs/xfs/allocation_group.rb', line 103 def agfl @agfl end |
#agi ⇒ Object (readonly)
///////////////////////////////////////////////////////////////////////// // initialize
103 104 105 |
# File 'lib/fs/xfs/allocation_group.rb', line 103 def agi @agi end |
#allocation_group_block ⇒ Object (readonly)
///////////////////////////////////////////////////////////////////////// // initialize
103 104 105 |
# File 'lib/fs/xfs/allocation_group.rb', line 103 def allocation_group_block @allocation_group_block end |
#stream ⇒ Object (readonly)
///////////////////////////////////////////////////////////////////////// // initialize
103 104 105 |
# File 'lib/fs/xfs/allocation_group.rb', line 103 def stream @stream end |
Instance Method Details
#dump ⇒ Object
Dump object.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/fs/xfs/allocation_group.rb', line 134 def dump out = "\#<#{self.class}:0x#{format('%08x', object_id)}>\n" out << "AGI Magic number : #{@agf['magic_num']}\n" out << "Version number : #{@agf['version_num']})\n" out << "Sequence Number : #{@agf['seq_no']}\n" out << "Length : #{@agf['length']}\n" out << "Root Blocks : #{@agf['root_blocks']}\n" out << "Btree Levels : #{@agf['btree_levels']}\n" out << "1st Freelist Blk Index : #{@agf['fl_first']}\n" out << "Last Freelist Blk Index : #{@agf['fl_last']}\n" out << "# Blocks in Freelist : #{@agf['fl_count']}\n" out << "# of Free Blocks : #{@agf['free_blocks']}\n" out << "Longest Free Space : #{@agf['longest']}\n" out << "# Blks in AG Free Btree : #{@agf['btree_blocks']}\n" out << "Filesystem UUID : #{@agf['uuid']}\n" out << "Allocated Inodes : #{@agi['count']}\n" out << "Root of Inode BTree : #{@agi['root']}\n" out << "Levels in Inode BTree : #{@agi['level']}\n" out << "Number of Free Inodes : #{@agi['free_count']}\n" out << "Newest Inode Allocated : #{@agi['new_inode']}\n" out << "Last Dir Inode Chunk : #{@agi['dir_inode']}\n" out << "Root of Free Ino Btree : #{@agi['free_root']}\n" out << "Levels in Free Ino Btree : #{@agi['free_level']}\n" out end |