From patchwork Sat Oct 6 22:08:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Borowski X-Patchwork-Id: 10629355 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA335112B for ; Sat, 6 Oct 2018 22:08:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDA6C21FAD for ; Sat, 6 Oct 2018 22:08:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDDA322376; Sat, 6 Oct 2018 22:08:21 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 B42BF21FAD for ; Sat, 6 Oct 2018 22:08:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725829AbeJGFNQ (ORCPT ); Sun, 7 Oct 2018 01:13:16 -0400 Received: from tartarus.angband.pl ([54.37.238.230]:53370 "EHLO tartarus.angband.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725779AbeJGFNQ (ORCPT ); Sun, 7 Oct 2018 01:13:16 -0400 Received: from 89-64-163-218.dynamic.chello.pl ([89.64.163.218] helo=umbar.angband.pl) by tartarus.angband.pl with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1g8uk9-0004zv-SQ; Sun, 07 Oct 2018 00:08:15 +0200 Received: from kilobyte by umbar.angband.pl with local (Exim 4.91) (envelope-from ) id 1g8uk9-0005ck-2g; Sun, 07 Oct 2018 00:08:13 +0200 From: Adam Borowski To: "Darrick J. Wong" , Dave Chinner , linux-xfs@vger.kernel.org Cc: Adam Borowski Date: Sun, 7 Oct 2018 00:08:11 +0200 Message-Id: <20181006220811.21482-1-kilobyte@angband.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181005234009.GJ12041@dastard> References: <20181005234009.GJ12041@dastard> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 89.64.163.218 X-SA-Exim-Mail-From: kilobyte@angband.pl Subject: [PATCH v2] xfs: add a define for statfs magic to uapi X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on tartarus.angband.pl) 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 Needed by userspace programs that call fstatfs(). It'd be natural to publish XFS_SB_MAGIC in uapi, but while these two have identical values, they have different semantic meaning: one is an enum cookie meant for statfs, the other a signature of the on-disk format. Signed-off-by: Adam Borowski Reviewed-by: Darrick J. Wong --- > > include/uapi/linux/magic.h would get: > > > > #define XFS_STATFS_MAGIC 0x58465342 /* 'XFSB' */ > > $ man statfs |grep 0x5846 > XFS_SUPER_MAGIC 0x58465342 Indeed, not only it is documented this way, but almost every other filesystem has the define named FOO_SUPER_MAGIC. Thus, inventing something else doesn't seem to be a good idea to me. On the other hand, this might be considered bikeshedding, and you're the maintainer of this particular shed... fs/xfs/xfs_super.c | 5 +++-- include/uapi/linux/magic.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 207ee302b1bb..90b08051a4f3 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -1097,7 +1098,7 @@ xfs_fs_statfs( xfs_extlen_t lsize; int64_t ffree; - statp->f_type = XFS_SB_MAGIC; + statp->f_type = XFS_SUPER_MAGIC; statp->f_namelen = MAXNAMELEN - 1; id = huge_encode_dev(mp->m_ddev_targp->bt_dev); @@ -1650,7 +1651,7 @@ xfs_fs_fill_super( * we must configure the block size in the superblock before we run the * full mount process as the mount process can lookup and cache inodes. */ - sb->s_magic = XFS_SB_MAGIC; + sb->s_magic = XFS_SUPER_MAGIC; sb->s_blocksize = mp->m_sb.sb_blocksize; sb->s_blocksize_bits = ffs(sb->s_blocksize) - 1; sb->s_maxbytes = xfs_max_file_offset(sb->s_blocksize_bits); diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h index 1a6fee974116..96c24478d8ce 100644 --- a/include/uapi/linux/magic.h +++ b/include/uapi/linux/magic.h @@ -29,6 +29,7 @@ #define HPFS_SUPER_MAGIC 0xf995e849 #define ISOFS_SUPER_MAGIC 0x9660 #define JFFS2_SUPER_MAGIC 0x72b6 +#define XFS_SUPER_MAGIC 0x58465342 /* "XFSB" */ #define PSTOREFS_MAGIC 0x6165676C #define EFIVARFS_MAGIC 0xde5e81e4 #define HOSTFS_SUPER_MAGIC 0x00c0ffee