Skip to contentSkip to conversation

Include lapi/posix_clocks.h in tst_safe_clocks.h

PATCH New Petr Vorel 2 participants 4 messages Feb 25, 2019 – Feb 26, 2019

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/2 Include lapi/posix_clocks.h in tst_safe_clocks.h

Although this not needed, users of tst_safe_clocks.h usually need also posix clock flags and it's safer to load them automatically so fixes like 938a1023d are not needed any more.

+ minor copyright formatting cleanup.

---
 include/tst_safe_clocks.h                                 | 8 +++++---
 testcases/kernel/syscalls/clock_gettime/clock_gettime01.c | 1 -
 testcases/kernel/syscalls/clock_gettime/clock_gettime02.c | 1 -
 testcases/kernel/syscalls/clock_settime/clock_settime02.c | 1 -
 testcases/kernel/syscalls/statx/statx06.c                 | 1 -
 5 files changed, 5 insertions(+), 7 deletions(-)
include/tst_safe_clocks.h +5 -3
index 553f8464a..d5cd83394 100644
@@ -1,11 +1,13 @@
-// SPDX-License-Identifier: GPL-2.0 or later
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *  Copyright (c) Zilogic Systems Pvt. Ltd., 2018
- *  Email : [email protected]
+ * Copyright (c) 2019, Linux Test Project
+ * Copyright (c) Zilogic Systems Pvt. Ltd., 2018
+ * Email : [email protected]
  */
 
 #include <time.h>
 #include "tst_test.h"
+#include "lapi/posix_clocks.h"
 
 static inline void safe_clock_getres(const char *file, const int lineno,
 	clockid_t clk_id, struct timespec *res)
testcases/kernel/syscalls/clock_gettime/clock_gettime01.c +0 -1
index f8028f0f6..d365823b2 100644
@@ -18,7 +18,6 @@
 
 #include "config.h"
 #include "tst_timer.h"
-#include "lapi/posix_clocks.h"
 #include "tst_safe_clocks.h"
 #include "tst_test.h"
 #include "lapi/syscalls.h"
testcases/kernel/syscalls/clock_gettime/clock_gettime02.c +0 -1
index c08f0f0de..2a29a71e6 100644
@@ -21,7 +21,6 @@
 #include "config.h"
 #include "tst_test.h"
 #include "lapi/syscalls.h"
-#include "lapi/posix_clocks.h"
 #include "tst_timer.h"
 #include "tst_safe_clocks.h"
 
testcases/kernel/syscalls/clock_settime/clock_settime02.c +0 -1
index a6df4940a..8db417b6b 100644
@@ -11,7 +11,6 @@
 #include "config.h"
 #include "tst_test.h"
 #include "lapi/syscalls.h"
-#include "lapi/posix_clocks.h"
 #include "tst_timer.h"
 #include "tst_safe_clocks.h"
 
testcases/kernel/syscalls/statx/statx06.c +0 -1
index 524022499..831f73092 100644
@@ -45,7 +45,6 @@
 #include "lapi/stat.h"
 #include "lapi/mount.h"
 #include "lapi/fcntl.h"
-#include "lapi/posix_clocks.h"
 
 #define MOUNT_POINT "mount_ext"
 #define TEST_FILE MOUNT_POINT"/test_file.txt"
Signature · 1 line
2.20.1
author
#1 lore raw

PATCH 2/2 lapi/posix_clocks.h: Include <time.h> before definitions

+ minor formatting fixes (include guards, copyright).

---
 include/lapi/posix_clocks.h | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)
include/lapi/posix_clocks.h +7 -17
index 7819bb9c0..0d1f0e99c 100644
@@ -1,23 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
+ * Copyright (c) 2019, Linux Test Project
  * Copyright (c) 2013 Cyril Hrubis <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __POSIX_CLOCK_IDS_H__
-#define __POSIX_CLOCK_IDS_H__
+#include <time.h>
+
+#ifndef POSIX_CLOCKS_H__
+#define POSIX_CLOCKS_H__
 
 #ifndef CLOCK_MONOTONIC_RAW
 # define CLOCK_MONOTONIC_RAW 4
