Used KPath where possible.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9550 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
92221d2425
commit
92eb857652
|
@ -14,6 +14,7 @@
|
||||||
#include "KDiskDevice.h"
|
#include "KDiskDevice.h"
|
||||||
#include "KDiskDeviceManager.h"
|
#include "KDiskDeviceManager.h"
|
||||||
#include "KDiskDeviceUtils.h"
|
#include "KDiskDeviceUtils.h"
|
||||||
|
#include "KPath.h"
|
||||||
#include "KPhysicalPartition.h"
|
#include "KPhysicalPartition.h"
|
||||||
#include "KShadowPartition.h"
|
#include "KShadowPartition.h"
|
||||||
|
|
||||||
|
@ -56,12 +57,12 @@ KPhysicalPartition::Open(int flags, int *fd)
|
||||||
if (!fd)
|
if (!fd)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
// get the path
|
// get the path
|
||||||
char path[B_PATH_NAME_LENGTH];
|
KPath path;
|
||||||
status_t error = GetPath(path);
|
status_t error = GetPath(&path);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
// open the device
|
// open the device
|
||||||
*fd = open(path, flags);
|
*fd = open(path.Path(), flags);
|
||||||
if (*fd < 0)
|
if (*fd < 0)
|
||||||
return errno;
|
return errno;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
@ -71,8 +72,9 @@ KPhysicalPartition::Open(int flags, int *fd)
|
||||||
status_t
|
status_t
|
||||||
KPhysicalPartition::PublishDevice()
|
KPhysicalPartition::PublishDevice()
|
||||||
{
|
{
|
||||||
char path[B_PATH_NAME_LENGTH];
|
// get the path
|
||||||
status_t error = GetPath(path);
|
KPath path;
|
||||||
|
status_t error = GetPath(&path);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
@ -83,23 +85,25 @@ KPhysicalPartition::PublishDevice()
|
||||||
info.logical_block_size = BlockSize();
|
info.logical_block_size = BlockSize();
|
||||||
info.session = 0;
|
info.session = 0;
|
||||||
info.partition = ID();
|
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 B_NAME_TOO_LONG;
|
||||||
|
}
|
||||||
|
|
||||||
return devfs_publish_partition(path, &info);
|
return devfs_publish_partition(path.Path(), &info);
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnpublishDevice
|
// UnpublishDevice
|
||||||
status_t
|
status_t
|
||||||
KPhysicalPartition::UnpublishDevice()
|
KPhysicalPartition::UnpublishDevice()
|
||||||
{
|
{
|
||||||
// get the entry path
|
// get the path
|
||||||
char path[B_PATH_NAME_LENGTH];
|
KPath path;
|
||||||
status_t error = GetPath(path);
|
status_t error = GetPath(&path);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
return devfs_unpublish_partition(path);
|
return devfs_unpublish_partition(path.Path());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mount
|
// Mount
|
||||||
|
|
Loading…
Reference in New Issue