blob: 4122e4066b84a060bc44a77f026f7174f3ee2fb4 [file] [log] [blame]
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -08001/*
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_COMMON_H
18#define RECOVERY_COMMON_H
19
20#include <stdio.h>
21
Doug Zongker28ce47c2011-10-28 10:33:05 -070022#ifdef __cplusplus
23extern "C" {
24#endif
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080025
Dees_Troy51a0e822012-09-05 15:24:24 -040026#define ui_print(...) fprintf(stdout, __VA_ARGS__)
27#define ui_print_overwrite(...) fprintf(stdout, __VA_ARGS__)
28
Doug Zongker28ce47c2011-10-28 10:33:05 -070029// TODO: restore ui_print for LOGE
30#define LOGE(...) fprintf(stdout, "E:" __VA_ARGS__)
Doug Zongker3d177d02010-07-01 09:18:44 -070031#define LOGW(...) fprintf(stdout, "W:" __VA_ARGS__)
32#define LOGI(...) fprintf(stdout, "I:" __VA_ARGS__)
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080033
34#if 0
Doug Zongker3d177d02010-07-01 09:18:44 -070035#define LOGV(...) fprintf(stdout, "V:" __VA_ARGS__)
36#define LOGD(...) fprintf(stdout, "D:" __VA_ARGS__)
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080037#else
38#define LOGV(...) do {} while (0)
39#define LOGD(...) do {} while (0)
40#endif
41
Doug Zongkerfb2e3af2009-06-17 17:29:40 -070042#define STRINGIFY(x) #x
43#define EXPAND(x) STRINGIFY(x)
44
Doug Zongkercc8cd3f2010-09-20 12:16:13 -070045typedef struct {
46 const char* mount_point; // eg. "/cache". must live in the root directory.
47
48 const char* fs_type; // "yaffs2" or "ext4" or "vfat"
49
50 const char* device; // MTD partition name if fs_type == "yaffs"
51 // block device if fs_type == "ext4" or "vfat"
52
53 const char* device2; // alternative device to try if fs_type
54 // == "ext4" or "vfat" and mounting
55 // 'device' fails
Doug Zongker2810ced2011-02-17 15:55:21 -080056
57 long long length; // (ext4 partition only) when
58 // formatting, size to use for the
59 // partition. 0 or negative number
60 // means to format all but the last
61 // (that much).
Doug Zongkercc8cd3f2010-09-20 12:16:13 -070062} Volume;
63
Doug Zongker469243e2011-04-12 09:28:10 -070064// fopen a file, mounting volumes and making parent dirs as necessary.
65FILE* fopen_path(const char *path, const char *mode);
66
Doug Zongker28ce47c2011-10-28 10:33:05 -070067#ifdef __cplusplus
68}
69#endif
70
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080071#endif // RECOVERY_COMMON_H