From patchwork Fri Nov 17 19:54:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Mahoney X-Patchwork-Id: 10063551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CDC976023A for ; Fri, 17 Nov 2017 19:52:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEFE92A8D1 for ; Fri, 17 Nov 2017 19:52:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3E982A989; Fri, 17 Nov 2017 19:52:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2B352A9BD for ; Fri, 17 Nov 2017 19:52:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965178AbdKQTwi (ORCPT ); Fri, 17 Nov 2017 14:52:38 -0500 Received: from mx2.suse.de ([195.135.220.15]:43700 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965179AbdKQTwh (ORCPT ); Fri, 17 Nov 2017 14:52:37 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 744E8ADBF for ; Fri, 17 Nov 2017 19:52:36 +0000 (UTC) Received: by starscream.home.jeffm.io (Postfix, from userid 1000) id 0DF0680089; Fri, 17 Nov 2017 14:55:03 -0500 (EST) From: jeffm@suse.com To: linux-xfs@vger.kernel.org Cc: Jeff Mahoney Subject: [PATCH 2/2] xfs_io: stat: treat statfs.f_flags as optional Date: Fri, 17 Nov 2017 14:54:57 -0500 Message-Id: <20171117195457.16218-2-jeffm@suse.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171117195457.16218-1-jeffm@suse.com> References: <20171117195457.16218-1-jeffm@suse.com> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jeff Mahoney Kernels prior to 2.6.36 didn't contain statfs.f_flags. Distros with initial releases with kernels prior to this may not have updated headers with this member. Only attempt to print it if we have the header with the member defined. Signed-off-by: Jeff Mahoney Reviewed-by: Eric Sandeen --- configure.ac | 1 + include/builddefs.in | 1 + io/stat.c | 2 ++ m4/package_libcdev.m4 | 14 ++++++++++++++ 4 files changed, 18 insertions(+) diff --git a/configure.ac b/configure.ac index 4161c3b4..939d802b 100644 --- a/configure.ac +++ b/configure.ac @@ -143,6 +143,7 @@ AC_HAVE_FSETXATTR AC_HAVE_MREMAP AC_NEED_INTERNAL_FSXATTR AC_HAVE_GETFSMAP +AC_HAVE_STATFS_FLAGS if test "$enable_blkid" = yes; then AC_HAVE_BLKID_TOPO diff --git a/include/builddefs.in b/include/builddefs.in index ec630bd9..13756d79 100644 --- a/include/builddefs.in +++ b/include/builddefs.in @@ -113,6 +113,7 @@ HAVE_FSETXATTR = @have_fsetxattr@ HAVE_MREMAP = @have_mremap@ NEED_INTERNAL_FSXATTR = @need_internal_fsxattr@ HAVE_GETFSMAP = @have_getfsmap@ +HAVE_STATFS_FLAGS = @have_statfs_flags@ GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall # -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl diff --git a/io/stat.c b/io/stat.c index 6ab10abf..1ca5b0d6 100644 --- a/io/stat.c +++ b/io/stat.c @@ -199,7 +199,9 @@ statfs_f( 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); +#ifdef HAVE_STATFS_FLAGS printf(_("statfs.f_flags = 0x%llx\n"), (long long) st.f_flags); +#endif } if (file->flags & IO_FOREIGN) return 0; diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4 index fa5b6397..bc395acd 100644 --- a/m4/package_libcdev.m4 +++ b/m4/package_libcdev.m4 @@ -297,3 +297,17 @@ AC_DEFUN([AC_HAVE_GETFSMAP], AC_MSG_RESULT(no)) AC_SUBST(have_getfsmap) ]) + +AC_DEFUN([AC_HAVE_STATFS_FLAGS], + [ + AC_CHECK_TYPE(struct statfs, + [ + AC_CHECK_MEMBER(struct statfs.f_flags, + have_statfs_flags=yes,, + [#include ] + ) + ],, + [#include ] + ) + AC_SUBST(have_statfs_flags) + ])