fs_unmount_volume() gets a path to the mount point, not the (eventual) device

behind the mount point; BPartition::Unmount() would never unmount a volume.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19894 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-01-21 18:44:20 +00:00
parent 83dd342c4a
commit 9353267722
+24 -19
View File
@@ -1,12 +1,14 @@
//---------------------------------------------------------------------- /*
// This software is part of the Haiku distribution and is covered * Copyright 2003-2007, Haiku, Inc. All Rights Reserved.
// by the MIT license. * Distributed under the terms of the MIT License.
//--------------------------------------------------------------------- *
* Authors:
* Ingo Weinhold, [email protected]
*/
#include <errno.h>
#include <new> #include <syscalls.h>
#include <unistd.h> #include <disk_device_manager/ddm_userland_interface.h>
#include <sys/stat.h>
#include <Directory.h> #include <Directory.h>
#include <DiskDevice.h> #include <DiskDevice.h>
@@ -21,8 +23,11 @@
#include <String.h> #include <String.h>
#include <Volume.h> #include <Volume.h>
#include <syscalls.h> #include <errno.h>
#include <disk_device_manager/ddm_userland_interface.h> #include <new>
#include <unistd.h>
#include <sys/stat.h>
using std::nothrow; using std::nothrow;
@@ -537,23 +542,23 @@ BPartition::Mount(const char *mountPoint, uint32 mountFlags,
status_t status_t
BPartition::Unmount(uint32 unmountFlags) BPartition::Unmount(uint32 unmountFlags)
{ {
if (!fPartitionData || !IsMounted()) if (fPartitionData == NULL || !IsMounted())
return B_BAD_VALUE; return B_BAD_VALUE;
// get the partition path // get the partition path
BPath partitionPath; BPath path;
status_t error = GetPath(&partitionPath); status_t status = GetMountPoint(&path);
if (error != B_OK) if (status != B_OK)
return error; return status;
// unmount // unmount
error = fs_unmount_volume(partitionPath.Path(), unmountFlags); status = fs_unmount_volume(path.Path(), unmountFlags);
// update object, if successful // update object, if successful
if (error == B_OK) if (status == B_OK)
error = Device()->Update(); status = Device()->Update();
return error; return status;
} }
// Device // Device