mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Oeser <ingo.oeser@informatik.tu-chemnitz.de>
To: Andrew Morton <akpm@digeo.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: the random driver
Date: Wed, 20 Nov 2002 13:04:42 +0100	[thread overview]
Message-ID: <20021120130442.M628@nightmaster.csn.tu-chemnitz.de> (raw)
In-Reply-To: <3DDB3DED.A4C9DC56@digeo.com>; from akpm@digeo.com on Tue, Nov 19, 2002 at 11:46:53PM -0800

Hi Andrew,

On Tue, Nov 19, 2002 at 11:46:53PM -0800, Andrew Morton wrote:
> c) The ring-buffer handling is awkward.  It shouldn't be masking
>    the head and tail pointers to always remain within bounds.
> 
>    A better technique is to allow these indices to wrap at
>    0xffffffff and only mask their values when you actually use
>    them as a subscript.  This allows you to distinguish the
>    completely-full case from the completely-empty one.  See
>    LOG_BUF* in kernel/printk.c.

Care to implement a generic ringbuffer in a header file, to avoid
this kind of errors? I'm sure there are more (and even overflows
on some implementations).

The gory implementation details of basic computer science
algorithms seem to cause problems for many driver writers.

So the trend of abstracting these away in the kernel, if it costs
no time and doesn't lead to ugly code, is right.

Regards

Ingo Oeser
-- 
Science is what we can tell a computer. Art is everything else. --- D.E.Knuth

  parent reply	other threads:[~2002-11-20 15:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-20  7:46 Andrew Morton
2002-11-20  8:13 ` Aaron Lehmann
2002-11-20 20:44   ` Oliver Xymoron
2002-11-20 12:04 ` Ingo Oeser [this message]
2002-11-20 16:27 ` Theodore Ts'o
2002-11-20 19:35   ` Andrew Morton
2002-11-20 20:42 ` Oliver Xymoron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021120130442.M628@nightmaster.csn.tu-chemnitz.de \
    --to=ingo.oeser@informatik.tu-chemnitz.de \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®