]>
Commit | Line | Data |
---|---|---|
959ef981 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
6719d622 DW |
2 | /* |
3 | * Copyright (C) 2018 Oracle. All Rights Reserved. | |
6719d622 | 4 | * Author: Darrick J. Wong <darrick.wong@oracle.com> |
6719d622 DW |
5 | */ |
6 | #include "libxfs.h" | |
7 | #include "command.h" | |
8 | #include "init.h" | |
42b4c8e8 | 9 | #include "libfrog/paths.h" |
fee68490 | 10 | #include "libfrog/fsgeom.h" |
a509ad57 | 11 | #include "space.h" |
6719d622 DW |
12 | |
13 | static void | |
14 | info_help(void) | |
15 | { | |
16 | printf(_( | |
17 | "\n" | |
18 | " Pretty-prints the filesystem geometry as derived from the superblock.\n" | |
19 | " The output has the same format as mkfs.xfs, xfs_info, and other utilities.\n" | |
20 | " The opened file must be an XFS mount point.\n" | |
21 | "\n" | |
22 | )); | |
23 | ||
24 | } | |
25 | ||
26 | static int | |
27 | info_f( | |
28 | int argc, | |
29 | char **argv) | |
30 | { | |
6719d622 DW |
31 | if (fs_table_lookup_mount(file->name) == NULL) { |
32 | fprintf(stderr, _("%s: Not a XFS mount point.\n"), file->name); | |
33 | return 1; | |
34 | } | |
35 | ||
a509ad57 DW |
36 | xfs_report_geom(&file->xfd.fsgeom, file->fs_path.fs_name, |
37 | file->fs_path.fs_log, file->fs_path.fs_rt); | |
6719d622 DW |
38 | return 0; |
39 | } | |
40 | ||
41 | static const struct cmdinfo info_cmd = { | |
42 | .name = "info", | |
43 | .altname = "i", | |
44 | .cfunc = info_f, | |
45 | .argmin = 0, | |
46 | .argmax = 0, | |
47 | .canpush = 0, | |
48 | .args = NULL, | |
49 | .flags = CMD_FLAG_ONESHOT, | |
50 | .oneline = N_("pretty-print superblock geometry info"), | |
51 | .help = info_help, | |
52 | }; | |
53 | ||
54 | void | |
55 | info_init(void) | |
56 | { | |
57 | add_command(&info_cmd); | |
58 | } |