on_f_allocate Event

Fires when the OS needs to allocate space for an open file.


class FUSEFAllocateEventParams(object):
  def path() -> str: ...
  def file_context() -> int: ...
  def mode() -> int: ...
  def offset() -> int: ...
  def length() -> int: ...
  def result() -> int: ...
  def result(value) -> None: ...

# In class FUSE:
def on_f_allocate() -> Callable[[FUSEFAllocateEventParams], None]: ...
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.

Copyright (c) 2021 Callback Technologies, Inc. - All rights reserved.
CBFS FUSE 2020 Python Edition - Version 20.0 [Build 7836]