Merge "Clean up any/all stale partition tables." into mnc-dr-dev

gugelfrei
Jeff Sharkey 9 years ago committed by Android (Google) Code Review
commit cb42a40a87

@ -340,10 +340,24 @@ status_t Disk::unmountAll() {
}
status_t Disk::partitionPublic() {
int res;
// TODO: improve this code
destroyAllVolumes();
mJustPartitioned = true;
// First nuke any existing partition table
std::vector<std::string> cmd;
cmd.push_back(kSgdiskPath);
cmd.push_back("--zap-all");
cmd.push_back(mDevPath);
// Zap sometimes returns an error when it actually succeeded, so
// just log as warning and keep rolling forward.
if ((res = ForkExecvp(cmd)) != 0) {
LOG(WARNING) << "Failed to zap; status " << res;
}
struct disk_info dinfo;
memset(&dinfo, 0, sizeof(dinfo));

Loading…
Cancel
Save