| 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 | 
| Shashank Mittal | 815ca5d | 2010-07-27 11:09:19 -0700 | [diff] [blame^] | 3 | * Copyright (c) 2010, Code Aurora Forum. All rights reserved. | 
| The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 4 | * | 
|  | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 6 | * you may not use this file except in compliance with the License. | 
|  | 7 | * You may obtain a copy of the License at | 
|  | 8 | * | 
|  | 9 | *      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 10 | * | 
|  | 11 | * Unless required by applicable law or agreed to in writing, software | 
|  | 12 | * distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 14 | * See the License for the specific language governing permissions and | 
|  | 15 | * limitations under the License. | 
|  | 16 | */ | 
|  | 17 |  | 
|  | 18 | #ifndef RECOVERY_ROOTS_H_ | 
|  | 19 | #define RECOVERY_ROOTS_H_ | 
|  | 20 |  | 
|  | 21 | #include "minzip/Zip.h" | 
|  | 22 | #include "mtdutils/mtdutils.h" | 
|  | 23 |  | 
| Koushik Dutta | a6522b3 | 2010-06-20 13:16:06 -0700 | [diff] [blame] | 24 | #ifndef SDCARD_DEVICE_PRIMARY | 
| Koushik Dutta | ceddcd5 | 2010-08-23 16:13:14 -0700 | [diff] [blame] | 25 | #define SDCARD_DEVICE_PRIMARY "/dev/block/mmcblk0p1" | 
| Koushik Dutta | a6522b3 | 2010-06-20 13:16:06 -0700 | [diff] [blame] | 26 | #endif | 
|  | 27 |  | 
|  | 28 | #ifndef SDCARD_DEVICE_SECONDARY | 
| Koushik Dutta | ceddcd5 | 2010-08-23 16:13:14 -0700 | [diff] [blame] | 29 | #define SDCARD_DEVICE_SECONDARY "/dev/block/mmcblk0" | 
| Koushik Dutta | a6522b3 | 2010-06-20 13:16:06 -0700 | [diff] [blame] | 30 | #endif | 
|  | 31 |  | 
|  | 32 | #ifndef SDEXT_DEVICE | 
|  | 33 | #define SDEXT_DEVICE "/dev/block/mmcblk0p2" | 
|  | 34 | #endif | 
|  | 35 |  | 
|  | 36 | #ifndef SDEXT_FILESYSTEM | 
| Koushik Dutta | 1bf4f69 | 2010-07-14 18:37:33 -0700 | [diff] [blame] | 37 | #define SDEXT_FILESYSTEM "auto" | 
| Koushik Dutta | a6522b3 | 2010-06-20 13:16:06 -0700 | [diff] [blame] | 38 | #endif | 
|  | 39 |  | 
|  | 40 | #ifndef DATA_DEVICE | 
|  | 41 | #define DATA_DEVICE g_mtd_device | 
|  | 42 | #endif | 
|  | 43 |  | 
|  | 44 | #ifndef DATA_FILESYSTEM | 
|  | 45 | #define DATA_FILESYSTEM "yaffs2" | 
|  | 46 | #endif | 
|  | 47 |  | 
|  | 48 | #ifndef DATADATA_DEVICE | 
|  | 49 | #define DATADATA_DEVICE g_mtd_device | 
|  | 50 | #endif | 
|  | 51 |  | 
|  | 52 | #ifndef DATADATA_FILESYSTEM | 
|  | 53 | #define DATADATA_FILESYSTEM "yaffs2" | 
|  | 54 | #endif | 
|  | 55 |  | 
|  | 56 | #ifndef CACHE_DEVICE | 
|  | 57 | #define CACHE_DEVICE g_mtd_device | 
|  | 58 | #endif | 
|  | 59 |  | 
|  | 60 | #ifndef CACHE_FILESYSTEM | 
|  | 61 | #define CACHE_FILESYSTEM "yaffs2" | 
|  | 62 | #endif | 
|  | 63 |  | 
| Koushik Dutta | 5aaa823 | 2010-07-20 16:23:18 -0700 | [diff] [blame] | 64 | #ifndef SYSTEM_DEVICE | 
|  | 65 | #define SYSTEM_DEVICE g_mtd_device | 
|  | 66 | #endif | 
|  | 67 |  | 
|  | 68 | #ifndef SYSTEM_FILESYSTEM | 
|  | 69 | #define SYSTEM_FILESYSTEM "yaffs2" | 
|  | 70 | #endif | 
|  | 71 |  | 
| Koushik Dutta | d4060c3 | 2010-07-22 20:14:44 -0700 | [diff] [blame] | 72 | #ifndef DATA_FILESYSTEM_OPTIONS | 
|  | 73 | #define DATA_FILESYSTEM_OPTIONS NULL | 
|  | 74 | #endif | 
|  | 75 |  | 
|  | 76 | #ifndef CACHE_FILESYSTEM_OPTIONS | 
|  | 77 | #define CACHE_FILESYSTEM_OPTIONS NULL | 
|  | 78 | #endif | 
|  | 79 |  | 
|  | 80 | #ifndef DATADATA_FILESYSTEM_OPTIONS | 
|  | 81 | #define DATADATA_FILESYSTEM_OPTIONS NULL | 
|  | 82 | #endif | 
|  | 83 |  | 
|  | 84 | #ifndef SYSTEM_FILESYSTEM_OPTIONS | 
|  | 85 | #define SYSTEM_FILESYSTEM_OPTIONS NULL | 
|  | 86 | #endif | 
|  | 87 |  | 
|  | 88 |  | 
| The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 89 | /* Any of the "root_path" arguments can be paths with relative | 
|  | 90 | * components, like "SYSTEM:a/b/c". | 
|  | 91 | */ | 
|  | 92 |  | 
|  | 93 | /* Associate this package with the package root "PKG:". | 
|  | 94 | */ | 
|  | 95 | int register_package_root(const ZipArchive *package, const char *package_path); | 
|  | 96 |  | 
|  | 97 | /* Returns non-zero iff root_path points inside a package. | 
|  | 98 | */ | 
|  | 99 | int is_package_root_path(const char *root_path); | 
|  | 100 |  | 
|  | 101 | /* Takes a string like "SYSTEM:lib" and turns it into a string | 
|  | 102 | * like "/system/lib".  The translated path is put in out_buf, | 
|  | 103 | * and out_buf is returned if the translation succeeded. | 
|  | 104 | */ | 
|  | 105 | const char *translate_root_path(const char *root_path, | 
|  | 106 | char *out_buf, size_t out_buf_len); | 
|  | 107 |  | 
|  | 108 | /* Takes a string like "PKG:lib/libc.so" and returns a pointer to | 
|  | 109 | * the containing zip file and a path like "lib/libc.so". | 
|  | 110 | */ | 
|  | 111 | const char *translate_package_root_path(const char *root_path, | 
|  | 112 | char *out_buf, size_t out_buf_len, const ZipArchive **out_package); | 
|  | 113 |  | 
|  | 114 | /* Returns negative on error, positive if it's mounted, zero if it isn't. | 
|  | 115 | */ | 
|  | 116 | int is_root_path_mounted(const char *root_path); | 
|  | 117 |  | 
|  | 118 | int ensure_root_path_mounted(const char *root_path); | 
|  | 119 |  | 
|  | 120 | int ensure_root_path_unmounted(const char *root_path); | 
|  | 121 |  | 
|  | 122 | const MtdPartition *get_root_mtd_partition(const char *root_path); | 
|  | 123 |  | 
|  | 124 | /* "root" must be the exact name of the root; no relative path is permitted. | 
|  | 125 | * If the named root is mounted, this will attempt to unmount it first. | 
|  | 126 | */ | 
|  | 127 | int format_root_device(const char *root); | 
|  | 128 |  | 
| Koushik Dutta | 14239d2 | 2010-06-14 15:02:48 -0700 | [diff] [blame] | 129 | typedef struct { | 
|  | 130 | const char *name; | 
|  | 131 | const char *device; | 
|  | 132 | const char *device2;  // If the first one doesn't work (may be NULL) | 
|  | 133 | const char *partition_name; | 
|  | 134 | const char *mount_point; | 
|  | 135 | const char *filesystem; | 
| Koushik Dutta | d4060c3 | 2010-07-22 20:14:44 -0700 | [diff] [blame] | 136 | const char *filesystem_options; | 
| Koushik Dutta | 14239d2 | 2010-06-14 15:02:48 -0700 | [diff] [blame] | 137 | } RootInfo; | 
|  | 138 |  | 
| The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 139 | #endif  // RECOVERY_ROOTS_H_ |