1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 * AUTHOR : William Roske, CO-PILOT : Dave Fenner
5 * Copyright (c) 2022 SUSE LLC Avinesh Kumar <[email protected]>
6 */
7
8 /*\
9 * [Description]
10 *
11 * Verify that statfs() syscall executes successfully on all
12 * available filesystems.
13 */
14
15 #include "tst_test.h"
16
17 #define MNT_POINT "mntpoint"
18 #define TEMP_FILE MNT_POINT"/testfile"
19 #define TEXT "dummy text"
20
setup(void)21 static void setup(void)
22 {
23 int fd = SAFE_OPEN(TEMP_FILE, O_RDWR | O_CREAT, 0700);
24
25 SAFE_WRITE(SAFE_WRITE_ALL, fd, TEXT, strlen(TEXT));
26 SAFE_CLOSE(fd);
27 }
28
run(void)29 static void run(void)
30 {
31 struct statfs buf;
32
33 TST_EXP_PASS(statfs(TEMP_FILE, &buf));
34 }
35
36 static struct tst_test test = {
37 .setup = setup,
38 .test_all = run,
39 .needs_root = 1,
40 .mount_device = 1,
41 .mntpoint = MNT_POINT,
42 .all_filesystems = 1
43 };
44