bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Entropy Patch (as an attachment)


From: Neal H. Walfield
Subject: Re: Entropy Patch (as an attachment)
Date: Mon, 06 Aug 2007 19:56:30 +0200
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.4 (i386-pc-linux-gnu) MULE/5.0 (SAKAKI)

> Index: device/blkio.c
> ===================================================================
> RCS file: /sources/hurd/gnumach/device/Attic/blkio.c,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 blkio.c
> --- device/blkio.c    25 Feb 1997 21:28:13 -0000      1.1.1.1
> +++ device/blkio.c    6 Aug 2007 15:05:19 -0000
> @@ -36,7 +36,9 @@
>  #include <device/io_req.h>
>  #include <device/ds_routines.h>
>  
> -
> +#ifdef MACH_ENTROPY
> +#include <device/entropy.h>
> +#endif
>  
>  io_return_t block_io(strat, max_count, ior)
>       void                    (*strat)();
> @@ -149,6 +151,10 @@
>       do {
>           prev = next;
>           next = prev->io_next;
> +#ifdef MACH_ENTROPY
> +         /*  Let's grab the cylinder numbers for entropy */
> +         entropy_putdata (prev, sizeof(io_req_t));
> +#endif 

sizeof will always give the same value.  Is this really what you want
to do here?


>  cngetc()
>  {
>       if (cn_tab)
> -             return ((*cn_tab->cn_getc)(cn_tab->cn_dev, 1));
> +#if defined(MACH_KERNEL) && defined(MACH_ENTROPY)
> +             entropy_putchar (cn_tab->cn_dev);
> +#endif /* MACH_ENTROPY and MACH_ENTROPY */
> +     return ((*cn_tab->cn_getc)(cn_tab->cn_dev, 1));

Why won't this crash?  cn_tab is null...

> +#ifdef MACH_ENTROPY
> +     /* Kick some mouse data to the entropy driver */
> +     entropy_putchar((buttonchanges + moved.mm_deltaX
> +                     + moved.mm_deltaY));
> +#endif

Please end sentences with periods followed by two spaces.


> +#ifdef MACH_ENTROPY
> +  /* Grab the packet for entropy purposes */
> +  entropy_putdata(ph + 1, skb->len - sizeof(struct ether_header));
> +#endif

This subtraction is completely useless as it doesn't change the amount
of entropy.  Just use skb->len.

> +/* Current read offset */
> +static int entropy_read_offset = 0;
> +
> +/* Current write offset */
> +static int entropy_write_offset = 0;
> +
> +/* If this device is already initalized */
> +static int entropy_init_done = 0;

No need to initialize static variables to 0; they are in the bss.

> +  /* Allocate memory*/
> +  err = device_read_alloc(ior, ior->io_count);
> +  if (err != KERN_SUCCESS) {
> +    return err;
> +  }

This is not GCS conforming.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]