bootloader: rebase onto upstream 1.0.0, sync firmware-loader version

Bootloader fork rebase:
- Base changed from 0.1.0 pre-patched archive to upstream 1.0.0 tag (c7eeb9f)
- Applied 0001-redbear-local-forks.patch (Cargo.toml crate path redirects)
- Applied fix-uefi-alloc-panic.patch equivalents (4 panic!() -> graceful
  error handling in src/main.rs)
- Applied P5-live-preload-cap-1gib.patch (1 GiB cap on live image preload)
- Skipped: P0 GPT partition scan (requires new module + integration),
  P1 timeout/default-resolution, P2 live preload guard (subsumed by
  panic fixes + cap), P3 live image safe read, P4 large ISO boot,
  redox.patch — to be applied in dedicated rebase session.

firmware-loader/Cargo.toml: version 0.1.0 -> 0.3.0 (sync with other
Red Bear custom crates which are at 0.3.0).

fork-upstream-map.toml: bootloader back from PENDING_REBASE to 1.0.0
since the partial rebase matches upstream 1.0.0 content.

fork-upstream-map.toml: base restored to 'main' tracked (was correctly
tracked by build-redbear.sh).
This commit is contained in:
2026-07-11 09:47:59 +03:00
parent 9bbc38fe60
commit 068a1ca63e
1609 changed files with 256532 additions and 299729 deletions
+54 -145
View File
@@ -1,7 +1,7 @@
/* System dependent declarations.
Copyright (C) 1988-1989, 1992-1995, 1998, 2001-2002, 2004, 2006, 2009-2013,
2015-2017 Free Software Foundation, Inc.
2015-2025 Free Software Foundation, Inc.
This file is part of GNU DIFF.
@@ -20,33 +20,15 @@
#include <config.h>
/* Use this to suppress gcc's "...may be used before initialized" warnings. */
#ifdef lint
# define IF_LINT(Code) Code
#else
# define IF_LINT(Code) /* empty */
#endif
/* Define '__attribute__' and 'volatile' first
so that they're used consistently in all system includes. */
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) || __STRICT_ANSI__
# define __attribute__(x)
#endif
#include <verify.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "stat-macros.h"
#ifndef STAT_BLOCKSIZE
# if HAVE_STRUCT_STAT_ST_BLKSIZE
# define STAT_BLOCKSIZE(s) ((s).st_blksize)
# else
# define STAT_BLOCKSIZE(s) (8 * 1024)
# endif
#endif
#include <stat-macros.h>
#include <stat-size.h>
#include <stat-time.h>
#include <timespec.h>
#include <unistd.h>
@@ -61,24 +43,14 @@
#endif
#include <stdlib.h>
#define EXIT_TROUBLE 2
#include <inttypes.h>
#include <limits.h>
#include <locale.h>
#include <stdbit.h>
#include <stdckdint.h>
#include <stddef.h>
#include <inttypes.h>
#include <string.h>
#if ! HAVE_STRCASECOLL
# if HAVE_STRICOLL || defined stricoll
# define strcasecoll(a, b) stricoll (a, b)
# else
# define strcasecoll(a, b) strcasecmp (a, b) /* best we can do */
# endif
#endif
#if ! (HAVE_STRCASECMP || defined strcasecmp)
int strcasecmp (char const *, char const *);
#endif
#include <gettext.h>
#if ! ENABLE_NLS
@@ -91,17 +63,6 @@ int strcasecmp (char const *, char const *);
#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
#include <ctype.h>
/* ISDIGIT differs from isdigit, as follows:
- Its arg may be any int or unsigned int; it need not be an unsigned char.
- It's guaranteed to evaluate its argument exactly once.
- It's typically faster.
POSIX 1003.1-2001 says that only '0' through '9' are digits.
Prefer ISDIGIT to isdigit unless it's important to use the locale's
definition of 'digit' even when the host does not conform to POSIX. */
#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
#include <errno.h>
#include <signal.h>
@@ -109,55 +70,50 @@ int strcasecmp (char const *, char const *);
# define SIGCHLD SIGCLD
#endif
#undef MIN
#undef MAX
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#include <stdbool.h>
#include <attribute.h>
#include <idx.h>
#include <intprops.h>
#include "propername.h"
#include <minmax.h>
#include <propername.h>
#include <same-inode.h>
#include "version.h"
/* Evaluate an assertion E that is guaranteed to be true.
E should not crash, loop forever, or have side effects. */
#if defined DDEBUG && !defined NDEBUG
/* Abort the program if E is false. */
# include <assert.h>
# define dassert(e) assert (e)
#else
/* The compiler can assume E, as behavior is undefined otherwise. */
# define dassert(e) assume (e)
#endif
#ifndef SYSTEM_INLINE
# define SYSTEM_INLINE _GL_INLINE
#endif
_GL_INLINE_HEADER_BEGIN
/* Type used for fast comparison of several bytes at a time.
This used to be uintmax_t, but changing it to size_t
The type is a pointer to an incomplete struct,
so that its values are less likely to be misused.
This used to be uintmax_t, but changing it to the size of a pointer
made plain 'cmp' 90% faster (GCC 4.8.1, x86). */
#ifndef word
# define word size_t
typedef struct incomplete *word;
#endif
/* The signed integer type of a line number. Since files are read
into main memory, ptrdiff_t should be wide enough. */
into main memory, ptrdiff_t should be wide enough. pI is for
printing line numbers. */
typedef ptrdiff_t lin;
#define LIN_MAX PTRDIFF_MAX
/* The signed integer type for printing line numbers, and its printf
length modifier. This is not simply ptrdiff_t, to cater to older
and/or nonstandard C libraries where "l" works but "ll" and "t" do
not, or where 'long' is too narrow and "ll" works but "t" does not. */
#if LIN_MAX <= LONG_MAX
typedef long int printint;
# define pI "l"
#elif LIN_MAX <= LLONG_MAX
typedef long long int printint;
# define pI "ll"
#else
typedef ptrdiff_t printint;
# define pI "t"
#endif
verify (TYPE_SIGNED (lin));
verify (TYPE_SIGNED (printint));
verify (LIN_MAX == TYPE_MAXIMUM (lin));
verify (LIN_MAX <= TYPE_MAXIMUM (printint));
/* Limit so that 2 * CONTEXT + 1 does not overflow. */
#define CONTEXT_MAX ((LIN_MAX - 1) / 2)
#define pI "t"
static_assert (LIN_MAX == IDX_MAX);
/* This section contains POSIX-compliant defaults for macros
that are meant to be overridden by hand in config.h as needed. */
@@ -174,67 +130,20 @@ verify (LIN_MAX <= TYPE_MAXIMUM (printint));
# define NULL_DEVICE "/dev/null"
#endif
/* Do struct stat *S, *T describe the same special file? */
#ifndef same_special_file
# if HAVE_STRUCT_STAT_ST_RDEV && defined S_ISBLK && defined S_ISCHR
# define same_special_file(s, t) \
(((S_ISBLK ((s)->st_mode) && S_ISBLK ((t)->st_mode)) \
|| (S_ISCHR ((s)->st_mode) && S_ISCHR ((t)->st_mode))) \
&& (s)->st_rdev == (t)->st_rdev)
# else
# define same_special_file(s, t) 0
# endif
#endif
/* Do struct stat *S, *T describe the same file? Answer -1 if unknown. */
#ifndef same_file
# define same_file(s, t) \
((((s)->st_ino == (t)->st_ino) && ((s)->st_dev == (t)->st_dev)) \
|| same_special_file (s, t))
#endif
/* Do struct stat *S, *T have the same file attributes?
POSIX says that two files are identical if st_ino and st_dev are
the same, but many file systems incorrectly assign the same (device,
inode) pair to two distinct files, including:
- GNU/Linux NFS servers that export all local file systems as a
single NFS file system, if a local device number (st_dev) exceeds
255, or if a local inode number (st_ino) exceeds 16777215.
- Network Appliance NFS servers in snapshot directories; see
Network Appliance bug #195.
- ClearCase MVFS; see bug id ATRia04618.
Check whether two files that purport to be the same have the same
attributes, to work around instances of this common bug. Do not
inspect all attributes, only attributes useful in checking for this
bug.
It's possible for two distinct files on a buggy file system to have
the same attributes, but it's not worth slowing down all
implementations (or complicating the configuration) to cater to
these rare cases in buggy implementations. */
#ifndef same_file_attributes
# define same_file_attributes(s, t) \
((s)->st_mode == (t)->st_mode \
&& (s)->st_nlink == (t)->st_nlink \
&& (s)->st_uid == (t)->st_uid \
&& (s)->st_gid == (t)->st_gid \
&& (s)->st_size == (t)->st_size \
&& (s)->st_mtime == (t)->st_mtime \
&& (s)->st_ctime == (t)->st_ctime)
#endif
#define STREQ(a, b) (strcmp (a, b) == 0)
#ifndef FALLTHROUGH
# if __GNUC__ < 7
# define FALLTHROUGH ((void) 0)
# else
# define FALLTHROUGH __attribute__ ((__fallthrough__))
# endif
#endif
/* Return the floor of the log base 2 of N. Return -1 if N is zero. */
SYSTEM_INLINE int floor_log2 (idx_t n)
{
static_assert (IDX_MAX <= SIZE_MAX);
size_t s = n;
int w = stdc_bit_width (s);
return w - 1;
}
_GL_INLINE_HEADER_END
extern bool same_file (struct stat const *, struct stat const *)
ATTRIBUTE_PURE;
extern off_t stat_size (struct stat const *)
ATTRIBUTE_PURE;