blob: abc27a185e2940bde726684043ccccc6b066ad0b [file] [log] [blame]
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08001/*
2 * Copyright (C) 2008 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 VOLD_H__
18#define VOLD_H__
19
20#define LOG_TAG "vold"
21#include "cutils/log.h"
22
23typedef int boolean;
24enum {
25 false = 0,
26 true = 1
27};
28
29#define DEVPATH "/dev/block/"
30#define DEVPATHLENGTH 11
31
32#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
33
34// Set this for logging error messages
35#define ENABLE_LOG_ERROR
36
37// set this to log vold events
38#define ENABLE_LOG_VOL
39
40#ifdef ENABLE_LOG_ERROR
41#define LOG_ERROR(fmt, args...) \
42 { LOGE(fmt , ## args); }
43#else
44#define LOG_ERROR(fmt, args...) \
45 do { } while (0)
46#endif /* ENABLE_LOG_ERROR */
47
48#ifdef ENABLE_LOG_VOL
49#define LOG_VOL(fmt, args...) \
50 { LOGD(fmt , ## args); }
51#else
52#define LOG_VOL(fmt, args...) \
53 do { } while (0)
54#endif /* ENABLE_LOG_VOL */
55
56#ifdef ENABLE_LOG_SERVER
57#define LOG_SERVER(fmt, args...) \
58 { LOGD(fmt , ## args); }
59#else
60#define LOG_SERVER(fmt, args...) \
61 do { } while (0)
62#endif /* ENABLE_LOG_SERVER */
63
64#ifdef ENABLE_LOG_ASEC
65#define LOG_ASEC(fmt, args...) \
66 { LOGD(fmt , ## args); }
67#else
68#define LOG_ASEC(fmt, args...) \
69 do { } while (0)
70#endif /* ENABLE_LOG_ASEC */
71
72/*
73 * Prototypes
74 */
75
76int process_framework_command(int socket);
77
78int process_inotify_event(int fd);
79int inotify_bootstrap(void);
80
81int process_uevent_message(int socket);
82int simulate_uevent(char *subsystem, char *path, char *action, char **params);
83
84int mmc_bootstrap(void);
85int ums_bootstrap(void);
86
87int volmgr_bootstrap(void);
88
89int switch_bootstrap(void);
90
91void *read_file(char *filename, ssize_t *_size);
The Android Open Source Projectf614d642009-03-18 17:39:49 -070092char *truncate_sysfs_path(char *path, int num_elements_to_remove, char *buffer, int buffer_size);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080093char *read_sysfs_var(char *buffer, size_t maxlen, char *devpath, char *var);
94
95void ums_hostconnected_set(boolean connected);
96boolean ums_hostconnected_get(void);
97
98int send_msg(char *msg);
99int send_msg_with_data(char *msg, char *data);
San Mehat1f278212009-07-16 10:44:15 -0700100extern int bootstrap;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800101#endif