Fix canonicalize_file_name clash.

canonicalize_file_name clashed with gnulib function. Additionally
it was declared in 2 places: emu/misc.h and util/misc.h. Added
grub_ prefix and removed second declaration.
This commit is contained in:
Vladimir Serbinenko 2015-03-04 01:00:19 +01:00
parent 9d25b0da9a
commit 27d1a67f8a
20 changed files with 30 additions and 30 deletions

View File

@ -55,7 +55,8 @@ grub_pci_device_map_range (grub_pci_device_t dev, grub_addr_t base,
int err; int err;
err = pci_device_map_range (dev, base, size, PCI_DEV_MAP_FLAG_WRITABLE, &addr); err = pci_device_map_range (dev, base, size, PCI_DEV_MAP_FLAG_WRITABLE, &addr);
if (err) if (err)
grub_util_error ("mapping 0x%x failed (error %d)\n", base, err); grub_util_error ("mapping 0x%llx failed (error %d)\n",
(unsigned long long) base, err);
return addr; return addr;
} }
@ -66,12 +67,12 @@ grub_pci_device_unmap_range (grub_pci_device_t dev, void *mem,
pci_device_unmap_range (dev, mem, size); pci_device_unmap_range (dev, mem, size);
} }
GRUB_MOD_INIT (pci) GRUB_MOD_INIT (emupci)
{ {
pci_system_init (); pci_system_init ();
} }
GRUB_MOD_FINI (pci) GRUB_MOD_FINI (emupci)
{ {
pci_system_cleanup (); pci_system_cleanup ();
} }

View File

@ -184,7 +184,7 @@ grub_hostdisk_os_dev_to_grub_drive (const char *os_disk, int add)
unsigned int i; unsigned int i;
char *canon; char *canon;
canon = canonicalize_file_name (os_disk); canon = grub_canonicalize_file_name (os_disk);
if (!canon) if (!canon)
canon = xstrdup (os_disk); canon = xstrdup (os_disk);
@ -535,7 +535,7 @@ read_device_map (const char *dev_map)
/* On Linux, the devfs uses symbolic links horribly, and that /* On Linux, the devfs uses symbolic links horribly, and that
confuses the interface very much, so use realpath to expand confuses the interface very much, so use realpath to expand
symbolic links. */ symbolic links. */
map[drive].device = canonicalize_file_name (p); map[drive].device = grub_canonicalize_file_name (p);
if (! map[drive].device) if (! map[drive].device)
map[drive].device = xstrdup (p); map[drive].device = xstrdup (p);

View File

