Class: CzSystemInfo::Filesystem::Stat
- Inherits:
-
Object
- Object
- CzSystemInfo::Filesystem::Stat
- Defined in:
- lib/cz_system_info/filesystem.rb
Overview
Stat objects are returned by the CzSystemInfo::Filesystem.stat method.
Constant Summary collapse
- RDONLY =
Read-only filesystem
1- NOSUID =
Filesystem does not support suid or sgid semantics.
2- NOTRUNC =
Filesystem does not truncate file names longer than
name_max. 3
Instance Attribute Summary collapse
-
#base_type ⇒ Object
The filesystem type, e.g.
-
#block_size ⇒ Object
The preferred system block size.
-
#blocks ⇒ Object
The total number of
fragment_sizeblocks in the filesystem. -
#blocks_available ⇒ Object
The number of free blocks available to unprivileged processes.
-
#blocks_free ⇒ Object
The total number of free blocks in the filesystem.
-
#files ⇒ Object
(also: #inodes)
The total number of files/inodes that can be created.
-
#files_available ⇒ Object
(also: #inodes_available)
The number of free files/inodes available to unprivileged processes.
-
#files_free ⇒ Object
(also: #inodes_free)
The total number of files/inodes on the filesystem.
-
#filesystem_id ⇒ Object
The filesystem identifier.
-
#flags ⇒ Object
A bit mask of flags.
-
#fragment_size ⇒ Object
The fragment size, i.e.
-
#name_max ⇒ Object
The maximum length of a file name permitted on the filesystem.
-
#path ⇒ Object
The path of the filesystem.
Instance Method Summary collapse
-
#bytes_available ⇒ Object
Returns the amount of free space available to unprivileged processes.
-
#bytes_free ⇒ Object
Returns the total amount of free space on the partition.
-
#bytes_total ⇒ Object
Returns the total space on the partition.
-
#bytes_used ⇒ Object
Returns the total amount of used space on the partition.
-
#initialize ⇒ Stat
constructor
Creates a new CzSystemInfo::Filesystem::Stat object.
-
#percent_used ⇒ Object
Returns the percentage of the partition that has been used.
Constructor Details
#initialize ⇒ Stat
Creates a new CzSystemInfo::Filesystem::Stat object. This is meant for internal use only. Do not instantiate directly.
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/cz_system_info/filesystem.rb', line 115 def initialize @path = nil @block_size = nil @fragment_size = nil @blocks = nil @blocks_free = nil @blocks_available = nil @files = nil @files_free = nil @files_available = nil @filesystem_id = nil @flags = nil @name_max = nil @base_type = nil end |
Instance Attribute Details
#base_type ⇒ Object
The filesystem type, e.g. UFS.
106 107 108 |
# File 'lib/cz_system_info/filesystem.rb', line 106 def base_type @base_type end |
#block_size ⇒ Object
The preferred system block size.
73 74 75 |
# File 'lib/cz_system_info/filesystem.rb', line 73 def block_size @block_size end |
#blocks ⇒ Object
The total number of fragment_size blocks in the filesystem.
79 80 81 |
# File 'lib/cz_system_info/filesystem.rb', line 79 def blocks @blocks end |
#blocks_available ⇒ Object
The number of free blocks available to unprivileged processes.
85 86 87 |
# File 'lib/cz_system_info/filesystem.rb', line 85 def blocks_available @blocks_available end |
#blocks_free ⇒ Object
The total number of free blocks in the filesystem.
82 83 84 |
# File 'lib/cz_system_info/filesystem.rb', line 82 def blocks_free @blocks_free end |
#files ⇒ Object Also known as: inodes
The total number of files/inodes that can be created.
88 89 90 |
# File 'lib/cz_system_info/filesystem.rb', line 88 def files @files end |
#files_available ⇒ Object Also known as: inodes_available
The number of free files/inodes available to unprivileged processes.
94 95 96 |
# File 'lib/cz_system_info/filesystem.rb', line 94 def files_available @files_available end |
#files_free ⇒ Object Also known as: inodes_free
The total number of files/inodes on the filesystem.
91 92 93 |
# File 'lib/cz_system_info/filesystem.rb', line 91 def files_free @files_free end |
#filesystem_id ⇒ Object
The filesystem identifier.
97 98 99 |
# File 'lib/cz_system_info/filesystem.rb', line 97 def filesystem_id @filesystem_id end |
#flags ⇒ Object
A bit mask of flags.
100 101 102 |
# File 'lib/cz_system_info/filesystem.rb', line 100 def flags @flags end |
#fragment_size ⇒ Object
The fragment size, i.e. fundamental filesystem block size.
76 77 78 |
# File 'lib/cz_system_info/filesystem.rb', line 76 def fragment_size @fragment_size end |
#name_max ⇒ Object
The maximum length of a file name permitted on the filesystem.
103 104 105 |
# File 'lib/cz_system_info/filesystem.rb', line 103 def name_max @name_max end |
#path ⇒ Object
The path of the filesystem.
70 71 72 |
# File 'lib/cz_system_info/filesystem.rb', line 70 def path @path end |
Instance Method Details
#bytes_available ⇒ Object
Returns the amount of free space available to unprivileged processes.
142 143 144 |
# File 'lib/cz_system_info/filesystem.rb', line 142 def bytes_available blocks_available * fragment_size end |
#bytes_free ⇒ Object
Returns the total amount of free space on the partition.
137 138 139 |
# File 'lib/cz_system_info/filesystem.rb', line 137 def bytes_free blocks_free * fragment_size end |
#bytes_total ⇒ Object
Returns the total space on the partition.
132 133 134 |
# File 'lib/cz_system_info/filesystem.rb', line 132 def bytes_total blocks * fragment_size end |
#bytes_used ⇒ Object
Returns the total amount of used space on the partition.
147 148 149 |
# File 'lib/cz_system_info/filesystem.rb', line 147 def bytes_used bytes_total - bytes_free end |
#percent_used ⇒ Object
Returns the percentage of the partition that has been used.
152 153 154 |
# File 'lib/cz_system_info/filesystem.rb', line 152 def percent_used 100 - (100.0 * bytes_free.to_f / bytes_total.to_f) end |