1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Copyright (C) 2007 The Android Open Source Project 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Licensed under the Apache License, Version 2.0 (the "License"); 5*4882a593Smuzhiyun * you may not use this file except in compliance with the License. 6*4882a593Smuzhiyun * You may obtain a copy of the License at 7*4882a593Smuzhiyun * 8*4882a593Smuzhiyun * http://www.apache.org/licenses/LICENSE-2.0 9*4882a593Smuzhiyun * 10*4882a593Smuzhiyun * Unless required by applicable law or agreed to in writing, software 11*4882a593Smuzhiyun * distributed under the License is distributed on an "AS IS" BASIS, 12*4882a593Smuzhiyun * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*4882a593Smuzhiyun * See the License for the specific language governing permissions and 14*4882a593Smuzhiyun * limitations under the License. 15*4882a593Smuzhiyun */ 16*4882a593Smuzhiyun 17*4882a593Smuzhiyun #ifndef RECOVERY_ROOTS_H_ 18*4882a593Smuzhiyun #define RECOVERY_ROOTS_H_ 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun #include "common.h" 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun // Load and parse volume data from /etc/recovery.fstab. 23*4882a593Smuzhiyun void load_volume_table(); 24*4882a593Smuzhiyun 25*4882a593Smuzhiyun // Return the Volume* record for this path (or NULL). 26*4882a593Smuzhiyun Volume* volume_for_path(const char* path); 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun // Make sure that the volume 'path' is on is mounted. Returns 0 on 29*4882a593Smuzhiyun // success (volume is mounted). 30*4882a593Smuzhiyun int ensure_path_mounted(const char* path); 31*4882a593Smuzhiyun 32*4882a593Smuzhiyun // Make sure that the volume 'path' is on is mounted. Returns 0 on 33*4882a593Smuzhiyun // success (volume is unmounted); 34*4882a593Smuzhiyun int ensure_path_unmounted(const char* path); 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun // Make sure that the volume 'path' is on is mounted. Returns 0 on 37*4882a593Smuzhiyun // success (volume is unmounted); 38*4882a593Smuzhiyun // It works for volume that not in fstab 39*4882a593Smuzhiyun int ensure_ex_path_unmounted(const char* path); 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun // device name get from /proc/mount, if device was umount, device 42*4882a593Smuzhiyun // would turn back NULL. 43*4882a593Smuzhiyun // Return NULL if device is not mounted or path is not existent. 44*4882a593Smuzhiyun const char* get_mounted_device_from_path(const char* path); 45*4882a593Smuzhiyun 46*4882a593Smuzhiyun // Reformat the given volume (must be the mount point only, eg 47*4882a593Smuzhiyun // "/cache"), no paths permitted. Attempts to unmount the volume if 48*4882a593Smuzhiyun // it is mounted. 49*4882a593Smuzhiyun int format_volume(const char* volume); 50*4882a593Smuzhiyun int resize_volume(const char* volume); 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun #endif // RECOVERY_ROOTS_H_ 54