Re: [PATCH iproute2-next v2] lib/fs: fix issue when {name,open}_to_handle_at() is not implemented

From: Petr Vorel
Date: Fri Apr 30 2021 - 14:43:23 EST


Hi Heiko,

...
> +++ b/lib/fs.c
> +int name_to_handle_at(int dirfd, const char *pathname,
> + struct file_handle *handle, int *mount_id, int flags)
> +{
> + return syscall(name_to_handle_at, 5, dirfd, pathname, handle,
I overlooked this in v1. name_to_handle_at must be replaced by __NR_name_to_handle_at:
(name_to_handle_at is the function name, not a syscall number).
It also requires to include <sys/syscall.h>:

#include <sys/syscall.h>
...
return syscall(__NR_name_to_handle_at, 5, dirfd, pathname, handle,
mount_id, flags);

> + mount_id, flags);
> +}
> +
> +int open_by_handle_at(int mount_fd, struct file_handle *handle, int flags)
> +{
> + return syscall(open_by_handle_at, 3, mount_fd, handle, flags);
And here needs to be __NR_open_by_handle_at

Kind regards,
Petr

> +}
> +#endif
> +
> /* return mount path of first occurrence of given fstype */
> static char *find_fs_mount(const char *fs_to_find)
> {