Class: Mount::FS

Inherits:
Object
  • Object
show all
Defined in:
lib/rbmount/fs.rb

Instance Method Summary collapse

Constructor Details

#initialize(ptr = nil) ⇒ FS

Returns a new instance of FS.



24
25
26
27
28
29
30
# File 'lib/rbmount/fs.rb', line 24

def initialize (ptr=nil)
  @pointer= ptr
  @pointer = Mount::C.mnt_new_fs unless @pointer
  raise if @pointer.null?

  ObjectSpace.define_finalizer(self, method(:finalize))
end

Instance Method Details

#append_attributes(optstr) ⇒ Object



32
33
34
# File 'lib/rbmount/fs.rb', line 32

def append_attributes (optstr)
  Mount::C.mnt_fs_append_attributes(@pointer, optstr)
end

#append_options(optstr) ⇒ Object



36
37
38
# File 'lib/rbmount/fs.rb', line 36

def append_options (optstr)
  Mount::C.mnt_fs_append_options(@pointer, optstr)
end

#attribute(key) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/rbmount/fs.rb', line 40

def attribute (key)
  ptr = FFI::MemoryPointer.new(:pointer).write_pointer(FFI::MemoryPointer.new(:string))
  plen = FFI::MemoryPointer.new(:ulong)

  raise unless Mount::C.mnt_fs_get_attribute(@pointer, key, ptr, plen)
  ptr.read_pointer.read_string[0, plen.read_ulong]
end

#attributesObject



48
49
50
# File 'lib/rbmount/fs.rb', line 48

def attributes
  Mount::C.mnt_fs_get_attributes(@pointer)
end

#attributes=(optstr) ⇒ Object



164
165
166
# File 'lib/rbmount/fs.rb', line 164

def attributes= (optstr)
  Mount::C.mnt_fs_set_attributes(@pointer, optstr)
end

#bindsrcObject



52
53
54
# File 'lib/rbmount/fs.rb', line 52

def bindsrc
  Mount::C.mnt_fs_get_bindsrc(@pointer)
end

#bindsrc=(src) ⇒ Object



168
169
170
# File 'lib/rbmount/fs.rb', line 168

def bindsrc= (src)
  Mount::C.mnt_fs_set_bindsrc(@pointer, src)
end

#devnoObject



56
57
58
# File 'lib/rbmount/fs.rb', line 56

def devno
  Mount::C.mnt_fs_get_devno(@pointer)
end

#dupObject



224
225
226
227
228
# File 'lib/rbmount/fs.rb', line 224

def dup
  Mount::FS.new.tap {|d|
    Mount::C.mnt_copy_fs(d.to_c, self.to_c)
  }
end

#finalizeObject



220
221
222
# File 'lib/rbmount/fs.rb', line 220

def finalize
  Mount::C.mnt_free_fs(@pointer)
end

#freqObject



60
61
62
# File 'lib/rbmount/fs.rb', line 60

def freq
  Mount::C.mnt_fs_get_freq(@pointer)
end

#freq=(f) ⇒ Object



172
173
174
# File 'lib/rbmount/fs.rb', line 172

def freq= (f)
  Mount::C.mnt_fs_set_freq(@pointer, f)
end

#fs_optionsObject



64
65
66
# File 'lib/rbmount/fs.rb', line 64

def fs_options
  Mount::C.mnt_fs_get_fs_options(@pointer)
end

#fstypeObject



68
69
70
# File 'lib/rbmount/fs.rb', line 68

def fstype
  Mount::C.mnt_fs_get_fstype(@pointer)
end

#fstype=(type) ⇒ Object



176
177
178
# File 'lib/rbmount/fs.rb', line 176

def fstype= (type)
  Mount::C.mnt_fs_set_fstype(@pointer, type)
end

#idObject



72
73
74
# File 'lib/rbmount/fs.rb', line 72

def id
  Mount::C.mnt_fs_get_id(@pointer)
end

#kernel?Boolean

Returns:

  • (Boolean)


132
133
134
# File 'lib/rbmount/fs.rb', line 132

def kernel?
  Mount::C.mnt_fs_is_kernel(@pointer)
end

#match_fstype(types) ⇒ Object



136
137
138
# File 'lib/rbmount/fs.rb', line 136

def match_fstype (types)
  Mount::C.mnt_fs_match_fstype(@pointer, types)
end

#match_options(options) ⇒ Object



140
141
142
# File 'lib/rbmount/fs.rb', line 140

def match_options (options)
  Mount::C.mnt_fs_match_options(@pointer, options)
end

#match_source(source = nil, cache = nil) ⇒ Object



144
145
146
# File 'lib/rbmount/fs.rb', line 144

def match_source (source=nil, cache=nil)
  Mount::C.mnt_fs_match_source(@pointer, source, (cache ? cache.to_c : cache))
end

#match_target(source = nil, cache = nil) ⇒ Object



148
149
150
# File 'lib/rbmount/fs.rb', line 148

def match_target (source=nil, cache=nil)
  Mount::C.mnt_fs_match_target(@pointer, source, (cache ? cache.to_c : cache))
end

#option(key) ⇒ Object



76
77
78
79
80
81
82
# File 'lib/rbmount/fs.rb', line 76

