All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] sendfile0{2,9}: Remove OFF_T workaround
@ 2021-05-26 10:46 Petr Vorel
  2021-05-28  7:36 ` Cyril Hrubis
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2021-05-26 10:46 UTC (permalink / raw)
  To: ltp

Using OFF_T definition to off64_t for 64bit variants seems to be am old
workaround for buggy libc. Nowadays we can rely on off_t to have correct size
(i.e.: 32bit: 4 bytes; 64bit or 32bit with -D_FILE_OFFSET_BITS=64: 8 bytes)

Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
NOTE: -DOFF_T=off64_t is also defined in testcases/kernel/io/disktest
and mentioned in {tst_,}safe_macros.h.

Kind regards,
Petr

 testcases/kernel/syscalls/sendfile/Makefile     |  2 +-
 testcases/kernel/syscalls/sendfile/sendfile02.c |  6 +-----
 testcases/kernel/syscalls/sendfile/sendfile09.c | 10 +++-------
 3 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/testcases/kernel/syscalls/sendfile/Makefile b/testcases/kernel/syscalls/sendfile/Makefile
index f63a42fe9..7ee7bbed4 100644
--- a/testcases/kernel/syscalls/sendfile/Makefile
+++ b/testcases/kernel/syscalls/sendfile/Makefile
@@ -6,6 +6,6 @@ top_srcdir		?= ../../../..
 include $(top_srcdir)/include/mk/testcases.mk
 include $(abs_srcdir)/../utils/newer_64.mk
 
-%_64: CPPFLAGS += -D_FILE_OFFSET_BITS=64 -DOFF_T=off64_t -D_GNU_SOURCE
+%_64: CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/sendfile/sendfile02.c b/testcases/kernel/syscalls/sendfile/sendfile02.c
index e5f115146..729a9e123 100644
--- a/testcases/kernel/syscalls/sendfile/sendfile02.c
+++ b/testcases/kernel/syscalls/sendfile/sendfile02.c
@@ -59,10 +59,6 @@
 #include "test.h"
 #include "safe_macros.h"
 
-#ifndef OFF_T
-#define OFF_T off_t
-#endif /* Not def: OFF_T */
-
 TCID_DEFINE(sendfile02);
 int TST_TOTAL = 4;
 
@@ -95,7 +91,7 @@ struct test_case_t {
 static char *argv0;
 #endif
 
-void do_sendfile(OFF_T offset, int i)
+void do_sendfile(off_t offset, int i)
 {
 	int in_fd;
 	struct stat sb;
diff --git a/testcases/kernel/syscalls/sendfile/sendfile09.c b/testcases/kernel/syscalls/sendfile/sendfile09.c
index 297b3e212..320649dcd 100644
--- a/testcases/kernel/syscalls/sendfile/sendfile09.c
+++ b/testcases/kernel/syscalls/sendfile/sendfile09.c
@@ -26,17 +26,13 @@
 
 #ifndef TST_ABI32
 
-#ifndef OFF_T
-#define OFF_T off_t
-#endif
-
 #define ONE_GB		(INT64_C(1) << 30)
 #define IN_FILE		"in_file"
 #define OUT_FILE	"out_file"
 
 static struct test_case_t {
 	char *desc;
-	OFF_T offset;
+	off_t offset;
 	int64_t count;
 	int64_t exp_retval;
 	int64_t exp_updated_offset;
@@ -67,9 +63,9 @@ static void run(unsigned int i)
 {
 	int in_fd = SAFE_OPEN(IN_FILE, O_RDONLY);
 	int out_fd = SAFE_OPEN(OUT_FILE, O_WRONLY);
-	OFF_T offset = tc[i].offset;
+	off_t offset = tc[i].offset;
 
-	OFF_T before_pos, after_pos;
+	off_t before_pos, after_pos;
 	before_pos = SAFE_LSEEK(in_fd, 0, SEEK_CUR);
 
 	TEST(sendfile(out_fd, in_fd, &offset, tc[i].count));
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [LTP] [PATCH 1/1] sendfile0{2,9}: Remove OFF_T workaround
  2021-05-26 10:46 [LTP] [PATCH 1/1] sendfile0{2,9}: Remove OFF_T workaround Petr Vorel
@ 2021-05-28  7:36 ` Cyril Hrubis
  2021-05-28 10:01   ` Petr Vorel
  0 siblings, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2021-05-28  7:36 UTC (permalink / raw)
  To: ltp

Hi!
> Using OFF_T definition to off64_t for 64bit variants seems to be am old
> workaround for buggy libc. Nowadays we can rely on off_t to have correct size
> (i.e.: 32bit: 4 bytes; 64bit or 32bit with -D_FILE_OFFSET_BITS=64: 8 bytes)

Looks good to me, Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

> Suggested-by: Cyril Hrubis <chrubis@suse.cz>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> NOTE: -DOFF_T=off64_t is also defined in testcases/kernel/io/disktest
> and mentioned in {tst_,}safe_macros.h.

We should remove the -DOFF_T=off64_t comment from the *safe_macros.h and
keep only the _FILE_OFFSET_BITS there.


-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [PATCH 1/1] sendfile0{2,9}: Remove OFF_T workaround
  2021-05-28  7:36 ` Cyril Hrubis
@ 2021-05-28 10:01   ` Petr Vorel
  2021-06-02 11:51     ` Petr Vorel
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2021-05-28 10:01 UTC (permalink / raw)
  To: ltp

Hi Cyril,

> Hi!
> > Using OFF_T definition to off64_t for 64bit variants seems to be am old
> > workaround for buggy libc. Nowadays we can rely on off_t to have correct size
> > (i.e.: 32bit: 4 bytes; 64bit or 32bit with -D_FILE_OFFSET_BITS=64: 8 bytes)

> Looks good to me, Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

> > Suggested-by: Cyril Hrubis <chrubis@suse.cz>
> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> > NOTE: -DOFF_T=off64_t is also defined in testcases/kernel/io/disktest
> > and mentioned in {tst_,}safe_macros.h.

> We should remove the -DOFF_T=off64_t comment from the *safe_macros.h and
> keep only the _FILE_OFFSET_BITS there.

Good. OK, after I solve our CI (github actions) I'll merge this and send another
patch which removes it in testcases/kernel/io/disktest + the comment in
*safe_macros.h.

Thanks for review and hints!

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [PATCH 1/1] sendfile0{2,9}: Remove OFF_T workaround
  2021-05-28 10:01   ` Petr Vorel
@ 2021-06-02 11:51     ` Petr Vorel
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2021-06-02 11:51 UTC (permalink / raw)
  To: ltp

Hi Cyril,

> Hi Cyril,

> > Hi!
> > > Using OFF_T definition to off64_t for 64bit variants seems to be am old
> > > workaround for buggy libc. Nowadays we can rely on off_t to have correct size
> > > (i.e.: 32bit: 4 bytes; 64bit or 32bit with -D_FILE_OFFSET_BITS=64: 8 bytes)

> > Looks good to me, Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

> > > Suggested-by: Cyril Hrubis <chrubis@suse.cz>
> > > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > > ---
> > > NOTE: -DOFF_T=off64_t is also defined in testcases/kernel/io/disktest
> > > and mentioned in {tst_,}safe_macros.h.

> > We should remove the -DOFF_T=off64_t comment from the *safe_macros.h and
> > keep only the _FILE_OFFSET_BITS there.

> Good. OK, after I solve our CI (github actions) I'll merge this and send another
> patch which removes it in testcases/kernel/io/disktest + the comment in
> *safe_macros.h.

Merged with your reviewed-by tag and going to implement above in separate patch.

Kind regards,
Petr

> Thanks for review and hints!

> Kind regards,
> Petr

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-02 11:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 10:46 [LTP] [PATCH 1/1] sendfile0{2,9}: Remove OFF_T workaround Petr Vorel
2021-05-28  7:36 ` Cyril Hrubis
2021-05-28 10:01   ` Petr Vorel
2021-06-02 11:51     ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.