Skip to content

Commit

Permalink
[fxfs] Make fshost launch fxfs as a component
Browse files Browse the repository at this point in the history
This involved removing the fs_switch option and changing the binary path
option into a format option instead.

Bug: 99591
Change-Id: I34a2e4a27bbbe2df1a0cf9fcaec3787f46cd020a
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/678383
Commit-Queue: Auto-Submit <[email protected]>
Reviewed-by: Stephen Demos <[email protected]>
Fuchsia-Auto-Submit: Chris Suter <[email protected]>
  • Loading branch information
sutes-work authored and Commit Bot committed May 13, 2022
1 parent 3e7f195 commit d401b31
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/lib/storage/fs_management/cpp/format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,24 @@ __EXPORT std::string_view DiskFormatString(DiskFormat fs_type) {
return format->name().c_str();
}

__EXPORT DiskFormat DiskFormatFromString(std::string_view str) {
static auto* formats = [] {
auto* formats = new std::unordered_map<std::string_view, DiskFormat>();
for (auto format : {kDiskFormatGpt, kDiskFormatMbr, kDiskFormatMinfs, kDiskFormatFat,
kDiskFormatBlobfs, kDiskFormatFvm, kDiskFormatZxcrypt, kDiskFormatFactoryfs,
kDiskFormatBlockVerity, kDiskFormatVbmeta, kDiskFormatBootpart,
kDiskFormatFxfs, kDiskFormatF2fs, kDiskFormatNandBroker}) {
formats->emplace(DiskFormatString(format), format);
}
return formats;
}();
if (auto iter = formats->find(str); iter == formats->end()) {
return kDiskFormatUnknown;
} else {
return iter->second;
}
}

__EXPORT std::string_view DiskFormatComponentUrl(DiskFormat fs_type) {
switch (fs_type) {
case kDiskFormatBlobfs:
Expand Down
1 change: 1 addition & 0 deletions src/lib/storage/fs_management/cpp/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ enum DiskFormat {
};

std::string_view DiskFormatString(DiskFormat fs_type);
DiskFormat DiskFormatFromString(std::string_view str);

// Get the component url for the disk format, if it's known. If it's not known, this returns an
// empty string.
Expand Down

0 comments on commit d401b31

Please sign in to comment.