def option (key)
  ptr = FFI::MemoryPointer.new(:pointer).write_pointer(FFI::MemoryPointer.new(:string))
  plen = FFI::MemoryPointer.new(:ulong)

  raise unless Mount::C.mnt_fs_get_option(@pointer, key, ptr, plen)
  ptr.read_pointer.read_string[0, plen.read_ulong]
end

#optionsObject



84
85
86
# File 'lib/rbmount/fs.rb', line 84

def options
  Mount::C.mnt_fs_get_options(@pointer)
end

#options=(optstr) ⇒ Object



180
181
182
# File 'lib/rbmount/fs.rb', line 180

def options= (optstr)
  Mount::C.mnt_fs_set_options(@pointer, optstr)
end

#options_dupObject



204
205
206
# File 'lib/rbmount/fs.rb', line 204

def options_dup
  Mount::C.mnt_fs_strdup_options(@pointer)
end

#parent_idObject



88
89
90
# File 'lib/rbmount/fs.rb', line 88

def parent_id
  Mount::C.mnt_fs_get_parent_id(@pointer)
end

#passnoObject



92
93
94
# File 'lib/rbmount/fs.rb', line 92

def passno
  Mount::C.mnt_fs_get_passno(@pointer)
end

#passno=(passn) ⇒ Object



184
185
186
# File 'lib/rbmount/fs.rb', line 184

def passno= (passn)
  Mount::C.mnt_fs_set_passno(@pointer, passn)
end

#prepend_attributes(optstr) ⇒ Object



152
153
154
# File 'lib/rbmount/fs.rb', line 152

def prepend_attributes (optstr)
  Mount::C.mnt_fs_prepend_attributes(@pointer, optstr)
end

#prepend_options(optstr) ⇒ Object



156
157
158
# File 'lib/rbmount/fs.rb', line 156

def prepend_options (optstr)
  Mount::C.mnt_fs_prepend_options(@pointer, optstr)
end


160
161
162
# File 'lib/rbmount/fs.rb', line 160

def print_debug (io)
  Mount::C.mnt_fs_print_debug(@pointer, io)
end

#reset!Object



216
217
218
# File 'lib/rbmount/fs.rb', line 216

def reset!
  Mount::C.mnt_reset_fs(@pointer)
end

#rootObject



96
97
98
# File 'lib/rbmount/fs.rb', line 96

def root
  Mount::C.mnt_fs_get_root(@pointer)
end

#root=(path) ⇒ Object



188
189
190
# File 'lib/rbmount/fs.rb', line 188

def root= (path)
  Mount::C.mnt_fs_set_root(@pointer, path)
end

#sourceObject



100
101
102
# File 'lib/rbmount/fs.rb', line 100

def source
  Mount::C.mnt_fs_get_source(@pointer)
end

#source=(src) ⇒ Object



192
193
194
# File 'lib/rbmount/fs.rb', line 192

def source= (src)
  Mount::C.mnt_fs_set_source(@pointer, src)
end

#srcpathObject



104
105
106
# File 'lib/rbmount/fs.rb', line 104

def srcpath
  Mount::C.mnt_fs_get_srcpath(@pointer)
end

#tagObject



108
109
110
111
112
113
114
# File 'lib/rbmount/fs.rb', line 108

def tag
  name = FFI::MemoryPointer.new(:pointer).write_pointer(FFI::MemoryPointer.new(:string))
  value = FFI::MemoryPointer.new(:pointer).write_pointer(FFI::MemoryPointer.new(:string))

  raise unless Mount::C.mnt_fs_get_tag(@pointer, name, value)
  [name.read_pointer.read_string, value.read_pointer.read_string]
end

#targetObject



116
117
118
# File 'lib/rbmount/fs.rb', line 116

def target
  Mount::C.mnt_fs_get_target(@pointer)
end

#target=(targ) ⇒ Object



196
197
198
# File 'lib/rbmount/fs.rb', line 196

def target= (targ)
  Mount::C.mnt_fs_set_target(@pointer, targ)
end

#to_cObject



230
231
232
# File 'lib/rbmount/fs.rb', line 230

def to_c
  @pointer
end

#to_mntentObject



208
209
210
211
212
213
214
# File 'lib/rbmount/fs.rb', line 208

def to_mntent
  ptr = FFI::MemoryPointer.new(:pointer).write_pointer(FFI::MemoryPointer.new(:pointer))

  raise unless Mount::C.mnt_fs_to_mntent(@pointer, ptr)

  Mount::C::MntEnt.new(ptr.read_pointer)
end

#user_optionsObject



124
125
126
# File 'lib/rbmount/fs.rb', line 124

def user_options
  Mount::C.mnt_fs_get_user_options(@pointer)
end

#userdataObject



120
121
122
# File 'lib/rbmount/fs.rb', line 120

def userdata
  Mount::C.mnt_fs_get_userdata(@pointer)
end

#userdata=(data) ⇒ Object



200
201
202
# File 'lib/rbmount/fs.rb', line 200

def userdata= (data)
  Mount::C.mnt_fs_set_userdata(@pointer, data)
end

#vfs_optionsObject



128
129
130
# File 'lib/rbmount/fs.rb', line 128

def vfs_options
  Mount::C.mnt_fs_get_vfs_options(@pointer)
end