* [PATCH][2.6.12-rc2] __attribute__ placement
@ 2005-04-18 15:16 Vinay K Nallamothu
[not found] ` <1113994849.10792.46.camel@vinay.gsecone.com>
0 siblings, 1 reply; 2+ messages in thread
From: Vinay K Nallamothu @ 2005-04-18 15:16 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel
Hi,
The variable attributes "packed" and "align" when used with struct,
should have the following order:
struct ... {...} __attribute__((packed)) var;
This patch fixes few instances where the variable and attributes are
placed the other way around and had no affect.
Thanks
Vinay
asm-m68knommu/MC68328.h | 2 +-
asm-m68knommu/MC68EZ328.h | 2 +-
asm-m68knommu/MC68VZ328.h | 2 +-
math-emu/double.h | 4 ++--
math-emu/extended.h | 2 +-
math-emu/quad.h | 2 +-
math-emu/single.h | 2 +-
7 files changed, 8 insertions(+), 8 deletions(-)
===========================================================================
diff -urN linux-2.6.12-rc2/include/asm-m68knommu/MC68328.h linux-2.6.12-rc2-nvk/include/asm-m68knommu/MC68328.h
--- linux-2.6.12-rc2/include/asm-m68knommu/MC68328.h 2005-04-07 18:55:40.000000000 +0530
+++ linux-2.6.12-rc2-nvk/include/asm-m68knommu/MC68328.h 2005-04-18 20:02:00.325855096 +0530
@@ -993,7 +993,7 @@
volatile unsigned short int pad1;
volatile unsigned short int pad2;
volatile unsigned short int pad3;
-} m68328_uart __attribute__((packed));
+} __attribute__((packed)) m68328_uart;
/**********
diff -urN linux-2.6.12-rc2/include/asm-m68knommu/MC68EZ328.h linux-2.6.12-rc2-nvk/include/asm-m68knommu/MC68EZ328.h
--- linux-2.6.12-rc2/include/asm-m68knommu/MC68EZ328.h 2005-04-07 18:55:40.000000000 +0530
+++ linux-2.6.12-rc2-nvk/include/asm-m68knommu/MC68EZ328.h 2005-04-18 20:03:08.034561808 +0530
@@ -815,7 +815,7 @@
volatile unsigned short int nipr;
volatile unsigned short int pad1;
volatile unsigned short int pad2;
-} m68328_uart __attribute__((packed));
+} __attribute__((packed)) m68328_uart;
/**********
diff -urN linux-2.6.12-rc2/include/asm-m68knommu/MC68VZ328.h linux-2.6.12-rc2-nvk/include/asm-m68knommu/MC68VZ328.h
--- linux-2.6.12-rc2/include/asm-m68knommu/MC68VZ328.h 2005-04-07 18:55:40.000000000 +0530
+++ linux-2.6.12-rc2-nvk/include/asm-m68knommu/MC68VZ328.h 2005-04-18 20:02:28.186619616 +0530
@@ -909,7 +909,7 @@
volatile unsigned short int nipr;
volatile unsigned short int hmark;
volatile unsigned short int unused;
-} m68328_uart __attribute__((packed));
+} __attribute__((packed)) m68328_uart;
diff -urN linux-2.6.12-rc2/include/math-emu/double.h linux-2.6.12-rc2-nvk/include/math-emu/double.h
--- linux-2.6.12-rc2/include/math-emu/double.h 2005-04-07 18:55:41.000000000 +0530
+++ linux-2.6.12-rc2-nvk/include/math-emu/double.h 2005-04-18 20:04:55.998148848 +0530
@@ -67,7 +67,7 @@
unsigned exp : _FP_EXPBITS_D;
unsigned sign : 1;
#endif
- } bits __attribute__((packed));
+ } __attribute__((packed)) bits;
};
#define FP_DECL_D(X) _FP_DECL(2,X)
@@ -139,7 +139,7 @@
unsigned exp : _FP_EXPBITS_D;
unsigned sign : 1;
#endif
- } bits __attribute__((packed));
+ } __attribute__((packed)) bits;
};
#define FP_DECL_D(X) _FP_DECL(1,X)
diff -urN linux-2.6.12-rc2/include/math-emu/extended.h linux-2.6.12-rc2-nvk/include/math-emu/extended.h
--- linux-2.6.12-rc2/include/math-emu/extended.h 2005-04-07 18:55:41.000000000 +0530
+++ linux-2.6.12-rc2-nvk/include/math-emu/extended.h 2005-04-18 20:04:14.768416720 +0530
@@ -68,7 +68,7 @@
unsigned exp : _FP_EXPBITS_E;
unsigned sign : 1;
#endif /* not bigendian */
- } bits __attribute__((packed));
+ } __attribute__((packed)) bits;
};
diff -urN linux-2.6.12-rc2/include/math-emu/quad.h linux-2.6.12-rc2-nvk/include/math-emu/quad.h
--- linux-2.6.12-rc2/include/math-emu/quad.h 2005-04-07 18:55:41.000000000 +0530
+++ linux-2.6.12-rc2-nvk/include/math-emu/quad.h 2005-04-18 20:03:55.135401392 +0530
@@ -72,7 +72,7 @@
unsigned exp : _FP_EXPBITS_Q;
unsigned sign : 1;
#endif /* not bigendian */
- } bits __attribute__((packed));
+ } __attribute__((packed)) bits;
};
diff -urN linux-2.6.12-rc2/include/math-emu/single.h linux-2.6.12-rc2-nvk/include/math-emu/single.h
--- linux-2.6.12-rc2/include/math-emu/single.h 2005-04-07 18:55:41.000000000 +0530
+++ linux-2.6.12-rc2-nvk/include/math-emu/single.h 2005-04-18 20:05:20.208468320 +0530
@@ -56,7 +56,7 @@
unsigned exp : _FP_EXPBITS_S;
unsigned sign : 1;
#endif
- } bits __attribute__((packed));
+ } __attribute__((packed)) bits;
};
#define FP_DECL_S(X) _FP_DECL(1,X)
===========================================================================
--
Views expressed in this mail are those of the individual sender and
do not bind Gsec1 Limited. or its subsidiary, unless the sender has done
so expressly with due authority of Gsec1.
_________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][2.6.12-rc2] __attribute__ placement
[not found] ` <1113994849.10792.46.camel@vinay.gsecone.com>
@ 2005-04-20 11:24 ` Vinay K Nallamothu
0 siblings, 0 replies; 2+ messages in thread
From: Vinay K Nallamothu @ 2005-04-20 11:24 UTC (permalink / raw)
To: akpm; +Cc: LKML
Hi,
Apparently my previous patch incorrectly fixed few cases where the
problem didn't exist. The __attribute__((packed)) issue is applicable
only to typedefed structs and the correct syntax for this should be:
typedef struct ... { ... } __attribute__((packed)) new_type;
Please find the updated patch. Hope I haven't introduced any new bugs.
Thanks
Vinay
drivers/net/gt96100eth.h | 4 ++--
include/asm-m68knommu/MC68328.h | 2 +-
include/asm-m68knommu/MC68EZ328.h | 2 +-
include/asm-m68knommu/MC68VZ328.h | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
=============================================================================
diff -urN linux-2.6.12-rc2/drivers/net/gt96100eth.h linux-2.6.12-rc2-nvk/drivers/net/gt96100eth.h
--- linux-2.6.12-rc2/drivers/net/gt96100eth.h 2005-04-07 18:56:46.000000000 +0530
+++ linux-2.6.12-rc2-nvk/drivers/net/gt96100eth.h 2005-04-20 15:50:20.000000000 +0530
@@ -214,7 +214,7 @@
u32 cmdstat;
u32 next;
u32 buff_ptr;
-} gt96100_td_t __attribute__ ((packed));
+} __attribute__ ((packed)) gt96100_td_t;
typedef struct {
#ifdef DESC_BE
@@ -227,7 +227,7 @@
u32 cmdstat;
u32 next;
u32 buff_ptr;
-} gt96100_rd_t __attribute__ ((packed));
+} __attribute__ ((packed)) gt96100_rd_t;
/* Values for the Tx command-status descriptor entry. */
diff -urN linux-2.6.12-rc2/include/asm-m68knommu/MC68328.h linux-2.6.12-rc2-nvk/include/asm-m68knommu/MC68328.h
--- linux-2.6.12-rc2/include/asm-m68knommu/MC68328.h 2005-04-07 18:55:40.000000000 +0530
+++ linux-2.6.12-rc2-nvk/include/asm-m68knommu/MC68328.h 2005-04-20 15:47:37.000000000 +0530
@@ -993,7 +993,7 @@
volatile unsigned short int pad1;
volatile unsigned short int pad2;
volatile unsigned short int pad3;
-} m68328_uart __attribute__((packed));
+} __attribute__((packed)) m68328_uart;
/**********
diff -urN linux-2.6.12-rc2/include/asm-m68knommu/MC68EZ328.h linux-2.6.12-rc2-nvk/include/asm-m68knommu/MC68EZ328.h
--- linux-2.6.12-rc2/include/asm-m68knommu/MC68EZ328.h 2005-04-07 18:55:40.000000000 +0530
+++ linux-2.6.12-rc2-nvk/include/asm-m68knommu/MC68EZ328.h 2005-04-20 15:48:27.000000000 +0530
@@ -815,7 +815,7 @@
volatile unsigned short int nipr;
volatile unsigned short int pad1;
volatile unsigned short int pad2;
-} m68328_uart __attribute__((packed));
+} __attribute__((packed)) m68328_uart;
/**********
diff -urN linux-2.6.12-rc2/include/asm-m68knommu/MC68VZ328.h linux-2.6.12-rc2-nvk/include/asm-m68knommu/MC68VZ328.h
--- linux-2.6.12-rc2/include/asm-m68knommu/MC68VZ328.h 2005-04-07 18:55:40.000000000 +0530
+++ linux-2.6.12-rc2-nvk/include/asm-m68knommu/MC68VZ328.h 2005-04-20 15:48:01.000000000 +0530
@@ -909,7 +909,7 @@
volatile unsigned short int nipr;
volatile unsigned short int hmark;
volatile unsigned short int unused;
-} m68328_uart __attribute__((packed));
+} __attribute__((packed)) m68328_uart;
=============================================================================
> On Mon, 2005-04-18 at 20:46 +0530, Vinay K Nallamothu wrote:
> > Hi,
> >
> > The variable attributes "packed" and "align" when used with struct,
> > should have the following order:
> >
> > struct ... {...} __attribute__((packed)) var;
> >
> > This patch fixes few instances where the variable and attributes are
> > placed the other way around and had no affect.
> >
--
Views expressed in this mail are those of the individual sender and
do not bind Gsec1 Limited. or its subsidiary, unless the sender has done
so expressly with due authority of Gsec1.
_________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-04-20 11:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-18 15:16 [PATCH][2.6.12-rc2] __attribute__ placement Vinay K Nallamothu
[not found] ` <1113994849.10792.46.camel@vinay.gsecone.com>
2005-04-20 11:24 ` Vinay K Nallamothu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®