| # Copyright 2026 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. | |
| load("@rules_cc//cc:defs.bzl", "cc_library") | |
| package(default_applicable_licenses = ["//:license"]) | |
| cc_library( | |
| name = "vfs_headers", | |
| hdrs = [ | |
| "debug.h", | |
| "shared_mutex.h", | |
| "vfs.h", | |
| "vfs_types.h", | |
| "vnode.h", | |
| ] + select({ | |
| "@platforms//os:fuchsia": [ | |
| "fuchsia_vfs.h", | |
| "lazy_dir.h", | |
| "managed_vfs.h", | |
| "paged_vfs.h", | |
| "paged_vnode.h", | |
| "pager_thread_pool.h", | |
| "pseudo_dir.h", | |
| "pseudo_file.h", | |
| "ref_counted.h", | |
| "remote_dir.h", | |
| "service.h", | |
| "synchronous_vfs.h", | |
| "ticker.h", | |
| "vmo_file.h", | |
| "watcher.h", | |
| ], | |
| "//conditions:default": [], | |
| }), | |
| includes = ["."], | |
| visibility = [":__pkg__"], | |
| deps = [ | |
| "//sdk/fidl/fuchsia.io:fuchsia.io_cpp", | |
| "//sdk/lib/fdio:constants", | |
| "//sdk/lib/fit", | |
| "//zircon/system/ulib/fbl", | |
| "//zircon/system/ulib/zx", | |
| ] + select({ | |
| "@platforms//os:fuchsia": [ | |
| # Required for fs::FilesystemInfo | |
| "//sdk/fidl/fuchsia.fs:fuchsia.fs_cpp", | |
| # Required for fs::FuchsiaVfs and fs::Connection | |
| "//sdk/lib/async", | |
| # Required for fs::PagedVnode | |
| "//sdk/lib/async:async-cpp", | |
| # Required for fs::Vnode | |
| "//sdk/lib/file-lock:cpp", | |
| ], | |
| "//conditions:default": [], | |
| }), | |
| alwayslink = True, | |
| ) | |
| cc_library( | |
| name = "connection", | |
| srcs = select({ | |
| "@platforms//os:fuchsia": [ | |
| "connection/advisory_lock.cc", | |
| "connection/connection.cc", | |
| "connection/directory_connection.cc", | |
| "connection/file_connection.cc", | |
| "connection/node_connection.cc", | |
| "connection/remote_file_connection.cc", | |
| "connection/stream_file_connection.cc", | |
| ], | |
| "//conditions:default": [], | |
| }), | |
| hdrs = select({ | |
| "@platforms//os:fuchsia": [ | |
| "connection/advisory_lock.h", | |
| "connection/connection.h", | |
| "connection/directory_connection.h", | |
| "connection/file_connection.h", | |
| "connection/node_connection.h", | |
| "connection/remote_file_connection.h", | |
| "connection/stream_file_connection.h", | |
| ], | |
| "//conditions:default": [], | |
| }), | |
| implementation_deps = [ | |
| "//sdk/lib/stdcompat", | |
| ] + select({ | |
| "@platforms//os:fuchsia": [ | |
| "//sdk/lib/fidl", | |
| "//zircon/system/ulib/sync", | |
| ], | |
| "//conditions:default": [], | |
| }), | |
| includes = ["."], | |
| visibility = [":__pkg__"], | |
| deps = [ | |
| ":vfs_headers", | |
| ], | |
| alwayslink = True, | |
| ) | |
| cc_library( | |
| name = "cpp", | |
| # Uncomment to enable some debug log messages | |
| # defines = [ "FS_TRACE_DEBUG_ENABLED" ] | |
| srcs = [ | |
| "debug.cc", | |
| "vfs.cc", | |
| "vfs_types.cc", | |
| "vnode.cc", | |
| ] + select({ | |
| "@platforms//os:fuchsia": [ | |
| "fuchsia_vfs.cc", | |
| "lazy_dir.cc", | |
| "managed_vfs.cc", | |
| "paged_vfs.cc", | |
| "paged_vnode.cc", | |
| "pager_thread_pool.cc", | |
| "pseudo_dir.cc", | |
| "pseudo_file.cc", | |
| "remote_dir.cc", | |
| "service.cc", | |
| "synchronous_vfs.cc", | |
| "vmo_file.cc", | |
| "watcher.cc", | |
| ], | |
| "//conditions:default": [], | |
| }), | |
| implementation_deps = [ | |
| "//sdk/lib/stdcompat", | |
| ] + select({ | |
| "@platforms//os:fuchsia": [ | |
| ":connection", | |
| "//sdk/lib/fidl", | |
| "//zircon/system/ulib/sync", | |
| ], | |
| "//conditions:default": [], | |
| }), | |
| # ________ _________ ________ ________ | |
| # |\ ____\|\___ ___\\ __ \|\ __ \ | |
| # \ \ \___|\|___ \ \_\ \ \|\ \ \ \|\ \ | |
| # \ \_____ \ \ \ \ \ \ \\\ \ \ ____\ | |
| # \|____|\ \ \ \ \ \ \ \\\ \ \ \___| | |
| # ____\_\ \ \ \__\ \ \_______\ \__\ | |
| # |\_________\ \|__| \|_______|\|__| | |
| # \|_________| | |
| # | |
| # This is an allowlist for using this library. New users should prefer //sdk/lib/vfs, | |
| # which provides better-supported API for pseudo-filesystems. | |
| visibility = [ | |
| ":__pkg__", | |
| "//sdk/lib/component/tests:__pkg__", | |
| "//sdk/lib/device-watcher/cpp:__pkg__", | |
| "//sdk/lib/driver/compat/cpp:__pkg__", | |
| "//sdk/lib/driver/power/cpp:__pkg__", | |
| "//sdk/lib/ld/testing:__pkg__", | |
| "//sdk/lib/svc:__pkg__", | |
| "//sdk/lib/vfs/internal:__pkg__", | |
| "//src/bringup/bin/console-launcher:__pkg__", | |
| "//src/camera/bin/device_watcher:__pkg__", | |
| "//src/camera/lib/fake_logical_buffer_collection:__pkg__", | |
| "//src/connectivity/bluetooth/hci/vendor/broadcom:__pkg__", | |
| "//src/connectivity/bluetooth/hci/vendor/intel:__pkg__", | |
| "//src/developer/debug/debug_agent:__pkg__", | |
| "//src/developer/debug/debug_agent/testing:__pkg__", | |
| "//src/developer/vsock-sshd-host:__pkg__", | |
| "//src/devices/bin/driver_manager:__pkg__", | |
| "//src/devices/bin/driver_manager/devfs:__pkg__", | |
| "//src/devices/testing/devmgr-integration-test-shim:__pkg__", | |
| "//src/devices/testing/driver-integration-test-shim:__pkg__", | |
| "//src/devices/tests/v2/runtime-protocol:__pkg__", | |
| "//src/devices/thermal/bin/fan-controller:__pkg__", | |
| "//src/firmware/lib/fastboot/test:__pkg__", | |
| "//src/firmware/paver/test:__pkg__", | |
| "//src/graphics/bin/vulkan_loader:__pkg__", | |
| "//src/graphics/bin/vulkan_loader/test:__pkg__", | |
| "//src/graphics/drivers/msd-arm-mali/tests/unit_tests:__pkg__", | |
| "//src/lib/fsl:__pkg__", | |
| "//src/lib/zxdump:__pkg__", | |
| "//src/media/audio/audio_core:__pkg__", | |
| "//src/media/audio/services/device_registry:__pkg__", | |
| "//src/media/codec/factory:__pkg__", | |
| "//src/performance/memory/thrasher:__pkg__", | |
| "//src/storage/blobfs:__pkg__", | |
| "//src/storage/blobfs/bin:__pkg__", | |
| "//src/storage/conformance/conformance_harness/cppvfs:__pkg__", | |
| "//src/storage/conformance/conformance_harness/memfs:__pkg__", | |
| "//src/storage/conformance/conformance_harness/minfs:__pkg__", | |
| "//src/storage/f2fs:__pkg__", | |
| "//src/storage/fs_test:__pkg__", | |
| "//src/storage/lib:__pkg__", | |
| "//src/storage/lib/fs_management/cpp:__pkg__", | |
| "//src/storage/lib/watchdog:__pkg__", | |
| "//src/storage/memfs:__pkg__", | |
| "//src/storage/memfs/test:__pkg__", | |
| "//src/storage/minfs:__pkg__", | |
| "//src/storage/minfs/test:__pkg__", | |
| "//src/storage/minfs/tools:__pkg__", | |
| "//src/storage/testing:__pkg__", | |
| "//src/sys/component_manager/tests/rights:__pkg__", | |
| "//src/tests/microbenchmarks:__pkg__", | |
| "//src/virtualization/packages:__pkg__", | |
| "//zircon/system/ulib/debugdata:__pkg__", | |
| "//zircon/system/ulib/debugdata/test:__pkg__", | |
| "//zircon/system/ulib/runtests-utils:__pkg__", | |
| "//zircon/system/ulib/runtests-utils/test:__pkg__", | |
| "//zircon/system/ulib/svc:__pkg__", | |
| ], | |
| deps = [":vfs_headers"], | |
| ) |