/** * @file FSRegistry.h * @author apio (cloudapio.eu) * @brief Kernel registry of available file system implementations. * * @copyright Copyright (c) 2023, the Luna authors. * */ #pragma once #include "fs/VFS.h" #include "fs/devices/Device.h" typedef Result> (*VirtualFileSystemFactoryFunction)(void); typedef Result> (*PhysicalFileSystemFactoryFunction)(SharedPtr); namespace FSRegistry { /** * @brief Register the built-in file system implementations. * * @return Result Whether the operation succeeded. */ Result init(); /** * @brief Register a "virtual" (in-memory) file system implementation, associating a name to it. * * @param factory_function The factory function to use to create new instances of this file system. * @param name The name to associate with this file system implementation. * @return Result Whether the operation succeeded. */ Result register_virtual_filesystem(VirtualFileSystemFactoryFunction factory_function, StringView name); /** * @brief Register a "physical" (mounted from a device) file system implementation, associating a name * to it. * * @param factory_function The factory function to use to create new instances of this file system. * @param name The name to associate with this file system implementation. * @return Result Whether the operation succeeded. */ Result register_physical_filesystem(PhysicalFileSystemFactoryFunction factory_function, StringView name); /** * @brief Find a "virtual" (in-memory) file system implementation by name. * * @param name The name to look for. * @return Result An error, or the factory function to create file systems of this * type. */ Result lookup_virtual_filesystem(StringView name); /** * @brief Find a "physical" (mounted from a device) file system implementation by name. * * @param name The name to look for. * @return Result An error, or the factory function to create file systems of * this type. */ Result lookup_physical_filesystem(StringView name); }