Class: FFI::StatVfs
- Inherits:
-
Struct
- Object
- Struct
- FFI::StatVfs
- Extended by:
- Library
- Includes:
- Accessors
- Defined in:
- lib/ffi/stat_vfs.rb
Overview
Represents Statvfs for use with Libfuse::FuseOperations#statfs callback
Instance Attribute Summary collapse
-
#bavail ⇒ Integer
Number of free blocks for unprivileged users.
-
#bfree ⇒ Integer
Number of free blocks.
-
#blocks ⇒ Integer
Size of fs in frsize units.
-
#bsize ⇒ Integer
Filesystem block size.
-
#favail ⇒ Integer
Number of free inodes for unprivileged users.
-
#ffree ⇒ Integer
Number of free inodes.
-
#files ⇒ Integer
Number of inodes.
-
#flag ⇒ Integer
Mount flags.
-
#frsize ⇒ Integer
Fragment size.
-
#fsid ⇒ Integer
Filesystem ID.
-
#namemax ⇒ Integer
Maximum filename length.
Class Method Summary collapse
Instance Method Summary collapse
-
#from(file) ⇒ self
File from native LIBC calls for file.
-
#fstatvfs(fileno) ⇒ self
Fill from native fstatvfs for fileno.
-
#statvfs(path) ⇒ self
Fill from native statvfs for path.
Methods included from Accessors
#ffi_attr_fill, #ffi_attr_reader_member, #ffi_attr_writer_member, #fill, #inspect, #to_h
Methods included from Accessors::ClassMethods
#attr_accessor, #attr_reader, #attr_writer, #ffi_attr_accessor, #ffi_attr_reader, #ffi_attr_reader_method, #ffi_attr_readers, #ffi_attr_writer, #ffi_attr_writer_method, #ffi_attr_writers, #ffi_bitflag_accessor, #ffi_bitflag_reader, #ffi_bitflag_writer, #ffi_public_attr_readers, #ffi_public_attr_writers
Instance Attribute Details
#bavail ⇒ Integer
Returns Number of free blocks for unprivileged users.
|
# File 'lib/ffi/stat_vfs.rb', line 57
|
#bfree ⇒ Integer
Returns Number of free blocks.
|
# File 'lib/ffi/stat_vfs.rb', line 54
|
#blocks ⇒ Integer
Returns Size of fs in frsize units.
|
# File 'lib/ffi/stat_vfs.rb', line 51
|
#bsize ⇒ Integer
Returns Filesystem block size.
|
# File 'lib/ffi/stat_vfs.rb', line 45
|
#favail ⇒ Integer
Returns Number of free inodes for unprivileged users.
|
# File 'lib/ffi/stat_vfs.rb', line 66
|
#ffree ⇒ Integer
Returns Number of free inodes.
|
# File 'lib/ffi/stat_vfs.rb', line 63
|
#files ⇒ Integer
Returns Number of inodes.
|
# File 'lib/ffi/stat_vfs.rb', line 60
|
#flag ⇒ Integer
Returns Mount flags.
|
# File 'lib/ffi/stat_vfs.rb', line 72
|
#frsize ⇒ Integer
Returns Fragment size.
|
# File 'lib/ffi/stat_vfs.rb', line 48
|
#fsid ⇒ Integer
Returns Filesystem ID.
|
# File 'lib/ffi/stat_vfs.rb', line 69
|
#namemax ⇒ Integer
Returns Maximum filename length.
78 |
# File 'lib/ffi/stat_vfs.rb', line 78 ffi_attr_accessor(**members.grep(/^f_/).to_h { |m| [m[2..].to_sym, m] }) |
Class Method Details
.fstatvfs(file) ⇒ StatVfs
130 |
# File 'lib/ffi/stat_vfs.rb', line 130 %i[from statvfs fstatvfs].each { |m| define_method(m) { |file, stat = new, **args| stat.send(m, file, **args) } } |
Instance Method Details
#from(file) ⇒ self
File from native LIBC calls for file
109 110 111 112 113 |
# File 'lib/ffi/stat_vfs.rb', line 109 def from(file) return fstatvfs(file) if file.is_a?(Integer) statvfs(file) end |
#fstatvfs(fileno) ⇒ self
Fill from native fstatvfs for fileno
99 100 101 102 103 104 |
# File 'lib/ffi/stat_vfs.rb', line 99 def fstatvfs(fileno) res = self.class.native_fstatvfs(fileno, self) raise SystemCallError.new('', FFI::LastError.errno) unless res.zero? self end |
#statvfs(path) ⇒ self
Fill from native statvfs for path
89 90 91 92 93 94 |
# File 'lib/ffi/stat_vfs.rb', line 89 def statvfs(path) res = self.class.native_statvfs(path.to_s, self) raise SystemCallError.new('', FFI::LastError.errno) unless res.zero? self end |