BPartition: Move dev_t return value to an optional parameter

Signed-off-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
This commit is contained in:
Puck Meerburg 2013-12-22 22:41:42 +00:00 committed by Jessica Hamilton
parent fcc65d4a33
commit 8bfb30ceb3
2 changed files with 13 additions and 7 deletions

View File

@ -68,9 +68,10 @@ public:
type_code* _type) const; type_code* _type) const;
status_t GetMountPoint(BPath* mountPoint) const; status_t GetMountPoint(BPath* mountPoint) const;
dev_t Mount(const char* mountPoint = NULL, status_t Mount(const char* mountPoint = NULL,
uint32 mountFlags = 0, uint32 mountFlags = 0,
const char* parameters = NULL); const char* parameters = NULL,
dev_t* devicePointer = NULL);
status_t Unmount(uint32 unmountFlags = 0); status_t Unmount(uint32 unmountFlags = 0);
// Hierarchy Info // Hierarchy Info

View File

@ -518,11 +518,13 @@ BPartition::GetMountPoint(BPath* mountPoint) const
\param mountFlags Currently only \c B_MOUNT_READ_ONLY is defined, which \param mountFlags Currently only \c B_MOUNT_READ_ONLY is defined, which
forces the volume to be mounted read-only. forces the volume to be mounted read-only.
\param parameters File system specific mount parameters. \param parameters File system specific mount parameters.
\param devicePointer Reference to the mounted filesystem for the programs
interested in it
\return \c B_OK, if everything went fine, another error code otherwise. \return \c B_OK, if everything went fine, another error code otherwise.
*/ */
dev_t status_t
BPartition::Mount(const char* mountPoint, uint32 mountFlags, BPartition::Mount(const char* mountPoint, uint32 mountFlags,
const char* parameters) const char* parameters, dev_t* devicePointer)
{ {
if (IsMounted() || !ContainsFileSystem()) if (IsMounted() || !ContainsFileSystem())
return B_BAD_VALUE; return B_BAD_VALUE;
@ -569,10 +571,13 @@ BPartition::Mount(const char* mountPoint, uint32 mountFlags,
} }
// update object, if successful // update object, if successful
if (device >= 0) if (device >= 0) {
error = Device()->Update(); error = Device()->Update();
if (devicePointer != NULL)
return device; *devicePointer = device;
return error;
}
return B_ERROR;
} }