Project: /_project.yaml Book: /_book.yaml

fuchsia.io

PROTOCOLS

Node {:#Node}

Defined in fuchsia.io/io.fidl

Node defines the minimal interface for entities which can be accessed in a filesystem.

Clone {:#Clone}

Create another connection to the same remote object.

flags may be any of:

  • OPEN_RIGHT_*
  • OPEN_FLAG_APPEND
  • OPEN_FLAG_NO_REMOTE
  • OPEN_FLAG_DESCRIBE
  • CLONE_FLAG_SAME_RIGHTS

All other flags are ignored.

The OPEN_RIGHT_* bits in flags request corresponding rights over the resulting cloned object. The cloned object must have rights less than or equal to the original object. Alternatively, pass CLONE_FLAG_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OPEN_RIGHT_* flags together with CLONE_FLAG_SAME_RIGHTS.

Request

Close {:#Close}

Terminates connection with object.

This method does not require any rights.

Request

Response

Describe {:#Describe}

Returns extra information about the type of the object. If the Describe operation fails, the connection is closed.

This method does not require any rights.

Request

Response

OnOpen {:#OnOpen}

An event produced eagerly by a FIDL server if requested by OPEN_FLAG_DESCRIBE.

Indicates the success or failure of the open operation, and optionally describes the object. If the status is ZX_OK, info contains descriptive information about the object (the same as would be returned by Describe).

Response

Sync {:#Sync}

Synchronizes updates to the node to the underlying media, if it exists.

This method does not require any rights.

Request

Response

GetAttr {:#GetAttr}

Acquires information about the node.

This method does not require any rights.

Request

Response

SetAttr {:#SetAttr}

Updates information about the node. flags may be any of NODE_ATTRIBUTE_FLAG_*.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

File {:#File}

Defined in fuchsia.io/io.fidl

File defines the interface of a node which contains a flat layout of data.

Clone {:#Clone}

Create another connection to the same remote object.

flags may be any of:

  • OPEN_RIGHT_*
  • OPEN_FLAG_APPEND
  • OPEN_FLAG_NO_REMOTE
  • OPEN_FLAG_DESCRIBE
  • CLONE_FLAG_SAME_RIGHTS

All other flags are ignored.

The OPEN_RIGHT_* bits in flags request corresponding rights over the resulting cloned object. The cloned object must have rights less than or equal to the original object. Alternatively, pass CLONE_FLAG_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OPEN_RIGHT_* flags together with CLONE_FLAG_SAME_RIGHTS.

Request

Close {:#Close}

Terminates connection with object.

This method does not require any rights.

Request

Response

Describe {:#Describe}

Returns extra information about the type of the object. If the Describe operation fails, the connection is closed.

This method does not require any rights.

Request

Response

OnOpen {:#OnOpen}

An event produced eagerly by a FIDL server if requested by OPEN_FLAG_DESCRIBE.

Indicates the success or failure of the open operation, and optionally describes the object. If the status is ZX_OK, info contains descriptive information about the object (the same as would be returned by Describe).

Response

Sync {:#Sync}

Synchronizes updates to the node to the underlying media, if it exists.

This method does not require any rights.

Request

Response

GetAttr {:#GetAttr}

Acquires information about the node.

This method does not require any rights.

Request

Response

SetAttr {:#SetAttr}

Updates information about the node. flags may be any of NODE_ATTRIBUTE_FLAG_*.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Read {:#Read}

Reads count bytes at the seek offset. The seek offset is moved forward by the number of bytes read.

This method requires following rights: OPEN_RIGHT_READABLE.

Request

Response

ReadAt {:#ReadAt}

Reads count bytes at the provided offset. Does not affect the seek offset.

This method requires following rights: OPEN_RIGHT_READABLE.

Request

Response

Write {:#Write}

Writes data at the seek offset. The seek offset is moved forward by the number of bytes written.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

WriteAt {:#WriteAt}

Writes data to the provided offset. Does not affect the seek offset.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Seek {:#Seek}

Moves the offset at which the next invocation of Read() or Write() will occur.

This method does not require any rights.

Request

Response

Truncate {:#Truncate}

Shrinks the file size to ‘length’ bytes.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

GetFlags {:#GetFlags}

Acquires the Directory.Open rights and flags used to access this file.

This method does not require any rights.

Request

Response

SetFlags {:#SetFlags}

Changes the Directory.Open flags used to access the file. Supported flags which can be turned on / off:

  • OPEN_FLAG_APPEND

This method does not require any rights.

Request

Response

GetBuffer {:#GetBuffer}

Acquires a buffer representing this file, if there is one, with the requested access rights.

flags may be any of VMO_FLAG_*.

This method requires following rights:

  • OPEN_RIGHT_WRITABLE if flags includes VMO_FLAG_WRITE.
  • OPEN_RIGHT_READABLE if flags includes VMO_FLAG_READ or VMO_FLAG_EXEC.

Request

Response

DirectoryWatcher {:#DirectoryWatcher}

Defined in fuchsia.io/io.fidl

DirectoryWatcher transmits messages from a filesystem server about events happening in the filesystem. Clients can register new watchers using the Directory.Watch method, where they can filter which events they want to receive notifications for.

OnEvent {:#OnEvent}

Request

Directory {:#Directory}

Defined in fuchsia.io/io.fidl

Directory defines a node which is capable of containing other Objects.

Clone {:#Clone}

Create another connection to the same remote object.

flags may be any of:

  • OPEN_RIGHT_*
  • OPEN_FLAG_APPEND
  • OPEN_FLAG_NO_REMOTE
  • OPEN_FLAG_DESCRIBE
  • CLONE_FLAG_SAME_RIGHTS

All other flags are ignored.

The OPEN_RIGHT_* bits in flags request corresponding rights over the resulting cloned object. The cloned object must have rights less than or equal to the original object. Alternatively, pass CLONE_FLAG_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OPEN_RIGHT_* flags together with CLONE_FLAG_SAME_RIGHTS.

Request

Close {:#Close}

Terminates connection with object.

This method does not require any rights.

Request

Response

Describe {:#Describe}

Returns extra information about the type of the object. If the Describe operation fails, the connection is closed.

This method does not require any rights.

Request

Response

OnOpen {:#OnOpen}

An event produced eagerly by a FIDL server if requested by OPEN_FLAG_DESCRIBE.

Indicates the success or failure of the open operation, and optionally describes the object. If the status is ZX_OK, info contains descriptive information about the object (the same as would be returned by Describe).

Response

Sync {:#Sync}

Synchronizes updates to the node to the underlying media, if it exists.

This method does not require any rights.

Request

Response

GetAttr {:#GetAttr}

Acquires information about the node.

This method does not require any rights.

Request

Response

SetAttr {:#SetAttr}

Updates information about the node. flags may be any of NODE_ATTRIBUTE_FLAG_*.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Open {:#Open}

Opens a new object relative to this directory object.

path may contain multiple segments, separated by “/” characters, and should never be empty; i.e., "" is an invalid path.

flags may be any of the OPEN_FLAG_* and OPEN_RIGHT_* values, bitwise ORed together. The OPEN_FLAG_DESCRIBE flag may cause an OnOpen event to be transmitted on the object handle, indicating the type of object opened.

If an unknown value is sent for either flags or mode, the connection should be closed.

OPEN_RIGHT_* flags provided in flags will restrict access rights on the object channel which will be connected to the opened entity.

Rights are never increased. When you open a nested entity within a directory, you may only request the same rights as what the directory connection already has, or a subset of those. Exceeding those rights causes an access denied error to be transmitted in the OnOpen event if applicable, and the object connection closed.

The caller must specify either one or more of the OPEN_RIGHT_* flags, or the OPEN_FLAG_NODE_REFERENCE flag.

Request

Unlink {:#Unlink}

Detaches an object from this directory object.

The underlying object may or may not be deleted after this method completes: although the link will be removed from the containing directory, objects with multiple references (such as files which are still open) will not actually be destroyed until all references are removed.

If a directory is unlinked while it still has an open reference, it must become read-only, preventing new entries from being created until all references close and the directory is destroyed.

path identifies the file which should be detached. If path contains multiple segments, separated by “/” characters, then the directory is traversed, one segment at a time, relative to the originally accessed Directory.

Returns: ZX_ERR_ACCESS_DENIED if the connection (or the underlying filesystem) does not allow writable access. ZX_ERR_INVALID_ARGS if path contains “..” segments. ZX_ERR_NOT_EMPTY if path refers to a non-empty directory. ZX_ERR_UNAVAILABLE if path refers to a mount point, containing a remote channel. ZX_ERR_UNAVAILABLE if path is “.”.

Other errors may be returned for filesystem-specific reasons.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

ReadDirents {:#ReadDirents}

Reads a collection of variably sized dirents into a buffer. The number of dirents in a directory may be very large: akin to calling read multiple times on a file, directories have a seek offset which is updated on subsequent calls to ReadDirents.

These dirents are of the form:

struct dirent {
  // Describes the inode of the entry.
  uint64 ino;
  // Describes the length of the dirent name in bytes.
  uint8 size;
  // Describes the type of the entry. Aligned with the
  // POSIX d_type values. Use `DIRENT_TYPE_*` constants.
  uint8 type;
  // Unterminated name of entry.
  char name[0];
}

This method does not require any rights, since one could always probe for directory contents by triggering name conflicts during file creation.

Request

Response

Rewind {:#Rewind}

Resets the directory seek offset.

This method does not require any rights, similar to ReadDirents.

Request

Response

GetToken {:#GetToken}

Acquires a token to a Directory which can be used to identify access to it at a later point in time.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Rename {:#Rename}

Renames an object named src to the name dst, in a directory represented by token.

src/dst must be resolved object names. Including “/” in any position other than the end of the string will return ZX_ERR_INVALID_ARGS. Returning “/” at the end of either string implies that it must be a directory, or else ZX_ERR_NOT_DIR should be returned.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Link {:#Link}

Creates a link to an object named src by the name dst, within a directory represented by token.

src must be a resolved object name. Including “/” in the string will return ZX_ERR_INVALID_ARGS.

dst must be a resolved object name. Including “/” in the string will return ZX_ERR_INVALID_ARGS.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Watch {:#Watch}

Watches a directory, receiving events of added messages on the watcher request channel.

The watcher handle will send messages of the form:

struct {
  uint8 event;
  uint8 len;
  char name[];
};

Where names are NOT null-terminated.

This API is unstable; in the future, watcher will be a DirectoryWatcher client.

Mask specifies a bitmask of events to observe. Options must be zero; it is reserved.

This method does not require any rights, similar to ReadDirents.

Request

Response

DirectoryAdmin {:#DirectoryAdmin}

Defined in fuchsia.io/io.fidl

DirectoryAdmin defines a directory which is capable of handling administrator tasks within the filesystem.

Clone {:#Clone}

Create another connection to the same remote object.

flags may be any of:

  • OPEN_RIGHT_*
  • OPEN_FLAG_APPEND
  • OPEN_FLAG_NO_REMOTE
  • OPEN_FLAG_DESCRIBE
  • CLONE_FLAG_SAME_RIGHTS

All other flags are ignored.

The OPEN_RIGHT_* bits in flags request corresponding rights over the resulting cloned object. The cloned object must have rights less than or equal to the original object. Alternatively, pass CLONE_FLAG_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OPEN_RIGHT_* flags together with CLONE_FLAG_SAME_RIGHTS.

Request

Close {:#Close}

Terminates connection with object.

This method does not require any rights.

Request

Response

Describe {:#Describe}

Returns extra information about the type of the object. If the Describe operation fails, the connection is closed.

This method does not require any rights.

Request

Response

OnOpen {:#OnOpen}

An event produced eagerly by a FIDL server if requested by OPEN_FLAG_DESCRIBE.

Indicates the success or failure of the open operation, and optionally describes the object. If the status is ZX_OK, info contains descriptive information about the object (the same as would be returned by Describe).

Response

Sync {:#Sync}

Synchronizes updates to the node to the underlying media, if it exists.

This method does not require any rights.

Request

Response

GetAttr {:#GetAttr}

Acquires information about the node.

This method does not require any rights.

Request

Response

SetAttr {:#SetAttr}

Updates information about the node. flags may be any of NODE_ATTRIBUTE_FLAG_*.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Open {:#Open}

Opens a new object relative to this directory object.

path may contain multiple segments, separated by “/” characters, and should never be empty; i.e., "" is an invalid path.

flags may be any of the OPEN_FLAG_* and OPEN_RIGHT_* values, bitwise ORed together. The OPEN_FLAG_DESCRIBE flag may cause an OnOpen event to be transmitted on the object handle, indicating the type of object opened.

If an unknown value is sent for either flags or mode, the connection should be closed.

OPEN_RIGHT_* flags provided in flags will restrict access rights on the object channel which will be connected to the opened entity.

Rights are never increased. When you open a nested entity within a directory, you may only request the same rights as what the directory connection already has, or a subset of those. Exceeding those rights causes an access denied error to be transmitted in the OnOpen event if applicable, and the object connection closed.

The caller must specify either one or more of the OPEN_RIGHT_* flags, or the OPEN_FLAG_NODE_REFERENCE flag.

Request

Unlink {:#Unlink}

Detaches an object from this directory object.

The underlying object may or may not be deleted after this method completes: although the link will be removed from the containing directory, objects with multiple references (such as files which are still open) will not actually be destroyed until all references are removed.

If a directory is unlinked while it still has an open reference, it must become read-only, preventing new entries from being created until all references close and the directory is destroyed.

path identifies the file which should be detached. If path contains multiple segments, separated by “/” characters, then the directory is traversed, one segment at a time, relative to the originally accessed Directory.

Returns: ZX_ERR_ACCESS_DENIED if the connection (or the underlying filesystem) does not allow writable access. ZX_ERR_INVALID_ARGS if path contains “..” segments. ZX_ERR_NOT_EMPTY if path refers to a non-empty directory. ZX_ERR_UNAVAILABLE if path refers to a mount point, containing a remote channel. ZX_ERR_UNAVAILABLE if path is “.”.

Other errors may be returned for filesystem-specific reasons.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

ReadDirents {:#ReadDirents}

Reads a collection of variably sized dirents into a buffer. The number of dirents in a directory may be very large: akin to calling read multiple times on a file, directories have a seek offset which is updated on subsequent calls to ReadDirents.

These dirents are of the form:

struct dirent {
  // Describes the inode of the entry.
  uint64 ino;
  // Describes the length of the dirent name in bytes.
  uint8 size;
  // Describes the type of the entry. Aligned with the
  // POSIX d_type values. Use `DIRENT_TYPE_*` constants.
  uint8 type;
  // Unterminated name of entry.
  char name[0];
}

This method does not require any rights, since one could always probe for directory contents by triggering name conflicts during file creation.

Request

Response

Rewind {:#Rewind}

Resets the directory seek offset.

This method does not require any rights, similar to ReadDirents.

Request

Response

GetToken {:#GetToken}

Acquires a token to a Directory which can be used to identify access to it at a later point in time.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Rename {:#Rename}

Renames an object named src to the name dst, in a directory represented by token.

src/dst must be resolved object names. Including “/” in any position other than the end of the string will return ZX_ERR_INVALID_ARGS. Returning “/” at the end of either string implies that it must be a directory, or else ZX_ERR_NOT_DIR should be returned.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Link {:#Link}

Creates a link to an object named src by the name dst, within a directory represented by token.

src must be a resolved object name. Including “/” in the string will return ZX_ERR_INVALID_ARGS.

dst must be a resolved object name. Including “/” in the string will return ZX_ERR_INVALID_ARGS.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Watch {:#Watch}

Watches a directory, receiving events of added messages on the watcher request channel.

The watcher handle will send messages of the form:

struct {
  uint8 event;
  uint8 len;
  char name[];
};

Where names are NOT null-terminated.

This API is unstable; in the future, watcher will be a DirectoryWatcher client.

Mask specifies a bitmask of events to observe. Options must be zero; it is reserved.

This method does not require any rights, similar to ReadDirents.

Request

Response

Mount {:#Mount}

Mount a channel representing a remote filesystem onto this directory. All future requests to this node will be forwarded to the remote filesystem. To re-open a node without forwarding to the remote target, the node should be opened with OPEN_FLAG_NO_REMOTE.

Request

Response

MountAndCreate {:#MountAndCreate}

Atomically create a directory with a provided path, and mount the remote handle to the newly created directory.

Request

Response

Unmount {:#Unmount}

Unmount this filesystem. After this function returns successfully, all connections to the filesystem will be terminated.

Request

Response

UnmountNode {:#UnmountNode}

Detach a node which was previously attached to this directory with Mount.

Request

Response

QueryFilesystem {:#QueryFilesystem}

Query the filesystem for filesystem-specific information.

Request

Response

GetDevicePath {:#GetDevicePath}

Acquire the path to the device backing this filesystem, if there is one.

Request

Response

Node {:#Node}

Defined in fuchsia.io/io.fidl

Node defines the minimal interface for entities which can be accessed in a filesystem.

Clone {:#Clone}

Create another connection to the same remote object.

flags may be any of:

  • OPEN_RIGHT_*
  • OPEN_FLAG_APPEND
  • OPEN_FLAG_NO_REMOTE
  • OPEN_FLAG_DESCRIBE
  • CLONE_FLAG_SAME_RIGHTS

All other flags are ignored.

The OPEN_RIGHT_* bits in flags request corresponding rights over the resulting cloned object. The cloned object must have rights less than or equal to the original object. Alternatively, pass CLONE_FLAG_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OPEN_RIGHT_* flags together with CLONE_FLAG_SAME_RIGHTS.

Request

Close {:#Close}

Terminates connection with object.

This method does not require any rights.

Request

Response

Describe {:#Describe}

Returns extra information about the type of the object. If the Describe operation fails, the connection is closed.

This method does not require any rights.

Request

Response

OnOpen {:#OnOpen}

An event produced eagerly by a FIDL server if requested by OPEN_FLAG_DESCRIBE.

Indicates the success or failure of the open operation, and optionally describes the object. If the status is ZX_OK, info contains descriptive information about the object (the same as would be returned by Describe).

Response

Sync {:#Sync}

Synchronizes updates to the node to the underlying media, if it exists.

This method does not require any rights.

Request

Response

GetAttr {:#GetAttr}

Acquires information about the node.

This method does not require any rights.

Request

Response

SetAttr {:#SetAttr}

Updates information about the node. flags may be any of NODE_ATTRIBUTE_FLAG_*.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

File {:#File}

Defined in fuchsia.io/io.fidl

File defines the interface of a node which contains a flat layout of data.

Clone {:#Clone}

Create another connection to the same remote object.

flags may be any of:

  • OPEN_RIGHT_*
  • OPEN_FLAG_APPEND
  • OPEN_FLAG_NO_REMOTE
  • OPEN_FLAG_DESCRIBE
  • CLONE_FLAG_SAME_RIGHTS

All other flags are ignored.

The OPEN_RIGHT_* bits in flags request corresponding rights over the resulting cloned object. The cloned object must have rights less than or equal to the original object. Alternatively, pass CLONE_FLAG_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OPEN_RIGHT_* flags together with CLONE_FLAG_SAME_RIGHTS.

Request

Close {:#Close}

Terminates connection with object.

This method does not require any rights.

Request

Response

Describe {:#Describe}

Returns extra information about the type of the object. If the Describe operation fails, the connection is closed.

This method does not require any rights.

Request

Response

OnOpen {:#OnOpen}

An event produced eagerly by a FIDL server if requested by OPEN_FLAG_DESCRIBE.

Indicates the success or failure of the open operation, and optionally describes the object. If the status is ZX_OK, info contains descriptive information about the object (the same as would be returned by Describe).

Response

Sync {:#Sync}

Synchronizes updates to the node to the underlying media, if it exists.

This method does not require any rights.

Request

Response

GetAttr {:#GetAttr}

Acquires information about the node.

This method does not require any rights.

Request

Response

SetAttr {:#SetAttr}

Updates information about the node. flags may be any of NODE_ATTRIBUTE_FLAG_*.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Read {:#Read}

Reads count bytes at the seek offset. The seek offset is moved forward by the number of bytes read.

This method requires following rights: OPEN_RIGHT_READABLE.

Request

Response

ReadAt {:#ReadAt}

Reads count bytes at the provided offset. Does not affect the seek offset.

This method requires following rights: OPEN_RIGHT_READABLE.

Request

Response

Write {:#Write}

Writes data at the seek offset. The seek offset is moved forward by the number of bytes written.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

WriteAt {:#WriteAt}

Writes data to the provided offset. Does not affect the seek offset.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Seek {:#Seek}

Moves the offset at which the next invocation of Read() or Write() will occur.

This method does not require any rights.

Request

Response

Truncate {:#Truncate}

Shrinks the file size to ‘length’ bytes.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

GetFlags {:#GetFlags}

Acquires the Directory.Open rights and flags used to access this file.

This method does not require any rights.

Request

Response

SetFlags {:#SetFlags}

Changes the Directory.Open flags used to access the file. Supported flags which can be turned on / off:

  • OPEN_FLAG_APPEND

This method does not require any rights.

Request

Response

GetBuffer {:#GetBuffer}

Acquires a buffer representing this file, if there is one, with the requested access rights.

flags may be any of VMO_FLAG_*.

This method requires following rights:

  • OPEN_RIGHT_WRITABLE if flags includes VMO_FLAG_WRITE.
  • OPEN_RIGHT_READABLE if flags includes VMO_FLAG_READ or VMO_FLAG_EXEC.

Request

Response

DirectoryWatcher {:#DirectoryWatcher}

Defined in fuchsia.io/io.fidl

DirectoryWatcher transmits messages from a filesystem server about events happening in the filesystem. Clients can register new watchers using the Directory.Watch method, where they can filter which events they want to receive notifications for.

OnEvent {:#OnEvent}

Request

Directory {:#Directory}

Defined in fuchsia.io/io.fidl

Directory defines a node which is capable of containing other Objects.

Clone {:#Clone}

Create another connection to the same remote object.

flags may be any of:

  • OPEN_RIGHT_*
  • OPEN_FLAG_APPEND
  • OPEN_FLAG_NO_REMOTE
  • OPEN_FLAG_DESCRIBE
  • CLONE_FLAG_SAME_RIGHTS

All other flags are ignored.

The OPEN_RIGHT_* bits in flags request corresponding rights over the resulting cloned object. The cloned object must have rights less than or equal to the original object. Alternatively, pass CLONE_FLAG_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OPEN_RIGHT_* flags together with CLONE_FLAG_SAME_RIGHTS.

Request

Close {:#Close}

Terminates connection with object.

This method does not require any rights.

Request

Response

Describe {:#Describe}

Returns extra information about the type of the object. If the Describe operation fails, the connection is closed.

This method does not require any rights.

Request

Response

OnOpen {:#OnOpen}

An event produced eagerly by a FIDL server if requested by OPEN_FLAG_DESCRIBE.

Indicates the success or failure of the open operation, and optionally describes the object. If the status is ZX_OK, info contains descriptive information about the object (the same as would be returned by Describe).

Response

Sync {:#Sync}

Synchronizes updates to the node to the underlying media, if it exists.

This method does not require any rights.

Request

Response

GetAttr {:#GetAttr}

Acquires information about the node.

This method does not require any rights.

Request

Response

SetAttr {:#SetAttr}

Updates information about the node. flags may be any of NODE_ATTRIBUTE_FLAG_*.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Open {:#Open}

Opens a new object relative to this directory object.

path may contain multiple segments, separated by “/” characters, and should never be empty; i.e., "" is an invalid path.

flags may be any of the OPEN_FLAG_* and OPEN_RIGHT_* values, bitwise ORed together. The OPEN_FLAG_DESCRIBE flag may cause an OnOpen event to be transmitted on the object handle, indicating the type of object opened.

If an unknown value is sent for either flags or mode, the connection should be closed.

OPEN_RIGHT_* flags provided in flags will restrict access rights on the object channel which will be connected to the opened entity.

Rights are never increased. When you open a nested entity within a directory, you may only request the same rights as what the directory connection already has, or a subset of those. Exceeding those rights causes an access denied error to be transmitted in the OnOpen event if applicable, and the object connection closed.

The caller must specify either one or more of the OPEN_RIGHT_* flags, or the OPEN_FLAG_NODE_REFERENCE flag.

Request

Unlink {:#Unlink}

Detaches an object from this directory object.

The underlying object may or may not be deleted after this method completes: although the link will be removed from the containing directory, objects with multiple references (such as files which are still open) will not actually be destroyed until all references are removed.

If a directory is unlinked while it still has an open reference, it must become read-only, preventing new entries from being created until all references close and the directory is destroyed.

path identifies the file which should be detached. If path contains multiple segments, separated by “/” characters, then the directory is traversed, one segment at a time, relative to the originally accessed Directory.

Returns: ZX_ERR_ACCESS_DENIED if the connection (or the underlying filesystem) does not allow writable access. ZX_ERR_INVALID_ARGS if path contains “..” segments. ZX_ERR_NOT_EMPTY if path refers to a non-empty directory. ZX_ERR_UNAVAILABLE if path refers to a mount point, containing a remote channel. ZX_ERR_UNAVAILABLE if path is “.”.

Other errors may be returned for filesystem-specific reasons.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

ReadDirents {:#ReadDirents}

Reads a collection of variably sized dirents into a buffer. The number of dirents in a directory may be very large: akin to calling read multiple times on a file, directories have a seek offset which is updated on subsequent calls to ReadDirents.

These dirents are of the form:

struct dirent {
  // Describes the inode of the entry.
  uint64 ino;
  // Describes the length of the dirent name in bytes.
  uint8 size;
  // Describes the type of the entry. Aligned with the
  // POSIX d_type values. Use `DIRENT_TYPE_*` constants.
  uint8 type;
  // Unterminated name of entry.
  char name[0];
}

This method does not require any rights, since one could always probe for directory contents by triggering name conflicts during file creation.

Request

Response

Rewind {:#Rewind}

Resets the directory seek offset.

This method does not require any rights, similar to ReadDirents.

Request

Response

GetToken {:#GetToken}

Acquires a token to a Directory which can be used to identify access to it at a later point in time.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Rename {:#Rename}

Renames an object named src to the name dst, in a directory represented by token.

src/dst must be resolved object names. Including “/” in any position other than the end of the string will return ZX_ERR_INVALID_ARGS. Returning “/” at the end of either string implies that it must be a directory, or else ZX_ERR_NOT_DIR should be returned.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Link {:#Link}

Creates a link to an object named src by the name dst, within a directory represented by token.

src must be a resolved object name. Including “/” in the string will return ZX_ERR_INVALID_ARGS.

dst must be a resolved object name. Including “/” in the string will return ZX_ERR_INVALID_ARGS.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Watch {:#Watch}

Watches a directory, receiving events of added messages on the watcher request channel.

The watcher handle will send messages of the form:

struct {
  uint8 event;
  uint8 len;
  char name[];
};

Where names are NOT null-terminated.

This API is unstable; in the future, watcher will be a DirectoryWatcher client.

Mask specifies a bitmask of events to observe. Options must be zero; it is reserved.

This method does not require any rights, similar to ReadDirents.

Request

Response

DirectoryAdmin {:#DirectoryAdmin}

Defined in fuchsia.io/io.fidl

DirectoryAdmin defines a directory which is capable of handling administrator tasks within the filesystem.

Clone {:#Clone}

Create another connection to the same remote object.

flags may be any of:

  • OPEN_RIGHT_*
  • OPEN_FLAG_APPEND
  • OPEN_FLAG_NO_REMOTE
  • OPEN_FLAG_DESCRIBE
  • CLONE_FLAG_SAME_RIGHTS

All other flags are ignored.

The OPEN_RIGHT_* bits in flags request corresponding rights over the resulting cloned object. The cloned object must have rights less than or equal to the original object. Alternatively, pass CLONE_FLAG_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OPEN_RIGHT_* flags together with CLONE_FLAG_SAME_RIGHTS.

Request

Close {:#Close}

Terminates connection with object.

This method does not require any rights.

Request

Response

Describe {:#Describe}

Returns extra information about the type of the object. If the Describe operation fails, the connection is closed.

This method does not require any rights.

Request

Response

OnOpen {:#OnOpen}

An event produced eagerly by a FIDL server if requested by OPEN_FLAG_DESCRIBE.

Indicates the success or failure of the open operation, and optionally describes the object. If the status is ZX_OK, info contains descriptive information about the object (the same as would be returned by Describe).

Response

Sync {:#Sync}

Synchronizes updates to the node to the underlying media, if it exists.

This method does not require any rights.

Request

Response

GetAttr {:#GetAttr}

Acquires information about the node.

This method does not require any rights.

Request

Response

SetAttr {:#SetAttr}

Updates information about the node. flags may be any of NODE_ATTRIBUTE_FLAG_*.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Open {:#Open}

Opens a new object relative to this directory object.

path may contain multiple segments, separated by “/” characters, and should never be empty; i.e., "" is an invalid path.

flags may be any of the OPEN_FLAG_* and OPEN_RIGHT_* values, bitwise ORed together. The OPEN_FLAG_DESCRIBE flag may cause an OnOpen event to be transmitted on the object handle, indicating the type of object opened.

If an unknown value is sent for either flags or mode, the connection should be closed.

OPEN_RIGHT_* flags provided in flags will restrict access rights on the object channel which will be connected to the opened entity.

Rights are never increased. When you open a nested entity within a directory, you may only request the same rights as what the directory connection already has, or a subset of those. Exceeding those rights causes an access denied error to be transmitted in the OnOpen event if applicable, and the object connection closed.

The caller must specify either one or more of the OPEN_RIGHT_* flags, or the OPEN_FLAG_NODE_REFERENCE flag.

Request

Unlink {:#Unlink}

Detaches an object from this directory object.

The underlying object may or may not be deleted after this method completes: although the link will be removed from the containing directory, objects with multiple references (such as files which are still open) will not actually be destroyed until all references are removed.

If a directory is unlinked while it still has an open reference, it must become read-only, preventing new entries from being created until all references close and the directory is destroyed.

path identifies the file which should be detached. If path contains multiple segments, separated by “/” characters, then the directory is traversed, one segment at a time, relative to the originally accessed Directory.

Returns: ZX_ERR_ACCESS_DENIED if the connection (or the underlying filesystem) does not allow writable access. ZX_ERR_INVALID_ARGS if path contains “..” segments. ZX_ERR_NOT_EMPTY if path refers to a non-empty directory. ZX_ERR_UNAVAILABLE if path refers to a mount point, containing a remote channel. ZX_ERR_UNAVAILABLE if path is “.”.

Other errors may be returned for filesystem-specific reasons.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

ReadDirents {:#ReadDirents}

Reads a collection of variably sized dirents into a buffer. The number of dirents in a directory may be very large: akin to calling read multiple times on a file, directories have a seek offset which is updated on subsequent calls to ReadDirents.

These dirents are of the form:

struct dirent {
  // Describes the inode of the entry.
  uint64 ino;
  // Describes the length of the dirent name in bytes.
  uint8 size;
  // Describes the type of the entry. Aligned with the
  // POSIX d_type values. Use `DIRENT_TYPE_*` constants.
  uint8 type;
  // Unterminated name of entry.
  char name[0];
}

This method does not require any rights, since one could always probe for directory contents by triggering name conflicts during file creation.

Request

Response

Rewind {:#Rewind}

Resets the directory seek offset.

This method does not require any rights, similar to ReadDirents.

Request

Response

GetToken {:#GetToken}

Acquires a token to a Directory which can be used to identify access to it at a later point in time.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Rename {:#Rename}

Renames an object named src to the name dst, in a directory represented by token.

src/dst must be resolved object names. Including “/” in any position other than the end of the string will return ZX_ERR_INVALID_ARGS. Returning “/” at the end of either string implies that it must be a directory, or else ZX_ERR_NOT_DIR should be returned.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Link {:#Link}

Creates a link to an object named src by the name dst, within a directory represented by token.

src must be a resolved object name. Including “/” in the string will return ZX_ERR_INVALID_ARGS.

dst must be a resolved object name. Including “/” in the string will return ZX_ERR_INVALID_ARGS.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Watch {:#Watch}

Watches a directory, receiving events of added messages on the watcher request channel.

The watcher handle will send messages of the form:

struct {
  uint8 event;
  uint8 len;
  char name[];
};

Where names are NOT null-terminated.

This API is unstable; in the future, watcher will be a DirectoryWatcher client.

Mask specifies a bitmask of events to observe. Options must be zero; it is reserved.

This method does not require any rights, similar to ReadDirents.

Request

Response

Mount {:#Mount}

Mount a channel representing a remote filesystem onto this directory. All future requests to this node will be forwarded to the remote filesystem. To re-open a node without forwarding to the remote target, the node should be opened with OPEN_FLAG_NO_REMOTE.

Request

Response

MountAndCreate {:#MountAndCreate}

Atomically create a directory with a provided path, and mount the remote handle to the newly created directory.

Request

Response

Unmount {:#Unmount}

Unmount this filesystem. After this function returns successfully, all connections to the filesystem will be terminated.

Request

Response

UnmountNode {:#UnmountNode}

Detach a node which was previously attached to this directory with Mount.

Request

Response

QueryFilesystem {:#QueryFilesystem}

Query the filesystem for filesystem-specific information.

Request

Response

GetDevicePath {:#GetDevicePath}

Acquire the path to the device backing this filesystem, if there is one.

Request

Response

STRUCTS

Service {:#Service}

Defined in fuchsia.io/io.fidl

The default protocol, interface information must be acquired some other way.

FileObject {:#FileObject}

Defined in fuchsia.io/io.fidl

The object may be cast to interface ‘File’.

The “FILE_SIGNAL_” values may be observed on this event.

DirectoryObject {:#DirectoryObject}

Defined in fuchsia.io/io.fidl

The object may be cast to interface ‘Directory’.

Pipe {:#Pipe}

Defined in fuchsia.io/io.fidl

The object is accompanied by a pipe.

Socket {:#Socket}

Defined in fuchsia.io/io.fidl

The object is accompanied by a socket.

Vmofile {:#Vmofile}

Defined in fuchsia.io/io.fidl

The object is a file which is represented as an immutable VMO. Although a VMO is returned as a part of this structure, this underlying object may represent multiple Vmofiles. To identify the logical portion of the VMO that represents the single file, an offset and length parameter are also supplied.

Device {:#Device}

Defined in fuchsia.io/io.fidl

The object may be cast to interface ‘Device’.

The “DEVICE_SIGNAL_” values may be observed on this event.

Tty {:#Tty}

Defined in fuchsia.io/io.fidl

The object may be cast to interface ‘Tty’

NodeAttributes {:#NodeAttributes}

Defined in fuchsia.io/io.fidl

NodeAttributes defines generic information about a filesystem node.

WatchedEvent {:#WatchedEvent}

Defined in fuchsia.io/io.fidl

WatchedEvent describes events returned from a DirectoryWatcher.

FilesystemInfo {:#FilesystemInfo}

Defined in fuchsia.io/io.fidl

Service {:#Service}

Defined in fuchsia.io/io.fidl

The default protocol, interface information must be acquired some other way.

FileObject {:#FileObject}

Defined in fuchsia.io/io.fidl

The object may be cast to interface ‘File’.

The “FILE_SIGNAL_” values may be observed on this event.

DirectoryObject {:#DirectoryObject}

Defined in fuchsia.io/io.fidl

The object may be cast to interface ‘Directory’.

Pipe {:#Pipe}

Defined in fuchsia.io/io.fidl

The object is accompanied by a pipe.

Socket {:#Socket}

Defined in fuchsia.io/io.fidl

The object is accompanied by a socket.

Vmofile {:#Vmofile}

Defined in fuchsia.io/io.fidl

The object is a file which is represented as an immutable VMO. Although a VMO is returned as a part of this structure, this underlying object may represent multiple Vmofiles. To identify the logical portion of the VMO that represents the single file, an offset and length parameter are also supplied.

Device {:#Device}

Defined in fuchsia.io/io.fidl

The object may be cast to interface ‘Device’.

The “DEVICE_SIGNAL_” values may be observed on this event.

Tty {:#Tty}

Defined in fuchsia.io/io.fidl

The object may be cast to interface ‘Tty’

NodeAttributes {:#NodeAttributes}

Defined in fuchsia.io/io.fidl

NodeAttributes defines generic information about a filesystem node.

WatchedEvent {:#WatchedEvent}

Defined in fuchsia.io/io.fidl

WatchedEvent describes events returned from a DirectoryWatcher.

FilesystemInfo {:#FilesystemInfo}

Defined in fuchsia.io/io.fidl

ENUMS

SeekOrigin {:#SeekOrigin}

Type: uint32

Defined in fuchsia.io/io.fidl

Update the Seek offset.

SeekOrigin {:#SeekOrigin}

Type: uint32

Defined in fuchsia.io/io.fidl

Update the Seek offset.

UNIONS

NodeInfo {:#NodeInfo}

Defined in fuchsia.io/io.fidl

Describes how the connection to an should be handled, as well as how to interpret the optional handle.

Refer to Node.Describe() and Node.OnOpen() for usage.

NodeInfo {:#NodeInfo}

Defined in fuchsia.io/io.fidl

Describes how the connection to an should be handled, as well as how to interpret the optional handle.

Refer to Node.Describe() and Node.OnOpen() for usage.

CONSTANTS

If the posix compatibility flag is not specified, opening always uses the requested rights, failing the operation with access denied error if requested rights exceeds the rights attached to the current connection.

If the requesting connection is read-only and the requested rights are read-only, the flag may be ignored by the server, and is not forwarded downstream. This is an implementation detail, necessary to enforce hierarchical permissions across mount points, and should have no effect on the expected behavior for clients.

If the posix compatibility flag is not specified, opening always uses the requested rights, failing the operation with access denied error if requested rights exceeds the rights attached to the current connection.

If the requesting connection is read-only and the requested rights are read-only, the flag may be ignored by the server, and is not forwarded downstream. This is an implementation detail, necessary to enforce hierarchical permissions across mount points, and should have no effect on the expected behavior for clients.