| # 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") |
| import("//build/fidl/fidl.gni") |
| |
| declare_args() { |
| # TODO(bcastell): Streaming writes is now enabled by default. Remove this argument when out of |
| # tree users don't set this anymore. |
| blobfs_enable_streaming_writes = true |
| |
| # Set this to true when configuring gn args to enable blobfs page-in metrics recording. This will |
| # also increase the inspect VMO size for blobfs to 2 MiB, to accommodate the large number of |
| # metrics entries. |
| blobfs_page_in_metrics_recording = false |
| } |
| |
| static_library("blobfs") { |
| friend = [ |
| ":decompressor_impl", |
| "test:*", |
| "test/integration:*", |
| ] |
| visibility = [ |
| "//src/security/lib/scrutiny/utils/*", |
| "//src/storage/*", |
| ] |
| public = [ |
| "blob_layout.h", |
| "blobfs_inspector.h", |
| "cache_policy.h", |
| "common.h", |
| "delivery_blob.h", |
| "format.h", |
| "fsck.h", |
| "fsck_host.h", |
| "host.h", |
| "iterator/node_populator.h", |
| "mkfs.h", |
| "mount.h", |
| "node_finder.h", |
| ] |
| sources = [ |
| "allocator/base_allocator.cc", |
| "allocator/base_allocator.h", |
| "allocator/extent_reserver.cc", |
| "allocator/extent_reserver.h", |
| "allocator/node_reserver.cc", |
| "allocator/node_reserver.h", |
| "blob_layout.cc", |
| "blobfs_checker.cc", |
| "common.cc", |
| "compression/chunked.cc", |
| "compression/chunked.h", |
| "compression/compressor.h", |
| "compression/decompressor.cc", |
| "compression/decompressor.h", |
| "compression/seekable_decompressor.h", |
| "compression_settings.cc", |
| "delivery_blob.cc", |
| "inspector/blobfs_inspector.cc", |
| "inspector/parser.cc", |
| "inspector/parser.h", |
| "iterator/allocated_extent_iterator.cc", |
| "iterator/allocated_extent_iterator.h", |
| "iterator/allocated_node_iterator.cc", |
| "iterator/allocated_node_iterator.h", |
| "iterator/block_iterator.cc", |
| "iterator/block_iterator.h", |
| "iterator/block_iterator_provider.h", |
| "iterator/extent_iterator.h", |
| "iterator/node_populator.cc", |
| "iterator/vector_extent_iterator.cc", |
| "iterator/vector_extent_iterator.h", |
| "trace.h", |
| ] |
| public_deps = [ |
| # format.h includes digest.h. |
| "//sdk/fidl/fuchsia.fs:fuchsia.fs_hlcpp", |
| "//sdk/lib/fit", |
| "//sdk/lib/fit-promise", |
| "//src/lib/digest", |
| "//src/storage/lib/vfs/cpp", |
| "//src/storage/lib/vfs/cpp/journal", |
| "//src/storage/lib/vfs/cpp/transaction", |
| "//src/storage/lib/watchdog", |
| "//zircon/system/ulib/bitmap", |
| "//zircon/system/ulib/id_allocator", |
| "//zircon/system/ulib/range", |
| "//zircon/system/ulib/storage/buffer", |
| "//zircon/system/ulib/zx", |
| "//zircon/third_party/ulib/safemath", |
| ] |
| deps = [ |
| "compression/configs", |
| "//sdk/lib/fit", |
| "//sdk/lib/syslog/cpp", |
| "//src/lib/chunked-compression", |
| "//src/lib/digest", |
| "//src/storage/fvm", |
| "//src/storage/lib/disk_inspector", |
| "//src/storage/lib/vfs/cpp/journal", |
| "//src/storage/lib/vfs/cpp/transaction", |
| "//zircon/system/ulib/bitmap", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/range", |
| "//zircon/system/ulib/storage/buffer", |
| "//zircon/system/ulib/storage/operation", |
| "//zircon/system/ulib/zx", |
| "//zircon/third_party/ulib/cksum", |
| ] |
| if (is_fuchsia) { |
| sources += [ |
| "allocator/allocator.cc", |
| "blob.cc", |
| "blob_cache.cc", |
| "blob_data_producer.cc", |
| "blob_data_producer.h", |
| "blob_loader.cc", |
| "blob_verifier.cc", |
| "blob_verifier.h", |
| "blob_writer.cc", |
| "blobfs.cc", |
| "blobfs_inspect_tree.cc", |
| "blobfs_inspect_tree.h", |
| "blobfs_metrics.cc", |
| "blobfs_metrics.h", |
| "cache_node.cc", |
| "component_runner.cc", |
| "compression/blob_compressor.cc", |
| "compression/external_decompressor.cc", |
| "compression/streaming_chunked_decompressor.cc", |
| "directory.cc", |
| "format.cc", |
| "fsck.cc", |
| "loader_info.h", |
| "metrics/compression_metrics.cc", |
| "metrics/compression_metrics.h", |
| "metrics/fragmentation_metrics.cc", |
| "metrics/fragmentation_metrics.h", |
| "metrics/read_metrics.cc", |
| "metrics/read_metrics.h", |
| "metrics/verification_metrics.cc", |
| "metrics/verification_metrics.h", |
| "mount.cc", |
| "page_loader.cc", |
| "page_loader.h", |
| "service/admin.cc", |
| "service/admin.h", |
| "service/health_check.cc", |
| "service/health_check.h", |
| "service/lifecycle.cc", |
| "service/lifecycle.h", |
| "service/startup.cc", |
| "service/startup.h", |
| "transaction.cc", |
| "transfer_buffer.cc", |
| "transfer_buffer.h", |
| ] |
| public_deps += [ |
| ":fuchsia.blobfs.internal_cpp", |
| ":fuchsia.blobfs.internal_hlcpp", |
| "//sdk/fidl/fuchsia.device.manager:fuchsia.device.manager_cpp", |
| "//sdk/fidl/fuchsia.fs:fuchsia.fs_cpp", |
| "//sdk/fidl/fuchsia.process.lifecycle:fuchsia.process.lifecycle_cpp", |
| "//sdk/lib/inspect/component/cpp", |
| "//src/storage/fidl/fuchsia.fs.startup:fuchsia.fs.startup_cpp", |
| "//src/storage/lib/block_client/cpp", |
| "//src/storage/lib/vfs/cpp/inspect", |
| "//src/sys/pkg/fidl/fuchsia.update.verify:fuchsia.update.verify_cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| ] |
| deps += [ |
| "//sdk/fidl/fuchsia.io:fuchsia.io_cpp", |
| "//sdk/lib/component/incoming/cpp", |
| "//sdk/lib/fdio", |
| "//sdk/lib/scheduler/cpp", |
| "//sdk/lib/syslog/cpp", |
| "//src/lib/debug:backtrace-request", |
| "//src/storage/lib/block_client/cpp", |
| "//zircon/system/ulib/async", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/async-default", |
| "//zircon/system/ulib/async-loop", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/sync", |
| "//zircon/system/ulib/trace", |
| "//zircon/system/ulib/trace-engine", |
| "//zircon/system/ulib/trace-provider", |
| "//zircon/system/ulib/zx", |
| ] |
| } else { |
| sources += [ |
| "allocator/host_allocator.cc", |
| "allocator/host_allocator.h", |
| "fsck_host.cc", |
| "host.cc", |
| ] |
| deps += [ "//src/storage/lib/host" ] |
| } |
| |
| defines = [] |
| |
| if (blobfs_page_in_metrics_recording) { |
| defines += [ |
| # Enable blobfs page-in metrics. |
| "BLOBFS_ENABLE_PAGE_IN_METRICS", |
| |
| # The page-in metrics feature requires a large Inspect VMO (>512KB) for blobfs. |
| "BLOBFS_ENABLE_LARGE_INSPECT_VMO", |
| ] |
| } |
| } |
| |
| fidl("fuchsia.blobfs.internal") { |
| sources = [ "compression/decompressor_sandbox/decompressor.fidl" ] |
| public_deps = [ "//zircon/vdso/zx" ] |
| enable_hlcpp = true |
| } |
| |
| source_set("decompressor_impl") { |
| visibility = [ "./*" ] |
| sources = [ |
| "compression/decompressor_sandbox/decompressor_impl.cc", |
| "compression/decompressor_sandbox/decompressor_impl.h", |
| ] |
| public_deps = [ |
| # Used by decompressor_impl.h |
| ":fuchsia.blobfs.internal_cpp", |
| ] |
| deps = [ |
| ":blobfs", |
| ":fuchsia.blobfs.internal_hlcpp", |
| "//sdk/lib/component/incoming/cpp", |
| "//sdk/lib/fidl/cpp:cpp", |
| "//sdk/lib/scheduler/cpp", |
| "//sdk/lib/sys/cpp:cpp", |
| "//sdk/lib/syslog/cpp", |
| "//src/lib/chunked-compression", |
| "//src/lib/digest", |
| "//src/storage/lib/vfs/cpp/journal", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/trace", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| |
| executable("decompressor") { |
| visibility = [ ":*" ] |
| sources = [ "compression/decompressor_sandbox/main.cc" ] |
| deps = [ |
| ":decompressor_impl", |
| ":fuchsia.blobfs.internal_hlcpp", |
| "//sdk/lib/fidl/cpp:cpp", |
| "//sdk/lib/sys/cpp:cpp", |
| "//sdk/lib/syslog/cpp", |
| "//src/lib/digest", |
| "//src/storage/lib/vfs/cpp/journal", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/trace", |
| "//zircon/system/ulib/trace-provider", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| |
| fuchsia_component("decompressor-sandbox") { |
| visibility = [ |
| ":*", |
| "//src/storage/blobfs/bin", |
| "//src/storage/fshost:*", |
| ] |
| manifest = "meta/decompressor_sandbox.cml" |
| deps = [ ":decompressor" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| "bin:tests", |
| "test", |
| ] |
| } |