diff options
author | Ethan <ethan.too@gmail.com> | 2010-07-21 23:07:51 +0800 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2010-08-30 09:07:59 -0700 |
commit | 75a3e1a95af0a2790de1b12aeca0008bfdc61649 (patch) | |
tree | 3f44e7592711a918c660e85a085aa26a8429d6ea /DirectVolume.cpp | |
parent | 826bec79ea253505813d125700a12816e2c3bc0f (diff) | |
download | system_vold-75a3e1a95af0a2790de1b12aeca0008bfdc61649.tar.gz system_vold-75a3e1a95af0a2790de1b12aeca0008bfdc61649.tar.bz2 system_vold-75a3e1a95af0a2790de1b12aeca0008bfdc61649.zip |
VOLD - make volume daemon to handle state change from shared to no_media
When volume state changed from shared to no_media,
volume is not properly unshared.
Change-Id: I0117d67da95440d982275746a166ef6f4ac1c0e2
Signed-off-by: Ethan <ethan.too@gmail.com>
Diffstat (limited to 'DirectVolume.cpp')
-rw-r--r-- | DirectVolume.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/DirectVolume.cpp b/DirectVolume.cpp index 23a21a0..02c83d1 100644 --- a/DirectVolume.cpp +++ b/DirectVolume.cpp @@ -266,6 +266,7 @@ void DirectVolume::handlePartitionRemoved(const char *devpath, NetlinkEvent *evt int major = atoi(evt->findParam("MAJOR")); int minor = atoi(evt->findParam("MINOR")); char msg[255]; + int state; SLOGD("Volume %s %s partition %d:%d removed\n", getLabel(), getMountpoint(), major, minor); @@ -275,7 +276,8 @@ void DirectVolume::handlePartitionRemoved(const char *devpath, NetlinkEvent *evt * the removal notification will be sent on the Disk * itself */ - if (getState() != Volume::State_Mounted) { + state = getState(); + if (state != Volume::State_Mounted && state != Volume::State_Shared) { return; } @@ -300,6 +302,19 @@ void DirectVolume::handlePartitionRemoved(const char *devpath, NetlinkEvent *evt } else { SLOGD("Crisis averted"); } + } else if (state == Volume::State_Shared) { + /* removed during mass storage */ + snprintf(msg, sizeof(msg), "Volume %s bad removal (%d:%d)", + getLabel(), major, minor); + mVm->getBroadcaster()->sendBroadcast(ResponseCode::VolumeBadRemoval, + msg, false); + + if (mVm->unshareVolume(getLabel(), "ums")) { + SLOGE("Failed to unshare volume on bad removal (%s)", + strerror(errno)); + } else { + SLOGD("Crisis averted"); + } } } |