| 1 | /*++ |
| 2 | |
| 3 | Copyright (c) Microsoft. All rights reserved. |
| 4 | |
| 5 | Module Name: |
| 6 | |
| 7 | drvfs.h |
| 8 | |
| 9 | Abstract: |
| 10 | |
| 11 | This file contains DrvFs function declarations. |
| 12 | |
| 13 | --*/ |
| 14 | |
| 15 | #pragma once |
| 16 | |
| 17 | #define VIRTIOFS_MOUNT_DIR "/run/wsl/virtiofs-mounts" |
| 18 | #include <optional> |
| 19 | #include <string_view> |
| 20 | #include "WslDistributionConfig.h" |
| 21 | |
| 22 | #define DRVFS_FS_TYPE "drvfs" |
| 23 | #define MOUNT_DRVFS_NAME "mount.drvfs" |
| 24 | |
| 25 | struct VirtioFsMountRoot |
| 26 | { |
| 27 | std::string_view ChildName; |
| 28 | std::string_view SubPath; |
| 29 | }; |
| 30 | |
| 31 | std::optional<VirtioFsMountRoot> ParseAggregateVirtioFsMountRoot(std::string_view Tag, std::string_view Root); |
| 32 | |
| 33 | int MountVirtioFsChild( |
| 34 | const char* Tag, |
| 35 | const char* ChildName, |
| 36 | const char* Target, |
| 37 | const char* Options, |
| 38 | int* ExitCode = nullptr, |
| 39 | std::string_view SubPath = "/"); |
| 40 | |
| 41 | int MountDrvfs(const char* Source, const char* Target, const char* Options, std::optional<bool> Admin, const wsl::linux::WslDistributionConfig& Config, int* ExitCode = nullptr); |
| 42 | |
| 43 | int MountDrvfsEntry(int Argc, char* Argv[]); |
| 44 | |
| 45 | int MountPlan9Share(const char* Source, const char* Target, const char* Options, bool Admin, int* ExitCode = nullptr); |
| 46 | |
| 47 | int MountPlan9(const char* Source, const char* Target, const char* Options, std::optional<bool> Admin, const wsl::linux::WslDistributionConfig& Config, int* ExitCode); |
| 48 | |
| 49 | int MountVirtioFs(const char* Source, const char* Target, const char* Options, std::optional<bool> Admin, const wsl::linux::WslDistributionConfig& Config, int* ExitCode = nullptr); |
| 50 | |
| 51 | int RemountVirtioFs(const char* Tag, const char* Target, const char* Options, bool Admin, std::string_view SubPath = "/"); |
| 52 | |
| 53 | std::string QueryVirtiofsMountSource(const char* Tag, const char* Root = nullptr); |