Page MenuHomeFreeBSD

linux(4): Implement name_to_handle_at(), open_by_handle_at()
ClosedPublic

Authored by cem on Nov 6 2020, 3:24 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 8 2024, 10:30 AM
Unknown Object (File)
Mar 8 2024, 10:30 AM
Unknown Object (File)
Mar 8 2024, 10:30 AM
Unknown Object (File)
Mar 8 2024, 10:18 AM
Unknown Object (File)
Dec 24 2023, 3:26 AM
Unknown Object (File)
Dec 20 2023, 8:27 AM
Unknown Object (File)
Nov 12 2023, 5:12 AM
Unknown Object (File)
Nov 1 2023, 9:23 AM
Subscribers

Details

Summary

They are similar to our getfhat(2) and fhopen(2) syscalls.

Test Plan

Using the t_name_to_handle_at and t_open_by_handle_at helpers provided in the Linux manual page:

bash-4.2# echo "hello" > test.txt
bash-4.2# /opt/name_to_handle/t_name_to_handle_at    test.txt  > fh
bash-4.2# /opt/name_to_handle/t_open_by_handle_at /dev/null < fh
Read 6 bytes
bash-4.2# stat --printf="%i\n" test.txt
2731679
bash-4.2# rm test.txt
bash-4.2# echo "hello" > test.txt
bash-4.2# stat --printf="%i\n" test.txt
2731680
bash-4.2# /opt/name_to_handle/t_open_by_handle_at /dev/null < fh
open_by_handle_at: Stale file handle

So, that basic functionality seems to work as expected.

Note that the explicit /dev/null is provided to prevent t_open_by_handle_at from grubbing around in /proc/self/mountinfo for a matching mount_id, which is not something we provide in linprocfs yet. And our open_by_handle_at does not care about the mountfd, so any old fd works. Linux programs obviously can't rely on that property, so at some point we would need to implement mountinfo to better support these syscalls.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable