public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [xfs:xfs-4.8-misc-fixes-2 3/9] fs/xfs/xfs_ondisk.h:116:2: error: call to '__compiletime_assert_116' declared with attribute error: XFS: offsetof(xfs_dir2_sf_entry_t, offset) is wrong, expected 1
@ 2016-06-22  6:06 kbuild test robot
  2016-06-22  7:42 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: kbuild test robot @ 2016-06-22  6:06 UTC (permalink / raw)
  Cc: Christoph Hellwig, Darrick J. Wong, kbuild-all, xfs

[-- Attachment #1: Type: text/plain, Size: 2407 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs.git xfs-4.8-misc-fixes-2
head:   19b54ee66c4c5de8f8db74d5914d9a97161460bf
commit: 3f94c441e2c3dea029a46a2326b2170acf2c7713 [3/9] xfs: check offsets of variable length structures
config: openrisc-allmodconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 3f94c441e2c3dea029a46a2326b2170acf2c7713
        # save the attached .config to linux build tree
        make.cross ARCH=openrisc 

All errors (new ones prefixed by >>):

   In file included from fs/xfs/xfs_super.c:48:0:
   In function 'xfs_check_ondisk_structs',
       inlined from 'init_xfs_fs' at fs/xfs/xfs_super.c:1855:26:
   fs/xfs/xfs_ondisk.h:114:2: error: call to '__compiletime_assert_114' declared with attribute error: XFS: sizeof(xfs_dir2_sf_entry_t) is wrong, expected 3
>> fs/xfs/xfs_ondisk.h:116:2: error: call to '__compiletime_assert_116' declared with attribute error: XFS: offsetof(xfs_dir2_sf_entry_t, offset) is wrong, expected 1
>> fs/xfs/xfs_ondisk.h:117:2: error: call to '__compiletime_assert_117' declared with attribute error: XFS: offsetof(xfs_dir2_sf_entry_t, name) is wrong, expected 3
   fs/xfs/xfs_ondisk.h:118:2: error: call to '__compiletime_assert_118' declared with attribute error: XFS: sizeof(xfs_dir2_sf_hdr_t) is wrong, expected 10

vim +/__compiletime_assert_116 +116 fs/xfs/xfs_ondisk.h

   108		XFS_CHECK_STRUCT_SIZE(xfs_dir2_ino8_t,			8);
   109		XFS_CHECK_STRUCT_SIZE(xfs_dir2_inou_t,			8);
   110		XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_entry_t,		8);
   111		XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_hdr_t,		16);
   112		XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_t,			16);
   113		XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_tail_t,		4);
 > 114		XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_entry_t,		3);
   115		XFS_CHECK_OFFSET(xfs_dir2_sf_entry_t, namelen,		0);
 > 116		XFS_CHECK_OFFSET(xfs_dir2_sf_entry_t, offset,		1);
 > 117		XFS_CHECK_OFFSET(xfs_dir2_sf_entry_t, name,		3);
   118		XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_hdr_t,		10);
   119		XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_off_t,		2);
   120	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 37842 bytes --]

