system/core
Revisão | 4a4c9f6f98055918f1ebff06b3cc1ed622c058fe (tree) |
---|---|
Hora | 2009-01-22 17:16:17 |
Autor | The Android Open Source Project <initial-contribution@andr...> |
Commiter | The Android Open Source Project |
Merge branch 'cupcake'
@@ -98,7 +98,6 @@ static struct perms_ devperms[] = { | ||
98 | 98 | /* these should not be world writable */ |
99 | 99 | { "/dev/android_adb", 0660, AID_ADB, AID_ADB, 0 }, |
100 | 100 | { "/dev/android_adb_enable", 0660, AID_ADB, AID_ADB, 0 }, |
101 | - /* TODO: remove legacy ttyMSM0 */ | |
102 | 101 | { "/dev/ttyMSM0", 0600, AID_BLUETOOTH, AID_BLUETOOTH, 0 }, |
103 | 102 | { "/dev/ttyHS0", 0600, AID_BLUETOOTH, AID_BLUETOOTH, 0 }, |
104 | 103 | { "/dev/uinput", 0600, AID_BLUETOOTH, AID_BLUETOOTH, 0 }, |
@@ -78,9 +78,9 @@ static void volume_setstate(volume_t *vol, volume_state_t state); | ||
78 | 78 | static char *conv_volstate_to_eventstr(volume_state_t state); |
79 | 79 | static char *conv_volstate_to_propstr(volume_state_t state); |
80 | 80 | static int volume_send_state(volume_t *vol); |
81 | -static void _cb_volstopped_for_ums_enable(volume_t *v); | |
81 | +static void _cb_volstopped_for_ums_enable(volume_t *v, void *arg); | |
82 | 82 | static int _volmgr_enable_ums(volume_t *); |
83 | -static int volmgr_shutdown_volume(volume_t *v, void (* cb) (volume_t *)); | |
83 | +static int volmgr_shutdown_volume(volume_t *v, void (* cb) (volume_t *, void *arg)); | |
84 | 84 | static int volmgr_stop_volume(volume_t *v, void (*cb) (volume_t *, void *), void *arg, int emit_statechange); |
85 | 85 | static void _cb_volume_stopped_for_eject(volume_t *v, void *arg); |
86 | 86 | static void _cb_volume_stopped_for_shutdown(volume_t *v, void *arg); |
@@ -171,7 +171,7 @@ int volmgr_stop_volume_by_mountpoint(char *mount_point) | ||
171 | 171 | while(v) { |
172 | 172 | if (!strcmp(v->mount_point, mount_point)) { |
173 | 173 | pthread_mutex_lock(&v->lock); |
174 | - if (volmgr_shutdown_volume(v, _cb_volstopped_for_ums_enable) < 0) | |
174 | + if (volmgr_shutdown_volume(v, NULL) < 0) | |
175 | 175 | LOGE("unable to shutdown volume '%s'\n", v->mount_point); |
176 | 176 | pthread_mutex_unlock(&v->lock); |
177 | 177 | return 0; |
@@ -229,13 +229,14 @@ int volmgr_enable_ums(boolean enable) | ||
229 | 229 | if (v->ums_path) { |
230 | 230 | int rc; |
231 | 231 | |
232 | - pthread_mutex_lock(&v->lock); | |
233 | 232 | if (enable) { |
233 | + pthread_mutex_lock(&v->lock); | |
234 | 234 | // Stop the volume, and enable UMS in the callback |
235 | 235 | if ((rc = volmgr_shutdown_volume(v, _cb_volstopped_for_ums_enable)) < 0) |
236 | 236 | LOGE("unable to shutdown volume '%s'\n", v->mount_point); |
237 | 237 | } else { |
238 | 238 | // Disable UMS |
239 | + pthread_mutex_lock(&v->lock); | |
239 | 240 | if ((rc = ums_disable(v->ums_path)) < 0) { |
240 | 241 | LOGE("unable to disable ums on '%s'\n", v->mount_point); |
241 | 242 | pthread_mutex_unlock(&v->lock); |
@@ -248,8 +249,8 @@ int volmgr_enable_ums(boolean enable) | ||
248 | 249 | if ((rc = _volmgr_consider_disk_and_vol(v, v->dev->disk)) < 0) { |
249 | 250 | LOGE("volmgr failed to consider disk '%s'\n", v->dev->disk->dev_fspath); |
250 | 251 | } |
252 | + pthread_mutex_unlock(&v->lock); | |
251 | 253 | } |
252 | - pthread_mutex_unlock(&v->lock); | |
253 | 254 | } |
254 | 255 | v = v->next; |
255 | 256 | } |
@@ -269,7 +270,9 @@ static int _volmgr_consider_disk_and_vol(volume_t *vol, blkdev_t *dev) | ||
269 | 270 | LOG_VOL("volmgr_consider_disk_and_vol(%s, %s):\n", vol->mount_point, dev->dev_fspath); |
270 | 271 | #endif |
271 | 272 | |
272 | - if (vol->state != volstate_nomedia && vol->state != volstate_unmounted) { | |
273 | + if (vol->state != volstate_nomedia && | |
274 | + vol->state != volstate_unmounted && | |
275 | + vol->state != volstate_badremoval) { | |
273 | 276 | LOGE("Volume manager is already handling volume '%s' (currently in state %d)\n", vol->mount_point, vol->state); |
274 | 277 | return -EADDRINUSE; |
275 | 278 | } |
@@ -467,9 +470,9 @@ static int volmgr_stop_volume(volume_t *v, void (*cb) (volume_t *, void *), void | ||
467 | 470 | /* |
468 | 471 | * Gracefully stop a volume |
469 | 472 | */ |
470 | -static int volmgr_shutdown_volume(volume_t *v, void (* cb) (volume_t *)) | |
473 | +static int volmgr_shutdown_volume(volume_t *v, void (* cb) (volume_t *, void *)) | |
471 | 474 | { |
472 | - return volmgr_stop_volume(v, NULL, cb, true); | |
475 | + return volmgr_stop_volume(v, cb, NULL, true); | |
473 | 476 | } |
474 | 477 | |
475 | 478 | static void _cb_volume_stopped_for_shutdown(volume_t *v, void *arg) |
@@ -483,15 +486,17 @@ static void _cb_volume_stopped_for_shutdown(volume_t *v, void *arg) | ||
483 | 486 | /* |
484 | 487 | * Called when a volume is sucessfully unmounted for UMS enable |
485 | 488 | */ |
486 | -static void _cb_volstopped_for_ums_enable(volume_t *v) | |
489 | +static void _cb_volstopped_for_ums_enable(volume_t *v, void *arg) | |
487 | 490 | { |
488 | 491 | int rc; |
489 | 492 | |
490 | - if ((rc = ums_enable(v->dev->dev_fspath, v->ums_path)) < 0) { | |
493 | + LOG_VOL("_cb_volstopped_for_ums_enable(%s):\n", v->dev->dev_fspath); | |
494 | + if ((rc = ums_enable(v->dev->disk->dev_fspath, v->ums_path)) < 0) { | |
491 | 495 | LOGE("Error enabling ums (%d)\n", rc); |
492 | 496 | return; |
493 | 497 | } |
494 | 498 | volume_setstate(v, volstate_ums); |
499 | + pthread_mutex_unlock(&v->lock); | |
495 | 500 | } |
496 | 501 | |
497 | 502 | static int volmgr_readconfig(char *cfg_path) |