summaryrefslogtreecommitdiffstats
path: root/NetlinkHandler.cpp
diff options
context:
space:
mode:
authorSan Mehat <san@android.com>2009-10-12 11:32:47 -0700
committerSan Mehat <san@android.com>2009-10-12 15:02:58 -0700
commitfd7f5875129adfe2845f4f3fffb17db3a89eea25 (patch)
tree5eb4230dc80b91ced9c7c45629d68f91059b1423 /NetlinkHandler.cpp
parentf1b736bc5605e92e917ab27f5abf3ba839be2270 (diff)
downloadandroid_system_vold-fd7f5875129adfe2845f4f3fffb17db3a89eea25.tar.gz
android_system_vold-fd7f5875129adfe2845f4f3fffb17db3a89eea25.tar.bz2
android_system_vold-fd7f5875129adfe2845f4f3fffb17db3a89eea25.zip
vold2: Refactor the netlink event handling and better define how partitions/disks are handled
Signed-off-by: San Mehat <san@android.com>
Diffstat (limited to 'NetlinkHandler.cpp')
-rw-r--r--NetlinkHandler.cpp33
1 files changed, 1 insertions, 32 deletions
diff --git a/NetlinkHandler.cpp b/NetlinkHandler.cpp
index 156079f..19ec932 100644
--- a/NetlinkHandler.cpp
+++ b/NetlinkHandler.cpp
@@ -44,7 +44,6 @@ int NetlinkHandler::stop() {
void NetlinkHandler::onEvent(NetlinkEvent *evt) {
VolumeManager *vm = VolumeManager::Instance();
const char *subsys = evt->getSubsystem();
- int action = evt->getAction();
if (!subsys) {
LOGW("No subsystem found in netlink event");
@@ -52,37 +51,7 @@ void NetlinkHandler::onEvent(NetlinkEvent *evt) {
}
if (!strcmp(subsys, "block")) {
- const char *devpath = evt->findParam("DEVPATH");
- const char *devtype = evt->findParam("DEVTYPE");
- int major = atoi(evt->findParam("MAJOR"));
- int minor = atoi(evt->findParam("MINOR"));
-
- LOGI("Block event %d, type %s, %d:%d, path '%s'", action, devtype, major, minor, devpath);
-
- if (!strcmp(devtype, "disk")) {
- const char *tmp = evt->findParam("NPARTS");
-
- if (!tmp) {
- LOGE("Disk uevent missing 'NPARTS' parameter");
- return;
- }
- if (action == NetlinkEvent::NlActionAdd)
- vm->handleDiskInserted(devpath, major, minor, atoi(tmp));
- else if (action == NetlinkEvent::NlActionRemove)
- vm->handleDiskRemoved(major, minor);
- } else {
- const char *tmp = evt->findParam("PARTN");
-
- if (!tmp) {
- LOGE("Partition uevent missing 'PARTN' parameter");
- return;
- }
- if (action == NetlinkEvent::NlActionAdd)
- vm->handlePartCreated(devpath, major, minor, atoi(tmp));
- else if (action == NetlinkEvent::NlActionRemove)
- vm->handlePartRemoved(major, minor);
- }
- LOGD("Block event handled");
+ vm->handleBlockEvent(evt);
} else if (!strcmp(subsys, "battery")) {
} else if (!strcmp(subsys, "power_supply")) {
} else {