Loading fs_mgr/libsnapshot/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -198,6 +198,7 @@ cc_library_static { "libsnapshot_cow/cow_format.cpp", "libsnapshot_cow/cow_reader.cpp", "libsnapshot_cow/parser_v2.cpp", "libsnapshot_cow/parser_v3.cpp", "libsnapshot_cow/snapshot_reader.cpp", "libsnapshot_cow/writer_base.cpp", "libsnapshot_cow/writer_v2.cpp", Loading fs_mgr/libsnapshot/libsnapshot_cow/parser_v2.h +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ #include <android-base/unique_fd.h> #include <libsnapshot/cow_format.h> #include "parser_base.h" #include <libsnapshot_cow/parser_base.h> namespace android { namespace snapshot { Loading fs_mgr/libsnapshot/libsnapshot_cow/parser_v3.cpp 0 → 100644 +45 −0 Original line number Diff line number Diff line // Copyright (C) 2023 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "parser_v3.h" #include <android-base/file.h> #include <android-base/logging.h> #include <libsnapshot/cow_format.h> namespace android { namespace snapshot { using android::base::borrowed_fd; bool CowParserV3::Parse(borrowed_fd fd, const CowHeaderV3& header, std::optional<uint64_t> label) { LOG(ERROR) << "this function should never be called"; if (fd.get() || sizeof(header) > 0 || label) return false; return false; } bool CowParserV3::ParseOps(android::base::borrowed_fd fd, std::optional<uint64_t> label) { LOG(ERROR) << "this function should never be called"; if (fd.get() || label) return false; return false; } bool CowParserV3::Translate(TranslatedCowOps* out) { out->ops = ops_; out->header = header_; return true; } } // namespace snapshot } // namespace android fs_mgr/libsnapshot/libsnapshot_cow/parser_v3.h 0 → 100644 +60 −0 Original line number Diff line number Diff line // Copyright (C) 2023 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Copyright (C) 2023 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include <stdint.h> #include <memory> #include <optional> #include <unordered_map> #include <vector> #include <android-base/unique_fd.h> #include <libsnapshot/cow_format.h> #include <libsnapshot_cow/parser_base.h> namespace android { namespace snapshot { class CowParserV3 final : public CowParserBase { public: bool Parse(android::base::borrowed_fd fd, const CowHeaderV3& header, std::optional<uint64_t> label = {}) override; bool Translate(TranslatedCowOps* out) override; std::shared_ptr<std::unordered_map<uint64_t, uint64_t>> data_loc() const override { return nullptr; }; private: bool ParseOps(android::base::borrowed_fd fd, std::optional<uint64_t> label); CowHeaderV3 header_ = {}; std::shared_ptr<std::vector<CowOperationV3>> ops_; }; } // namespace snapshot } // namespace android Loading
fs_mgr/libsnapshot/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -198,6 +198,7 @@ cc_library_static { "libsnapshot_cow/cow_format.cpp", "libsnapshot_cow/cow_reader.cpp", "libsnapshot_cow/parser_v2.cpp", "libsnapshot_cow/parser_v3.cpp", "libsnapshot_cow/snapshot_reader.cpp", "libsnapshot_cow/writer_base.cpp", "libsnapshot_cow/writer_v2.cpp", Loading
fs_mgr/libsnapshot/libsnapshot_cow/parser_v2.h +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ #include <android-base/unique_fd.h> #include <libsnapshot/cow_format.h> #include "parser_base.h" #include <libsnapshot_cow/parser_base.h> namespace android { namespace snapshot { Loading
fs_mgr/libsnapshot/libsnapshot_cow/parser_v3.cpp 0 → 100644 +45 −0 Original line number Diff line number Diff line // Copyright (C) 2023 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "parser_v3.h" #include <android-base/file.h> #include <android-base/logging.h> #include <libsnapshot/cow_format.h> namespace android { namespace snapshot { using android::base::borrowed_fd; bool CowParserV3::Parse(borrowed_fd fd, const CowHeaderV3& header, std::optional<uint64_t> label) { LOG(ERROR) << "this function should never be called"; if (fd.get() || sizeof(header) > 0 || label) return false; return false; } bool CowParserV3::ParseOps(android::base::borrowed_fd fd, std::optional<uint64_t> label) { LOG(ERROR) << "this function should never be called"; if (fd.get() || label) return false; return false; } bool CowParserV3::Translate(TranslatedCowOps* out) { out->ops = ops_; out->header = header_; return true; } } // namespace snapshot } // namespace android
fs_mgr/libsnapshot/libsnapshot_cow/parser_v3.h 0 → 100644 +60 −0 Original line number Diff line number Diff line // Copyright (C) 2023 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Copyright (C) 2023 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include <stdint.h> #include <memory> #include <optional> #include <unordered_map> #include <vector> #include <android-base/unique_fd.h> #include <libsnapshot/cow_format.h> #include <libsnapshot_cow/parser_base.h> namespace android { namespace snapshot { class CowParserV3 final : public CowParserBase { public: bool Parse(android::base::borrowed_fd fd, const CowHeaderV3& header, std::optional<uint64_t> label = {}) override; bool Translate(TranslatedCowOps* out) override; std::shared_ptr<std::unordered_map<uint64_t, uint64_t>> data_loc() const override { return nullptr; }; private: bool ParseOps(android::base::borrowed_fd fd, std::optional<uint64_t> label); CowHeaderV3 header_ = {}; std::shared_ptr<std::vector<CowOperationV3>> ops_; }; } // namespace snapshot } // namespace android