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