Class: VirtFS::NativeFS::Thin::File

Inherits:
Object
  • Object
show all
Defined in:
lib/virtfs/nativefs/thin/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fs, instance_handle, parsed_args) ⇒ File

Returns a new instance of File.



6
7
8
9
10
11
# File 'lib/virtfs/nativefs/thin/file.rb', line 6

def initialize(fs, instance_handle, parsed_args)
  @fs          = fs
  @file_obj    = instance_handle
  @parsed_args = parsed_args
  @block_size  = 512
end

Instance Attribute Details

#block_sizeObject (readonly)

Returns the value of attribute block_size.



4
5
6
# File 'lib/virtfs/nativefs/thin/file.rb', line 4

def block_size
  @block_size
end

#file_objObject (readonly)

Returns the value of attribute file_obj.



4
5
6
# File 'lib/virtfs/nativefs/thin/file.rb', line 4

def file_obj
  @file_obj
end

#fsObject (readonly)

Returns the value of attribute fs.



4
5
6
# File 'lib/virtfs/nativefs/thin/file.rb', line 4

def fs
  @fs
end

Instance Method Details

#atimeObject



13
14
15
# File 'lib/virtfs/nativefs/thin/file.rb', line 13

def atime
  @file_obj.atime
end

#chmod(permission) ⇒ Object



17
18
19
# File 'lib/virtfs/nativefs/thin/file.rb', line 17

def chmod(permission)
  @file_obj.chmod(permission)
end

#chown(owner, group) ⇒ Object



21
22
23
# File 'lib/virtfs/nativefs/thin/file.rb', line 21

def chown(owner, group)
  @file_obj.chown(owner, group)
end

#closeObject



25
26
27
# File 'lib/virtfs/nativefs/thin/file.rb', line 25

def close
  @file_obj.close unless @file_obj.closed?
end

#close_on_exec=(bool) ⇒ Object



33
34
35
# File 'lib/virtfs/nativefs/thin/file.rb', line 33

def close_on_exec=(bool)
  @file_obj.close_on_exec = bool
end

#close_on_exec?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/virtfs/nativefs/thin/file.rb', line 29

def close_on_exec?
  @file_obj.close_on_exec?
end

#close_readObject



37
38
39
# File 'lib/virtfs/nativefs/thin/file.rb', line 37

def close_read
  @file_obj.close_read
end

#close_writeObject



41
42
43
# File 'lib/virtfs/nativefs/thin/file.rb', line 41

def close_write
  @file_obj.close_write
end

#ctimeObject



45
46
47
# File 'lib/virtfs/nativefs/thin/file.rb', line 45

def ctime
  @file_obj.ctime
end

#fcntl(cmd, arg) ⇒ Object



49
50
51
# File 'lib/virtfs/nativefs/thin/file.rb', line 49

def fcntl(cmd, arg)
  @file_obj.fcntl(cmd, arg)
end

#fdatasyncObject



53
54
55
# File 'lib/virtfs/nativefs/thin/file.rb', line 53

def fdatasync
  @file_obj.fdatasync
end

#filenoObject



61
62
63
# File 'lib/virtfs/nativefs/thin/file.rb', line 61

def fileno
  @file_obj.fileno
end

#flock(locking_constant) ⇒ Object



65
66
67
# File 'lib/virtfs/nativefs/thin/file.rb', line 65

def flock(locking_constant)
  @file_obj.flock(locking_constant)
end

#flushObject



57
58
59
# File 'lib/virtfs/nativefs/thin/file.rb', line 57

def flush
  @file_obj.flush
end

#fsyncObject



69
70
71
# File 'lib/virtfs/nativefs/thin/file.rb', line 69

def fsync
  @file_obj.fsync
end

#isattyObject



73
74
75
# File 'lib/virtfs/nativefs/thin/file.rb', line 73

def isatty
  @file_obj.isatty
end

#lstatObject



77
78
79
# File 'lib/virtfs/nativefs/thin/file.rb', line 77

def lstat
  @file_obj.lstat
end

#mtimeObject



81
82
83
# File 'lib/virtfs/nativefs/thin/file.rb', line 81

def mtime
  @file_obj.mtime
end

#pidObject



85
86
87
# File 'lib/virtfs/nativefs/thin/file.rb', line 85

def pid
  @file_obj.pid
end

#raw_read(start_byte, num_bytes) ⇒ Object



89
90
91
92
# File 'lib/virtfs/nativefs/thin/file.rb', line 89

def raw_read(start_byte, num_bytes)
  @file_obj.sysseek(start_byte, IO::SEEK_SET)
  @file_obj.sysread(num_bytes)
end

#raw_write(start_byte, buf) ⇒ Object



94
95
96
97
# File 'lib/virtfs/nativefs/thin/file.rb', line 94

def raw_write(start_byte, buf)
  @file_obj.sysseek(start_byte, IO::SEEK_SET)
  @file_obj.syswrite(buf)
end

#sizeObject



99
100
101
# File 'lib/virtfs/nativefs/thin/file.rb', line 99

def size
  @file_obj.size
end

#statObject



103
104
105
# File 'lib/virtfs/nativefs/thin/file.rb', line 103

def stat
  @file_obj.stat
end

#truncate(len) ⇒ Object



107
108
109
# File 'lib/virtfs/nativefs/thin/file.rb', line 107

def truncate(len)
  @file_obj.truncate(len)
end