| # 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.gni") |
| |
| # The in-memory filesystem implementation. |
| static_library("lib") { |
| public = [ |
| "memfs.h", |
| "vnode.h", |
| "vnode_dir.h", |
| "vnode_file.h", |
| "vnode_vmo.h", |
| ] |
| sources = [ |
| "dnode.cc", |
| "memfs.cc", |
| "vnode.cc", |
| "vnode_dir.cc", |
| "vnode_file.cc", |
| "vnode_vmo.cc", |
| ] |
| |
| public_deps = [ |
| # <memfs.h> has #include "src/storage/lib/vfs/*.h" |
| "//src/storage/lib/vfs/cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| ] |
| deps = [ |
| "//sdk/lib/syslog/cpp", |
| "//zircon/system/ulib/async", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/sync", |
| "//zircon/third_party/ulib/safemath", |
| ] |
| |
| # TODO(https://fxbug.dev/293618742): Remove uses of memfs as a library. Tests should use /tmp in |
| # tests instead of running their own memfs instances. |
| visibility = [ |
| ":*", |
| "//src/developer/vsock-sshd-host/*", |
| "//src/lib/loader_service:loader_service_test_fixture", |
| "//src/storage/conformance/conformance_harness/memfs:bin", |
| "//src/storage/memfs/test/*", |
| "//src/sys/component_manager/tests/rights:expose_dir_rights_bin", |
| "//src/sys/component_manager/tests/security_policy/capability_allowlist:dir_service_bin", |
| "//zircon/system/ulib/fdio-caller/test:fdio-caller", |
| ] |
| } |
| |
| # A C++ wrapper around ":lib" that handles setup and tear-down. |
| source_set("cpp") { |
| public = [ "mounted_memfs.h" ] |
| sources = [ "mounted_memfs.cc" ] |
| |
| deps = [ "//sdk/fidl/fuchsia.io:fuchsia.io_cpp" ] |
| |
| public_deps = [ |
| ":lib", |
| "//zircon/system/ulib/zx", |
| ] |
| |
| # TODO(https://fxbug.dev/293618742): Remove uses of memfs as a library. Tests should use /tmp in |
| # tests instead of running their own memfs instances. |
| visibility = [ |
| ":*", |
| "//sdk/lib/fdio/tests:fdio-test", |
| "//src/developer/forensics/testing:scoped_memfs_manager", |
| "//src/developer/memory/monitor/tests:memory_monitor_unittests", |
| "//src/storage/lib/vfs/cpp:fs-connection-test", |
| "//src/storage/memfs/test/*", |
| "//src/virtualization/bin/termina_guest_manager:termina_guest_manager_unittests", |
| ] |
| } |
| |
| executable("memfs_bin") { |
| output_name = "memfs" |
| sources = [ "component.cc" ] |
| deps = [ |
| ":lib", |
| "//sdk/lib/scheduler/cpp", |
| "//sdk/lib/syslog/cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| ] |
| } |
| |
| fuchsia_component("memfs_component") { |
| manifest = "meta/memfs.cml" |
| component_name = "memfs" |
| deps = [ ":memfs_bin" ] |
| } |
| |
| fuchsia_package("package") { |
| package_name = "memfs" |
| deps = [ ":memfs_component" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ "test:tests" ] |
| } |