@@ -43,4 +33,4 @@
 # define CLOCK_BOOTTIME_ALARM 9
 #endif
 
-#endif /* __POSIX_CLOCK_IDS_H__ */
+#endif /* POSIX_CLOCKS_H__ */
Signature · 1 line
2.20.1
#2 lore raw

PATCH 1/2 Include lapi/posix_clocks.h in tst_safe_clocks.h

In reply to Petr Vorel

----- Original Message -----

Quoted 7 lines

Although this not needed, users of tst_safe_clocks.h usually need also posix clock flags and it's safer to load them automatically so fixes like 938a1023d are not needed any more.

+ minor copyright formatting cleanup.

Both look good to me, ack.

Regards,
Jan

Quoted 88 lines
---
 include/tst_safe_clocks.h                                 | 8 +++++---
 testcases/kernel/syscalls/clock_gettime/clock_gettime01.c | 1 -
 testcases/kernel/syscalls/clock_gettime/clock_gettime02.c | 1 -
 testcases/kernel/syscalls/clock_settime/clock_settime02.c | 1 -
 testcases/kernel/syscalls/statx/statx06.c                 | 1 -
 5 files changed, 5 insertions(+), 7 deletions(-)
include/tst_safe_clocks.h +5 -3
index 553f8464a..d5cd83394 100644
@@ -1,11 +1,13 @@
-// SPDX-License-Identifier: GPL-2.0 or later
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *  Copyright (c) Zilogic Systems Pvt. Ltd., 2018
- *  Email : [email protected]
+ * Copyright (c) 2019, Linux Test Project
+ * Copyright (c) Zilogic Systems Pvt. Ltd., 2018
+ * Email : [email protected]
  */
 
 #include <time.h>
 #include "tst_test.h"
+#include "lapi/posix_clocks.h"
 
 static inline void safe_clock_getres(const char *file, const int lineno,
 	clockid_t clk_id, struct timespec *res)
testcases/kernel/syscalls/clock_gettime/clock_gettime01.c +0 -1
index f8028f0f6..d365823b2 100644
@@ -18,7 +18,6 @@
 
 #include "config.h"
 #include "tst_timer.h"
-#include "lapi/posix_clocks.h"
 #include "tst_safe_clocks.h"
 #include "tst_test.h"
 #include "lapi/syscalls.h"
testcases/kernel/syscalls/clock_gettime/clock_gettime02.c +0 -1
index c08f0f0de..2a29a71e6 100644
@@ -21,7 +21,6 @@
 #include "config.h"
 #include "tst_test.h"
 #include "lapi/syscalls.h"
-#include "lapi/posix_clocks.h"
 #include "tst_timer.h"
 #include "tst_safe_clocks.h"
 
testcases/kernel/syscalls/clock_settime/clock_settime02.c +0 -1
index a6df4940a..8db417b6b 100644
@@ -11,7 +11,6 @@
 #include "config.h"
 #include "tst_test.h"
 #include "lapi/syscalls.h"
-#include "lapi/posix_clocks.h"
 #include "tst_timer.h"
 #include "tst_safe_clocks.h"
 
testcases/kernel/syscalls/statx/statx06.c +0 -2
index 524022499..831f73092 100644
@@ -45,7 +45,6 @@
 #include "lapi/stat.h"
 #include "lapi/mount.h"
 #include "lapi/fcntl.h"
-#include "lapi/posix_clocks.h"
 
 #define MOUNT_POINT "mount_ext"
 #define TEST_FILE MOUNT_POINT"/test_file.txt"
--

2.20.1

--
Mailing list info: https://lists.linux.it/listinfo/ltp

author
#3 lore raw

PATCH 1/2 Include lapi/posix_clocks.h in tst_safe_clocks.h

Hi Jan,

Quoted 1 line

Both look good to me, ack.

Thanks a lot for your review! Merged.

Quoted 2 lines

Regards,
Jan

Kind regards,
Petr