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
+135 -81
View File
@@ -1,7 +1,7 @@
/* Shared definitions for GNU DIFF
Copyright (C) 1988-1989, 1991-1995, 1998, 2001-2002, 2004, 2009-2013,
2015-2017 Free Software Foundation, Inc.
2015-2025 Free Software Foundation, Inc.
This file is part of GNU DIFF.
@@ -23,6 +23,12 @@
#include <stdio.h>
#include <unlocked-io.h>
_GL_INLINE_HEADER_BEGIN
#ifndef DIFF_INLINE
# define DIFF_INLINE _GL_INLINE
#endif
/* What kind of changes a hunk contains. */
enum changes
{
@@ -54,12 +60,6 @@ enum colors_style
/* Variables for command line options */
#ifndef GDIFF_MAIN
# define XTERN extern
#else
# define XTERN
#endif
enum output_style
{
/* No output style specified. */
@@ -91,27 +91,31 @@ enum output_style
};
/* True for output styles that are robust,
i.e. can handle a file that ends in a non-newline. */
#define ROBUST_OUTPUT_STYLE(S) ((S) != OUTPUT_ED && (S) != OUTPUT_FORWARD_ED)
i.e. can handle a file that ends in a non-newline.
This is indented unusually to pacify 'make syntax-check'. */
DIFF_INLINE bool robust_output_style (enum output_style s)
{
return s != OUTPUT_ED && s != OUTPUT_FORWARD_ED;
}
XTERN enum output_style output_style;
extern enum output_style output_style;
/* Define the current color context used to print a line. */
XTERN enum colors_style colors_style;
extern enum colors_style colors_style;
/* Nonzero if output cannot be generated for identical files. */
XTERN bool no_diff_means_no_output;
extern bool no_diff_means_no_output;
/* Number of lines of context to show in each set of diffs.
This is zero when context is not to be shown. */
XTERN lin context;
extern lin context;
/* Consider all files as text files (-a).
Don't interpret codes over 0177 as implying a "binary file". */
XTERN bool text;
extern bool text;
/* Number of lines to keep in identical prefix and suffix. */
XTERN lin horizon_lines;
extern lin horizon_lines;
/* The significance of white space during comparisons. */
enum DIFF_white_space
@@ -136,100 +140,107 @@ enum DIFF_white_space
/* Ignore all horizontal white space (-w). */
IGNORE_ALL_SPACE
};
XTERN enum DIFF_white_space ignore_white_space;
extern enum DIFF_white_space ignore_white_space;
/* Ignore changes that affect only blank lines (-B). */
XTERN bool ignore_blank_lines;
extern bool ignore_blank_lines;
/* Files can be compared byte-by-byte, as if they were binary.
This depends on various options. */
XTERN bool files_can_be_treated_as_binary;
extern bool files_can_be_treated_as_binary;
/* Ignore differences in case of letters (-i). */
XTERN bool ignore_case;
extern bool ignore_case;
/* Ignore differences in case of letters in file names. */
XTERN bool ignore_file_name_case;
extern bool ignore_file_name_case;
/* Act on symbolic links themselves rather than on their target
(--no-dereference). */
XTERN bool no_dereference_symlinks;
extern bool no_dereference_symlinks;
/* Local timezone for 'c' output headers, if needed. */
#if HAVE_TM_GMTOFF
# define localtz 0 /* Placeholder since localtz is never needed. */
#else
extern timezone_t localtz;
#endif
/* File labels for '-c' output headers (--label). */
XTERN char *file_label[2];
extern char *file_label[2];
/* Regexp to identify function-header lines (-F). */
XTERN struct re_pattern_buffer function_regexp;
extern struct re_pattern_buffer function_regexp;
/* Ignore changes that affect only lines matching this regexp (-I). */
XTERN struct re_pattern_buffer ignore_regexp;
extern struct re_pattern_buffer ignore_regexp;
/* Say only whether files differ, not how (-q). */
XTERN bool brief;
extern bool brief;
/* Expand tabs in the output so the text lines up properly
despite the characters added to the front of each line (-t). */
XTERN bool expand_tabs;
extern bool expand_tabs;
/* Number of columns between tab stops. */
XTERN size_t tabsize;
extern intmax_t tabsize;
/* Use a tab in the output, rather than a space, before the text of an
input line, so as to keep the proper alignment in the input line
without changing the characters in it (-T). */
XTERN bool initial_tab;
extern bool initial_tab;
/* Do not output an initial space or tab before the text of an empty line. */
XTERN bool suppress_blank_empty;
extern bool suppress_blank_empty;
/* Remove trailing carriage returns from input. */
XTERN bool strip_trailing_cr;
extern bool strip_trailing_cr;
/* In directory comparison, specify file to start with (-S).
This is used for resuming an aborted comparison.
All file names less than this name are ignored. */
XTERN char const *starting_file;
extern char const *starting_file;
/* Pipe each file's output through pr (-l). */
XTERN bool paginate;
extern bool paginate;
/* Line group formats for unchanged, old, new, and changed groups. */
XTERN char const *group_format[CHANGED + 1];
extern char const *group_format[CHANGED + 1];
/* Line formats for unchanged, old, and new lines. */
XTERN char const *line_format[NEW + 1];
extern char const *line_format[NEW + 1];
/* If using OUTPUT_SDIFF print extra information to help the sdiff filter. */
XTERN bool sdiff_merge_assist;
extern bool sdiff_merge_assist;
/* Tell OUTPUT_SDIFF to show only the left version of common lines. */
XTERN bool left_column;
extern bool left_column;
/* Tell OUTPUT_SDIFF to not show common lines. */
XTERN bool suppress_common_lines;
extern bool suppress_common_lines;
/* The half line width and column 2 offset for OUTPUT_SDIFF. */
XTERN size_t sdiff_half_width;
XTERN size_t sdiff_column2_offset;
extern intmax_t sdiff_half_width;
extern intmax_t sdiff_column2_offset;
/* String containing all the command options diff received,
with spaces between and at the beginning but none at the end.
If there were no options given, this string is empty. */
XTERN char *switch_string;
extern char *switch_string;
/* Use heuristics for better speed with large files with a small
density of changes. */
XTERN bool speed_large_files;
extern bool speed_large_files;
/* Patterns that match file names to be excluded. */
XTERN struct exclude *excluded;
extern struct exclude *excluded;
/* Don't discard lines. This makes things slower (sometimes much
slower) but will find a guaranteed minimal set of changes. */
XTERN bool minimal;
extern bool minimal;
/* The strftime format to use for time strings. */
XTERN char const *time_format;
extern char const *time_format;
/* The result of comparison is an "edit script": a chain of 'struct change'.
Each 'struct change' represents one place where some lines are deleted
@@ -254,30 +265,57 @@ struct change
/* Structures that describe the input files. */
/* Directory entry types. Like dirent DT_* macros, but portable and
safe to use as 'char'. Use the same values as GNU/Linux, as this
may help compilers on that platform. */
enum detype
{
DE_UNKNOWN,
DE_FIFO,
DE_CHR,
DE_DIR = 4,
DE_BLK = 6,
DE_REG = 8,
DE_LNK = 10,
DE_SOCK = 12,
DE_WHT = 14,
/* This one is not in GNU/Linux; it means the directory entry
type has been determined but is none of the above. */
DE_OTHER
};
/* Data on one input file being compared. */
struct file_data {
int desc; /* File descriptor */
int openerr; /* openat errno, or 0 */
int err; /* openat or fstatat or fstat errno, or 0 */
char const *name; /* File name */
char const *filetype; /* file type as untranslated string */
struct stat stat; /* File status */
/* Directory stream corresponding to DESC, if it has been fdopendir'ed.
Null otherwise. */
DIR *dirstream;
/* Buffer in which text of file is read. */
word *buffer;
/* Allocated size of buffer, in bytes. Always a multiple of
sizeof *buffer. */
size_t bufsize;
idx_t bufsize;
/* Number of valid bytes now in the buffer. */
size_t buffered;
idx_t buffered;
/* Array of pointers to lines in the file. */
char const **linbuf;
/* linbuf_base <= buffered_lines <= valid_lines <= alloc_lines.
linebuf[linbuf_base ... buffered_lines - 1] are possibly differing.
linebuf[linbuf_base ... valid_lines - 1] contain valid data.
linebuf[linbuf_base ... alloc_lines - 1] are allocated. */
/* linbuf_base <= 0 <= buffered_lines <= valid_lines <= alloc_lines.
linbuf[0 ... buffered_lines - 1] are possibly differing.
linbuf[linbuf_base ... valid_lines - 1] contain valid data.
linbuf[linbuf_base ... alloc_lines - 1] are allocated. */
lin linbuf_base, buffered_lines, valid_lines, alloc_lines;
/* Pointer to end of prefix of this file to ignore when hashing. */
@@ -307,9 +345,9 @@ struct file_data {
lin nondiscarded_lines;
/* Vector, indexed by real origin-0 line number,
containing 1 for a line that is an insertion or a deletion.
containing true for a line that is an insertion or a deletion.
The results of comparison are stored here. */
char *changed;
bool *changed;
/* 1 if file ends in a line with no final newline. */
bool missing_newline;
@@ -322,25 +360,38 @@ struct file_data {
lin equiv_max;
};
/* The file buffer, considered as an array of bytes rather than
as an array of words. */
#define FILE_BUFFER(f) ((char *) (f)->buffer)
/* struct file_data.desc markers.
A top level parent directory desc can be AT_FDCWD;
it is OK if AT_FDCWD is one of these other values. */
enum { OPEN_FAILED = -1 }; /* open was attempted but failed */
enum { NONEXISTENT = -2 }; /* nonexistent file */
enum { UNOPENED = -3 }; /* unopened file (e.g., file type mismatch) */
/* Data on two input files being compared. */
struct comparison
{
/* The two files. */
struct file_data file[2];
struct comparison const *parent; /* parent, if a recursive comparison */
/* The parent comparison, or &noparent if at the top level. */
struct comparison const *parent;
};
/* Describe the two files currently being compared. */
XTERN struct file_data files[2];
extern struct comparison curr;
/* A placeholder for the parent of the top level comparison.
Only the desc slots are used; although they are typically AT_FDCWD,
one might be nonnegative for a directory at the top level
for 'diff DIR FILE' or 'diff FILE DIR'. */
extern struct comparison noparent;
/* Stdio stream to output diffs to. */
XTERN FILE *outfile;
extern FILE *outfile;
/* Declare various functions. */
@@ -348,14 +399,20 @@ XTERN FILE *outfile;
extern int diff_2_files (struct comparison *);
/* context.c */
extern void print_context_header (struct file_data[], char const * const *, bool);
extern void print_context_header (struct file_data[],
char const *const *, bool);
extern void print_context_script (struct change *, bool);
/* diff.c */
extern int compare_files (struct comparison const *, enum detype const[2],
char const *, char const *);
/* dir.c */
extern int diff_dirs (struct comparison const *,
int (*) (struct comparison const *,
char const *, char const *));
extern char *find_dir_file_pathname (char const *, char const *);
extern int diff_dirs (struct comparison *);
extern char *find_dir_file_pathname (struct file_data *, char const *,
enum detype *)
ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC_FREE
ATTRIBUTE_RETURNS_NONNULL;
/* ed.c */
extern void print_ed_script (struct change *);
@@ -365,7 +422,7 @@ extern void pr_forward_ed_script (struct change *);
extern void print_ifdef_script (struct change *);
/* io.c */
extern void file_block_read (struct file_data *, size_t);
extern void file_block_read (struct file_data *, idx_t);
extern bool read_files (struct file_data[], bool);
/* normal.c */
@@ -380,33 +437,28 @@ extern void print_sdiff_script (struct change *);
/* util.c */
extern char const change_letter[4];
extern char const pr_program[];
extern char *concat (char const *, char const *, char const *);
extern bool lines_differ (char const *, char const *) _GL_ATTRIBUTE_PURE;
extern lin translate_line_number (struct file_data const *, lin);
extern struct change *find_change (struct change *);
extern struct change *find_reverse_change (struct change *);
extern void *zalloc (size_t);
extern lin translate_line_number (struct file_data const *, lin)
ATTRIBUTE_PURE;
extern struct change *find_change (struct change *) ATTRIBUTE_CONST;
extern enum changes analyze_hunk (struct change *, lin *, lin *, lin *, lin *);
extern void begin_output (void);
extern void cleanup_signal_handlers (void);
extern void debug_script (struct change *);
extern void fatal (char const *) __attribute__((noreturn));
extern _Noreturn void fatal (char const *);
extern void finish_output (void);
extern void message (char const *, char const *, char const *);
extern void message5 (char const *, char const *, char const *,
char const *, char const *);
extern void message (char const *, ...) ATTRIBUTE_FORMAT ((printf, 1, 2));
extern void output_1_line (char const *, char const *, char const *,
char const *);
extern void perror_with_name (char const *);
extern void pfatal_with_name (char const *) __attribute__((noreturn));
extern void print_1_line (char const *, char const * const *);
extern void print_1_line_nl (char const *, char const * const *, bool);
extern _Noreturn void pfatal_with_name (char const *);
extern void print_1_line (char const *, char const *const *);
extern void print_1_line_nl (char const *, char const *const *, bool);
extern void print_message_queue (void);
extern void print_number_range (char, struct file_data *, lin, lin);
extern void print_script (struct change *, struct change * (*) (struct change *),
void (*) (struct change *));
extern void setup_output (char const *, char const *, bool);
extern void translate_range (struct file_data const *, lin, lin,
printint *, printint *);
extern void translate_range (struct file_data const *, lin, lin, lin *, lin *);
enum color_context
{
@@ -417,7 +469,9 @@ enum color_context
LINE_NUMBER_CONTEXT,
};
XTERN bool presume_output_tty;
extern bool presume_output_tty;
extern void set_color_context (enum color_context color_context);
extern void set_color_palette (char const *palette);
extern void set_color_palette (char *palette);
_GL_INLINE_HEADER_END