| // Copyright 2019 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. |
| library fuchsia.fshost; |
| |
| using zx; |
| using fuchsia.hardware.block; |
| using fuchsia.io; |
| |
| /// Manages the block watcher. |
| @discoverable |
| protocol BlockWatcher { |
| /// Pauses the block watcher. This causes the block watcher to drop all |
| /// new block device events. |
| /// Returns ZX_ERR_UNAVAILABLE if the watcher has been paused too many times. |
| Pause() -> (struct { |
| status zx.status; |
| }); |
| |
| /// Resumes the block watcher. The block watcher won't resume until every |
| /// Pause() call has had a corresponding Resume(). |
| /// Returns ZX_ERR_BAD_STATE if the watcher isn't paused. |
| Resume() -> (struct { |
| status zx.status; |
| }); |
| }; |
| |
| type MountOptions = resource table { |
| 1: read_only bool; |
| 2: collect_metrics bool; |
| 3: verbose bool; |
| 4: write_compression_algorithm string:32; |
| }; |
| |
| /// Manages fshost lifecycle |
| @discoverable |
| protocol Admin { |
| /// Causes fshost to unmount all filesystems and exit. Fshost has |
| /// successfully unmounted all filesystems when this function returns, and |
| /// exits immediately after writing the response to this function. |
| // TODO(fxbug.dev/43186): replace with the component manager shutdown API once it |
| // becomes available. |
| Shutdown() -> (); |
| |
| /// Mounts the filesystem on the block device. The filesystem will be mounted in /fs/mnt/<name> |
| /// (in fshost's outgoing directory). This may or may not be supported depending on fshost |
| /// configuration. |
| Mount(resource struct { |
| device client_end:fuchsia.hardware.block.Block; |
| name string:fuchsia.io.MAX_FILENAME; |
| options MountOptions; |
| }) -> (struct {}) error zx.status; |
| |
| /// Unmounts a previously mounted filesystem. |
| Unmount(struct { |
| name string:fuchsia.io.MAX_FILENAME; |
| }) -> (struct {}) error zx.status; |
| |
| /// Returns the device path for the filesystem with the given fs_id. |
| GetDevicePath(struct { |
| fs_id uint64; |
| }) -> (struct { |
| path string:fuchsia.io.MAX_PATH; |
| }) error zx.status; |
| }; |