Fixed bug #483:
* 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:
parent
b026647574
commit
b2536cb5d6
|
@ -173,7 +173,8 @@ KFileDiskDevice::GetGeometry(device_geometry *geometry)
|
||||||
status_t
|
status_t
|
||||||
KFileDiskDevice::_RegisterDevice(const char *file, const char *device)
|
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
|
// TODO: For now we use the virtualdrive driver to register a file
|
||||||
// as a device and then simply symlink the assigned device to the
|
// 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
|
status_t
|
||||||
KFileDiskDevice::_UnregisterDevice(const char *_device)
|
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
|
// // read the symlink to get the path of the virtualdrive device
|
||||||
// char device[B_PATH_NAME_LENGTH];
|
// char device[B_PATH_NAME_LENGTH];
|
||||||
|
|
|
@ -90,7 +90,8 @@ KPhysicalPartition::PublishDevice()
|
||||||
return B_NAME_TOO_LONG;
|
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
|
// UnpublishDevice
|
||||||
|
@ -103,7 +104,8 @@ KPhysicalPartition::UnpublishDevice()
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
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
|
// Mount
|
||||||
|
|
|
@ -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
|
// the partition and device paths must be the same until the leaves
|
||||||
const char *lastPath = strrchr(path, '/');
|
const char *lastPath = strrchr(path, '/');
|
||||||
const char *lastDevice = strrchr(info->device, '/');
|
const char *lastDevice = strrchr(info->device, '/');
|
||||||
if (lastPath == NULL || lastDevice == NULL
|
if (lastPath == NULL || lastDevice == NULL)
|
||||||
|| lastPath - path != lastDevice - info->device
|
return B_BAD_VALUE;
|
||||||
|| strncmp(path, info->device, lastPath - path))
|
|
||||||
|
size_t length = lastDevice - (lastPath - path) - info->device;
|
||||||
|
if (strncmp(path, info->device + length, lastPath - path))
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
devfs_vnode *device;
|
devfs_vnode *device;
|
||||||
|
|
|
@ -2759,9 +2759,14 @@ vfs_get_fs_node_from_path(mount_id mountID, const char *path, bool kernel, void
|
||||||
strlcpy(buffer, path, pathBuffer.BufferSize());
|
strlcpy(buffer, path, pathBuffer.BufferSize());
|
||||||
|
|
||||||
struct vnode *vnode = mount->root_vnode;
|
struct vnode *vnode = mount->root_vnode;
|
||||||
inc_vnode_ref_count(vnode);
|
|
||||||
|
|
||||||
|
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);
|
status = vnode_path_to_vnode(vnode, buffer, true, 0, &vnode, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
put_mount(mount);
|
put_mount(mount);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue