fs_mount_volume() now returns a dev_t as well - changed mount/mountvolume to take

that into account as well (they were reporting an error even though everything
went fine).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14450 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-10-20 13:03:50 +00:00
parent 9949213a25
commit da6d1a7022
6 changed files with 24 additions and 23 deletions

View File

@ -1,7 +1,8 @@
/* File System volume functions
**
** Distributed under the terms of the Haiku License.
*/
*
* Copyright 2004-2005, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _FS_VOLUME_H
#define _FS_VOLUME_H
@ -20,7 +21,7 @@
extern "C" {
#endif
extern status_t fs_mount_volume(const char *where, const char *device,
extern dev_t fs_mount_volume(const char *where, const char *device,
const char *filesystem, uint32 flags, const char *parameters);
extern status_t fs_unmount_volume(const char *path, uint32 flags);

View File

@ -1,6 +1,6 @@
//----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
// This software is part of the Haiku distribution and is covered
// by the MIT license.
//---------------------------------------------------------------------
#ifndef _PARTITION_H
@ -55,10 +55,10 @@ public:
status_t GetIcon(BBitmap *icon, icon_size which) const;
status_t GetMountPoint(BPath *mountPoint) const;
status_t Mount(const char *mountPoint = NULL, uint32 mountFlags = 0,
dev_t Mount(const char *mountPoint = NULL, uint32 mountFlags = 0,
const char *parameters = NULL);
status_t Unmount(uint32 unmountFlags = 0);
// Hierarchy Info
BDiskDevice *Device() const;

View File

@ -1,7 +1,7 @@
/*
** Copyright 2001-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
** Distributed under the terms of the Haiku License.
*/
* Copyright 2001-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
/** Mounts a volume with the specified file system */
@ -33,7 +33,7 @@ main(int argc, char **argv)
const char *parameter = NULL;
const char *fs = NULL;
struct stat mountStat;
status_t status;
dev_t device;
uint32 flags = 0;
/* prettify the program name */
@ -77,9 +77,9 @@ main(int argc, char **argv)
/* do the work */
status = fs_mount_volume(mountPoint, device, fs, flags, parameter);
if (status != B_OK) {
fprintf(stderr, "%s: %s\n", programName, strerror(status));
device = fs_mount_volume(mountPoint, device, fs, flags, parameter);
if (device < B_OK) {
fprintf(stderr, "%s: %s\n", programName, strerror(device));
return -1;
}
return 0;

View File

@ -143,7 +143,7 @@ struct MountVisitor : public BDiskDeviceVisitor {
status_t error = partition->Mount(NULL,
(readOnly ? B_MOUNT_READ_ONLY : 0));
if (!silent) {
if (error == B_OK) {
if (error >= B_OK) {
printf("Volume `%s' mounted successfully.\n", name);
} else {
fprintf(stderr, "Failed to mount volume `%s': %s\n",

View File

@ -474,7 +474,7 @@ BPartition::GetMountPoint(BPath *mountPoint) const
\param parameters File system specific mount parameters.
\return \c B_OK, if everything went fine, another error code otherwise.
*/
status_t
dev_t
BPartition::Mount(const char *mountPoint, uint32 mountFlags,
const char *parameters)
{
@ -506,14 +506,14 @@ BPartition::Mount(const char *mountPoint, uint32 mountFlags,
}
// mount the partition
error = fs_mount_volume(mountPoint, partitionPath.Path(), NULL, mountFlags,
parameters);
dev_t device = fs_mount_volume(mountPoint, partitionPath.Path(), NULL,
mountFlags, parameters);
// delete the mount point on error, if we created it
if (error != B_OK && deleteMountPoint)
if (device < B_OK && deleteMountPoint)
rmdir(mountPoint);
return error;
return device;
}
// Unmount

View File

@ -1,5 +1,5 @@
/*
* Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
@ -8,7 +8,7 @@
#include <syscalls.h>
status_t
dev_t
fs_mount_volume(const char *where, const char *device,
const char *fileSystem, uint32 flags, const char *parameters)
{