Exclusive exec() path, format after partition.
Sadly setexeccon() is process global, so we need to carefully ensure
that all exec() are mutually exclusive to avoid transitioning into
unwanted domains. Also, because we have several threads floating
around, we need to guard all our FDs with O_CLOEXEC.
Format all newly created volumes immediately after partitioning,
but silence all events emitted from those volumes to prevent the
framework from getting all excited. Unify all notify events under a
single codepath to make them easy to silence.
Sent SIGINT before escalating to SIGTERM when unmounting.
Bug: 19993667
Change-Id: Idc6c806afc7919a004a93e2240b42884f6b52d6b
diff --git a/Disk.h b/Disk.h
index 82ef1f5..a8461fb 100644
--- a/Disk.h
+++ b/Disk.h
@@ -74,6 +74,9 @@
status_t partitionPrivate();
status_t partitionMixed(int8_t ratio);
+ void notifyEvent(int msg);
+ void notifyEvent(int msg, const std::string& value);
+
private:
/* ID that uniquely references this disk */
std::string mId;
@@ -97,6 +100,8 @@
int mFlags;
/* Flag indicating object is created */
bool mCreated;
+ /* Flag that we just partitioned and should format all volumes */
+ bool mJustPartitioned;
void createPublicVolume(dev_t device);
void createPrivateVolume(dev_t device, const std::string& partGuid);