* vfs_get_fs_node_from_path() now also work for absolute paths again (but
  still for relative ones from the volume root) - it just tests if the
  mount IDs fit, so it only returns successful if the path really is on
  the desired mount.
* the Disk Device Manager publish functions now call devfs_publish_*()
  correctly (by omitting the "/dev/" mount point).
* devfs_publish_partition() now accepts absolute device paths but relative
  partition paths.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17138 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-04-16 11:44:54 +00:00
parent b026647574
commit b2536cb5d6
4 changed files with 20 additions and 9 deletions

View File

@ -173,7 +173,8 @@ KFileDiskDevice::GetGeometry(device_geometry *geometry)
status_t
KFileDiskDevice::_RegisterDevice(const char *file, const char *device)
{
return devfs_publish_file_device(device, file);
return devfs_publish_file_device(device + 5, file);
// we need to remove the "/dev/" part from the path
// TODO: For now we use the virtualdrive driver to register a file
// as a device and then simply symlink the assigned device to the
@ -222,7 +223,8 @@ KFileDiskDevice::_RegisterDevice(const char *file, const char *device)
status_t
KFileDiskDevice::_UnregisterDevice(const char *_device)
{
return devfs_unpublish_file_device(_device);
return devfs_unpublish_file_device(_device + 5);
// we need to remove the "/dev/" part from the path
// // read the symlink to get the path of the virtualdrive device
// char device[B_PATH_NAME_LENGTH];

View File

@ -90,7 +90,8 @@ KPhysicalPartition::PublishDevice()
return B_NAME_TOO_LONG;
}
return devfs_publish_partition(path.Path(), &info);
return devfs_publish_partition(path.Path() + 5, &info);
// we need to remove the "/dev/" part from the path
}
// UnpublishDevice
@ -103,7 +104,8 @@ KPhysicalPartition::UnpublishDevice()
if (error != B_OK)
return error;
return devfs_unpublish_partition(path.Path());
return devfs_unpublish_partition(path.Path() + 5);
// we need to remove the "/dev/" part from the path
}
// Mount

View File

@ -2107,9 +2107,11 @@ devfs_publish_partition(const char *path, const partition_info *info)
// the partition and device paths must be the same until the leaves
const char *lastPath = strrchr(path, '/');
const char *lastDevice = strrchr(info->device, '/');
if (lastPath == NULL || lastDevice == NULL
|| lastPath - path != lastDevice - info->device
|| strncmp(path, info->device, lastPath - path))
if (lastPath == NULL || lastDevice == NULL)
return B_BAD_VALUE;
size_t length = lastDevice - (lastPath - path) - info->device;
if (strncmp(path, info->device + length, lastPath - path))
return B_BAD_VALUE;
devfs_vnode *device;

View File

@ -2759,9 +2759,14 @@ vfs_get_fs_node_from_path(mount_id mountID, const char *path, bool kernel, void
strlcpy(buffer, path, pathBuffer.BufferSize());
struct vnode *vnode = mount->root_vnode;
inc_vnode_ref_count(vnode);
status = vnode_path_to_vnode(vnode, buffer, true, 0, &vnode, NULL, NULL);
if (buffer[0] == '/')
status = path_to_vnode(buffer, true, &vnode, NULL, true);
else {
inc_vnode_ref_count(vnode);
// vnode_path_to_vnode() releases a reference to the starting vnode
status = vnode_path_to_vnode(vnode, buffer, true, 0, &vnode, NULL, NULL);
}
put_mount(mount);