class File
Public Instance Methods
allocate(offset, length = nil)
click to toggle source
Ensures there is enough disk space for writing to a file.
This method asks the filesystem to allocate disk blocks for a file region, so that writes to that region will not fail due to out-of-space errors.
@param [Integer] offset the 0-based offset of the region’s starting byte @param [Integer] length the region’s length, in bytes
# File lib/fallocate/18.rb, line 9 def allocate(offset, length = nil) unless length length = offset offset = 0 end errno = Fallocate.posix_fallocate fileno, offset, length return if errno == 0 raise SystemCallError.new(errno) end