[Yaffs] Re: PATCH!!! PATCH!!! (Was Sorry state of YAFFS2)

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Sergey Kubushyn
Date:  
To: Charles Manning
CC: yaffs-list
Subject: [Yaffs] Re: PATCH!!! PATCH!!! (Was Sorry state of YAFFS2)
On Fri, 14 Oct 2005, Sergey Kubushyn wrote:

> On Fri, 14 Oct 2005, Charles Manning wrote:


[dd]

> I do, really _DO_ hope to see it applied and that "Fix your MTD" mantra
> thrown
> away forever. You better start fixing bugs in your wonderFS. I'd
> suggest to
> start from explaining why 36 Mbyte tar takes 51 Mbytes on YAFFS2 FS.
> And
> here is a hint - without that included patch it took 56 Mbytes. If it's
> too
> complex for you, try to look for any illegal cast usage on irregular
> data
> structures. I'm sending you a small program that illustrates the point
> of
> data alignment, you can compile and run it to see yourself how it makes
> a
> surprise even on ix86...


Here is a small demo... Almost helloworld, heh?

=== Cut ===
#include <stdio.h>
#include <stdlib.h>

typedef struct {
      int    a;
      int    b;
      char    c;
      int    d;
} test;


typedef union {
      test    t;
      char    as_char[16];
} u_test;



int main(int argc, char **argv)
{
    int i;
    /* Another test - remove "static" and see what happens. Why? */
    static u_test dummy;


    printf("Size of union = %d\n", sizeof(u_test));
    printf("Size of structure = %d\n", sizeof(dummy.t));
    printf("Total size of structure members = %d. Surprise?\n",
        sizeof(dummy.t.a) + sizeof(dummy.t.b) +
        sizeof(dummy.t.c) + sizeof(dummy.t.d));


    dummy.t.a = 0x12343412;
    dummy.t.b = 0x45676745;
    dummy.t.c = 0x11;
    dummy.t.d = 0x71176556;


    for (i = 0; i < 16; i++) {
      printf("Char #%d = 0x%02x\n", i, dummy.as_char[i]);
    }


    return 0;
}
=== Cut ===



---
******************************************************************
*  KSI@home    KOI8 Net  < >  The impossible we do immediately.  *
*  Las Vegas   NV, USA   < >  Miracles require 24-hour notice.   *
******************************************************************