Hi, all. I'm interesing in the hash/map in POSIX key and Classic notepad project[1] and want to apply it as my GSoC this year. I've submitted my proposal at GSoC. Here are some problems I want to figure out, thanks for reply to any of them:<br>
<br>1. First, I want to be sure where the entry point of this project exactly is in the RTEMS. For the notepad, I think RTEMS_API_Control structure, which includes the Notepads array member, is the entry of the Notepad part of this project. And to the POSIX key, the corresponding structure is POSIX_Keys_Control structure, and the key area mentioned in [1] is the Values array member of POSIX_Keys_Control. Am I missing something?<br>
<br><div style="margin-left:40px">typedef struct {<br> rtems_event_set pending_events;<br> rtems_event_set event_condition;<br> ASR_Information Signal;<br> uint32_t Notepads[ RTEMS_NUMBER_NOTEPADS ];<br>
} RTEMS_API_Control;<br><br>typedef struct {<br> Objects_Control Object;<br> void (*destructor)( void * );<br> void **Values[ OBJECTS_APIS_LAST + 1 ];<br>} POSIX_Keys_Control;<br></div>
<br>2. I doesn't quite understand the key create procedure.First, I'm not sure what determines the maximum variable at line4 in code below, is it equal to CONFIGURE_MAXIMUM_POSIX_KEYS in configuration? Second, where the code also allocates key memory for OBJECTS_INTERNAL_API, OBJECTS_CLASSIC_API, while in my opinion, only key memory allocation for OBJECTS_POSIX_API is enough. what are other things used for? <br>
<br><div style="margin-left:40px">typedef enum {<br> OBJECTS_NO_API = 0,<br> OBJECTS_INTERNAL_API = 1,<br> OBJECTS_CLASSIC_API = 2,<br> OBJECTS_POSIX_API = 3<br>} Objects_APIs;<br><br>#define OBJECTS_APIS_LAST OBJECTS_POSIX_API<br>
</div><br><br><div style="margin-left:40px">1 for ( the_api = 1; the_api <= OBJECTS_APIS_LAST; the_api++ ) {<br>2 the_key->Values[ the_api ] = NULL;<br>3<br>4 bytes_to_allocate = sizeof( void * ) * (_Objects_Information_table[ the_api ][ 1 ]->maximum + 1);<br>
5 table = _Workspace_Allocate( bytes_to_allocate );<br>6 if ( !table ) {<br>7 _POSIX_Keys_Free_memory( the_key );<br>8<br>9 _POSIX_Keys_Free( the_key );<br>10 _Thread_Enable_dispatch();<br>11 return ENOMEM;<br>
12 }<br>13<br>14 the_key->Values[ the_api ] = table;<br>15 memset( table, '\0', bytes_to_allocate );<br>16 }<br></div><br>3. What's the general purpose of Notepads in RTEMS? After look at the example in /testsuites/sptests/sp07, I feel it is used for inter-thread communication, am I right? And the same question for POSIX key, since I haven't found much information of it in RTEMS POSIX API User’s Guide, I learn POSIX key knowledge from here[2], does it also apply to RTEMS?<br>
<br>4.As mentioned in [1], std::map can be an example for this project. I wonder is std::vector also appropriate for this project? Or maybe, several differection algorithms sould be implemented, and leave the choice to user? And I haven't study hash/map algorithm in depth, maybe, I should ask related question after do more homework on this.<br>
<br>5. What's the function naming convention in RTEMS, like _POSIX_Key_Get is an inline function, while _POSIX_Keys_Free_memory is not.<br><br><br>links:<br>[1]<a href="http://www.rtems.com/wiki/index.php/UseHashOrMapInNotepadsAndKeys" target="_blank">http://www.rtems.com/wiki/index.php/UseHashOrMapInNotepadsAndKeys</a><br>
[2]<a href="http://www.cs.cf.ac.uk/Dave/C/node29.html#SECTION002945000000000000000">http://www.cs.cf.ac.uk/Dave/C/node29.html#SECTION002945000000000000000</a><br><br>Best Regards!<br>zw_yao<br>