on_get_attr Event

Fires when the OS needs information about a file or directory.

Syntax

class FUSEGetAttrEventParams(object):
  @property
  def path() -> str: ...
  @property
  def file_context() -> int: ...
  @property
  def ino() -> int: ...
  @ino.setter
  def ino(value) -> None: ...
  @property
  def mode() -> int: ...
  @mode.setter
  def mode(value) -> None: ...
  @property
  def uid() -> int: ...
  @uid.setter
  def uid(value) -> None: ...
  @property
  def gid() -> int: ...
  @gid.setter
  def gid(value) -> None: ...
  @property
  def link_count() -> int: ...
  @link_count.setter
  def link_count(value) -> None: ...
  @property
  def size() -> int: ...
  @size.setter
  def size(value) -> None: ...
  @property
  def a_time() -> datetime.datetime: ...
  @a_time.setter
  def a_time(value) -> None: ...
  @property
  def m_time() -> datetime.datetime: ...
  @m_time.setter
  def m_time(value) -> None: ...
  @property
  def c_time() -> datetime.datetime: ...
  @c_time.setter
  def c_time(value) -> None: ...
  @property
  def result() -> int: ...
  @result.setter
  def result(value) -> None: ...

# In class FUSE:
@property
def on_get_attr() -> Callable[[FUSEGetAttrEventParams], None]: ...
@on_get_attr.setter
def on_get_attr(event_hook: Callable[[FUSEGetAttrEventParams], None]) -> None: ...

Remarks

This event fires when the OS needs information about the file or directory identified by either Path or FileContext (the latter in most cases will not be initialized). If the entry with the specified name does not exist, the handler must return ENOENT in Result parameter.

The Ino parameter should be set to the ID of the file, which must be unique within a filesystem. Ino is optional on Windows and is ignored on Linux, where FUSE internally generates internal IDs.

The Mode parameter is a combination of bit flags.

Windows: Mode may include 0x4000 (S_IFDIR) to indicate that the entry is a directory, and must include either 0x80 (S_IWUSR) to indicate a file that can be read and written or 0x100 (S_IRUSR) to indicate a read-only file. Other flags are ignored.

Linux: Mode may include any appropriate file mode flags.

Windows: The Uid, Gid, and LinkCount parameters are not used.

Linux: The Uid and Gid parameters must be set to the owner's user ID and group ID respectively. LinkCount should be set to the number of hard links that the file has (which usually is 1).

Size must be set to the size of the file's data. For directories, the parameter should be set to 0.

ATime, MTime, CTime: Set respectively to the Access Time, Modification Time, and Creation Time values of the file or directory. All date/time parameters in the class are specified in UTC.

To convert Unix time to the format, suitable for this event, use the unix_time_to_file_time method.

Windows: Any non-applicable time values can be left unchanged, or set to January 1, 1970 00:00:00 UTC.

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]