Merge "Remove coldboot from vold" am: cc29c526d4
am: 9a2e29fe32
am: 78bf4cbb12
Change-Id: Idbeaf5ef67d59318507a83ad988a6dff45356b2b
This commit is contained in:
commit
787930f5b6
2 changed files with 2 additions and 49 deletions
|
@ -350,6 +350,7 @@ void VolumeManager::handleBlockEvent(NetlinkEvent *evt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VolumeManager::addDiskSource(const std::shared_ptr<DiskSource>& diskSource) {
|
void VolumeManager::addDiskSource(const std::shared_ptr<DiskSource>& diskSource) {
|
||||||
|
std::lock_guard<std::mutex> lock(mLock);
|
||||||
mDiskSources.push_back(diskSource);
|
mDiskSources.push_back(diskSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
50
main.cpp
50
main.cpp
|
@ -36,11 +36,9 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <dirent.h>
|
|
||||||
#include <fs_mgr.h>
|
#include <fs_mgr.h>
|
||||||
|
|
||||||
static int process_config(VolumeManager *vm, bool* has_adoptable);
|
static int process_config(VolumeManager *vm, bool* has_adoptable);
|
||||||
static void coldboot(const char *path);
|
|
||||||
static void parse_args(int argc, char** argv);
|
static void parse_args(int argc, char** argv);
|
||||||
|
|
||||||
struct fstab *fstab;
|
struct fstab *fstab;
|
||||||
|
@ -117,9 +115,6 @@ int main(int argc, char** argv) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
coldboot("/sys/block");
|
|
||||||
// coldboot("/sys/class/switch");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now that we're up, we can respond to commands
|
* Now that we're up, we can respond to commands
|
||||||
*/
|
*/
|
||||||
|
@ -139,7 +134,7 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
// Eventually we'll become the monitoring thread
|
// Eventually we'll become the monitoring thread
|
||||||
while(1) {
|
while(1) {
|
||||||
sleep(1000);
|
pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(ERROR) << "Vold exiting";
|
LOG(ERROR) << "Vold exiting";
|
||||||
|
@ -170,49 +165,6 @@ static void parse_args(int argc, char** argv) {
|
||||||
CHECK(android::vold::sFsckUntrustedContext != nullptr);
|
CHECK(android::vold::sFsckUntrustedContext != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_coldboot(DIR *d, int lvl) {
|
|
||||||
struct dirent *de;
|
|
||||||
int dfd, fd;
|
|
||||||
|
|
||||||
dfd = dirfd(d);
|
|
||||||
|
|
||||||
fd = openat(dfd, "uevent", O_WRONLY | O_CLOEXEC);
|
|
||||||
if(fd >= 0) {
|
|
||||||
write(fd, "add\n", 4);
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
while((de = readdir(d))) {
|
|
||||||
DIR *d2;
|
|
||||||
|
|
||||||
if (de->d_name[0] == '.')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (de->d_type != DT_DIR && lvl > 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
fd = openat(dfd, de->d_name, O_RDONLY | O_DIRECTORY);
|
|
||||||
if(fd < 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
d2 = fdopendir(fd);
|
|
||||||
if(d2 == 0)
|
|
||||||
close(fd);
|
|
||||||
else {
|
|
||||||
do_coldboot(d2, lvl + 1);
|
|
||||||
closedir(d2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void coldboot(const char *path) {
|
|
||||||
DIR *d = opendir(path);
|
|
||||||
if(d) {
|
|
||||||
do_coldboot(d, 0);
|
|
||||||
closedir(d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int process_config(VolumeManager *vm, bool* has_adoptable) {
|
static int process_config(VolumeManager *vm, bool* has_adoptable) {
|
||||||
std::string path(android::vold::DefaultFstabPath());
|
std::string path(android::vold::DefaultFstabPath());
|
||||||
fstab = fs_mgr_read_fstab(path.c_str());
|
fstab = fs_mgr_read_fstab(path.c_str());
|
||||||
|
|
Loading…
Reference in a new issue