From 8bfb30ceb34798ab2d51a700ffe56b9a26528421 Mon Sep 17 00:00:00 2001 From: Puck Meerburg Date: Sun, 22 Dec 2013 22:41:42 +0000 Subject: [PATCH] BPartition: Move dev_t return value to an optional parameter Signed-off-by: Jessica Hamilton --- headers/private/storage/Partition.h | 5 +++-- src/kits/storage/disk_device/Partition.cpp | 15 ++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/headers/private/storage/Partition.h b/headers/private/storage/Partition.h index 2f897c680e..5ef98d015d 100644 --- a/headers/private/storage/Partition.h +++ b/headers/private/storage/Partition.h @@ -68,9 +68,10 @@ public: type_code* _type) const; status_t GetMountPoint(BPath* mountPoint) const; - dev_t Mount(const char* mountPoint = NULL, + status_t Mount(const char* mountPoint = NULL, uint32 mountFlags = 0, - const char* parameters = NULL); + const char* parameters = NULL, + dev_t* devicePointer = NULL); status_t Unmount(uint32 unmountFlags = 0); // Hierarchy Info diff --git a/src/kits/storage/disk_device/Partition.cpp b/src/kits/storage/disk_device/Partition.cpp index c1bb3d6449..9e25b38f11 100644 --- a/src/kits/storage/disk_device/Partition.cpp +++ b/src/kits/storage/disk_device/Partition.cpp @@ -518,11 +518,13 @@ BPartition::GetMountPoint(BPath* mountPoint) const \param mountFlags Currently only \c B_MOUNT_READ_ONLY is defined, which forces the volume to be mounted read-only. \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. */ -dev_t +status_t BPartition::Mount(const char* mountPoint, uint32 mountFlags, - const char* parameters) + const char* parameters, dev_t* devicePointer) { if (IsMounted() || !ContainsFileSystem()) return B_BAD_VALUE; @@ -569,10 +571,13 @@ BPartition::Mount(const char* mountPoint, uint32 mountFlags, } // update object, if successful - if (device >= 0) + if (device >= 0) { error = Device()->Update(); - - return device; + if (devicePointer != NULL) + *devicePointer = device; + return error; + } + return B_ERROR; }