[vlc-devel] Libnfs API changed

Steve Lhomme robux4 at ycbcr.xyz
Mon Dec 16 08:40:38 UTC 2024


Hi Ronnie,

Thanks for the heads up.
I did a Merge Request to fix our usage in VLC: 
https://code.videolan.org/videolan/vlc/-/merge_requests/6527

I tried to update our contribs to the latest version but it fails to 
build properly on Windows.
I opened some issues:
- https://github.com/sahlberg/libnfs/issues/506
- https://github.com/sahlberg/libnfs/issues/507

Thanks,
Steve

On 15/12/2024 11:11, ronnie sahlberg wrote:
> Libnfs is now pushing out a new major release.
> This wll affect VLC as some signatures in the API has changed in order
> to allow zero-copy for the READ paths.
> This greatly improves performance on low=end devices such as RPi.
> 
> The new API is mainly due to nfs_read* cha ngin its signature to make
> zero-copy possible.
> But since this breaks pretty much every application, why not clean up
> and fix all other warts in the API at the same time.
> 
> VLC as dar as I can tell only uses the high-level APIs so the changes
> should be fairly trivial.
> This is an example on how fio added compile time support for either
> the classic api or the new api:
> 
> ---
> diff --git a/engines/nfs.c b/engines/nfs.c
> index 6bc4af1f..13b55038 100644
> --- a/engines/nfs.c
> +++ b/engines/nfs.c
> @@ -157,16 +157,28 @@ static int queue_write(struct fio_libnfs_options
> *o, struct io_u *io_u)
>   {
>          struct nfs_data *nfs_data = io_u->engine_data;
> 
> +#ifdef LIBNFS_API_V2
> +       return nfs_pwrite_async(o->context, nfs_data->nfsfh,
> +                               io_u->buf, io_u->buflen, io_u->offset,
> +                               nfs_callback, io_u);
> +#else
>          return nfs_pwrite_async(o->context, nfs_data->nfsfh, io_u->offset,
>                                  io_u->buflen, io_u->buf, nfs_callback, io_u);
> +#endif
>   }
> 
>   static int queue_read(struct fio_libnfs_options *o, struct io_u *io_u)
>   {
>          struct nfs_data *nfs_data = io_u->engine_data;
> 
> +#ifdef LIBNFS_API_V2
> +       return nfs_pread_async(o->context, nfs_data->nfsfh,
> +                               io_u->buf, io_u->buflen, io_u->offset,
> +                               nfs_callback, io_u);
> +#else
>          return nfs_pread_async(o->context, nfs_data->nfsfh, io_u->offset,
>                                  io_u->buflen, nfs_callback, io_u);
> +#endif
>   }
> --
> 
> 
> VLC will need the same type of ifdef conditionals to ensure it can
> compile against either API.
> 
> It is painful to break an API but sometimes you have to. And there is
> no difference between breaking it a little and breaking it alot so
> taking the opportunity to fix a lot of mistakes done in the last 20
> years.
> 
> In exchange for this breakage I offer significantly improved
> performance on very low end devices with poor memory bandwidth. Likem
> the original RPi.
> 
> regards
> ronnie sahlberg
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list