[ECOS] JFFS2 Issue.

Ramgopal Kota rkota@broadcom.com
Tue Sep 22 17:03:00 GMT 2009


 Hi,

I am integrating JFFS2 into our MIPS Malta board. I am seeing a strange issue.
In JFFS2 erase.c file and function jffs2_mark_erased_block , code section as below 

struct jffs2_unknown_node marker = {
      .magic =  cpu_to_je16(JFFS2_MAGIC_BITMASK),
      .nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER), 
      .totlen = cpu_to_je32(c->cleanmarker_size)
    };

struct jffs2_unknown_node
{
  /* All start like this */
  jint16_t magic;
  jint16_t nodetype;
  jint32_t totlen; /* So we can skip over nodes we don't grok */
  jint32_t hdr_crc;
} __attribute__((packed));

I am seeing that both .magic and .nodetype are filled with 0x2003 which is the value of JFFS2_NODETYPE_CLEANMARKER.

If I change the code to the following it is working fine...

struct jffs2_unknown_node marker = {
      .magic =  cpu_to_je16(JFFS2_MAGIC_BITMASK),
      .nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER), 
      .totlen = cpu_to_je32(c->cleanmarker_size)
    };

marker.magic =  cpu_to_je16(JFFS2_MAGIC_BITMASK);

I don't know if it is CFLAGS issue or Compiler issue.I am thinking it is a compiler optimisation re-ordering issue.I am using -Os flag.
Compiler I am using is gcc version 3.2.1 (eCosCentric)

Thanks & Regards,
Ramgopal Kota

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list