[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grub-core/osdep/unix/hostdisk.c: remove support for ancient glibc
From: |
Vladimir 'φ-coder/phcoder' Serbinenko |
Subject: |
Re: grub-core/osdep/unix/hostdisk.c: remove support for ancient glibc |
Date: |
Fri, 28 Nov 2014 21:18:05 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.2.0 |
On 21.11.2014 22:00, Felix Janda wrote:
> Hello,
>
> the file grub-core/osdep/unix/hostdisk.c has special code for glibc<2.1,
> which gets also pulled in for other libcs (such as musl libc) and makes
> compilation fail for them because the code uses glibc internals. The
> easiest way to fix is just to remove the code as the below patch does.
>
Don't assume that nobody will try to compile with ancient glibc. If you
want to raise the supported version for glibc you need to add a
configure check for presence of long offsets to configure and fail it if
it's not available. It should also be documented in INSTALL.
> --Felix
>
> diff -ur a/grub-2.02~beta2/grub-core/osdep/unix/hostdisk.c
> b/grub-2.02~beta2/grub-core/osdep/unix/hostdisk.c
> --- a/grub-2.02~beta2/grub-core/osdep/unix/hostdisk.c
> +++ b/grub-2.02~beta2/grub-core/osdep/unix/hostdisk.c
> @@ -48,11 +48,6 @@
> #ifdef __linux__
> # include <sys/ioctl.h> /* ioctl */
> # include <sys/mount.h>
> -# if !defined(__GLIBC__) || \
> - ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))
> -/* Maybe libc doesn't have large file support. */
> -# include <linux/unistd.h> /* _llseek */
> -# endif /* (GLIBC < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR < 1)) */
> #endif /* __linux__ */
>
> grub_uint64_t
> @@ -79,24 +74,6 @@
> return st.st_size;
> }
>
> -#if defined(__linux__) && (!defined(__GLIBC__) || \
> - ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))))
> - /* Maybe libc doesn't have large file support. */
> -int
> -grub_util_fd_seek (grub_util_fd_t fd, grub_uint64_t off)
> -{
> - loff_t offset, result;
> - static int _llseek (uint filedes, ulong hi, ulong lo,
> - loff_t *res, uint wh);
> - _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo,
> - loff_t *, res, uint, wh);
> -
> - offset = (loff_t) off;
> - if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET))
> - return -1;
> - return GRUB_ERR_NONE;
> -}
> -#else
> int
> grub_util_fd_seek (grub_util_fd_t fd, grub_uint64_t off)
> {
> @@ -107,7 +84,6 @@
>
> return 0;
> }
> -#endif
>
>
> /* Read LEN bytes from FD in BUF. Return less than or equal to zero if an
>
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
signature.asc
Description: OpenPGP digital signature