All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] cpio and tar filesystem
Date: Sun, 23 Dec 2007 22:48:51 +0100	[thread overview]
Message-ID: <20071223214851.GB28105@thorin> (raw)
In-Reply-To: <ca0f59980712231204y61340ba6jb2c82e8fe051dfe8@mail.gmail.com>

On Mon, Dec 24, 2007 at 04:04:31AM +0800, Bean wrote:
> 
> 	* conf/i386-pc.rmk (grub_emu_SOURCES): Add cpio.c.
> 
> 	* conf/i386-efi.rmk (grub_emu_SOURCES): Likewise.
> 
> 	* conf/i386-linuxbios.rmk (grub_emu_SOURCES): Likewise.
> 
> 	* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.

Perhaps it'd be a good idea to move the arch-independant part of
grub_emu_SOURCES to common.rmk (as grub_emu_SOURCES += foo), to avoid
having to update all the files so often ...

> diff --git a/disk/loopback.c b/disk/loopback.c
> index 9d48def..31d8116 100644
> --- a/disk/loopback.c
> +++ b/disk/loopback.c
> @@ -214,7 +214,7 @@ grub_loopback_read (grub_disk_t disk,
> grub_disk_addr_t sector,
>    if (pos > file->size)
>      {
>        grub_size_t amount = pos - file->size;
> -      grub_memset (buf + size - amount, 0, amount);
> +      grub_memset (buf + (size << GRUB_DISK_SECTOR_BITS) - amount, 0, amount);

Ugh :-)  I check this in right now.

> +struct HEAD_USTAR
> +{
> +  char	name[100];
> +  char	mode[8];
> +  char	uid[8];
> +  char	gid[8];
> +  char	size[12];
> +  char	mtime[12];
> +  char	chksum[8];
> +  char	typeflag;
> +  char	linkname[100];
> +  char	magic[6];
> +  char	version[2];
> +  char	uname[32];
> +  char	gname[32];
> +  char	devmajor[8];
> +  char	devminor[8];
> +  char	prefix[155];

These tabs should be spaces.

> +      if (grub_disk_read (data->disk, 0, data->hofs, sizeof(hd), (char*)&hd))
> [...]
> +      if (grub_disk_read (data->disk, 0, data->hofs, sizeof(hd), (char*)&hd))

`(char *) &hd' here (same for all other casts).

Btw, this line seems to be the same on both cases.  It can be moved out of
`if (data->mode == MODE_BCPIO)' to save some space?

> +      if (hd.namesize & 1)
> +        hd.namesize++;
> [...]
> +      if (data->size & 1)
> +        (*ofs)++;

I find this confusing.  AFAICT `hd.namesize == 1' would archieve the same and
seems to be more consistent with your use of this variable as a counter.

> +      if ((*name = grub_malloc (hd.namesize))==NULL)
> [...]
> +      if ((*name = grub_strdup (hd.name))==NULL)

Please add some spaces: ` == NULL'

> +      if (grub_memcmp(hd.magic, MAGIC_USTAR, sizeof(MAGIC_USTAR) - 1))
> [...]
> +      data->size = grub_strtoul(hd.size, NULL, 8);

`grub_memcmp (', `grub_strtoul (', etc.  Same for other function calls.

> +  return (grub_disk_read (data->disk, 0, data->dofs + file->offset,
> +                          len, buf))?-1:len;

` ? -1 : len'

> +#ifndef GRUB_UTIL
> +  grub_dl_unref (my_mod);
> +#endif
> [...]
> +#ifndef GRUB_UTIL
> +  my_mod = mod;
> +#endif

Are you sure these are still needed?  We have a few modules that use them but
AFAIK are not necessary at this time.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)



  reply	other threads:[~2007-12-23 21:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-23 19:52 [PATCH] cpio and tar filesystem Bean
2007-12-23 20:04 ` Bean
2007-12-23 21:48   ` Robert Millan [this message]
2007-12-24  4:40     ` Bean
2007-12-24 12:59       ` Robert Millan
2007-12-26  7:51         ` Robert Millan
2007-12-23 21:17 ` Robert Millan

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=20071223214851.GB28105@thorin \
    --to=rmh@aybabtu.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.