1 /* VTreeFS - link.c - by Alen Stojanov and David van Moolenbroek */
5 /*===========================================================================*
7 *===========================================================================*/
10 /* Retrieve symbolic link target.
17 if ((node
= find_inode(fs_m_in
.REQ_INODE_NR
)) == NULL
)
20 /* Call the rdlink hook. */
21 assert(vtreefs_hooks
->rdlink_hook
!= NULL
);
22 assert(!is_inode_deleted(node
)); /* symlinks cannot be opened */
24 r
= vtreefs_hooks
->rdlink_hook(node
, path
, sizeof(path
),
25 get_inode_cbdata(node
));
26 if (r
!= OK
) return r
;
29 assert(len
> 0 && len
< sizeof(path
));
31 if (len
> fs_m_in
.REQ_MEM_SIZE
)
32 len
= fs_m_in
.REQ_MEM_SIZE
;
34 /* Copy out the result. */
35 r
= sys_safecopyto(fs_m_in
.m_source
, fs_m_in
.REQ_GRANT
, 0,
36 (vir_bytes
) path
, len
);
37 if (r
!= OK
) return r
;
39 fs_m_out
.RES_NBYTES
= len
;