[Yaffs] Yaffs enum serialization

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: Gerte Hoogewerf
Date:  
To: yaffs
Subject: [Yaffs] Yaffs enum serialization
Hello,

We have integrated the commercial licensed Yaffs sources into our project
and hit a portability issue with GCC. It turns out that the format of
data on flash changes as a result of enums being interpreted as either int
(4 bytes) or char (1 byte), depending on the GCC version.

We learned that newer versions of GCC use short enums by default, whereas
older versions use int (4 bytes). Since we're planning to update our GCC
compiler in the near future, this will become a serious problem for those
devices that need to be field-upgraded. We could obviously use the
-fno-short-enums for the Yaffs source code to maintain compatibility, but
it would probably help us and many others if some changes are made to the
source code.

One of the problematic sections is in yaffs_guts.h:

struct yaffs_obj_hdr {
    enum yaffs_obj_type type;


    /* Apply to everything  */
    int parent_obj_id;


Unsurprisingly, the device crashes when running Yaffs built with an older
version of GCC, if the device previously ran binaries produced with a newer
version of GCC:

U1_2 (Stopped - Step End)

yaffs_find_by_name() - yaffs_guts.c:4394

yaffs_create_obj() - yaffs_guts.c:2186

yaffs_create_dir() - yaffs_guts.c:2259

yaffs_mkdir_reldir() - yaffsfs.c:2686
yaffs_mkdir() - yaffsfs.c:2709


Could you guys please consider revising the Yaffs source code and use
explicit types (e.g. u32) instead of enums in all relevant structures to
overcome this issue? This would be highly appreciated.

Regards,


--
*Gerte Hoogewerf*
*Senior Software Engineer*
*LMI Technologies*
Wiebachstraat 25b, Kerkrade 6466 NG, The Netherlands

*Office* +31 45 850 7000
*Fax* +31 45 574 2500
*Email*
*Web* www.lmi3D.com <http://www.lmi3d.com>

<https://twitter.com/lmi3d> <http://www.youtube.com/LMITechnologies>
<http://www.linkedin.com/company/lmi-technologies>