linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Proper packed attribute usage?
@ 2019-06-17  9:06 Qu Wenruo
  2019-06-17 13:18 ` David Sterba
  2019-06-17 15:37 ` James Bottomley
  0 siblings, 2 replies; 5+ messages in thread
From: Qu Wenruo @ 2019-06-17  9:06 UTC (permalink / raw)
  To: linux-btrfs@vger.kernel.org, Linux FS Devel


[-- Attachment #1.1: Type: text/plain, Size: 1085 bytes --]

Hi,

With GCC 9 coming soon, its new default warning,
-Waddress-of-packed-member, is already causing a lot of btrfs-progs
warnings.

It's pretty sure kernel will just suppress this warning, but this makes
me to think about the proper way to use packed attribute.

To my poor understanding, we should only use packed attribute handling:
- On-disk format
  Obviously. And also needs extra handlers to do the endian convert.

- Ioctl parameters
  To make sure the format doesn't change.

- Fixed format packages
  For network packages.

But then this means, we should have two copies of data for every such
structures.
One for the fixed format one, and one for the compiler aligned one, with
enough helper to convert them (along with needed endian convert).

Is that the correct practice?

And for a btrfs specific question, why we have packed attribute for
btrfs_key?
I see no specific reason to make a CPU native structure packed, not to
mention we already have btrfs_disk_key.
And no ioctl structure is using btrfs_key in its parameter.

Thanks,
Qu


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2019-06-18  1:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-17  9:06 Proper packed attribute usage? Qu Wenruo
2019-06-17 13:18 ` David Sterba
2019-06-17 13:40   ` Qu Wenruo
2019-06-17 15:37 ` James Bottomley
2019-06-18  1:07   ` Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).