[LTP] [PATCH v2 1/3] lib: Introduce tst_defaults.h

Petr Vorel pvorel@suse.cz
Tue Dec 14 15:43:07 CET 2021


Needed to reuse DEFAULT_FS_TYPE in next commit,
but put there also TEMPDIR, which is also variable used in both legacy
and new API.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
new in v2

 include/old/ltp_priv.h | 13 +------------
 include/tst_defaults.h | 21 +++++++++++++++++++++
 include/tst_private.h  |  1 +
 3 files changed, 23 insertions(+), 12 deletions(-)
 create mode 100644 include/tst_defaults.h

diff --git a/include/old/ltp_priv.h b/include/old/ltp_priv.h
index 0552457e59..0a0ef70f33 100644
--- a/include/old/ltp_priv.h
+++ b/include/old/ltp_priv.h
@@ -23,18 +23,7 @@
 #define __LTP_PRIV_H__
 
 #include <stdarg.h>
-
-/*
- * This is the default temporary directory used by tst_tmpdir().
- *
- * This is used when TMPDIR env variable is not set.
- */
-#define TEMPDIR	"/tmp"
-
-/*
- * Default filesystem to be used for tests.
- */
-#define DEFAULT_FS_TYPE "ext2"
+#include "tst_defaults.h"
 
 /* environment variables for controlling  tst_res verbosity */
 #define TOUT_VERBOSE_S  "VERBOSE"	/* All test cases reported */
diff --git a/include/tst_defaults.h b/include/tst_defaults.h
new file mode 100644
index 0000000000..083427b7e2
--- /dev/null
+++ b/include/tst_defaults.h
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+#ifndef TST_DEFAULTS_H_
+#define TST_DEFAULTS_H_
+
+/*
+ * This is the default temporary directory used by tst_tmpdir().
+ *
+ * This is used when TMPDIR env variable is not set.
+ */
+#define TEMPDIR	"/tmp"
+
+/*
+ * Default filesystem to be used for tests.
+ */
+#define DEFAULT_FS_TYPE "ext2"
+
+#endif /* TST_DEFAULTS_H_ */
diff --git a/include/tst_private.h b/include/tst_private.h
index b02f91228e..6f4f39b151 100644
--- a/include/tst_private.h
+++ b/include/tst_private.h
@@ -11,6 +11,7 @@
 
 #include <stdio.h>
 #include <netdb.h>
+#include "tst_defaults.h"
 
 #define MAX_IPV4_PREFIX 32
 #define MAX_IPV6_PREFIX 128
-- 
2.34.1



More information about the ltp mailing list