All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin D Bennett <colin@gibibit.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Cc: bean123ch@gmail.com
Subject: Re: [PATCH] buffered file read
Date: Sun, 27 Jul 2008 12:51:54 -0700	[thread overview]
Message-ID: <20080727125154.1ffb69b6@gibibit.com> (raw)
In-Reply-To: <ca0f59980807271052o18cfc7f4x57b12a4bd32a087e@mail.gmail.com>

On Mon, 28 Jul 2008 01:52:40 +0800
Bean <bean123ch@gmail.com> wrote:

> Hi,
> 
> This patch add a new module bufio, which reads block of data at a
> time, and return the required range to the upper level. This is
> extremely useful in modules like png, where data are normally read one
> byte at a time.
> 
> To use buffered io service, just include header file <grub/bufio.h>,
> and replace grub_file_open with grub_buffile_open.
> 
> Changelog:
> 
> 2008-07-27  Bean  <bean123ch@gmail.com>
> 	
> 	* conf/common.rmk (pkglib_MODULES): Add bufio.mod.
> 	(bufio_mod_SOURCES): New macro.
> 	(bufio_mod_CFLAGS): Likewise.
> 	(bufio_mod_LDFLAGS): Likewise.
> 
> 	* include/grub/bufio.h: New file.
> 
> 	* io/bufio.c: Likewise.
> 
> 	* video/png.c (grub_video_reader_png): Use grub_buffile_open
> to open file.
> 
> 	* video/jpeg.c (grub_video_reader_jpeg): Likewise.
> 
> 	* video/tga.c (grub_video_reader_tga): Likewise.

Hi Bean,

Beautiful code!  Thanks so much for doing this work -- using buffered
file reads is absolutely necessary from a performance perspective, and
I am glad to see it implemented so cleanly.

My poor hack of grub_file_read() bows to your far superior patch!  I
really appreciate the simplicity and clarity of both its design and its
use.  I like how you implemented it using the Decorator pattern (from
the GoF design patterns) to wrap the basic file with the buffered file
layer in a way transparent to users. This is very intuitive to me,
especially since Java does exactly the same thing with InputStream and
BufferedInputStream.

The best part is that users of file I/O only have to change one
function call to get all the benefits of the buffering.

I will begin testing with this patch instead of mine shortly.

Thanks again!
Regards,
Colin



  reply	other threads:[~2008-07-27 19:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-27 17:52 [PATCH] buffered file read Bean
2008-07-27 19:51 ` Colin D Bennett [this message]
2008-07-27 20:28   ` Bean
2008-07-27 21:25 ` Robert Millan
2008-07-28  5:08   ` Bean
2008-07-30  3:48     ` Bean
2008-07-30  4:23       ` Colin D Bennett
2008-07-31 19:18     ` Marco Gerards
2008-07-31 19:20       ` Bean
2008-07-31 20:06         ` Marco Gerards
2008-08-01  4:06           ` Bean

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=20080727125154.1ffb69b6@gibibit.com \
    --to=colin@gibibit.com \
    --cc=bean123ch@gmail.com \
    --cc=grub-devel@gnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.