| // Copyright 2018 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| // |
| // GENERATED FILE: Do not edit! |
| // |
| // To rebuild this file, invoke third_party/go/regen-fidl. |
| |
| // +build fuchsia |
| |
| package io |
| |
| import ( |
| _zx "syscall/zx" |
| _bindings "syscall/zx/fidl" |
| fuchsiamem "syscall/zx/mem" |
| ) |
| |
| const ( |
| // Indicates the file is ready for reading. |
| FileSignalReadable uint32 = 16777216 |
| // Indicates the file is ready for writing. |
| FileSignalWritable uint32 = 33554432 |
| // Indicates the device is ready for reading. |
| DeviceSignalReadable uint32 = 16777216 |
| // Indicates an out-of-band state transition has occurred. |
| DeviceSignalOob uint32 = 33554432 |
| // Indicates the device is ready for writing. |
| DeviceSignalWritable uint32 = 67108864 |
| // Indicates the device has encountered an error state. |
| DeviceSignalError uint32 = 134217728 |
| // Indicates the device has hung up on the current connection. |
| DeviceSignalHangup uint32 = 268435456 |
| // Can read from target object. |
| OpenRightReadable uint32 = 1 |
| // Can write to target object. |
| OpenRightWritable uint32 = 2 |
| // Connection can mount/umount filesystem. |
| OpenRightAdmin uint32 = 4 |
| // Connection can map target object executable. |
| OpenRightExecutable uint32 = 8 |
| // Create the object if it doesn't exist. |
| OpenFlagCreate uint32 = 65536 |
| // (with Create) Fail if the object already exists. |
| OpenFlagCreateIfAbsent uint32 = 131072 |
| // Truncate the object before usage. |
| OpenFlagTruncate uint32 = 262144 |
| // Assert that the object to be opened is a directory. |
| // Return an error if the target object is not a directory. |
| OpenFlagDirectory uint32 = 524288 |
| // Seek to the end of the object before all writes. |
| OpenFlagAppend uint32 = 1048576 |
| // If the object is a mount point, open the local directory. |
| OpenFlagNoRemote uint32 = 2097152 |
| // Open a reference to the object, not the object itself. |
| // It is ONLY valid to pass the following flags together with `OPEN_FLAG_NODE_REFERENCE`: |
| // - `OPEN_FLAG_DIRECTORY` |
| // - `OPEN_FLAG_NOT_DIRECTORY` |
| // - `OPEN_FLAG_DESCRIBE` |
| // otherwise an error is returned. |
| // If an object is opened or cloned using this method, the resulting connection does not carry |
| // any permission flags. |
| // The resulting node allows a limited set of operations: `GetAttr`, `Clone`, `Close`, `Describe`, |
| // and, if the node is a file, these extra operations: `GetFlags`, `SetFlags`. |
| OpenFlagNodeReference uint32 = 4194304 |
| // 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 = 46661632 |
| // Requests that an "OnOpen" event is sent to the interface request. |
| // The event will contain a non-null NodeInfo if the open/clone is successful. |
| OpenFlagDescribe uint32 = 8388608 |
| // 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 expand to include |
| // `OPEN_RIGHT_WRITABLE` if and only if the current connection and all intermediate mount points |
| // are writable, and to include `OPEN_RIGHT_EXECUTABLE` if and only if the current connection and |
| // all intermediate mount points are executable. |
| // - Otherwise, this flag is ignored. It is an access denied error to request more rights |
| // than those on the current connection, or any intermediate mount points. |
| // |
| // If 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 = 16777216 |
| // Assert that the object to be opened is not a directory. |
| // Return an error if the target object is a directory. |
| OpenFlagNotDirectory uint32 = 33554432 |
| // 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_FLAG_SAME_RIGHTS`. |
| CloneFlagSameRights uint32 = 67108864 |
| // 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 = 4095 |
| // 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 = 1044480 |
| ModeTypeDirectory uint32 = 16384 |
| ModeTypeBlockDevice uint32 = 24576 |
| ModeTypeFile uint32 = 32768 |
| ModeTypeSocket uint32 = 49152 |
| ModeTypeService uint32 = 65536 |
| MaxIoctlHandles uint64 = 2 |
| // The maximal buffer size which can be transmitted for buffered operations. |
| // This capacity is currently set somewhat arbitrarily. |
| MaxBuf uint64 = 8192 |
| // The maximum length, in bytes, of a filesystem string. |
| MaxPath uint64 = 4096 |
| // The maximum length, in bytes, of a single filesystem component. |
| MaxFilename uint64 = 255 |
| // The fields of 'attributes' which are used to update the Node are indicated |
| // by the 'flags' argument. |
| NodeAttributeFlagCreationTime uint32 = 1 |
| NodeAttributeFlagModificationTime uint32 = 2 |
| // Requests that the VMO be readable. |
| VmoFlagRead uint32 = 1 |
| // Requests that the VMO be writable. |
| VmoFlagWrite uint32 = 2 |
| // Requests that the VMO be executable. |
| VmoFlagExec uint32 = 4 |
| // 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 = 65536 |
| // 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 = 131072 |
| // A dirent with an unknown type. |
| DirentTypeUnknown uint8 = 0 |
| // A dirent representing a directory object. |
| DirentTypeDirectory uint8 = 4 |
| // A dirent representing a block device object. |
| DirentTypeBlockDevice uint8 = 6 |
| // A dirent representing a file object. |
| DirentTypeFile uint8 = 8 |
| // A dirent representing a socket object. |
| DirentTypeSocket uint8 = 12 |
| // A dirent representing a service object. |
| DirentTypeService uint8 = 16 |
| // Nodes which do not have ino values should return this value |
| // from Readdir and GetAttr. |
| InoUnknown uint64 = 18446744073709551615 |
| // 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 |
| // Used by Directory::Watch. Requests transmission of `WATCH_EVENT_DELETED`. |
| WatchMaskDeleted uint32 = 1 |
| // Used by Directory::Watch. Requests transmission of `WATCH_EVENT_ADDED`. |
| WatchMaskAdded uint32 = 2 |
| // Used by Directory::Watch. Requests transmission of `WATCH_EVENT_REMOVED`. |
| WatchMaskRemoved uint32 = 4 |
| // Used by Directory::Watch. Requests transmission of `WATCH_EVENT_EXISTING`. |
| WatchMaskExisting uint32 = 8 |
| // Used by Directory::Watch. Requests transmission of `WATCH_EVENT_IDLE`. |
| WatchMaskIdle uint32 = 16 |
| // Used by Directory::Watch. Requests transmission of all watcher events. |
| WatchMaskAll uint32 = 31 |
| MountCreateFlagReplace uint32 = 1 |
| MaxFsNameBuffer uint64 = 32 |
| ) |
| |
| // Update the Seek offset. |
| type SeekOrigin uint32 |
| |
| const ( |
| SeekOriginStart SeekOrigin = 0 |
| SeekOriginCurrent SeekOrigin = 1 |
| SeekOriginEnd SeekOrigin = 2 |
| ) |
| |
| func (x SeekOrigin) String() string { |
| switch x { |
| case 0: |
| return "Start" |
| case 1: |
| return "Current" |
| case 2: |
| return "End" |
| } |
| return "Unknown" |
| } |
| |
| // The default protocol, interface information must be acquired some |
| // other way. |
| type Service struct { |
| _ struct{} `fidl2:"s,1,1"` |
| } |
| |
| var _mService = _bindings.CreateLazyMarshaler(Service{}) |
| |
| func (msg *Service) Marshaler() _bindings.Marshaler { |
| return _mService |
| } |
| |
| // The object may be cast to interface 'File'. |
| type FileObject struct { |
| _ struct{} `fidl2:"s,4,4"` |
| // An optional event which transmits information about an object's readability |
| // or writability. This event relays information about the underlying object, not |
| // the capability granted to client: this event may be signalled "readable" on a |
| // connection that does not have the capability to read. |
| // |
| // The "`FILE_SIGNAL_`" values may be observed on this event. |
| Event _zx.Event `fidl:"1" fidl2:"1"` |
| } |
| |
| var _mFileObject = _bindings.CreateLazyMarshaler(FileObject{}) |
| |
| func (msg *FileObject) Marshaler() _bindings.Marshaler { |
| return _mFileObject |
| } |
| |
| // The object may be cast to interface 'Directory'. |
| type DirectoryObject struct { |
| _ struct{} `fidl2:"s,1,1"` |
| } |
| |
| var _mDirectoryObject = _bindings.CreateLazyMarshaler(DirectoryObject{}) |
| |
| func (msg *DirectoryObject) Marshaler() _bindings.Marshaler { |
| return _mDirectoryObject |
| } |
| |
| // The object is accompanied by a pipe. |
| type Pipe struct { |
| _ struct{} `fidl2:"s,4,4"` |
| Socket _zx.Socket `fidl:"0" fidl2:"0"` |
| } |
| |
| var _mPipe = _bindings.CreateLazyMarshaler(Pipe{}) |
| |
| func (msg *Pipe) Marshaler() _bindings.Marshaler { |
| return _mPipe |
| } |
| |
| // The object is accompanied by a socket. |
| type Socket struct { |
| _ struct{} `fidl2:"s,4,4"` |
| Socket _zx.Socket `fidl:"0" fidl2:"0"` |
| } |
| |
| var _mSocket = _bindings.CreateLazyMarshaler(Socket{}) |
| |
| func (msg *Socket) Marshaler() _bindings.Marshaler { |
| return _mSocket |
| } |
| |
| // The object is a file which is represented as an immutable VMO. |
| // Although a VMO is returned as a part of this structure, this underlying object |
| // may represent multiple Vmofiles. To identify the logical portion of the VMO |
| // that represents the single file, an offset and length parameter are also supplied. |
| type Vmofile struct { |
| _ struct{} `fidl2:"s,24,8"` |
| // The VMO which backs this file. |
| Vmo _zx.VMO `fidl:"0" fidl2:"0"` |
| // The index into `vmo` which represents the first byte of the file. |
| Offset uint64 |
| // The number of bytes, starting at `offset`, which may be used to represent this file. |
| Length uint64 |
| } |
| |
| var _mVmofile = _bindings.CreateLazyMarshaler(Vmofile{}) |
| |
| func (msg *Vmofile) Marshaler() _bindings.Marshaler { |
| return _mVmofile |
| } |
| |
| // The object may be cast to interface 'Device'. |
| type Device struct { |
| _ struct{} `fidl2:"s,4,4"` |
| // An optional event which transmits information about a device's state. |
| // |
| // The "`DEVICE_SIGNAL_`" values may be observed on this event. |
| Event _zx.Handle `fidl:"1" fidl2:"1"` |
| } |
| |
| var _mDevice = _bindings.CreateLazyMarshaler(Device{}) |
| |
| func (msg *Device) Marshaler() _bindings.Marshaler { |
| return _mDevice |
| } |
| |
| // The object may be cast to interface 'Tty' |
| type Tty struct { |
| _ struct{} `fidl2:"s,4,4"` |
| Event _zx.Handle `fidl:"1" fidl2:"1"` |
| } |
| |
| var _mTty = _bindings.CreateLazyMarshaler(Tty{}) |
| |
| func (msg *Tty) Marshaler() _bindings.Marshaler { |
| return _mTty |
| } |
| |
| // NodeAttributes defines generic information about a filesystem node. |
| type NodeAttributes struct { |
| _ 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 |
| } |
| |
| var _mNodeAttributes = _bindings.CreateLazyMarshaler(NodeAttributes{}) |
| |
| func (msg *NodeAttributes) Marshaler() _bindings.Marshaler { |
| return _mNodeAttributes |
| } |
| |
| // WatchedEvent describes events returned from a DirectoryWatcher. |
| type WatchedEvent struct { |
| _ struct{} `fidl2:"s,24,8"` |
| Event uint8 |
| Len uint8 |
| Name []uint8 `fidl:"255" fidl2:"255"` |
| } |
| |
| var _mWatchedEvent = _bindings.CreateLazyMarshaler(WatchedEvent{}) |
| |
| func (msg *WatchedEvent) Marshaler() _bindings.Marshaler { |
| return _mWatchedEvent |
| } |
| |
| type FilesystemInfo struct { |
| _ 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 |
| // 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 |
| Name [32]int8 |
| } |
| |
| var _mFilesystemInfo = _bindings.CreateLazyMarshaler(FilesystemInfo{}) |
| |
| func (msg *FilesystemInfo) Marshaler() _bindings.Marshaler { |
| return _mFilesystemInfo |
| } |
| |
| type I_nodeInfoTag uint32 |
| |
| const ( |
| _ I_nodeInfoTag = iota |
| NodeInfoService |
| NodeInfoFile |
| NodeInfoDirectory |
| NodeInfoPipe |
| NodeInfoVmofile |
| NodeInfoDevice |
| NodeInfoTty |
| NodeInfoSocket |
| ) |
| |
| // 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 { |
| I_nodeInfoTag `fidl:"tag" fidl2:"u,32,8"` |
| Service Service |
| File FileObject |
| Directory DirectoryObject |
| Pipe Pipe |
| Vmofile Vmofile |
| Device Device |
| Tty Tty |
| Socket Socket |
| } |
| |
| func (u *NodeInfo) Which() I_nodeInfoTag { |
| return u.I_nodeInfoTag |
| } |
| |
| func (u *NodeInfo) SetService(service Service) { |
| u.I_nodeInfoTag = NodeInfoService |
| u.Service = service |
| } |
| |
| func NodeInfoWithService(service Service) NodeInfo { |
| var _u NodeInfo |
| _u.SetService(service) |
| return _u |
| } |
| |
| func (u *NodeInfo) SetFile(file FileObject) { |
| u.I_nodeInfoTag = NodeInfoFile |
| u.File = file |
| } |
| |
| func NodeInfoWithFile(file FileObject) NodeInfo { |
| var _u NodeInfo |
| _u.SetFile(file) |
| return _u |
| } |
| |
| func (u *NodeInfo) SetDirectory(directory DirectoryObject) { |
| u.I_nodeInfoTag = NodeInfoDirectory |
| u.Directory = directory |
| } |
| |
| func NodeInfoWithDirectory(directory DirectoryObject) NodeInfo { |
| var _u NodeInfo |
| _u.SetDirectory(directory) |
| return _u |
| } |
| |
| func (u *NodeInfo) SetPipe(pipe Pipe) { |
| u.I_nodeInfoTag = NodeInfoPipe |
| u.Pipe = pipe |
| } |
| |
| func NodeInfoWithPipe(pipe Pipe) NodeInfo { |
| var _u NodeInfo |
| _u.SetPipe(pipe) |
| return _u |
| } |
| |
| func (u *NodeInfo) SetVmofile(vmofile Vmofile) { |
| u.I_nodeInfoTag = NodeInfoVmofile |
| u.Vmofile = vmofile |
| } |
| |
| func NodeInfoWithVmofile(vmofile Vmofile) NodeInfo { |
| var _u NodeInfo |
| _u.SetVmofile(vmofile) |
| return _u |
| } |
| |
| func (u *NodeInfo) SetDevice(device Device) { |
| u.I_nodeInfoTag = NodeInfoDevice |
| u.Device = device |
| } |
| |
| func NodeInfoWithDevice(device Device) NodeInfo { |
| var _u NodeInfo |
| _u.SetDevice(device) |
| return _u |
| } |
| |
| func (u *NodeInfo) SetTty(tty Tty) { |
| u.I_nodeInfoTag = NodeInfoTty |
| u.Tty = tty |
| } |
| |
| func NodeInfoWithTty(tty Tty) NodeInfo { |
| var _u NodeInfo |
| _u.SetTty(tty) |
| return _u |
| } |
| |
| func (u *NodeInfo) SetSocket(socket Socket) { |
| u.I_nodeInfoTag = NodeInfoSocket |
| u.Socket = socket |
| } |
| |
| func NodeInfoWithSocket(socket Socket) NodeInfo { |
| var _u NodeInfo |
| _u.SetSocket(socket) |
| return _u |
| } |
| |
| const ( |
| NodeCloneOrdinal uint64 = 0x17fe6a4c00000000 |
| NodeCloseOrdinal uint64 = 0x52b9568700000000 |
| NodeDescribeOrdinal uint64 = 0x1f62df5e00000000 |
| NodeOnOpenOrdinal uint64 = 0x4700a7bd00000000 |
| NodeSyncOrdinal uint64 = 0x62423faa00000000 |
| NodeGetAttrOrdinal uint64 = 0x4585e7c800000000 |
| NodeSetAttrOrdinal uint64 = 0xbd5559a00000000 |
| NodeIoctlOrdinal uint64 = 0x35f3aca700000000 |
| ) |
| |
| type nodeCloneRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Flags uint32 |
| Object NodeInterfaceRequest `fidl:"0" fidl2:"0"` |
| } |
| |
| var _mnodeCloneRequest = _bindings.CreateLazyMarshaler(nodeCloneRequest{}) |
| |
| func (msg *nodeCloneRequest) Marshaler() _bindings.Marshaler { |
| return _mnodeCloneRequest |
| } |
| |
| type nodeCloseResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mnodeCloseResponse = _bindings.CreateLazyMarshaler(nodeCloseResponse{}) |
| |
| func (msg *nodeCloseResponse) Marshaler() _bindings.Marshaler { |
| return _mnodeCloseResponse |
| } |
| |
| type nodeDescribeResponse struct { |
| _ struct{} `fidl2:"s,32,0"` |
| Info NodeInfo |
| } |
| |
| var _mnodeDescribeResponse = _bindings.CreateLazyMarshaler(nodeDescribeResponse{}) |
| |
| func (msg *nodeDescribeResponse) Marshaler() _bindings.Marshaler { |
| return _mnodeDescribeResponse |
| } |
| |
| type nodeOnOpenResponse struct { |
| _ struct{} `fidl2:"s,16,0"` |
| S int32 |
| Info *NodeInfo |
| } |
| |
| var _mnodeOnOpenResponse = _bindings.CreateLazyMarshaler(nodeOnOpenResponse{}) |
| |
| func (msg *nodeOnOpenResponse) Marshaler() _bindings.Marshaler { |
| return _mnodeOnOpenResponse |
| } |
| |
| type nodeSyncResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mnodeSyncResponse = _bindings.CreateLazyMarshaler(nodeSyncResponse{}) |
| |
| func (msg *nodeSyncResponse) Marshaler() _bindings.Marshaler { |
| return _mnodeSyncResponse |
| } |
| |
| type nodeGetAttrResponse struct { |
| _ struct{} `fidl2:"s,64,0"` |
| S int32 |
| Attributes NodeAttributes |
| } |
| |
| var _mnodeGetAttrResponse = _bindings.CreateLazyMarshaler(nodeGetAttrResponse{}) |
| |
| func (msg *nodeGetAttrResponse) Marshaler() _bindings.Marshaler { |
| return _mnodeGetAttrResponse |
| } |
| |
| type nodeSetAttrRequest struct { |
| _ struct{} `fidl2:"s,64,0"` |
| Flags uint32 |
| Attributes NodeAttributes |
| } |
| |
| var _mnodeSetAttrRequest = _bindings.CreateLazyMarshaler(nodeSetAttrRequest{}) |
| |
| func (msg *nodeSetAttrRequest) Marshaler() _bindings.Marshaler { |
| return _mnodeSetAttrRequest |
| } |
| |
| type nodeSetAttrResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mnodeSetAttrResponse = _bindings.CreateLazyMarshaler(nodeSetAttrResponse{}) |
| |
| func (msg *nodeSetAttrResponse) Marshaler() _bindings.Marshaler { |
| return _mnodeSetAttrResponse |
| } |
| |
| type nodeIoctlRequest struct { |
| _ struct{} `fidl2:"s,48,0"` |
| Opcode uint32 |
| MaxOut uint64 |
| Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"` |
| In []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mnodeIoctlRequest = _bindings.CreateLazyMarshaler(nodeIoctlRequest{}) |
| |
| func (msg *nodeIoctlRequest) Marshaler() _bindings.Marshaler { |
| return _mnodeIoctlRequest |
| } |
| |
| type nodeIoctlResponse struct { |
| _ struct{} `fidl2:"s,40,0"` |
| S int32 |
| Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"` |
| Out []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mnodeIoctlResponse = _bindings.CreateLazyMarshaler(nodeIoctlResponse{}) |
| |
| func (msg *nodeIoctlResponse) Marshaler() _bindings.Marshaler { |
| return _mnodeIoctlResponse |
| } |
| |
| 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` |
| // - `CLONE_FLAG_SAME_RIGHTS` |
| // |
| // All other flags are ignored. |
| // |
| // The `OPEN_RIGHT_*` bits in `flags` request corresponding rights over the resulting |
| // cloned object. |
| // The cloned object must have rights less than or equal to the original object. |
| // Alternatively, pass `CLONE_FLAG_SAME_RIGHTS` to inherit the rights on the source connection. |
| // It is invalid to pass any of the `OPEN_RIGHT_*` flags together with `CLONE_FLAG_SAME_RIGHTS`. |
| func (p *NodeInterface) Clone(flags uint32, object NodeInterfaceRequest) error { |
| req_ := &nodeCloneRequest{ |
| Flags: flags, |
| Object: object, |
| } |
| 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) { |
| var req_ _bindings.Message |
| 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) { |
| var req_ _bindings.Message |
| 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_) |
| return resp_.S, resp_.Info, err |
| } |
| |
| // Synchronizes updates to the node to the underlying media, if it exists. |
| // |
| // This method does not require any rights. |
| func (p *NodeInterface) Sync() (int32, error) { |
| var req_ _bindings.Message |
| 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) { |
| var req_ _bindings.Message |
| 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`. |
| func (p *NodeInterface) SetAttr(flags uint32, attributes NodeAttributes) (int32, error) { |
| req_ := &nodeSetAttrRequest{ |
| Flags: flags, |
| Attributes: attributes, |
| } |
| 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{ |
| Opcode: opcode, |
| MaxOut: maxOut, |
| Handles: handles, |
| In: in, |
| } |
| 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` |
| // - `CLONE_FLAG_SAME_RIGHTS` |
| // |
| // All other flags are ignored. |
| // |
| // The `OPEN_RIGHT_*` bits in `flags` request corresponding rights over the resulting |
| // cloned object. |
| // The cloned object must have rights less than or equal to the original object. |
| // Alternatively, pass `CLONE_FLAG_SAME_RIGHTS` to inherit the rights on the source connection. |
| // It is invalid to pass any of the `OPEN_RIGHT_*` flags together with `CLONE_FLAG_SAME_RIGHTS`. |
| 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. |
| // |
| // This method does not require any rights. |
| 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`. |
| 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) |
| } |
| |
| type NodeTransitionalBase struct{} |
| |
| type NodeInterfaceRequest _bindings.InterfaceRequest |
| |
| func NewNodeInterfaceRequest() (NodeInterfaceRequest, *NodeInterface, error) { |
| req, cli, err := _bindings.NewInterfaceRequest() |
| return NodeInterfaceRequest(req), (*NodeInterface)(cli), err |
| } |
| |
| type NodeStub struct { |
| Impl Node |
| } |
| |
| func (s_ *NodeStub) DispatchImpl(ordinal_ uint64, data_ []byte, handles_ []_zx.Handle) (_bindings.Message, bool, error) { |
| switch ordinal_ { |
| case NodeCloneOrdinal: |
| in_ := nodeCloneRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| err_ := s_.Impl.Clone(in_.Flags, in_.Object) |
| return nil, false, err_ |
| case NodeCloseOrdinal: |
| s, err_ := s_.Impl.Close() |
| out_ := nodeCloseResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case NodeDescribeOrdinal: |
| info, err_ := s_.Impl.Describe() |
| out_ := nodeDescribeResponse{} |
| out_.Info = info |
| return &out_, true, err_ |
| case NodeSyncOrdinal: |
| s, err_ := s_.Impl.Sync() |
| out_ := nodeSyncResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case NodeGetAttrOrdinal: |
| s, attributes, err_ := s_.Impl.GetAttr() |
| out_ := nodeGetAttrResponse{} |
| out_.S = s |
| out_.Attributes = attributes |
| return &out_, true, err_ |
| case NodeSetAttrOrdinal: |
| in_ := nodeSetAttrRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.SetAttr(in_.Flags, in_.Attributes) |
| out_ := nodeSetAttrResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case NodeIoctlOrdinal: |
| in_ := nodeIoctlRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| 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 |
| return &out_, true, err_ |
| } |
| return nil, false, _bindings.ErrUnknownOrdinal |
| } |
| |
| type NodeService struct { |
| _bindings.BindingSet |
| } |
| |
| func (s *NodeService) Add(impl Node, c _zx.Channel, onError func(error)) (_bindings.BindingKey, error) { |
| return s.BindingSet.Add(&NodeStub{Impl: impl}, c, onError) |
| } |
| |
| func (s *NodeService) EventProxyFor(key _bindings.BindingKey) (*NodeEventProxy, bool) { |
| pxy, err := s.BindingSet.ProxyFor(key) |
| return (*NodeEventProxy)(pxy), err |
| } |
| |
| type NodeEventProxy _bindings.ChannelProxy |
| |
| func (p *NodeEventProxy) OnOpen(s int32, info *NodeInfo) error { |
| event_ := &nodeOnOpenResponse{ |
| S: s, |
| Info: info, |
| } |
| return ((*_bindings.ChannelProxy)(p)).Send(NodeOnOpenOrdinal, event_) |
| } |
| |
| const ( |
| FileCloneOrdinal uint64 = 0x17fe6a4c00000000 |
| FileCloseOrdinal uint64 = 0x52b9568700000000 |
| FileDescribeOrdinal uint64 = 0x1f62df5e00000000 |
| FileOnOpenOrdinal uint64 = 0x4700a7bd00000000 |
| FileSyncOrdinal uint64 = 0x62423faa00000000 |
| FileGetAttrOrdinal uint64 = 0x4585e7c800000000 |
| FileSetAttrOrdinal uint64 = 0xbd5559a00000000 |
| FileIoctlOrdinal uint64 = 0x35f3aca700000000 |
| FileReadOrdinal uint64 = 0x25f7418400000000 |
| FileReadAtOrdinal uint64 = 0x7c724dc400000000 |
| FileWriteOrdinal uint64 = 0x512e7a000000000 |
| FileWriteAtOrdinal uint64 = 0x3e5522e500000000 |
| FileSeekOrdinal uint64 = 0x782a774500000000 |
| FileTruncateOrdinal uint64 = 0x42ab3a3a00000000 |
| FileGetFlagsOrdinal uint64 = 0x6416a3f600000000 |
| FileSetFlagsOrdinal uint64 = 0x3f23cc7600000000 |
| FileGetBufferOrdinal uint64 = 0x74c3097300000000 |
| ) |
| |
| type fileCloneRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Flags uint32 |
| Object NodeInterfaceRequest `fidl:"0" fidl2:"0"` |
| } |
| |
| var _mfileCloneRequest = _bindings.CreateLazyMarshaler(fileCloneRequest{}) |
| |
| func (msg *fileCloneRequest) Marshaler() _bindings.Marshaler { |
| return _mfileCloneRequest |
| } |
| |
| type fileCloseResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mfileCloseResponse = _bindings.CreateLazyMarshaler(fileCloseResponse{}) |
| |
| func (msg *fileCloseResponse) Marshaler() _bindings.Marshaler { |
| return _mfileCloseResponse |
| } |
| |
| type fileDescribeResponse struct { |
| _ struct{} `fidl2:"s,32,0"` |
| Info NodeInfo |
| } |
| |
| var _mfileDescribeResponse = _bindings.CreateLazyMarshaler(fileDescribeResponse{}) |
| |
| func (msg *fileDescribeResponse) Marshaler() _bindings.Marshaler { |
| return _mfileDescribeResponse |
| } |
| |
| type fileOnOpenResponse struct { |
| _ struct{} `fidl2:"s,16,0"` |
| S int32 |
| Info *NodeInfo |
| } |
| |
| var _mfileOnOpenResponse = _bindings.CreateLazyMarshaler(fileOnOpenResponse{}) |
| |
| func (msg *fileOnOpenResponse) Marshaler() _bindings.Marshaler { |
| return _mfileOnOpenResponse |
| } |
| |
| type fileSyncResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mfileSyncResponse = _bindings.CreateLazyMarshaler(fileSyncResponse{}) |
| |
| func (msg *fileSyncResponse) Marshaler() _bindings.Marshaler { |
| return _mfileSyncResponse |
| } |
| |
| type fileGetAttrResponse struct { |
| _ struct{} `fidl2:"s,64,0"` |
| S int32 |
| Attributes NodeAttributes |
| } |
| |
| var _mfileGetAttrResponse = _bindings.CreateLazyMarshaler(fileGetAttrResponse{}) |
| |
| func (msg *fileGetAttrResponse) Marshaler() _bindings.Marshaler { |
| return _mfileGetAttrResponse |
| } |
| |
| type fileSetAttrRequest struct { |
| _ struct{} `fidl2:"s,64,0"` |
| Flags uint32 |
| Attributes NodeAttributes |
| } |
| |
| var _mfileSetAttrRequest = _bindings.CreateLazyMarshaler(fileSetAttrRequest{}) |
| |
| func (msg *fileSetAttrRequest) Marshaler() _bindings.Marshaler { |
| return _mfileSetAttrRequest |
| } |
| |
| type fileSetAttrResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mfileSetAttrResponse = _bindings.CreateLazyMarshaler(fileSetAttrResponse{}) |
| |
| func (msg *fileSetAttrResponse) Marshaler() _bindings.Marshaler { |
| return _mfileSetAttrResponse |
| } |
| |
| type fileIoctlRequest struct { |
| _ struct{} `fidl2:"s,48,0"` |
| Opcode uint32 |
| MaxOut uint64 |
| Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"` |
| In []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mfileIoctlRequest = _bindings.CreateLazyMarshaler(fileIoctlRequest{}) |
| |
| func (msg *fileIoctlRequest) Marshaler() _bindings.Marshaler { |
| return _mfileIoctlRequest |
| } |
| |
| type fileIoctlResponse struct { |
| _ struct{} `fidl2:"s,40,0"` |
| S int32 |
| Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"` |
| Out []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mfileIoctlResponse = _bindings.CreateLazyMarshaler(fileIoctlResponse{}) |
| |
| func (msg *fileIoctlResponse) Marshaler() _bindings.Marshaler { |
| return _mfileIoctlResponse |
| } |
| |
| type fileReadRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Count uint64 |
| } |
| |
| var _mfileReadRequest = _bindings.CreateLazyMarshaler(fileReadRequest{}) |
| |
| func (msg *fileReadRequest) Marshaler() _bindings.Marshaler { |
| return _mfileReadRequest |
| } |
| |
| type fileReadResponse struct { |
| _ struct{} `fidl2:"s,24,0"` |
| S int32 |
| Data []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mfileReadResponse = _bindings.CreateLazyMarshaler(fileReadResponse{}) |
| |
| func (msg *fileReadResponse) Marshaler() _bindings.Marshaler { |
| return _mfileReadResponse |
| } |
| |
| type fileReadAtRequest struct { |
| _ struct{} `fidl2:"s,16,0"` |
| Count uint64 |
| Offset uint64 |
| } |
| |
| var _mfileReadAtRequest = _bindings.CreateLazyMarshaler(fileReadAtRequest{}) |
| |
| func (msg *fileReadAtRequest) Marshaler() _bindings.Marshaler { |
| return _mfileReadAtRequest |
| } |
| |
| type fileReadAtResponse struct { |
| _ struct{} `fidl2:"s,24,0"` |
| S int32 |
| Data []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mfileReadAtResponse = _bindings.CreateLazyMarshaler(fileReadAtResponse{}) |
| |
| func (msg *fileReadAtResponse) Marshaler() _bindings.Marshaler { |
| return _mfileReadAtResponse |
| } |
| |
| type fileWriteRequest struct { |
| _ struct{} `fidl2:"s,16,0"` |
| Data []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mfileWriteRequest = _bindings.CreateLazyMarshaler(fileWriteRequest{}) |
| |
| func (msg *fileWriteRequest) Marshaler() _bindings.Marshaler { |
| return _mfileWriteRequest |
| } |
| |
| type fileWriteResponse struct { |
| _ struct{} `fidl2:"s,16,0"` |
| S int32 |
| Actual uint64 |
| } |
| |
| var _mfileWriteResponse = _bindings.CreateLazyMarshaler(fileWriteResponse{}) |
| |
| func (msg *fileWriteResponse) Marshaler() _bindings.Marshaler { |
| return _mfileWriteResponse |
| } |
| |
| type fileWriteAtRequest struct { |
| _ struct{} `fidl2:"s,24,0"` |
| Data []uint8 `fidl:"8192" fidl2:"8192"` |
| Offset uint64 |
| } |
| |
| var _mfileWriteAtRequest = _bindings.CreateLazyMarshaler(fileWriteAtRequest{}) |
| |
| func (msg *fileWriteAtRequest) Marshaler() _bindings.Marshaler { |
| return _mfileWriteAtRequest |
| } |
| |
| type fileWriteAtResponse struct { |
| _ struct{} `fidl2:"s,16,0"` |
| S int32 |
| Actual uint64 |
| } |
| |
| var _mfileWriteAtResponse = _bindings.CreateLazyMarshaler(fileWriteAtResponse{}) |
| |
| func (msg *fileWriteAtResponse) Marshaler() _bindings.Marshaler { |
| return _mfileWriteAtResponse |
| } |
| |
| type fileSeekRequest struct { |
| _ struct{} `fidl2:"s,16,0"` |
| Offset int64 |
| Start SeekOrigin |
| } |
| |
| var _mfileSeekRequest = _bindings.CreateLazyMarshaler(fileSeekRequest{}) |
| |
| func (msg *fileSeekRequest) Marshaler() _bindings.Marshaler { |
| return _mfileSeekRequest |
| } |
| |
| type fileSeekResponse struct { |
| _ struct{} `fidl2:"s,16,0"` |
| S int32 |
| Offset uint64 |
| } |
| |
| var _mfileSeekResponse = _bindings.CreateLazyMarshaler(fileSeekResponse{}) |
| |
| func (msg *fileSeekResponse) Marshaler() _bindings.Marshaler { |
| return _mfileSeekResponse |
| } |
| |
| type fileTruncateRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Length uint64 |
| } |
| |
| var _mfileTruncateRequest = _bindings.CreateLazyMarshaler(fileTruncateRequest{}) |
| |
| func (msg *fileTruncateRequest) Marshaler() _bindings.Marshaler { |
| return _mfileTruncateRequest |
| } |
| |
| type fileTruncateResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mfileTruncateResponse = _bindings.CreateLazyMarshaler(fileTruncateResponse{}) |
| |
| func (msg *fileTruncateResponse) Marshaler() _bindings.Marshaler { |
| return _mfileTruncateResponse |
| } |
| |
| type fileGetFlagsResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| Flags uint32 |
| } |
| |
| var _mfileGetFlagsResponse = _bindings.CreateLazyMarshaler(fileGetFlagsResponse{}) |
| |
| func (msg *fileGetFlagsResponse) Marshaler() _bindings.Marshaler { |
| return _mfileGetFlagsResponse |
| } |
| |
| type fileSetFlagsRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Flags uint32 |
| } |
| |
| var _mfileSetFlagsRequest = _bindings.CreateLazyMarshaler(fileSetFlagsRequest{}) |
| |
| func (msg *fileSetFlagsRequest) Marshaler() _bindings.Marshaler { |
| return _mfileSetFlagsRequest |
| } |
| |
| type fileSetFlagsResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mfileSetFlagsResponse = _bindings.CreateLazyMarshaler(fileSetFlagsResponse{}) |
| |
| func (msg *fileSetFlagsResponse) Marshaler() _bindings.Marshaler { |
| return _mfileSetFlagsResponse |
| } |
| |
| type fileGetBufferRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Flags uint32 |
| } |
| |
| var _mfileGetBufferRequest = _bindings.CreateLazyMarshaler(fileGetBufferRequest{}) |
| |
| func (msg *fileGetBufferRequest) Marshaler() _bindings.Marshaler { |
| return _mfileGetBufferRequest |
| } |
| |
| type fileGetBufferResponse struct { |
| _ struct{} `fidl2:"s,16,0"` |
| S int32 |
| Buffer *fuchsiamem.Buffer |
| } |
| |
| var _mfileGetBufferResponse = _bindings.CreateLazyMarshaler(fileGetBufferResponse{}) |
| |
| func (msg *fileGetBufferResponse) Marshaler() _bindings.Marshaler { |
| return _mfileGetBufferResponse |
| } |
| |
| 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` |
| // - `CLONE_FLAG_SAME_RIGHTS` |
| // |
| // All other flags are ignored. |
| // |
| // The `OPEN_RIGHT_*` bits in `flags` request corresponding rights over the resulting |
| // cloned object. |
| // The cloned object must have rights less than or equal to the original object. |
| // Alternatively, pass `CLONE_FLAG_SAME_RIGHTS` to inherit the rights on the source connection. |
| // It is invalid to pass any of the `OPEN_RIGHT_*` flags together with `CLONE_FLAG_SAME_RIGHTS`. |
| func (p *FileInterface) Clone(flags uint32, object NodeInterfaceRequest) error { |
| req_ := &fileCloneRequest{ |
| Flags: flags, |
| Object: object, |
| } |
| 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) { |
| var req_ _bindings.Message |
| 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) { |
| var req_ _bindings.Message |
| 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_) |
| return resp_.S, resp_.Info, err |
| } |
| |
| // Synchronizes updates to the node to the underlying media, if it exists. |
| // |
| // This method does not require any rights. |
| func (p *FileInterface) Sync() (int32, error) { |
| var req_ _bindings.Message |
| 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) { |
| var req_ _bindings.Message |
| 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`. |
| func (p *FileInterface) SetAttr(flags uint32, attributes NodeAttributes) (int32, error) { |
| req_ := &fileSetAttrRequest{ |
| Flags: flags, |
| Attributes: attributes, |
| } |
| 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{ |
| Opcode: opcode, |
| MaxOut: maxOut, |
| Handles: handles, |
| In: in, |
| } |
| resp_ := &fileIoctlResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(FileIoctlOrdinal, req_, resp_) |
| return resp_.S, resp_.Handles, resp_.Out, err |
| } |
| |
| // Reads 'count' bytes at the seek offset. |
| // The seek offset is moved forward by the number of bytes read. |
| // |
| // This method requires following rights: `OPEN_RIGHT_READABLE`. |
| func (p *FileInterface) Read(count uint64) (int32, []uint8, error) { |
| req_ := &fileReadRequest{ |
| Count: count, |
| } |
| resp_ := &fileReadResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(FileReadOrdinal, req_, resp_) |
| return resp_.S, resp_.Data, err |
| } |
| |
| // Reads '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{ |
| Count: count, |
| Offset: offset, |
| } |
| resp_ := &fileReadAtResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(FileReadAtOrdinal, req_, resp_) |
| return resp_.S, resp_.Data, err |
| } |
| |
| // Writes data at the seek offset. |
| // The seek offset is moved forward by the number of bytes written. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| func (p *FileInterface) Write(data []uint8) (int32, uint64, error) { |
| req_ := &fileWriteRequest{ |
| Data: data, |
| } |
| resp_ := &fileWriteResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(FileWriteOrdinal, req_, resp_) |
| return resp_.S, resp_.Actual, err |
| } |
| |
| // Writes 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{ |
| Data: data, |
| Offset: offset, |
| } |
| 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{ |
| Offset: offset, |
| Start: start, |
| } |
| resp_ := &fileSeekResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(FileSeekOrdinal, req_, resp_) |
| return resp_.S, resp_.Offset, err |
| } |
| |
| // Shrinks the file size to 'length' bytes. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| func (p *FileInterface) Truncate(length uint64) (int32, error) { |
| req_ := &fileTruncateRequest{ |
| Length: length, |
| } |
| resp_ := &fileTruncateResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(FileTruncateOrdinal, req_, resp_) |
| return resp_.S, err |
| } |
| |
| // Acquires 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) { |
| var req_ _bindings.Message |
| resp_ := &fileGetFlagsResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(FileGetFlagsOrdinal, req_, resp_) |
| return resp_.S, resp_.Flags, err |
| } |
| |
| // Changes the Directory::Open flags used to access the file. |
| // Supported flags which can be turned on / off: |
| // - `OPEN_FLAG_APPEND` |
| // |
| // This method does not require any rights. |
| func (p *FileInterface) SetFlags(flags uint32) (int32, error) { |
| req_ := &fileSetFlagsRequest{ |
| Flags: flags, |
| } |
| resp_ := &fileSetFlagsResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(FileSetFlagsOrdinal, req_, resp_) |
| return resp_.S, err |
| } |
| |
| // Acquires a buffer representing this file, if there is one, with the |
| // requested access rights. |
| // |
| // `flags` may be any of `VMO_FLAG_*`. |
| // |
| // This method requires following rights: |
| // - `OPEN_RIGHT_WRITABLE` if `flags` includes `VMO_FLAG_WRITE`. |
| // - `OPEN_RIGHT_READABLE` if `flags` includes `VMO_FLAG_READ` or `VMO_FLAG_EXEC`. |
| func (p *FileInterface) GetBuffer(flags uint32) (int32, *fuchsiamem.Buffer, error) { |
| req_ := &fileGetBufferRequest{ |
| Flags: flags, |
| } |
| 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` |
| // - `CLONE_FLAG_SAME_RIGHTS` |
| // |
| // All other flags are ignored. |
| // |
| // The `OPEN_RIGHT_*` bits in `flags` request corresponding rights over the resulting |
| // cloned object. |
| // The cloned object must have rights less than or equal to the original object. |
| // Alternatively, pass `CLONE_FLAG_SAME_RIGHTS` to inherit the rights on the source connection. |
| // It is invalid to pass any of the `OPEN_RIGHT_*` flags together with `CLONE_FLAG_SAME_RIGHTS`. |
| 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. |
| // |
| // This method does not require any rights. |
| 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`. |
| 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) |
| // Reads 'count' bytes at the seek offset. |
| // The seek offset is moved forward by the number of bytes read. |
| // |
| // This method requires following rights: `OPEN_RIGHT_READABLE`. |
| Read(count uint64) (int32, []uint8, error) |
| // Reads '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) |
| // Writes data at the seek offset. |
| // The seek offset is moved forward by the number of bytes written. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| Write(data []uint8) (int32, uint64, error) |
| // Writes 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) |
| // Shrinks the file size to 'length' bytes. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| Truncate(length uint64) (int32, error) |
| // Acquires the Directory::Open rights and flags used to access this file. |
| // |
| // This method does not require any rights. |
| GetFlags() (int32, uint32, error) |
| // Changes the Directory::Open flags used to access the file. |
| // Supported flags which can be turned on / off: |
| // - `OPEN_FLAG_APPEND` |
| // |
| // This method does not require any rights. |
| SetFlags(flags uint32) (int32, error) |
| // Acquires a buffer representing this file, if there is one, with the |
| // requested access rights. |
| // |
| // `flags` may be any of `VMO_FLAG_*`. |
| // |
| // This method requires following rights: |
| // - `OPEN_RIGHT_WRITABLE` if `flags` includes `VMO_FLAG_WRITE`. |
| // - `OPEN_RIGHT_READABLE` if `flags` includes `VMO_FLAG_READ` or `VMO_FLAG_EXEC`. |
| GetBuffer(flags uint32) (int32, *fuchsiamem.Buffer, error) |
| } |
| |
| type FileTransitionalBase struct{} |
| |
| type FileInterfaceRequest _bindings.InterfaceRequest |
| |
| func NewFileInterfaceRequest() (FileInterfaceRequest, *FileInterface, error) { |
| req, cli, err := _bindings.NewInterfaceRequest() |
| return FileInterfaceRequest(req), (*FileInterface)(cli), err |
| } |
| |
| type FileStub struct { |
| Impl File |
| } |
| |
| func (s_ *FileStub) DispatchImpl(ordinal_ uint64, data_ []byte, handles_ []_zx.Handle) (_bindings.Message, bool, error) { |
| switch ordinal_ { |
| case FileCloneOrdinal: |
| in_ := fileCloneRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| err_ := s_.Impl.Clone(in_.Flags, in_.Object) |
| return nil, false, err_ |
| case FileCloseOrdinal: |
| s, err_ := s_.Impl.Close() |
| out_ := fileCloseResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case FileDescribeOrdinal: |
| info, err_ := s_.Impl.Describe() |
| out_ := fileDescribeResponse{} |
| out_.Info = info |
| return &out_, true, err_ |
| case FileSyncOrdinal: |
| s, err_ := s_.Impl.Sync() |
| out_ := fileSyncResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case FileGetAttrOrdinal: |
| s, attributes, err_ := s_.Impl.GetAttr() |
| out_ := fileGetAttrResponse{} |
| out_.S = s |
| out_.Attributes = attributes |
| return &out_, true, err_ |
| case FileSetAttrOrdinal: |
| in_ := fileSetAttrRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.SetAttr(in_.Flags, in_.Attributes) |
| out_ := fileSetAttrResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case FileIoctlOrdinal: |
| in_ := fileIoctlRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| 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 |
| return &out_, true, err_ |
| case FileReadOrdinal: |
| in_ := fileReadRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, data, err_ := s_.Impl.Read(in_.Count) |
| out_ := fileReadResponse{} |
| out_.S = s |
| out_.Data = data |
| return &out_, true, err_ |
| case FileReadAtOrdinal: |
| in_ := fileReadAtRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, data, err_ := s_.Impl.ReadAt(in_.Count, in_.Offset) |
| out_ := fileReadAtResponse{} |
| out_.S = s |
| out_.Data = data |
| return &out_, true, err_ |
| case FileWriteOrdinal: |
| in_ := fileWriteRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, actual, err_ := s_.Impl.Write(in_.Data) |
| out_ := fileWriteResponse{} |
| out_.S = s |
| out_.Actual = actual |
| return &out_, true, err_ |
| case FileWriteAtOrdinal: |
| in_ := fileWriteAtRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, actual, err_ := s_.Impl.WriteAt(in_.Data, in_.Offset) |
| out_ := fileWriteAtResponse{} |
| out_.S = s |
| out_.Actual = actual |
| return &out_, true, err_ |
| case FileSeekOrdinal: |
| in_ := fileSeekRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, offset, err_ := s_.Impl.Seek(in_.Offset, in_.Start) |
| out_ := fileSeekResponse{} |
| out_.S = s |
| out_.Offset = offset |
| return &out_, true, err_ |
| case FileTruncateOrdinal: |
| in_ := fileTruncateRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.Truncate(in_.Length) |
| out_ := fileTruncateResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case FileGetFlagsOrdinal: |
| s, flags, err_ := s_.Impl.GetFlags() |
| out_ := fileGetFlagsResponse{} |
| out_.S = s |
| out_.Flags = flags |
| return &out_, true, err_ |
| case FileSetFlagsOrdinal: |
| in_ := fileSetFlagsRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.SetFlags(in_.Flags) |
| out_ := fileSetFlagsResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case FileGetBufferOrdinal: |
| in_ := fileGetBufferRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, buffer, err_ := s_.Impl.GetBuffer(in_.Flags) |
| out_ := fileGetBufferResponse{} |
| out_.S = s |
| out_.Buffer = buffer |
| return &out_, true, err_ |
| } |
| return nil, false, _bindings.ErrUnknownOrdinal |
| } |
| |
| type FileService struct { |
| _bindings.BindingSet |
| } |
| |
| func (s *FileService) Add(impl File, c _zx.Channel, onError func(error)) (_bindings.BindingKey, error) { |
| return s.BindingSet.Add(&FileStub{Impl: impl}, c, onError) |
| } |
| |
| func (s *FileService) EventProxyFor(key _bindings.BindingKey) (*FileEventProxy, bool) { |
| pxy, err := s.BindingSet.ProxyFor(key) |
| return (*FileEventProxy)(pxy), err |
| } |
| |
| type FileEventProxy _bindings.ChannelProxy |
| |
| func (p *FileEventProxy) OnOpen(s int32, info *NodeInfo) error { |
| event_ := &fileOnOpenResponse{ |
| S: s, |
| Info: info, |
| } |
| return ((*_bindings.ChannelProxy)(p)).Send(FileOnOpenOrdinal, event_) |
| } |
| |
| const ( |
| DirectoryWatcherOnEventOrdinal uint64 = 0x208bcc9d00000000 |
| ) |
| |
| type directoryWatcherOnEventRequest struct { |
| _ struct{} `fidl2:"s,16,0"` |
| Events []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mdirectoryWatcherOnEventRequest = _bindings.CreateLazyMarshaler(directoryWatcherOnEventRequest{}) |
| |
| func (msg *directoryWatcherOnEventRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryWatcherOnEventRequest |
| } |
| |
| type DirectoryWatcherInterface _bindings.ChannelProxy |
| |
| func (p *DirectoryWatcherInterface) OnEvent(events []uint8) error { |
| req_ := &directoryWatcherOnEventRequest{ |
| Events: events, |
| } |
| err := ((*_bindings.ChannelProxy)(p)).Send(DirectoryWatcherOnEventOrdinal, req_) |
| return err |
| } |
| |
| // 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 { |
| OnEvent(events []uint8) error |
| } |
| |
| type DirectoryWatcherTransitionalBase struct{} |
| |
| type DirectoryWatcherInterfaceRequest _bindings.InterfaceRequest |
| |
| func NewDirectoryWatcherInterfaceRequest() (DirectoryWatcherInterfaceRequest, *DirectoryWatcherInterface, error) { |
| req, cli, err := _bindings.NewInterfaceRequest() |
| return DirectoryWatcherInterfaceRequest(req), (*DirectoryWatcherInterface)(cli), err |
| } |
| |
| type DirectoryWatcherStub struct { |
| Impl DirectoryWatcher |
| } |
| |
| func (s_ *DirectoryWatcherStub) DispatchImpl(ordinal_ uint64, data_ []byte, handles_ []_zx.Handle) (_bindings.Message, bool, error) { |
| switch ordinal_ { |
| case DirectoryWatcherOnEventOrdinal: |
| in_ := directoryWatcherOnEventRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| err_ := s_.Impl.OnEvent(in_.Events) |
| return nil, false, err_ |
| } |
| return nil, false, _bindings.ErrUnknownOrdinal |
| } |
| |
| type DirectoryWatcherService struct { |
| _bindings.BindingSet |
| } |
| |
| func (s *DirectoryWatcherService) Add(impl DirectoryWatcher, c _zx.Channel, onError func(error)) (_bindings.BindingKey, error) { |
| return s.BindingSet.Add(&DirectoryWatcherStub{Impl: impl}, c, onError) |
| } |
| |
| func (s *DirectoryWatcherService) EventProxyFor(key _bindings.BindingKey) (*DirectoryWatcherEventProxy, bool) { |
| pxy, err := s.BindingSet.ProxyFor(key) |
| return (*DirectoryWatcherEventProxy)(pxy), err |
| } |
| |
| type DirectoryWatcherEventProxy _bindings.ChannelProxy |
| |
| const ( |
| DirectoryCloneOrdinal uint64 = 0x17fe6a4c00000000 |
| DirectoryCloseOrdinal uint64 = 0x52b9568700000000 |
| DirectoryDescribeOrdinal uint64 = 0x1f62df5e00000000 |
| DirectoryOnOpenOrdinal uint64 = 0x4700a7bd00000000 |
| DirectorySyncOrdinal uint64 = 0x62423faa00000000 |
| DirectoryGetAttrOrdinal uint64 = 0x4585e7c800000000 |
| DirectorySetAttrOrdinal uint64 = 0xbd5559a00000000 |
| DirectoryIoctlOrdinal uint64 = 0x35f3aca700000000 |
| DirectoryOpenOrdinal uint64 = 0x77e4cceb00000000 |
| DirectoryUnlinkOrdinal uint64 = 0x2cbadb1900000000 |
| DirectoryReadDirentsOrdinal uint64 = 0x2ea53c2d00000000 |
| DirectoryRewindOrdinal uint64 = 0x7072fd8700000000 |
| DirectoryGetTokenOrdinal uint64 = 0x3217bced00000000 |
| DirectoryRenameOrdinal uint64 = 0x4a94b0ac00000000 |
| DirectoryLinkOrdinal uint64 = 0x1b8a5e6400000000 |
| DirectoryWatchOrdinal uint64 = 0x5ac28f3400000000 |
| ) |
| |
| type directoryCloneRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Flags uint32 |
| Object NodeInterfaceRequest `fidl:"0" fidl2:"0"` |
| } |
| |
| var _mdirectoryCloneRequest = _bindings.CreateLazyMarshaler(directoryCloneRequest{}) |
| |
| func (msg *directoryCloneRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryCloneRequest |
| } |
| |
| type directoryCloseResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryCloseResponse = _bindings.CreateLazyMarshaler(directoryCloseResponse{}) |
| |
| func (msg *directoryCloseResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryCloseResponse |
| } |
| |
| type directoryDescribeResponse struct { |
| _ struct{} `fidl2:"s,32,0"` |
| Info NodeInfo |
| } |
| |
| var _mdirectoryDescribeResponse = _bindings.CreateLazyMarshaler(directoryDescribeResponse{}) |
| |
| func (msg *directoryDescribeResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryDescribeResponse |
| } |
| |
| type directoryOnOpenResponse struct { |
| _ struct{} `fidl2:"s,16,0"` |
| S int32 |
| Info *NodeInfo |
| } |
| |
| var _mdirectoryOnOpenResponse = _bindings.CreateLazyMarshaler(directoryOnOpenResponse{}) |
| |
| func (msg *directoryOnOpenResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryOnOpenResponse |
| } |
| |
| type directorySyncResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectorySyncResponse = _bindings.CreateLazyMarshaler(directorySyncResponse{}) |
| |
| func (msg *directorySyncResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectorySyncResponse |
| } |
| |
| type directoryGetAttrResponse struct { |
| _ struct{} `fidl2:"s,64,0"` |
| S int32 |
| Attributes NodeAttributes |
| } |
| |
| var _mdirectoryGetAttrResponse = _bindings.CreateLazyMarshaler(directoryGetAttrResponse{}) |
| |
| func (msg *directoryGetAttrResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryGetAttrResponse |
| } |
| |
| type directorySetAttrRequest struct { |
| _ struct{} `fidl2:"s,64,0"` |
| Flags uint32 |
| Attributes NodeAttributes |
| } |
| |
| var _mdirectorySetAttrRequest = _bindings.CreateLazyMarshaler(directorySetAttrRequest{}) |
| |
| func (msg *directorySetAttrRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectorySetAttrRequest |
| } |
| |
| type directorySetAttrResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectorySetAttrResponse = _bindings.CreateLazyMarshaler(directorySetAttrResponse{}) |
| |
| func (msg *directorySetAttrResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectorySetAttrResponse |
| } |
| |
| type directoryIoctlRequest struct { |
| _ struct{} `fidl2:"s,48,0"` |
| Opcode uint32 |
| MaxOut uint64 |
| Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"` |
| In []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mdirectoryIoctlRequest = _bindings.CreateLazyMarshaler(directoryIoctlRequest{}) |
| |
| func (msg *directoryIoctlRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryIoctlRequest |
| } |
| |
| type directoryIoctlResponse struct { |
| _ struct{} `fidl2:"s,40,0"` |
| S int32 |
| Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"` |
| Out []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mdirectoryIoctlResponse = _bindings.CreateLazyMarshaler(directoryIoctlResponse{}) |
| |
| func (msg *directoryIoctlResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryIoctlResponse |
| } |
| |
| type directoryOpenRequest struct { |
| _ struct{} `fidl2:"s,32,0"` |
| Flags uint32 |
| Mode uint32 |
| Path string `fidl:"4096" fidl2:"4096"` |
| Object NodeInterfaceRequest `fidl:"0" fidl2:"0"` |
| } |
| |
| var _mdirectoryOpenRequest = _bindings.CreateLazyMarshaler(directoryOpenRequest{}) |
| |
| func (msg *directoryOpenRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryOpenRequest |
| } |
| |
| type directoryUnlinkRequest struct { |
| _ struct{} `fidl2:"s,16,0"` |
| Path string `fidl:"4096" fidl2:"4096"` |
| } |
| |
| var _mdirectoryUnlinkRequest = _bindings.CreateLazyMarshaler(directoryUnlinkRequest{}) |
| |
| func (msg *directoryUnlinkRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryUnlinkRequest |
| } |
| |
| type directoryUnlinkResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryUnlinkResponse = _bindings.CreateLazyMarshaler(directoryUnlinkResponse{}) |
| |
| func (msg *directoryUnlinkResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryUnlinkResponse |
| } |
| |
| type directoryReadDirentsRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| MaxBytes uint64 |
| } |
| |
| var _mdirectoryReadDirentsRequest = _bindings.CreateLazyMarshaler(directoryReadDirentsRequest{}) |
| |
| func (msg *directoryReadDirentsRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryReadDirentsRequest |
| } |
| |
| type directoryReadDirentsResponse struct { |
| _ struct{} `fidl2:"s,24,0"` |
| S int32 |
| Dirents []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mdirectoryReadDirentsResponse = _bindings.CreateLazyMarshaler(directoryReadDirentsResponse{}) |
| |
| func (msg *directoryReadDirentsResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryReadDirentsResponse |
| } |
| |
| type directoryRewindResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryRewindResponse = _bindings.CreateLazyMarshaler(directoryRewindResponse{}) |
| |
| func (msg *directoryRewindResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryRewindResponse |
| } |
| |
| type directoryGetTokenResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| Token _zx.Handle `fidl:"1" fidl2:"1"` |
| } |
| |
| var _mdirectoryGetTokenResponse = _bindings.CreateLazyMarshaler(directoryGetTokenResponse{}) |
| |
| func (msg *directoryGetTokenResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryGetTokenResponse |
| } |
| |
| type directoryRenameRequest struct { |
| _ struct{} `fidl2:"s,40,0"` |
| Src string `fidl:"4096" fidl2:"4096"` |
| DstParentToken _zx.Handle `fidl:"0" fidl2:"0"` |
| Dst string `fidl:"4096" fidl2:"4096"` |
| } |
| |
| var _mdirectoryRenameRequest = _bindings.CreateLazyMarshaler(directoryRenameRequest{}) |
| |
| func (msg *directoryRenameRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryRenameRequest |
| } |
| |
| type directoryRenameResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryRenameResponse = _bindings.CreateLazyMarshaler(directoryRenameResponse{}) |
| |
| func (msg *directoryRenameResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryRenameResponse |
| } |
| |
| type directoryLinkRequest struct { |
| _ struct{} `fidl2:"s,40,0"` |
| Src string `fidl:"4096" fidl2:"4096"` |
| DstParentToken _zx.Handle `fidl:"0" fidl2:"0"` |
| Dst string `fidl:"4096" fidl2:"4096"` |
| } |
| |
| var _mdirectoryLinkRequest = _bindings.CreateLazyMarshaler(directoryLinkRequest{}) |
| |
| func (msg *directoryLinkRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryLinkRequest |
| } |
| |
| type directoryLinkResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryLinkResponse = _bindings.CreateLazyMarshaler(directoryLinkResponse{}) |
| |
| func (msg *directoryLinkResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryLinkResponse |
| } |
| |
| type directoryWatchRequest struct { |
| _ struct{} `fidl2:"s,16,0"` |
| Mask uint32 |
| Options uint32 |
| Watcher _zx.Channel `fidl:"0" fidl2:"0"` |
| } |
| |
| var _mdirectoryWatchRequest = _bindings.CreateLazyMarshaler(directoryWatchRequest{}) |
| |
| func (msg *directoryWatchRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryWatchRequest |
| } |
| |
| type directoryWatchResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryWatchResponse = _bindings.CreateLazyMarshaler(directoryWatchResponse{}) |
| |
| func (msg *directoryWatchResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryWatchResponse |
| } |
| |
| 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` |
| // - `CLONE_FLAG_SAME_RIGHTS` |
| // |
| // All other flags are ignored. |
| // |
| // The `OPEN_RIGHT_*` bits in `flags` request corresponding rights over the resulting |
| // cloned object. |
| // The cloned object must have rights less than or equal to the original object. |
| // Alternatively, pass `CLONE_FLAG_SAME_RIGHTS` to inherit the rights on the source connection. |
| // It is invalid to pass any of the `OPEN_RIGHT_*` flags together with `CLONE_FLAG_SAME_RIGHTS`. |
| func (p *DirectoryInterface) Clone(flags uint32, object NodeInterfaceRequest) error { |
| req_ := &directoryCloneRequest{ |
| Flags: flags, |
| Object: object, |
| } |
| 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) { |
| var req_ _bindings.Message |
| 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) { |
| var req_ _bindings.Message |
| 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_) |
| return resp_.S, resp_.Info, err |
| } |
| |
| // Synchronizes updates to the node to the underlying media, if it exists. |
| // |
| // This method does not require any rights. |
| func (p *DirectoryInterface) Sync() (int32, error) { |
| var req_ _bindings.Message |
| 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) { |
| var req_ _bindings.Message |
| 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`. |
| func (p *DirectoryInterface) SetAttr(flags uint32, attributes NodeAttributes) (int32, error) { |
| req_ := &directorySetAttrRequest{ |
| Flags: flags, |
| Attributes: attributes, |
| } |
| 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{ |
| Opcode: opcode, |
| MaxOut: maxOut, |
| Handles: handles, |
| In: in, |
| } |
| resp_ := &directoryIoctlResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryIoctlOrdinal, req_, resp_) |
| return resp_.S, resp_.Handles, resp_.Out, err |
| } |
| |
| // Opens a new object relative to this directory object. |
| // |
| // `path` may contain multiple segments, separated by "/" characters, |
| // and should never be empty i.e. "" is an invalid path. |
| // |
| // `flags` may be any of the `OPEN_FLAG_*` and `OPEN_RIGHT_*` values, bitwise ORed together. |
| // The `OPEN_FLAG_DESCRIBE` flag may cause an `OnOpen` event to be transmitted |
| // on the `object` handle, indicating the type of object opened. |
| // |
| // If an unknown value is sent for either flags or mode, the connection should |
| // be closed. |
| // |
| // `OPEN_RIGHTS_*` flags provided in `flags` will restrict access rights on the `object` channel |
| // which will be connected to the opened entity. |
| // |
| // Rights are never increased. When you open a nested entity within a directory, you may only |
| // request the same rights as what the directory connection already has, or a subset of those. |
| // Exceeding those rights causes an access denied error to be transmitted in the |
| // `OnOpen` event if applicable, and the `object` connection closed. |
| // |
| // The caller must specify either one or more of the `OPEN_RIGHT_*` flags, or |
| // the `OPEN_FLAG_NODE_REFERENCE` flag. |
| func (p *DirectoryInterface) Open(flags uint32, mode uint32, path string, object NodeInterfaceRequest) error { |
| req_ := &directoryOpenRequest{ |
| Flags: flags, |
| Mode: mode, |
| Path: path, |
| Object: object, |
| } |
| err := ((*_bindings.ChannelProxy)(p)).Send(DirectoryOpenOrdinal, req_) |
| return err |
| } |
| |
| // Detaches an object from this directory object. |
| // |
| // The underlying object may or may not be deleted after this method |
| // completes: although the link will be removed from the containing directory, |
| // objects with multiple references (such as files which are still open) |
| // will not actually be destroyed until all references are removed. |
| // |
| // If a directory is unlinked while it still has an open reference, |
| // it must become read-only, preventing new entries from being created |
| // until all references close and the directory is destroyed. |
| // |
| // `path` identifies the file which should be detached. |
| // If `path` contains multiple segments, separated by "/" characters, |
| // then the directory is traversed, one segment at a time, relative to the |
| // originally accessed Directory. |
| // |
| // Returns: |
| // `ZX_ERR_ACCESS_DENIED` if the connection (or the underlying filesystem) does not |
| // allow writable access. |
| // `ZX_ERR_INVALID_ARGS` if `path` contains ".." segments. |
| // `ZX_ERR_NOT_EMPTY` if `path` refers to a non-empty directory. |
| // `ZX_ERR_UNAVAILABLE` if `path` refers to a mount point, containing a remote channel. |
| // `ZX_ERR_UNAVAILABLE` if `path` is ".". |
| // |
| // Other errors may be returned for filesystem-specific reasons. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| func (p *DirectoryInterface) Unlink(path string) (int32, error) { |
| req_ := &directoryUnlinkRequest{ |
| Path: path, |
| } |
| 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]; |
| // } |
| // |
| // This method does not require any rights, since one could always probe for |
| // directory contents by triggering name conflicts during file creation. |
| func (p *DirectoryInterface) ReadDirents(maxBytes uint64) (int32, []uint8, error) { |
| req_ := &directoryReadDirentsRequest{ |
| MaxBytes: maxBytes, |
| } |
| resp_ := &directoryReadDirentsResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryReadDirentsOrdinal, req_, resp_) |
| return resp_.S, resp_.Dirents, err |
| } |
| |
| // Resets the directory seek offset. |
| // |
| // This method does not require any rights, similar to ReadDirents. |
| func (p *DirectoryInterface) Rewind() (int32, error) { |
| var req_ _bindings.Message |
| resp_ := &directoryRewindResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryRewindOrdinal, req_, resp_) |
| return resp_.S, err |
| } |
| |
| // Acquires a token to a Directory which can be used to identify |
| // access to it at a later point in time. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| func (p *DirectoryInterface) GetToken() (int32, _zx.Handle, error) { |
| var req_ _bindings.Message |
| resp_ := &directoryGetTokenResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryGetTokenOrdinal, req_, resp_) |
| return resp_.S, resp_.Token, err |
| } |
| |
| // Renames an object named src to the name dst, in a directory represented by token. |
| // |
| // `src/dst` must be resolved object names. Including "/" in any position |
| // other than the end of the string will return `ZX_ERR_INVALID_ARGS`. |
| // Returning "/" at the end of either string implies that it must be a |
| // directory, or else `ZX_ERR_NOT_DIR` should be returned. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| func (p *DirectoryInterface) Rename(src string, dstParentToken _zx.Handle, dst string) (int32, error) { |
| req_ := &directoryRenameRequest{ |
| Src: src, |
| DstParentToken: dstParentToken, |
| Dst: dst, |
| } |
| resp_ := &directoryRenameResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryRenameOrdinal, req_, resp_) |
| return resp_.S, err |
| } |
| |
| // Creates a link to an object named src by the name dst, within a directory represented by |
| // token. |
| // |
| // `src` must be a resolved object name. Including "/" in the string will |
| // return `ZX_ERR_INVALID_ARGS`. |
| // |
| // `dst` must be a resolved object name. Including "/" in the string will |
| // return `ZX_ERR_INVALID_ARGS`. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| func (p *DirectoryInterface) Link(src string, dstParentToken _zx.Handle, dst string) (int32, error) { |
| req_ := &directoryLinkRequest{ |
| Src: src, |
| DstParentToken: dstParentToken, |
| Dst: dst, |
| } |
| 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. |
| // |
| // This method does not require any rights, similar to ReadDirents. |
| func (p *DirectoryInterface) Watch(mask uint32, options uint32, watcher _zx.Channel) (int32, error) { |
| req_ := &directoryWatchRequest{ |
| Mask: mask, |
| Options: options, |
| Watcher: watcher, |
| } |
| 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` |
| // - `CLONE_FLAG_SAME_RIGHTS` |
| // |
| // All other flags are ignored. |
| // |
| // The `OPEN_RIGHT_*` bits in `flags` request corresponding rights over the resulting |
| // cloned object. |
| // The cloned object must have rights less than or equal to the original object. |
| // Alternatively, pass `CLONE_FLAG_SAME_RIGHTS` to inherit the rights on the source connection. |
| // It is invalid to pass any of the `OPEN_RIGHT_*` flags together with `CLONE_FLAG_SAME_RIGHTS`. |
| 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. |
| // |
| // This method does not require any rights. |
| 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`. |
| 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) |
| // Opens a new object relative to this directory object. |
| // |
| // `path` may contain multiple segments, separated by "/" characters, |
| // and should never be empty i.e. "" is an invalid path. |
| // |
| // `flags` may be any of the `OPEN_FLAG_*` and `OPEN_RIGHT_*` values, bitwise ORed together. |
| // The `OPEN_FLAG_DESCRIBE` flag may cause an `OnOpen` event to be transmitted |
| // on the `object` handle, indicating the type of object opened. |
| // |
| // If an unknown value is sent for either flags or mode, the connection should |
| // be closed. |
| // |
| // `OPEN_RIGHTS_*` flags provided in `flags` will restrict access rights on the `object` channel |
| // which will be connected to the opened entity. |
| // |
| // Rights are never increased. When you open a nested entity within a directory, you may only |
| // request the same rights as what the directory connection already has, or a subset of those. |
| // Exceeding those rights causes an access denied error to be transmitted in the |
| // `OnOpen` event if applicable, and the `object` connection closed. |
| // |
| // The caller must specify either one or more of the `OPEN_RIGHT_*` flags, or |
| // the `OPEN_FLAG_NODE_REFERENCE` flag. |
| Open(flags uint32, mode uint32, path string, object NodeInterfaceRequest) error |
| // Detaches an object from this directory object. |
| // |
| // The underlying object may or may not be deleted after this method |
| // completes: although the link will be removed from the containing directory, |
| // objects with multiple references (such as files which are still open) |
| // will not actually be destroyed until all references are removed. |
| // |
| // If a directory is unlinked while it still has an open reference, |
| // it must become read-only, preventing new entries from being created |
| // until all references close and the directory is destroyed. |
| // |
| // `path` identifies the file which should be detached. |
| // If `path` contains multiple segments, separated by "/" characters, |
| // then the directory is traversed, one segment at a time, relative to the |
| // originally accessed Directory. |
| // |
| // Returns: |
| // `ZX_ERR_ACCESS_DENIED` if the connection (or the underlying filesystem) does not |
| // allow writable access. |
| // `ZX_ERR_INVALID_ARGS` if `path` contains ".." segments. |
| // `ZX_ERR_NOT_EMPTY` if `path` refers to a non-empty directory. |
| // `ZX_ERR_UNAVAILABLE` if `path` refers to a mount point, containing a remote channel. |
| // `ZX_ERR_UNAVAILABLE` if `path` is ".". |
| // |
| // Other errors may be returned for filesystem-specific reasons. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| 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]; |
| // } |
| // |
| // This method does not require any rights, since one could always probe for |
| // directory contents by triggering name conflicts during file creation. |
| ReadDirents(maxBytes uint64) (int32, []uint8, error) |
| // Resets the directory seek offset. |
| // |
| // This method does not require any rights, similar to ReadDirents. |
| Rewind() (int32, error) |
| // Acquires a token to a Directory which can be used to identify |
| // access to it at a later point in time. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| GetToken() (int32, _zx.Handle, error) |
| // Renames an object named src to the name dst, in a directory represented by token. |
| // |
| // `src/dst` must be resolved object names. Including "/" in any position |
| // other than the end of the string will return `ZX_ERR_INVALID_ARGS`. |
| // Returning "/" at the end of either string implies that it must be a |
| // directory, or else `ZX_ERR_NOT_DIR` should be returned. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| Rename(src string, dstParentToken _zx.Handle, dst string) (int32, error) |
| // Creates a link to an object named src by the name dst, within a directory represented by |
| // token. |
| // |
| // `src` must be a resolved object name. Including "/" in the string will |
| // return `ZX_ERR_INVALID_ARGS`. |
| // |
| // `dst` must be a resolved object name. Including "/" in the string will |
| // return `ZX_ERR_INVALID_ARGS`. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| 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. |
| // |
| // This method does not require any rights, similar to ReadDirents. |
| Watch(mask uint32, options uint32, watcher _zx.Channel) (int32, error) |
| } |
| |
| type DirectoryTransitionalBase struct{} |
| |
| type DirectoryInterfaceRequest _bindings.InterfaceRequest |
| |
| func NewDirectoryInterfaceRequest() (DirectoryInterfaceRequest, *DirectoryInterface, error) { |
| req, cli, err := _bindings.NewInterfaceRequest() |
| return DirectoryInterfaceRequest(req), (*DirectoryInterface)(cli), err |
| } |
| |
| type DirectoryStub struct { |
| Impl Directory |
| } |
| |
| func (s_ *DirectoryStub) DispatchImpl(ordinal_ uint64, data_ []byte, handles_ []_zx.Handle) (_bindings.Message, bool, error) { |
| switch ordinal_ { |
| case DirectoryCloneOrdinal: |
| in_ := directoryCloneRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| err_ := s_.Impl.Clone(in_.Flags, in_.Object) |
| return nil, false, err_ |
| case DirectoryCloseOrdinal: |
| s, err_ := s_.Impl.Close() |
| out_ := directoryCloseResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryDescribeOrdinal: |
| info, err_ := s_.Impl.Describe() |
| out_ := directoryDescribeResponse{} |
| out_.Info = info |
| return &out_, true, err_ |
| case DirectorySyncOrdinal: |
| s, err_ := s_.Impl.Sync() |
| out_ := directorySyncResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryGetAttrOrdinal: |
| s, attributes, err_ := s_.Impl.GetAttr() |
| out_ := directoryGetAttrResponse{} |
| out_.S = s |
| out_.Attributes = attributes |
| return &out_, true, err_ |
| case DirectorySetAttrOrdinal: |
| in_ := directorySetAttrRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.SetAttr(in_.Flags, in_.Attributes) |
| out_ := directorySetAttrResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryIoctlOrdinal: |
| in_ := directoryIoctlRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| 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 |
| return &out_, true, err_ |
| case DirectoryOpenOrdinal: |
| in_ := directoryOpenRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| err_ := s_.Impl.Open(in_.Flags, in_.Mode, in_.Path, in_.Object) |
| return nil, false, err_ |
| case DirectoryUnlinkOrdinal: |
| in_ := directoryUnlinkRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.Unlink(in_.Path) |
| out_ := directoryUnlinkResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryReadDirentsOrdinal: |
| in_ := directoryReadDirentsRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, dirents, err_ := s_.Impl.ReadDirents(in_.MaxBytes) |
| out_ := directoryReadDirentsResponse{} |
| out_.S = s |
| out_.Dirents = dirents |
| return &out_, true, err_ |
| case DirectoryRewindOrdinal: |
| s, err_ := s_.Impl.Rewind() |
| out_ := directoryRewindResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryGetTokenOrdinal: |
| s, token, err_ := s_.Impl.GetToken() |
| out_ := directoryGetTokenResponse{} |
| out_.S = s |
| out_.Token = token |
| return &out_, true, err_ |
| case DirectoryRenameOrdinal: |
| in_ := directoryRenameRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.Rename(in_.Src, in_.DstParentToken, in_.Dst) |
| out_ := directoryRenameResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryLinkOrdinal: |
| in_ := directoryLinkRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.Link(in_.Src, in_.DstParentToken, in_.Dst) |
| out_ := directoryLinkResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryWatchOrdinal: |
| in_ := directoryWatchRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.Watch(in_.Mask, in_.Options, in_.Watcher) |
| out_ := directoryWatchResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| } |
| return nil, false, _bindings.ErrUnknownOrdinal |
| } |
| |
| type DirectoryService struct { |
| _bindings.BindingSet |
| } |
| |
| func (s *DirectoryService) Add(impl Directory, c _zx.Channel, onError func(error)) (_bindings.BindingKey, error) { |
| return s.BindingSet.Add(&DirectoryStub{Impl: impl}, c, onError) |
| } |
| |
| func (s *DirectoryService) EventProxyFor(key _bindings.BindingKey) (*DirectoryEventProxy, bool) { |
| pxy, err := s.BindingSet.ProxyFor(key) |
| return (*DirectoryEventProxy)(pxy), err |
| } |
| |
| type DirectoryEventProxy _bindings.ChannelProxy |
| |
| func (p *DirectoryEventProxy) OnOpen(s int32, info *NodeInfo) error { |
| event_ := &directoryOnOpenResponse{ |
| S: s, |
| Info: info, |
| } |
| return ((*_bindings.ChannelProxy)(p)).Send(DirectoryOnOpenOrdinal, event_) |
| } |
| |
| const ( |
| DirectoryAdminCloneOrdinal uint64 = 0x17fe6a4c00000000 |
| DirectoryAdminCloseOrdinal uint64 = 0x52b9568700000000 |
| DirectoryAdminDescribeOrdinal uint64 = 0x1f62df5e00000000 |
| DirectoryAdminOnOpenOrdinal uint64 = 0x4700a7bd00000000 |
| DirectoryAdminSyncOrdinal uint64 = 0x62423faa00000000 |
| DirectoryAdminGetAttrOrdinal uint64 = 0x4585e7c800000000 |
| DirectoryAdminSetAttrOrdinal uint64 = 0xbd5559a00000000 |
| DirectoryAdminIoctlOrdinal uint64 = 0x35f3aca700000000 |
| DirectoryAdminOpenOrdinal uint64 = 0x77e4cceb00000000 |
| DirectoryAdminUnlinkOrdinal uint64 = 0x2cbadb1900000000 |
| DirectoryAdminReadDirentsOrdinal uint64 = 0x2ea53c2d00000000 |
| DirectoryAdminRewindOrdinal uint64 = 0x7072fd8700000000 |
| DirectoryAdminGetTokenOrdinal uint64 = 0x3217bced00000000 |
| DirectoryAdminRenameOrdinal uint64 = 0x4a94b0ac00000000 |
| DirectoryAdminLinkOrdinal uint64 = 0x1b8a5e6400000000 |
| DirectoryAdminWatchOrdinal uint64 = 0x5ac28f3400000000 |
| DirectoryAdminMountOrdinal uint64 = 0x7e5f12e600000000 |
| DirectoryAdminMountAndCreateOrdinal uint64 = 0x3225f69100000000 |
| DirectoryAdminUnmountOrdinal uint64 = 0x2502275400000000 |
| DirectoryAdminUnmountNodeOrdinal uint64 = 0x16da38a700000000 |
| DirectoryAdminQueryFilesystemOrdinal uint64 = 0x66298d9200000000 |
| DirectoryAdminGetDevicePathOrdinal uint64 = 0x2ef70eb800000000 |
| ) |
| |
| type directoryAdminCloneRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Flags uint32 |
| Object NodeInterfaceRequest `fidl:"0" fidl2:"0"` |
| } |
| |
| var _mdirectoryAdminCloneRequest = _bindings.CreateLazyMarshaler(directoryAdminCloneRequest{}) |
| |
| func (msg *directoryAdminCloneRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminCloneRequest |
| } |
| |
| type directoryAdminCloseResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryAdminCloseResponse = _bindings.CreateLazyMarshaler(directoryAdminCloseResponse{}) |
| |
| func (msg *directoryAdminCloseResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminCloseResponse |
| } |
| |
| type directoryAdminDescribeResponse struct { |
| _ struct{} `fidl2:"s,32,0"` |
| Info NodeInfo |
| } |
| |
| var _mdirectoryAdminDescribeResponse = _bindings.CreateLazyMarshaler(directoryAdminDescribeResponse{}) |
| |
| func (msg *directoryAdminDescribeResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminDescribeResponse |
| } |
| |
| type directoryAdminOnOpenResponse struct { |
| _ struct{} `fidl2:"s,16,0"` |
| S int32 |
| Info *NodeInfo |
| } |
| |
| var _mdirectoryAdminOnOpenResponse = _bindings.CreateLazyMarshaler(directoryAdminOnOpenResponse{}) |
| |
| func (msg *directoryAdminOnOpenResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminOnOpenResponse |
| } |
| |
| type directoryAdminSyncResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryAdminSyncResponse = _bindings.CreateLazyMarshaler(directoryAdminSyncResponse{}) |
| |
| func (msg *directoryAdminSyncResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminSyncResponse |
| } |
| |
| type directoryAdminGetAttrResponse struct { |
| _ struct{} `fidl2:"s,64,0"` |
| S int32 |
| Attributes NodeAttributes |
| } |
| |
| var _mdirectoryAdminGetAttrResponse = _bindings.CreateLazyMarshaler(directoryAdminGetAttrResponse{}) |
| |
| func (msg *directoryAdminGetAttrResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminGetAttrResponse |
| } |
| |
| type directoryAdminSetAttrRequest struct { |
| _ struct{} `fidl2:"s,64,0"` |
| Flags uint32 |
| Attributes NodeAttributes |
| } |
| |
| var _mdirectoryAdminSetAttrRequest = _bindings.CreateLazyMarshaler(directoryAdminSetAttrRequest{}) |
| |
| func (msg *directoryAdminSetAttrRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminSetAttrRequest |
| } |
| |
| type directoryAdminSetAttrResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryAdminSetAttrResponse = _bindings.CreateLazyMarshaler(directoryAdminSetAttrResponse{}) |
| |
| func (msg *directoryAdminSetAttrResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminSetAttrResponse |
| } |
| |
| type directoryAdminIoctlRequest struct { |
| _ struct{} `fidl2:"s,48,0"` |
| Opcode uint32 |
| MaxOut uint64 |
| Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"` |
| In []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mdirectoryAdminIoctlRequest = _bindings.CreateLazyMarshaler(directoryAdminIoctlRequest{}) |
| |
| func (msg *directoryAdminIoctlRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminIoctlRequest |
| } |
| |
| type directoryAdminIoctlResponse struct { |
| _ struct{} `fidl2:"s,40,0"` |
| S int32 |
| Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"` |
| Out []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mdirectoryAdminIoctlResponse = _bindings.CreateLazyMarshaler(directoryAdminIoctlResponse{}) |
| |
| func (msg *directoryAdminIoctlResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminIoctlResponse |
| } |
| |
| type directoryAdminOpenRequest struct { |
| _ struct{} `fidl2:"s,32,0"` |
| Flags uint32 |
| Mode uint32 |
| Path string `fidl:"4096" fidl2:"4096"` |
| Object NodeInterfaceRequest `fidl:"0" fidl2:"0"` |
| } |
| |
| var _mdirectoryAdminOpenRequest = _bindings.CreateLazyMarshaler(directoryAdminOpenRequest{}) |
| |
| func (msg *directoryAdminOpenRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminOpenRequest |
| } |
| |
| type directoryAdminUnlinkRequest struct { |
| _ struct{} `fidl2:"s,16,0"` |
| Path string `fidl:"4096" fidl2:"4096"` |
| } |
| |
| var _mdirectoryAdminUnlinkRequest = _bindings.CreateLazyMarshaler(directoryAdminUnlinkRequest{}) |
| |
| func (msg *directoryAdminUnlinkRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminUnlinkRequest |
| } |
| |
| type directoryAdminUnlinkResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryAdminUnlinkResponse = _bindings.CreateLazyMarshaler(directoryAdminUnlinkResponse{}) |
| |
| func (msg *directoryAdminUnlinkResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminUnlinkResponse |
| } |
| |
| type directoryAdminReadDirentsRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| MaxBytes uint64 |
| } |
| |
| var _mdirectoryAdminReadDirentsRequest = _bindings.CreateLazyMarshaler(directoryAdminReadDirentsRequest{}) |
| |
| func (msg *directoryAdminReadDirentsRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminReadDirentsRequest |
| } |
| |
| type directoryAdminReadDirentsResponse struct { |
| _ struct{} `fidl2:"s,24,0"` |
| S int32 |
| Dirents []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mdirectoryAdminReadDirentsResponse = _bindings.CreateLazyMarshaler(directoryAdminReadDirentsResponse{}) |
| |
| func (msg *directoryAdminReadDirentsResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminReadDirentsResponse |
| } |
| |
| type directoryAdminRewindResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryAdminRewindResponse = _bindings.CreateLazyMarshaler(directoryAdminRewindResponse{}) |
| |
| func (msg *directoryAdminRewindResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminRewindResponse |
| } |
| |
| type directoryAdminGetTokenResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| Token _zx.Handle `fidl:"1" fidl2:"1"` |
| } |
| |
| var _mdirectoryAdminGetTokenResponse = _bindings.CreateLazyMarshaler(directoryAdminGetTokenResponse{}) |
| |
| func (msg *directoryAdminGetTokenResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminGetTokenResponse |
| } |
| |
| type directoryAdminRenameRequest struct { |
| _ struct{} `fidl2:"s,40,0"` |
| Src string `fidl:"4096" fidl2:"4096"` |
| DstParentToken _zx.Handle `fidl:"0" fidl2:"0"` |
| Dst string `fidl:"4096" fidl2:"4096"` |
| } |
| |
| var _mdirectoryAdminRenameRequest = _bindings.CreateLazyMarshaler(directoryAdminRenameRequest{}) |
| |
| func (msg *directoryAdminRenameRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminRenameRequest |
| } |
| |
| type directoryAdminRenameResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryAdminRenameResponse = _bindings.CreateLazyMarshaler(directoryAdminRenameResponse{}) |
| |
| func (msg *directoryAdminRenameResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminRenameResponse |
| } |
| |
| type directoryAdminLinkRequest struct { |
| _ struct{} `fidl2:"s,40,0"` |
| Src string `fidl:"4096" fidl2:"4096"` |
| DstParentToken _zx.Handle `fidl:"0" fidl2:"0"` |
| Dst string `fidl:"4096" fidl2:"4096"` |
| } |
| |
| var _mdirectoryAdminLinkRequest = _bindings.CreateLazyMarshaler(directoryAdminLinkRequest{}) |
| |
| func (msg *directoryAdminLinkRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminLinkRequest |
| } |
| |
| type directoryAdminLinkResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryAdminLinkResponse = _bindings.CreateLazyMarshaler(directoryAdminLinkResponse{}) |
| |
| func (msg *directoryAdminLinkResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminLinkResponse |
| } |
| |
| type directoryAdminWatchRequest struct { |
| _ struct{} `fidl2:"s,16,0"` |
| Mask uint32 |
| Options uint32 |
| Watcher _zx.Channel `fidl:"0" fidl2:"0"` |
| } |
| |
| var _mdirectoryAdminWatchRequest = _bindings.CreateLazyMarshaler(directoryAdminWatchRequest{}) |
| |
| func (msg *directoryAdminWatchRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminWatchRequest |
| } |
| |
| type directoryAdminWatchResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryAdminWatchResponse = _bindings.CreateLazyMarshaler(directoryAdminWatchResponse{}) |
| |
| func (msg *directoryAdminWatchResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminWatchResponse |
| } |
| |
| type directoryAdminMountRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Remote DirectoryInterface |
| } |
| |
| var _mdirectoryAdminMountRequest = _bindings.CreateLazyMarshaler(directoryAdminMountRequest{}) |
| |
| func (msg *directoryAdminMountRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminMountRequest |
| } |
| |
| type directoryAdminMountResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryAdminMountResponse = _bindings.CreateLazyMarshaler(directoryAdminMountResponse{}) |
| |
| func (msg *directoryAdminMountResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminMountResponse |
| } |
| |
| type directoryAdminMountAndCreateRequest struct { |
| _ struct{} `fidl2:"s,32,0"` |
| Remote DirectoryInterface |
| Name string `fidl:"255" fidl2:"255"` |
| Flags uint32 |
| } |
| |
| var _mdirectoryAdminMountAndCreateRequest = _bindings.CreateLazyMarshaler(directoryAdminMountAndCreateRequest{}) |
| |
| func (msg *directoryAdminMountAndCreateRequest) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminMountAndCreateRequest |
| } |
| |
| type directoryAdminMountAndCreateResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryAdminMountAndCreateResponse = _bindings.CreateLazyMarshaler(directoryAdminMountAndCreateResponse{}) |
| |
| func (msg *directoryAdminMountAndCreateResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminMountAndCreateResponse |
| } |
| |
| type directoryAdminUnmountResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mdirectoryAdminUnmountResponse = _bindings.CreateLazyMarshaler(directoryAdminUnmountResponse{}) |
| |
| func (msg *directoryAdminUnmountResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminUnmountResponse |
| } |
| |
| type directoryAdminUnmountNodeResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| Remote DirectoryInterface |
| } |
| |
| var _mdirectoryAdminUnmountNodeResponse = _bindings.CreateLazyMarshaler(directoryAdminUnmountNodeResponse{}) |
| |
| func (msg *directoryAdminUnmountNodeResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminUnmountNodeResponse |
| } |
| |
| type directoryAdminQueryFilesystemResponse struct { |
| _ struct{} `fidl2:"s,16,0"` |
| S int32 |
| Info *FilesystemInfo |
| } |
| |
| var _mdirectoryAdminQueryFilesystemResponse = _bindings.CreateLazyMarshaler(directoryAdminQueryFilesystemResponse{}) |
| |
| func (msg *directoryAdminQueryFilesystemResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminQueryFilesystemResponse |
| } |
| |
| type directoryAdminGetDevicePathResponse struct { |
| _ struct{} `fidl2:"s,24,0"` |
| S int32 |
| Path *string `fidl:"4096" fidl2:"4096"` |
| } |
| |
| var _mdirectoryAdminGetDevicePathResponse = _bindings.CreateLazyMarshaler(directoryAdminGetDevicePathResponse{}) |
| |
| func (msg *directoryAdminGetDevicePathResponse) Marshaler() _bindings.Marshaler { |
| return _mdirectoryAdminGetDevicePathResponse |
| } |
| |
| 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` |
| // - `CLONE_FLAG_SAME_RIGHTS` |
| // |
| // All other flags are ignored. |
| // |
| // The `OPEN_RIGHT_*` bits in `flags` request corresponding rights over the resulting |
| // cloned object. |
| // The cloned object must have rights less than or equal to the original object. |
| // Alternatively, pass `CLONE_FLAG_SAME_RIGHTS` to inherit the rights on the source connection. |
| // It is invalid to pass any of the `OPEN_RIGHT_*` flags together with `CLONE_FLAG_SAME_RIGHTS`. |
| func (p *DirectoryAdminInterface) Clone(flags uint32, object NodeInterfaceRequest) error { |
| req_ := &directoryAdminCloneRequest{ |
| Flags: flags, |
| Object: object, |
| } |
| 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) { |
| var req_ _bindings.Message |
| 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) { |
| var req_ _bindings.Message |
| 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_) |
| return resp_.S, resp_.Info, err |
| } |
| |
| // Synchronizes updates to the node to the underlying media, if it exists. |
| // |
| // This method does not require any rights. |
| func (p *DirectoryAdminInterface) Sync() (int32, error) { |
| var req_ _bindings.Message |
| 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) { |
| var req_ _bindings.Message |
| 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`. |
| func (p *DirectoryAdminInterface) SetAttr(flags uint32, attributes NodeAttributes) (int32, error) { |
| req_ := &directoryAdminSetAttrRequest{ |
| Flags: flags, |
| Attributes: attributes, |
| } |
| 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{ |
| Opcode: opcode, |
| MaxOut: maxOut, |
| Handles: handles, |
| In: in, |
| } |
| resp_ := &directoryAdminIoctlResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminIoctlOrdinal, req_, resp_) |
| return resp_.S, resp_.Handles, resp_.Out, err |
| } |
| |
| // Opens a new object relative to this directory object. |
| // |
| // `path` may contain multiple segments, separated by "/" characters, |
| // and should never be empty i.e. "" is an invalid path. |
| // |
| // `flags` may be any of the `OPEN_FLAG_*` and `OPEN_RIGHT_*` values, bitwise ORed together. |
| // The `OPEN_FLAG_DESCRIBE` flag may cause an `OnOpen` event to be transmitted |
| // on the `object` handle, indicating the type of object opened. |
| // |
| // If an unknown value is sent for either flags or mode, the connection should |
| // be closed. |
| // |
| // `OPEN_RIGHTS_*` flags provided in `flags` will restrict access rights on the `object` channel |
| // which will be connected to the opened entity. |
| // |
| // Rights are never increased. When you open a nested entity within a directory, you may only |
| // request the same rights as what the directory connection already has, or a subset of those. |
| // Exceeding those rights causes an access denied error to be transmitted in the |
| // `OnOpen` event if applicable, and the `object` connection closed. |
| // |
| // The caller must specify either one or more of the `OPEN_RIGHT_*` flags, or |
| // the `OPEN_FLAG_NODE_REFERENCE` flag. |
| func (p *DirectoryAdminInterface) Open(flags uint32, mode uint32, path string, object NodeInterfaceRequest) error { |
| req_ := &directoryAdminOpenRequest{ |
| Flags: flags, |
| Mode: mode, |
| Path: path, |
| Object: object, |
| } |
| err := ((*_bindings.ChannelProxy)(p)).Send(DirectoryAdminOpenOrdinal, req_) |
| return err |
| } |
| |
| // Detaches an object from this directory object. |
| // |
| // The underlying object may or may not be deleted after this method |
| // completes: although the link will be removed from the containing directory, |
| // objects with multiple references (such as files which are still open) |
| // will not actually be destroyed until all references are removed. |
| // |
| // If a directory is unlinked while it still has an open reference, |
| // it must become read-only, preventing new entries from being created |
| // until all references close and the directory is destroyed. |
| // |
| // `path` identifies the file which should be detached. |
| // If `path` contains multiple segments, separated by "/" characters, |
| // then the directory is traversed, one segment at a time, relative to the |
| // originally accessed Directory. |
| // |
| // Returns: |
| // `ZX_ERR_ACCESS_DENIED` if the connection (or the underlying filesystem) does not |
| // allow writable access. |
| // `ZX_ERR_INVALID_ARGS` if `path` contains ".." segments. |
| // `ZX_ERR_NOT_EMPTY` if `path` refers to a non-empty directory. |
| // `ZX_ERR_UNAVAILABLE` if `path` refers to a mount point, containing a remote channel. |
| // `ZX_ERR_UNAVAILABLE` if `path` is ".". |
| // |
| // Other errors may be returned for filesystem-specific reasons. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| func (p *DirectoryAdminInterface) Unlink(path string) (int32, error) { |
| req_ := &directoryAdminUnlinkRequest{ |
| Path: path, |
| } |
| 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]; |
| // } |
| // |
| // This method does not require any rights, since one could always probe for |
| // directory contents by triggering name conflicts during file creation. |
| func (p *DirectoryAdminInterface) ReadDirents(maxBytes uint64) (int32, []uint8, error) { |
| req_ := &directoryAdminReadDirentsRequest{ |
| MaxBytes: maxBytes, |
| } |
| resp_ := &directoryAdminReadDirentsResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminReadDirentsOrdinal, req_, resp_) |
| return resp_.S, resp_.Dirents, err |
| } |
| |
| // Resets the directory seek offset. |
| // |
| // This method does not require any rights, similar to ReadDirents. |
| func (p *DirectoryAdminInterface) Rewind() (int32, error) { |
| var req_ _bindings.Message |
| resp_ := &directoryAdminRewindResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminRewindOrdinal, req_, resp_) |
| return resp_.S, err |
| } |
| |
| // Acquires a token to a Directory which can be used to identify |
| // access to it at a later point in time. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| func (p *DirectoryAdminInterface) GetToken() (int32, _zx.Handle, error) { |
| var req_ _bindings.Message |
| resp_ := &directoryAdminGetTokenResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminGetTokenOrdinal, req_, resp_) |
| return resp_.S, resp_.Token, err |
| } |
| |
| // Renames an object named src to the name dst, in a directory represented by token. |
| // |
| // `src/dst` must be resolved object names. Including "/" in any position |
| // other than the end of the string will return `ZX_ERR_INVALID_ARGS`. |
| // Returning "/" at the end of either string implies that it must be a |
| // directory, or else `ZX_ERR_NOT_DIR` should be returned. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| func (p *DirectoryAdminInterface) Rename(src string, dstParentToken _zx.Handle, dst string) (int32, error) { |
| req_ := &directoryAdminRenameRequest{ |
| Src: src, |
| DstParentToken: dstParentToken, |
| Dst: dst, |
| } |
| resp_ := &directoryAdminRenameResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(DirectoryAdminRenameOrdinal, req_, resp_) |
| return resp_.S, err |
| } |
| |
| // Creates a link to an object named src by the name dst, within a directory represented by |
| // token. |
| // |
| // `src` must be a resolved object name. Including "/" in the string will |
| // return `ZX_ERR_INVALID_ARGS`. |
| // |
| // `dst` must be a resolved object name. Including "/" in the string will |
| // return `ZX_ERR_INVALID_ARGS`. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| func (p *DirectoryAdminInterface) Link(src string, dstParentToken _zx.Handle, dst string) (int32, error) { |
| req_ := &directoryAdminLinkRequest{ |
| Src: src, |
| DstParentToken: dstParentToken, |
| Dst: dst, |
| } |
| 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. |
| // |
| // This method does not require any rights, similar to ReadDirents. |
| func (p *DirectoryAdminInterface) Watch(mask uint32, options uint32, watcher _zx.Channel) (int32, error) { |
| req_ := &directoryAdminWatchRequest{ |
| Mask: mask, |
| Options: options, |
| Watcher: watcher, |
| } |
| 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{ |
| Remote: remote, |
| } |
| 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{ |
| Remote: remote, |
| Name: name, |
| Flags: flags, |
| } |
| 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) { |
| var req_ _bindings.Message |
| 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) { |
| var req_ _bindings.Message |
| 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) { |
| var req_ _bindings.Message |
| 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) { |
| var req_ _bindings.Message |
| 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` |
| // - `CLONE_FLAG_SAME_RIGHTS` |
| // |
| // All other flags are ignored. |
| // |
| // The `OPEN_RIGHT_*` bits in `flags` request corresponding rights over the resulting |
| // cloned object. |
| // The cloned object must have rights less than or equal to the original object. |
| // Alternatively, pass `CLONE_FLAG_SAME_RIGHTS` to inherit the rights on the source connection. |
| // It is invalid to pass any of the `OPEN_RIGHT_*` flags together with `CLONE_FLAG_SAME_RIGHTS`. |
| 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. |
| // |
| // This method does not require any rights. |
| 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`. |
| 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) |
| // Opens a new object relative to this directory object. |
| // |
| // `path` may contain multiple segments, separated by "/" characters, |
| // and should never be empty i.e. "" is an invalid path. |
| // |
| // `flags` may be any of the `OPEN_FLAG_*` and `OPEN_RIGHT_*` values, bitwise ORed together. |
| // The `OPEN_FLAG_DESCRIBE` flag may cause an `OnOpen` event to be transmitted |
| // on the `object` handle, indicating the type of object opened. |
| // |
| // If an unknown value is sent for either flags or mode, the connection should |
| // be closed. |
| // |
| // `OPEN_RIGHTS_*` flags provided in `flags` will restrict access rights on the `object` channel |
| // which will be connected to the opened entity. |
| // |
| // Rights are never increased. When you open a nested entity within a directory, you may only |
| // request the same rights as what the directory connection already has, or a subset of those. |
| // Exceeding those rights causes an access denied error to be transmitted in the |
| // `OnOpen` event if applicable, and the `object` connection closed. |
| // |
| // The caller must specify either one or more of the `OPEN_RIGHT_*` flags, or |
| // the `OPEN_FLAG_NODE_REFERENCE` flag. |
| Open(flags uint32, mode uint32, path string, object NodeInterfaceRequest) error |
| // Detaches an object from this directory object. |
| // |
| // The underlying object may or may not be deleted after this method |
| // completes: although the link will be removed from the containing directory, |
| // objects with multiple references (such as files which are still open) |
| // will not actually be destroyed until all references are removed. |
| // |
| // If a directory is unlinked while it still has an open reference, |
| // it must become read-only, preventing new entries from being created |
| // until all references close and the directory is destroyed. |
| // |
| // `path` identifies the file which should be detached. |
| // If `path` contains multiple segments, separated by "/" characters, |
| // then the directory is traversed, one segment at a time, relative to the |
| // originally accessed Directory. |
| // |
| // Returns: |
| // `ZX_ERR_ACCESS_DENIED` if the connection (or the underlying filesystem) does not |
| // allow writable access. |
| // `ZX_ERR_INVALID_ARGS` if `path` contains ".." segments. |
| // `ZX_ERR_NOT_EMPTY` if `path` refers to a non-empty directory. |
| // `ZX_ERR_UNAVAILABLE` if `path` refers to a mount point, containing a remote channel. |
| // `ZX_ERR_UNAVAILABLE` if `path` is ".". |
| // |
| // Other errors may be returned for filesystem-specific reasons. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| 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]; |
| // } |
| // |
| // This method does not require any rights, since one could always probe for |
| // directory contents by triggering name conflicts during file creation. |
| ReadDirents(maxBytes uint64) (int32, []uint8, error) |
| // Resets the directory seek offset. |
| // |
| // This method does not require any rights, similar to ReadDirents. |
| Rewind() (int32, error) |
| // Acquires a token to a Directory which can be used to identify |
| // access to it at a later point in time. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| GetToken() (int32, _zx.Handle, error) |
| // Renames an object named src to the name dst, in a directory represented by token. |
| // |
| // `src/dst` must be resolved object names. Including "/" in any position |
| // other than the end of the string will return `ZX_ERR_INVALID_ARGS`. |
| // Returning "/" at the end of either string implies that it must be a |
| // directory, or else `ZX_ERR_NOT_DIR` should be returned. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| Rename(src string, dstParentToken _zx.Handle, dst string) (int32, error) |
| // Creates a link to an object named src by the name dst, within a directory represented by |
| // token. |
| // |
| // `src` must be a resolved object name. Including "/" in the string will |
| // return `ZX_ERR_INVALID_ARGS`. |
| // |
| // `dst` must be a resolved object name. Including "/" in the string will |
| // return `ZX_ERR_INVALID_ARGS`. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| 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. |
| // |
| // This method does not require any rights, similar to ReadDirents. |
| 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) |
| } |
| |
| type DirectoryAdminTransitionalBase struct{} |
| |
| type DirectoryAdminInterfaceRequest _bindings.InterfaceRequest |
| |
| func NewDirectoryAdminInterfaceRequest() (DirectoryAdminInterfaceRequest, *DirectoryAdminInterface, error) { |
| req, cli, err := _bindings.NewInterfaceRequest() |
| return DirectoryAdminInterfaceRequest(req), (*DirectoryAdminInterface)(cli), err |
| } |
| |
| type DirectoryAdminStub struct { |
| Impl DirectoryAdmin |
| } |
| |
| func (s_ *DirectoryAdminStub) DispatchImpl(ordinal_ uint64, data_ []byte, handles_ []_zx.Handle) (_bindings.Message, bool, error) { |
| switch ordinal_ { |
| case DirectoryAdminCloneOrdinal: |
| in_ := directoryAdminCloneRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| err_ := s_.Impl.Clone(in_.Flags, in_.Object) |
| return nil, false, err_ |
| case DirectoryAdminCloseOrdinal: |
| s, err_ := s_.Impl.Close() |
| out_ := directoryAdminCloseResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryAdminDescribeOrdinal: |
| info, err_ := s_.Impl.Describe() |
| out_ := directoryAdminDescribeResponse{} |
| out_.Info = info |
| return &out_, true, err_ |
| case DirectoryAdminSyncOrdinal: |
| s, err_ := s_.Impl.Sync() |
| out_ := directoryAdminSyncResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryAdminGetAttrOrdinal: |
| s, attributes, err_ := s_.Impl.GetAttr() |
| out_ := directoryAdminGetAttrResponse{} |
| out_.S = s |
| out_.Attributes = attributes |
| return &out_, true, err_ |
| case DirectoryAdminSetAttrOrdinal: |
| in_ := directoryAdminSetAttrRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.SetAttr(in_.Flags, in_.Attributes) |
| out_ := directoryAdminSetAttrResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryAdminIoctlOrdinal: |
| in_ := directoryAdminIoctlRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| 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 |
| return &out_, true, err_ |
| case DirectoryAdminOpenOrdinal: |
| in_ := directoryAdminOpenRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| err_ := s_.Impl.Open(in_.Flags, in_.Mode, in_.Path, in_.Object) |
| return nil, false, err_ |
| case DirectoryAdminUnlinkOrdinal: |
| in_ := directoryAdminUnlinkRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.Unlink(in_.Path) |
| out_ := directoryAdminUnlinkResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryAdminReadDirentsOrdinal: |
| in_ := directoryAdminReadDirentsRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, dirents, err_ := s_.Impl.ReadDirents(in_.MaxBytes) |
| out_ := directoryAdminReadDirentsResponse{} |
| out_.S = s |
| out_.Dirents = dirents |
| return &out_, true, err_ |
| case DirectoryAdminRewindOrdinal: |
| s, err_ := s_.Impl.Rewind() |
| out_ := directoryAdminRewindResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryAdminGetTokenOrdinal: |
| s, token, err_ := s_.Impl.GetToken() |
| out_ := directoryAdminGetTokenResponse{} |
| out_.S = s |
| out_.Token = token |
| return &out_, true, err_ |
| case DirectoryAdminRenameOrdinal: |
| in_ := directoryAdminRenameRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.Rename(in_.Src, in_.DstParentToken, in_.Dst) |
| out_ := directoryAdminRenameResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryAdminLinkOrdinal: |
| in_ := directoryAdminLinkRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.Link(in_.Src, in_.DstParentToken, in_.Dst) |
| out_ := directoryAdminLinkResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryAdminWatchOrdinal: |
| in_ := directoryAdminWatchRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.Watch(in_.Mask, in_.Options, in_.Watcher) |
| out_ := directoryAdminWatchResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryAdminMountOrdinal: |
| in_ := directoryAdminMountRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.Mount(in_.Remote) |
| out_ := directoryAdminMountResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryAdminMountAndCreateOrdinal: |
| in_ := directoryAdminMountAndCreateRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, false, err_ |
| } |
| s, err_ := s_.Impl.MountAndCreate(in_.Remote, in_.Name, in_.Flags) |
| out_ := directoryAdminMountAndCreateResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryAdminUnmountOrdinal: |
| s, err_ := s_.Impl.Unmount() |
| out_ := directoryAdminUnmountResponse{} |
| out_.S = s |
| return &out_, true, err_ |
| case DirectoryAdminUnmountNodeOrdinal: |
| s, remote, err_ := s_.Impl.UnmountNode() |
| out_ := directoryAdminUnmountNodeResponse{} |
| out_.S = s |
| out_.Remote = remote |
| return &out_, true, err_ |
| case DirectoryAdminQueryFilesystemOrdinal: |
| s, info, err_ := s_.Impl.QueryFilesystem() |
| out_ := directoryAdminQueryFilesystemResponse{} |
| out_.S = s |
| out_.Info = info |
| return &out_, true, err_ |
| case DirectoryAdminGetDevicePathOrdinal: |
| s, path, err_ := s_.Impl.GetDevicePath() |
| out_ := directoryAdminGetDevicePathResponse{} |
| out_.S = s |
| out_.Path = path |
| return &out_, true, err_ |
| } |
| return nil, false, _bindings.ErrUnknownOrdinal |
| } |
| |
| type DirectoryAdminService struct { |
| _bindings.BindingSet |
| } |
| |
| func (s *DirectoryAdminService) Add(impl DirectoryAdmin, c _zx.Channel, onError func(error)) (_bindings.BindingKey, error) { |
| return s.BindingSet.Add(&DirectoryAdminStub{Impl: impl}, c, onError) |
| } |
| |
| func (s *DirectoryAdminService) EventProxyFor(key _bindings.BindingKey) (*DirectoryAdminEventProxy, bool) { |
| pxy, err := s.BindingSet.ProxyFor(key) |
| return (*DirectoryAdminEventProxy)(pxy), err |
| } |
| |
| type DirectoryAdminEventProxy _bindings.ChannelProxy |
| |
| func (p *DirectoryAdminEventProxy) OnOpen(s int32, info *NodeInfo) error { |
| event_ := &directoryAdminOnOpenResponse{ |
| S: s, |
| Info: info, |
| } |
| return ((*_bindings.ChannelProxy)(p)).Send(DirectoryAdminOnOpenOrdinal, event_) |
| } |