From da6d1a7022b1c7a4f0f6fba0dc60ffe0a57958da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 20 Oct 2005 13:03:50 +0000 Subject: [PATCH] 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 --- headers/os/kernel/fs_volume.h | 9 +++++---- headers/private/storage/Partition.h | 8 ++++---- src/bin/mount.c | 14 +++++++------- src/bin/mountvolume.cpp | 2 +- src/kits/storage/Partition.cpp | 10 +++++----- src/system/libroot/os/fs_volume.c | 4 ++-- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/headers/os/kernel/fs_volume.h b/headers/os/kernel/fs_volume.h index dadb3d377a..84f34ed5bc 100644 --- a/headers/os/kernel/fs_volume.h +++ b/headers/os/kernel/fs_volume.h @@ -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); diff --git a/headers/private/storage/Partition.h b/headers/private/storage/Partition.h index ea05e38f9b..8113a9107e 100644 --- a/headers/private/storage/Partition.h +++ b/headers/private/storage/Partition.h @@ -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; diff --git a/src/bin/mount.c b/src/bin/mount.c index fb78f673b7..a6421a52df 100644 --- a/src/bin/mount.c +++ b/src/bin/mount.c @@ -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; diff --git a/src/bin/mountvolume.cpp b/src/bin/mountvolume.cpp index 588dd7e6f3..7ea1095c76 100644 --- a/src/bin/mountvolume.cpp +++ b/src/bin/mountvolume.cpp @@ -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", diff --git a/src/kits/storage/Partition.cpp b/src/kits/storage/Partition.cpp index 0ace6b68d2..bcc217caa7 100644 --- a/src/kits/storage/Partition.cpp +++ b/src/kits/storage/Partition.cpp @@ -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 diff --git a/src/system/libroot/os/fs_volume.c b/src/system/libroot/os/fs_volume.c index 21aeb8c876..54e5b8fb92 100644 --- a/src/system/libroot/os/fs_volume.c +++ b/src/system/libroot/os/fs_volume.c @@ -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 -status_t +dev_t fs_mount_volume(const char *where, const char *device, const char *fileSystem, uint32 flags, const char *parameters) {