Proper packed attribute usage?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux