blob: 8338f04045dbbee63d4a519f143551a9baef207b [file] [log] [blame]
# 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.
import("//build/components/fuchsia_component.gni")
import("//build/components/fuchsia_structured_config.gni")
import("//build/cpp/sdk_source_set.gni")
import("//build/zircon/zx_library.gni")
# The in-memory filesystem implementation.
#
# Most users will want to consume the shared library rather than statically linking this
# implementation. To do that, either use the "memfs" target (C) or the "cpp" target (C++).
static_library("lib") {
output_name = "memfs_lib"
public = [
"memfs.h",
"vnode.h",
"vnode_dir.h",
"vnode_file.h",
"vnode_vmo.h",
]
sources = [
"dnode.cc",
"include/lib/memfs/memfs.h",
"memfs.cc",
"vnode.cc",
"vnode_dir.cc",
"vnode_file.cc",
"vnode_vmo.cc",
]
public_deps = [
# <memfs.h> has #include "src/lib/storage/vfs/*.h"
"//src/lib/storage/vfs/cpp",
"//zircon/system/ulib/async-loop:async-loop-cpp",
]
deps = [
"//sdk/fidl/fuchsia.io:fuchsia.io_cpp_wire",
"//sdk/lib/syslog/cpp",
"//zircon/system/ulib/async",
"//zircon/system/ulib/async:async-cpp",
"//zircon/system/ulib/sync",
"//zircon/third_party/ulib/safemath",
]
}
# libmemfs.so: The C ABI client library.
#
# Used to create local temporary filesystems.
zx_library("memfs") {
sdk = "shared"
sdk_publishable = true
sdk_headers = [ "lib/memfs/memfs.h" ]
sources = [ "memfs_api.cc" ]
public_deps = [
# <lib/memfs/memfs.h> has #include <lib/async/dispatcher.h>.
"//zircon/system/ulib/async",
# <lib/memfs/memfs.h> has #include <lib/sync/completion.h>.
"//zircon/system/ulib/sync",
]
deps = [
":lib",
"//sdk/lib/fdio",
"//src/lib/storage/vfs/cpp",
"//zircon/system/ulib/fbl",
]
runtime_deps = [
"//sdk/lib/fdio:fdio_sdk",
"//zircon/system/ulib/trace-engine:trace-engine_sdk",
]
}
# A C++ wrapper around the C "memfs" shared library that handles setup and tear-down.
source_set("cpp") {
public = [ "scoped_memfs.h" ]
public_deps = [ ":memfs" ]
}
fuchsia_component_manifest("manifest") {
component_name = "memfs"
manifest = "meta/memfs.cml"
}
fuchsia_structured_config_cpp_elf_lib("memfs_config") {
cm_label = ":manifest"
}
executable("memfs_bin") {
output_name = "memfs"
sources = [ "component.cc" ]
deps = [
":lib",
":memfs_config",
"//sdk/lib/syslog/cpp",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
]
}
fuchsia_structured_config_values("default_config") {
cm_label = ":manifest"
values = {
# 512 MiB
max_file_size = 536870912
}
}
fuchsia_component("memfs_component_only") {
cm_label = ":manifest"
deps = [ ":memfs_bin" ]
}
group("memfs_component") {
deps = [
":default_config",
":memfs_component_only",
]
}
group("tests") {
testonly = true
deps = [ "test:tests" ]
}