Hi,
On Fri, Jul 13, 2007 at 01:04:01AM -0400, Michael Casadevall wrote:
> + void entropy_putchar(int c) {
[...]
> + if (entropy_write_offset == ENTROPYBUFSIZE) {
> + entropy_write_offset = 0;
> + }
> +
> + if (entropy_write_offset == ENTROPYBUFSIZE) {
> + entropy_write_offset = 0;
> + }// Deep magic (tells any read functiosn more entropy is available)
Surely you don't really want to check twice :-)
> + void entropy_putdata(void *data, int size) {
> + // This function is used to copy data from memory pointers directly
> + // into the bufffer
> + io_req_t ior; // Used to tell reads that we got entropy
> +
> + // See if we are initalized; if not, initalize the driver
> + if (!entropy_init_done) {
> + entropyinit();
> + }
> +
> + /* See if the buffer is full, if it is, bail out */
> + if (entropy_write_offset+1 == entropy_read_offset) {
> + return;
> + }
You only check whether a single byte fits in, although you might write
more than one...
> + // Try to grab a lock on the device, otherwise bail
> + if (!simple_lock_try(&entropy_lock)) {
> + return; // Bailing out
> + }
> +
> + // Lets advance the pointer on
> + entropy_write_offset++;
Still incrementing before the actual write?
-antrik-
_______________________________________________
Bug-hurd mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-hurd