Honoring Asian Pacific American Heritage Month. See how.

fuchsia.io

Added: 7

PROTOCOLS

AdvisoryLocking

Defined in fuchsia.io/locking.fidl

Advisory locking protocol.

This protocol is intended to be composed into the |File| protocol to provide support for advisory locking.

Advisory locks are purely advisory. They do not prevent actual read or write operations from occurring on the file, either through this connection or through other connections.

These primitives are designed to support the flock() and fcntl(), specifically F_SETLK, F_SETLKW, and F_GETLK, functionality that code running on Fuchsia expects from other operating systems.

AdvisoryLock

Acquires an advisory lock on the underlying file.

The lock lasts until either this connection is closed or this method is called with |AdvisoryLockType.UNLOCK| to release the lock explicitly.

Advisory locks are purely advisory. They do not prevent actual read or write operations from occurring on the file, either through this connection or through other connections.

This method requires the following rights:

Errors

  • ZX_ERR_BAD_STATE The specified type of lock cannot be acquired. For example, another connection might hold a conflicting lock type.
  • ZX_ERR_NOT_SUPPORTED This file does not support advisory locking.
  • ZX_ERR_ACCESS_DENIED This connection does not have sufficient rights to acquire the given type of lock.

Request

NameType
request AdvisoryLockRequest

Response

NameType
result AdvisoryLocking_AdvisoryLock_Result

Directory

Defined in fuchsia.io/directory.fidl

AddInotifyFilter

Adds a new inotify filter for an object relative to this directory object.

  • 'filter` is a mask of different inotify events that need to be watched by the server for a specific file/directory.

  • path may contain multiple segments, separated by "/" characters, and should never be empty; i.e., "" is an invalid path. Paths should not contain a leading "/".

+watch_descriptor is client assigned value to identify a filter. Server shouldn't trust the client-assigned watch_descriptor. They should just send it back to the client in the socket. This value is not used by server, but it is returned back as part of InotifyEvent, to help the client correlate filter with events on this filter.

  • socket is shared between different filter objects i.e every new filter will have a different server end of the socket and there will be a single client end per inotify instance on inotify init.

Request

NameType
path Path
filter InotifyWatchMask
watch_descriptor uint32
socket handle<socket>

Response

<EMPTY>

AdvisoryLock

Acquires an advisory lock on the underlying file.

The lock lasts until either this connection is closed or this method is called with |AdvisoryLockType.UNLOCK| to release the lock explicitly.

Advisory locks are purely advisory. They do not prevent actual read or write operations from occurring on the file, either through this connection or through other connections.

This method requires the following rights:

Errors

  • ZX_ERR_BAD_STATE The specified type of lock cannot be acquired. For example, another connection might hold a conflicting lock type.
  • ZX_ERR_NOT_SUPPORTED This file does not support advisory locking.
  • ZX_ERR_ACCESS_DENIED This connection does not have sufficient rights to acquire the given type of lock.

Request

NameType
request AdvisoryLockRequest

Response

NameType
result AdvisoryLocking_AdvisoryLock_Result

Clone

Create another connection to the same remote object.

flags may be any of:

  • OpenFlags.RIGHT_*
  • OpenFlags.APPEND
  • OpenFlags.NO_REMOTE
  • OpenFlags.DESCRIBE
  • OpenFlags.CLONE_SAME_RIGHTS

All other flags are ignored.

The OpenFlags.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, otherwise returns ZX_ERR_ACCESS_DENIED. Alternatively, pass OpenFlags.CLONE_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OpenFlags.RIGHT_* flags together with OpenFlags.CLONE_SAME_RIGHTS.

Request

NameType
flags OpenFlags
object request<Node>

Close

Terminates the connection to the node.

After calling Close, the client must not send any other requests. Servers, after sending the status response, should close the connection regardless of status and without sending an epitaph.

Closing the client end of the channel should be semantically equivalent to calling Close without knowing when the close has completed or its status.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Close_Result

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

<EMPTY>

Response

NameType
info NodeInfo

Describe2

Returns extra connection information and auxiliary handles.

  • query specifies the fields in ConnectionInfo that the caller is interested in.

When all known bits in query are set, the return value matches the one from OnConnectionInfo, as if the caller requested that event using ConnectionFlags.GET_CONNECTION_INFO.

If the Describe operation fails, the connection is closed with the associated error.

This method does not require any rights.

Request

NameType
query ConnectionInfoQuery

Response

NameType
info ConnectionInfo

Enumerate

Initiates a directory listing operation over the input channel, starting at seek offset 0.

This method requires the Rights.ENUMERATE right. If this right is absent, iterator will be closed with a ZX_ERR_ACCESS_DENIED epitaph.

Request

NameType
options DirectoryEnumerateOptions
iterator request<DirectoryIterator>

GetAttr

Acquires information about the node.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
s zx/status
attributes NodeAttributes

GetAttributes

Acquires information about the node.

The attributes of a node should be stable, independent of the specific protocol used to access it.

  • query a bit-mask specifying which attributes to fetch. The server should not return more than necessary.
  • attributes the returned attributes.

This method requires the Rights.GET_ATTRIBUTES right.

Request

NameType
query NodeAttributesQuery

Response

NameType
result Node2_GetAttributes_Result

GetFlags

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

This method does not require any rights.

Request

<EMPTY>

Response

NameType
s zx/status
flags OpenFlags

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: OpenFlags.RIGHT_WRITABLE, otherwise returns ZX_ERR_BAD_HANDLE.

Request

<EMPTY>

Response

NameType
s zx/status
token handle<handle>?

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: OpenFlags.RIGHT_WRITABLE, otherwise returns ZX_ERR_BAD_HANDLE.

NameType
src string[255]
dst_parent_token handle<handle>
dst string[255]
NameType
s zx/status

OnConnectionInfo

An event produced eagerly by the server if requested by ConnectionFlags.GET_CONNECTION_INFO. This event will be the first message from the server, and is sent exactly once.

  • info See ConnectionInfo for details on the fields. All members should be present.

Different from fuchsia.io/OnOpen, an error during open/reopen is always manifested as an epitaph.

Response

NameType
info ConnectionInfo

OnOpen

An event produced eagerly by a FIDL server if requested by OpenFlags.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

