xref: /third_party/ltp/testcases/kernel/containers/mountns/mountns.h (revision f08c3bdf)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/ltp/testcases/kernel/containers/mountns/
1f08c3bdfSopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
2f08c3bdfSopenharmony_ci/*
3f08c3bdfSopenharmony_ci * Copyright (c) 2014 Red Hat, Inc.
4f08c3bdfSopenharmony_ci * Copyright (C) 2021 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
5f08c3bdfSopenharmony_ci */
6f08c3bdfSopenharmony_ci
7f08c3bdfSopenharmony_ci#ifndef COMMON_H
8f08c3bdfSopenharmony_ci#define COMMON_H
9f08c3bdfSopenharmony_ci
10f08c3bdfSopenharmony_ci#include "tst_test.h"
11f08c3bdfSopenharmony_ci
12f08c3bdfSopenharmony_ci#define DIRA "LTP_DIR_A"
13f08c3bdfSopenharmony_ci#define DIRB "LTP_DIR_B"
14f08c3bdfSopenharmony_ci
15f08c3bdfSopenharmony_cistatic void umount_folders(void)
16f08c3bdfSopenharmony_ci{
17f08c3bdfSopenharmony_ci	if (tst_is_mounted(DIRA))
18f08c3bdfSopenharmony_ci		SAFE_UMOUNT(DIRA);
19f08c3bdfSopenharmony_ci
20f08c3bdfSopenharmony_ci	if (tst_is_mounted(DIRB))
21f08c3bdfSopenharmony_ci		SAFE_UMOUNT(DIRB);
22f08c3bdfSopenharmony_ci}
23f08c3bdfSopenharmony_ci
24f08c3bdfSopenharmony_cistatic void create_folders(void)
25f08c3bdfSopenharmony_ci{
26f08c3bdfSopenharmony_ci	SAFE_MKDIR(DIRA, 0777);
27f08c3bdfSopenharmony_ci	SAFE_MKDIR(DIRB, 0777);
28f08c3bdfSopenharmony_ci	SAFE_TOUCH(DIRA "/A", 0, NULL);
29f08c3bdfSopenharmony_ci	SAFE_TOUCH(DIRB "/B", 0, NULL);
30f08c3bdfSopenharmony_ci}
31f08c3bdfSopenharmony_ci
32f08c3bdfSopenharmony_ci#endif
33

Indexes created Thu Nov 07 10:32:03 CST 2024