• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
4  * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
5  */
6 
7 #include <stdio.h>
8 #include <string.h>
9 
10 #define TST_NO_DEFAULT_MAIN
11 #include "tst_test.h"
12 #include "tst_fs.h"
13 
usage(void)14 static void usage(void)
15 {
16 	fprintf(stderr, "Usage: tst_supported_fs [fs_type]\n");
17 	fprintf(stderr, "   If fs_type is supported, return 0\n");
18 	fprintf(stderr, "   If fs_type isn't supported, return 1\n");
19 	fprintf(stderr, "   If fs_type isn't specified, print the list of supported filesystems\n");
20 	fprintf(stderr, "   fs_type - a specified filesystem type\n");
21 }
22 
main(int argc,char * argv[])23 int main(int argc, char *argv[])
24 {
25 	const char *skiplist[] = {"tmpfs", NULL};
26 	const char *const *filesystems;
27 	int i;
28 
29 	if (argc > 2) {
30 		fprintf(stderr, "Can't specify multiple fs_type\n");
31 		usage();
32 		return 2;
33 	}
34 
35 	if (argv[1] && !strcmp(argv[1], "-h")) {
36 		usage();
37 		return 0;
38 	}
39 
40 	if (argv[1])
41 		return !tst_fs_is_supported(argv[1]);
42 
43 	filesystems = tst_get_supported_fs_types(skiplist);
44 	for (i = 0; filesystems[i]; i++)
45 		printf("%s\n", filesystems[i]);
46 
47 	return 0;
48 }
49