Fires when the OS needs to allocate space for an open file.
class FUSEFAllocateEventParams(object): @property def path() -> str: ... @property def file_context() -> int: ... @property def mode() -> int: ... @property def offset() -> int: ... @property def length() -> int: ... @property def result() -> int: ... @result.setter def result(value) -> None: ... # In class FUSE: @property def on_f_allocate() -> Callable[[FUSEFAllocateEventParams], None]: ... @on_f_allocate.setter def on_f_allocate(event_hook: Callable[[FUSEFAllocateEventParams], None]) -> None: ...
This event fires when the OS needs to allocate and zeroize space for an open file, which is identified by FileContext. The Path parameter contains the name of the file.
The allocation size of the file must be the greater of Offset+Length and current file size. The actual file size must be adjusted to match the new allocation size unless the Mode parameter includes the value 1 (FALLOC_FL_KEEP_SIZE).
Linux: The OS may send additional flags in the Mode parameter to manipulate file contents.
The range of the file data to zeroize starts from Offset and occupies Length bytes.
The event handler must ensure that the required space is allocated for specified file. If the event handler returns success then any subsequent write request to specified range must be guaranteed not to fail because of lack of space in the backend storage.
The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), set it to a negative error code value (e.g. -ENOENT to indicate that the file does not exist) to report an appropriate error. Please refer to the Error Reporting and Handling topic for more information.