@ -61,7 +61,7 @@
static ULONG *bounce; static ULONG *bounce;
char * char *
canonicalize_file_name (const char *path) grub_canonicalize_file_name (const char *path)
{ {
char *ret; char *ret;
BPTR lck; BPTR lck;

View File

@ -491,7 +491,7 @@ grub_guess_root_devices (const char *dir_in)
char **os_dev = NULL; char **os_dev = NULL;
struct stat st; struct stat st;
dev_t dev; dev_t dev;
char *dir = canonicalize_file_name (dir_in); char *dir = grub_canonicalize_file_name (dir_in);
if (!dir) if (!dir)
grub_util_error (_("failed to get canonical path of `%s'"), dir_in); grub_util_error (_("failed to get canonical path of `%s'"), dir_in);
@ -516,7 +516,7 @@ grub_guess_root_devices (const char *dir_in)
*cur = tmp; *cur = tmp;
else else
{ {
*cur = canonicalize_file_name (tmp); *cur = grub_canonicalize_file_name (tmp);
if (*cur == NULL) if (*cur == NULL)
grub_util_error (_("failed to get canonical path of `%s'"), tmp); grub_util_error (_("failed to get canonical path of `%s'"), tmp);
free (tmp); free (tmp);

View File

@ -198,7 +198,7 @@ grub_util_fd_close (grub_util_fd_t fd)
} }
char * char *
canonicalize_file_name (const char *path) grub_canonicalize_file_name (const char *path)
{ {
#if defined (PATH_MAX) #if defined (PATH_MAX)
char *ret; char *ret;

View File

@ -44,7 +44,7 @@ grub_make_system_path_relative_to_its_root (const char *path)
char *poolfs = NULL; char *poolfs = NULL;
/* canonicalize. */ /* canonicalize. */
p = canonicalize_file_name (path); p = grub_canonicalize_file_name (path);
if (p == NULL) if (p == NULL)
grub_util_error (_("failed to get canonical path of `%s'"), path); grub_util_error (_("failed to get canonical path of `%s'"), path);

View File

@ -328,7 +328,7 @@ grub_util_fd_strerror (void)
} }
char * char *
canonicalize_file_name (const char *path) grub_canonicalize_file_name (const char *path)
{ {
char *ret; char *ret;
LPTSTR windows_path; LPTSTR windows_path;

View File

@ -170,7 +170,7 @@ grub_util_host_init (int *argc __attribute__ ((unused)),
#error "Unsupported TCHAR size" #error "Unsupported TCHAR size"
#endif #endif
grub_util_base_directory = canonicalize_file_name ((*argv)[0]); grub_util_base_directory = grub_canonicalize_file_name ((*argv)[0]);
if (!grub_util_base_directory) if (!grub_util_base_directory)
grub_util_base_directory = xstrdup ((*argv)[0]); grub_util_base_directory = xstrdup ((*argv)[0]);
for (ptr = grub_util_base_directory + strlen (grub_util_base_directory) - 1; for (ptr = grub_util_base_directory + strlen (grub_util_base_directory) - 1;

View File

@ -27,6 +27,7 @@
#include <grub/symbol.h> #include <grub/symbol.h>
#include <grub/types.h> #include <grub/types.h>
#include <grub/misc.h> #include <grub/misc.h>
#include <grub/util/misc.h>
extern int verbosity; extern int verbosity;
extern const char *program_name; extern const char *program_name;
@ -61,8 +62,6 @@ void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format
grub_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void); grub_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void);
extern char * canonicalize_file_name (const char *path);
#ifdef HAVE_DEVICE_MAPPER #ifdef HAVE_DEVICE_MAPPER
int grub_device_mapper_supported (void); int grub_device_mapper_supported (void);
#endif #endif

View File

@ -41,7 +41,7 @@ void grub_util_write_image_at (const void *img, size_t size, off_t offset,
char *make_system_path_relative_to_its_root (const char *path); char *make_system_path_relative_to_its_root (const char *path);
char *canonicalize_file_name (const char *path); char *grub_canonicalize_file_name (const char *path);
void grub_util_init_nls (void); void grub_util_init_nls (void);

View File

@ -406,7 +406,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
os_dev); os_dev);
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
canon = canonicalize_file_name (os_dev); canon = grub_canonicalize_file_name (os_dev);
drive = grub_hostdisk_os_dev_to_grub_drive (canon ? : os_dev, 1); drive = grub_hostdisk_os_dev_to_grub_drive (canon ? : os_dev, 1);
if (canon) if (canon)
free (canon); free (canon);

View File

@ -77,7 +77,7 @@ main (int argc, char *argv[])
} }
if (had_file) if (had_file)
grub_util_error ("one argument expected"); grub_util_error ("one argument expected");
argv2[i - 1] = canonicalize_file_name (argv[i]); argv2[i - 1] = grub_canonicalize_file_name (argv[i]);
if (!argv2[i - 1]) if (!argv2[i - 1])
{ {
grub_util_error (_("cannot open `%s': %s"), argv[i], grub_util_error (_("cannot open `%s': %s"), argv[i],

View File

@ -651,7 +651,7 @@ argp_parser (int key, char *arg, struct argp_state *state)
{ {
if (args_count == 0) if (args_count == 0)
images = xmalloc (num_disks * sizeof (images[0])); images = xmalloc (num_disks * sizeof (images[0]));
images[args_count] = canonicalize_file_name (arg); images[args_count] = grub_canonicalize_file_name (arg);
args_count++; args_count++;
return 0; return 0;
} }

View File

@ -967,7 +967,7 @@ main (int argc, char *argv[])
{ {
char * t = grub_util_path_concat (2, bootdir, GRUB_DIR_NAME); char * t = grub_util_path_concat (2, bootdir, GRUB_DIR_NAME);
grub_install_mkdir_p (t); grub_install_mkdir_p (t);
grubdir = canonicalize_file_name (t); grubdir = grub_canonicalize_file_name (t);
if (!grubdir) if (!grubdir)
grub_util_error (_("failed to get canonical path of `%s'"), t); grub_util_error (_("failed to get canonical path of `%s'"), t);
free (t); free (t);
@ -1299,7 +1299,7 @@ main (int argc, char *argv[])
{ {
char *t = grub_util_path_concat (2, grubdir, char *t = grub_util_path_concat (2, grubdir,
platname); platname);
platdir = canonicalize_file_name (t); platdir = grub_canonicalize_file_name (t);
if (!platdir) if (!platdir)
grub_util_error (_("failed to get canonical path of `%s'"), grub_util_error (_("failed to get canonical path of `%s'"),
t); t);

View File

@ -64,7 +64,7 @@ bless (const char *path, int x86)
grub_err_t err; grub_err_t err;
struct stat st; struct stat st;
grub_path = canonicalize_file_name (path); grub_path = grub_canonicalize_file_name (path);
if (stat (grub_path, &st) < 0) if (stat (grub_path, &st) < 0)
grub_util_error (N_("cannot stat `%s': %s"), grub_util_error (N_("cannot stat `%s': %s"),

View File

@ -547,7 +547,7 @@ argp_parser (int key, char *arg, struct argp_state *state)
} }
images = xrealloc (images, (num_disks + 1) * sizeof (images[0])); images = xrealloc (images, (num_disks + 1) * sizeof (images[0]));
images[num_disks] = canonicalize_file_name (arg); images[num_disks] = grub_canonicalize_file_name (arg);
num_disks++; num_disks++;
return 0; return 0;

View File

@ -262,7 +262,7 @@ probe (const char *path, char **device_names, char delim)
if (path != NULL) if (path != NULL)
{ {
grub_path = canonicalize_file_name (path); grub_path = grub_canonicalize_file_name (path);
if (! grub_path) if (! grub_path)
grub_util_error (_("failed to get canonical path of `%s'"), path); grub_util_error (_("failed to get canonical path of `%s'"), path);
device_names = grub_guess_root_devices (grub_path); device_names = grub_guess_root_devices (grub_path);

View File

@ -175,7 +175,7 @@ main (int argc, char *argv[])
grub_host_init (); grub_host_init ();
char *t, *inpfull, *rootfull, *res; char *t, *inpfull, *rootfull, *res;
t = canonicalize_file_name (arguments.input); t = grub_canonicalize_file_name (arguments.input);
if (!t) if (!t)
{ {
grub_util_error (_("cannot open `%s': %s"), arguments.input, grub_util_error (_("cannot open `%s': %s"), arguments.input,
@ -185,7 +185,7 @@ main (int argc, char *argv[])
inpfull = xasprintf ("(host)/%s", t); inpfull = xasprintf ("(host)/%s", t);
free (t); free (t);
t = canonicalize_file_name (arguments.root ? : "/"); t = grub_canonicalize_file_name (arguments.root ? : "/");
if (!t) if (!t)
{ {
grub_util_error (_("cannot open `%s': %s"), arguments.root, grub_util_error (_("cannot open `%s': %s"), arguments.root,
@ -206,7 +206,7 @@ main (int argc, char *argv[])
cwd = xstrdup ("."); cwd = xstrdup (".");
} }
t = canonicalize_file_name (arguments.cwd ? : cwd); t = grub_canonicalize_file_name (arguments.cwd ? : cwd);
if (!t) if (!t)
{ {
grub_util_error (_("cannot open `%s': %s"), arguments.root, grub_util_error (_("cannot open `%s': %s"), arguments.root,

View File

@ -73,7 +73,7 @@ grub_util_guess_bios_drive (const char *orig_path)
{ {
char *canon; char *canon;
char *ptr; char *ptr;
canon = canonicalize_file_name (orig_path); canon = grub_canonicalize_file_name (orig_path);
if (!canon) if (!canon)
return NULL; return NULL;
ptr = strrchr (orig_path, '/'); ptr = strrchr (orig_path, '/');
@ -102,7 +102,7 @@ grub_util_guess_efi_drive (const char *orig_path)
{ {
char *canon; char *canon;
char *ptr; char *ptr;
canon = canonicalize_file_name (orig_path); canon = grub_canonicalize_file_name (orig_path);
if (!canon) if (!canon)
return NULL; return NULL;
ptr = strrchr (orig_path, '/'); ptr = strrchr (orig_path, '/');
@ -131,7 +131,7 @@ grub_util_guess_baremetal_drive (const char *orig_path)
{ {
char *canon; char *canon;
char *ptr; char *ptr;
canon = canonicalize_file_name (orig_path); canon = grub_canonicalize_file_name (orig_path);
if (!canon) if (!canon)
return NULL; return NULL;
ptr = strrchr (orig_path, '/'); ptr = strrchr (orig_path, '/');

View File

@ -157,7 +157,7 @@ grub_util_render_label (const char *label_font,
ieee1275_palette[cptr].a = 0xff; ieee1275_palette[cptr].a = 0xff;
char * t; char * t;
t = canonicalize_file_name (label_font); t = grub_canonicalize_file_name (label_font);
if (!t) if (!t)
{ {
grub_util_error (_("cannot open `%s': %s"), label_font, grub_util_error (_("cannot open `%s': %s"), label_font,