diff --git a/src/kernel/core/fs/vfs.cpp b/src/kernel/core/fs/vfs.cpp index ba6e12d093..d298e0a0ef 100755 --- a/src/kernel/core/fs/vfs.cpp +++ b/src/kernel/core/fs/vfs.cpp @@ -1648,6 +1648,21 @@ vfs_mount_boot_file_system() // make the boot partition (and probably others) available KDiskDeviceManager::CreateDefault(); +#if 0 + KDiskDeviceManager *manager = KDiskDeviceManager::Default(); + + status_t status = manager->InitialDeviceScan(); + if (status != B_OK) + panic("KDiskDeviceManager::InitialDeviceScan() failed: %s\n", strerror(status)); + + // ToDo: do this for real... (no hacks allowed :)) + for (;;) { + snooze(500000); + if (manager->CountJobs() == 0) + break; + } +#endif + file_system_info *bootfs; if ((bootfs = get_file_system("bootfs")) == NULL) { // no bootfs there, yet @@ -3874,6 +3889,34 @@ _user_sync(void) } +// ToDo: this might be a temporary syscall, it's used to get the path to an entry_ref + +status_t +_user_dir_node_ref_to_path(dev_t device, ino_t inode, char *userPath, size_t pathLength) +{ + char path[B_PATH_NAME_LENGTH + 1]; + struct vnode *vnode; + int status; + + if (!IS_USER_ADDRESS(userPath)) + return B_BAD_ADDRESS; + + // get the vnode matching the node_ref + status = get_vnode(device, inode, &vnode, false); + if (status < B_OK) + return status; + + status = dir_vnode_to_path(vnode, path, sizeof(path)); + put_vnode(vnode); + // we don't need the vnode anymore + + if (status < B_OK) + return status; + + return user_strlcpy(userPath, path, pathLength); +} + + int _user_open_entry_ref(dev_t device, ino_t inode, const char *userName, int omode) { diff --git a/src/kernel/core/syscalls.c b/src/kernel/core/syscalls.c index c12fc092ce..f9d16edfae 100644 --- a/src/kernel/core/syscalls.c +++ b/src/kernel/core/syscalls.c @@ -91,6 +91,9 @@ syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_ret) case SYSCALL_SEEK: *call_ret = _user_seek((int)arg0, (off_t)INT32TOINT64(arg1, arg2), (int)arg3); break; + case SYSCALL_DIR_NODE_REF_TO_PATH: + *call_ret = _user_dir_node_ref_to_path((dev_t)arg0, (ino_t)INT32TOINT64(arg1,arg2), (char *)arg3, (size_t)arg4); + break; case SYSCALL_OPEN_DIR_ENTRY_REF: *call_ret = _user_open_dir_entry_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1,arg2), (const char *)arg3); break;