]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - db/info.c
xfsprogs: Release v4.19.0-rc1
[thirdparty/xfsprogs-dev.git] / db / info.c
CommitLineData
959ef981 1// SPDX-License-Identifier: GPL-2.0+
172793ee
DW
2/*
3 * Copyright (C) 2018 Oracle. All Rights Reserved.
172793ee 4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
172793ee
DW
5 */
6#include "libxfs.h"
7#include "command.h"
8#include "init.h"
9#include "output.h"
10#include "fsgeom.h"
11
12static void
13info_help(void)
14{
15 dbprintf(_(
16"\n"
17" Pretty-prints the filesystem geometry as derived from the superblock.\n"
18" The output has the same format as mkfs.xfs, xfs_info, and other utilities.\n"
19"\n"
20));
21
22}
23
24static int
25info_f(
26 int argc,
27 char **argv)
28{
29 struct xfs_fsop_geom geo;
30 int error;
31
32 error = -libxfs_fs_geometry(&mp->m_sb, &geo,
33 XFS_FS_GEOM_MAX_STRUCT_VER);
34 if (error) {
35 dbprintf(_("could not obtain geometry\n"));
36 exitcode = 1;
37 return 0;
38 }
39
40 xfs_report_geom(&geo, fsdevice, x.logname, x.rtname);
41 return 0;
42}
43
44static const struct cmdinfo info_cmd = {
45 .name = "info",
46 .altname = "i",
47 .cfunc = info_f,
48 .argmin = 0,
49 .argmax = 0,
50 .canpush = 0,
51 .args = NULL,
52 .oneline = N_("pretty-print superblock info"),
53 .help = info_help,
54};
55
56void
57info_init(void)
58{
59 add_command(&info_cmd);
60}