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)
Wed, Nov 20, 9:57 AM
Unknown Object (File)
Tue, Oct 29, 12:23 AM
Unknown Object (File)
Oct 22 2024, 12:08 AM
Unknown Object (File)
Sep 18 2024, 7:16 AM
Unknown Object (File)
Sep 17 2024, 6:11 AM
Unknown Object (File)
Sep 17 2024, 12:26 AM
Unknown Object (File)
Sep 17 2024, 12:26 AM
Unknown Object (File)
Sep 17 2024, 12:26 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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 34662
Build 31732: arc lint + arc unit