1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <string> 20 21 #include <fstab/fstab.h> 22 23 bool fs_mgr_overlayfs_already_mounted(const std::string& mount_point, bool overlay_only = true); 24 bool fs_mgr_wants_overlayfs(android::fs_mgr::FstabEntry* entry); 25 android::fs_mgr::Fstab fs_mgr_overlayfs_candidate_list(const android::fs_mgr::Fstab& fstab); 26 27 // If "mount_point" is non-null, set up exactly one overlay. 28 // If "mount_point" is null, setup any overlays. 29 // 30 // If |want_reboot| is non-null, and a reboot is needed to apply overlays, then 31 // it will be true on return. The caller is responsible for initializing it. 32 bool fs_mgr_overlayfs_setup(const android::fs_mgr::Fstab& fstab, const char* mount_point = nullptr, 33 bool* want_reboot = nullptr, bool just_disabled_verity = true); 34 35 enum class OverlayfsTeardownResult { 36 Ok, 37 Busy, // Indicates that overlays are still in use. 38 Error 39 }; 40 OverlayfsTeardownResult fs_mgr_overlayfs_teardown(const char* mount_point = nullptr, 41 bool* want_reboot = nullptr); 42 43 namespace android { 44 namespace fs_mgr { 45 46 void CleanupOldScratchFiles(); 47 48 } // namespace fs_mgr 49 } // namespace android 50