blob: f7016bc7241f776b795106dbd31d73b54cb6b791 [file] [log] [blame]
// Copyright 2020 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.
#include <lib/async-loop/default.h>
#include <lib/zx/channel.h>
#include <lib/zx/resource.h>
#include <block-client/cpp/block-device.h>
#include <fbl/function.h>
namespace factoryfs {
using block_client::BlockDevice;
// Determines the kind of directory layout the filesystem server should expose to the outside world.
// TODO( When all users migrate to the export directory, delete this enum, since only
// |kExportDirectory| would be used.
enum class ServeLayout {
// The root of the filesystem is exposed directly
// Expose a pseudo-directory with the filesystem root located at "/root".
// TODO( Also expose an administration service under "/svc/fuchsia.fs.Admin".
// Toggles that may be set on factoryfs during initialization.
struct MountOptions {
bool verbose = false;
bool metrics = false; // TODO(manalib)
// Begins serving requests to the filesystem by parsing the on-disk format using |device|. If
// |ServeLayout| is |kDataRootOnly|, |root| serves the root of the filesystem. If it's
// |kExportDirectory|, |root| serves an outgoing directory.
// This function blocks until the filesystem terminates.
zx_status_t Mount(std::unique_ptr<BlockDevice> device, MountOptions* options, zx::channel root,
ServeLayout layout);
} // namespace factoryfs