Re: [PATCH bpf-next] bpf: uapi: Document front truncation in bpf_d_path()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 30, 2024 at 1:55 PM Daniel Xu <dxu@xxxxxxxxx> wrote:
>
> bpf_d_path() will truncate the resolved path from the front if the
> provided buffer is too small. This is somewhat non-intuitive but makes
> sense when you think about it. So document it.
>
> Signed-off-by: Daniel Xu <dxu@xxxxxxxxx>
> ---
>  include/uapi/linux/bpf.h       | 4 ++++
>  tools/include/uapi/linux/bpf.h | 4 ++++
>  2 files changed, 8 insertions(+)
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 2acf9b336371..91218c5fd207 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -4845,6 +4845,10 @@ union bpf_attr {
>   *             including the trailing NUL character. On error, a negative
>   *             value.
>   *
> + *             If *buf* is too small, the resolved path is truncated from
> + *             the front and -ENAMETOOLONG is returned. The buffer is valid
> + *             in this case.
> + *

I think this is overkill to add to uapi header.
Above is an implementation detail.
Highly unlikely at this point, but it may change.
While the above description in the uapi file may prompt unnecessary
concerns if/when implementation changes.
So let's leave it as-is.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux