The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 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 | #ifndef RECOVERY_ROOTS_H_ |
| 18 | #define RECOVERY_ROOTS_H_ |
| 19 | |
| 20 | #include "minzip/Zip.h" |
| 21 | #include "mtdutils/mtdutils.h" |
| 22 | |
| 23 | /* Any of the "root_path" arguments can be paths with relative |
| 24 | * components, like "SYSTEM:a/b/c". |
| 25 | */ |
| 26 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 27 | /* Takes a string like "SYSTEM:lib" and turns it into a string |
| 28 | * like "/system/lib". The translated path is put in out_buf, |
| 29 | * and out_buf is returned if the translation succeeded. |
| 30 | */ |
| 31 | const char *translate_root_path(const char *root_path, |
| 32 | char *out_buf, size_t out_buf_len); |
| 33 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 34 | /* Returns negative on error, positive if it's mounted, zero if it isn't. |
| 35 | */ |
| 36 | int is_root_path_mounted(const char *root_path); |
| 37 | |
| 38 | int ensure_root_path_mounted(const char *root_path); |
| 39 | |
| 40 | int ensure_root_path_unmounted(const char *root_path); |
| 41 | |
| 42 | const MtdPartition *get_root_mtd_partition(const char *root_path); |
| 43 | |
| 44 | /* "root" must be the exact name of the root; no relative path is permitted. |
| 45 | * If the named root is mounted, this will attempt to unmount it first. |
| 46 | */ |
| 47 | int format_root_device(const char *root); |
| 48 | |
| 49 | #endif // RECOVERY_ROOTS_H_ |