xine-lib build broken with libnfs 6
Xavier Bachelot via xine-devel <[email protected]> Mon, 16 Dec 2024 12:18:41 +0100
| Newsgroups | gmane.comp.video.xine.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
While trying to update Fedora to latest libnfs 6 release, a build
failure with xine-lib can be observed:
```
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../include -I../..
-I../../include -I../../include -I../../src -I../../src/xine-engine
-I../../src/xine-engine -I../../src/xine-utils -I../../src/input
-I../../src/input -I../../lib -I../../lib -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -DNDEBUG -D_REENTRANT -DXINE_COMPILE -O3
-fexpensive-optimizations -ffast-math -fvisibility=hidden -pipe -Wall
-Wformat=2 -Wno-format-zero-length -Wmissing-format-attribute
-Werror-implicit-function-declaration -Wstrict-aliasing=2
-Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes
-Wwrite-strings -Wpointer-arith -g -O2 -flto=auto -ffat-lto-objects
-fexceptions -g -grecord-gcc-switches -pipe -Wall
-Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3
-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
-fcommon -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables
-fstack-clash-protection -fcf-protection -mtls-dialect=gnu2
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -O3
-fexpensive-optimizations -ffast-math -Wall -Wchar-subscripts
-Wnested-externs -Wcast-align -Wmissing-declarations
-Wmissing-prototypes -Wmissing-format-attribute -Wno-pointer-sign
-Wformat=2 -Wno-format-zero-length -Wformat-security -Wstrict-aliasing=2
-Werror=implicit-function-declaration -c input_nfs.c -fPIC -DPIC -o
.libs/xineplug_inp_nfs_la-input_nfs.o
make[3]: Leaving directory
'/builddir/build/BUILD/xine-lib-1.2.13-build/xine-lib-1.2.13/src/input'
input_nfs.c: In function '_read':
input_nfs.c:137:47: error: passing argument 3 of 'nfs_read' makes
pointer from integer without a cast [-Wint-conversion]
137 | rc = nfs_read(this->nfs, this->nfsfh, len - got, buf + got);
| ~~~~^~~~~
| |
| off_t {aka long
int}
In file included from input_nfs.c:35:
/usr/include/nfsc/libnfs.h:764:27: note: expected 'void *' but argument
is of type 'off_t' {aka 'long int'}
764 | void *buf, size_t count);
| ~~~~~~^~~
input_nfs.c:137:58: error: passing argument 4 of 'nfs_read' makes
integer from pointer without a cast [-Wint-conversion]
137 | rc = nfs_read(this->nfs, this->nfsfh, len - got, buf + got);
| ~~~~^~~~~
| |
| uint8_t
* {aka unsigned char *}
/usr/include/nfsc/libnfs.h:764:39: note: expected 'size_t' {aka 'long
unsigned int'} but argument is of type 'uint8_t *' {aka 'unsigned char
*'}
764 | void *buf, size_t count);
| ~~~~~~~^~~~~
make[3]: *** [Makefile:1581: xineplug_inp_nfs_la-input_nfs.lo] Error 1
```
Upstream commit :
https://github.com/sahlberg/libnfs/commit/5e8f7ce273308
qemu is broken too with libnfs 6, here's a comment from upstream libnfs
author in the subsequent mail thread which might shed some more light on
what needs to be done for xine-lib and every code broken by the API
change:
```
I would prefer not to restore the old API. I had to break the API for
at least nfs_[p]read[_async]
in order to make (almost) zero-copy within the library work for the read
path.
I already do zero-copy (within the library) for the write path bit did
not do it for the read path until now
due to how hairy it is to do with the several variable length fields
in the headers :-(
Since I broke the API for read, which will affect every applicatin I
went ahead and fixed a lot of other warts in the
API as well, so that we can not actually cancel pdus that are in flight.
There is a compile-time check that can be made to determine which API is
use,
this is from fio :
@@ -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
}
...
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
```
Regards,
Xavier