Small cleanup patch
Hi,
This patch fix some small things. It updates some copyright notices, indents vga.c correctly (somehow a bunch of lines a got a space extra), uses PACKAGE_BUGREPORT as bugreporting address in the tools and fix some remaining warnings I got with compiling with gcc 3.4 and some I got on GNU/Hurd.
Ok to commit?
2004-03-14 Jeroen Dekkers <[email protected]>
* Makefile.in: Update copyright.
* genmodsrc.sh: Likewise.
* gensymlist.sh: Likewise.
* term/i386/pc/vga.c: Indent correctly.
* util/i386/pc/pupa-mkimage.c (usage): Use PACKAGE_BUGREPORT as bugreporting address.
* util/i386/pc/pupa-setup.c (usage): Likewise,
* fs/fat.c (log2): Change name to grub_log2. All callers changed.
* kern/misc.c (memcpy): Alias to pupa_memmove.
* loader/i386/pc/multiboot.c (pupa_rescue_cmd_multiboot): Fix lvalue cast.
* util/console.c (pupa_ncurses_fini): Return 0.
* util/i386/pc/biosdisk.c (pupa_util_biosdisk_open)[__linux__]:
Move fail label here.
[__GNU__]: Don't warn when using stat. (open_device)[!__linux__]: Check if FD < 0 instead of !FD. (pupa_util_biosdisk_get_pupa_dev)[__GNU__]: Change type of N to long int. Use strtol instead of strtoul.
Index: Makefile.in
===================================================================
RCS file: /cvsroot/grub/grub2/Makefile.in,v
retrieving revision 1.4
Makefile.in +1 -2
@@ -1,7 +1,6 @@ # -*- makefile -*- # -# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. -# Copyright (C) 2002 Yoshinori K. Okuji <[email protected]> +# Copyright (C) 1994,95,96,97,98,99,2000,01,02,04 Free Software Foundation, Inc. # # This Makefile.in is free software; the author # gives unlimited permission to copy and/or distribute it,
Index: genmodsrc.sh
===================================================================
RCS file: /cvsroot/grub/grub2/genmodsrc.sh,v
retrieving revision 1.2
genmodsrc.sh +1 -1
@@ -20,7 +20,7 @@ cat <<EOF /* This file is automatically generated by genmodsrc.sh. DO NOT EDIT! */ /* * PUPA -- Preliminary Universal Programming Architecture for GRUB - * Copyright (C) 2002 Yoshinori K. Okuji <[email protected]> + * Copyright (C) 2002 Free Software Foundation, Inc. * * PUPA is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
Index: gensymlist.sh
===================================================================
RCS file: /cvsroot/grub/grub2/gensymlist.sh,v
retrieving revision 1.2
gensymlist.sh +1 -1
@@ -15,7 +15,7 @@ cat <<EOF /* This file is automatically generated by gensymlist.sh. DO NOT EDIT! */ /* * PUPA -- Preliminary Universal Programming Architecture for GRUB - * Copyright (C) 2002 Yoshinori K. Okuji <[email protected]> + * Copyright (C) 2002 Free Software Foundation, Inc. * * PUPA is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
Index: fs/fat.c
===================================================================
RCS file: /cvsroot/grub/grub2/fs/fat.c,v
retrieving revision 1.6
fat.c +5 -4
@@ -1,7 +1,7 @@/* fat.c - FAT filesystem */ /* * PUPA -- Preliminary Universal Programming Architecture for GRUB -* Copyright (C) 2000,2001,2002,2003 Free Software Foundation, Inc. +* Copyright (C) 2000,2001,2002,2003,2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -130,7 +130,7 @@ static pupa_dl_t my_mod;#endif static int -log2 (unsigned x) +grub_log2 (unsigned x) {int i;
@@ -165,12 +165,13 @@ pupa_fat_mount (pupa_disk_t disk) goto fail;/* Get the sizes of logical sectors and clusters. */ - data->logical_sector_bits =log2 (pupa_le_to_cpu16 (bpb.bytes_per_sector)); + data->logical_sector_bits = +grub_log2 (pupa_le_to_cpu16 (bpb.bytes_per_sector));if (data->logical_sector_bits <PUPA_DISK_SECTOR_BITS ) goto fail; data->logical_sector_bits -=PUPA_DISK_SECTOR_BITS ; - data->cluster_bits =log2 (bpb.sectors_per_cluster); + data->cluster_bits =grub_log2 (bpb.sectors_per_cluster);if (data->cluster_bits <0 ) goto fail; data->cluster_bits += data->logical_sector_bits;
Index: kern/misc.c
===================================================================
RCS file: /cvsroot/grub/grub2/kern/misc.c,v
retrieving revision 1.9
misc.c +4 -1
@@ -1,7 +1,7 @@/* misc.c - definitions of misc functions */ /* * PUPA -- Preliminary Universal Programming Architecture for GRUB -* Copyright (C) 1999,2000,2001,2002,2003 Free Software Foundation, Inc. +* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. * * PUPA is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -45,6 +45,9 @@ pupa_memmove (void *dest, const void *srreturn dest; } +/* GCC emits references to memcpy() for struct copies etc. */ +void *memcpy (void *dest,const void *src,pupa_size_t n) + __attribute__ ((alias ("pupa_memmove" )));char *pupa_strcpy (char *dest,const char *src)
Index: loader/i386/pc/multiboot.c
===================================================================
RCS file: /cvsroot/grub/grub2/loader/i386/pc/multiboot.c,v retrieving revision 1.3
i386/pc/multiboot.c +2 -2
@@ -1,7 +1,7 @@/* multiboot.c - boot a multiboot OS image. */ /* * PUPA -- Preliminary Universal Programming Architecture for GRUB -* Copyright (C) 2003 Free Software Foundation, Inc. +* Copyright (C) 2003, 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -119,7 +119,7 @@ pupa_rescue_cmd_multiboot (int argc, chabe at least 12 bytes and aligned on a 4-byte boundary. */ for (header = (struct pupa_multiboot_header *) buffer; ((char *) header <= buffer + len -12 ) || (header =0 ); - (char *)header +=4 ) + header = (struct pupa_multiboot_header *) ((char *)header +4 )) {if (header->magic ==PUPA_MB_MAGIC && !(header->magic + header->flags + header->checksum))
Index: term/i386/pc/vga.c
===================================================================
RCS file: /cvsroot/grub/grub2/term/i386/pc/vga.c,v retrieving revision 1.3
i386/pc/vga.c +103 -103
217 lines not on this page · raw message
Index: util/console.c
===================================================================
RCS file: /cvsroot/grub/grub2/util/console.c,v
retrieving revision 1.3
console.c +1 -0
@@ -177,6 +177,7 @@ static pupa_err_tpupa_ncurses_fini (void) {endwin (); +return 0 ; }
Index: util/i386/pc/biosdisk.c
===================================================================
RCS file: /cvsroot/grub/grub2/util/i386/pc/biosdisk.c,v retrieving revision 1.5
i386/pc/biosdisk.c +8 -7
@@ -1,7 +1,7 @@/* biosdisk.c - emulate biosdisk */ /* * PUPA -- Preliminary Universal Programming Architecture for GRUB -* Copyright (C) 1999,2000,2001,2002,2003 Free Software Foundation, Inc. +* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. * * PUPA is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -190,11 +190,12 @@ pupa_util_biosdisk_open (const char *namreturn PUPA_ERR_NONE ; } -#else -# warning "No special routine to get the size of a block device is implemented for your OS. This is not possibly fatal." -#endif fail: + /* In GNU/Hurd, stat() will return the right size. */ +#elif !defined (__GNU__) +# warning "No special routine to get the size of a block device is implemented for your OS. This is not possibly fatal." +#endif if (stat (map[drive], &st) <0 )return pupa_error (PUPA_ERR_BAD_DEVICE ,"cannot stat `%s'" , map[drive]);
@@ -325,7 +326,7 @@ open_device (const pupa_disk_t disk, uns }#else /* ! __linux__ */ fd =open (map[disk->id], flags); -if (! fd) +if (fd <0 ) {pupa_error (PUPA_ERR_BAD_DEVICE ,"cannot open `%s'" , map[disk->id]);return -1 ;
@@ -815,11 +816,11 @@ pupa_util_biosdisk_get_pupa_dev (const c p =strrchr (os_dev,'s' );if (p) { -unsigned long n; +long int n;char *q; p++; - n =strtoul (p, &q,10 ); + n =strtol (p, &q,10 );if (p != q && n !=LONG_MIN && n !=LONG_MAX ) { dos_part = (int ) n;
Index: util/i386/pc/pupa-mkimage.c
===================================================================
RCS file: /cvsroot/grub/grub2/util/i386/pc/pupa-mkimage.c,v retrieving revision 1.4
i386/pc/pupa-mkimage.c +3 -3
@@ -1,7 +1,7 @@/* pupa-mkimage.c - make a bootable image */ /* * PUPA -- Preliminary Universal Programming Architecture for GRUB -* Copyright (C) 2002,2003 Free Software Foundation, Inc. +* Copyright (C) 2002,2003,2004 Free Software Foundation, Inc. * * PUPA is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -192,8 +192,8 @@ Make a bootable image of PUPA.\n\ -V, --version print version information and exit\n\ -v, --verbose print verbose messages\n\ \n\ -Report bugs to <[email protected]>.\n\ -", PUPA_DATADIR); +Report bugs to <%s>.\n\ +", PUPA_DATADIR, PACKAGE_BUGREPORT); exit (status); }
Index: util/i386/pc/pupa-setup.c
===================================================================
RCS file: /cvsroot/grub/grub2/util/i386/pc/pupa-setup.c,v retrieving revision 1.6
i386/pc/pupa-setup.c +6 -4
@@ -1,7 +1,7 @@/* pupa-setup.c - make PUPA usable */ /* * PUPA -- Preliminary Universal Programming Architecture for GRUB -* Copyright (C) 1999,2000,2001,2002,2003 Free Software Foundation, Inc. +* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. * * PUPA is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -470,10 +470,10 @@ DEVICE must be a PUPA device (e.g. ``(hd -V, --version print version information and exit\n\ -v, --verbose print verbose messages\n\ \n\ -Report bugs to <[email protected]>.\n\ +Report bugs to <%s>.\n\ ", -DEFAULT_BOOT_FILE ,DEFAULT_CORE_FILE , - DEFAULT_DIRECTORY, DEFAULT_DEVICE_MAP); +DEFAULT_BOOT_FILE ,DEFAULT_CORE_FILE ,DEFAULT_DIRECTORY , + DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);exit (status); }
@@ -594,6 +594,7 @@ main (int argc, char *argv[])/* Initialize filesystems. */ pupa_fat_init (); +pupa_ext2_init ();if (root_dev) {
@@ -625,6 +626,7 @@ main (int argc, char *argv[]) root_dev, dest_dev);/* Free resources. */ +pupa_ext2_fini ();pupa_fat_fini ();pupa_util_biosdisk_fini ();
Signature · 1 line
Jeroen Dekkers
Quoted 1 line · Jeroen Dekkers
*
fs/fat.c(log2): Change name togrub_log2. All callers
changed.
This should be written like this:
* fs/fat.c (log2): Renamed to ...
(grub_log2): ... this.
All callers changed.
This is the traditional in GRUB.
BTW, I think this function should be named fat_log2 rather than grub_log2, because it's local. Or, is it better to define this globally in somewhere else?
The other changes are very good.
Thanks,
Okuji
Quoted 11 lines · Yoshinori K. Okuji
Quoted 1 line · Jeroen Dekkers
*
fs/fat.c(log2): Change name togrub_log2. All callerschanged.
This should be written like this:
*
fs/fat.c(log2): Renamed to ...
(grub_log2): ... this.
All callers changed.This is the traditional in GRUB.
Ok.
Quoted 3 lines
BTW, I think this function should be named
fat_log2rather thangrub_log2, because it's local. Or, is it better to define this globally in somewhere else?
I renamed it to fat_log2.
Quoted 1 line
The other changes are very good.
I committed the changes. I don't have any patches outstanding anymore, you don't have to wait for me to change the filenames.
Signature · 1 line
Jeroen Dekkers
Quoted 2 lines · Jeroen Dekkers
I committed the changes. I don't have any patches outstanding anymore, you don't have to wait for me to change the filenames.
I still have to commit the PPC port. Before I do that I want to have a quick look at some things. At the moment I do not have the time for that, I think I can commit it Monday or Tuesday.
I will send a email to the list if I committed this.
--
Marco