Re: [PATCH 01/12 linux-next] udf: use __packed instead of __attribute__ ((packed))

From: Jan Kara
Date: Tue Jan 10 2017 - 05:29:47 EST


On Fri 06-01-17 21:53:49, Fabian Frederick wrote:
> defined in linux/compiler-gcc.h
>
> Signed-off-by: Fabian Frederick <fabf@xxxxxxxxx>

Thanks. Applied.

Honza
> ---
> fs/udf/ecma_167.h | 98 +++++++++++++++++++++++++++----------------------------
> fs/udf/osta_udf.h | 34 +++++++++----------
> 2 files changed, 66 insertions(+), 66 deletions(-)
>
> diff --git a/fs/udf/ecma_167.h b/fs/udf/ecma_167.h
> index 4792b77..9f24bd1 100644
> --- a/fs/udf/ecma_167.h
> +++ b/fs/udf/ecma_167.h
> @@ -41,7 +41,7 @@
> struct charspec {
> uint8_t charSetType;
> uint8_t charSetInfo[63];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Character Set Type (ECMA 167r3 1/7.2.1.1) */
> #define CHARSPEC_TYPE_CS0 0x00 /* (1/7.2.2) */
> @@ -68,7 +68,7 @@ struct timestamp {
> uint8_t centiseconds;
> uint8_t hundredsOfMicroseconds;
> uint8_t microseconds;
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Type and Time Zone (ECMA 167r3 1/7.3.1) */
> #define TIMESTAMP_TYPE_MASK 0xF000
> @@ -82,7 +82,7 @@ struct regid {
> uint8_t flags;
> uint8_t ident[23];
> uint8_t identSuffix[8];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Flags (ECMA 167r3 1/7.4.1) */
> #define ENTITYID_FLAGS_DIRTY 0x00
> @@ -95,7 +95,7 @@ struct volStructDesc {
> uint8_t stdIdent[VSD_STD_ID_LEN];
> uint8_t structVersion;
> uint8_t structData[2041];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Standard Identifier (EMCA 167r2 2/9.1.2) */
> #define VSD_STD_ID_NSR02 "NSR02" /* (3/9.1) */
> @@ -114,7 +114,7 @@ struct beginningExtendedAreaDesc {
> uint8_t stdIdent[VSD_STD_ID_LEN];
> uint8_t structVersion;
> uint8_t structData[2041];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Terminating Extended Area Descriptor (ECMA 167r3 2/9.3) */
> struct terminatingExtendedAreaDesc {
> @@ -122,7 +122,7 @@ struct terminatingExtendedAreaDesc {
> uint8_t stdIdent[VSD_STD_ID_LEN];
> uint8_t structVersion;
> uint8_t structData[2041];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Boot Descriptor (ECMA 167r3 2/9.4) */
> struct bootDesc {
> @@ -140,7 +140,7 @@ struct bootDesc {
> __le16 flags;
> uint8_t reserved2[32];
> uint8_t bootUse[1906];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Flags (ECMA 167r3 2/9.4.12) */
> #define BOOT_FLAGS_ERASE 0x01
> @@ -149,7 +149,7 @@ struct bootDesc {
> struct extent_ad {
> __le32 extLength;
> __le32 extLocation;
> -} __attribute__ ((packed));
> +} __packed;
>
> struct kernel_extent_ad {
> uint32_t extLength;
> @@ -166,7 +166,7 @@ struct tag {
> __le16 descCRC;
> __le16 descCRCLength;
> __le32 tagLocation;
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Tag Identifier (ECMA 167r3 3/7.2.1) */
> #define TAG_IDENT_PVD 0x0001
> @@ -186,7 +186,7 @@ struct NSRDesc {
> uint8_t structVersion;
> uint8_t reserved;
> uint8_t structData[2040];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Primary Volume Descriptor (ECMA 167r3 3/10.1) */
> struct primaryVolDesc {
> @@ -212,7 +212,7 @@ struct primaryVolDesc {
> __le32 predecessorVolDescSeqLocation;
> __le16 flags;
> uint8_t reserved[22];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Flags (ECMA 167r3 3/10.1.21) */
> #define PVD_FLAGS_VSID_COMMON 0x0001
> @@ -223,7 +223,7 @@ struct anchorVolDescPtr {
> struct extent_ad mainVolDescSeqExt;
> struct extent_ad reserveVolDescSeqExt;
> uint8_t reserved[480];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Volume Descriptor Pointer (ECMA 167r3 3/10.3) */
> struct volDescPtr {
> @@ -231,7 +231,7 @@ struct volDescPtr {
> __le32 volDescSeqNum;
> struct extent_ad nextVolDescSeqExt;
> uint8_t reserved[484];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Implementation Use Volume Descriptor (ECMA 167r3 3/10.4) */
> struct impUseVolDesc {
> @@ -239,7 +239,7 @@ struct impUseVolDesc {
> __le32 volDescSeqNum;
> struct regid impIdent;
> uint8_t impUse[460];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Partition Descriptor (ECMA 167r3 3/10.5) */
> struct partitionDesc {
> @@ -255,7 +255,7 @@ struct partitionDesc {
> struct regid impIdent;
> uint8_t impUse[128];
> uint8_t reserved[156];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Partition Flags (ECMA 167r3 3/10.5.3) */
> #define PD_PARTITION_FLAGS_ALLOC 0x0001
> @@ -291,14 +291,14 @@ struct logicalVolDesc {
> uint8_t impUse[128];
> struct extent_ad integritySeqExt;
> uint8_t partitionMaps[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Generic Partition Map (ECMA 167r3 3/10.7.1) */
> struct genericPartitionMap {
> uint8_t partitionMapType;
> uint8_t partitionMapLength;
> uint8_t partitionMapping[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Partition Map Type (ECMA 167r3 3/10.7.1.1) */
> #define GP_PARTITION_MAP_TYPE_UNDEF 0x00
> @@ -311,14 +311,14 @@ struct genericPartitionMap1 {
> uint8_t partitionMapLength;
> __le16 volSeqNum;
> __le16 partitionNum;
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Type 2 Partition Map (ECMA 167r3 3/10.7.3) */
> struct genericPartitionMap2 {
> uint8_t partitionMapType;
> uint8_t partitionMapLength;
> uint8_t partitionIdent[62];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Unallocated Space Descriptor (ECMA 167r3 3/10.8) */
> struct unallocSpaceDesc {
> @@ -326,13 +326,13 @@ struct unallocSpaceDesc {
> __le32 volDescSeqNum;
> __le32 numAllocDescs;
> struct extent_ad allocDescs[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Terminating Descriptor (ECMA 167r3 3/10.9) */
> struct terminatingDesc {
> struct tag descTag;
> uint8_t reserved[496];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Logical Volume Integrity Descriptor (ECMA 167r3 3/10.10) */
> struct logicalVolIntegrityDesc {
> @@ -346,7 +346,7 @@ struct logicalVolIntegrityDesc {
> __le32 freeSpaceTable[0];
> __le32 sizeTable[0];
> uint8_t impUse[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Integrity Type (ECMA 167r3 3/10.10.3) */
> #define LVID_INTEGRITY_TYPE_OPEN 0x00000000
> @@ -356,7 +356,7 @@ struct logicalVolIntegrityDesc {
> struct lb_addr {
> __le32 logicalBlockNum;
> __le16 partitionReferenceNum;
> -} __attribute__ ((packed));
> +} __packed;
>
> /* ... and its in-core analog */
> struct kernel_lb_addr {
> @@ -368,14 +368,14 @@ struct kernel_lb_addr {
> struct short_ad {
> __le32 extLength;
> __le32 extPosition;
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */
> struct long_ad {
> __le32 extLength;
> struct lb_addr extLocation;
> uint8_t impUse[6];
> -} __attribute__ ((packed));
> +} __packed;
>
> struct kernel_long_ad {
> uint32_t extLength;
> @@ -389,7 +389,7 @@ struct ext_ad {
> __le32 recordedLength;
> __le32 informationLength;
> struct lb_addr extLocation;
> -} __attribute__ ((packed));
> +} __packed;
>
> struct kernel_ext_ad {
> uint32_t extLength;
> @@ -434,7 +434,7 @@ struct fileSetDesc {
> struct long_ad nextExt;
> struct long_ad streamDirectoryICB;
> uint8_t reserved[32];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Partition Header Descriptor (ECMA 167r3 4/14.3) */
> struct partitionHeaderDesc {
> @@ -444,7 +444,7 @@ struct partitionHeaderDesc {
> struct short_ad freedSpaceTable;
> struct short_ad freedSpaceBitmap;
> uint8_t reserved[88];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* File Identifier Descriptor (ECMA 167r3 4/14.4) */
> struct fileIdentDesc {
> @@ -457,7 +457,7 @@ struct fileIdentDesc {
> uint8_t impUse[0];
> uint8_t fileIdent[0];
> uint8_t padding[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* File Characteristics (ECMA 167r3 4/14.4.3) */
> #define FID_FILE_CHAR_HIDDEN 0x01
> @@ -471,7 +471,7 @@ struct allocExtDesc {
> struct tag descTag;
> __le32 previousAllocExtLocation;
> __le32 lengthAllocDescs;
> -} __attribute__ ((packed));
> +} __packed;
>
> /* ICB Tag (ECMA 167r3 4/14.6) */
> struct icbtag {
> @@ -483,7 +483,7 @@ struct icbtag {
> uint8_t fileType;
> struct lb_addr parentICBLocation;
> __le16 flags;
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Strategy Type (ECMA 167r3 4/14.6.2) */
> #define ICBTAG_STRATEGY_TYPE_UNDEF 0x0000
> @@ -531,13 +531,13 @@ struct indirectEntry {
> struct tag descTag;
> struct icbtag icbTag;
> struct long_ad indirectICB;
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Terminal Entry (ECMA 167r3 4/14.8) */
> struct terminalEntry {
> struct tag descTag;
> struct icbtag icbTag;
> -} __attribute__ ((packed));
> +} __packed;
>
> /* File Entry (ECMA 167r3 4/14.9) */
> struct fileEntry {
> @@ -563,7 +563,7 @@ struct fileEntry {
> __le32 lengthAllocDescs;
> uint8_t extendedAttr[0];
> uint8_t allocDescs[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Permissions (ECMA 167r3 4/14.9.5) */
> #define FE_PERM_O_EXEC 0x00000001U
> @@ -607,7 +607,7 @@ struct extendedAttrHeaderDesc {
> struct tag descTag;
> __le32 impAttrLocation;
> __le32 appAttrLocation;
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Generic Format (ECMA 167r3 4/14.10.2) */
> struct genericFormat {
> @@ -616,7 +616,7 @@ struct genericFormat {
> uint8_t reserved[3];
> __le32 attrLength;
> uint8_t attrData[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Character Set Information (ECMA 167r3 4/14.10.3) */
> struct charSetInfo {
> @@ -627,7 +627,7 @@ struct charSetInfo {
> __le32 escapeSeqLength;
> uint8_t charSetType;
> uint8_t escapeSeq[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Alternate Permissions (ECMA 167r3 4/14.10.4) */
> struct altPerms {
> @@ -638,7 +638,7 @@ struct altPerms {
> __le16 ownerIdent;
> __le16 groupIdent;
> __le16 permission;
> -} __attribute__ ((packed));
> +} __packed;
>
> /* File Times Extended Attribute (ECMA 167r3 4/14.10.5) */
> struct fileTimesExtAttr {
> @@ -649,7 +649,7 @@ struct fileTimesExtAttr {
> __le32 dataLength;
> __le32 fileTimeExistence;
> uint8_t fileTimes;
> -} __attribute__ ((packed));
> +} __packed;
>
> /* FileTimeExistence (ECMA 167r3 4/14.10.5.6) */
> #define FTE_CREATION 0x00000001
> @@ -666,7 +666,7 @@ struct infoTimesExtAttr {
> __le32 dataLength;
> __le32 infoTimeExistence;
> uint8_t infoTimes[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Device Specification (ECMA 167r3 4/14.10.7) */
> struct deviceSpec {
> @@ -678,7 +678,7 @@ struct deviceSpec {
> __le32 majorDeviceIdent;
> __le32 minorDeviceIdent;
> uint8_t impUse[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Implementation Use Extended Attr (ECMA 167r3 4/14.10.8) */
> struct impUseExtAttr {
> @@ -689,7 +689,7 @@ struct impUseExtAttr {
> __le32 impUseLength;
> struct regid impIdent;
> uint8_t impUse[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Application Use Extended Attribute (ECMA 167r3 4/14.10.9) */
> struct appUseExtAttr {
> @@ -700,7 +700,7 @@ struct appUseExtAttr {
> __le32 appUseLength;
> struct regid appIdent;
> uint8_t appUse[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> #define EXTATTR_CHAR_SET 1
> #define EXTATTR_ALT_PERMS 3
> @@ -716,7 +716,7 @@ struct unallocSpaceEntry {
> struct icbtag icbTag;
> __le32 lengthAllocDescs;
> uint8_t allocDescs[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Space Bitmap Descriptor (ECMA 167r3 4/14.12) */
> struct spaceBitmapDesc {
> @@ -724,7 +724,7 @@ struct spaceBitmapDesc {
> __le32 numOfBits;
> __le32 numOfBytes;
> uint8_t bitmap[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Partition Integrity Entry (ECMA 167r3 4/14.13) */
> struct partitionIntegrityEntry {
> @@ -735,7 +735,7 @@ struct partitionIntegrityEntry {
> uint8_t reserved[175];
> struct regid impIdent;
> uint8_t impUse[256];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */
>
> @@ -753,7 +753,7 @@ struct partitionIntegrityEntry {
> struct logicalVolHeaderDesc {
> __le64 uniqueID;
> uint8_t reserved[24];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Path Component (ECMA 167r3 4/14.16.1) */
> struct pathComponent {
> @@ -761,7 +761,7 @@ struct pathComponent {
> uint8_t lengthComponentIdent;
> __le16 componentFileVersionNum;
> dstring componentIdent[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* File Entry (ECMA 167r3 4/14.17) */
> struct extendedFileEntry {
> @@ -791,6 +791,6 @@ struct extendedFileEntry {
> __le32 lengthAllocDescs;
> uint8_t extendedAttr[0];
> uint8_t allocDescs[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> #endif /* _ECMA_167_H */
> diff --git a/fs/udf/osta_udf.h b/fs/udf/osta_udf.h
> index fbff746..a4da59e 100644
> --- a/fs/udf/osta_udf.h
> +++ b/fs/udf/osta_udf.h
> @@ -70,17 +70,17 @@ struct UDFIdentSuffix {
> uint8_t OSClass;
> uint8_t OSIdentifier;
> uint8_t reserved[4];
> -} __attribute__ ((packed));
> +} __packed;
>
> struct impIdentSuffix {
> uint8_t OSClass;
> uint8_t OSIdentifier;
> uint8_t reserved[6];
> -} __attribute__ ((packed));
> +} __packed;
>
> struct appIdentSuffix {
> uint8_t impUse[8];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Logical Volume Integrity Descriptor (UDF 2.50 2.2.6) */
> /* Implementation Use (UDF 2.50 2.2.6.4) */
> @@ -92,7 +92,7 @@ struct logicalVolIntegrityDescImpUse {
> __le16 minUDFWriteRev;
> __le16 maxUDFWriteRev;
> uint8_t impUse[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Implementation Use Volume Descriptor (UDF 2.50 2.2.7) */
> /* Implementation Use (UDF 2.50 2.2.7.2) */
> @@ -104,7 +104,7 @@ struct impUseVolDescImpUse {
> dstring LVInfo3[36];
> struct regid impIdent;
> uint8_t impUse[128];
> -} __attribute__ ((packed));
> +} __packed;
>
> struct udfPartitionMap2 {
> uint8_t partitionMapType;
> @@ -113,7 +113,7 @@ struct udfPartitionMap2 {
> struct regid partIdent;
> __le16 volSeqNum;
> __le16 partitionNum;
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Virtual Partition Map (UDF 2.50 2.2.8) */
> struct virtualPartitionMap {
> @@ -124,7 +124,7 @@ struct virtualPartitionMap {
> __le16 volSeqNum;
> __le16 partitionNum;
> uint8_t reserved2[24];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Sparable Partition Map (UDF 2.50 2.2.9) */
> struct sparablePartitionMap {
> @@ -139,7 +139,7 @@ struct sparablePartitionMap {
> uint8_t reserved2[1];
> __le32 sizeSparingTable;
> __le32 locSparingTable[4];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Metadata Partition Map (UDF 2.4.0 2.2.10) */
> struct metadataPartitionMap {
> @@ -156,14 +156,14 @@ struct metadataPartitionMap {
> __le16 alignUnitSize;
> uint8_t flags;
> uint8_t reserved2[5];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Virtual Allocation Table (UDF 1.5 2.2.10) */
> struct virtualAllocationTable15 {
> __le32 VirtualSector[0];
> struct regid vatIdent;
> __le32 previousVATICBLoc;
> -} __attribute__ ((packed));
> +} __packed;
>
> #define ICBTAG_FILE_TYPE_VAT15 0x00U
>
> @@ -181,7 +181,7 @@ struct virtualAllocationTable20 {
> __le16 reserved;
> uint8_t impUse[0];
> __le32 vatEntry[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> #define ICBTAG_FILE_TYPE_VAT20 0xF8U
>
> @@ -189,7 +189,7 @@ struct virtualAllocationTable20 {
> struct sparingEntry {
> __le32 origLocation;
> __le32 mappedLocation;
> -} __attribute__ ((packed));
> +} __packed;
>
> struct sparingTable {
> struct tag descTag;
> @@ -199,7 +199,7 @@ struct sparingTable {
> __le32 sequenceNum;
> struct sparingEntry
> mapEntry[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Metadata File (and Metadata Mirror File) (UDF 2.50 2.2.13.1) */
> #define ICBTAG_FILE_TYPE_MAIN 0xFA
> @@ -210,7 +210,7 @@ struct sparingTable {
> struct allocDescImpUse {
> __le16 flags;
> uint8_t impUse[4];
> -} __attribute__ ((packed));
> +} __packed;
>
> #define AD_IU_EXT_ERASED 0x0001
>
> @@ -222,7 +222,7 @@ struct allocDescImpUse {
> struct freeEaSpace {
> __le16 headerChecksum;
> uint8_t freeEASpace[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* DVD Copyright Management Information (UDF 2.50 3.3.4.5.1.2) */
> struct DVDCopyrightImpUse {
> @@ -230,14 +230,14 @@ struct DVDCopyrightImpUse {
> uint8_t CGMSInfo;
> uint8_t dataType;
> uint8_t protectionSystemInfo[4];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* Application Use Extended Attribute (UDF 2.50 3.3.4.6) */
> /* FreeAppEASpace (UDF 2.50 3.3.4.6.1) */
> struct freeAppEASpace {
> __le16 headerChecksum;
> uint8_t freeEASpace[0];
> -} __attribute__ ((packed));
> +} __packed;
>
> /* UDF Defined System Stream (UDF 2.50 3.3.7) */
> #define UDF_ID_UNIQUE_ID "*UDF Unique ID Mapping Data"
> --
> 2.7.4
>
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR