Ticket #9672: fixv5.patch

File fixv5.patch, 2.2 KB (added by puckipedia, 10 years ago)

Second version of the fix

  • headers/private/storage/Partition.h

    From 98b6dcc99003806dbfd8c232c750e7ebce82029e Mon Sep 17 00:00:00 2001
    From: Puck Meerburg <puck@puckipedia.nl>
    Date: Sun, 22 Dec 2013 22:41:42 +0000
    Subject: [PATCH] BPartition: Move dev_t return value to an optional parameter
    
    ---
     headers/private/storage/Partition.h        |  5 +++--
     src/kits/storage/disk_device/Partition.cpp | 14 +++++++++-----
     2 files changed, 12 insertions(+), 7 deletions(-)
    
    diff --git a/headers/private/storage/Partition.h b/headers/private/storage/Partition.h
    index 2f897c6..5ef98d0 100644
    a b public:  
    6868                                    type_code* _type) const;
    6969            status_t            GetMountPoint(BPath* mountPoint) const;
    7070
    71             dev_t               Mount(const char* mountPoint = NULL,
     71            status_t            Mount(const char* mountPoint = NULL,
    7272                                    uint32 mountFlags = 0,
    73                                     const char* parameters = NULL);
     73                                    const char* parameters = NULL,
     74                                    dev_t* devicePointer = NULL);
    7475            status_t            Unmount(uint32 unmountFlags = 0);
    7576
    7677    // Hierarchy Info
  • src/kits/storage/disk_device/Partition.cpp

    diff --git a/src/kits/storage/disk_device/Partition.cpp b/src/kits/storage/disk_device/Partition.cpp
    index c1bb3d6..8a6cce8 100644
    a b BPartition::GetMountPoint(BPath* mountPoint) const  
    518518    \param mountFlags Currently only \c B_MOUNT_READ_ONLY is defined, which
    519519           forces the volume to be mounted read-only.
    520520    \param parameters File system specific mount parameters.
     521    \param devicePointer Reference to the mounted filesystem for the programs
     522            interested in it
    521523    \return \c B_OK, if everything went fine, another error code otherwise.
    522524*/
    523 dev_t
     525status_t
    524526BPartition::Mount(const char* mountPoint, uint32 mountFlags,
    525     const char* parameters)
     527    const char* parameters, dev_t* devicePointer)
    526528{
    527529    if (IsMounted() || !ContainsFileSystem())
    528530        return B_BAD_VALUE;
    BPartition::Mount(const char* mountPoint, uint32 mountFlags,  
    569571    }
    570572
    571573    // update object, if successful
    572     if (device >= 0)
     574    if (device >= 0) {
    573575        error = Device()->Update();
    574 
    575     return device;
     576        *devicePointer = device;
     577        return error;
     578    }
     579    return B_ERROR;
    576580}
    577581
    578582