* grub-core/kern/emu/misc.c (canonicalize_file_name): Move to ...
* grub-core/kern/emu/hostdisk_*.c (canonicalize_file_name): ... here.
This commit is contained in:
parent
29072e994e
commit
a5b0365ab2
5 changed files with 61 additions and 58 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2013-10-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/kern/emu/misc.c (canonicalize_file_name): Move to ...
|
||||||
|
* grub-core/kern/emu/hostdisk_*.c (canonicalize_file_name): ... here.
|
||||||
|
|
||||||
2013-10-08 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-10-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/kern/arm/misc.S: Remove leftover ARM and THUMB.
|
* grub-core/kern/arm/misc.S: Remove leftover ARM and THUMB.
|
||||||
|
|
|
@ -59,6 +59,31 @@
|
||||||
|
|
||||||
static ULONG *bounce;
|
static ULONG *bounce;
|
||||||
|
|
||||||
|
char *
|
||||||
|
canonicalize_file_name (const char *path)
|
||||||
|
{
|
||||||
|
char *ret;
|
||||||
|
BPTR lck;
|
||||||
|
const char *p;
|
||||||
|
|
||||||
|
p = strchr (path, ':');
|
||||||
|
if (p && !p[1])
|
||||||
|
return xstrdup (path);
|
||||||
|
|
||||||
|
ret = xmalloc (2048);
|
||||||
|
lck = Lock ((const unsigned char *) path, SHARED_LOCK);
|
||||||
|
|
||||||
|
if (!lck || !NameFromLock (lck, (unsigned char *) ret, 2040))
|
||||||
|
{
|
||||||
|
free (ret);
|
||||||
|
ret = xstrdup (path);
|
||||||
|
}
|
||||||
|
if (lck)
|
||||||
|
UnLock (lck);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static grub_uint64_t
|
static grub_uint64_t
|
||||||
grub_util_get_fd_size_volume (grub_util_fd_t fd __attribute__ ((unused)),
|
grub_util_get_fd_size_volume (grub_util_fd_t fd __attribute__ ((unused)),
|
||||||
const char *dev,
|
const char *dev,
|
||||||
|
|
|
@ -190,4 +190,19 @@ grub_util_fd_close (grub_util_fd_t fd)
|
||||||
close (fd);
|
close (fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
canonicalize_file_name (const char *path)
|
||||||
|
{
|
||||||
|
#if defined (PATH_MAX)
|
||||||
|
char *ret;
|
||||||
|
|
||||||
|
ret = xmalloc (PATH_MAX);
|
||||||
|
if (!realpath (path, ret))
|
||||||
|
return NULL;
|
||||||
|
return ret;
|
||||||
|
#else
|
||||||
|
return realpath (path, NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -239,3 +239,19 @@ grub_util_fd_strerror (void)
|
||||||
#error "Unsupported TCHAR size"
|
#error "Unsupported TCHAR size"
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
canonicalize_file_name (const char *path)
|
||||||
|
{
|
||||||
|
char *ret;
|
||||||
|
ret = xmalloc (PATH_MAX);
|
||||||
|
|
||||||
|
#ifndef __CYGWIN__
|
||||||
|
if (!_fullpath (ret, path, PATH_MAX))
|
||||||
|
return NULL;
|
||||||
|
#else
|
||||||
|
if (!realpath (path, ret))
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
@ -42,26 +42,6 @@
|
||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
#include <grub/emu/misc.h>
|
#include <grub/emu/misc.h>
|
||||||
|
|
||||||
#ifdef HAVE_SYS_PARAM_H
|
|
||||||
# include <sys/param.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_MOUNT_H
|
|
||||||
# include <sys/mount.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_MNTTAB_H
|
|
||||||
# include <stdio.h> /* Needed by sys/mnttab.h. */
|
|
||||||
# include <sys/mnttab.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __AROS__
|
|
||||||
#include <dos/dos.h>
|
|
||||||
#include <dos/filesystem.h>
|
|
||||||
#include <dos/exall.h>
|
|
||||||
#include <proto/dos.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int verbosity;
|
int verbosity;
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -196,41 +176,3 @@ int fsync (int fno __attribute__ ((unused)))
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *
|
|
||||||
canonicalize_file_name (const char *path)
|
|
||||||
{
|
|
||||||
char *ret;
|
|
||||||
#ifdef __AROS__
|
|
||||||
BPTR lck;
|
|
||||||
const char *p;
|
|
||||||
|
|
||||||
p = strchr (path, ':');
|
|
||||||
if (p && !p[1])
|
|
||||||
return xstrdup (path);
|
|
||||||
|
|
||||||
ret = xmalloc (2048);
|
|
||||||
lck = Lock ((const unsigned char *) path, SHARED_LOCK);
|
|
||||||
|
|
||||||
if (!lck || !NameFromLock (lck, (unsigned char *) ret, 2040))
|
|
||||||
{
|
|
||||||
free (ret);
|
|
||||||
ret = xstrdup (path);
|
|
||||||
}
|
|
||||||
if (lck)
|
|
||||||
UnLock (lck);
|
|
||||||
|
|
||||||
#elif defined (__MINGW32__)
|
|
||||||
ret = xmalloc (PATH_MAX);
|
|
||||||
if (!_fullpath (ret, path, PATH_MAX))
|
|
||||||
return NULL;
|
|
||||||
#elif defined (PATH_MAX)
|
|
||||||
ret = xmalloc (PATH_MAX);
|
|
||||||
if (!realpath (path, ret))
|
|
||||||
return NULL;
|
|
||||||
#else
|
|
||||||
ret = realpath (path, NULL);
|
|
||||||
#endif
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue