From 92eb857652e85f671d5e5deacc580d72b62436c7 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 27 Oct 2004 21:56:38 +0000 Subject: [PATCH] Used KPath where possible. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9550 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../KPhysicalPartition.cpp | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/kernel/core/disk_device_manager/KPhysicalPartition.cpp b/src/kernel/core/disk_device_manager/KPhysicalPartition.cpp index b99eedad8b..c397dfc281 100644 --- a/src/kernel/core/disk_device_manager/KPhysicalPartition.cpp +++ b/src/kernel/core/disk_device_manager/KPhysicalPartition.cpp @@ -14,6 +14,7 @@ #include "KDiskDevice.h" #include "KDiskDeviceManager.h" #include "KDiskDeviceUtils.h" +#include "KPath.h" #include "KPhysicalPartition.h" #include "KShadowPartition.h" @@ -56,12 +57,12 @@ KPhysicalPartition::Open(int flags, int *fd) if (!fd) return B_BAD_VALUE; // get the path - char path[B_PATH_NAME_LENGTH]; - status_t error = GetPath(path); + KPath path; + status_t error = GetPath(&path); if (error != B_OK) return error; // open the device - *fd = open(path, flags); + *fd = open(path.Path(), flags); if (*fd < 0) return errno; return B_OK; @@ -71,8 +72,9 @@ KPhysicalPartition::Open(int flags, int *fd) status_t KPhysicalPartition::PublishDevice() { - char path[B_PATH_NAME_LENGTH]; - status_t error = GetPath(path); + // get the path + KPath path; + status_t error = GetPath(&path); if (error != B_OK) return error; @@ -83,23 +85,25 @@ KPhysicalPartition::PublishDevice() info.logical_block_size = BlockSize(); info.session = 0; info.partition = ID(); - if (strlcpy(info.device, Device()->Path(), B_PATH_NAME_LENGTH) > B_PATH_NAME_LENGTH) + if (strlcpy(info.device, Device()->Path(), B_PATH_NAME_LENGTH) + >= B_PATH_NAME_LENGTH) { return B_NAME_TOO_LONG; + } - return devfs_publish_partition(path, &info); + return devfs_publish_partition(path.Path(), &info); } // UnpublishDevice status_t KPhysicalPartition::UnpublishDevice() { - // get the entry path - char path[B_PATH_NAME_LENGTH]; - status_t error = GetPath(path); + // get the path + KPath path; + status_t error = GetPath(&path); if (error != B_OK) return error; - return devfs_unpublish_partition(path); + return devfs_unpublish_partition(path.Path()); } // Mount