+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2003-2005 Silicon Graphics, Inc.
* All Rights Reserved.
- *
* Copyright (C) 2015, 2017 Red Hat, Inc.
* Portions of statx support written by David Howells (dhowells@redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "command.h"
#include "io.h"
#include "statx.h"
#include "libxfs.h"
+#include "libfrog/logging.h"
+#include "libfrog/fsgeom.h"
#include <fcntl.h>
return 0;
}
-void print_file_info(void)
+static void
+print_file_info(void)
{
printf(_("fd.path = \"%s\"\n"), file->name);
printf(_("fd.flags = %s,%s,%s%s%s%s%s\n"),
file->flags & IO_TMPFILE ? _(",tmpfile") : "");
}
-void print_xfs_info(int verbose)
+static void
+print_xfs_info(int verbose)
{
struct dioattr dio;
struct fsxattr fsx, fsxa;
struct xfs_fsop_counts fscounts;
struct xfs_fsop_geom fsgeo;
struct statfs st;
+ int ret;
printf(_("fd.path = \"%s\"\n"), file->name);
if (platform_fstatfs(file->fd, &st) < 0) {
printf(_("statfs.f_bavail = %lld\n"), (long long) st.f_bavail);
printf(_("statfs.f_files = %lld\n"), (long long) st.f_files);
printf(_("statfs.f_ffree = %lld\n"), (long long) st.f_ffree);
- printf(_("statfs.f_fflags = 0x%llx\n"), (long long) st.f_flags);
+#ifdef HAVE_STATFS_FLAGS
+ printf(_("statfs.f_flags = 0x%llx\n"), (long long) st.f_flags);
+#endif
}
if (file->flags & IO_FOREIGN)
return 0;
- if ((xfsctl(file->name, file->fd, XFS_IOC_FSGEOMETRY_V1, &fsgeo)) < 0) {
- perror("XFS_IOC_FSGEOMETRY_V1");
+ ret = -xfrog_geometry(file->fd, &fsgeo);
+ if (ret) {
+ xfrog_perror(ret, "XFS_IOC_FSGEOMETRY");
} else {
printf(_("geom.bsize = %u\n"), fsgeo.blocksize);
printf(_("geom.agcount = %u\n"), fsgeo.agcount);
printf("stat.ino = %llu\n", (unsigned long long)stx->stx_ino);
printf("stat.size = %llu\n", (unsigned long long)stx->stx_size);
printf("stat.blocks = %llu\n", (unsigned long long)stx->stx_blocks);
+ printf("stat.attributes_mask = 0x%llx\n", (unsigned long long)stx->stx_attributes_mask);
printf("stat.atime.tv_sec = %lld\n", (long long)stx->stx_atime.tv_sec);
printf("stat.atime.tv_nsec = %d\n", stx->stx_atime.tv_nsec);
printf("stat.btime.tv_sec = %lld\n", (long long)stx->stx_btime.tv_sec);
* - output style for flags (and all else?) (chars vs. hex?)
* - output - mask out incidental flag or not?
*/
-int
+static int
statx_f(
int argc,
char **argv)