Message ID | 20250114034831.1128945-1-shinichiro.kawasaki@wdc.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | fsx: fix compile error for preadv2() | expand |
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
On 1/13/25 8:48 PM, Shin'ichiro Kawasaki wrote: > Commit d6b9d8eff076 ("fsx: add support for RWF_DONTCACHE") introduced > preadv2() calls in ltp/fsx.c. However, sys/uio.h is not included to the > source file, which causes compile errors with the gcc option > -Werror-implicit-function-declaration: > > fsx.c: In function 'test_dontcache_io': > fsx.c:1956:15: error: implicit declaration of function 'preadv2'; did you mean 'pread64'? [-Wimplicit-function-declaration] > 1956 | ret = preadv2(fd, &iov, 1, 0, RWF_DONTCACHE); > | ^~~~~~~ > | pread64 > fsx.c: In function 'fsx_rw': > fsx.c:2836:31: error: implicit declaration of function 'pwritev2'; did you mean 'pwrite64'? [-Wimplicit-function-declaration] > 2836 | ret = pwritev2(fd, &iov, 1, offset, flags); > | ^~~~~~~~ > | pwrite64 > > To fix it, add the include directive. Looks good, thanks for catching that. Reviewed-by: Jens Axboe <axboe@kernel.dk>
On Tue, Jan 14, 2025 at 12:48:31PM +0900, Shin'ichiro Kawasaki wrote: > Commit d6b9d8eff076 ("fsx: add support for RWF_DONTCACHE") introduced > preadv2() calls in ltp/fsx.c. However, sys/uio.h is not included to the > source file, which causes compile errors with the gcc option > -Werror-implicit-function-declaration: > > fsx.c: In function 'test_dontcache_io': > fsx.c:1956:15: error: implicit declaration of function 'preadv2'; did you mean 'pread64'? [-Wimplicit-function-declaration] > 1956 | ret = preadv2(fd, &iov, 1, 0, RWF_DONTCACHE); > | ^~~~~~~ > | pread64 > fsx.c: In function 'fsx_rw': > fsx.c:2836:31: error: implicit declaration of function 'pwritev2'; did you mean 'pwrite64'? [-Wimplicit-function-declaration] > 2836 | ret = pwritev2(fd, &iov, 1, offset, flags); > | ^~~~~~~~ > | pwrite64 > > To fix it, add the include directive. I didn't hit this issue when I test it. Thanks for catching it. Reviewed-by: Zorro Lang <zlang@redhat.com> > > Fixes: d6b9d8eff076 ("fsx: add support for RWF_DONTCACHE") > Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> > --- > ltp/fsx.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/ltp/fsx.c b/ltp/fsx.c > index 9efd2f5c..3e89d570 100644 > --- a/ltp/fsx.c > +++ b/ltp/fsx.c > @@ -20,6 +20,7 @@ > #include <strings.h> > #include <sys/file.h> > #include <sys/mman.h> > +#include <sys/uio.h> > #include <stdbool.h> > #ifdef HAVE_ERR_H > #include <err.h> > -- > 2.47.0 > >
diff --git a/ltp/fsx.c b/ltp/fsx.c index 9efd2f5c..3e89d570 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -20,6 +20,7 @@ #include <strings.h> #include <sys/file.h> #include <sys/mman.h> +#include <sys/uio.h> #include <stdbool.h> #ifdef HAVE_ERR_H #include <err.h>
Commit d6b9d8eff076 ("fsx: add support for RWF_DONTCACHE") introduced preadv2() calls in ltp/fsx.c. However, sys/uio.h is not included to the source file, which causes compile errors with the gcc option -Werror-implicit-function-declaration: fsx.c: In function 'test_dontcache_io': fsx.c:1956:15: error: implicit declaration of function 'preadv2'; did you mean 'pread64'? [-Wimplicit-function-declaration] 1956 | ret = preadv2(fd, &iov, 1, 0, RWF_DONTCACHE); | ^~~~~~~ | pread64 fsx.c: In function 'fsx_rw': fsx.c:2836:31: error: implicit declaration of function 'pwritev2'; did you mean 'pwrite64'? [-Wimplicit-function-declaration] 2836 | ret = pwritev2(fd, &iov, 1, offset, flags); | ^~~~~~~~ | pwrite64 To fix it, add the include directive. Fixes: d6b9d8eff076 ("fsx: add support for RWF_DONTCACHE") Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> --- ltp/fsx.c | 1 + 1 file changed, 1 insertion(+)