poniedziałek, 15 października 2012

First serious RFS job - rfs bitmaps

Hi. Today entry is about bitmaps. RFS uses it to manage informations about blocks and inodes - are they free or not. This was my first task on RFS, fortunately there was big piece of test code on bitmaps written by  Chris Johns and I simply have to change it to fstest and extend it to cover rest of code.

My part of test contain check of set, clear and test map's bit when specified bit number is larger than map size. Another thing was use of rtems_rfs_bitmap_map_set_all function and then clear and set random bit. I have also to  attempt to find clear bit when all bits were set. I also invoke rtems_rfs_bitmap_map_clear_all directive.

In many functions there were branches which can execute probably only when pointer to bitmap control structure function was invalid, so I had to invoke all bitmap related directive with null pointer and check if return value is appropriate.

There were also another tricky and hard to execute branch in bitmap open directive. This branch could execute only when there would be lack of memory - it returned ENOMEM. It takes me a lot of time and I need help from my mentor - dr Joel Sherrill. He adviced me to use rtems_heap_greedy_allocate directive which cause allocation of almost all heap. You can specify how much blocks should be left on heap. I used this directive and it eventually helps. Attempt to open bitmap returned ENOMEM :)

All bitmaps code is covered. I think this is quite big success :) And my next battlefield will be block maps - which make use of bitmaps.

RFS bitmap test code is here.

Brak komentarzy:

Prześlij komentarz