[-- Attachment #3: Type: text/plain, Size: 121 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [xfs:xfs-4.8-misc-fixes-2 3/9] fs/xfs/xfs_ondisk.h:116:2: error: call to '__compiletime_assert_116' declared with attribute error: XFS: offsetof(xfs_dir2_sf_entry_t, offset) is wrong, expected 1
  2016-06-22  6:06 [xfs:xfs-4.8-misc-fixes-2 3/9] fs/xfs/xfs_ondisk.h:116:2: error: call to '__compiletime_assert_116' declared with attribute error: XFS: offsetof(xfs_dir2_sf_entry_t, offset) is wrong, expected 1 kbuild test robot
@ 2016-06-22  7:42 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2016-06-22  7:42 UTC (permalink / raw)
  To: kbuild test robot; +Cc: jonas, xfs, kbuild-all, Darrick J. Wong

On Wed, Jun 22, 2016 at 02:06:49PM +0800, kbuild test robot wrote:
> config: openrisc-allmodconfig (attached as .config)
> compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1

This looks openrisc copied it's weird packing rules from the old ARM
ABI and would need to define __arch_pack similar to ARM.  Alternatively
we could try to get rid of our struct types that wrap the char
arrays for the unaligned fields.   For the SF dir offset that would
looks something like this (untested):

diff --git a/fs/xfs/libxfs/xfs_da_format.h b/fs/xfs/libxfs/xfs_da_format.h
index 8d4d8bc..e1d8e59 100644
--- a/fs/xfs/libxfs/xfs_da_format.h
+++ b/fs/xfs/libxfs/xfs_da_format.h
@@ -192,12 +192,6 @@ typedef	__uint16_t	xfs_dir2_data_off_t;
 typedef uint		xfs_dir2_data_aoff_t;	/* argument form */
 
 /*
- * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t.
- * Only need 16 bits, this is the byte offset into the single block form.
- */
-typedef struct { __uint8_t i[2]; } __arch_pack xfs_dir2_sf_off_t;
-
-/*
  * Offset in data space of a data entry.
  */
 typedef	__uint32_t	xfs_dir2_dataptr_t;
@@ -251,7 +245,7 @@ typedef struct xfs_dir2_sf_hdr {
 
 typedef struct xfs_dir2_sf_entry {
 	__u8			namelen;	/* actual name length */
-	xfs_dir2_sf_off_t	offset;		/* saved offset */
+	__u8			offset[2];	/* saved offset */
 	__u8			name[];		/* name, variable size */
 	/*
 	 * A single byte containing the file type field follows the inode
@@ -272,13 +266,13 @@ static inline int xfs_dir2_sf_hdr_size(int i8count)
 static inline xfs_dir2_data_aoff_t
 xfs_dir2_sf_get_offset(xfs_dir2_sf_entry_t *sfep)
 {
-	return get_unaligned_be16(&sfep->offset.i);
+	return get_unaligned_be16(sfep->offset);
 }
 
 static inline void
 xfs_dir2_sf_put_offset(xfs_dir2_sf_entry_t *sfep, xfs_dir2_data_aoff_t off)
 {
-	put_unaligned_be16(off, &sfep->offset.i);
+	put_unaligned_be16(off, sfep->offset);
 }
 
 static inline struct xfs_dir2_sf_entry *
diff --git a/fs/xfs/libxfs/xfs_dir2_sf.c b/fs/xfs/libxfs/xfs_dir2_sf.c
index e5bb9cc..18cc6c7 100644
--- a/fs/xfs/libxfs/xfs_dir2_sf.c
+++ b/fs/xfs/libxfs/xfs_dir2_sf.c
@@ -126,11 +126,10 @@ xfs_dir2_block_sfsize(
 		/*
 		 * Calculate the new size, see if we should give up yet.
 		 */
-		size = xfs_dir2_sf_hdr_size(i8count) +		/* header */
-		       count +					/* namelen */
-		       count * (uint)sizeof(xfs_dir2_sf_off_t) + /* offset */
-		       namelen +				/* name */
-		       (i8count ?				/* inumber */
+		size = xfs_dir2_sf_hdr_size(i8count) +	/* header */
+		       count * 3 * sizeof(u8) +		/* namelen + offset */
+		       namelen +			/* name */
+		       (i8count ?			/* inumber */
 				(uint)sizeof(xfs_dir2_ino8_t) * count :
 				(uint)sizeof(xfs_dir2_ino4_t) * count);
 		if (size > XFS_IFORK_DSIZE(dp))
@@ -1048,7 +1047,8 @@ xfs_dir2_sf_toino4(
 	     i++, sfep = dp->d_ops->sf_nextentry(sfp, sfep),
 		  oldsfep = dp->d_ops->sf_nextentry(oldsfp, oldsfep)) {
 		sfep->namelen = oldsfep->namelen;
-		sfep->offset = oldsfep->offset;
+		sfep->offset[0] = oldsfep->offset[0];
+		sfep->offset[1] = oldsfep->offset[1];
 		memcpy(sfep->name, oldsfep->name, sfep->namelen);
 		dp->d_ops->sf_put_ino(sfp, sfep,
 				      dp->d_ops->sf_get_ino(oldsfp, oldsfep));
@@ -1124,7 +1124,8 @@ xfs_dir2_sf_toino8(
 	     i++, sfep = dp->d_ops->sf_nextentry(sfp, sfep),
 		  oldsfep = dp->d_ops->sf_nextentry(oldsfp, oldsfep)) {
 		sfep->namelen = oldsfep->namelen;
-		sfep->offset = oldsfep->offset;
+		sfep->offset[0] = oldsfep->offset[0];
+		sfep->offset[1] = oldsfep->offset[1];
 		memcpy(sfep->name, oldsfep->name, sfep->namelen);
 		dp->d_ops->sf_put_ino(sfp, sfep,
 				      dp->d_ops->sf_get_ino(oldsfp, oldsfep));
diff --git a/fs/xfs/xfs_ondisk.h b/fs/xfs/xfs_ondisk.h
index 0272301..3cbc1f8 100644
--- a/fs/xfs/xfs_ondisk.h
+++ b/fs/xfs/xfs_ondisk.h
@@ -116,7 +116,6 @@ xfs_check_ondisk_structs(void)
 	XFS_CHECK_OFFSET(xfs_dir2_sf_entry_t, offset,		1);
 	XFS_CHECK_OFFSET(xfs_dir2_sf_entry_t, name,		3);
 	XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_hdr_t,		10);
-	XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_off_t,		2);
 
 	/* log structures */
 	XFS_CHECK_STRUCT_SIZE(struct xfs_dq_logformat,		24);

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-22  7:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-22  6:06 [xfs:xfs-4.8-misc-fixes-2 3/9] fs/xfs/xfs_ondisk.h:116:2: error: call to '__compiletime_assert_116' declared with attribute error: XFS: offsetof(xfs_dir2_sf_entry_t, offset) is wrong, expected 1 kbuild test robot
2016-06-22  7:42 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox