[LTP] [PATCH v2 1/3] lapi/fcntl.h: Remove O_DIRECT definition

Petr Vorel pvorel@suse.cz
Wed Jun 28 15:07:40 CEST 2023


O_DIRECT definitions differ a lot depending on architecture.
Because this can lead to problems (e.g. the generic value O_DIRECT
040000 is O_DIRECTORY on powerpc. Therefore it's better just to remove
the definition in lapi and define _GNU_SOURCE in the tests which need
it (so far it's not needed for the library code).

Add this hint to the lapi header.

Reported-by: NeilBrown <neilb@suse.de>
Suggested-by: NeilBrown <neilb@suse.de>
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 include/lapi/fcntl.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/lapi/fcntl.h b/include/lapi/fcntl.h
index 848ac7865..cb216e2dc 100644
--- a/include/lapi/fcntl.h
+++ b/include/lapi/fcntl.h
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) Linux Test Project, 2014-2023
  */
 
 #ifndef LAPI_FCNTL_H__
@@ -10,9 +11,7 @@
 #include <fcntl.h>
 #include <sys/socket.h>
 
-#ifndef O_DIRECT
-# define O_DIRECT 040000
-#endif
+/* NOTE: #define _GNU_SOURCE if you need O_DIRECT in tests */
 
 #ifndef O_CLOEXEC
 # define O_CLOEXEC 02000000
-- 
2.40.1



More information about the ltp mailing list