NameType
s zx/status
info NodeInfo?

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. A trailing slash implies OpenFlags.DIRECTORY. Components must not be empty (i.e. "foo//bar" is invalid). ".." is disallowed anywhere in the path. "." is only allowed if the path is exactly ".", but not otherwise. A leading '/' is allowed (and is treated the same way as if not present, i.e. "/foo/bar' and "foo/bar" are the same).

If an unknown value is sent for flags the connection should be closed.

OpenFlags.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.

mode is only used if an object is created and indicates the type of object to be created. An unsupported mode will cause the connection to be closed. The mode type, if set, must always be consistent with the OpenFlags.DIRECTORY and OpenFlags.NOT_DIRECTORY flags, even if an object is not being created. If an object is not being created, mode is otherwise ignored. If an object is being created and the mode type is not set, a directory will be created if OpenFlags.DIRECTORY is set (explicitly or implicitly), or otherwise a server chosen object type.

Request

NameType
flags OpenFlags
mode uint32
path string[4096]
object request<Node>

Open2

Opens or creates a new node relative to this directory node.

  • path identifies the node to open. If path contains multiple segments, then the directory is traversed, one segment at a time, relative to the directory represented by this connection. See Path for what constitutes a valid path. To open another connection to the current directory, use Node2.Reopen instead.
  • mode controls whether to open existing/create new etc.
  • options additional options applicable to both Open and Reopen, including negotiating protocol and restricting rights. See ConnectionOptions.
  • object_request is the server end of a channel created for the new connection. The caller may proceed to send messages on the corresponding client end right away.

This method requires the following rights on the current connection:

Errors are presented as an epitaph on the object_request channel.

  • error ZX_ERR_ACCESS_DENIED if the requested rights exceeds what is allowed.
  • error ZX_ERR_BAD_PATH if path is invalid.

Request

NameType
path Path
mode OpenMode
options ConnectionOptions
object_request handle<channel>

QueryFilesystem

Query the filesystem for filesystem-specific information.

Request

<EMPTY>

Response

NameType
s zx/status
info FilesystemInfo?

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. Each call to ReadDirents will only return whole dirent structures, they will not get split across ReadDirent calls.

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 `DirentType` 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

NameType
max_bytes uint64

Response

NameType
s zx/status
dirents vector<uint8>[8192]

Rename

Renames a node named src to the name dst, in a directory represented by dst_parent_token.

src and dst must be valid node names. See Name for what constitutes a valid name.

This method requires the following rights on both the current connection, and the connection identified by dst_parent_token:

Request

NameType
src Name
dst_parent_token Token
dst Name

Response

NameType
result Directory2_Rename_Result

Reopen

Creates another connection to the same node.

  • options options applicable to both Open and Reopen, including negotiating protocol and restricting rights. See ConnectionOptions.
  • object_request is the server end of a channel created for the new connection. The caller may proceed to send messages on the corresponding client end right away.

For files, the cloned connection and the original connection have independent seek offsets.

Request

NameType
options ConnectionOptions
object_request handle<channel>

Rewind

Resets the directory seek offset.

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

Request

<EMPTY>

Response

NameType
s zx/status

SetAttr

Updates information about the node.

This method requires following rights: OpenFlags.RIGHT_WRITABLE, otherwise returns ZX_ERR_BAD_HANDLE.

Request

NameType
flags NodeAttributeFlags
attributes NodeAttributes

Response

NameType
s zx/status

SetFlags

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

  • OpenFlags.APPEND

This method does not require any rights.

Request

NameType
flags OpenFlags

Response

NameType
s zx/status

Sync

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

This method will return when the filesystem server has flushed the relevant updates to the underlying media, but does not guarantee the underlying media has persisted the information, nor that any information is committed to hardware. Clients may use Sync to ensure ordering between operations.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Sync_Result

Removes a child node from the this directory's list of entries.

Note: this does not guarantee that the underlying object is destroyed. 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 closed.

  • error ZX_ERR_ACCESS_DENIED if the connection does not have Rights.WRITE_BYTES.
  • error ZX_ERR_NOT_SUPPORTED if the underlying filesystem does not support writing.
  • error ZX_ERR_BAD_PATH if name is invalid.
  • error ZX_ERR_NOT_EMPTY if name refers to a non-empty directory.
  • error ZX_ERR_UNAVAILABLE if name refers to a mount point, containing a remote channel.
  • error ZX_ERR_NOT_DIR if the options requested a directory but something other than a directory was found.

Other errors may be returned for filesystem-specific reasons.

This method requires the following rights:

NameType
name Name
options UnlinkOptions
NameType
result Directory2_Unlink_Result

UpdateAttributes

Updates information about the node.

  • attributes the presence of a table field in attributes indicates the intent to update the corresponding attribute.

This method requires the Rights.UPDATE_ATTRIBUTES right.

Request

NameType
attributes NodeAttributes2

Response

NameType
result Node2_UpdateAttributes_Result

Watch

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

Options must be zero; it is reserved.

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

Request

NameType
mask WatchMask
options uint32
watcher request<DirectoryWatcher>

Response

NameType
s zx/status

Directory1

Defined in fuchsia.io/directory.fidl

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

Clone

Create another connection to the same remote object.

flags may be any of:

  • OpenFlags.RIGHT_*
  • OpenFlags.APPEND
  • OpenFlags.NO_REMOTE
  • OpenFlags.DESCRIBE
  • OpenFlags.CLONE_SAME_RIGHTS

All other flags are ignored.

The OpenFlags.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, otherwise returns ZX_ERR_ACCESS_DENIED. Alternatively, pass OpenFlags.CLONE_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OpenFlags.RIGHT_* flags together with OpenFlags.CLONE_SAME_RIGHTS.

Request

NameType
flags OpenFlags
object request<Node>

Close

Terminates the connection to the node.

After calling Close, the client must not send any other requests. Servers, after sending the status response, should close the connection regardless of status and without sending an epitaph.

Closing the client end of the channel should be semantically equivalent to calling Close without knowing when the close has completed or its status.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Close_Result

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

<EMPTY>

Response

NameType
info NodeInfo

Describe2

Returns extra connection information and auxiliary handles.

  • query specifies the fields in ConnectionInfo that the caller is interested in.

When all known bits in query are set, the return value matches the one from OnConnectionInfo, as if the caller requested that event using ConnectionFlags.GET_CONNECTION_INFO.

If the Describe operation fails, the connection is closed with the associated error.

This method does not require any rights.

Request

NameType
query ConnectionInfoQuery

Response

NameType
info ConnectionInfo

GetAttr

Acquires information about the node.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
s zx/status
attributes NodeAttributes

GetAttributes

Acquires information about the node.

The attributes of a node should be stable, independent of the specific protocol used to access it.

  • query a bit-mask specifying which attributes to fetch. The server should not return more than necessary.
  • attributes the returned attributes.

This method requires the Rights.GET_ATTRIBUTES right.

Request

NameType
query NodeAttributesQuery

Response

NameType
result Node2_GetAttributes_Result

GetFlags

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

This method does not require any rights.

Request

<EMPTY>

Response

NameType
s zx/status
flags OpenFlags

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: OpenFlags.RIGHT_WRITABLE, otherwise returns ZX_ERR_BAD_HANDLE.

Request

<EMPTY>

Response

NameType
s zx/status
token handle<handle>?

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: OpenFlags.RIGHT_WRITABLE, otherwise returns ZX_ERR_BAD_HANDLE.

NameType
src string[255]
dst_parent_token handle<handle>
dst string[255]
NameType
s zx/status

OnConnectionInfo

An event produced eagerly by the server if requested by ConnectionFlags.GET_CONNECTION_INFO. This event will be the first message from the server, and is sent exactly once.

  • info See ConnectionInfo for details on the fields. All members should be present.

Different from fuchsia.io/OnOpen, an error during open/reopen is always manifested as an epitaph.

Response

NameType
info ConnectionInfo

OnOpen

An event produced eagerly by a FIDL server if requested by OpenFlags.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

NameType
s zx/status
info NodeInfo?

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. A trailing slash implies OpenFlags.DIRECTORY. Components must not be empty (i.e. "foo//bar" is invalid). ".." is disallowed anywhere in the path. "." is only allowed if the path is exactly ".", but not otherwise. A leading '/' is allowed (and is treated the same way as if not present, i.e. "/foo/bar' and "foo/bar" are the same).

If an unknown value is sent for flags the connection should be closed.

OpenFlags.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.

mode is only used if an object is created and indicates the type of object to be created. An unsupported mode will cause the connection to be closed. The mode type, if set, must always be consistent with the OpenFlags.DIRECTORY and OpenFlags.NOT_DIRECTORY flags, even if an object is not being created. If an object is not being created, mode is otherwise ignored. If an object is being created and the mode type is not set, a directory will be created if OpenFlags.DIRECTORY is set (explicitly or implicitly), or otherwise a server chosen object type.

Request

NameType
flags OpenFlags
mode uint32
path string[4096]
object request<Node>

QueryFilesystem

Query the filesystem for filesystem-specific information.

Request

<EMPTY>

Response

NameType
s zx/status
info FilesystemInfo?

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. Each call to ReadDirents will only return whole dirent structures, they will not get split across ReadDirent calls.

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 `DirentType` 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

NameType
max_bytes uint64

Response

NameType
s zx/status
dirents vector<uint8>[8192]

Reopen

Creates another connection to the same node.

  • options options applicable to both Open and Reopen, including negotiating protocol and restricting rights. See ConnectionOptions.
  • object_request is the server end of a channel created for the new connection. The caller may proceed to send messages on the corresponding client end right away.

For files, the cloned connection and the original connection have independent seek offsets.

Request

NameType
options ConnectionOptions
object_request handle<channel>

Rewind

Resets the directory seek offset.

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

Request

<EMPTY>

Response

NameType
s zx/status

SetAttr

Updates information about the node.

This method requires following rights: OpenFlags.RIGHT_WRITABLE, otherwise returns ZX_ERR_BAD_HANDLE.

Request

NameType
flags NodeAttributeFlags
attributes NodeAttributes

Response

NameType
s zx/status

SetFlags

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

  • OpenFlags.APPEND

This method does not require any rights.

Request

NameType
flags OpenFlags

Response

NameType
s zx/status

Sync

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

This method will return when the filesystem server has flushed the relevant updates to the underlying media, but does not guarantee the underlying media has persisted the information, nor that any information is committed to hardware. Clients may use Sync to ensure ordering between operations.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Sync_Result

UpdateAttributes

Updates information about the node.

  • attributes the presence of a table field in attributes indicates the intent to update the corresponding attribute.

This method requires the Rights.UPDATE_ATTRIBUTES right.

Request

NameType
attributes NodeAttributes2

Response

NameType
result Node2_UpdateAttributes_Result

Watch

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

Options must be zero; it is reserved.

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

Request

NameType
mask WatchMask
options uint32
watcher request<DirectoryWatcher>

Response

NameType
s zx/status

Directory2

Defined in fuchsia.io/directory2.fidl

A Node2 that is capable of containing other nodes.

AddInotifyFilter

Adds a new inotify filter for an object relative to this directory object.

  • 'filter` is a mask of different inotify events that need to be watched by the server for a specific file/directory.

  • path may contain multiple segments, separated by "/" characters, and should never be empty; i.e., "" is an invalid path. Paths should not contain a leading "/".

+watch_descriptor is client assigned value to identify a filter. Server shouldn't trust the client-assigned watch_descriptor. They should just send it back to the client in the socket. This value is not used by server, but it is returned back as part of InotifyEvent, to help the client correlate filter with events on this filter.

  • socket is shared between different filter objects i.e every new filter will have a different server end of the socket and there will be a single client end per inotify instance on inotify init.

Request

NameType
path Path
filter InotifyWatchMask
watch_descriptor uint32
socket handle<socket>

Response

<EMPTY>

AdvisoryLock

Acquires an advisory lock on the underlying file.

The lock lasts until either this connection is closed or this method is called with |AdvisoryLockType.UNLOCK| to release the lock explicitly.

Advisory locks are purely advisory. They do not prevent actual read or write operations from occurring on the file, either through this connection or through other connections.

This method requires the following rights:

Errors

  • ZX_ERR_BAD_STATE The specified type of lock cannot be acquired. For example, another connection might hold a conflicting lock type.
  • ZX_ERR_NOT_SUPPORTED This file does not support advisory locking.
  • ZX_ERR_ACCESS_DENIED This connection does not have sufficient rights to acquire the given type of lock.

Request

NameType
request AdvisoryLockRequest

Response

NameType
result AdvisoryLocking_AdvisoryLock_Result

Close

Terminates the connection to the node.

After calling Close, the client must not send any other requests. Servers, after sending the status response, should close the connection regardless of status and without sending an epitaph.

Closing the client end of the channel should be semantically equivalent to calling Close without knowing when the close has completed or its status.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Close_Result

Describe2

Returns extra connection information and auxiliary handles.

  • query specifies the fields in ConnectionInfo that the caller is interested in.

When all known bits in query are set, the return value matches the one from OnConnectionInfo, as if the caller requested that event using ConnectionFlags.GET_CONNECTION_INFO.

If the Describe operation fails, the connection is closed with the associated error.

This method does not require any rights.

Request

NameType
query ConnectionInfoQuery

Response

NameType
info ConnectionInfo

Enumerate

Initiates a directory listing operation over the input channel, starting at seek offset 0.

This method requires the Rights.ENUMERATE right. If this right is absent, iterator will be closed with a ZX_ERR_ACCESS_DENIED epitaph.

Request

NameType
options DirectoryEnumerateOptions
iterator request<DirectoryIterator>

GetAttributes

Acquires information about the node.

The attributes of a node should be stable, independent of the specific protocol used to access it.

  • query a bit-mask specifying which attributes to fetch. The server should not return more than necessary.
  • attributes the returned attributes.

This method requires the Rights.GET_ATTRIBUTES right.

Request

NameType
query NodeAttributesQuery

Response

NameType
result Node2_GetAttributes_Result

OnConnectionInfo

An event produced eagerly by the server if requested by ConnectionFlags.GET_CONNECTION_INFO. This event will be the first message from the server, and is sent exactly once.

  • info See ConnectionInfo for details on the fields. All members should be present.

Different from fuchsia.io/OnOpen, an error during open/reopen is always manifested as an epitaph.

Response

NameType
info ConnectionInfo

Open2

Opens or creates a new node relative to this directory node.

  • path identifies the node to open. If path contains multiple segments, then the directory is traversed, one segment at a time, relative to the directory represented by this connection. See Path for what constitutes a valid path. To open another connection to the current directory, use Node2.Reopen instead.
  • mode controls whether to open existing/create new etc.
  • options additional options applicable to both Open and Reopen, including negotiating protocol and restricting rights. See ConnectionOptions.
  • object_request is the server end of a channel created for the new connection. The caller may proceed to send messages on the corresponding client end right away.

This method requires the following rights on the current connection:

Errors are presented as an epitaph on the object_request channel.

  • error ZX_ERR_ACCESS_DENIED if the requested rights exceeds what is allowed.
  • error ZX_ERR_BAD_PATH if path is invalid.

Request

NameType
path Path
mode OpenMode
options ConnectionOptions
object_request handle<channel>

Rename

Renames a node named src to the name dst, in a directory represented by dst_parent_token.

src and dst must be valid node names. See Name for what constitutes a valid name.

This method requires the following rights on both the current connection, and the connection identified by dst_parent_token:

Request

NameType
src Name
dst_parent_token Token
dst Name

Response

NameType
result Directory2_Rename_Result

Reopen

Creates another connection to the same node.

  • options options applicable to both Open and Reopen, including negotiating protocol and restricting rights. See ConnectionOptions.
  • object_request is the server end of a channel created for the new connection. The caller may proceed to send messages on the corresponding client end right away.

For files, the cloned connection and the original connection have independent seek offsets.

Request

NameType
options ConnectionOptions
object_request handle<channel>

Sync

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

This method will return when the filesystem server has flushed the relevant updates to the underlying media, but does not guarantee the underlying media has persisted the information, nor that any information is committed to hardware. Clients may use Sync to ensure ordering between operations.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Sync_Result

Removes a child node from the this directory's list of entries.

Note: this does not guarantee that the underlying object is destroyed. 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 closed.

  • error ZX_ERR_ACCESS_DENIED if the connection does not have Rights.WRITE_BYTES.
  • error ZX_ERR_NOT_SUPPORTED if the underlying filesystem does not support writing.
  • error ZX_ERR_BAD_PATH if name is invalid.
  • error ZX_ERR_NOT_EMPTY if name refers to a non-empty directory.
  • error ZX_ERR_UNAVAILABLE if name refers to a mount point, containing a remote channel.
  • error ZX_ERR_NOT_DIR if the options requested a directory but something other than a directory was found.

Other errors may be returned for filesystem-specific reasons.

This method requires the following rights:

NameType
name Name
options UnlinkOptions
NameType
result Directory2_Unlink_Result

UpdateAttributes

Updates information about the node.

  • attributes the presence of a table field in attributes indicates the intent to update the corresponding attribute.

This method requires the Rights.UPDATE_ATTRIBUTES right.

Request

NameType
attributes NodeAttributes2

Response

NameType
result Node2_UpdateAttributes_Result

DirectoryIterator

Defined in fuchsia.io/directory2.fidl

GetNext

Reads a collection of variably sized directory entries into a buffer.

The number of entries 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 Enumerate. The caller should always use a receiving buffer size as large as the maximum channel limit.

When the end of iteration is reached, the returned entries vector will be empty.

This method does not require any rights, as the rights are checked in the Directory.Enumerate call.

Request

<EMPTY>

Response

NameType
result DirectoryIterator_GetNext_Result

DirectoryWatcher

Defined in fuchsia.io/directory.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.

The DirectoryWatcher will send messages of the form:

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

Where names are NOT null-terminated.

File

Defined in fuchsia.io/file.fidl

AdvisoryLock

Acquires an advisory lock on the underlying file.

The lock lasts until either this connection is closed or this method is called with |AdvisoryLockType.UNLOCK| to release the lock explicitly.

Advisory locks are purely advisory. They do not prevent actual read or write operations from occurring on the file, either through this connection or through other connections.

This method requires the following rights:

Errors

  • ZX_ERR_BAD_STATE The specified type of lock cannot be acquired. For example, another connection might hold a conflicting lock type.
  • ZX_ERR_NOT_SUPPORTED This file does not support advisory locking.
  • ZX_ERR_ACCESS_DENIED This connection does not have sufficient rights to acquire the given type of lock.

Request

NameType
request AdvisoryLockRequest

Response

NameType
result AdvisoryLocking_AdvisoryLock_Result

Clone

Create another connection to the same remote object.

flags may be any of:

  • OpenFlags.RIGHT_*
  • OpenFlags.APPEND
  • OpenFlags.NO_REMOTE
  • OpenFlags.DESCRIBE
  • OpenFlags.CLONE_SAME_RIGHTS

All other flags are ignored.

The OpenFlags.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, otherwise returns ZX_ERR_ACCESS_DENIED. Alternatively, pass OpenFlags.CLONE_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OpenFlags.RIGHT_* flags together with OpenFlags.CLONE_SAME_RIGHTS.

Request

NameType
flags OpenFlags
object request<Node>

Close

Terminates the connection to the node.

After calling Close, the client must not send any other requests. Servers, after sending the status response, should close the connection regardless of status and without sending an epitaph.

Closing the client end of the channel should be semantically equivalent to calling Close without knowing when the close has completed or its status.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Close_Result

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

<EMPTY>

Response

NameType
info NodeInfo

Describe2

Returns extra connection information and auxiliary handles.

  • query specifies the fields in ConnectionInfo that the caller is interested in.

When all known bits in query are set, the return value matches the one from OnConnectionInfo, as if the caller requested that event using ConnectionFlags.GET_CONNECTION_INFO.

If the Describe operation fails, the connection is closed with the associated error.

This method does not require any rights.

Request

NameType
query ConnectionInfoQuery

Response

NameType
info ConnectionInfo

GetAttr

Acquires information about the node.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
s zx/status
attributes NodeAttributes

GetAttributes

Acquires information about the node.

The attributes of a node should be stable, independent of the specific protocol used to access it.

  • query a bit-mask specifying which attributes to fetch. The server should not return more than necessary.
  • attributes the returned attributes.

This method requires the Rights.GET_ATTRIBUTES right.

Request

NameType
query NodeAttributesQuery

Response

NameType
result Node2_GetAttributes_Result

GetBackingMemory

Acquires a zx.handle:VMO representing this file, if there is one, with the requested access rights.

  • request flags a VmoFlags indicating the desired mode of access.
  • error a zx.status value indicating the failure.

This method requires the following rights:

Request

NameType
flags VmoFlags

Response

NameType
result File2_GetBackingMemory_Result

GetFlags

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

This method does not require any rights.

Request

<EMPTY>

Response

NameType
s zx/status
flags OpenFlags

OnConnectionInfo

An event produced eagerly by the server if requested by ConnectionFlags.GET_CONNECTION_INFO. This event will be the first message from the server, and is sent exactly once.

  • info See ConnectionInfo for details on the fields. All members should be present.

Different from fuchsia.io/OnOpen, an error during open/reopen is always manifested as an epitaph.

Response

NameType
info ConnectionInfo

OnOpen

An event produced eagerly by a FIDL server if requested by OpenFlags.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

NameType
s zx/status
info NodeInfo?

QueryFilesystem

Query the filesystem for filesystem-specific information.

Request

<EMPTY>

Response

NameType
s zx/status
info FilesystemInfo?

Read

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

Invariants

  • The returned data.length will never be greater than count.
  • If data.length is less than count, it means that the seek offset has reached the end of file as part of this operation.
  • If data.length is zero while count is not, it means that the seek offset is already at or beyond the end of file, and no data could be read.
  • If count is zero, the server should perform all the checks ensuring read access without actually read anything, and return an empty data vector.

This method requires the Rights.READ_BYTES right.

Returns ZX_ERR_OUT_OF_RANGE if count is greater than MAX_TRANSFER_SIZE.

Request

NameType
count uint64

Response

NameType
result File2_Read_Result

ReadAt

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

Invariants

  • The returned data.length will never be greater than count.
  • If data.length is less than count, it means that ReadAt has hit the end of file as part of this operation.
  • If data.length is zero while count is not, it means that offset is at or past the end of file, and no data can be read.
  • If count is zero, the server should perform all the checks ensuring read access without actually reading anything, and return an empty data vector.

This method requires the Rights.READ_BYTES right.

Returns ZX_ERR_OUT_OF_RANGE if count is greater than MAX_TRANSFER_SIZE.

Request

NameType
count uint64
offset uint64

Response

NameType
result File2_ReadAt_Result

Reopen

Creates another connection to the same node.

  • options options applicable to both Open and Reopen, including negotiating protocol and restricting rights. See ConnectionOptions.
  • object_request is the server end of a channel created for the new connection. The caller may proceed to send messages on the corresponding client end right away.

For files, the cloned connection and the original connection have independent seek offsets.

Request

NameType
options ConnectionOptions
object_request handle<channel>

Resize

Shrinks or grows the file size to 'length' bytes.

If file size is reduced by this operation, the extra trailing data' is discarded. If file size is increased by this operation, the extended area appears as if it was zeroed.

This method requires the Rights.WRITE_BYTES right.

Request

NameType
length uint64

Response

NameType
result File2_Resize_Result

Seek

Moves the offset at which the next invocation of Read or Write will occur. The seek offset is specific to each file connection.

  • request origin the reference point where offset will be based on.
  • request offset the number of bytes to seek.
  • response offset_from_start the adjusted seek offset, from the start of the file.

This method does not require any rights.

Request

NameType
origin SeekOrigin
offset int64

Response

NameType
result File2_Seek_Result

SetAttr

Updates information about the node.

This method requires following rights: OpenFlags.RIGHT_WRITABLE, otherwise returns ZX_ERR_BAD_HANDLE.

Request

NameType
flags NodeAttributeFlags
attributes NodeAttributes

Response

NameType
s zx/status

SetFlags

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

  • OpenFlags.APPEND

This method does not require any rights.

Request

NameType
flags OpenFlags

Response

NameType
s zx/status

Sync

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

This method will return when the filesystem server has flushed the relevant updates to the underlying media, but does not guarantee the underlying media has persisted the information, nor that any information is committed to hardware. Clients may use Sync to ensure ordering between operations.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Sync_Result

UpdateAttributes

Updates information about the node.

  • attributes the presence of a table field in attributes indicates the intent to update the corresponding attribute.

This method requires the Rights.UPDATE_ATTRIBUTES right.

Request

NameType
attributes NodeAttributes2

Response

NameType
result Node2_UpdateAttributes_Result

Write

Writes data at the seek offset. The seek offset is moved forward by the number of bytes written. If the file is in append mode, the seek offset is first set to the end of the file, followed by the write, in one atomic step.

The file size may grow if the seek offset plus data.length is beyond the current end of file.

  • request data the byte buffer to write to the file.
  • response actual_count the number of bytes written.

Invariants

  • The returned actual_count will never be greater than data.length.
  • If the server is unable to write all the data due to e.g. not enough space, actual_count may be less than data.length.
  • If data.length is zero, the server should perform all the checks ensuring write access without mutating the file. The seek offset is still updated if in append mode.

This method requires the Rights.WRITE_BYTES right.

Request

NameType
data Transfer

Response

NameType
result File2_Write_Result

WriteAt

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

The file size may grow if offset plus data.length is past the current end of file.

  • request data the byte buffer to write to the file.
  • request offset the offset from start of the file to begin writing.
  • response actual_count the number of bytes written.

Invariants

  • The returned actual_count will never be greater than data.length.
  • If the server is unable to write all the data due to e.g. not enough space, actual_count may be less than data.length.
  • If data.length is zero, the server should perform all the checks ensuring write access without mutating the file.

This method requires the Rights.WRITE_BYTES right.

Request

NameType
data Transfer
offset uint64

Response

NameType
result File2_WriteAt_Result

WriteDeprecated

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

This method requires following rights: OpenFlags.RIGHT_WRITABLE, otherwise returns ZX_ERR_BAD_HANDLE.

DEPRECATED - replaced by File2.Write

#### Request {:#File.WriteDeprecated_Request transformation="converted"}
NameType
data vector<uint8>[8192]
#### Response {:#File.WriteDeprecated_Response transformation="converted"}
NameType
s zx/status
actual uint64
## File1 {:#File1 transformation="converted"} *Defined in [fuchsia.io/file.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.io/file.fidl;l=15)*

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

Clone

Create another connection to the same remote object.

flags may be any of:

  • OpenFlags.RIGHT_*
  • OpenFlags.APPEND
  • OpenFlags.NO_REMOTE
  • OpenFlags.DESCRIBE
  • OpenFlags.CLONE_SAME_RIGHTS

All other flags are ignored.

The OpenFlags.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, otherwise returns ZX_ERR_ACCESS_DENIED. Alternatively, pass OpenFlags.CLONE_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OpenFlags.RIGHT_* flags together with OpenFlags.CLONE_SAME_RIGHTS.

Request

NameType
flags OpenFlags
object request<Node>

Close

Terminates the connection to the node.

After calling Close, the client must not send any other requests. Servers, after sending the status response, should close the connection regardless of status and without sending an epitaph.

Closing the client end of the channel should be semantically equivalent to calling Close without knowing when the close has completed or its status.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Close_Result

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

<EMPTY>

Response

NameType
info NodeInfo

Describe2

Returns extra connection information and auxiliary handles.

  • query specifies the fields in ConnectionInfo that the caller is interested in.

When all known bits in query are set, the return value matches the one from OnConnectionInfo, as if the caller requested that event using ConnectionFlags.GET_CONNECTION_INFO.

If the Describe operation fails, the connection is closed with the associated error.

This method does not require any rights.

Request

NameType
query ConnectionInfoQuery

Response

NameType
info ConnectionInfo

GetAttr

Acquires information about the node.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
s zx/status
attributes NodeAttributes

GetAttributes

Acquires information about the node.

The attributes of a node should be stable, independent of the specific protocol used to access it.

  • query a bit-mask specifying which attributes to fetch. The server should not return more than necessary.
  • attributes the returned attributes.

This method requires the Rights.GET_ATTRIBUTES right.

Request

NameType
query NodeAttributesQuery

Response

NameType
result Node2_GetAttributes_Result

GetFlags

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

This method does not require any rights.

Request

<EMPTY>

Response

NameType
s zx/status
flags OpenFlags

OnConnectionInfo

An event produced eagerly by the server if requested by ConnectionFlags.GET_CONNECTION_INFO. This event will be the first message from the server, and is sent exactly once.

  • info See ConnectionInfo for details on the fields. All members should be present.

Different from fuchsia.io/OnOpen, an error during open/reopen is always manifested as an epitaph.

Response

NameType
info ConnectionInfo

OnOpen

An event produced eagerly by a FIDL server if requested by OpenFlags.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

NameType
s zx/status
info NodeInfo?

QueryFilesystem

Query the filesystem for filesystem-specific information.

Request

<EMPTY>

Response

NameType
s zx/status
info FilesystemInfo?

Reopen

Creates another connection to the same node.

  • options options applicable to both Open and Reopen, including negotiating protocol and restricting rights. See ConnectionOptions.
  • object_request is the server end of a channel created for the new connection. The caller may proceed to send messages on the corresponding client end right away.

For files, the cloned connection and the original connection have independent seek offsets.

Request

NameType
options ConnectionOptions
object_request handle<channel>

SetAttr

Updates information about the node.

This method requires following rights: OpenFlags.RIGHT_WRITABLE, otherwise returns ZX_ERR_BAD_HANDLE.

Request

NameType
flags NodeAttributeFlags
attributes NodeAttributes

Response

NameType
s zx/status

SetFlags

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

  • OpenFlags.APPEND

This method does not require any rights.

Request

NameType
flags OpenFlags

Response

NameType
s zx/status

Sync

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

This method will return when the filesystem server has flushed the relevant updates to the underlying media, but does not guarantee the underlying media has persisted the information, nor that any information is committed to hardware. Clients may use Sync to ensure ordering between operations.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Sync_Result

UpdateAttributes

Updates information about the node.

  • attributes the presence of a table field in attributes indicates the intent to update the corresponding attribute.

This method requires the Rights.UPDATE_ATTRIBUTES right.

Request

NameType
attributes NodeAttributes2

Response

NameType
result Node2_UpdateAttributes_Result

WriteDeprecated

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

This method requires following rights: OpenFlags.RIGHT_WRITABLE, otherwise returns ZX_ERR_BAD_HANDLE.

DEPRECATED - replaced by File2.Write

#### Request {:#File1.WriteDeprecated_Request transformation="converted"}
NameType
data vector<uint8>[8192]
#### Response {:#File1.WriteDeprecated_Response transformation="converted"}
NameType
s zx/status
actual uint64
## File2 {:#File2 transformation="converted"} *Defined in [fuchsia.io/file2.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.io/file2.fidl;l=19)*

A Node2 which contains a sequence of bytes of definite length.

AdvisoryLock

Acquires an advisory lock on the underlying file.

The lock lasts until either this connection is closed or this method is called with |AdvisoryLockType.UNLOCK| to release the lock explicitly.

Advisory locks are purely advisory. They do not prevent actual read or write operations from occurring on the file, either through this connection or through other connections.

This method requires the following rights:

Errors

  • ZX_ERR_BAD_STATE The specified type of lock cannot be acquired. For example, another connection might hold a conflicting lock type.
  • ZX_ERR_NOT_SUPPORTED This file does not support advisory locking.
  • ZX_ERR_ACCESS_DENIED This connection does not have sufficient rights to acquire the given type of lock.

Request

NameType
request AdvisoryLockRequest

Response

NameType
result AdvisoryLocking_AdvisoryLock_Result

Close

Terminates the connection to the node.

After calling Close, the client must not send any other requests. Servers, after sending the status response, should close the connection regardless of status and without sending an epitaph.

Closing the client end of the channel should be semantically equivalent to calling Close without knowing when the close has completed or its status.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Close_Result

Describe2

Returns extra connection information and auxiliary handles.

  • query specifies the fields in ConnectionInfo that the caller is interested in.

When all known bits in query are set, the return value matches the one from OnConnectionInfo, as if the caller requested that event using ConnectionFlags.GET_CONNECTION_INFO.

If the Describe operation fails, the connection is closed with the associated error.

This method does not require any rights.

Request

NameType
query ConnectionInfoQuery

Response

NameType
info ConnectionInfo

GetAttributes

Acquires information about the node.

The attributes of a node should be stable, independent of the specific protocol used to access it.

  • query a bit-mask specifying which attributes to fetch. The server should not return more than necessary.
  • attributes the returned attributes.

This method requires the Rights.GET_ATTRIBUTES right.

Request

NameType
query NodeAttributesQuery

Response

NameType
result Node2_GetAttributes_Result

GetBackingMemory

Acquires a zx.handle:VMO representing this file, if there is one, with the requested access rights.

  • request flags a VmoFlags indicating the desired mode of access.
  • error a zx.status value indicating the failure.

This method requires the following rights:

Request

NameType
flags VmoFlags

Response

NameType
result File2_GetBackingMemory_Result

OnConnectionInfo

An event produced eagerly by the server if requested by ConnectionFlags.GET_CONNECTION_INFO. This event will be the first message from the server, and is sent exactly once.

  • info See ConnectionInfo for details on the fields. All members should be present.

Different from fuchsia.io/OnOpen, an error during open/reopen is always manifested as an epitaph.

Response

NameType
info ConnectionInfo

Read

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

Invariants

  • The returned data.length will never be greater than count.
  • If data.length is less than count, it means that the seek offset has reached the end of file as part of this operation.
  • If data.length is zero while count is not, it means that the seek offset is already at or beyond the end of file, and no data could be read.
  • If count is zero, the server should perform all the checks ensuring read access without actually read anything, and return an empty data vector.

This method requires the Rights.READ_BYTES right.

Returns ZX_ERR_OUT_OF_RANGE if count is greater than MAX_TRANSFER_SIZE.

Request

NameType
count uint64

Response

NameType
result File2_Read_Result

ReadAt

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

Invariants

  • The returned data.length will never be greater than count.
  • If data.length is less than count, it means that ReadAt has hit the end of file as part of this operation.
  • If data.length is zero while count is not, it means that offset is at or past the end of file, and no data can be read.
  • If count is zero, the server should perform all the checks ensuring read access without actually reading anything, and return an empty data vector.

This method requires the Rights.READ_BYTES right.

Returns ZX_ERR_OUT_OF_RANGE if count is greater than MAX_TRANSFER_SIZE.

Request

NameType
count uint64
offset uint64

Response

NameType
result File2_ReadAt_Result

Reopen

Creates another connection to the same node.

  • options options applicable to both Open and Reopen, including negotiating protocol and restricting rights. See ConnectionOptions.
  • object_request is the server end of a channel created for the new connection. The caller may proceed to send messages on the corresponding client end right away.

For files, the cloned connection and the original connection have independent seek offsets.

Request

NameType
options ConnectionOptions
object_request handle<channel>

Resize

Shrinks or grows the file size to 'length' bytes.

If file size is reduced by this operation, the extra trailing data' is discarded. If file size is increased by this operation, the extended area appears as if it was zeroed.

This method requires the Rights.WRITE_BYTES right.

Request

NameType
length uint64

Response

NameType
result File2_Resize_Result

Seek

Moves the offset at which the next invocation of Read or Write will occur. The seek offset is specific to each file connection.

  • request origin the reference point where offset will be based on.
  • request offset the number of bytes to seek.
  • response offset_from_start the adjusted seek offset, from the start of the file.

This method does not require any rights.

Request

NameType
origin SeekOrigin
offset int64

Response

NameType
result File2_Seek_Result

Sync

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

This method will return when the filesystem server has flushed the relevant updates to the underlying media, but does not guarantee the underlying media has persisted the information, nor that any information is committed to hardware. Clients may use Sync to ensure ordering between operations.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Sync_Result

UpdateAttributes

Updates information about the node.

  • attributes the presence of a table field in attributes indicates the intent to update the corresponding attribute.

This method requires the Rights.UPDATE_ATTRIBUTES right.

Request

NameType
attributes NodeAttributes2

Response

NameType
result Node2_UpdateAttributes_Result

Write

Writes data at the seek offset. The seek offset is moved forward by the number of bytes written. If the file is in append mode, the seek offset is first set to the end of the file, followed by the write, in one atomic step.

The file size may grow if the seek offset plus data.length is beyond the current end of file.

  • request data the byte buffer to write to the file.
  • response actual_count the number of bytes written.

Invariants

  • The returned actual_count will never be greater than data.length.
  • If the server is unable to write all the data due to e.g. not enough space, actual_count may be less than data.length.
  • If data.length is zero, the server should perform all the checks ensuring write access without mutating the file. The seek offset is still updated if in append mode.

This method requires the Rights.WRITE_BYTES right.

Request

NameType
data Transfer

Response

NameType
result File2_Write_Result

WriteAt

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

The file size may grow if offset plus data.length is past the current end of file.

  • request data the byte buffer to write to the file.
  • request offset the offset from start of the file to begin writing.
  • response actual_count the number of bytes written.

Invariants

  • The returned actual_count will never be greater than data.length.
  • If the server is unable to write all the data due to e.g. not enough space, actual_count may be less than data.length.
  • If data.length is zero, the server should perform all the checks ensuring write access without mutating the file.

This method requires the Rights.WRITE_BYTES right.

Request

NameType
data Transfer
offset uint64

Response

NameType
result File2_WriteAt_Result

Inotifier

Defined in fuchsia.io/inotify.fidl

Inotifier implements the linux Inotify functionality. It provides a mechanism for monitoring filesystem events. Inotify can be used to monitor individual files, or to monitor directories. When a directory is monitored, inotify will return events for the directory itself, and for files inside the directory.

Node

Defined in fuchsia.io/node.fidl

Clone

Create another connection to the same remote object.

flags may be any of:

  • OpenFlags.RIGHT_*
  • OpenFlags.APPEND
  • OpenFlags.NO_REMOTE
  • OpenFlags.DESCRIBE
  • OpenFlags.CLONE_SAME_RIGHTS

All other flags are ignored.

The OpenFlags.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, otherwise returns ZX_ERR_ACCESS_DENIED. Alternatively, pass OpenFlags.CLONE_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OpenFlags.RIGHT_* flags together with OpenFlags.CLONE_SAME_RIGHTS.

Request

NameType
flags OpenFlags
object request<Node>

Close

Terminates the connection to the node.

After calling Close, the client must not send any other requests. Servers, after sending the status response, should close the connection regardless of status and without sending an epitaph.

Closing the client end of the channel should be semantically equivalent to calling Close without knowing when the close has completed or its status.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Close_Result

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

<EMPTY>

Response

NameType
info NodeInfo

Describe2

Returns extra connection information and auxiliary handles.

  • query specifies the fields in ConnectionInfo that the caller is interested in.

When all known bits in query are set, the return value matches the one from OnConnectionInfo, as if the caller requested that event using ConnectionFlags.GET_CONNECTION_INFO.

If the Describe operation fails, the connection is closed with the associated error.

This method does not require any rights.

Request

NameType
query ConnectionInfoQuery

Response

NameType
info ConnectionInfo

GetAttr

Acquires information about the node.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
s zx/status
attributes NodeAttributes

GetAttributes

Acquires information about the node.

The attributes of a node should be stable, independent of the specific protocol used to access it.

  • query a bit-mask specifying which attributes to fetch. The server should not return more than necessary.
  • attributes the returned attributes.

This method requires the Rights.GET_ATTRIBUTES right.

Request

NameType
query NodeAttributesQuery

Response

NameType
result Node2_GetAttributes_Result

GetFlags

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

This method does not require any rights.

Request

<EMPTY>

Response

NameType
s zx/status
flags OpenFlags

OnConnectionInfo

An event produced eagerly by the server if requested by ConnectionFlags.GET_CONNECTION_INFO. This event will be the first message from the server, and is sent exactly once.

  • info See ConnectionInfo for details on the fields. All members should be present.

Different from fuchsia.io/OnOpen, an error during open/reopen is always manifested as an epitaph.

Response

NameType
info ConnectionInfo

OnOpen

An event produced eagerly by a FIDL server if requested by OpenFlags.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

NameType
s zx/status
info NodeInfo?

QueryFilesystem

Query the filesystem for filesystem-specific information.

Request

<EMPTY>

Response

NameType
s zx/status
info FilesystemInfo?

Reopen

Creates another connection to the same node.

  • options options applicable to both Open and Reopen, including negotiating protocol and restricting rights. See ConnectionOptions.
  • object_request is the server end of a channel created for the new connection. The caller may proceed to send messages on the corresponding client end right away.

For files, the cloned connection and the original connection have independent seek offsets.

Request

NameType
options ConnectionOptions
object_request handle<channel>

SetAttr

Updates information about the node.

This method requires following rights: OpenFlags.RIGHT_WRITABLE, otherwise returns ZX_ERR_BAD_HANDLE.

Request

NameType
flags NodeAttributeFlags
attributes NodeAttributes

Response

NameType
s zx/status

SetFlags

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

  • OpenFlags.APPEND

This method does not require any rights.

Request

NameType
flags OpenFlags

Response

NameType
s zx/status

Sync

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

This method will return when the filesystem server has flushed the relevant updates to the underlying media, but does not guarantee the underlying media has persisted the information, nor that any information is committed to hardware. Clients may use Sync to ensure ordering between operations.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Sync_Result

UpdateAttributes

Updates information about the node.

  • attributes the presence of a table field in attributes indicates the intent to update the corresponding attribute.

This method requires the Rights.UPDATE_ATTRIBUTES right.

Request

NameType
attributes NodeAttributes2

Response

NameType
result Node2_UpdateAttributes_Result

Node1

Defined in fuchsia.io/node.fidl

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

Clone

Create another connection to the same remote object.

flags may be any of:

  • OpenFlags.RIGHT_*
  • OpenFlags.APPEND
  • OpenFlags.NO_REMOTE
  • OpenFlags.DESCRIBE
  • OpenFlags.CLONE_SAME_RIGHTS

All other flags are ignored.

The OpenFlags.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, otherwise returns ZX_ERR_ACCESS_DENIED. Alternatively, pass OpenFlags.CLONE_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OpenFlags.RIGHT_* flags together with OpenFlags.CLONE_SAME_RIGHTS.

Request

NameType
flags OpenFlags
object request<Node>

Close

Terminates the connection to the node.

After calling Close, the client must not send any other requests. Servers, after sending the status response, should close the connection regardless of status and without sending an epitaph.

Closing the client end of the channel should be semantically equivalent to calling Close without knowing when the close has completed or its status.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Close_Result

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

<EMPTY>

Response

NameType
info NodeInfo

Describe2

Returns extra connection information and auxiliary handles.

  • query specifies the fields in ConnectionInfo that the caller is interested in.

When all known bits in query are set, the return value matches the one from OnConnectionInfo, as if the caller requested that event using ConnectionFlags.GET_CONNECTION_INFO.

If the Describe operation fails, the connection is closed with the associated error.

This method does not require any rights.

Request

NameType
query ConnectionInfoQuery

Response

NameType
info ConnectionInfo

GetAttr

Acquires information about the node.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
s zx/status
attributes NodeAttributes

GetAttributes

Acquires information about the node.

The attributes of a node should be stable, independent of the specific protocol used to access it.

  • query a bit-mask specifying which attributes to fetch. The server should not return more than necessary.
  • attributes the returned attributes.

This method requires the Rights.GET_ATTRIBUTES right.

Request

NameType
query NodeAttributesQuery

Response

NameType
result Node2_GetAttributes_Result

GetFlags

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

This method does not require any rights.

Request

<EMPTY>

Response

NameType
s zx/status
flags OpenFlags

OnConnectionInfo

An event produced eagerly by the server if requested by ConnectionFlags.GET_CONNECTION_INFO. This event will be the first message from the server, and is sent exactly once.

  • info See ConnectionInfo for details on the fields. All members should be present.

Different from fuchsia.io/OnOpen, an error during open/reopen is always manifested as an epitaph.

Response

NameType
info ConnectionInfo

OnOpen

An event produced eagerly by a FIDL server if requested by OpenFlags.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

NameType
s zx/status
info NodeInfo?

QueryFilesystem

Query the filesystem for filesystem-specific information.

Request

<EMPTY>

Response

NameType
s zx/status
info FilesystemInfo?

Reopen

Creates another connection to the same node.

  • options options applicable to both Open and Reopen, including negotiating protocol and restricting rights. See ConnectionOptions.
  • object_request is the server end of a channel created for the new connection. The caller may proceed to send messages on the corresponding client end right away.

For files, the cloned connection and the original connection have independent seek offsets.

Request

NameType
options ConnectionOptions
object_request handle<channel>

SetAttr

Updates information about the node.

This method requires following rights: OpenFlags.RIGHT_WRITABLE, otherwise returns ZX_ERR_BAD_HANDLE.

Request

NameType
flags NodeAttributeFlags
attributes NodeAttributes

Response

NameType
s zx/status

SetFlags

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

  • OpenFlags.APPEND

This method does not require any rights.

Request

NameType
flags OpenFlags

Response

NameType
s zx/status

Sync

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

This method will return when the filesystem server has flushed the relevant updates to the underlying media, but does not guarantee the underlying media has persisted the information, nor that any information is committed to hardware. Clients may use Sync to ensure ordering between operations.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Sync_Result

UpdateAttributes

Updates information about the node.

  • attributes the presence of a table field in attributes indicates the intent to update the corresponding attribute.

This method requires the Rights.UPDATE_ATTRIBUTES right.

Request

NameType
attributes NodeAttributes2

Response

NameType
result Node2_UpdateAttributes_Result

Node2

Defined in fuchsia.io/node2.fidl

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

Close

Terminates the connection to the node.

After calling Close, the client must not send any other requests. Servers, after sending the status response, should close the connection regardless of status and without sending an epitaph.

Closing the client end of the channel should be semantically equivalent to calling Close without knowing when the close has completed or its status.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Close_Result

Describe2

Returns extra connection information and auxiliary handles.

  • query specifies the fields in ConnectionInfo that the caller is interested in.

When all known bits in query are set, the return value matches the one from OnConnectionInfo, as if the caller requested that event using ConnectionFlags.GET_CONNECTION_INFO.

If the Describe operation fails, the connection is closed with the associated error.

This method does not require any rights.

Request

NameType
query ConnectionInfoQuery

Response

NameType
info ConnectionInfo

GetAttributes

Acquires information about the node.

The attributes of a node should be stable, independent of the specific protocol used to access it.

  • query a bit-mask specifying which attributes to fetch. The server should not return more than necessary.
  • attributes the returned attributes.

This method requires the Rights.GET_ATTRIBUTES right.

Request

NameType
query NodeAttributesQuery

Response

NameType
result Node2_GetAttributes_Result

OnConnectionInfo

An event produced eagerly by the server if requested by ConnectionFlags.GET_CONNECTION_INFO. This event will be the first message from the server, and is sent exactly once.

  • info See ConnectionInfo for details on the fields. All members should be present.

Different from fuchsia.io/OnOpen, an error during open/reopen is always manifested as an epitaph.

Response

NameType
info ConnectionInfo

Reopen

Creates another connection to the same node.

  • options options applicable to both Open and Reopen, including negotiating protocol and restricting rights. See ConnectionOptions.
  • object_request is the server end of a channel created for the new connection. The caller may proceed to send messages on the corresponding client end right away.

For files, the cloned connection and the original connection have independent seek offsets.

Request

NameType
options ConnectionOptions
object_request handle<channel>

Sync

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

This method will return when the filesystem server has flushed the relevant updates to the underlying media, but does not guarantee the underlying media has persisted the information, nor that any information is committed to hardware. Clients may use Sync to ensure ordering between operations.

This method does not require any rights.

Request

<EMPTY>

Response

NameType
result Node2_Sync_Result

UpdateAttributes

Updates information about the node.

  • attributes the presence of a table field in attributes indicates the intent to update the corresponding attribute.

This method requires the Rights.UPDATE_ATTRIBUTES right.

Request

NameType
attributes NodeAttributes2

Response

NameType
result Node2_UpdateAttributes_Result

STRUCTS

AdvisoryLockRange

Defined in fuchsia.io/locking.fidl

FieldTypeDescriptionDefault
origin SeekOrigin

The location in the file from which offset is computed.

No default
offset int64

The start of the byte range, expressed as an offset from origin. Cannot be negative if origin is SeekOrigin.START.

No default
length int64

The length of the byte range in bytes.

If the length is zero, then the byte range extends until the end of the file, regardless of how large the file becomes.

If the length is negative, the byte range includes the bytes offset + length up to, and including, offset - 1, provided this range does not extend beyond the beginning of the file.

No default

AdvisoryLocking_AdvisoryLock_Response

Defined in fuchsia.io/locking.fidl

<EMPTY>

DatagramSocket resource

Defined in fuchsia.io/node.fidl

FieldTypeDescriptionDefault
socket handle<socket>

See fuchsia.posix.socket.DatagramSocket for details.

No default
tx_meta_buf_size uint64

Size of the buffer used to receive Tx metadata.

No default
rx_meta_buf_size uint64

Size of the buffer used to receive Rx metadata.

No default

Device resource

Defined in fuchsia.io/node.fidl

FieldTypeDescriptionDefault
unused handle<eventpair>?

An optional event which transmits information about a device's state.

The "DEVICE_SIGNAL_" values may be observed on this event.

No default

Directory2_Rename_Response

Defined in fuchsia.io/directory2.fidl

<EMPTY>

Defined in fuchsia.io/directory2.fidl

<EMPTY>

DirectoryIterator_GetNext_Response

Defined in fuchsia.io/directory2.fidl

FieldTypeDescriptionDefault
entries vector<DirectoryEntry>[8192]

Information about an immediate child node of a directory.

If a particular attribute is not applicable or not supported, implementations should leave the corresponding field absent.

No default

DirectoryObject

Defined in fuchsia.io/node.fidl

<EMPTY>

File2_GetBackingMemory_Response resource

Defined in fuchsia.io/file2.fidl

FieldTypeDescriptionDefault
vmo handle<vmo> No default

File2_ReadAt_Response

Defined in fuchsia.io/file2.fidl

FieldTypeDescriptionDefault
data Transfer No default

File2_Read_Response

Defined in fuchsia.io/file2.fidl

FieldTypeDescriptionDefault
data Transfer No default

File2_Resize_Response

Defined in fuchsia.io/file2.fidl

<EMPTY>

File2_Seek_Response

Defined in fuchsia.io/file2.fidl

FieldTypeDescriptionDefault
offset_from_start uint64 No default

File2_WriteAt_Response

Defined in fuchsia.io/file2.fidl

FieldTypeDescriptionDefault
actual_count uint64 No default

File2_Write_Response

Defined in fuchsia.io/file2.fidl

FieldTypeDescriptionDefault
actual_count uint64 No default

FileObject resource

Defined in fuchsia.io/node.fidl

FieldTypeDescriptionDefault
event handle<event>?

An optional event which transmits information about an object's readability or writability. This event relays information about the underlying object, not the capability granted to client: this event may be signalled "readable" on a connection that does not have the capability to read.

The "FILE_SIGNAL_" values may be observed on this event.

No default
stream handle<stream>?

A placeholder for future stream support.

Currently, servers are required not to send a handle in this field.

No default

FilesystemInfo

Defined in fuchsia.io/node.fidl

FieldTypeDescriptionDefault
total_bytes uint64

The number of data bytes which may be stored in a filesystem. This does not count metadata or other filesystem overhead like block rounding.

No default
used_bytes uint64

The number of data bytes which are in use by the filesystem. This does not count metadata or other filesystem overhead like block rounding.

No default
total_nodes uint64

The number of nodes which may be stored in the filesystem.

No default
used_nodes uint64

The number of nodes used by the filesystem.

No default
free_shared_pool_bytes uint64

The amount of additional space which may be allocated from the underlying volume manager. If unsupported or there is no space for the filesystem to grow, this will be zero.

No default
fs_id uint64

A unique identifier for this filesystem instance. Will not be preserved across reboots.

Implementors should create a kernel object (normally an event) and use its koid for the filesystem ID. This koid guarantees uniqueness in the system.

No default
block_size uint32

The size in bytes of a single filesystem block.

No default
max_filename_size uint32

The maximum length of a filesystem name.

No default
fs_type uint32

A unique identifier for the type of the underlying filesystem.

No default
padding uint32 No default
name int8[32] No default

InotifyEvent

Defined in fuchsia.io/inotify.fidl

FieldTypeDescriptionDefault
watch_descriptor uint32 No default
mask InotifyWatchMask No default
cookie uint32 No default
len uint32 No default
filename Path No default

Node2_Close_Response

Defined in fuchsia.io/node2.fidl

<EMPTY>

Node2_GetAttributes_Response

Defined in fuchsia.io/node2.fidl

FieldTypeDescriptionDefault
attributes NodeAttributes2 No default

Node2_Sync_Response

Defined in fuchsia.io/node2.fidl

<EMPTY>

Node2_UpdateAttributes_Response

Defined in fuchsia.io/node2.fidl

<EMPTY>

NodeAttributes

Defined in fuchsia.io/node.fidl

NodeAttributes defines generic information about a filesystem node.

FieldTypeDescriptionDefault
mode uint32

Protection bits and node type information describe in 'mode'.

No default
id uint64

A filesystem-unique ID.

No default
content_size uint64

Node size, in bytes.

No default
storage_size uint64

Space needed to store node (possibly larger than size), in bytes.

No default
creation_time uint64

Time of creation (may be updated manually after creation) in ns since Unix epoch, UTC.

No default
modification_time uint64

Time of last modification in ns since Unix epoch, UTC.

No default

PacketSocket resource

Defined in fuchsia.io/node.fidl

FieldTypeDescriptionDefault
event handle<eventpair>

See fuchsia.posix.socket.packet.Socket for details.

No default

PipeObject resource

Defined in fuchsia.io/node.fidl

FieldTypeDescriptionDefault
socket handle<socket> No default

RawSocket resource

Defined in fuchsia.io/node.fidl

FieldTypeDescriptionDefault
event handle<eventpair>

See fuchsia.posix.socket.raw.Socket for details.

No default

RightsRequest

Defined in fuchsia.io/connection-options.fidl

FieldTypeDescriptionDefault
at_most Rights

Sets an upper bound on the resulting rights. The exact rights will depend on resolution.

Implementation Notes

When a directory proxy encounters this variant, it should compute the intersection between this and the rights on the connection where it received the request, to shrink the rights.

  • If the intersection is empty, or not a superset of at_least, the proxy should close object_request with the ZX_ERR_ACCESS_DENIED epitaph.
  • Otherwise, the proxy should forward the Open call as usual, but update at_most with the shrunk rights.
No default
at_least Rights

Sets a lower bound on the resulting rights. The exact rights will depend on resolution.

  • During Directory.Open, you may only specify the same rights as what the directory connection already has, or a subset of those.
  • During Node.Reopen, similarly, you may only specify the same or a subset of rights possessed by the original connection.
  • Exceeding those rights causes object_request to be closed with a ZX_ERR_ACCESS_DENIED epitaph.

Therefore there are these invariants which should be maintained:

at_most ⊋ {}
at_most ⊃ at_least
rights_on_connection_where_open_is_received ⊋ {}
rights_on_connection_where_open_is_received ⊃ at_least

using the superset (), proper superset (), and empty set ({}) notations.

No default
resolution RightsResolution

When an Open/Reopen request reaches its final remote server, it should assign rights on the new connection based on one of these modes.

No default

Service

Defined in fuchsia.io/node.fidl

<EMPTY>

StreamSocket resource

Defined in fuchsia.io/node.fidl

FieldTypeDescriptionDefault
socket handle<socket> No default

SynchronousDatagramSocket resource

Defined in fuchsia.io/node.fidl

FieldTypeDescriptionDefault
event handle<eventpair>

See fuchsia.posix.socket.SynchronousDatagramSocket for details.

No default

Tty resource

Defined in fuchsia.io/node.fidl

FieldTypeDescriptionDefault
event handle<eventpair>? No default

Vmofile resource

Defined in fuchsia.io/node.fidl

FieldTypeDescriptionDefault
vmo handle<vmo>

The VMO which backs this file.

No default
offset uint64

The index into vmo which represents the first byte of the file.

No default
length uint64

The number of bytes, starting at offset, which may be used to represent this file.

No default

ENUMS

AdvisoryLockType strict

Type: uint32

Defined in fuchsia.io/locking.fidl

NameValueDescription
1

Zero or more connections can hold read locks on a file simultaneously.

2

At most one connection can hold a write lock on a file simultaneously. When a write lock is held on a file, no other types of locks can be held on that file.

3

The region specifies a region to be unlocked.

DirentType strict

Type: uint8

Defined in fuchsia.io/directory.fidl

NameValueDescription
0

A dirent with an unknown type.

4

A dirent representing a directory object.

6

A dirent representing a block device object.

8

A dirent representing a file object.

12

A dirent representing a socket object.

16

A dirent representing a service object.

OpenMode strict

Type: uint32

Defined in fuchsia.io/directory2.fidl

Options related to node creation during Directory.Open.

NameValueDescription
1

Only succeed if the object exists.

2

Create the object if it does not exist, otherwise open existing. The check and the creation are performed in one atomic step.

3

Assert that the object does not exist, then create it. The assertion and creation are performed in one atomic step.

268435456

If the object is a mount point, open the local directory instead of forwarding the request. The object must be a directory.

This option implies the behavior of OPEN_EXISTING.

DEPRECATED - Mount points will be replaced by components.

RightsResolution strict

Type: uint32

Defined in fuchsia.io/connection-options.fidl

NameValueDescription
1

The rights will be the intersection between RightsRequest.at_most and the connection where the Open/Reopen request was received, closing object_request with ZX_ERR_ACCESS_DENIED if it is empty.

2

The rights will be determined by the following rules:

  • If the negotiated protocol on the new connection is Directory, the rules from the MAXIMIZE case applies.
  • Otherwise, the rights will be RightsRequest.at_least if it does not exceed rights on the current connection.
  • Otherwise, object_request should be closed with ZX_ERR_ACCESS_DENIED.

The motivation for this enum is to facilitate implementing POSIX compatibility layers. The POSIX file permission model relies on ambient authority: access control on files are resolved based on the mode of the file, and the current user. There is no concept of hierarchical permissions. Fuchsia, on the other hand, restricts rights on file connections to never exceed that of its containing directory connection.

SeekOrigin strict

Type: uint32

Defined in fuchsia.io/file2.fidl

The reference point for updating the seek offset. See File.Seek.

This enum matches the zx_stream_seek_origin_t enum.

NameValueDescription
0

Seek from the start of the file. The seek offset will be set to offset bytes. The seek offset cannot be negative in this case.

1

Seek from the current position in the file. The seek offset will be the current seek offset plus offset bytes.

2

Seek from the end of the file. The seek offset will be the file size plus offset bytes.

WatchEvent strict

Type: uint8

Defined in fuchsia.io/directory.fidl

NameValueDescription
0

Indicates the directory being watched has been deleted.

1

Indicates a node has been created (either new or moved) into a directory.

2

Identifies a node has been removed (either deleted or moved) from the directory.

3

Identifies a node already existed in the directory when watching started.

4

Identifies that no more EXISTING events will be sent.

TABLES

AdvisoryLockRequest

Defined in fuchsia.io/locking.fidl

OrdinalFieldTypeDescription
type AdvisoryLockType

The type of lock to be acquired.

If this field is absent, the AdvisoryLock method will fail with ZX_ERR_INVALID_ARGS.

range AdvisoryLockRange

The byte range within the file to be locked.

The range can extend beyond the end of the file but cannot extend beyond the beginning of the file.

If this field is absent, the range defaults to the entire file.

wait bool

Whether the file should wait reply to the AdvisoryLock method until the requested lock can be acquired.

If this field is absent, the file will not wait.

ConnectionInfo resource

Defined in fuchsia.io/connection-info.fidl

Returns run-time information about a node that is specific to the current connection.

OrdinalFieldTypeDescription
representation Representation

The active variant corresponds to one of the supported protocols of the node, and represents the result of the connection-time negotiation. Provides auxiliary handles if applicable.

Describes how the connection should be handled, and provides auxiliary handles and information for the connection where applicable. Refer to Node.Describe and Node.OnConnectionInfo.

If handles are returned which offer alternative ways of access to the node, the rights on the handles should correspond to the rights on the connection.

If the client specified more than one protocol in protocols during Directory.Open or Node.Reopen, the Representation carries additionally the result of the connection-time negotiation via its tag.

The elements have one-to-one correspondence with the members of NodeProtocols.

rights Rights

Information about the rights possessed by the current connection. Note: rights limits the set of operations allowed on the connection, but does not guarantee their availability. For example, one may have the Rights.EXECUTE right on a file connection, but the file itself does not have the EXECUTE ability, and hence cannot be executed. See ConnectionOptions.rights.

available_operations Operations

The set of available operations on this channel. It is always the intersection between the rights possessed by this connection, and the abilities of the node. The value may be zero in the case of an empty intersection. See ConnectionOptions.rights.

ConnectionOptions

Defined in fuchsia.io/connection-options.fidl

Options for Directory.Open and Node.Reopen.

OrdinalFieldTypeDescription
flags ConnectionFlags

Flags which can affect the behavior when opening and reopening. If absent, assumes a default of zero.

protocols NodeProtocols

Specifies the set of representations accepted by the client, to support a form of protocol negotiation on the node being opened. Refer to the definition of NodeProtocols for more details. It cannot be zero.

In addition, clients may assert the type of the object by setting the protocol corresponding to the expected type:

  • If the caller expected a directory but the node cannot be accessed as a directory, the error is ZX_ERR_NOT_DIR.
  • If the caller expected a file but the node cannot be accessed as a file, the error is ZX_ERR_NOT_FILE.
  • In other mismatched cases, the error is ZX_ERR_WRONG_TYPE.

During Directory.Open, if a new object is to be created, protocols determines the type of object to create; it must be present. If a valid object type cannot be unambiguously inferred e.g. both DIRECTORY and FILE were set, the request must fail.

During Node.Reopen, clients may specify a different but compatible protocols to do a "protocol upgrade".

If more than one protocol is present in protocols, the resultant protocol may become any one of them. Clients should specify ConnectionFlags.GET_CONNECTION_INFO to receive a Node.OnConnectionInfo event, in order to ascertain the protocol.

If absent, indicates that the caller accepts any type of node, and the resulting protocol is unspecified.

rights_request RightsRequest

Requests rights on the new connection according to the specified rules. See RightsRequest.

Rights Hierarchy

Respecting principles of least privileges, rights in general must meet the following restrictions:

  • A connection must have nonzero rights.
  • From the perspective of a client, rights must never increase in a derived connection.
  • From the perspective of a directory proxy, it must ensure that new connections opened through it cannot have more rights than the connection where the proxy received the Open/Reopen call.

The proper enforcement of the rights hierarchy is a powerful refinement over the existing access control facilities offered by directory sandboxing.

Rights Inheritance

If rights_request is absent, inherits at most the rights on the source connection:

  • During Node.Reopen, the new connection would have the same rights as the connection where the Reopen call is made.
  • During Directory.Open, the rights on the connection would inherit from the connection where the Open call is made. If the path crosses intermediate proxies, a proxy may strip elements from the resulting rights if the intermediate connection does not have the corresponding rights.

Rights vs Abilities

The rights on a connection limits the set of operations allowed on that connection, but does not guarantee their availability, because the object may not support it. For convenience, clients may query the ConnectionInfo.available_operations field on a new connection, which is the intersection of the rights and abilities and indicates the guaranteed set of available operations.

See Rights and Abilities.

Implementation Notes

When a directory proxy encounters an absent rights field, let r be the rights on the connection where it received this request, the proxy should fill in this field with the following:

RightsRequest {
    at_most: r,
    at_least: 0,
    resolution: RightsResolution.MAXIMIZE,
}

before forwarding the request to the remote party.

Options for requesting rights on the new connection. Because opening a new connection may involve multiple hops through directory proxies, we require the client to set an upper bound and lower bound on the rights request, and intermediate proxies to refine these bounds.

The rights manipulation should be implemented mechanically without knowledge of any specific rights, and servers should propagate unknown bits members, to gracefully handle future rights extensions.

Implementation Notes

It could be common for a client to request an exact set of rights. We recommend client libraries to define a helper function like follows:

fn Exact(exact_rights: Rights) -> RightsRequest {
    RightsRequest {
        at_most: exact_rights,
        at_least: exact_rights,
        resolution: RightsResolution.MAXIMIZE,
    }
}

ConnectorInfo

Defined in fuchsia.io/connection-info.fidl

OrdinalFieldTypeDescription

DatagramSocketInfo resource

Defined in fuchsia.io/connection-info.fidl

OrdinalFieldTypeDescription
socket handle<socket>

See fuchsia.posix.socket.DatagramSocket for details.

tx_meta_buf_size uint64

Size of the buffer used to receive Tx metadata.

rx_meta_buf_size uint64

Size of the buffer used to receive Rx metadata.

DeviceInfo resource

Defined in fuchsia.io/connection-info.fidl

OrdinalFieldTypeDescription
unused handle<eventpair>

An optional event which transmits information about a device's state.

The DeviceSignal values may be observed on this event.

DirectoryEntry

Defined in fuchsia.io/directory2.fidl

OrdinalFieldTypeDescription
name Name

Name of the node. This field must be present.

protocols NodeProtocols

Describes the kinds of representations supported by the node.

abilities Abilities

Describes the kinds of operations supported by the node.

id Id

An ID for the node. See Id. This id should be unique among all entries of a directory.

DirectoryEnumerateOptions

Defined in fuchsia.io/directory2.fidl

OrdinalFieldTypeDescription

DirectoryInfo

Defined in fuchsia.io/connection-info.fidl

OrdinalFieldTypeDescription

FileInfo resource

Defined in fuchsia.io/connection-info.fidl

OrdinalFieldTypeDescription
observer handle<event>

An optional event which transmits information about an object's readability or writability. This event relays information about the underlying object, not the capability granted to client: this event may be signalled "readable" on a connection that does not have the capability to read.

This event will be present if the following conditions are met:

  • The available_operations on the file connection is not empty.
  • The filesystem supports signalling readability/writability events.

The FileSignal values may be observed on this event.

is_append bool

Returns if the file is opened in append mode. In append mode, the seek offset is moved to the end before every write, the two steps performed in an atomic manner.

stream handle<stream>

An optional stream object, which can be used to read to and write from the file.

Reading and writing the file using the stream object can be up to 20x faster than reading and writing the file using the Read and Write operations in the File protocol.

MemoryInfo resource

Defined in fuchsia.io/connection-info.fidl

OrdinalFieldTypeDescription
buffer fuchsia.mem/Range

Although a VMO is returned as a part of this structure, that VMO may back multiple files. To identify the logical portion of the VMO that represents the single file, offset and size are also supplied.

If the range covers the entire VMO (i.e. the offset is zero and the length matches the size of the VMO), then all clients must receive a VMO with the same koid. This can be a duplicate of the same underlying page-aligned VMO.

The rights on this VMO should correspond to the rights on the node connection.

NodeAttributes2

Defined in fuchsia.io/node2.fidl

Objective information about a filesystem node. See Node.GetAttributes and Node.UpdateAttributes.

The attributes of a node should be stable, independent of the specific protocol used to access it.

If a particular attribute is not applicable or not supported, filesystems should leave the corresponding field absent.

OrdinalFieldTypeDescription
protocols NodeProtocols

Describes the kinds of representations supported by the node. Note: This is not the result of the connection-time negotiation, which is conveyed via representation.

This attribute is read-only.

abilities Abilities

Describes the kinds of operations supported by the node. Note: This is distinct from the rights used at connection time.

This attribute is read-only.

content_size uint64

Node size, in bytes.

This attribute is read-only.

storage_size uint64

Space needed to store the node (possibly larger than size), in bytes.

This attribute is read-only.

creation_time uint64

Time of creation in nanoseconds since the Unix epoch, UTC. It may be updated manually after creation.

modification_time uint64

Time of last modification in nanoseconds since the Unix epoch, UTC.

id Id

An ID for the node. See Id. This id should be unique among all entries of a directory.

This attribute is read-only.

PacketSocketInfo resource

Defined in fuchsia.io/connection-info.fidl

OrdinalFieldTypeDescription
event handle<eventpair>

See fuchsia.posix.socket.packet.Socket for details.

PipeInfo resource

Defined in fuchsia.io/connection-info.fidl

OrdinalFieldTypeDescription
socket handle<socket>

The backing socket transport for the pipe. The rights on this socket should correspond to the rights on the node connection.

RawSocketInfo resource

Defined in fuchsia.io/connection-info.fidl

OrdinalFieldTypeDescription
event handle<eventpair>

StreamSocketInfo resource

Defined in fuchsia.io/connection-info.fidl

OrdinalFieldTypeDescription
socket handle<socket>

SynchronousDatagramSocketInfo resource

Defined in fuchsia.io/connection-info.fidl

OrdinalFieldTypeDescription
event handle<eventpair>

TtyInfo resource

Defined in fuchsia.io/connection-info.fidl

OrdinalFieldTypeDescription
event handle<eventpair>

An optional event which transmits information about a device's state.

The DeviceSignal values may be observed on this event.

UnlinkOptions

Defined in fuchsia.io/directory2.fidl

Options for Directory.Unlink.

OrdinalFieldTypeDescription
flags UnlinkFlags

UNIONS

AdvisoryLocking_AdvisoryLock_Result strict

Defined in fuchsia.io/locking.fidl

OrdinalVariantTypeDescription
response AdvisoryLocking_AdvisoryLock_Response
err zx/status

Directory2_Rename_Result strict

Defined in fuchsia.io/directory2.fidl

OrdinalVariantTypeDescription
response Directory2_Rename_Response
err zx/status

Defined in fuchsia.io/directory2.fidl

OrdinalVariantTypeDescription

DirectoryIterator_GetNext_Result strict

Defined in fuchsia.io/directory2.fidl

OrdinalVariantTypeDescription
response DirectoryIterator_GetNext_Response
err zx/status

File2_GetBackingMemory_Result strict resource

Defined in fuchsia.io/file2.fidl

OrdinalVariantTypeDescription
response File2_GetBackingMemory_Response
err zx/status

File2_ReadAt_Result strict

Defined in fuchsia.io/file2.fidl

OrdinalVariantTypeDescription
response File2_ReadAt_Response
err zx/status

File2_Read_Result strict

Defined in fuchsia.io/file2.fidl

OrdinalVariantTypeDescription
response File2_Read_Response
err zx/status

File2_Resize_Result strict

Defined in fuchsia.io/file2.fidl

OrdinalVariantTypeDescription
response File2_Resize_Response
err zx/status

File2_Seek_Result strict

Defined in fuchsia.io/file2.fidl

OrdinalVariantTypeDescription
response File2_Seek_Response
err zx/status

File2_WriteAt_Result strict

Defined in fuchsia.io/file2.fidl

OrdinalVariantTypeDescription
response File2_WriteAt_Response
err zx/status

File2_Write_Result strict

Defined in fuchsia.io/file2.fidl

OrdinalVariantTypeDescription
response File2_Write_Response
err zx/status

Node2_Close_Result strict

Defined in fuchsia.io/node2.fidl

OrdinalVariantTypeDescription
response Node2_Close_Response
err zx/status

Node2_GetAttributes_Result strict

Defined in fuchsia.io/node2.fidl

OrdinalVariantTypeDescription
response Node2_GetAttributes_Response
err zx/status

Node2_Sync_Result strict

Defined in fuchsia.io/node2.fidl

OrdinalVariantTypeDescription
response Node2_Sync_Response
err zx/status

Node2_UpdateAttributes_Result strict

Defined in fuchsia.io/node2.fidl

OrdinalVariantTypeDescription
response Node2_UpdateAttributes_Response
err zx/status

NodeInfo strict resource

Defined in fuchsia.io/node.fidl

Connection information.

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

OrdinalVariantTypeDescription
service Service

No protocol information was supplied by the connection.

file FileObject

The connection composes File.

directory DirectoryObject

The connection composes Directory.

pipe PipeObject

The connection composes Pipe.

vmofile Vmofile

The connection composes File. Its implementation is backed by a VMO.

device Device
tty Tty
synchronous_datagram_socket SynchronousDatagramSocket

The connection composes fuchsia.posix.socket/SynchronousDatagramSocket.

stream_socket StreamSocket

The connection composes fuchsia.posix.socket/StreamSocket.

raw_socket RawSocket

The connection composes fuchsia.posix.socket.raw/Socket.

packet_socket PacketSocket

The connection composes fuchsia.posix.socket.packet/Socket.

datagram_socket DatagramSocket

The connection composes fuchsia.posix.socket/DatagramSocket.

Representation flexible resource

Defined in fuchsia.io/connection-info.fidl

OrdinalVariantTypeDescription
connector ConnectorInfo

Auxiliary data for the connector representation of a node, used for protocol discovery and connection.

It supports connecting to arbitrary protocols exported by the filesystem server at a path, including ones that do not compose Node2.

See NodeProtocols.CONNECTOR.

directory DirectoryInfo

Auxiliary data for the directory representation of a node. The selection of this variant in Representation implies that the connection speaks the Directory protocol.

See NodeProtocols.DIRECTORY.

file FileInfo

Auxiliary data for the file representation of a node. The selection of this variant in Representation implies that the connection speaks the File protocol.

See NodeProtocols.FILE.

memory MemoryInfo

Auxiliary data for the memory object representation of a node. The node is a file which is represented as a VMO. The selection of this variant in Representation implies that the connection speaks the Memory protocol.

See NodeProtocols.MEMORY.

pipe PipeInfo

The pipe representation of a node. A pipe is a data streaming interface, commonly used for standard in/out. There is no universal requirement as to if it is uni- or bi-directional. The selection of this variant in Representation implies that the connection speaks the Pipe protocol.

See NodeProtocols.PIPE.

device DeviceInfo

The object may be cast to the shared interface of devices.

DEPRECATED - devices will be services in the future

tty TtyInfo

The object may be cast to a Tty interface.

DEPRECATED - tty functionalities may be covered by a tty service

synchronous_datagram_socket SynchronousDatagramSocketInfo

The connection composes fuchsia.posix.socket/SynchronousDatagramSocket.

See NodeProtocols.SYNCHRONOUS_DATAGRAM_SOCKET.

datagram_socket DatagramSocketInfo

The connection composes fuchsia.posix.socket/DatagramSocket.

See NodeProtocols.DATAGRAM_SOCKET.

stream_socket StreamSocketInfo

The connection composes fuchsia.posix.socket/StreamSocket.

See NodeProtocols.STREAM_SOCKET.

raw_socket RawSocketInfo

The connection composes fuchsia.posix.socket.raw/Socket.

See NodeProtocols.RAW_SOCKET.

packet_socket PacketSocketInfo

The connection composes fuchsia.posix.socket.packet/Socket.

See NodeProtocols.PACKET_SOCKET.

BITS

ConnectionFlags strict

Type: uint64

Defined in fuchsia.io/connection-options.fidl

NameValueDescription
1

Requests that an Node.OnConnectionInfo event be sent as the first message on the protocol request. Requests all fields in the ConnectionInfo table. Doing so is more efficient than calling Node.Describe later on the connection.

2

Connects to the exposed protocol if the node is a Connector. It is an error to use this flag with other types of nodes.

If both GET_CONNECTION_INFO and CONNECT are specified, the channel will receive exactly one Node.OnConnectionInfo event, after which the protocol switches from Node to the intended protocol. Message sent by the client prior to receiving Node.OnConnectionInfo are queued and processed after the protocol switch.

CONNECT cannot be supplied together with APPEND. CONNECT cannot be supplied together with TRUNCATE.

Requires the Rights.CONNECT right on the connection.

4

Opens the node in append mode, i.e. the connection should seek to the end of the node before every write.

If the node does not support appending, it should result in a ZX_ERR_NOT_SUPPORTED epitaph. Currently, only NodeProtocols.FILE connections may be configured for appending.

8

Truncates the object before usage, by setting its length to 0. Requires the Rights.WRITE_BYTES right on the connection.

If the node does not support truncating, it should result in a ZX_ERR_NOT_SUPPORTED epitaph.

ConnectionInfoQuery strict

Type: uint64

Defined in fuchsia.io/node2.fidl

NameValueDescription
1

Requests ConnectionInfo.representation.

2

Requests ConnectionInfo.rights.

4

Requests ConnectionInfo.available_operations.

FileSignal strict

Type: uint32

Defined in fuchsia.io/file2.fidl

NameValueDescription
16777216

Indicates the file is ready for reading.

33554432

Indicates the file is ready for writing.

InotifyWatchMask strict

Type: uint32

Defined in fuchsia.io/inotify.fidl

Used by InotifyAddWatch to indicate the server the events to be watched on. Also used by Node.Inotify to indicate the types of events that occurred on server side, to be notified to clients. See InotifyEvent.

NameValueDescription
1
2
4
8
16
32
64
128
256
512
1024
2048
8192
16384
32768
16777216
33554432
268435456
536870912
1073741824
2147483648

NodeAttributeFlags strict

Type: uint32

Defined in fuchsia.io/node.fidl

The fields of 'attributes' which are used to update the Node are indicated by the 'flags' argument.

NameValueDescription
1
2

NodeAttributesQuery strict

Type: uint64

Defined in fuchsia.io/node2.fidl

NameValueDescription
1

Requests NodeAttributes.protocols.

2

Requests NodeAttributes.abilities.

4

Requests NodeAttributes.content_size.

8

Requests NodeAttributes.storage_size.

32

Requests NodeAttributes.creation_time.

64

Requests NodeAttributes.modification_time.

128

Requests NodeAttributes.id.

NodeProtocols strict

Type: uint64

Defined in fuchsia.io/node-protocols.fidl

A node may have multiple supported representations when opening, even though it may have a fixed underlying identity.

Today, a file is accessed via the File protocol, and sends a Representation.FileInfo when opened with GET_CONNECTION_INFO. However, in the future we might introduce a more sophisticated FileV2 protocol, or a more efficient SuperFastFile backed by a specialized kernel object. New clients can request the more advanced representations by specifying the corresponding bits in NodeProtocols, whereas existing clients would continue to talk to the node via the old representation.

NodeProtocols enables forward-compatibility through a form of protocol negotiation.

The elements have one-to-one correspondence with the members of Representation.

NameValueDescription
1

The connector representation of a node. The connection will speak either Node, or some custom protocol, depending on the flags used during opening and reopening.

2

The directory representation of a node. The connection will speak the Directory protocol.

4

The file representation of a node. The connection will speak the File protocol.

8

The memory representation of a node. A memory object is a file whose contents are explicitly backed by some VMO. The connection will speak the Memory protocol, and Representation would contain a fuchsia.mem/Range object representing the contents of the file.

16

The pipe representation of a node. The connection will speak the Pipe protocol.

32

The datagram socket representation of a node. The connection will speak the fuchsia.posix.socket/SynchronousDatagramSocket protocol.

64

The stream socket representation of a node. The connection will speak the fuchsia.posix.socket/StreamSocket protocol.

128

The raw socket representation of a node. The connection will speak the fuchsia.posix.socket.raw/Socket protocol.

256

The packet socket representation of a node. The connection will speak the fuchsia.posix.socket.packet/Socket protocol.

512

The datagram socket representation of a node. The connection will speak the fuchsia.posix.socket/DatagramSocket protocol.

268435456

DEPRECATED - devices will be services in the future

536870912

DEPRECATED - tty functionalities may be covered by a tty service

OpenFlags strict

Type: uint32

Defined in fuchsia.io/directory.fidl

NameValueDescription
1

Can read from target object.

2

Can write to target object.

8

Connection can map target object executable.

65536

Create the object if it doesn't exist.

131072

(with Create) Fail if the object already exists.

262144

Truncate the object before usage.

524288

Assert that the object to be opened is a directory. Return an error if the target object is not a directory.

1048576

Seek to the end of the object before all writes.

2097152

If the object is a mount point, open the local directory.

4194304

Open a reference to the object, not the object itself. It is ONLY valid to pass the following flags together with NODE_REFERENCE:

  • DIRECTORY
  • NOT_DIRECTORY
  • DESCRIBE otherwise an error is returned. If an object is opened or cloned using this method, the resulting connection does not carry any permission flags. The resulting node allows a limited set of operations: GetAttr, Clone, Close, Describe, and, if the node is a file, these extra operations: GetFlags, SetFlags.
8388608

Requests that an "OnOpen" event is sent to the interface request. The event will contain a non-null NodeInfo if the open/clone is successful.

16777216

DO NOT USE. In process of being removed. TODO(fxbug.dev/81185): Remove when all clients have updated to the latest SDK.

DEPRECATED - Temporary flag used by servers to maintain binary compatibility with clients.

134217728

Specify this flag to request POSIX-compatibility with respect to write permission handling. Currently, it affects permission handling specifically during Open:

  • If the target path is a directory, the rights on the new connection expand to include WRITABLE if and only if the current connection and all intermediate mount points are writable.
  • Otherwise, this flag is ignored. It is an access denied error to request more rights than those on the current connection, or any intermediate mount points.

If this flag is omitted, 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.

268435456

Specify this flag to request POSIX-compatibility with respect to execute permission handling. Currently, it affects permission handling specifically during Open:

  • If the target path is a directory, the rights on the new connection expand to include EXECUTABLE if and only if the current connection and all intermediate mount points are executable.
  • Otherwise, this flag is ignored. It is an access denied error to request more rights than those on the current connection, or any intermediate mount points.

If this flag is omitted, 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.

33554432

Assert that the object to be opened is not a directory. Return an error if the target object is a directory.

67108864

When used during clone, the new connection inherits the rights on the source connection, regardless if it is a file or directory. Otherwise, clone attempts to use the requested rights. It is invalid to pass any of the RIGHT_* flags together with OpenFlags.CLONE_SAME_RIGHTS.

Operations strict

Type: uint64

Defined in fuchsia.io/rights-abilities.fidl

The common members definition behind Rights and Abilities. Note that Directory operations are distinct from File operations, with the exception of some common operations (e.g. GET_ATTRIBUTES) defined on the underlying Node.

NameValueDescription
1

Connecting to a service.

2

Reading from the byte contents of a node.

4

Writing to the byte contents of a node.

8

Execute the byte contents of a node.

16

Reading the attributes of a node.

32

Updating the attributes of a node.

64

Reading the list of entries in a directory.

128

Opening a node from a directory.

When used in ConnectionOptions.rights, it must be specified together with Rights.ENUMERATE, since one can always probe the directory contents by opening children.

256

Modifying the list of entries in a directory. For example: node creation, renaming, linking, unlinking, etc.

When used in ConnectionOptions.rights, it must be specified together with Rights.ENUMERATE, since one can always probe the directory contents by triggering name conflicts during node creation.

UnlinkFlags strict

Type: uint64

Defined in fuchsia.io/directory2.fidl

Flags for Directory.Unlink.

NameValueDescription
1

If set, the unlink will fail (with ZX_ERR_NOT_DIR) if the object is not a directory.

VmoFlags strict

Type: uint32

Defined in fuchsia.io/file2.fidl

NameValueDescription
1

Requests that the VMO be readable.

2

Requests that the VMO be writable.

4

Request that the VMO be executable.

65536

Require a copy-on-write clone of the underlying VMO. The request should fail if the VMO cannot be cloned. May not be supplied with SHARED_BUFFER.

131072

Require an exact (non-cloned) handle to the underlying VMO. All clients using this flag would get a VMO with the same koid. The request should fail if a handle to the exact VMO cannot be returned. May not be supplied with PRIVATE_CLONE.

WatchMask strict

Type: uint32

Defined in fuchsia.io/directory.fidl

NameValueDescription
1

Used by Directory.Watch. Requests transmission of WatchEvent.DELETED.

2

Used by Directory.Watch. Requests transmission of WatchEvent.ADDED.

4

Used by Directory.Watch. Requests transmission of WatchEvent.REMOVED.

8

Used by Directory.Watch. Requests transmission of WatchEvent.EXISTING.

16

Used by Directory.Watch. Requests transmission of WatchEvent.IDLE.

CONSTANTS

NameValueTypeDescription
CLOSE_ALL
INO_UNKNOWN 18446744073709551615 uint64

Nodes which do not have ino values should return this value from Readdir and GetAttr.

MAX_BUF 8192 uint64

The maximal buffer size which can be transmitted for buffered operations. This capacity is currently set somewhat arbitrarily.

MAX_FILENAME 255 uint64

The maximum length, in bytes, of a single filesystem component.

MAX_FS_NAME_BUFFER 32 uint64
MAX_NAME_LENGTH 255 uint64

The maximum length, in bytes, of a single filesystem component.

MAX_PATH 4096 uint64

The maximum length, in bytes, of a filesystem string.

MAX_PATH_LENGTH 4095 uint64

The maximum length, in bytes, of a filesystem path.

MAX_TRANSFER_SIZE 8192 uint64

The maximum I/O size that is allowed for read/write operations using byte vectors.

MODE_PROTECTION_MASK 4095 uint32

Bits reserved for posix protections. Native fuchsia filesystems are not required to set bits contained within MODE_PROTECTION_MASK, but filesystems that wish to do so may refer to sys/stat.h for their definitions.

MODE_TYPE_BLOCK_DEVICE 24576 uint32
MODE_TYPE_DIRECTORY 16384 uint32
MODE_TYPE_FILE 32768 uint32
MODE_TYPE_MASK 1044480 uint32

Bits indicating node type. The canonical mechanism to check for a node type is to take 'mode', bitwise AND it with the MODE_TYPE_MASK, and check exact equality against a mode type.

MODE_TYPE_SERVICE 65536 uint32
MODE_TYPE_SOCKET 49152 uint32
MOVE
OPEN_FLAGS_ALLOWED_WITH_NODE_REFERENCE

Flags used when opening a node reference must fall within this mask.

OPEN_RIGHTS

All known rights.

RW_STAR_DIR

Alias for directory permission alias rw*

RX_STAR_DIR

Alias for directory permission alias rx*

R_STAR_DIR

Alias for directory permission alias r*

W_STAR_DIR

Alias for directory permission alias w*

X_STAR_DIR

Alias for directory permission alias x*

TYPE ALIASES

NameValueDescription
Abilities fuchsia.io/Operations

Abilities are properties intrinsic to a node. They specify which operations are supported by it.

Invoking an operation without corresponding support in the node results in a ZX_ERR_NOT_SUPPORTED error. Note that if both the access denied and the not supported error conditions apply, the access denied case takes precedence.

Id uint64

The type to identify a node, if the implementation supports some notion of unique node ID.

Uniqueness Guarantees

A client is usually presented with a directory tree that is the result of composing together multiple backing implementation instances. An ID would be unique within the corresponding instance only. Their boundaries are rather implicit on Fuchsia, as a result of transparently-forwarding directory proxies. It could be common for a client to observe identical Ids when traversing a directory tree, when it encounters nodes from different backing instances. Therefore, the ID is best used for debugging and informational purposes.

The fuchsia.fs/FilesystemInfo.fs_id field may be used to disambiguate IDs from different backing instances.

Name string[MAX_NAME_LENGTH]

The type for the name of a node, i.e. a single path component. E.g. foo

Invariants

A valid node name must meet the following criteria:

  • It cannot be longer than MAX_NAME_LENGTH.
  • It cannot be empty.
  • It cannot be ".." (dot-dot).
  • It cannot be "." (single dot).
  • It cannot contain "/".
  • It cannot contain embedded NUL.
Path string[MAX_PATH_LENGTH]

A path is a string of one or more components, separated by "/". E.g. foo/bar/baz

Invariants

A valid path must meet the following criteria:

  • It cannot be empty.
  • It cannot be longer than MAX_PATH_LENGTH.
  • It cannot have a leading "/".
  • It cannot have a trailing "/".
  • Each component must be a valid Name.

Paths should be transformed into their canonical forms at client side. For example, a client should convert "foo/bar/.././baz/" to "foo/baz" before using it as a path.

Rights fuchsia.io/Operations

Rights are properties specific to a connection. They limit which operations are allowed on a connection.

Invoking an operation without the corresponding right results in a ZX_ERR_ACCESS_DENIED error.

Token zx/handle

The type to identify a connection to a node. It represents a capability: a reference to a node with associated rights.

Transfer vector[MAX_TRANSFER_SIZE]

The byte vector type used for read/write operations.