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