Skip to content

Commit

Permalink
lib: Create tst_tmpdir.h
Browse files Browse the repository at this point in the history
This fixes our sparse warning:

tst_tmpdir.c:347:6: warning: Symbol 'tst_purge_dir' has no prototype or
library ('tst_') prefix. Should it be static?

Header needs to be added also to include/tst_test.h (for tests which use
tst_purge_dir, e.g. creat08.c).

Link: https://lore.kernel.org/ltp/20240712081359.116227-2-pvorel@suse.cz/
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Reviewed-by: Li Wang <liwang@redhat.com>
Reviewed-by: Avinesh Kumar <akumar@suse.de>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
  • Loading branch information
pevik committed Jul 12, 2024
1 parent 9168820 commit f2e10a9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
6 changes: 1 addition & 5 deletions include/tst_device.h
Original file line number Diff line number Diff line change
@@ -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__
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions include/tst_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "tst_memutils.h"
#include "tst_arch.h"
#include "tst_fd.h"
#include "tst_tmpdir.h"

void tst_res_(const char *file, const int lineno, int ttype,
const char *fmt, ...)
Expand Down
19 changes: 19 additions & 0 deletions include/tst_tmpdir.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// 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__

/**
* tst_purge_dir - Wipe the content of given directory.
*
* Wipe the content of given directory but keep the directory itself.
*
* @path: Path of the directory to be wiped.
*/
void tst_purge_dir(const char *path);

#endif /* TST_TMPDIR_H__ */
1 change: 1 addition & 0 deletions lib/tst_tmpdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@

#include "test.h"
#include "safe_macros.h"
#include "tst_tmpdir.h"
#include "ltp_priv.h"
#include "lapi/futex.h"

Expand Down

0 comments on commit f2e10a9

Please sign in to comment.