Use unique_fd
Also allow the state just before doMount() as a valid state for setting
fuse fd.
Test: manual
BUG:140173712
Change-Id: I012f8a83fef00e68f33010954fbc2ebc53cf8f1d
diff --git a/model/VolumeBase.h b/model/VolumeBase.h
index fa9eee4..6afb88e 100644
--- a/model/VolumeBase.h
+++ b/model/VolumeBase.h
@@ -87,7 +87,7 @@
State getState() const { return mState; }
const std::string& getPath() const { return mPath; }
const std::string& getInternalPath() const { return mInternalPath; }
- int getDeviceFd() const { return dup(mDeviceFd.get()); }
+ const android::base::unique_fd& getFuseFd() const { return mFuseFd; }
status_t setDiskId(const std::string& diskId);
status_t setPartGuid(const std::string& partGuid);
@@ -122,7 +122,7 @@
status_t setId(const std::string& id);
status_t setPath(const std::string& path);
status_t setInternalPath(const std::string& internalPath);
- status_t setDeviceFd(int deviceFd);
+ status_t setFuseFd(android::base::unique_fd fuseFd);
android::sp<android::os::IVoldListener> getListener() const;
@@ -150,7 +150,7 @@
/* Flag indicating that volume should emit no events */
bool mSilent;
/* The filedescriptor for the fuse device, if the volume uses fuse, or -1 otherwise */
- android::base::unique_fd mDeviceFd;
+ android::base::unique_fd mFuseFd;
/* Volumes stacked on top of this volume */
std::list<std::shared_ptr<VolumeBase>> mVolumes;