public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Tulak <jtulak@redhat.com>
To: xfs@oss.sgi.com
Cc: hch@infradead.org, Jan Tulak <jtulak@redhat.com>
Subject: [PATCH 02b/11] xfsprogs: avoid dependency on Linux XATTR_SIZE_MAX
Date: Thu,  3 Sep 2015 12:33:10 +0200	[thread overview]
Message-ID: <1441276391-23587-2-git-send-email-jtulak@redhat.com> (raw)
In-Reply-To: <1441276391-23587-1-git-send-email-jtulak@redhat.com>

Currently, we depends on Linux XATTR value for on disk
definitions. Which causes trouble on other platforms and
maybe also if this value was to change.

Fix it by creating a custom definition independent from
those in Linux (although with the same values), so it is OK
with the be16 fields used for holding these attributes.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
---
 libxfs/xfs_attr_remote.c |  2 +-
 libxfs/xfs_format.h      | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c
index 5feaf55..98893e2 100644
--- a/libxfs/xfs_attr_remote.c
+++ b/libxfs/xfs_attr_remote.c
@@ -102,7 +102,7 @@ xfs_attr3_rmt_verify(
 	if (be32_to_cpu(rmt->rm_bytes) > fsbsize - sizeof(*rmt))
 		return false;
 	if (be32_to_cpu(rmt->rm_offset) +
-				be32_to_cpu(rmt->rm_bytes) > XATTR_SIZE_MAX)
+				be32_to_cpu(rmt->rm_bytes) > XFS_XATTR_SIZE_MAX)
 		return false;
 	if (rmt->rm_owner == 0)
 		return false;
diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h
index bb7cc04..046b20f 100644
--- a/libxfs/xfs_format.h
+++ b/libxfs/xfs_format.h
@@ -60,6 +60,14 @@ struct xfs_ifork;
 #define	XFS_SB_VERSION_MOREBITSBIT	0x8000
 
 /*
+ * The size of a single extended attribute on disk is limited by
+ * the size of index values within the attribute entries themselves.
+ * These are be16 fields, so we can only support attribute data
+ * sizes up to 2^16 bytes in length.
+ */
+#define XFS_XATTR_SIZE_MAX (1 << 16)
+
+/*
  * Supported feature bit list is just all bits in the versionnum field because
  * we've used them all up and understand them all. Except, of course, for the
  * shared superblock bit, which nobody knows what it does and so is unsupported.
@@ -1483,7 +1491,7 @@ struct xfs_acl {
  */
 #define XFS_ACL_MAX_ENTRIES(mp)	\
 	(xfs_sb_version_hascrc(&mp->m_sb) \
-		?  (XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \
+		?  (XFS_XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \
 						sizeof(struct xfs_acl_entry) \
 		: 25)
 
-- 
2.4.5

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2015-09-03 10:33 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-26 12:00 [PATCH 00/11 v4] xfsprogs: Partial OSX support Jan Tulak
2015-08-26 12:02 ` [PATCH 01/11] xfsprogs: Add a way to compile without blkid Jan Tulak
2015-08-26 12:02   ` [PATCH 02/11] xfsprogs: avoid dependency on linux XATTR_SIZE/LIST_MAX Jan Tulak
2015-08-26 22:01     ` Dave Chinner
2015-08-27  6:06       ` Jan Tulak
2015-08-27  6:02     ` Jan Tulak
2015-09-03 10:33       ` [PATCH 02a/11] xfsprogs: Add XATTR_LIST_MAX to OS X headers Jan Tulak
2015-09-03 10:33         ` Jan Tulak [this message]
2015-09-03 10:33         ` [PATCH 02c/11] xfsprogs: prefix XATTR_LIST_MAX with XFS_ Jan Tulak
2015-08-31 18:58     ` [PATCH 02/11] xfsprogs: avoid dependency on linux XATTR_SIZE/LIST_MAX Christoph Hellwig
2015-09-01  8:13       ` Jan Tulak
2015-09-01  8:35         ` Jan Tulak
2015-08-26 12:02   ` [PATCH 03/11] xfsprogs: Add includes required for OS X builds (delta) Jan Tulak
2015-08-31 18:58     ` Christoph Hellwig
2015-08-26 12:02   ` [PATCH 04/11] xfsprogs: Add autoconf check for fsetxattr call Jan Tulak
2015-08-31 18:59     ` Christoph Hellwig
2015-08-26 12:02   ` [PATCH 05/11] xfsprogs: uuid changes for OS X Jan Tulak
2015-08-31 18:59     ` Christoph Hellwig
2015-08-26 12:02   ` [PATCH 06/11] xfsprogs: Remove conflicting define " Jan Tulak
2015-08-31 18:59     ` Christoph Hellwig
2015-08-26 12:02   ` [PATCH 07/11] xfsprogs: add nftw64 translation " Jan Tulak
2015-08-31 18:59     ` Christoph Hellwig
2015-09-01  7:49       ` Jan Tulak
2015-09-01  8:04       ` [PATCH v2] " Jan Tulak
2015-09-01 16:31         ` Darrick J. Wong
2015-09-01 17:24           ` Christoph Hellwig
2015-09-02  7:12           ` Jan Tulak
2015-09-03 10:39     ` [PATCH v2 07/11] xfsprogs: change nftw64 to nftw Jan Tulak
2015-09-09 10:11       ` Jan Tulak
2015-09-09 10:14       ` [PATCH v3 " Jan Tulak
2015-08-26 12:02   ` [PATCH 08/11] xfsprogs: Add a timer implementation for OS X Jan Tulak
2015-08-31 19:00     ` Christoph Hellwig
2015-09-02 10:54       ` Jan Tulak
2015-08-26 12:02   ` [PATCH 09/11] xfsprogs: Add statvfs64 for osx Jan Tulak
2015-09-08 14:24     ` [PATCH 09/11 v2] " Jan Tulak
2015-08-26 12:02   ` [PATCH 10/11] xfsprogs: add dummy mntent for OS X Jan Tulak
2015-08-31 19:01     ` Christoph Hellwig
2015-09-03  9:01       ` Jan Tulak
2015-09-03 10:33         ` Dave Chinner
2015-09-03 10:37           ` Jan Tulak
2015-09-08 14:23     ` [PATCH 10/11 v2] xfsprogs: make fsr use mntinfo when there is no mntent Jan Tulak
2015-08-26 12:02   ` [PATCH 11/11] xfsprogs: add dummy mremap for OS X Jan Tulak
2015-08-31 19:01     ` Christoph Hellwig
2015-09-03 10:35     ` [PATCH v2] xfsprogs: Make mremap conditional Jan Tulak
2015-08-31 18:57   ` [PATCH 01/11] xfsprogs: Add a way to compile without blkid Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441276391-23587-2-git-send-email-jtulak@redhat.com \
    --to=jtulak@redhat.com \
    --cc=hch@infradead.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox