2004-04-04 Yoshinori K. Okuji <okuji@enbug.org>
All symbols prefixed with PUPA_ and pupa_ are renamed to GRUB_ and grub_, respectively. Because the conversion is trivial and mechanical, I omit the details here. Please refer to the CVS if you need more information.
This commit is contained in:
parent
6a1425510d
commit
4b13b216f4
125 changed files with 6198 additions and 6181 deletions
76
util/misc.c
76
util/misc.c
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
|
||||
*
|
||||
* PUPA is free software; you can redistribute it and/or modify
|
||||
* GRUB is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@ -13,7 +13,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PUPA; if not, write to the Free Software
|
||||
* along with GRUB; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
@ -26,15 +26,15 @@
|
|||
#include <sys/times.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include <pupa/util/misc.h>
|
||||
#include <pupa/mm.h>
|
||||
#include <pupa/term.h>
|
||||
#include <grub/util/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/term.h>
|
||||
|
||||
char *progname = 0;
|
||||
int verbosity = 0;
|
||||
|
||||
void
|
||||
pupa_util_info (const char *fmt, ...)
|
||||
grub_util_info (const char *fmt, ...)
|
||||
{
|
||||
if (verbosity > 0)
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ pupa_util_info (const char *fmt, ...)
|
|||
}
|
||||
|
||||
void
|
||||
pupa_util_error (const char *fmt, ...)
|
||||
grub_util_error (const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
@ -68,7 +68,7 @@ xmalloc (size_t size)
|
|||
|
||||
p = malloc (size);
|
||||
if (! p)
|
||||
pupa_util_error ("out of memory");
|
||||
grub_util_error ("out of memory");
|
||||
|
||||
return p;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ xrealloc (void *ptr, size_t size)
|
|||
{
|
||||
ptr = realloc (ptr, size);
|
||||
if (! ptr)
|
||||
pupa_util_error ("out of memory");
|
||||
grub_util_error ("out of memory");
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ xstrdup (const char *str)
|
|||
}
|
||||
|
||||
char *
|
||||
pupa_util_get_path (const char *dir, const char *file)
|
||||
grub_util_get_path (const char *dir, const char *file)
|
||||
{
|
||||
char *path;
|
||||
|
||||
|
@ -107,36 +107,36 @@ pupa_util_get_path (const char *dir, const char *file)
|
|||
}
|
||||
|
||||
size_t
|
||||
pupa_util_get_image_size (const char *path)
|
||||
grub_util_get_image_size (const char *path)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
pupa_util_info ("getting the size of %s", path);
|
||||
grub_util_info ("getting the size of %s", path);
|
||||
|
||||
if (stat (path, &st) == -1)
|
||||
pupa_util_error ("cannot stat %s", path);
|
||||
grub_util_error ("cannot stat %s", path);
|
||||
|
||||
return st.st_size;
|
||||
}
|
||||
|
||||
char *
|
||||
pupa_util_read_image (const char *path)
|
||||
grub_util_read_image (const char *path)
|
||||
{
|
||||
char *img;
|
||||
FILE *fp;
|
||||
size_t size;
|
||||
|
||||
pupa_util_info ("reading %s", path);
|
||||
grub_util_info ("reading %s", path);
|
||||
|
||||
size = pupa_util_get_image_size (path);
|
||||
size = grub_util_get_image_size (path);
|
||||
img = (char *) xmalloc (size);
|
||||
|
||||
fp = fopen (path, "rb");
|
||||
if (! fp)
|
||||
pupa_util_error ("cannot open %s", path);
|
||||
grub_util_error ("cannot open %s", path);
|
||||
|
||||
if (fread (img, 1, size, fp) != size)
|
||||
pupa_util_error ("cannot read %s", path);
|
||||
grub_util_error ("cannot read %s", path);
|
||||
|
||||
fclose (fp);
|
||||
|
||||
|
@ -144,83 +144,83 @@ pupa_util_read_image (const char *path)
|
|||
}
|
||||
|
||||
void
|
||||
pupa_util_load_image (const char *path, char *buf)
|
||||
grub_util_load_image (const char *path, char *buf)
|
||||
{
|
||||
FILE *fp;
|
||||
size_t size;
|
||||
|
||||
pupa_util_info ("reading %s", path);
|
||||
grub_util_info ("reading %s", path);
|
||||
|
||||
size = pupa_util_get_image_size (path);
|
||||
size = grub_util_get_image_size (path);
|
||||
|
||||
fp = fopen (path, "rb");
|
||||
if (! fp)
|
||||
pupa_util_error ("cannot open %s", path);
|
||||
grub_util_error ("cannot open %s", path);
|
||||
|
||||
if (fread (buf, 1, size, fp) != size)
|
||||
pupa_util_error ("cannot read %s", path);
|
||||
grub_util_error ("cannot read %s", path);
|
||||
|
||||
fclose (fp);
|
||||
}
|
||||
|
||||
void
|
||||
pupa_util_write_image (const char *img, size_t size, FILE *out)
|
||||
grub_util_write_image (const char *img, size_t size, FILE *out)
|
||||
{
|
||||
pupa_util_info ("writing 0x%x bytes", size);
|
||||
grub_util_info ("writing 0x%x bytes", size);
|
||||
if (fwrite (img, 1, size, out) != size)
|
||||
pupa_util_error ("write failed");
|
||||
grub_util_error ("write failed");
|
||||
}
|
||||
|
||||
void *
|
||||
pupa_malloc (unsigned size)
|
||||
grub_malloc (unsigned size)
|
||||
{
|
||||
return xmalloc (size);
|
||||
}
|
||||
|
||||
void
|
||||
pupa_free (void *ptr)
|
||||
grub_free (void *ptr)
|
||||
{
|
||||
free (ptr);
|
||||
}
|
||||
|
||||
void *
|
||||
pupa_realloc (void *ptr, unsigned size)
|
||||
grub_realloc (void *ptr, unsigned size)
|
||||
{
|
||||
return xrealloc (ptr, size);
|
||||
}
|
||||
|
||||
void *
|
||||
pupa_memalign (pupa_size_t align, pupa_size_t size)
|
||||
grub_memalign (grub_size_t align, grub_size_t size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
p = memalign (align, size);
|
||||
if (! p)
|
||||
pupa_util_error ("out of memory");
|
||||
grub_util_error ("out of memory");
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Some functions that we don't use. */
|
||||
void
|
||||
pupa_mm_init_region (void *addr __attribute__ ((unused)),
|
||||
pupa_size_t size __attribute__ ((unused)))
|
||||
grub_mm_init_region (void *addr __attribute__ ((unused)),
|
||||
grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
pupa_register_exported_symbols (void)
|
||||
grub_register_exported_symbols (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
pupa_stop (void)
|
||||
grub_stop (void)
|
||||
{
|
||||
exit (1);
|
||||
}
|
||||
|
||||
pupa_uint32_t
|
||||
pupa_get_rtc (void)
|
||||
grub_uint32_t
|
||||
grub_get_rtc (void)
|
||||
{
|
||||
struct tms currtime;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue