[fidlgen][go] Updating the generated impls
Mechanical
./regen-fidl
With CL
https://fuchsia-review.googlesource.com/c/fuchsia/+/261711
Change-Id: Iaf41f40d1a80f8c118fe0c15460b11a416d091b6
diff --git a/src/syscall/zx/fidl/bindingstest/impl.go b/src/syscall/zx/fidl/bindingstest/impl.go
index 3640dad..89a849d 100644
--- a/src/syscall/zx/fidl/bindingstest/impl.go
+++ b/src/syscall/zx/fidl/bindingstest/impl.go
@@ -1365,17 +1365,17 @@
type Test1Interface _bindings.ChannelProxy
func (p *Test1Interface) Echo(in *string) (*string, error) {
- req_ := Test1EchoRequest{
+ req_ := &Test1EchoRequest{
In: in,
}
- resp_ := Test1EchoResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(Test1EchoOrdinal, &req_, &resp_)
+ resp_ := &Test1EchoResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(Test1EchoOrdinal, req_, resp_)
return resp_.Out, err
}
func (p *Test1Interface) ExpectSurprise() (string, error) {
- resp_ := Test1SurpriseResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Recv(Test1SurpriseOrdinal, &resp_)
+ resp_ := &Test1SurpriseResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Recv(Test1SurpriseOrdinal, resp_)
return resp_.Foo, err
}
@@ -1403,8 +1403,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := Test1EchoResponse{}
out, err_ := s.Impl.Echo(in_.In)
+ out_ := Test1EchoResponse{}
out_.Out = out
return &out_, err_
}
@@ -1427,8 +1427,8 @@
type Test1EventProxy _bindings.ChannelProxy
func (p *Test1EventProxy) Surprise(foo string) error {
- event_ := Test1SurpriseResponse{
+ event_ := &Test1SurpriseResponse{
Foo: foo,
}
- return ((*_bindings.ChannelProxy)(p)).Send(Test1SurpriseOrdinal, &event_)
+ return ((*_bindings.ChannelProxy)(p)).Send(Test1SurpriseOrdinal, event_)
}
diff --git a/src/syscall/zx/io/impl.go b/src/syscall/zx/io/impl.go
index e6fb98f..d8ca499 100644
--- a/src/syscall/zx/io/impl.go
+++ b/src/syscall/zx/io/impl.go
@@ -17,57 +17,136 @@
)
const (
- OpenRightReadable uint32 = 0x00000001
- OpenRightWritable uint32 = 0x00000002
- OpenRightAdmin uint32 = 0x00000004
- OpenFlagCreate uint32 = 0x00010000
- OpenFlagCreateIfAbsent uint32 = 0x00020000
- OpenFlagTruncate uint32 = 0x00040000
- OpenFlagDirectory uint32 = 0x00080000
- OpenFlagAppend uint32 = 0x00100000
- OpenFlagNoRemote uint32 = 0x00200000
- OpenFlagNodeReference uint32 = 0x00400000
- OpenFlagDescribe uint32 = 0x00800000
- ModeProtectionMask uint32 = 0x00FFF
- ModeTypeMask uint32 = 0xFF000
- ModeTypeDirectory uint32 = 0x04000
- ModeTypeBlockDevice uint32 = 0x06000
- ModeTypeFile uint32 = 0x08000
- ModeTypeSocket uint32 = 0x0C000
- ModeTypeService uint32 = 0x10000
- MaxIoctlHandles uint64 = 2
- MaxBuf uint64 = 8192
- MaxPath uint64 = 4096
- MaxFilename uint64 = 255
+ // Can read from target object.
+ OpenRightReadable uint32 = 0x00000001
+ // Can write to target object.
+ OpenRightWritable uint32 = 0x00000002
+ // Connection can mount/umount filesystem.
+ OpenRightAdmin uint32 = 0x00000004
+ // Create the object if it doesn't exist.
+ OpenFlagCreate uint32 = 0x00010000
+ // (with Create) Fail if the object already exists.
+ OpenFlagCreateIfAbsent uint32 = 0x00020000
+ // Truncate the object before usage.
+ OpenFlagTruncate uint32 = 0x00040000
+ // Return an error if the target object is not a directory.
+ OpenFlagDirectory uint32 = 0x00080000
+ // Seek to the end of the object before all writes.
+ OpenFlagAppend uint32 = 0x00100000
+ // If the object is a mount point, open the local directory.
+ OpenFlagNoRemote uint32 = 0x00200000
+ // Open a reference to the object, not the object itself.
+ //
+ // If an object is opened or cloned using this method, all other flags
+ // except for:
+ // - OPEN_FLAG_DIRECTORY
+ // - OPEN_FLAG_DESCRIBE
+ // Are ignored.
+ OpenFlagNodeReference uint32 = 0x00400000
+ // TODO(ZX-1723): Unimplemented.
+ // Binary OR of OPEN_FLAG_DIRECTORY, OPEN_FLAG_NOT_DIRECTORY, OPEN_FLAG_DESCRIBE, and
+ // OPEN_FLAG_NODE_REFERENCE. Flags used when opening a node reference must fall within this mask.
+ OpenFlagsAllowedWithNodeReference uint32 = 0x02c80000
+ // Requests that an "OnOpen" event is sent, with
+ // a non-null NodeInfo (if the open is successful).
+ OpenFlagDescribe uint32 = 0x00800000
+ // TODO(ZX-1723): Unimplemented.
+ // Specify this flag to request POSIX-compatibility. Currently, it affects permission handling.
+ // During Open:
+ // - If the target path is a directory, the rights on the new connection expands to include
+ // OPEN_RIGHT_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 the posix compatibility flag is not specified, opening always uses the requested rights,
+ // failing the operation with access denied error if requested rights exceeds the rights attached
+ // to the current connection.
+ //
+ // If the requesting connection is read-only and the requested rights are read-only, the flag
+ // may be ignored by the server, and is not forwarded downstream. This is an implementation detail,
+ // necessary to enforce hierarchical permissions across mount points, and should have no effect
+ // on the expected behavior for clients.
+ OpenFlagPosix uint32 = 0x01000000
+ // TODO(ZX-1723): Unimplemented.
+ // Assert that the object to be opened is not a directory.
+ // Return an error if the target object is a directory.
+ OpenFlagNotDirectory uint32 = 0x02000000
+ // TODO(ZX-1723): Unimplemented.
+ // 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 OPEN_RIGHT_* flags together with CLONE_FLAGS_SAME_RIGHTS.
+ CloneFlagSameRights uint32 = 0x04000000
+ // 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.
+ ModeProtectionMask uint32 = 0x00FFF
+ // 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.
+ ModeTypeMask uint32 = 0xFF000
+ ModeTypeDirectory uint32 = 0x04000
+ ModeTypeBlockDevice uint32 = 0x06000
+ ModeTypeFile uint32 = 0x08000
+ ModeTypeSocket uint32 = 0x0C000
+ ModeTypeService uint32 = 0x10000
+ MaxIoctlHandles uint64 = 2
+ MaxBuf uint64 = 8192
+ MaxPath uint64 = 4096
+ MaxFilename uint64 = 255
+ // The fields of 'attributes' which are used to update the Node are indicated
+ // by the 'flags' argument.
NodeAttributeFlagCreationTime uint32 = 0x00000001
NodeAttributeFlagModificationTime uint32 = 0x00000002
- VmoFlagRead uint32 = 0x00000001
- VmoFlagWrite uint32 = 0x00000002
- VmoFlagExec uint32 = 0x00000004
- VmoFlagPrivate uint32 = 0x00010000
- VmoFlagExact uint32 = 0x00020000
- DirentTypeUnknown uint8 = 0
- DirentTypeDirectory uint8 = 4
- DirentTypeBlockDevice uint8 = 6
- DirentTypeFile uint8 = 8
- DirentTypeSocket uint8 = 12
- DirentTypeService uint8 = 16
- InoUnknown uint64 = 0xFFFFFFFFFFFFFFFF
- WatchEventDeleted uint8 = 0
- WatchEventAdded uint8 = 1
- WatchEventRemoved uint8 = 2
- WatchEventExisting uint8 = 3
- WatchEventIdle uint8 = 4
- WatchMaskDeleted uint32 = 0x00000001
- WatchMaskAdded uint32 = 0x00000002
- WatchMaskRemoved uint32 = 0x00000004
- WatchMaskExisting uint32 = 0x00000008
- WatchMaskIdle uint32 = 0x00000010
- WatchMaskAll uint32 = 0x0000001F
- MountCreateFlagReplace uint32 = 0x00000001
- MaxFsNameBuffer uint64 = 32
+ // Requests that the VMO be readable.
+ VmoFlagRead uint32 = 0x00000001
+ // Requests that the VMO be writable.
+ VmoFlagWrite uint32 = 0x00000002
+ // Requests that the VMO be executable.
+ VmoFlagExec uint32 = 0x00000004
+ // Require a copy-on-write clone of the underlying VMO.
+ // The request should fail if the VMO is not cloned.
+ // May not be supplied with fuchsia_io_VMO_FLAG_EXACT.
+ VmoFlagPrivate uint32 = 0x00010000
+ // Require an exact (non-cloned) handle to the underlying VMO.
+ // The request should fail if a handle to the exact VMO is not returned.
+ // May not be supplied with VMO_FLAG_PRIVATE.
+ VmoFlagExact uint32 = 0x00020000
+ // Dirent type information associated with the results of ReadDirents.
+ DirentTypeUnknown uint8 = 0
+ DirentTypeDirectory uint8 = 4
+ DirentTypeBlockDevice uint8 = 6
+ DirentTypeFile uint8 = 8
+ DirentTypeSocket uint8 = 12
+ DirentTypeService uint8 = 16
+ // Nodes which do not have ino values should return this value
+ // from Readdir and GetAttr.
+ InoUnknown uint64 = 0xFFFFFFFFFFFFFFFF
+ // Indicates the directory being watched has been deleted.
+ WatchEventDeleted uint8 = 0
+ // Indicates a node has been created (either new or moved) into a directory.
+ WatchEventAdded uint8 = 1
+ // Identifies a node has been removed (either deleted or moved) from the directory.
+ WatchEventRemoved uint8 = 2
+ // Identifies a node already existed in the directory when watching started.
+ WatchEventExisting uint8 = 3
+ // Identifies that no more WATCH_EVENT_EXISTING events will be sent.
+ WatchEventIdle uint8 = 4
+ // The following are bitmasks corresponding to the "watch events".
+ // They may be used as arguments to the Directory Watch method, to
+ // specify which events should receive notifications.
+ WatchMaskDeleted uint32 = 0x00000001
+ WatchMaskAdded uint32 = 0x00000002
+ WatchMaskRemoved uint32 = 0x00000004
+ WatchMaskExisting uint32 = 0x00000008
+ WatchMaskIdle uint32 = 0x00000010
+ WatchMaskAll uint32 = 0x0000001F
+ MountCreateFlagReplace uint32 = 0x00000001
+ MaxFsNameBuffer uint64 = 32
)
+// Update the Seek offset.
type SeekOrigin uint32
const (
@@ -88,6 +167,8 @@
return "Unknown"
}
+// The default protocol, interface information must be acquired some
+// other way.
type Service struct {
_ struct{} `fidl2:"s,1,1"`
Reserved uint8
@@ -109,6 +190,7 @@
return 1
}
+// The object may be cast to interface 'File'.
type FileObject struct {
_ struct{} `fidl2:"s,4,4"`
Event _zx.Event `fidl:"*" fidl2:"1"`
@@ -130,6 +212,7 @@
return 4
}
+// The object may be cast to interface 'Directory'.
type DirectoryObject struct {
_ struct{} `fidl2:"s,1,1"`
Reserved uint8
@@ -151,6 +234,7 @@
return 1
}
+// The object is accompanied by a pipe.
type Pipe struct {
_ struct{} `fidl2:"s,4,4"`
Socket _zx.Socket `fidl2:"0"`
@@ -172,6 +256,7 @@
return 4
}
+// The object is accompanied by a VMO.
type Vmofile struct {
_ struct{} `fidl2:"s,24,8"`
Vmo _zx.VMO `fidl2:"0"`
@@ -195,6 +280,7 @@
return 24
}
+// The object may be cast to interface 'Device'.
type Device struct {
_ struct{} `fidl2:"s,4,4"`
Event _zx.Event `fidl:"*" fidl2:"1"`
@@ -216,14 +302,22 @@
return 4
}
+// NodeAttributes defines generic information about a filesystem node.
type NodeAttributes struct {
- _ struct{} `fidl2:"s,56,8"`
- Mode uint32
- Id uint64
- ContentSize uint64
- StorageSize uint64
- LinkCount uint64
- CreationTime uint64
+ _ struct{} `fidl2:"s,56,8"`
+ // Protection bits and node type information describe in 'mode'.
+ Mode uint32
+ // A filesystem-unique ID.
+ Id uint64
+ // Node size, in bytes.
+ ContentSize uint64
+ // Space needed to store node (possibly larger than size), in bytes.
+ StorageSize uint64
+ // Hard link count.
+ LinkCount uint64
+ // Time of creation (may be updated manually after creation) in ns since Unix epoch, UTC.
+ CreationTime uint64
+ // Time of last modification in ns since Unix epoch, UTC.
ModificationTime uint64
}
@@ -243,6 +337,9 @@
return 56
}
+// WARNING(ZX-2645): Unused.
+//
+// WatchedEvent describes events returned from a DirectoryWatcher.
type WatchedEvent struct {
_ struct{} `fidl2:"s,24,8"`
Event uint8
@@ -267,18 +364,32 @@
}
type FilesystemInfo struct {
- _ struct{} `fidl2:"s,96,8"`
- TotalBytes uint64
- UsedBytes uint64
- TotalNodes uint64
- UsedNodes uint64
+ _ struct{} `fidl2:"s,96,8"`
+ // The number of data bytes which may be stored in a filesystem.
+ TotalBytes uint64
+ // The number of data bytes which are in use by the filesystem.
+ UsedBytes uint64
+ // The number of nodes which may be stored in the filesystem.
+ TotalNodes uint64
+ // The number of nodes used by the filesystem.
+ UsedNodes uint64
+ // The amount of space which may be allocated from the underlying
+ // volume manager. If unsupported, this will be zero.
FreeSharedPoolBytes uint64
- FsId uint64
- BlockSize uint32
- MaxFilenameSize uint32
- FsType uint32
- Padding uint32
- Name [32]int8
+ // A unique identifier for this filesystem instance. Will not be preserved
+ // across reboots.
+ FsId uint64
+ // The size of a single filesystem block.
+ BlockSize uint32
+ // The maximum length of a filesystem name.
+ MaxFilenameSize uint32
+ // A unique identifier for the type of the underlying filesystem.
+ FsType uint32
+ Padding uint32
+ // TODO(smklein): Replace this field with a string when supported
+ // by the "Simple" interface. At the moment, name is a fixed-size,
+ // null-terminated buffer.
+ Name [32]int8
}
var _mFilesystemInfo = _bindings.CreateLazyMarshaler(FilesystemInfo{})
@@ -309,6 +420,10 @@
NodeInfoDevice
)
+// Describes how the connection to an should be handled, as well as
+// how to interpret the optional handle.
+//
+// Refer to |Node::Describe()| and |Node::OnOpen()| for usage.
type NodeInfo struct {
NodeInfoTag `fidl:"tag" fidl2:"u,32,8"`
Service Service
@@ -404,26 +519,6 @@
return 8
}
-type NodeCloseRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mNodeCloseRequest = _bindings.CreateLazyMarshaler(NodeCloseRequest{})
-
-func (msg *NodeCloseRequest) Marshaler() _bindings.Marshaler {
- return _mNodeCloseRequest
-}
-
-// Implements Payload.
-func (_ *NodeCloseRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *NodeCloseRequest) InlineSize() int {
- return 0
-}
-
type NodeCloseResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
@@ -445,26 +540,6 @@
return 8
}
-type NodeDescribeRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mNodeDescribeRequest = _bindings.CreateLazyMarshaler(NodeDescribeRequest{})
-
-func (msg *NodeDescribeRequest) Marshaler() _bindings.Marshaler {
- return _mNodeDescribeRequest
-}
-
-// Implements Payload.
-func (_ *NodeDescribeRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *NodeDescribeRequest) InlineSize() int {
- return 0
-}
-
type NodeDescribeResponse struct {
_ struct{} `fidl2:"s,32,0"`
Info NodeInfo
@@ -508,26 +583,6 @@
return 16
}
-type NodeSyncRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mNodeSyncRequest = _bindings.CreateLazyMarshaler(NodeSyncRequest{})
-
-func (msg *NodeSyncRequest) Marshaler() _bindings.Marshaler {
- return _mNodeSyncRequest
-}
-
-// Implements Payload.
-func (_ *NodeSyncRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *NodeSyncRequest) InlineSize() int {
- return 0
-}
-
type NodeSyncResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
@@ -549,26 +604,6 @@
return 8
}
-type NodeGetAttrRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mNodeGetAttrRequest = _bindings.CreateLazyMarshaler(NodeGetAttrRequest{})
-
-func (msg *NodeGetAttrRequest) Marshaler() _bindings.Marshaler {
- return _mNodeGetAttrRequest
-}
-
-// Implements Payload.
-func (_ *NodeGetAttrRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *NodeGetAttrRequest) InlineSize() int {
- return 0
-}
-
type NodeGetAttrResponse struct {
_ struct{} `fidl2:"s,64,0"`
S int32
@@ -683,78 +718,151 @@
type NodeInterface _bindings.ChannelProxy
+// Create another connection to the same remote object.
+//
+// |flags| may be any of:
+// - OPEN_RIGHT_*
+// - OPEN_FLAG_APPEND
+// - OPEN_FLAG_NO_REMOTE
+// - OPEN_FLAG_DESCRIBE
+//
+// All other flags are ignored.
+//
+// The cloned object must have rights less than or equal to the original object.
+//
+// TODO: Currently, ulib/fs ignores OPEN_RIGHT_*, and uses the rights of the original
+// connection. This is a bug.
func (p *NodeInterface) Clone(flags uint32, object NodeInterfaceRequest) error {
- req_ := NodeCloneRequest{
+ req_ := &NodeCloneRequest{
Flags: flags,
Object: object,
}
- err := ((*_bindings.ChannelProxy)(p)).Send(NodeCloneOrdinal, &req_)
+ err := ((*_bindings.ChannelProxy)(p)).Send(NodeCloneOrdinal, req_)
return err
}
+// Terminates connection with object.
+//
+// This method does not require any rights.
func (p *NodeInterface) Close() (int32, error) {
- req_ := NodeCloseRequest{}
- resp_ := NodeCloseResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(NodeCloseOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &NodeCloseResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(NodeCloseOrdinal, req_, resp_)
return resp_.S, err
}
+// 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.
func (p *NodeInterface) Describe() (NodeInfo, error) {
- req_ := NodeDescribeRequest{}
- resp_ := NodeDescribeResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(NodeDescribeOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &NodeDescribeResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(NodeDescribeOrdinal, req_, resp_)
return resp_.Info, err
}
+// An event produced eagerly by a fidl server if requested by |OPEN_FLAG_DESCRIBE|.
+//
+// Indicates the success or failure of the open operation, and optionally describes the
+// object. If the status is |ZX_OK|, |info| contains descriptive information about the object
+// (the same as would be returned by |Describe|).
func (p *NodeInterface) ExpectOnOpen() (int32, *NodeInfo, error) {
- resp_ := NodeOnOpenResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Recv(NodeOnOpenOrdinal, &resp_)
+ resp_ := &NodeOnOpenResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Recv(NodeOnOpenOrdinal, resp_)
return resp_.S, resp_.Info, err
}
+// Synchronizes updates to the node to the underlying media, if it exists.
func (p *NodeInterface) Sync() (int32, error) {
- req_ := NodeSyncRequest{}
- resp_ := NodeSyncResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(NodeSyncOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &NodeSyncResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(NodeSyncOrdinal, req_, resp_)
return resp_.S, err
}
+// Acquires information about the node.
+//
+// This method does not require any rights.
func (p *NodeInterface) GetAttr() (int32, NodeAttributes, error) {
- req_ := NodeGetAttrRequest{}
- resp_ := NodeGetAttrResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(NodeGetAttrOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &NodeGetAttrResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(NodeGetAttrOrdinal, req_, resp_)
return resp_.S, resp_.Attributes, err
}
+// Updates information about the node.
+// |flags| may be any of NODE_ATTRIBUTE_FLAG_*.
+//
+// This method requires following rights: OPEN_RIGHT_WRITABLE.
+// TODO(ZX-1262): This access restriction is not implemented in ulib/fs.
func (p *NodeInterface) SetAttr(flags uint32, attributes NodeAttributes) (int32, error) {
- req_ := NodeSetAttrRequest{
+ req_ := &NodeSetAttrRequest{
Flags: flags,
Attributes: attributes,
}
- resp_ := NodeSetAttrResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(NodeSetAttrOrdinal, &req_, &resp_)
+ resp_ := &NodeSetAttrResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(NodeSetAttrOrdinal, req_, resp_)
return resp_.S, err
}
+// Deprecated. Only for use with compatibility with devhost.
func (p *NodeInterface) Ioctl(opcode uint32, maxOut uint64, handles []_zx.Handle, in []uint8) (int32, []_zx.Handle, []uint8, error) {
- req_ := NodeIoctlRequest{
+ req_ := &NodeIoctlRequest{
Opcode: opcode,
MaxOut: maxOut,
Handles: handles,
In: in,
}
- resp_ := NodeIoctlResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(NodeIoctlOrdinal, &req_, &resp_)
+ resp_ := &NodeIoctlResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(NodeIoctlOrdinal, req_, resp_)
return resp_.S, resp_.Handles, resp_.Out, err
}
+// Node defines the minimal interface for entities which can be accessed in a filesystem.
type Node interface {
+ // Create another connection to the same remote object.
+ //
+ // |flags| may be any of:
+ // - OPEN_RIGHT_*
+ // - OPEN_FLAG_APPEND
+ // - OPEN_FLAG_NO_REMOTE
+ // - OPEN_FLAG_DESCRIBE
+ //
+ // All other flags are ignored.
+ //
+ // The cloned object must have rights less than or equal to the original object.
+ //
+ // TODO: Currently, ulib/fs ignores OPEN_RIGHT_*, and uses the rights of the original
+ // connection. This is a bug.
Clone(flags uint32, object NodeInterfaceRequest) error
+ // Terminates connection with object.
+ //
+ // This method does not require any rights.
Close() (int32, error)
+ // 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.
Describe() (NodeInfo, error)
+ // An event produced eagerly by a fidl server if requested by |OPEN_FLAG_DESCRIBE|.
+ //
+ // Indicates the success or failure of the open operation, and optionally describes the
+ // object. If the status is |ZX_OK|, |info| contains descriptive information about the object
+ // (the same as would be returned by |Describe|).
+ // Synchronizes updates to the node to the underlying media, if it exists.
Sync() (int32, error)
+ // Acquires information about the node.
+ //
+ // This method does not require any rights.
GetAttr() (int32, NodeAttributes, error)
+ // Updates information about the node.
+ // |flags| may be any of NODE_ATTRIBUTE_FLAG_*.
+ //
+ // This method requires following rights: OPEN_RIGHT_WRITABLE.
+ // TODO(ZX-1262): This access restriction is not implemented in ulib/fs.
SetAttr(flags uint32, attributes NodeAttributes) (int32, error)
+ // Deprecated. Only for use with compatibility with devhost.
Ioctl(opcode uint32, maxOut uint64, handles []_zx.Handle, in []uint8) (int32, []_zx.Handle, []uint8, error)
}
@@ -781,39 +889,23 @@
err_ := s.Impl.Clone(in_.Flags, in_.Object)
return nil, err_
case NodeCloseOrdinal:
- in_ := NodeCloseRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := NodeCloseResponse{}
s, err_ := s.Impl.Close()
+ out_ := NodeCloseResponse{}
out_.S = s
return &out_, err_
case NodeDescribeOrdinal:
- in_ := NodeDescribeRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := NodeDescribeResponse{}
info, err_ := s.Impl.Describe()
+ out_ := NodeDescribeResponse{}
out_.Info = info
return &out_, err_
case NodeSyncOrdinal:
- in_ := NodeSyncRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := NodeSyncResponse{}
s, err_ := s.Impl.Sync()
+ out_ := NodeSyncResponse{}
out_.S = s
return &out_, err_
case NodeGetAttrOrdinal:
- in_ := NodeGetAttrRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := NodeGetAttrResponse{}
s, attributes, err_ := s.Impl.GetAttr()
+ out_ := NodeGetAttrResponse{}
out_.S = s
out_.Attributes = attributes
return &out_, err_
@@ -822,8 +914,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := NodeSetAttrResponse{}
s, err_ := s.Impl.SetAttr(in_.Flags, in_.Attributes)
+ out_ := NodeSetAttrResponse{}
out_.S = s
return &out_, err_
case NodeIoctlOrdinal:
@@ -831,8 +923,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := NodeIoctlResponse{}
s, handles, out, err_ := s.Impl.Ioctl(in_.Opcode, in_.MaxOut, in_.Handles, in_.In)
+ out_ := NodeIoctlResponse{}
out_.S = s
out_.Handles = handles
out_.Out = out
@@ -857,11 +949,11 @@
type NodeEventProxy _bindings.ChannelProxy
func (p *NodeEventProxy) OnOpen(s int32, info *NodeInfo) error {
- event_ := NodeOnOpenResponse{
+ event_ := &NodeOnOpenResponse{
S: s,
Info: info,
}
- return ((*_bindings.ChannelProxy)(p)).Send(NodeOnOpenOrdinal, &event_)
+ return ((*_bindings.ChannelProxy)(p)).Send(NodeOnOpenOrdinal, event_)
}
const (
@@ -923,26 +1015,6 @@
return 8
}
-type FileCloseRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mFileCloseRequest = _bindings.CreateLazyMarshaler(FileCloseRequest{})
-
-func (msg *FileCloseRequest) Marshaler() _bindings.Marshaler {
- return _mFileCloseRequest
-}
-
-// Implements Payload.
-func (_ *FileCloseRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *FileCloseRequest) InlineSize() int {
- return 0
-}
-
type FileCloseResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
@@ -964,26 +1036,6 @@
return 8
}
-type FileDescribeRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mFileDescribeRequest = _bindings.CreateLazyMarshaler(FileDescribeRequest{})
-
-func (msg *FileDescribeRequest) Marshaler() _bindings.Marshaler {
- return _mFileDescribeRequest
-}
-
-// Implements Payload.
-func (_ *FileDescribeRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *FileDescribeRequest) InlineSize() int {
- return 0
-}
-
type FileDescribeResponse struct {
_ struct{} `fidl2:"s,32,0"`
Info NodeInfo
@@ -1027,26 +1079,6 @@
return 16
}
-type FileSyncRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mFileSyncRequest = _bindings.CreateLazyMarshaler(FileSyncRequest{})
-
-func (msg *FileSyncRequest) Marshaler() _bindings.Marshaler {
- return _mFileSyncRequest
-}
-
-// Implements Payload.
-func (_ *FileSyncRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *FileSyncRequest) InlineSize() int {
- return 0
-}
-
type FileSyncResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
@@ -1068,26 +1100,6 @@
return 8
}
-type FileGetAttrRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mFileGetAttrRequest = _bindings.CreateLazyMarshaler(FileGetAttrRequest{})
-
-func (msg *FileGetAttrRequest) Marshaler() _bindings.Marshaler {
- return _mFileGetAttrRequest
-}
-
-// Implements Payload.
-func (_ *FileGetAttrRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *FileGetAttrRequest) InlineSize() int {
- return 0
-}
-
type FileGetAttrResponse struct {
_ struct{} `fidl2:"s,64,0"`
S int32
@@ -1460,26 +1472,6 @@
return 8
}
-type FileGetFlagsRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mFileGetFlagsRequest = _bindings.CreateLazyMarshaler(FileGetFlagsRequest{})
-
-func (msg *FileGetFlagsRequest) Marshaler() _bindings.Marshaler {
- return _mFileGetFlagsRequest
-}
-
-// Implements Payload.
-func (_ *FileGetFlagsRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *FileGetFlagsRequest) InlineSize() int {
- return 0
-}
-
type FileGetFlagsResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
@@ -1589,169 +1581,320 @@
type FileInterface _bindings.ChannelProxy
+// Create another connection to the same remote object.
+//
+// |flags| may be any of:
+// - OPEN_RIGHT_*
+// - OPEN_FLAG_APPEND
+// - OPEN_FLAG_NO_REMOTE
+// - OPEN_FLAG_DESCRIBE
+//
+// All other flags are ignored.
+//
+// The cloned object must have rights less than or equal to the original object.
+//
+// TODO: Currently, ulib/fs ignores OPEN_RIGHT_*, and uses the rights of the original
+// connection. This is a bug.
func (p *FileInterface) Clone(flags uint32, object NodeInterfaceRequest) error {
- req_ := FileCloneRequest{
+ req_ := &FileCloneRequest{
Flags: flags,
Object: object,
}
- err := ((*_bindings.ChannelProxy)(p)).Send(FileCloneOrdinal, &req_)
+ err := ((*_bindings.ChannelProxy)(p)).Send(FileCloneOrdinal, req_)
return err
}
+// Terminates connection with object.
+//
+// This method does not require any rights.
func (p *FileInterface) Close() (int32, error) {
- req_ := FileCloseRequest{}
- resp_ := FileCloseResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(FileCloseOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &FileCloseResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(FileCloseOrdinal, req_, resp_)
return resp_.S, err
}
+// 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.
func (p *FileInterface) Describe() (NodeInfo, error) {
- req_ := FileDescribeRequest{}
- resp_ := FileDescribeResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(FileDescribeOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &FileDescribeResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(FileDescribeOrdinal, req_, resp_)
return resp_.Info, err
}
+// An event produced eagerly by a fidl server if requested by |OPEN_FLAG_DESCRIBE|.
+//
+// Indicates the success or failure of the open operation, and optionally describes the
+// object. If the status is |ZX_OK|, |info| contains descriptive information about the object
+// (the same as would be returned by |Describe|).
func (p *FileInterface) ExpectOnOpen() (int32, *NodeInfo, error) {
- resp_ := FileOnOpenResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Recv(FileOnOpenOrdinal, &resp_)
+ resp_ := &FileOnOpenResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Recv(FileOnOpenOrdinal, resp_)
return resp_.S, resp_.Info, err
}
+// Synchronizes updates to the node to the underlying media, if it exists.
func (p *FileInterface) Sync() (int32, error) {
- req_ := FileSyncRequest{}
- resp_ := FileSyncResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(FileSyncOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &FileSyncResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(FileSyncOrdinal, req_, resp_)
return resp_.S, err
}
+// Acquires information about the node.
+//
+// This method does not require any rights.
func (p *FileInterface) GetAttr() (int32, NodeAttributes, error) {
- req_ := FileGetAttrRequest{}
- resp_ := FileGetAttrResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(FileGetAttrOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &FileGetAttrResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(FileGetAttrOrdinal, req_, resp_)
return resp_.S, resp_.Attributes, err
}
+// Updates information about the node.
+// |flags| may be any of NODE_ATTRIBUTE_FLAG_*.
+//
+// This method requires following rights: OPEN_RIGHT_WRITABLE.
+// TODO(ZX-1262): This access restriction is not implemented in ulib/fs.
func (p *FileInterface) SetAttr(flags uint32, attributes NodeAttributes) (int32, error) {
- req_ := FileSetAttrRequest{
+ req_ := &FileSetAttrRequest{
Flags: flags,
Attributes: attributes,
}
- resp_ := FileSetAttrResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(FileSetAttrOrdinal, &req_, &resp_)
+ resp_ := &FileSetAttrResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(FileSetAttrOrdinal, req_, resp_)
return resp_.S, err
}
+// Deprecated. Only for use with compatibility with devhost.
func (p *FileInterface) Ioctl(opcode uint32, maxOut uint64, handles []_zx.Handle, in []uint8) (int32, []_zx.Handle, []uint8, error) {
- req_ := FileIoctlRequest{
+ req_ := &FileIoctlRequest{
Opcode: opcode,
MaxOut: maxOut,
Handles: handles,
In: in,
}
- resp_ := FileIoctlResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(FileIoctlOrdinal, &req_, &resp_)
+ resp_ := &FileIoctlResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(FileIoctlOrdinal, req_, resp_)
return resp_.S, resp_.Handles, resp_.Out, err
}
+// Read 'count' bytes at the seek offset.
+// The seek offset is moved forward by the number of bytes read.
+//
+// This method requires following rights: OPEN_RIGHT_READABLE.
func (p *FileInterface) Read(count uint64) (int32, []uint8, error) {
- req_ := FileReadRequest{
+ req_ := &FileReadRequest{
Count: count,
}
- resp_ := FileReadResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(FileReadOrdinal, &req_, &resp_)
+ resp_ := &FileReadResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(FileReadOrdinal, req_, resp_)
return resp_.S, resp_.Data, err
}
+// Read 'count' bytes at the provided offset.
+// Does not affect the seek offset.
+//
+// This method requires following rights: OPEN_RIGHT_READABLE.
func (p *FileInterface) ReadAt(count uint64, offset uint64) (int32, []uint8, error) {
- req_ := FileReadAtRequest{
+ req_ := &FileReadAtRequest{
Count: count,
Offset: offset,
}
- resp_ := FileReadAtResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(FileReadAtOrdinal, &req_, &resp_)
+ resp_ := &FileReadAtResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(FileReadAtOrdinal, req_, resp_)
return resp_.S, resp_.Data, err
}
+// Write data at the seek offset.
+// The seek offset is moved forward by the number of bytes written.
+//
+// This method requires following rights: OPEN_RIGHT_WRITABLE.
func (p *FileInterface) Write(data []uint8) (int32, uint64, error) {
- req_ := FileWriteRequest{
+ req_ := &FileWriteRequest{
Data: data,
}
- resp_ := FileWriteResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(FileWriteOrdinal, &req_, &resp_)
+ resp_ := &FileWriteResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(FileWriteOrdinal, req_, resp_)
return resp_.S, resp_.Actual, err
}
+// Write data to the provided offset.
+// Does not affect the seek offset.
+//
+// This method requires following rights: OPEN_RIGHT_WRITABLE.
func (p *FileInterface) WriteAt(data []uint8, offset uint64) (int32, uint64, error) {
- req_ := FileWriteAtRequest{
+ req_ := &FileWriteAtRequest{
Data: data,
Offset: offset,
}
- resp_ := FileWriteAtResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(FileWriteAtOrdinal, &req_, &resp_)
+ resp_ := &FileWriteAtResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(FileWriteAtOrdinal, req_, resp_)
return resp_.S, resp_.Actual, err
}
+// Moves the offset at which the next invocation of |Read()| or |Write()| will
+// occur.
+//
+// This method does not require any rights.
func (p *FileInterface) Seek(offset int64, start SeekOrigin) (int32, uint64, error) {
- req_ := FileSeekRequest{
+ req_ := &FileSeekRequest{
Offset: offset,
Start: start,
}
- resp_ := FileSeekResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(FileSeekOrdinal, &req_, &resp_)
+ resp_ := &FileSeekResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(FileSeekOrdinal, req_, resp_)
return resp_.S, resp_.Offset, err
}
+// Shrink the file size to 'length' bytes.
+//
+// This method requires following rights: OPEN_RIGHT_WRITABLE.
func (p *FileInterface) Truncate(length uint64) (int32, error) {
- req_ := FileTruncateRequest{
+ req_ := &FileTruncateRequest{
Length: length,
}
- resp_ := FileTruncateResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(FileTruncateOrdinal, &req_, &resp_)
+ resp_ := &FileTruncateResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(FileTruncateOrdinal, req_, resp_)
return resp_.S, err
}
+// Acquire the Directory::Open rights and flags used to access this file.
+//
+// This method does not require any rights.
func (p *FileInterface) GetFlags() (int32, uint32, error) {
- req_ := FileGetFlagsRequest{}
- resp_ := FileGetFlagsResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(FileGetFlagsOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &FileGetFlagsResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(FileGetFlagsOrdinal, req_, resp_)
return resp_.S, resp_.Flags, err
}
+// Change the Directory::Open flags used to access the file.
+// Supported flags which can be turned on / off:
+// - OPEN_FLAG_APPEND
+//
+// This method does not require any rights.
func (p *FileInterface) SetFlags(flags uint32) (int32, error) {
- req_ := FileSetFlagsRequest{
+ req_ := &FileSetFlagsRequest{
Flags: flags,
}
- resp_ := FileSetFlagsResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(FileSetFlagsOrdinal, &req_, &resp_)
+ resp_ := &FileSetFlagsResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(FileSetFlagsOrdinal, req_, resp_)
return resp_.S, err
}
+// Acquire a VMO representing this file, if there is one, with the
+// requested access rights.
+//
+// |flags| may be any of VMO_FLAG_*.
+//
+// This method requires following rights:
+// - OPEN_RIGHT_WRITABLE if |flags| includes VMO_FLAG_WRITE.
+// - OPEN_RIGHT_READABLE if |flags| includes VMO_FLAG_READ or VMO_FLAG_EXEC.
func (p *FileInterface) GetBuffer(flags uint32) (int32, *fuchsiamem.Buffer, error) {
- req_ := FileGetBufferRequest{
+ req_ := &FileGetBufferRequest{
Flags: flags,
}
- resp_ := FileGetBufferResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(FileGetBufferOrdinal, &req_, &resp_)
+ resp_ := &FileGetBufferResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(FileGetBufferOrdinal, req_, resp_)
return resp_.S, resp_.Buffer, err
}
+// File defines the interface of a node which contains a flat layout of data.
type File interface {
+ // Create another connection to the same remote object.
+ //
+ // |flags| may be any of:
+ // - OPEN_RIGHT_*
+ // - OPEN_FLAG_APPEND
+ // - OPEN_FLAG_NO_REMOTE
+ // - OPEN_FLAG_DESCRIBE
+ //
+ // All other flags are ignored.
+ //
+ // The cloned object must have rights less than or equal to the original object.
+ //
+ // TODO: Currently, ulib/fs ignores OPEN_RIGHT_*, and uses the rights of the original
+ // connection. This is a bug.
Clone(flags uint32, object NodeInterfaceRequest) error
+ // Terminates connection with object.
+ //
+ // This method does not require any rights.
Close() (int32, error)
+ // 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.
Describe() (NodeInfo, error)
+ // An event produced eagerly by a fidl server if requested by |OPEN_FLAG_DESCRIBE|.
+ //
+ // Indicates the success or failure of the open operation, and optionally describes the
+ // object. If the status is |ZX_OK|, |info| contains descriptive information about the object
+ // (the same as would be returned by |Describe|).
+ // Synchronizes updates to the node to the underlying media, if it exists.
Sync() (int32, error)
+ // Acquires information about the node.
+ //
+ // This method does not require any rights.
GetAttr() (int32, NodeAttributes, error)
+ // Updates information about the node.
+ // |flags| may be any of NODE_ATTRIBUTE_FLAG_*.
+ //
+ // This method requires following rights: OPEN_RIGHT_WRITABLE.
+ // TODO(ZX-1262): This access restriction is not implemented in ulib/fs.
SetAttr(flags uint32, attributes NodeAttributes) (int32, error)
+ // Deprecated. Only for use with compatibility with devhost.
Ioctl(opcode uint32, maxOut uint64, handles []_zx.Handle, in []uint8) (int32, []_zx.Handle, []uint8, error)
+ // Read 'count' bytes at the seek offset.
+ // The seek offset is moved forward by the number of bytes read.
+ //
+ // This method requires following rights: OPEN_RIGHT_READABLE.
Read(count uint64) (int32, []uint8, error)
+ // Read 'count' bytes at the provided offset.
+ // Does not affect the seek offset.
+ //
+ // This method requires following rights: OPEN_RIGHT_READABLE.
ReadAt(count uint64, offset uint64) (int32, []uint8, error)
+ // Write data at the seek offset.
+ // The seek offset is moved forward by the number of bytes written.
+ //
+ // This method requires following rights: OPEN_RIGHT_WRITABLE.
Write(data []uint8) (int32, uint64, error)
+ // Write data to the provided offset.
+ // Does not affect the seek offset.
+ //
+ // This method requires following rights: OPEN_RIGHT_WRITABLE.
WriteAt(data []uint8, offset uint64) (int32, uint64, error)
+ // Moves the offset at which the next invocation of |Read()| or |Write()| will
+ // occur.
+ //
+ // This method does not require any rights.
Seek(offset int64, start SeekOrigin) (int32, uint64, error)
+ // Shrink the file size to 'length' bytes.
+ //
+ // This method requires following rights: OPEN_RIGHT_WRITABLE.
Truncate(length uint64) (int32, error)
+ // Acquire the Directory::Open rights and flags used to access this file.
+ //
+ // This method does not require any rights.
GetFlags() (int32, uint32, error)
+ // Change the Directory::Open flags used to access the file.
+ // Supported flags which can be turned on / off:
+ // - OPEN_FLAG_APPEND
+ //
+ // This method does not require any rights.
SetFlags(flags uint32) (int32, error)
+ // Acquire a VMO representing this file, if there is one, with the
+ // requested access rights.
+ //
+ // |flags| may be any of VMO_FLAG_*.
+ //
+ // This method requires following rights:
+ // - OPEN_RIGHT_WRITABLE if |flags| includes VMO_FLAG_WRITE.
+ // - OPEN_RIGHT_READABLE if |flags| includes VMO_FLAG_READ or VMO_FLAG_EXEC.
GetBuffer(flags uint32) (int32, *fuchsiamem.Buffer, error)
}
@@ -1778,39 +1921,23 @@
err_ := s.Impl.Clone(in_.Flags, in_.Object)
return nil, err_
case FileCloseOrdinal:
- in_ := FileCloseRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := FileCloseResponse{}
s, err_ := s.Impl.Close()
+ out_ := FileCloseResponse{}
out_.S = s
return &out_, err_
case FileDescribeOrdinal:
- in_ := FileDescribeRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := FileDescribeResponse{}
info, err_ := s.Impl.Describe()
+ out_ := FileDescribeResponse{}
out_.Info = info
return &out_, err_
case FileSyncOrdinal:
- in_ := FileSyncRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := FileSyncResponse{}
s, err_ := s.Impl.Sync()
+ out_ := FileSyncResponse{}
out_.S = s
return &out_, err_
case FileGetAttrOrdinal:
- in_ := FileGetAttrRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := FileGetAttrResponse{}
s, attributes, err_ := s.Impl.GetAttr()
+ out_ := FileGetAttrResponse{}
out_.S = s
out_.Attributes = attributes
return &out_, err_
@@ -1819,8 +1946,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := FileSetAttrResponse{}
s, err_ := s.Impl.SetAttr(in_.Flags, in_.Attributes)
+ out_ := FileSetAttrResponse{}
out_.S = s
return &out_, err_
case FileIoctlOrdinal:
@@ -1828,8 +1955,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := FileIoctlResponse{}
s, handles, out, err_ := s.Impl.Ioctl(in_.Opcode, in_.MaxOut, in_.Handles, in_.In)
+ out_ := FileIoctlResponse{}
out_.S = s
out_.Handles = handles
out_.Out = out
@@ -1839,8 +1966,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := FileReadResponse{}
s, data, err_ := s.Impl.Read(in_.Count)
+ out_ := FileReadResponse{}
out_.S = s
out_.Data = data
return &out_, err_
@@ -1849,8 +1976,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := FileReadAtResponse{}
s, data, err_ := s.Impl.ReadAt(in_.Count, in_.Offset)
+ out_ := FileReadAtResponse{}
out_.S = s
out_.Data = data
return &out_, err_
@@ -1859,8 +1986,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := FileWriteResponse{}
s, actual, err_ := s.Impl.Write(in_.Data)
+ out_ := FileWriteResponse{}
out_.S = s
out_.Actual = actual
return &out_, err_
@@ -1869,8 +1996,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := FileWriteAtResponse{}
s, actual, err_ := s.Impl.WriteAt(in_.Data, in_.Offset)
+ out_ := FileWriteAtResponse{}
out_.S = s
out_.Actual = actual
return &out_, err_
@@ -1879,8 +2006,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := FileSeekResponse{}
s, offset, err_ := s.Impl.Seek(in_.Offset, in_.Start)
+ out_ := FileSeekResponse{}
out_.S = s
out_.Offset = offset
return &out_, err_
@@ -1889,17 +2016,13 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := FileTruncateResponse{}
s, err_ := s.Impl.Truncate(in_.Length)
+ out_ := FileTruncateResponse{}
out_.S = s
return &out_, err_
case FileGetFlagsOrdinal:
- in_ := FileGetFlagsRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := FileGetFlagsResponse{}
s, flags, err_ := s.Impl.GetFlags()
+ out_ := FileGetFlagsResponse{}
out_.S = s
out_.Flags = flags
return &out_, err_
@@ -1908,8 +2031,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := FileSetFlagsResponse{}
s, err_ := s.Impl.SetFlags(in_.Flags)
+ out_ := FileSetFlagsResponse{}
out_.S = s
return &out_, err_
case FileGetBufferOrdinal:
@@ -1917,8 +2040,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := FileGetBufferResponse{}
s, buffer, err_ := s.Impl.GetBuffer(in_.Flags)
+ out_ := FileGetBufferResponse{}
out_.S = s
out_.Buffer = buffer
return &out_, err_
@@ -1942,11 +2065,11 @@
type FileEventProxy _bindings.ChannelProxy
func (p *FileEventProxy) OnOpen(s int32, info *NodeInfo) error {
- event_ := FileOnOpenResponse{
+ event_ := &FileOnOpenResponse{
S: s,
Info: info,
}
- return ((*_bindings.ChannelProxy)(p)).Send(FileOnOpenOrdinal, &event_)
+ return ((*_bindings.ChannelProxy)(p)).Send(FileOnOpenOrdinal, event_)
}
const (
@@ -1977,15 +2100,23 @@
type DirectoryWatcherInterface _bindings.ChannelProxy
+// TODO(smklein): Convert this to a vector of WatchedEvents, when possible.
func (p *DirectoryWatcherInterface) OnEvent(events []uint8) error {
- req_ := DirectoryWatcherOnEventRequest{
+ req_ := &DirectoryWatcherOnEventRequest{
Events: events,
}
- err := ((*_bindings.ChannelProxy)(p)).Send(DirectoryWatcherOnEventOrdinal, &req_)
+ err := ((*_bindings.ChannelProxy)(p)).Send(DirectoryWatcherOnEventOrdinal, req_)
return err
}
+// WARNING(ZX-2645): Unused.
+//
+// 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.
type DirectoryWatcher interface {
+ // TODO(smklein): Convert this to a vector of WatchedEvents, when possible.
OnEvent(events []uint8) error
}
@@ -2087,26 +2218,6 @@
return 8
}
-type DirectoryCloseRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectoryCloseRequest = _bindings.CreateLazyMarshaler(DirectoryCloseRequest{})
-
-func (msg *DirectoryCloseRequest) Marshaler() _bindings.Marshaler {
- return _mDirectoryCloseRequest
-}
-
-// Implements Payload.
-func (_ *DirectoryCloseRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectoryCloseRequest) InlineSize() int {
- return 0
-}
-
type DirectoryCloseResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
@@ -2128,26 +2239,6 @@
return 8
}
-type DirectoryDescribeRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectoryDescribeRequest = _bindings.CreateLazyMarshaler(DirectoryDescribeRequest{})
-
-func (msg *DirectoryDescribeRequest) Marshaler() _bindings.Marshaler {
- return _mDirectoryDescribeRequest
-}
-
-// Implements Payload.
-func (_ *DirectoryDescribeRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectoryDescribeRequest) InlineSize() int {
- return 0
-}
-
type DirectoryDescribeResponse struct {
_ struct{} `fidl2:"s,32,0"`
Info NodeInfo
@@ -2191,26 +2282,6 @@
return 16
}
-type DirectorySyncRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectorySyncRequest = _bindings.CreateLazyMarshaler(DirectorySyncRequest{})
-
-func (msg *DirectorySyncRequest) Marshaler() _bindings.Marshaler {
- return _mDirectorySyncRequest
-}
-
-// Implements Payload.
-func (_ *DirectorySyncRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectorySyncRequest) InlineSize() int {
- return 0
-}
-
type DirectorySyncResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
@@ -2232,26 +2303,6 @@
return 8
}
-type DirectoryGetAttrRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectoryGetAttrRequest = _bindings.CreateLazyMarshaler(DirectoryGetAttrRequest{})
-
-func (msg *DirectoryGetAttrRequest) Marshaler() _bindings.Marshaler {
- return _mDirectoryGetAttrRequest
-}
-
-// Implements Payload.
-func (_ *DirectoryGetAttrRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectoryGetAttrRequest) InlineSize() int {
- return 0
-}
-
type DirectoryGetAttrResponse struct {
_ struct{} `fidl2:"s,64,0"`
S int32
@@ -2473,26 +2524,6 @@
return 24
}
-type DirectoryRewindRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectoryRewindRequest = _bindings.CreateLazyMarshaler(DirectoryRewindRequest{})
-
-func (msg *DirectoryRewindRequest) Marshaler() _bindings.Marshaler {
- return _mDirectoryRewindRequest
-}
-
-// Implements Payload.
-func (_ *DirectoryRewindRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectoryRewindRequest) InlineSize() int {
- return 0
-}
-
type DirectoryRewindResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
@@ -2514,26 +2545,6 @@
return 8
}
-type DirectoryGetTokenRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectoryGetTokenRequest = _bindings.CreateLazyMarshaler(DirectoryGetTokenRequest{})
-
-func (msg *DirectoryGetTokenRequest) Marshaler() _bindings.Marshaler {
- return _mDirectoryGetTokenRequest
-}
-
-// Implements Payload.
-func (_ *DirectoryGetTokenRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectoryGetTokenRequest) InlineSize() int {
- return 0
-}
-
type DirectoryGetTokenResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
@@ -2690,162 +2701,325 @@
type DirectoryInterface _bindings.ChannelProxy
+// Create another connection to the same remote object.
+//
+// |flags| may be any of:
+// - OPEN_RIGHT_*
+// - OPEN_FLAG_APPEND
+// - OPEN_FLAG_NO_REMOTE
+// - OPEN_FLAG_DESCRIBE
+//
+// All other flags are ignored.
+//
+// The cloned object must have rights less than or equal to the original object.
+//
+// TODO: Currently, ulib/fs ignores OPEN_RIGHT_*, and uses the rights of the original
+// connection. This is a bug.
func (p *DirectoryInterface) Clone(flags uint32, object NodeInterfaceRequest) error {
- req_ := DirectoryCloneRequest{
+ req_ := &DirectoryCloneRequest{
Flags: flags,
Object: object,
}
- err := ((*_bindings.ChannelProxy)(p)).Send(DirectoryCloneOrdinal, &req_)
+ err := ((*_bindings.ChannelProxy)(p)).Send(DirectoryCloneOrdinal, req_)
return err
}
+// Terminates connection with object.
+//
+// This method does not require any rights.
func (p *DirectoryInterface) Close() (int32, error) {
- req_ := DirectoryCloseRequest{}
- resp_ := DirectoryCloseResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryCloseOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectoryCloseResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryCloseOrdinal, req_, resp_)
return resp_.S, err
}
+// 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.
func (p *DirectoryInterface) Describe() (NodeInfo, error) {
- req_ := DirectoryDescribeRequest{}
- resp_ := DirectoryDescribeResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryDescribeOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectoryDescribeResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryDescribeOrdinal, req_, resp_)
return resp_.Info, err
}
+// An event produced eagerly by a fidl server if requested by |OPEN_FLAG_DESCRIBE|.
+//
+// Indicates the success or failure of the open operation, and optionally describes the
+// object. If the status is |ZX_OK|, |info| contains descriptive information about the object
+// (the same as would be returned by |Describe|).
func (p *DirectoryInterface) ExpectOnOpen() (int32, *NodeInfo, error) {
- resp_ := DirectoryOnOpenResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Recv(DirectoryOnOpenOrdinal, &resp_)
+ resp_ := &DirectoryOnOpenResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Recv(DirectoryOnOpenOrdinal, resp_)
return resp_.S, resp_.Info, err
}
+// Synchronizes updates to the node to the underlying media, if it exists.
func (p *DirectoryInterface) Sync() (int32, error) {
- req_ := DirectorySyncRequest{}
- resp_ := DirectorySyncResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectorySyncOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectorySyncResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectorySyncOrdinal, req_, resp_)
return resp_.S, err
}
+// Acquires information about the node.
+//
+// This method does not require any rights.
func (p *DirectoryInterface) GetAttr() (int32, NodeAttributes, error) {
- req_ := DirectoryGetAttrRequest{}
- resp_ := DirectoryGetAttrResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryGetAttrOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectoryGetAttrResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryGetAttrOrdinal, req_, resp_)
return resp_.S, resp_.Attributes, err
}
+// Updates information about the node.
+// |flags| may be any of NODE_ATTRIBUTE_FLAG_*.
+//
+// This method requires following rights: OPEN_RIGHT_WRITABLE.
+// TODO(ZX-1262): This access restriction is not implemented in ulib/fs.
func (p *DirectoryInterface) SetAttr(flags uint32, attributes NodeAttributes) (int32, error) {
- req_ := DirectorySetAttrRequest{
+ req_ := &DirectorySetAttrRequest{
Flags: flags,
Attributes: attributes,
}
- resp_ := DirectorySetAttrResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectorySetAttrOrdinal, &req_, &resp_)
+ resp_ := &DirectorySetAttrResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectorySetAttrOrdinal, req_, resp_)
return resp_.S, err
}
+// Deprecated. Only for use with compatibility with devhost.
func (p *DirectoryInterface) Ioctl(opcode uint32, maxOut uint64, handles []_zx.Handle, in []uint8) (int32, []_zx.Handle, []uint8, error) {
- req_ := DirectoryIoctlRequest{
+ req_ := &DirectoryIoctlRequest{
Opcode: opcode,
MaxOut: maxOut,
Handles: handles,
In: in,
}
- resp_ := DirectoryIoctlResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryIoctlOrdinal, &req_, &resp_)
+ resp_ := &DirectoryIoctlResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryIoctlOrdinal, req_, resp_)
return resp_.S, resp_.Handles, resp_.Out, err
}
+// Open a new object relative to this directory object.
+//
+// Flags may be any of the OPEN_FLAG_* and OPEN_RIGHT_* values, bitwise ORed together.
+// The OPEN_FLAG_DESCRIBE flag may cause an |OnOpen| event to be transmitted
+// on the |object| handle, indicating the type of object opened.
func (p *DirectoryInterface) Open(flags uint32, mode uint32, path string, object NodeInterfaceRequest) error {
- req_ := DirectoryOpenRequest{
+ req_ := &DirectoryOpenRequest{
Flags: flags,
Mode: mode,
Path: path,
Object: object,
}
- err := ((*_bindings.ChannelProxy)(p)).Send(DirectoryOpenOrdinal, &req_)
+ err := ((*_bindings.ChannelProxy)(p)).Send(DirectoryOpenOrdinal, req_)
return err
}
+// Remove an object relative to this directory object.
func (p *DirectoryInterface) Unlink(path string) (int32, error) {
- req_ := DirectoryUnlinkRequest{
+ req_ := &DirectoryUnlinkRequest{
Path: path,
}
- resp_ := DirectoryUnlinkResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryUnlinkOrdinal, &req_, &resp_)
+ resp_ := &DirectoryUnlinkResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryUnlinkOrdinal, req_, resp_)
return resp_.S, err
}
+// Reads a collection of variably sized dirents into a buffer.
+// The number of dirents in a directory may be very large: akin to
+// calling read multiple times on a file, directories have a seek
+// offset which is updated on subsequent calls to ReadDirents.
+//
+// These dirents are of the form:
+// struct dirent {
+// // Describes the inode of the entry.
+// uint64 ino;
+// // Describes the length of the dirent name.
+// uint8 size;
+// // Describes the type of the entry. Aligned with the
+// /// POSIX d_type values. Use DIRENT_TYPE_* constants.
+// uint8 type;
+// // Unterminated name of entry.
+// char name[0];
+// }
func (p *DirectoryInterface) ReadDirents(maxBytes uint64) (int32, []uint8, error) {
- req_ := DirectoryReadDirentsRequest{
+ req_ := &DirectoryReadDirentsRequest{
MaxBytes: maxBytes,
}
- resp_ := DirectoryReadDirentsResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryReadDirentsOrdinal, &req_, &resp_)
+ resp_ := &DirectoryReadDirentsResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryReadDirentsOrdinal, req_, resp_)
return resp_.S, resp_.Dirents, err
}
+// Reset the directory seek offset.
func (p *DirectoryInterface) Rewind() (int32, error) {
- req_ := DirectoryRewindRequest{}
- resp_ := DirectoryRewindResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryRewindOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectoryRewindResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryRewindOrdinal, req_, resp_)
return resp_.S, err
}
+// Acquire a token to a Directory which can be used to identify
+// access to it at a later point in time.
func (p *DirectoryInterface) GetToken() (int32, _zx.Handle, error) {
- req_ := DirectoryGetTokenRequest{}
- resp_ := DirectoryGetTokenResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryGetTokenOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectoryGetTokenResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryGetTokenOrdinal, req_, resp_)
return resp_.S, resp_.Token, err
}
+// Within the directory, rename an object named src to the name dst, in
+// a directory represented by token.
func (p *DirectoryInterface) Rename(src string, dstParentToken _zx.Handle, dst string) (int32, error) {
- req_ := DirectoryRenameRequest{
+ req_ := &DirectoryRenameRequest{
Src: src,
DstParentToken: dstParentToken,
Dst: dst,
}
- resp_ := DirectoryRenameResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryRenameOrdinal, &req_, &resp_)
+ resp_ := &DirectoryRenameResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryRenameOrdinal, req_, resp_)
return resp_.S, err
}
+// Within the directory, create a link to an object named src by the name
+// dst, within a directory represented by token.
func (p *DirectoryInterface) Link(src string, dstParentToken _zx.Handle, dst string) (int32, error) {
- req_ := DirectoryLinkRequest{
+ req_ := &DirectoryLinkRequest{
Src: src,
DstParentToken: dstParentToken,
Dst: dst,
}
- resp_ := DirectoryLinkResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryLinkOrdinal, &req_, &resp_)
+ resp_ := &DirectoryLinkResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryLinkOrdinal, req_, resp_)
return resp_.S, err
}
+// Watches a directory, receiving events of added messages on the
+// watcher request channel.
+//
+// The "watcher" handle will send messages of the form:
+// struct {
+// uint8 event;
+// uint8 len;
+// char name[];
+// };
+// Where names are NOT null-terminated.
+//
+// This API is unstable; in the future, watcher will be a "DirectoryWatcher" client.
+//
+// Mask specifies a bitmask of events to observe.
+// Options must be zero; it is reserved.
func (p *DirectoryInterface) Watch(mask uint32, options uint32, watcher _zx.Channel) (int32, error) {
- req_ := DirectoryWatchRequest{
+ req_ := &DirectoryWatchRequest{
Mask: mask,
Options: options,
Watcher: watcher,
}
- resp_ := DirectoryWatchResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryWatchOrdinal, &req_, &resp_)
+ resp_ := &DirectoryWatchResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryWatchOrdinal, req_, resp_)
return resp_.S, err
}
+// Directory defines a node which is capable of containing other Objects.
type Directory interface {
+ // Create another connection to the same remote object.
+ //
+ // |flags| may be any of:
+ // - OPEN_RIGHT_*
+ // - OPEN_FLAG_APPEND
+ // - OPEN_FLAG_NO_REMOTE
+ // - OPEN_FLAG_DESCRIBE
+ //
+ // All other flags are ignored.
+ //
+ // The cloned object must have rights less than or equal to the original object.
+ //
+ // TODO: Currently, ulib/fs ignores OPEN_RIGHT_*, and uses the rights of the original
+ // connection. This is a bug.
Clone(flags uint32, object NodeInterfaceRequest) error
+ // Terminates connection with object.
+ //
+ // This method does not require any rights.
Close() (int32, error)
+ // 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.
Describe() (NodeInfo, error)
+ // An event produced eagerly by a fidl server if requested by |OPEN_FLAG_DESCRIBE|.
+ //
+ // Indicates the success or failure of the open operation, and optionally describes the
+ // object. If the status is |ZX_OK|, |info| contains descriptive information about the object
+ // (the same as would be returned by |Describe|).
+ // Synchronizes updates to the node to the underlying media, if it exists.
Sync() (int32, error)
+ // Acquires information about the node.
+ //
+ // This method does not require any rights.
GetAttr() (int32, NodeAttributes, error)
+ // Updates information about the node.
+ // |flags| may be any of NODE_ATTRIBUTE_FLAG_*.
+ //
+ // This method requires following rights: OPEN_RIGHT_WRITABLE.
+ // TODO(ZX-1262): This access restriction is not implemented in ulib/fs.
SetAttr(flags uint32, attributes NodeAttributes) (int32, error)
+ // Deprecated. Only for use with compatibility with devhost.
Ioctl(opcode uint32, maxOut uint64, handles []_zx.Handle, in []uint8) (int32, []_zx.Handle, []uint8, error)
+ // Open a new object relative to this directory object.
+ //
+ // Flags may be any of the OPEN_FLAG_* and OPEN_RIGHT_* values, bitwise ORed together.
+ // The OPEN_FLAG_DESCRIBE flag may cause an |OnOpen| event to be transmitted
+ // on the |object| handle, indicating the type of object opened.
Open(flags uint32, mode uint32, path string, object NodeInterfaceRequest) error
+ // Remove an object relative to this directory object.
Unlink(path string) (int32, error)
+ // Reads a collection of variably sized dirents into a buffer.
+ // The number of dirents in a directory may be very large: akin to
+ // calling read multiple times on a file, directories have a seek
+ // offset which is updated on subsequent calls to ReadDirents.
+ //
+ // These dirents are of the form:
+ // struct dirent {
+ // // Describes the inode of the entry.
+ // uint64 ino;
+ // // Describes the length of the dirent name.
+ // uint8 size;
+ // // Describes the type of the entry. Aligned with the
+ // /// POSIX d_type values. Use DIRENT_TYPE_* constants.
+ // uint8 type;
+ // // Unterminated name of entry.
+ // char name[0];
+ // }
ReadDirents(maxBytes uint64) (int32, []uint8, error)
+ // Reset the directory seek offset.
Rewind() (int32, error)
+ // Acquire a token to a Directory which can be used to identify
+ // access to it at a later point in time.
GetToken() (int32, _zx.Handle, error)
+ // Within the directory, rename an object named src to the name dst, in
+ // a directory represented by token.
Rename(src string, dstParentToken _zx.Handle, dst string) (int32, error)
+ // Within the directory, create a link to an object named src by the name
+ // dst, within a directory represented by token.
Link(src string, dstParentToken _zx.Handle, dst string) (int32, error)
+ // Watches a directory, receiving events of added messages on the
+ // watcher request channel.
+ //
+ // The "watcher" handle will send messages of the form:
+ // struct {
+ // uint8 event;
+ // uint8 len;
+ // char name[];
+ // };
+ // Where names are NOT null-terminated.
+ //
+ // This API is unstable; in the future, watcher will be a "DirectoryWatcher" client.
+ //
+ // Mask specifies a bitmask of events to observe.
+ // Options must be zero; it is reserved.
Watch(mask uint32, options uint32, watcher _zx.Channel) (int32, error)
}
@@ -2872,39 +3046,23 @@
err_ := s.Impl.Clone(in_.Flags, in_.Object)
return nil, err_
case DirectoryCloseOrdinal:
- in_ := DirectoryCloseRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectoryCloseResponse{}
s, err_ := s.Impl.Close()
+ out_ := DirectoryCloseResponse{}
out_.S = s
return &out_, err_
case DirectoryDescribeOrdinal:
- in_ := DirectoryDescribeRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectoryDescribeResponse{}
info, err_ := s.Impl.Describe()
+ out_ := DirectoryDescribeResponse{}
out_.Info = info
return &out_, err_
case DirectorySyncOrdinal:
- in_ := DirectorySyncRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectorySyncResponse{}
s, err_ := s.Impl.Sync()
+ out_ := DirectorySyncResponse{}
out_.S = s
return &out_, err_
case DirectoryGetAttrOrdinal:
- in_ := DirectoryGetAttrRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectoryGetAttrResponse{}
s, attributes, err_ := s.Impl.GetAttr()
+ out_ := DirectoryGetAttrResponse{}
out_.S = s
out_.Attributes = attributes
return &out_, err_
@@ -2913,8 +3071,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectorySetAttrResponse{}
s, err_ := s.Impl.SetAttr(in_.Flags, in_.Attributes)
+ out_ := DirectorySetAttrResponse{}
out_.S = s
return &out_, err_
case DirectoryIoctlOrdinal:
@@ -2922,8 +3080,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectoryIoctlResponse{}
s, handles, out, err_ := s.Impl.Ioctl(in_.Opcode, in_.MaxOut, in_.Handles, in_.In)
+ out_ := DirectoryIoctlResponse{}
out_.S = s
out_.Handles = handles
out_.Out = out
@@ -2940,8 +3098,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectoryUnlinkResponse{}
s, err_ := s.Impl.Unlink(in_.Path)
+ out_ := DirectoryUnlinkResponse{}
out_.S = s
return &out_, err_
case DirectoryReadDirentsOrdinal:
@@ -2949,27 +3107,19 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectoryReadDirentsResponse{}
s, dirents, err_ := s.Impl.ReadDirents(in_.MaxBytes)
+ out_ := DirectoryReadDirentsResponse{}
out_.S = s
out_.Dirents = dirents
return &out_, err_
case DirectoryRewindOrdinal:
- in_ := DirectoryRewindRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectoryRewindResponse{}
s, err_ := s.Impl.Rewind()
+ out_ := DirectoryRewindResponse{}
out_.S = s
return &out_, err_
case DirectoryGetTokenOrdinal:
- in_ := DirectoryGetTokenRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectoryGetTokenResponse{}
s, token, err_ := s.Impl.GetToken()
+ out_ := DirectoryGetTokenResponse{}
out_.S = s
out_.Token = token
return &out_, err_
@@ -2978,8 +3128,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectoryRenameResponse{}
s, err_ := s.Impl.Rename(in_.Src, in_.DstParentToken, in_.Dst)
+ out_ := DirectoryRenameResponse{}
out_.S = s
return &out_, err_
case DirectoryLinkOrdinal:
@@ -2987,8 +3137,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectoryLinkResponse{}
s, err_ := s.Impl.Link(in_.Src, in_.DstParentToken, in_.Dst)
+ out_ := DirectoryLinkResponse{}
out_.S = s
return &out_, err_
case DirectoryWatchOrdinal:
@@ -2996,8 +3146,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectoryWatchResponse{}
s, err_ := s.Impl.Watch(in_.Mask, in_.Options, in_.Watcher)
+ out_ := DirectoryWatchResponse{}
out_.S = s
return &out_, err_
}
@@ -3020,11 +3170,11 @@
type DirectoryEventProxy _bindings.ChannelProxy
func (p *DirectoryEventProxy) OnOpen(s int32, info *NodeInfo) error {
- event_ := DirectoryOnOpenResponse{
+ event_ := &DirectoryOnOpenResponse{
S: s,
Info: info,
}
- return ((*_bindings.ChannelProxy)(p)).Send(DirectoryOnOpenOrdinal, &event_)
+ return ((*_bindings.ChannelProxy)(p)).Send(DirectoryOnOpenOrdinal, event_)
}
const (
@@ -3096,26 +3246,6 @@
return 8
}
-type DirectoryAdminCloseRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectoryAdminCloseRequest = _bindings.CreateLazyMarshaler(DirectoryAdminCloseRequest{})
-
-func (msg *DirectoryAdminCloseRequest) Marshaler() _bindings.Marshaler {
- return _mDirectoryAdminCloseRequest
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminCloseRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminCloseRequest) InlineSize() int {
- return 0
-}
-
type DirectoryAdminCloseResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
@@ -3137,26 +3267,6 @@
return 8
}
-type DirectoryAdminDescribeRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectoryAdminDescribeRequest = _bindings.CreateLazyMarshaler(DirectoryAdminDescribeRequest{})
-
-func (msg *DirectoryAdminDescribeRequest) Marshaler() _bindings.Marshaler {
- return _mDirectoryAdminDescribeRequest
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminDescribeRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminDescribeRequest) InlineSize() int {
- return 0
-}
-
type DirectoryAdminDescribeResponse struct {
_ struct{} `fidl2:"s,32,0"`
Info NodeInfo
@@ -3200,26 +3310,6 @@
return 16
}
-type DirectoryAdminSyncRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectoryAdminSyncRequest = _bindings.CreateLazyMarshaler(DirectoryAdminSyncRequest{})
-
-func (msg *DirectoryAdminSyncRequest) Marshaler() _bindings.Marshaler {
- return _mDirectoryAdminSyncRequest
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminSyncRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminSyncRequest) InlineSize() int {
- return 0
-}
-
type DirectoryAdminSyncResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
@@ -3241,26 +3331,6 @@
return 8
}
-type DirectoryAdminGetAttrRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectoryAdminGetAttrRequest = _bindings.CreateLazyMarshaler(DirectoryAdminGetAttrRequest{})
-
-func (msg *DirectoryAdminGetAttrRequest) Marshaler() _bindings.Marshaler {
- return _mDirectoryAdminGetAttrRequest
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminGetAttrRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminGetAttrRequest) InlineSize() int {
- return 0
-}
-
type DirectoryAdminGetAttrResponse struct {
_ struct{} `fidl2:"s,64,0"`
S int32
@@ -3482,26 +3552,6 @@
return 24
}
-type DirectoryAdminRewindRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectoryAdminRewindRequest = _bindings.CreateLazyMarshaler(DirectoryAdminRewindRequest{})
-
-func (msg *DirectoryAdminRewindRequest) Marshaler() _bindings.Marshaler {
- return _mDirectoryAdminRewindRequest
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminRewindRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminRewindRequest) InlineSize() int {
- return 0
-}
-
type DirectoryAdminRewindResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
@@ -3523,26 +3573,6 @@
return 8
}
-type DirectoryAdminGetTokenRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectoryAdminGetTokenRequest = _bindings.CreateLazyMarshaler(DirectoryAdminGetTokenRequest{})
-
-func (msg *DirectoryAdminGetTokenRequest) Marshaler() _bindings.Marshaler {
- return _mDirectoryAdminGetTokenRequest
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminGetTokenRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminGetTokenRequest) InlineSize() int {
- return 0
-}
-
type DirectoryAdminGetTokenResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
@@ -3783,26 +3813,6 @@
return 8
}
-type DirectoryAdminUnmountRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectoryAdminUnmountRequest = _bindings.CreateLazyMarshaler(DirectoryAdminUnmountRequest{})
-
-func (msg *DirectoryAdminUnmountRequest) Marshaler() _bindings.Marshaler {
- return _mDirectoryAdminUnmountRequest
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminUnmountRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminUnmountRequest) InlineSize() int {
- return 0
-}
-
type DirectoryAdminUnmountResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
@@ -3824,26 +3834,6 @@
return 8
}
-type DirectoryAdminUnmountNodeRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectoryAdminUnmountNodeRequest = _bindings.CreateLazyMarshaler(DirectoryAdminUnmountNodeRequest{})
-
-func (msg *DirectoryAdminUnmountNodeRequest) Marshaler() _bindings.Marshaler {
- return _mDirectoryAdminUnmountNodeRequest
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminUnmountNodeRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminUnmountNodeRequest) InlineSize() int {
- return 0
-}
-
type DirectoryAdminUnmountNodeResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
@@ -3866,26 +3856,6 @@
return 8
}
-type DirectoryAdminQueryFilesystemRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectoryAdminQueryFilesystemRequest = _bindings.CreateLazyMarshaler(DirectoryAdminQueryFilesystemRequest{})
-
-func (msg *DirectoryAdminQueryFilesystemRequest) Marshaler() _bindings.Marshaler {
- return _mDirectoryAdminQueryFilesystemRequest
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminQueryFilesystemRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminQueryFilesystemRequest) InlineSize() int {
- return 0
-}
-
type DirectoryAdminQueryFilesystemResponse struct {
_ struct{} `fidl2:"s,16,0"`
S int32
@@ -3908,26 +3878,6 @@
return 16
}
-type DirectoryAdminGetDevicePathRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mDirectoryAdminGetDevicePathRequest = _bindings.CreateLazyMarshaler(DirectoryAdminGetDevicePathRequest{})
-
-func (msg *DirectoryAdminGetDevicePathRequest) Marshaler() _bindings.Marshaler {
- return _mDirectoryAdminGetDevicePathRequest
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminGetDevicePathRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *DirectoryAdminGetDevicePathRequest) InlineSize() int {
- return 0
-}
-
type DirectoryAdminGetDevicePathResponse struct {
_ struct{} `fidl2:"s,24,0"`
S int32
@@ -3952,216 +3902,404 @@
type DirectoryAdminInterface _bindings.ChannelProxy
+// Create another connection to the same remote object.
+//
+// |flags| may be any of:
+// - OPEN_RIGHT_*
+// - OPEN_FLAG_APPEND
+// - OPEN_FLAG_NO_REMOTE
+// - OPEN_FLAG_DESCRIBE
+//
+// All other flags are ignored.
+//
+// The cloned object must have rights less than or equal to the original object.
+//
+// TODO: Currently, ulib/fs ignores OPEN_RIGHT_*, and uses the rights of the original
+// connection. This is a bug.
func (p *DirectoryAdminInterface) Clone(flags uint32, object NodeInterfaceRequest) error {
- req_ := DirectoryAdminCloneRequest{
+ req_ := &DirectoryAdminCloneRequest{
Flags: flags,
Object: object,
}
- err := ((*_bindings.ChannelProxy)(p)).Send(DirectoryAdminCloneOrdinal, &req_)
+ err := ((*_bindings.ChannelProxy)(p)).Send(DirectoryAdminCloneOrdinal, req_)
return err
}
+// Terminates connection with object.
+//
+// This method does not require any rights.
func (p *DirectoryAdminInterface) Close() (int32, error) {
- req_ := DirectoryAdminCloseRequest{}
- resp_ := DirectoryAdminCloseResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminCloseOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectoryAdminCloseResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminCloseOrdinal, req_, resp_)
return resp_.S, err
}
+// 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.
func (p *DirectoryAdminInterface) Describe() (NodeInfo, error) {
- req_ := DirectoryAdminDescribeRequest{}
- resp_ := DirectoryAdminDescribeResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminDescribeOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectoryAdminDescribeResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminDescribeOrdinal, req_, resp_)
return resp_.Info, err
}
+// An event produced eagerly by a fidl server if requested by |OPEN_FLAG_DESCRIBE|.
+//
+// Indicates the success or failure of the open operation, and optionally describes the
+// object. If the status is |ZX_OK|, |info| contains descriptive information about the object
+// (the same as would be returned by |Describe|).
func (p *DirectoryAdminInterface) ExpectOnOpen() (int32, *NodeInfo, error) {
- resp_ := DirectoryAdminOnOpenResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Recv(DirectoryAdminOnOpenOrdinal, &resp_)
+ resp_ := &DirectoryAdminOnOpenResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Recv(DirectoryAdminOnOpenOrdinal, resp_)
return resp_.S, resp_.Info, err
}
+// Synchronizes updates to the node to the underlying media, if it exists.
func (p *DirectoryAdminInterface) Sync() (int32, error) {
- req_ := DirectoryAdminSyncRequest{}
- resp_ := DirectoryAdminSyncResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminSyncOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectoryAdminSyncResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminSyncOrdinal, req_, resp_)
return resp_.S, err
}
+// Acquires information about the node.
+//
+// This method does not require any rights.
func (p *DirectoryAdminInterface) GetAttr() (int32, NodeAttributes, error) {
- req_ := DirectoryAdminGetAttrRequest{}
- resp_ := DirectoryAdminGetAttrResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminGetAttrOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectoryAdminGetAttrResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminGetAttrOrdinal, req_, resp_)
return resp_.S, resp_.Attributes, err
}
+// Updates information about the node.
+// |flags| may be any of NODE_ATTRIBUTE_FLAG_*.
+//
+// This method requires following rights: OPEN_RIGHT_WRITABLE.
+// TODO(ZX-1262): This access restriction is not implemented in ulib/fs.
func (p *DirectoryAdminInterface) SetAttr(flags uint32, attributes NodeAttributes) (int32, error) {
- req_ := DirectoryAdminSetAttrRequest{
+ req_ := &DirectoryAdminSetAttrRequest{
Flags: flags,
Attributes: attributes,
}
- resp_ := DirectoryAdminSetAttrResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminSetAttrOrdinal, &req_, &resp_)
+ resp_ := &DirectoryAdminSetAttrResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminSetAttrOrdinal, req_, resp_)
return resp_.S, err
}
+// Deprecated. Only for use with compatibility with devhost.
func (p *DirectoryAdminInterface) Ioctl(opcode uint32, maxOut uint64, handles []_zx.Handle, in []uint8) (int32, []_zx.Handle, []uint8, error) {
- req_ := DirectoryAdminIoctlRequest{
+ req_ := &DirectoryAdminIoctlRequest{
Opcode: opcode,
MaxOut: maxOut,
Handles: handles,
In: in,
}
- resp_ := DirectoryAdminIoctlResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminIoctlOrdinal, &req_, &resp_)
+ resp_ := &DirectoryAdminIoctlResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminIoctlOrdinal, req_, resp_)
return resp_.S, resp_.Handles, resp_.Out, err
}
+// Open a new object relative to this directory object.
+//
+// Flags may be any of the OPEN_FLAG_* and OPEN_RIGHT_* values, bitwise ORed together.
+// The OPEN_FLAG_DESCRIBE flag may cause an |OnOpen| event to be transmitted
+// on the |object| handle, indicating the type of object opened.
func (p *DirectoryAdminInterface) Open(flags uint32, mode uint32, path string, object NodeInterfaceRequest) error {
- req_ := DirectoryAdminOpenRequest{
+ req_ := &DirectoryAdminOpenRequest{
Flags: flags,
Mode: mode,
Path: path,
Object: object,
}
- err := ((*_bindings.ChannelProxy)(p)).Send(DirectoryAdminOpenOrdinal, &req_)
+ err := ((*_bindings.ChannelProxy)(p)).Send(DirectoryAdminOpenOrdinal, req_)
return err
}
+// Remove an object relative to this directory object.
func (p *DirectoryAdminInterface) Unlink(path string) (int32, error) {
- req_ := DirectoryAdminUnlinkRequest{
+ req_ := &DirectoryAdminUnlinkRequest{
Path: path,
}
- resp_ := DirectoryAdminUnlinkResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminUnlinkOrdinal, &req_, &resp_)
+ resp_ := &DirectoryAdminUnlinkResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminUnlinkOrdinal, req_, resp_)
return resp_.S, err
}
+// Reads a collection of variably sized dirents into a buffer.
+// The number of dirents in a directory may be very large: akin to
+// calling read multiple times on a file, directories have a seek
+// offset which is updated on subsequent calls to ReadDirents.
+//
+// These dirents are of the form:
+// struct dirent {
+// // Describes the inode of the entry.
+// uint64 ino;
+// // Describes the length of the dirent name.
+// uint8 size;
+// // Describes the type of the entry. Aligned with the
+// /// POSIX d_type values. Use DIRENT_TYPE_* constants.
+// uint8 type;
+// // Unterminated name of entry.
+// char name[0];
+// }
func (p *DirectoryAdminInterface) ReadDirents(maxBytes uint64) (int32, []uint8, error) {
- req_ := DirectoryAdminReadDirentsRequest{
+ req_ := &DirectoryAdminReadDirentsRequest{
MaxBytes: maxBytes,
}
- resp_ := DirectoryAdminReadDirentsResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminReadDirentsOrdinal, &req_, &resp_)
+ resp_ := &DirectoryAdminReadDirentsResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminReadDirentsOrdinal, req_, resp_)
return resp_.S, resp_.Dirents, err
}
+// Reset the directory seek offset.
func (p *DirectoryAdminInterface) Rewind() (int32, error) {
- req_ := DirectoryAdminRewindRequest{}
- resp_ := DirectoryAdminRewindResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminRewindOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectoryAdminRewindResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminRewindOrdinal, req_, resp_)
return resp_.S, err
}
+// Acquire a token to a Directory which can be used to identify
+// access to it at a later point in time.
func (p *DirectoryAdminInterface) GetToken() (int32, _zx.Handle, error) {
- req_ := DirectoryAdminGetTokenRequest{}
- resp_ := DirectoryAdminGetTokenResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminGetTokenOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectoryAdminGetTokenResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminGetTokenOrdinal, req_, resp_)
return resp_.S, resp_.Token, err
}
+// Within the directory, rename an object named src to the name dst, in
+// a directory represented by token.
func (p *DirectoryAdminInterface) Rename(src string, dstParentToken _zx.Handle, dst string) (int32, error) {
- req_ := DirectoryAdminRenameRequest{
+ req_ := &DirectoryAdminRenameRequest{
Src: src,
DstParentToken: dstParentToken,
Dst: dst,
}
- resp_ := DirectoryAdminRenameResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminRenameOrdinal, &req_, &resp_)
+ resp_ := &DirectoryAdminRenameResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminRenameOrdinal, req_, resp_)
return resp_.S, err
}
+// Within the directory, create a link to an object named src by the name
+// dst, within a directory represented by token.
func (p *DirectoryAdminInterface) Link(src string, dstParentToken _zx.Handle, dst string) (int32, error) {
- req_ := DirectoryAdminLinkRequest{
+ req_ := &DirectoryAdminLinkRequest{
Src: src,
DstParentToken: dstParentToken,
Dst: dst,
}
- resp_ := DirectoryAdminLinkResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminLinkOrdinal, &req_, &resp_)
+ resp_ := &DirectoryAdminLinkResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminLinkOrdinal, req_, resp_)
return resp_.S, err
}
+// Watches a directory, receiving events of added messages on the
+// watcher request channel.
+//
+// The "watcher" handle will send messages of the form:
+// struct {
+// uint8 event;
+// uint8 len;
+// char name[];
+// };
+// Where names are NOT null-terminated.
+//
+// This API is unstable; in the future, watcher will be a "DirectoryWatcher" client.
+//
+// Mask specifies a bitmask of events to observe.
+// Options must be zero; it is reserved.
func (p *DirectoryAdminInterface) Watch(mask uint32, options uint32, watcher _zx.Channel) (int32, error) {
- req_ := DirectoryAdminWatchRequest{
+ req_ := &DirectoryAdminWatchRequest{
Mask: mask,
Options: options,
Watcher: watcher,
}
- resp_ := DirectoryAdminWatchResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminWatchOrdinal, &req_, &resp_)
+ resp_ := &DirectoryAdminWatchResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminWatchOrdinal, req_, resp_)
return resp_.S, err
}
+// Mount a channel representing a remote filesystem onto this directory.
+// All future requests to this node will be forwarded to the remote filesystem.
+// To re-open a node without forwarding to the remote target, the node
+// should be opened with OPEN_FLAG_NO_REMOTE.
func (p *DirectoryAdminInterface) Mount(remote DirectoryInterface) (int32, error) {
- req_ := DirectoryAdminMountRequest{
+ req_ := &DirectoryAdminMountRequest{
Remote: remote,
}
- resp_ := DirectoryAdminMountResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminMountOrdinal, &req_, &resp_)
+ resp_ := &DirectoryAdminMountResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminMountOrdinal, req_, resp_)
return resp_.S, err
}
+// Atomically create a directory with a provided path, and mount the
+// remote handle to the newly created directory.
func (p *DirectoryAdminInterface) MountAndCreate(remote DirectoryInterface, name string, flags uint32) (int32, error) {
- req_ := DirectoryAdminMountAndCreateRequest{
+ req_ := &DirectoryAdminMountAndCreateRequest{
Remote: remote,
Name: name,
Flags: flags,
}
- resp_ := DirectoryAdminMountAndCreateResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminMountAndCreateOrdinal, &req_, &resp_)
+ resp_ := &DirectoryAdminMountAndCreateResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminMountAndCreateOrdinal, req_, resp_)
return resp_.S, err
}
+// Unmount this filesystem. After this function returns successfully,
+// all connections to the filesystem will be terminated.
func (p *DirectoryAdminInterface) Unmount() (int32, error) {
- req_ := DirectoryAdminUnmountRequest{}
- resp_ := DirectoryAdminUnmountResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminUnmountOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectoryAdminUnmountResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminUnmountOrdinal, req_, resp_)
return resp_.S, err
}
+// Detach a node which was previously attached to this directory
+// with Mount.
func (p *DirectoryAdminInterface) UnmountNode() (int32, DirectoryInterface, error) {
- req_ := DirectoryAdminUnmountNodeRequest{}
- resp_ := DirectoryAdminUnmountNodeResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminUnmountNodeOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectoryAdminUnmountNodeResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminUnmountNodeOrdinal, req_, resp_)
return resp_.S, resp_.Remote, err
}
+// Query the filesystem for filesystem-specific information.
func (p *DirectoryAdminInterface) QueryFilesystem() (int32, *FilesystemInfo, error) {
- req_ := DirectoryAdminQueryFilesystemRequest{}
- resp_ := DirectoryAdminQueryFilesystemResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminQueryFilesystemOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectoryAdminQueryFilesystemResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminQueryFilesystemOrdinal, req_, resp_)
return resp_.S, resp_.Info, err
}
+// Acquire the path to the device backing this filesystem, if there is one.
func (p *DirectoryAdminInterface) GetDevicePath() (int32, *string, error) {
- req_ := DirectoryAdminGetDevicePathRequest{}
- resp_ := DirectoryAdminGetDevicePathResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminGetDevicePathOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &DirectoryAdminGetDevicePathResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminGetDevicePathOrdinal, req_, resp_)
return resp_.S, resp_.Path, err
}
+// DirectoryAdmin defines a directory which is capable of handling
+// administrator tasks within the filesystem.
type DirectoryAdmin interface {
+ // Create another connection to the same remote object.
+ //
+ // |flags| may be any of:
+ // - OPEN_RIGHT_*
+ // - OPEN_FLAG_APPEND
+ // - OPEN_FLAG_NO_REMOTE
+ // - OPEN_FLAG_DESCRIBE
+ //
+ // All other flags are ignored.
+ //
+ // The cloned object must have rights less than or equal to the original object.
+ //
+ // TODO: Currently, ulib/fs ignores OPEN_RIGHT_*, and uses the rights of the original
+ // connection. This is a bug.
Clone(flags uint32, object NodeInterfaceRequest) error
+ // Terminates connection with object.
+ //
+ // This method does not require any rights.
Close() (int32, error)
+ // 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.
Describe() (NodeInfo, error)
+ // An event produced eagerly by a fidl server if requested by |OPEN_FLAG_DESCRIBE|.
+ //
+ // Indicates the success or failure of the open operation, and optionally describes the
+ // object. If the status is |ZX_OK|, |info| contains descriptive information about the object
+ // (the same as would be returned by |Describe|).
+ // Synchronizes updates to the node to the underlying media, if it exists.
Sync() (int32, error)
+ // Acquires information about the node.
+ //
+ // This method does not require any rights.
GetAttr() (int32, NodeAttributes, error)
+ // Updates information about the node.
+ // |flags| may be any of NODE_ATTRIBUTE_FLAG_*.
+ //
+ // This method requires following rights: OPEN_RIGHT_WRITABLE.
+ // TODO(ZX-1262): This access restriction is not implemented in ulib/fs.
SetAttr(flags uint32, attributes NodeAttributes) (int32, error)
+ // Deprecated. Only for use with compatibility with devhost.
Ioctl(opcode uint32, maxOut uint64, handles []_zx.Handle, in []uint8) (int32, []_zx.Handle, []uint8, error)
+ // Open a new object relative to this directory object.
+ //
+ // Flags may be any of the OPEN_FLAG_* and OPEN_RIGHT_* values, bitwise ORed together.
+ // The OPEN_FLAG_DESCRIBE flag may cause an |OnOpen| event to be transmitted
+ // on the |object| handle, indicating the type of object opened.
Open(flags uint32, mode uint32, path string, object NodeInterfaceRequest) error
+ // Remove an object relative to this directory object.
Unlink(path string) (int32, error)
+ // Reads a collection of variably sized dirents into a buffer.
+ // The number of dirents in a directory may be very large: akin to
+ // calling read multiple times on a file, directories have a seek
+ // offset which is updated on subsequent calls to ReadDirents.
+ //
+ // These dirents are of the form:
+ // struct dirent {
+ // // Describes the inode of the entry.
+ // uint64 ino;
+ // // Describes the length of the dirent name.
+ // uint8 size;
+ // // Describes the type of the entry. Aligned with the
+ // /// POSIX d_type values. Use DIRENT_TYPE_* constants.
+ // uint8 type;
+ // // Unterminated name of entry.
+ // char name[0];
+ // }
ReadDirents(maxBytes uint64) (int32, []uint8, error)
+ // Reset the directory seek offset.
Rewind() (int32, error)
+ // Acquire a token to a Directory which can be used to identify
+ // access to it at a later point in time.
GetToken() (int32, _zx.Handle, error)
+ // Within the directory, rename an object named src to the name dst, in
+ // a directory represented by token.
Rename(src string, dstParentToken _zx.Handle, dst string) (int32, error)
+ // Within the directory, create a link to an object named src by the name
+ // dst, within a directory represented by token.
Link(src string, dstParentToken _zx.Handle, dst string) (int32, error)
+ // Watches a directory, receiving events of added messages on the
+ // watcher request channel.
+ //
+ // The "watcher" handle will send messages of the form:
+ // struct {
+ // uint8 event;
+ // uint8 len;
+ // char name[];
+ // };
+ // Where names are NOT null-terminated.
+ //
+ // This API is unstable; in the future, watcher will be a "DirectoryWatcher" client.
+ //
+ // Mask specifies a bitmask of events to observe.
+ // Options must be zero; it is reserved.
Watch(mask uint32, options uint32, watcher _zx.Channel) (int32, error)
+ // Mount a channel representing a remote filesystem onto this directory.
+ // All future requests to this node will be forwarded to the remote filesystem.
+ // To re-open a node without forwarding to the remote target, the node
+ // should be opened with OPEN_FLAG_NO_REMOTE.
Mount(remote DirectoryInterface) (int32, error)
+ // Atomically create a directory with a provided path, and mount the
+ // remote handle to the newly created directory.
MountAndCreate(remote DirectoryInterface, name string, flags uint32) (int32, error)
+ // Unmount this filesystem. After this function returns successfully,
+ // all connections to the filesystem will be terminated.
Unmount() (int32, error)
+ // Detach a node which was previously attached to this directory
+ // with Mount.
UnmountNode() (int32, DirectoryInterface, error)
+ // Query the filesystem for filesystem-specific information.
QueryFilesystem() (int32, *FilesystemInfo, error)
+ // Acquire the path to the device backing this filesystem, if there is one.
GetDevicePath() (int32, *string, error)
}
@@ -4188,39 +4326,23 @@
err_ := s.Impl.Clone(in_.Flags, in_.Object)
return nil, err_
case DirectoryAdminCloseOrdinal:
- in_ := DirectoryAdminCloseRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectoryAdminCloseResponse{}
s, err_ := s.Impl.Close()
+ out_ := DirectoryAdminCloseResponse{}
out_.S = s
return &out_, err_
case DirectoryAdminDescribeOrdinal:
- in_ := DirectoryAdminDescribeRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectoryAdminDescribeResponse{}
info, err_ := s.Impl.Describe()
+ out_ := DirectoryAdminDescribeResponse{}
out_.Info = info
return &out_, err_
case DirectoryAdminSyncOrdinal:
- in_ := DirectoryAdminSyncRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectoryAdminSyncResponse{}
s, err_ := s.Impl.Sync()
+ out_ := DirectoryAdminSyncResponse{}
out_.S = s
return &out_, err_
case DirectoryAdminGetAttrOrdinal:
- in_ := DirectoryAdminGetAttrRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectoryAdminGetAttrResponse{}
s, attributes, err_ := s.Impl.GetAttr()
+ out_ := DirectoryAdminGetAttrResponse{}
out_.S = s
out_.Attributes = attributes
return &out_, err_
@@ -4229,8 +4351,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectoryAdminSetAttrResponse{}
s, err_ := s.Impl.SetAttr(in_.Flags, in_.Attributes)
+ out_ := DirectoryAdminSetAttrResponse{}
out_.S = s
return &out_, err_
case DirectoryAdminIoctlOrdinal:
@@ -4238,8 +4360,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectoryAdminIoctlResponse{}
s, handles, out, err_ := s.Impl.Ioctl(in_.Opcode, in_.MaxOut, in_.Handles, in_.In)
+ out_ := DirectoryAdminIoctlResponse{}
out_.S = s
out_.Handles = handles
out_.Out = out
@@ -4256,8 +4378,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectoryAdminUnlinkResponse{}
s, err_ := s.Impl.Unlink(in_.Path)
+ out_ := DirectoryAdminUnlinkResponse{}
out_.S = s
return &out_, err_
case DirectoryAdminReadDirentsOrdinal:
@@ -4265,27 +4387,19 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectoryAdminReadDirentsResponse{}
s, dirents, err_ := s.Impl.ReadDirents(in_.MaxBytes)
+ out_ := DirectoryAdminReadDirentsResponse{}
out_.S = s
out_.Dirents = dirents
return &out_, err_
case DirectoryAdminRewindOrdinal:
- in_ := DirectoryAdminRewindRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectoryAdminRewindResponse{}
s, err_ := s.Impl.Rewind()
+ out_ := DirectoryAdminRewindResponse{}
out_.S = s
return &out_, err_
case DirectoryAdminGetTokenOrdinal:
- in_ := DirectoryAdminGetTokenRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectoryAdminGetTokenResponse{}
s, token, err_ := s.Impl.GetToken()
+ out_ := DirectoryAdminGetTokenResponse{}
out_.S = s
out_.Token = token
return &out_, err_
@@ -4294,8 +4408,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectoryAdminRenameResponse{}
s, err_ := s.Impl.Rename(in_.Src, in_.DstParentToken, in_.Dst)
+ out_ := DirectoryAdminRenameResponse{}
out_.S = s
return &out_, err_
case DirectoryAdminLinkOrdinal:
@@ -4303,8 +4417,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectoryAdminLinkResponse{}
s, err_ := s.Impl.Link(in_.Src, in_.DstParentToken, in_.Dst)
+ out_ := DirectoryAdminLinkResponse{}
out_.S = s
return &out_, err_
case DirectoryAdminWatchOrdinal:
@@ -4312,8 +4426,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectoryAdminWatchResponse{}
s, err_ := s.Impl.Watch(in_.Mask, in_.Options, in_.Watcher)
+ out_ := DirectoryAdminWatchResponse{}
out_.S = s
return &out_, err_
case DirectoryAdminMountOrdinal:
@@ -4321,8 +4435,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectoryAdminMountResponse{}
s, err_ := s.Impl.Mount(in_.Remote)
+ out_ := DirectoryAdminMountResponse{}
out_.S = s
return &out_, err_
case DirectoryAdminMountAndCreateOrdinal:
@@ -4330,46 +4444,30 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := DirectoryAdminMountAndCreateResponse{}
s, err_ := s.Impl.MountAndCreate(in_.Remote, in_.Name, in_.Flags)
+ out_ := DirectoryAdminMountAndCreateResponse{}
out_.S = s
return &out_, err_
case DirectoryAdminUnmountOrdinal:
- in_ := DirectoryAdminUnmountRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectoryAdminUnmountResponse{}
s, err_ := s.Impl.Unmount()
+ out_ := DirectoryAdminUnmountResponse{}
out_.S = s
return &out_, err_
case DirectoryAdminUnmountNodeOrdinal:
- in_ := DirectoryAdminUnmountNodeRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectoryAdminUnmountNodeResponse{}
s, remote, err_ := s.Impl.UnmountNode()
+ out_ := DirectoryAdminUnmountNodeResponse{}
out_.S = s
out_.Remote = remote
return &out_, err_
case DirectoryAdminQueryFilesystemOrdinal:
- in_ := DirectoryAdminQueryFilesystemRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectoryAdminQueryFilesystemResponse{}
s, info, err_ := s.Impl.QueryFilesystem()
+ out_ := DirectoryAdminQueryFilesystemResponse{}
out_.S = s
out_.Info = info
return &out_, err_
case DirectoryAdminGetDevicePathOrdinal:
- in_ := DirectoryAdminGetDevicePathRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := DirectoryAdminGetDevicePathResponse{}
s, path, err_ := s.Impl.GetDevicePath()
+ out_ := DirectoryAdminGetDevicePathResponse{}
out_.S = s
out_.Path = path
return &out_, err_
@@ -4393,9 +4491,9 @@
type DirectoryAdminEventProxy _bindings.ChannelProxy
func (p *DirectoryAdminEventProxy) OnOpen(s int32, info *NodeInfo) error {
- event_ := DirectoryAdminOnOpenResponse{
+ event_ := &DirectoryAdminOnOpenResponse{
S: s,
Info: info,
}
- return ((*_bindings.ChannelProxy)(p)).Send(DirectoryAdminOnOpenOrdinal, &event_)
+ return ((*_bindings.ChannelProxy)(p)).Send(DirectoryAdminOnOpenOrdinal, event_)
}
diff --git a/src/syscall/zx/mem/impl.go b/src/syscall/zx/mem/impl.go
index 00807c5..912fc3f 100644
--- a/src/syscall/zx/mem/impl.go
+++ b/src/syscall/zx/mem/impl.go
@@ -15,9 +15,19 @@
_bindings "syscall/zx/fidl"
)
+// A Buffer for data whose size is not necessarily a multiple of the page
+// size.
+//
+// VMO objects have a physical size that is always a multiple of the page
+// size. As such, VMO alone cannot serve as a buffer for arbitrarly sized
+// data. |fuchsia.mem.Buffer| is a standard struct that aggregate the VMO
+// and its size.
type Buffer struct {
- _ struct{} `fidl2:"s,16,8"`
- Vmo _zx.VMO `fidl2:"0"`
+ _ struct{} `fidl2:"s,16,8"`
+ // The vmo.
+ Vmo _zx.VMO `fidl2:"0"`
+ // The size of the data in the vmo in bytes. This size must be smaller
+ // than the physical size of the vmo.
Size uint64
}
diff --git a/src/syscall/zx/net/impl.go b/src/syscall/zx/net/impl.go
index 11ea12a..5b0a8c5 100644
--- a/src/syscall/zx/net/impl.go
+++ b/src/syscall/zx/net/impl.go
@@ -252,7 +252,7 @@
const (
ConnectivityOnNetworkReachableOrdinal uint32 = 1703348424
- ConnectivityOnNetworkReachableGenOrdinal uint32 = 1
+ ConnectivityOnNetworkReachableGenOrdinal uint32 = 1703348424
)
type ConnectivityOnNetworkReachableResponse struct {
@@ -279,8 +279,8 @@
type ConnectivityInterface _bindings.ChannelProxy
func (p *ConnectivityInterface) ExpectOnNetworkReachable() (bool, error) {
- resp_ := ConnectivityOnNetworkReachableResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Recv(ConnectivityOnNetworkReachableOrdinal, &resp_, ConnectivityOnNetworkReachableGenOrdinal)
+ resp_ := &ConnectivityOnNetworkReachableResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Recv(ConnectivityOnNetworkReachableOrdinal, resp_)
return resp_.Reachable, err
}
@@ -332,10 +332,10 @@
type ConnectivityEventProxy _bindings.ChannelProxy
func (p *ConnectivityEventProxy) OnNetworkReachable(reachable bool) error {
- event_ := ConnectivityOnNetworkReachableResponse{
+ event_ := &ConnectivityOnNetworkReachableResponse{
Reachable: reachable,
}
- return ((*_bindings.ChannelProxy)(p)).Send(ConnectivityOnNetworkReachableOrdinal, &event_)
+ return ((*_bindings.ChannelProxy)(p)).Send(ConnectivityOnNetworkReachableOrdinal, event_)
}
const (
@@ -439,24 +439,24 @@
type SocketProviderInterface _bindings.ChannelProxy
func (p *SocketProviderInterface) Socket(domain int16, type_ int16, protocol int16) (int16, _zx.Socket, error) {
- req_ := SocketProviderSocketRequest{
+ req_ := &SocketProviderSocketRequest{
Domain: domain,
Type: type_,
Protocol: protocol,
}
- resp_ := SocketProviderSocketResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(SocketProviderSocketOrdinal, &req_, &resp_)
+ resp_ := &SocketProviderSocketResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(SocketProviderSocketOrdinal, req_, resp_)
return resp_.Code, resp_.S, err
}
func (p *SocketProviderInterface) GetAddrInfo(node *string, service *string, hints *AddrInfoHints) (AddrInfoStatus, uint32, [4]AddrInfo, error) {
- req_ := SocketProviderGetAddrInfoRequest{
+ req_ := &SocketProviderGetAddrInfoRequest{
Node: node,
Service: service,
Hints: hints,
}
- resp_ := SocketProviderGetAddrInfoResponse{}
- err := ((*_bindings.ChannelProxy)(p)).Call(SocketProviderGetAddrInfoOrdinal, &req_, &resp_)
+ resp_ := &SocketProviderGetAddrInfoResponse{}
+ err := ((*_bindings.ChannelProxy)(p)).Call(SocketProviderGetAddrInfoOrdinal, req_, resp_)
return resp_.Status, resp_.Nres, resp_.Res, err
}
@@ -496,8 +496,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := SocketProviderSocketResponse{}
code, s, err_ := s.Impl.Socket(in_.Domain, in_.Type, in_.Protocol)
+ out_ := SocketProviderSocketResponse{}
out_.Code = code
out_.S = s
return &out_, err_
@@ -506,8 +506,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := SocketProviderGetAddrInfoResponse{}
status, nres, res, err_ := s.Impl.GetAddrInfo(in_.Node, in_.Service, in_.Hints)
+ out_ := SocketProviderGetAddrInfoResponse{}
out_.Status = status
out_.Nres = nres
out_.Res = res
@@ -554,26 +554,6 @@
SocketControlGetSockOptGenOrdinal uint32 = 2132650507
)
-type SocketControlCloseRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mSocketControlCloseRequest = _bindings.CreateLazyMarshaler(SocketControlCloseRequest{})
-
-func (msg *SocketControlCloseRequest) Marshaler() _bindings.Marshaler {
- return _mSocketControlCloseRequest
-}
-
-// Implements Payload.
-func (_ *SocketControlCloseRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *SocketControlCloseRequest) InlineSize() int {
- return 0
-}
-
type SocketControlCloseResponse struct {
_ struct{} `fidl2:"s,8,0"`
Code int16
@@ -807,26 +787,6 @@
return 8
}
-type SocketControlGetSockNameRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mSocketControlGetSockNameRequest = _bindings.CreateLazyMarshaler(SocketControlGetSockNameRequest{})
-
-func (msg *SocketControlGetSockNameRequest) Marshaler() _bindings.Marshaler {
- return _mSocketControlGetSockNameRequest
-}
-
-// Implements Payload.
-func (_ *SocketControlGetSockNameRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *SocketControlGetSockNameRequest) InlineSize() int {
- return 0
-}
-
type SocketControlGetSockNameResponse struct {
_ struct{} `fidl2:"s,24,0"`
Code int16
@@ -849,26 +809,6 @@
return 24
}
-type SocketControlGetPeerNameRequest struct {
- _ struct{} `fidl2:"s,0,0"`
-}
-
-var _mSocketControlGetPeerNameRequest = _bindings.CreateLazyMarshaler(SocketControlGetPeerNameRequest{})
-
-func (msg *SocketControlGetPeerNameRequest) Marshaler() _bindings.Marshaler {
- return _mSocketControlGetPeerNameRequest
-}
-
-// Implements Payload.
-func (_ *SocketControlGetPeerNameRequest) InlineAlignment() int {
- return 0
-}
-
-// Implements Payload.
-func (_ *SocketControlGetPeerNameRequest) InlineSize() int {
- return 0
-}
-
type SocketControlGetPeerNameResponse struct {
_ struct{} `fidl2:"s,24,0"`
Code int16
@@ -982,90 +922,90 @@
type SocketControlInterface _bindings.SocketControlProxy
func (p *SocketControlInterface) Close() (int16, error) {
- req_ := SocketControlCloseRequest{}
- resp_ := SocketControlCloseResponse{}
- err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlCloseOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &SocketControlCloseResponse{}
+ err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlCloseOrdinal, req_, resp_)
return resp_.Code, err
}
func (p *SocketControlInterface) Ioctl(req int16, in []uint8) (int16, []uint8, error) {
- req_ := SocketControlIoctlRequest{
+ req_ := &SocketControlIoctlRequest{
Req: req,
In: in,
}
- resp_ := SocketControlIoctlResponse{}
- err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlIoctlOrdinal, &req_, &resp_)
+ resp_ := &SocketControlIoctlResponse{}
+ err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlIoctlOrdinal, req_, resp_)
return resp_.Code, resp_.Out, err
}
func (p *SocketControlInterface) Connect(addr []uint8) (int16, error) {
- req_ := SocketControlConnectRequest{
+ req_ := &SocketControlConnectRequest{
Addr: addr,
}
- resp_ := SocketControlConnectResponse{}
- err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlConnectOrdinal, &req_, &resp_)
+ resp_ := &SocketControlConnectResponse{}
+ err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlConnectOrdinal, req_, resp_)
return resp_.Code, err
}
func (p *SocketControlInterface) Accept(flags int16) (int16, error) {
- req_ := SocketControlAcceptRequest{
+ req_ := &SocketControlAcceptRequest{
Flags: flags,
}
- resp_ := SocketControlAcceptResponse{}
- err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlAcceptOrdinal, &req_, &resp_)
+ resp_ := &SocketControlAcceptResponse{}
+ err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlAcceptOrdinal, req_, resp_)
return resp_.Code, err
}
func (p *SocketControlInterface) Bind(addr []uint8) (int16, error) {
- req_ := SocketControlBindRequest{
+ req_ := &SocketControlBindRequest{
Addr: addr,
}
- resp_ := SocketControlBindResponse{}
- err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlBindOrdinal, &req_, &resp_)
+ resp_ := &SocketControlBindResponse{}
+ err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlBindOrdinal, req_, resp_)
return resp_.Code, err
}
func (p *SocketControlInterface) Listen(backlog int16) (int16, error) {
- req_ := SocketControlListenRequest{
+ req_ := &SocketControlListenRequest{
Backlog: backlog,
}
- resp_ := SocketControlListenResponse{}
- err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlListenOrdinal, &req_, &resp_)
+ resp_ := &SocketControlListenResponse{}
+ err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlListenOrdinal, req_, resp_)
return resp_.Code, err
}
func (p *SocketControlInterface) GetSockName() (int16, []uint8, error) {
- req_ := SocketControlGetSockNameRequest{}
- resp_ := SocketControlGetSockNameResponse{}
- err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlGetSockNameOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &SocketControlGetSockNameResponse{}
+ err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlGetSockNameOrdinal, req_, resp_)
return resp_.Code, resp_.Addr, err
}
func (p *SocketControlInterface) GetPeerName() (int16, []uint8, error) {
- req_ := SocketControlGetPeerNameRequest{}
- resp_ := SocketControlGetPeerNameResponse{}
- err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlGetPeerNameOrdinal, &req_, &resp_)
+ var req_ _bindings.Payload
+ resp_ := &SocketControlGetPeerNameResponse{}
+ err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlGetPeerNameOrdinal, req_, resp_)
return resp_.Code, resp_.Addr, err
}
func (p *SocketControlInterface) SetSockOpt(level int16, optname int16, optval []uint8) (int16, error) {
- req_ := SocketControlSetSockOptRequest{
+ req_ := &SocketControlSetSockOptRequest{
Level: level,
Optname: optname,
Optval: optval,
}
- resp_ := SocketControlSetSockOptResponse{}
- err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlSetSockOptOrdinal, &req_, &resp_)
+ resp_ := &SocketControlSetSockOptResponse{}
+ err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlSetSockOptOrdinal, req_, resp_)
return resp_.Code, err
}
func (p *SocketControlInterface) GetSockOpt(level int16, optname int16) (int16, []uint8, error) {
- req_ := SocketControlGetSockOptRequest{
+ req_ := &SocketControlGetSockOptRequest{
Level: level,
Optname: optname,
}
- resp_ := SocketControlGetSockOptResponse{}
- err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlGetSockOptOrdinal, &req_, &resp_)
+ resp_ := &SocketControlGetSockOptResponse{}
+ err := ((*_bindings.SocketControlProxy)(p)).Call(SocketControlGetSockOptOrdinal, req_, resp_)
return resp_.Code, resp_.Optval, err
}
@@ -1091,12 +1031,8 @@
func (s *SocketControlStub) Dispatch(ord uint32, b_ []byte, h_ []_zx.Handle) (_bindings.Payload, error) {
switch ord {
case SocketControlCloseOrdinal:
- in_ := SocketControlCloseRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := SocketControlCloseResponse{}
code, err_ := s.Impl.Close()
+ out_ := SocketControlCloseResponse{}
out_.Code = code
return &out_, err_
case SocketControlIoctlOrdinal:
@@ -1104,8 +1040,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := SocketControlIoctlResponse{}
code, out, err_ := s.Impl.Ioctl(in_.Req, in_.In)
+ out_ := SocketControlIoctlResponse{}
out_.Code = code
out_.Out = out
return &out_, err_
@@ -1114,8 +1050,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := SocketControlConnectResponse{}
code, err_ := s.Impl.Connect(in_.Addr)
+ out_ := SocketControlConnectResponse{}
out_.Code = code
return &out_, err_
case SocketControlAcceptOrdinal:
@@ -1123,8 +1059,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := SocketControlAcceptResponse{}
code, err_ := s.Impl.Accept(in_.Flags)
+ out_ := SocketControlAcceptResponse{}
out_.Code = code
return &out_, err_
case SocketControlBindOrdinal:
@@ -1132,8 +1068,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := SocketControlBindResponse{}
code, err_ := s.Impl.Bind(in_.Addr)
+ out_ := SocketControlBindResponse{}
out_.Code = code
return &out_, err_
case SocketControlListenOrdinal:
@@ -1141,27 +1077,19 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := SocketControlListenResponse{}
code, err_ := s.Impl.Listen(in_.Backlog)
+ out_ := SocketControlListenResponse{}
out_.Code = code
return &out_, err_
case SocketControlGetSockNameOrdinal:
- in_ := SocketControlGetSockNameRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := SocketControlGetSockNameResponse{}
code, addr, err_ := s.Impl.GetSockName()
+ out_ := SocketControlGetSockNameResponse{}
out_.Code = code
out_.Addr = addr
return &out_, err_
case SocketControlGetPeerNameOrdinal:
- in_ := SocketControlGetPeerNameRequest{}
- if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
- return nil, err_
- }
- out_ := SocketControlGetPeerNameResponse{}
code, addr, err_ := s.Impl.GetPeerName()
+ out_ := SocketControlGetPeerNameResponse{}
out_.Code = code
out_.Addr = addr
return &out_, err_
@@ -1170,8 +1098,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := SocketControlSetSockOptResponse{}
code, err_ := s.Impl.SetSockOpt(in_.Level, in_.Optname, in_.Optval)
+ out_ := SocketControlSetSockOptResponse{}
out_.Code = code
return &out_, err_
case SocketControlGetSockOptOrdinal:
@@ -1179,8 +1107,8 @@
if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil {
return nil, err_
}
- out_ := SocketControlGetSockOptResponse{}
code, optval, err_ := s.Impl.GetSockOpt(in_.Level, in_.Optname)
+ out_ := SocketControlGetSockOptResponse{}
out_.Code = code
out_.Optval = optval
return &out_, err_