Class: XFS::FileObject

Inherits:
Object
  • Object
show all
Includes:
XFS
Defined in:
lib/fs/MiqFS/modules/XFS.rb

Overview

Top level file object.

Constant Summary

Constants included from XFS

AG_FL_STRUCT_SIZE, AG_FREELIST, AG_FREESPACE, AG_INODEINFO, BMAP_BTREE_REC, BMAP_BTREE_ROOT_NODE_BLOCK, BMAP_BTREE_ROOT_NODE_ENTRIES, BMAP_BTREE_ROOT_NODE_HEADER, BMAP_BTREE_ROOT_NODE_OFFSET, BTREE_BLOCK_LONG, BTREE_BLOCK_LONG_NOCRC, BTREE_BLOCK_SHORT, BTREE_BLOCK_SHORT_NOCRC, DEF_CACHE_SIZE, DIRECTORY2_DATA_ENTRY, DIRECTORY2_DATA_HEADER, DIRECTORY2_DATA_TAG, DIRECTORY2_UNUSED_ENTRY, DIRECTORY3_DATA_HEADER, DIRECTORY3_DATA_PAD, DIRECTORY_BLOCK_TAIL, DIRECTORY_DATA_FREE, DIRECTORY_LEAF_ENTRY, DIRECTORY_SHORTERFORM_HEADER, DIRECTORY_SHORTFORM_HEADER, EXTENDED_INODE, INODE, SHORT_FORM_DIRECTORY_ENTRY, SHORT_FORM_LONG_INO, SHORT_FORM_SHORT_INO, SIZEOF_BMAP_BTREE_REC, SIZEOF_BMAP_BTREE_ROOT_NODE_BLOCK, SIZEOF_BMAP_BTREE_ROOT_NODE_ENTRIES, SIZEOF_BMAP_BTREE_ROOT_NODE_HEADER, SIZEOF_BMAP_BTREE_ROOT_NODE_OFFSET, SIZEOF_BTREE_BLOCK_LONG, SIZEOF_BTREE_BLOCK_LONG_NOCRC, SIZEOF_BTREE_BLOCK_SHORT, SIZEOF_BTREE_BLOCK_SHORT_NOCRC, SIZEOF_DIRECTORY2_DATA_ENTRY, SIZEOF_DIRECTORY2_DATA_HEADER, SIZEOF_DIRECTORY2_DATA_TAG, SIZEOF_DIRECTORY2_UNUSED_ENTRY, SIZEOF_DIRECTORY3_DATA_HEADER, SIZEOF_DIRECTORY3_DATA_PAD, SIZEOF_DIRECTORY_BLOCK_TAIL, SIZEOF_DIRECTORY_DATA_FREE, SIZEOF_DIRECTORY_LEAF_ENTRY, SIZEOF_DIRECTORY_SHORTERFORM_HEADER, SIZEOF_DIRECTORY_SHORTFORM_HEADER, SIZEOF_EXTENDED_INODE, SIZEOF_INODE, SIZEOF_SHORT_FORM_DIRECTORY_ENTRY, SIZEOF_SHORT_FORM_LONG_INO, SIZEOF_SHORT_FORM_SHORT_INO, SUPERBLOCK, SUPERBLOCK_SIZE, TIMESTAMP

Instance Attribute Summary collapse

Attributes included from XFS

#cache_hits, #dir_cache, #entry_cache, #rootDir, #superblock

Instance Method Summary collapse

Methods included from XFS

#fs_dirEntries, #fs_dirMkdir, #fs_dirRmdir, #fs_fileAtime, #fs_fileAtime_obj, #fs_fileClose, #fs_fileCtime, #fs_fileCtime_obj, #fs_fileDelete, #fs_fileDirectory?, #fs_fileExists?, #fs_fileFile?, #fs_fileMtime, #fs_fileMtime_obj, #fs_fileOpen, #fs_fileRead, #fs_fileSeek, #fs_fileSize, #fs_fileSize_obj, #fs_fileWrite, #fs_freeBytes, #fs_init, #fs_isSymLink?, #ifs_getDir, #ifs_getDirR, #ifs_getFile, #ifs_putFile, #unnormalizePath

Constructor Details

#initialize(path, miqfs) ⇒ FileObject

fs_fileOpen passes ‘self’ into .. er, ‘this’.



22
23
24
25
# File 'lib/fs/MiqFS/modules/XFS.rb', line 22

def initialize(path, miqfs)
  @path = path
  @miqfs = miqfs
end

Instance Attribute Details

#deObject (readonly)

Returns the value of attribute de.



18
19
20
# File 'lib/fs/MiqFS/modules/XFS.rb', line 18

def de
  @de
end

#inodeObject (readonly)

Returns the value of attribute inode.



18
19
20
# File 'lib/fs/MiqFS/modules/XFS.rb', line 18

def inode
  @inode
end

#miqfsObject (readonly)

Returns the value of attribute miqfs.



18
19
20
# File 'lib/fs/MiqFS/modules/XFS.rb', line 18

def miqfs
  @miqfs
end

#pathObject (readonly)

Returns the value of attribute path.



18
19
20
# File 'lib/fs/MiqFS/modules/XFS.rb', line 18

def path
  @path
end

Instance Method Details

#open(mode = "r") ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fs/MiqFS/modules/XFS.rb', line 27

def open(mode = "r")
  # XFS module methods use miqfs instance accessors to touch @boot_sector.
  @mode = mode.downcase
  @de = ifs_getFile(@path, @miqfs)
  raise "File is directory: '#{@path}'" if  @de && @de.directory?

  if mode.include?("r")
    raise "File not found: '#{@path}'" if @de.nil?
    @inode = @miqfs.superblock.get_inode(@de.inode)
  end
end