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
+5 -4
View File
@@ -1,7 +1,8 @@
/* File System volume functions /* 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 #ifndef _FS_VOLUME_H
#define _FS_VOLUME_H #define _FS_VOLUME_H
@@ -20,7 +21,7 @@
extern "C" { extern "C" {
#endif #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); const char *filesystem, uint32 flags, const char *parameters);
extern status_t fs_unmount_volume(const char *path, uint32 flags); extern status_t fs_unmount_volume(const char *path, uint32 flags);
+4 -4
View File
@@ -1,6 +1,6 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered // This software is part of the Haiku distribution and is covered
// by the OpenBeOS license. // by the MIT license.
//--------------------------------------------------------------------- //---------------------------------------------------------------------
#ifndef _PARTITION_H #ifndef _PARTITION_H
@@ -55,10 +55,10 @@ public:
status_t GetIcon(BBitmap *icon, icon_size which) const; status_t GetIcon(BBitmap *icon, icon_size which) const;
status_t GetMountPoint(BPath *mountPoint) 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); const char *parameters = NULL);
status_t Unmount(uint32 unmountFlags = 0); status_t Unmount(uint32 unmountFlags = 0);
// Hierarchy Info // Hierarchy Info
BDiskDevice *Device() const; BDiskDevice *Device() const;
+7 -7
View File
@@ -1,7 +1,7 @@
/* /*
** Copyright 2001-2004, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2001-2005, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the Haiku License. * Distributed under the terms of the MIT License.
*/ */
/** Mounts a volume with the specified file system */ /** Mounts a volume with the specified file system */
@@ -33,7 +33,7 @@ main(int argc, char **argv)
const char *parameter = NULL; const char *parameter = NULL;
const char *fs = NULL; const char *fs = NULL;
struct stat mountStat; struct stat mountStat;
status_t status; dev_t device;
uint32 flags = 0; uint32 flags = 0;
/* prettify the program name */ /* prettify the program name */
@@ -77,9 +77,9 @@ main(int argc, char **argv)
/* do the work */ /* do the work */
status = fs_mount_volume(mountPoint, device, fs, flags, parameter); device = fs_mount_volume(mountPoint, device, fs, flags, parameter);
if (status != B_OK) { if (device < B_OK) {
fprintf(stderr, "%s: %s\n", programName, strerror(status)); fprintf(stderr, "%s: %s\n", programName, strerror(device));
return -1; return -1;
} }
return 0; return 0;
+1 -1
View File
@@ -143,7 +143,7 @@ struct MountVisitor : public BDiskDeviceVisitor {
status_t error = partition->Mount(NULL, status_t error = partition->Mount(NULL,
(readOnly ? B_MOUNT_READ_ONLY : 0)); (readOnly ? B_MOUNT_READ_ONLY : 0));
if (!silent) { if (!silent) {
if (error == B_OK) { if (error >= B_OK) {
printf("Volume `%s' mounted successfully.\n", name); printf("Volume `%s' mounted successfully.\n", name);
} else { } else {
fprintf(stderr, "Failed to mount volume `%s': %s\n", fprintf(stderr, "Failed to mount volume `%s': %s\n",
+5 -5
View File
@@ -474,7 +474,7 @@ BPartition::GetMountPoint(BPath *mountPoint) const
\param parameters File system specific mount parameters. \param parameters File system specific mount parameters.
\return \c B_OK, if everything went fine, another error code otherwise. \return \c B_OK, if everything went fine, another error code otherwise.
*/ */
status_t dev_t
BPartition::Mount(const char *mountPoint, uint32 mountFlags, BPartition::Mount(const char *mountPoint, uint32 mountFlags,
const char *parameters) const char *parameters)
{ {
@@ -506,14 +506,14 @@ BPartition::Mount(const char *mountPoint, uint32 mountFlags,
} }
// mount the partition // mount the partition
error = fs_mount_volume(mountPoint, partitionPath.Path(), NULL, mountFlags, dev_t device = fs_mount_volume(mountPoint, partitionPath.Path(), NULL,
parameters); mountFlags, parameters);
// delete the mount point on error, if we created it // delete the mount point on error, if we created it
if (error != B_OK && deleteMountPoint) if (device < B_OK && deleteMountPoint)
rmdir(mountPoint); rmdir(mountPoint);
return error; return device;
} }
// Unmount // Unmount
+2 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2004, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2004-2005, Axel Dörfler, [email protected]. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -8,7 +8,7 @@
#include <syscalls.h> #include <syscalls.h>
status_t dev_t
fs_mount_volume(const char *where, const char *device, fs_mount_volume(const char *where, const char *device,
const char *fileSystem, uint32 flags, const char *parameters) const char *fileSystem, uint32 flags, const char *parameters)
{ {