The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 23 | typedef int boolean; |
| 24 | enum { |
| 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 | |
| 76 | int process_framework_command(int socket); |
| 77 | |
| 78 | int process_inotify_event(int fd); |
| 79 | int inotify_bootstrap(void); |
| 80 | |
| 81 | int process_uevent_message(int socket); |
| 82 | int simulate_uevent(char *subsystem, char *path, char *action, char **params); |
| 83 | |
| 84 | int mmc_bootstrap(void); |
| 85 | int ums_bootstrap(void); |
| 86 | |
| 87 | int volmgr_bootstrap(void); |
| 88 | |
| 89 | int switch_bootstrap(void); |
| 90 | |
| 91 | void *read_file(char *filename, ssize_t *_size); |
The Android Open Source Project | f614d64 | 2009-03-18 17:39:49 -0700 | [diff] [blame^] | 92 | char *truncate_sysfs_path(char *path, int num_elements_to_remove, char *buffer, int buffer_size); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 93 | char *read_sysfs_var(char *buffer, size_t maxlen, char *devpath, char *var); |
| 94 | |
| 95 | void ums_hostconnected_set(boolean connected); |
| 96 | boolean ums_hostconnected_get(void); |
| 97 | |
| 98 | int send_msg(char *msg); |
| 99 | int send_msg_with_data(char *msg, char *data); |
| 100 | #endif |