| # 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/fidl/fidl.gni") |
| import("//src/sys/build/components.gni") |
| |
| declare_args() { |
| # 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:*", |
| ] |
| visibility = [ |
| "//src/storage/*", |
| "//zircon/system/ulib/fvm-host", |
| "//zircon/system/utest/blobfs-bench", |
| "//zircon/system/utest/fs-management", |
| "//zircon/system/utest/fs-test-utils", |
| "//zircon/system/utest/fvm", |
| "//zircon/tools/blobfs", |
| ] |
| public = [ |
| "blob-layout.h", |
| "blobfs_inspector.h", |
| "cache-policy.h", |
| "common.h", |
| "format.h", |
| "fsck-host.h", |
| "fsck.h", |
| "host.h", |
| "mkfs.h", |
| "mount.h", |
| "node-finder.h", |
| ] |
| sources = [ |
| "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-settings.cc", |
| "compression/chunked.cc", |
| "compression/chunked.h", |
| "compression/compressor.h", |
| "compression/decompressor.cc", |
| "compression/decompressor.h", |
| "compression/lz4.cc", |
| "compression/lz4.h", |
| "compression/seekable-decompressor.h", |
| "compression/zstd-plain.cc", |
| "compression/zstd-plain.h", |
| "compression/zstd-seekable.cc", |
| "compression/zstd-seekable.h", |
| "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-provider.h", |
| "iterator/block-iterator.cc", |
| "iterator/block-iterator.h", |
| "iterator/extent-iterator.h", |
| "iterator/vector-extent-iterator.cc", |
| "iterator/vector-extent-iterator.h", |
| ] |
| public_deps = [ |
| "//src/storage/lib/watchdog", |
| "//zircon/public/lib/bitmap", |
| "//zircon/public/lib/fit", |
| "//zircon/public/lib/zxc", |
| "//zircon/system/ulib/fs", |
| "//zircon/system/ulib/fs/journal", |
| "//zircon/system/ulib/fs/transaction", |
| "//zircon/system/ulib/range", |
| "//zircon/system/ulib/storage/buffer", |
| |
| # format.h has #include <digest/digest.h>. |
| "//zircon/system/ulib/digest", |
| |
| # Seekable zstd include_dirs config required for all compilation units that incorporate it. |
| # TODO(fxbug.dev/57392): Move it back to //third_party once unification completes. |
| "//zircon/third_party/ulib/zstd:zstdseek", |
| ] |
| deps = [ |
| "//src/lib/chunked-compression", |
| "//src/storage/fvm", |
| "//third_party/boringssl", |
| "//zircon/public/lib/bitmap", |
| "//zircon/public/lib/cksum", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/fit", |
| "//zircon/public/lib/lz4", |
| "//zircon/public/lib/safemath", |
| "//zircon/public/lib/zircon-internal", |
| "//zircon/public/lib/zxc", |
| "//zircon/system/ulib/digest", |
| "//zircon/system/ulib/disk_inspector", |
| "//zircon/system/ulib/fs/journal", |
| "//zircon/system/ulib/fs/transaction", |
| "//zircon/system/ulib/range", |
| "//zircon/system/ulib/storage/buffer", |
| "//zircon/system/ulib/storage/operation", |
| |
| # TODO(fxbug.dev/57392): Move it back to //third_party once unification completes. |
| "//sdk/lib/syslog/cpp", |
| "//zircon/third_party/ulib/zstd", |
| "//zircon/third_party/ulib/zstd:zstdseek", |
| ] |
| if (is_fuchsia) { |
| sources += [ |
| "allocator/allocator.cc", |
| "blob-cache.cc", |
| "blob-corruption-notifier.cc", |
| "blob-loader.cc", |
| "blob-verifier.cc", |
| "blob.cc", |
| "blobfs.cc", |
| "cache-node.cc", |
| "compression/blob-compressor.cc", |
| "compression/external-decompressor.cc", |
| "directory.cc", |
| "format.cc", |
| "fsck.cc", |
| "iterator/node-populator.cc", |
| "metrics.cc", |
| "mount.cc", |
| "pager/page-watcher.cc", |
| "pager/transfer-buffer.cc", |
| "pager/user-pager.cc", |
| "query.cc", |
| "read-metrics.cc", |
| "runner.cc", |
| "transaction.cc", |
| "verification-metrics.cc", |
| ] |
| public_deps += [ |
| ":fuchsia.blobfs.internal", |
| ":fuchsia.blobfs.internal_llcpp", |
| "//sdk/fidl/fuchsia.blobfs:fuchsia.blobfs_llcpp", |
| "//zircon/system/ulib/block-client", |
| "//zircon/system/ulib/fs/metrics:metrics-cobalt", |
| "//zircon/system/ulib/fs/metrics:metrics-composite-latency-event", |
| "//zircon/system/ulib/fs/metrics:metrics-inspect", |
| ] |
| deps += [ |
| "//sdk/fidl/fuchsia.blobfs:fuchsia.blobfs_c", |
| "//sdk/fidl/fuchsia.blobfs:fuchsia.blobfs_llcpp", |
| "//sdk/fidl/fuchsia.fs:fuchsia.fs_llcpp", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp", |
| "//sdk/fidl/fuchsia.scheduler", |
| "//sdk/lib/fdio", |
| "//sdk/lib/sys/inspect/cpp", |
| "//sdk/lib/syslog/cpp", |
| "//zircon/public/lib/async", |
| "//zircon/public/lib/async-cpp", |
| "//zircon/public/lib/sync", |
| "//zircon/public/lib/zx", |
| "//zircon/system/ulib/async-default", |
| "//zircon/system/ulib/async-loop", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/backtrace-request", |
| "//zircon/system/ulib/block-client", |
| "//zircon/system/ulib/fidl-async:fidl-async-cpp", |
| "//zircon/system/ulib/fidl-utils", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/id_allocator", |
| "//zircon/system/ulib/trace", |
| "//zircon/system/ulib/trace-engine", |
| "//zircon/system/ulib/trace-provider:trace-provider-with-fdio", |
| ] |
| } else { |
| sources += [ |
| "fsck-host.cc", |
| "host.cc", |
| ] |
| deps += [ "//zircon/system/ulib/fs-host" ] |
| } |
| configs += [ |
| # TODO(fxbug.dev/58162): delete the below and fix compiler warnings |
| "//build/config:Wno-conversion", |
| ] |
| |
| 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" ] |
| } |
| |
| source_set("decompressor-impl") { |
| visibility = [ "./*" ] |
| sources = [ |
| "compression/decompressor-sandbox/decompressor-impl.cc", |
| "compression/decompressor-sandbox/decompressor-impl.h", |
| ] |
| deps = [ |
| ":blobfs", |
| ":fuchsia.blobfs.internal", |
| ":fuchsia.blobfs.internal_llcpp", |
| "//sdk/fidl/fuchsia.scheduler", |
| "//sdk/lib/fidl/cpp:cpp", |
| "//sdk/lib/sys/cpp:cpp", |
| "//sdk/lib/syslog/cpp:cpp", |
| "//src/lib/chunked-compression", |
| "//zircon/public/lib/zxc", |
| "//zircon/system/ulib/digest", |
| "//zircon/system/ulib/fs/journal", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/trace", |
| ] |
| } |
| |
| executable("decompressor") { |
| sources = [ "compression/decompressor-sandbox/main.cc" ] |
| deps = [ |
| ":decompressor-impl", |
| ":fuchsia.blobfs.internal", |
| "//sdk/lib/fidl/cpp:cpp", |
| "//sdk/lib/sys/cpp:cpp", |
| "//sdk/lib/syslog/cpp:cpp", |
| "//zircon/public/lib/zxc", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/digest", |
| "//zircon/system/ulib/fs/journal", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/trace", |
| "//zircon/system/ulib/trace-provider:trace-provider-with-fdio", |
| ] |
| } |
| |
| fuchsia_component("decompressor-sandbox") { |
| manifest = "meta/decompressor-sandbox.cml" |
| deps = [ ":decompressor" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ "test" ] |
| } |