diff mbox series

[2/2] lib: Create tst_tmpdir.h

Message ID 20240620054958.554319-2-pvorel@suse.cz
State Changes Requested
Headers show
Series [1/2] tst_tmpdir: Remove NULL from static | expand

Commit Message

Petr Vorel June 20, 2024, 5:49 a.m. UTC
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 include/tst_device.h |  6 +-----
 include/tst_tmpdir.h | 15 +++++++++++++++
 lib/tst_tmpdir.c     |  1 +
 3 files changed, 17 insertions(+), 5 deletions(-)
 create mode 100644 include/tst_tmpdir.h

Comments

Cyril Hrubis June 21, 2024, 10:15 a.m. UTC | #1
Hi!
> diff --git a/include/tst_tmpdir.h b/include/tst_tmpdir.h
> new file mode 100644
> index 000000000..b4f95b666
> --- /dev/null
> +++ b/include/tst_tmpdir.h
> @@ -0,0 +1,15 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
> + * Copyright (c) 2020 Martin Doucha <mdoucha@suse.cz>
> + */
> +
> +#ifndef TST_TMPDIR_H__
> +#define TST_TMPDIR_H__
> +
> +/*
> + * Wipe the contents of given directory but keep the directory itself
> + */

This should ideally a proper documentation comment, but that can be done
in an follow up patch.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Petr Vorel June 21, 2024, 10:58 a.m. UTC | #2
> > +/*
> > + * Wipe the contents of given directory but keep the directory itself
> > + */

> This should ideally a proper documentation comment, but that can be done
> in an follow up patch.

+1, I'll send v2 now

Kind regards,
Petr
diff mbox series

Patch

diff --git a/include/tst_device.h b/include/tst_device.h
index 36258f436..391fb4e56 100644
--- a/include/tst_device.h
+++ b/include/tst_device.h
@@ -1,6 +1,7 @@ 
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016-2019 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) Linux Test Project, 2019-2024
  */
 
 #ifndef TST_DEVICE_H__
@@ -101,11 +102,6 @@  int tst_dev_sync(int fd);
  */
 unsigned long tst_dev_bytes_written(const char *dev);
 
-/*
- * Wipe the contents of given directory but keep the directory itself
- */
-void tst_purge_dir(const char *path);
-
 /*
  * Find the file or path belongs to which block dev
  * @path       Path to find the backing dev
diff --git a/include/tst_tmpdir.h b/include/tst_tmpdir.h
new file mode 100644
index 000000000..b4f95b666
--- /dev/null
+++ b/include/tst_tmpdir.h
@@ -0,0 +1,15 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) 2020 Martin Doucha <mdoucha@suse.cz>
+ */
+
+#ifndef TST_TMPDIR_H__
+#define TST_TMPDIR_H__
+
+/*
+ * Wipe the contents of given directory but keep the directory itself
+ */
+void tst_purge_dir(const char *path);
+
+#endif /* TST_TMPDIR_H__ */
diff --git a/lib/tst_tmpdir.c b/lib/tst_tmpdir.c
index bcc788390..0f1b15ca4 100644
--- a/lib/tst_tmpdir.c
+++ b/lib/tst_tmpdir.c
@@ -72,6 +72,7 @@ 
 
 #include "test.h"
 #include "safe_macros.h"
+#include "tst_tmpdir.h"
 #include "ltp_priv.h"
 #include "lapi/futex.h"