Merge "Create new mount directory /mnt/runtime/full."

am: b9fae464fc

Change-Id: I33a72f65d938bfb3132b6440e5cd1d9e791600c6
This commit is contained in:
Sudheer Shanka 2019-01-18 16:52:45 -08:00 committed by android-build-merger
commit f6c3c77f6c
4 changed files with 18 additions and 6 deletions

View file

@ -65,18 +65,20 @@ status_t EmulatedVolume::doMount() {
mFuseDefault = StringPrintf("/mnt/runtime/default/%s", label.c_str()); mFuseDefault = StringPrintf("/mnt/runtime/default/%s", label.c_str());
mFuseRead = StringPrintf("/mnt/runtime/read/%s", label.c_str()); mFuseRead = StringPrintf("/mnt/runtime/read/%s", label.c_str());
mFuseWrite = StringPrintf("/mnt/runtime/write/%s", label.c_str()); mFuseWrite = StringPrintf("/mnt/runtime/write/%s", label.c_str());
mFuseFull = StringPrintf("/mnt/runtime/full/%s", label.c_str());
setInternalPath(mRawPath); setInternalPath(mRawPath);
setPath(StringPrintf("/storage/%s", label.c_str())); setPath(StringPrintf("/storage/%s", label.c_str()));
if (fs_prepare_dir(mFuseDefault.c_str(), 0700, AID_ROOT, AID_ROOT) || if (fs_prepare_dir(mFuseDefault.c_str(), 0700, AID_ROOT, AID_ROOT) ||
fs_prepare_dir(mFuseRead.c_str(), 0700, AID_ROOT, AID_ROOT) || fs_prepare_dir(mFuseRead.c_str(), 0700, AID_ROOT, AID_ROOT) ||
fs_prepare_dir(mFuseWrite.c_str(), 0700, AID_ROOT, AID_ROOT)) { fs_prepare_dir(mFuseWrite.c_str(), 0700, AID_ROOT, AID_ROOT) ||
fs_prepare_dir(mFuseFull.c_str(), 0700, AID_ROOT, AID_ROOT)) {
PLOG(ERROR) << getId() << " failed to create mount points"; PLOG(ERROR) << getId() << " failed to create mount points";
return -errno; return -errno;
} }
dev_t before = GetDevice(mFuseWrite); dev_t before = GetDevice(mFuseFull);
if (!(mFusePid = fork())) { if (!(mFusePid = fork())) {
// clang-format off // clang-format off
@ -104,7 +106,7 @@ status_t EmulatedVolume::doMount() {
} }
nsecs_t start = systemTime(SYSTEM_TIME_BOOTTIME); nsecs_t start = systemTime(SYSTEM_TIME_BOOTTIME);
while (before == GetDevice(mFuseWrite)) { while (before == GetDevice(mFuseFull)) {
LOG(DEBUG) << "Waiting for FUSE to spin up..."; LOG(DEBUG) << "Waiting for FUSE to spin up...";
usleep(50000); // 50ms usleep(50000); // 50ms
@ -130,14 +132,17 @@ status_t EmulatedVolume::doUnmount() {
ForceUnmount(mFuseDefault); ForceUnmount(mFuseDefault);
ForceUnmount(mFuseRead); ForceUnmount(mFuseRead);
ForceUnmount(mFuseWrite); ForceUnmount(mFuseWrite);
ForceUnmount(mFuseFull);
rmdir(mFuseDefault.c_str()); rmdir(mFuseDefault.c_str());
rmdir(mFuseRead.c_str()); rmdir(mFuseRead.c_str());
rmdir(mFuseWrite.c_str()); rmdir(mFuseWrite.c_str());
rmdir(mFuseFull.c_str());
mFuseDefault.clear(); mFuseDefault.clear();
mFuseRead.clear(); mFuseRead.clear();
mFuseWrite.clear(); mFuseWrite.clear();
mFuseFull.clear();
return OK; return OK;
} }

View file

@ -52,6 +52,7 @@ class EmulatedVolume : public VolumeBase {
std::string mFuseDefault; std::string mFuseDefault;
std::string mFuseRead; std::string mFuseRead;
std::string mFuseWrite; std::string mFuseWrite;
std::string mFuseFull;
/* PID of FUSE wrapper */ /* PID of FUSE wrapper */
pid_t mFusePid; pid_t mFusePid;

View file

@ -119,6 +119,7 @@ status_t PublicVolume::doMount() {
mFuseDefault = StringPrintf("/mnt/runtime/default/%s", stableName.c_str()); mFuseDefault = StringPrintf("/mnt/runtime/default/%s", stableName.c_str());
mFuseRead = StringPrintf("/mnt/runtime/read/%s", stableName.c_str()); mFuseRead = StringPrintf("/mnt/runtime/read/%s", stableName.c_str());
mFuseWrite = StringPrintf("/mnt/runtime/write/%s", stableName.c_str()); mFuseWrite = StringPrintf("/mnt/runtime/write/%s", stableName.c_str());
mFuseFull = StringPrintf("/mnt/runtime/full/%s", stableName.c_str());
setInternalPath(mRawPath); setInternalPath(mRawPath);
if (getMountFlags() & MountFlags::kVisible) { if (getMountFlags() & MountFlags::kVisible) {
@ -156,12 +157,13 @@ status_t PublicVolume::doMount() {
if (fs_prepare_dir(mFuseDefault.c_str(), 0700, AID_ROOT, AID_ROOT) || if (fs_prepare_dir(mFuseDefault.c_str(), 0700, AID_ROOT, AID_ROOT) ||
fs_prepare_dir(mFuseRead.c_str(), 0700, AID_ROOT, AID_ROOT) || fs_prepare_dir(mFuseRead.c_str(), 0700, AID_ROOT, AID_ROOT) ||
fs_prepare_dir(mFuseWrite.c_str(), 0700, AID_ROOT, AID_ROOT)) { fs_prepare_dir(mFuseWrite.c_str(), 0700, AID_ROOT, AID_ROOT) ||
fs_prepare_dir(mFuseFull.c_str(), 0700, AID_ROOT, AID_ROOT)) {
PLOG(ERROR) << getId() << " failed to create FUSE mount points"; PLOG(ERROR) << getId() << " failed to create FUSE mount points";
return -errno; return -errno;
} }
dev_t before = GetDevice(mFuseWrite); dev_t before = GetDevice(mFuseFull);
if (!(mFusePid = fork())) { if (!(mFusePid = fork())) {
if (getMountFlags() & MountFlags::kPrimary) { if (getMountFlags() & MountFlags::kPrimary) {
@ -201,7 +203,7 @@ status_t PublicVolume::doMount() {
} }
nsecs_t start = systemTime(SYSTEM_TIME_BOOTTIME); nsecs_t start = systemTime(SYSTEM_TIME_BOOTTIME);
while (before == GetDevice(mFuseWrite)) { while (before == GetDevice(mFuseFull)) {
LOG(DEBUG) << "Waiting for FUSE to spin up..."; LOG(DEBUG) << "Waiting for FUSE to spin up...";
usleep(50000); // 50ms usleep(50000); // 50ms
@ -230,16 +232,19 @@ status_t PublicVolume::doUnmount() {
ForceUnmount(mFuseDefault); ForceUnmount(mFuseDefault);
ForceUnmount(mFuseRead); ForceUnmount(mFuseRead);
ForceUnmount(mFuseWrite); ForceUnmount(mFuseWrite);
ForceUnmount(mFuseFull);
ForceUnmount(mRawPath); ForceUnmount(mRawPath);
rmdir(mFuseDefault.c_str()); rmdir(mFuseDefault.c_str());
rmdir(mFuseRead.c_str()); rmdir(mFuseRead.c_str());
rmdir(mFuseWrite.c_str()); rmdir(mFuseWrite.c_str());
rmdir(mFuseFull.c_str());
rmdir(mRawPath.c_str()); rmdir(mRawPath.c_str());
mFuseDefault.clear(); mFuseDefault.clear();
mFuseRead.clear(); mFuseRead.clear();
mFuseWrite.clear(); mFuseWrite.clear();
mFuseFull.clear();
mRawPath.clear(); mRawPath.clear();
return OK; return OK;

View file

@ -63,6 +63,7 @@ class PublicVolume : public VolumeBase {
std::string mFuseDefault; std::string mFuseDefault;
std::string mFuseRead; std::string mFuseRead;
std::string mFuseWrite; std::string mFuseWrite;
std::string mFuseFull;
/* PID of FUSE wrapper */ /* PID of FUSE wrapper */
pid_t mFusePid; pid_t mFusePid;