OK. The test case you submitted ought to account for the semaphore though.<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Dec 3, 2012 at 8:11 AM, Ralf Kirchner <span dir="ltr"><<a href="mailto:ralf.kirchner@embedded-brains.de" target="_blank">ralf.kirchner@embedded-brains.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Gedare,<br>
Thanks for reviewing my modifications. Most of your comments are fixed<br>
locally meanwhile. Only these 3 points remain:<br>
<br>
Am 29.11.2012 17:55, schrieb Gedare Bloom:<br>
<div class="im"><br>
> +<br>
> + if (NULL == sd)<br>
> + return RTEMS_INVALID_ADDRESS;<br>
> +<br>
> + uint8_t *data = (uint8_t *) sd;<br>
><br>
> again why the extra variable?<br>
</div>In this case the variable data gets incremented in the header of the for<br>
loop and used within that loop. Thus in this case the variable is a<br>
simplification.<br>
<div class="im"><br>
> + sc = rtems_semaphore_create(<br>
> + rtems_build_name('S', 'P', 'A', 'R'),<br>
> + 1,<br>
> + RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY,<br>
> + 0,<br>
> + &sd->mutex<br>
> + );<br>
><br>
> This semaphore should be accounted in application configuration<br>
> requirements, either explicitly by applications that use the<br>
> rtems_sparse_disk, or with some macro that detects it..<br>
</div>I agree with Sebastians comment on this topic. I very much doubt that<br>
the sparse disk ever will be used anywhere else but within tests.<br>
<div class="im"><br>
> +static rtems_sparse_disk_key *<br>
> + sparse_disk_get_new_block(<br>
> + rtems_sparse_disk *sparse_disk,<br>
> + const rtems_blkdev_bnum block<br>
> +)<br>
> +{<br>
> + rtems_sparse_disk_key *key;<br>
> +<br>
> + if (sparse_disk->used_count < sparse_disk->blocks_allocated) {<br>
> + key = &sparse_disk->key_table [sparse_disk->used_count];<br>
> + key->block = block;<br>
> + ++sparse_disk->used_count;<br>
> + qsort(sparse_disk->key_table, sparse_disk->used_count,<br>
> sizeof(rtems_sparse_disk_key), sparse_disk_compare);<br>
><br>
> is quicksort every time OK here? is a sorted array the best structure to<br>
> use, or should a tree be used? Just wondering out loud.<br>
</div>Using the sparse disk anywhere else but within test does not make much<br>
sense. And for testing purposes the quicksort approach seems sufficient<br>
to me.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
--------------------------------------------<br>
Embedded Brains GmbH<br>
Ralf Kirchner Dornierstr. 4<br>
D-82178 Puchheim Germany<br>
email: <a href="mailto:ralf.kirchner@embedded-brains.de">ralf.kirchner@embedded-brains.de</a><br>
Phone: <a href="tel:%2B49-89-18%2094%20741-17" value="+4989189474117">+49-89-18 94 741-17</a><br>
Fax: <a href="tel:%2B49-89-18%2094%20741-08" value="+4989189474108">+49-89-18 94 741-08</a><br>
</font></span><div class="HOEnZb"><div class="h5"><br>
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.<br>
</div></div></blockquote></div><br></div>