From 7ae0d342bed519834bad1ac79f4904bcc9a678a7 Mon Sep 17 00:00:00 2001
From: Puck Meerburg <puck@puckipedia.nl>
Date: Thu, 19 Dec 2013 21:14:56 +0000
Subject: [PATCH] BPartition: Move dev_t return value to an optional parameter
(fixes small issues)
---
headers/private/storage/Partition.h | 5 +++--
src/kits/storage/disk_device/Partition.cpp | 17 ++++++++++++-----
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/headers/private/storage/Partition.h b/headers/private/storage/Partition.h
index 2f897c6..5ef98d0 100644
a
|
b
|
public:
|
68 | 68 | type_code* _type) const; |
69 | 69 | status_t GetMountPoint(BPath* mountPoint) const; |
70 | 70 | |
71 | | dev_t Mount(const char* mountPoint = NULL, |
| 71 | status_t Mount(const char* mountPoint = NULL, |
72 | 72 | uint32 mountFlags = 0, |
73 | | const char* parameters = NULL); |
| 73 | const char* parameters = NULL, |
| 74 | dev_t* devicePointer = NULL); |
74 | 75 | status_t Unmount(uint32 unmountFlags = 0); |
75 | 76 | |
76 | 77 | // Hierarchy Info |
diff --git a/src/kits/storage/disk_device/Partition.cpp b/src/kits/storage/disk_device/Partition.cpp
index c1bb3d6..87d884d 100644
a
|
b
|
BPartition::GetMountPoint(BPath* mountPoint) const
|
518 | 518 | \param mountFlags Currently only \c B_MOUNT_READ_ONLY is defined, which |
519 | 519 | forces the volume to be mounted read-only. |
520 | 520 | \param parameters File system specific mount parameters. |
| 521 | \param devicePointer Reference to the mounted filesystem for the programs |
| 522 | interested in it |
521 | 523 | \return \c B_OK, if everything went fine, another error code otherwise. |
522 | 524 | */ |
523 | | dev_t |
| 525 | status_t |
524 | 526 | BPartition::Mount(const char* mountPoint, uint32 mountFlags, |
525 | | const char* parameters) |
| 527 | const char* parameters, dev_t* devicePointer) |
526 | 528 | { |
527 | 529 | if (IsMounted() || !ContainsFileSystem()) |
528 | 530 | return B_BAD_VALUE; |
… |
… |
BPartition::Mount(const char* mountPoint, uint32 mountFlags,
|
568 | 570 | rmdir(mountPoint); |
569 | 571 | } |
570 | 572 | |
| 573 | // Update reference to device |
| 574 | if(devicePointer != NULL) |
| 575 | *devicePointer = device; |
| 576 | |
571 | 577 | // update object, if successful |
572 | | if (device >= 0) |
| 578 | if (device >= 0) { |
573 | 579 | error = Device()->Update(); |
574 | | |
575 | | return device; |
| 580 | return error; |
| 581 | } |
| 582 | return B_ERROR; |
576 | 583 | } |
577 | 584 | |
578 | 585 | |