Implemented syscall to get the path for a directory node_ref and made it available to userland.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8280 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-07-02 18:48:58 +00:00
parent fa310b3a35
commit 58131f940d
2 changed files with 46 additions and 0 deletions

View File

@ -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)
{

View File

@ -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;