This also switches to _cleanup_free_. Otherwise no code changes.
# include "string-util-fundamental.h"
# define CHAR8 char
-# define CHAR16 char16_t
# define UINTN size_t
# define TEST_STATIC static
#endif
* (it always has the GUID 9dea862c-5cdd-4e70-acc1-f32b344d4795). If it contains more than
* one GUID, the BCD is multi-boot and we stop looking. Otherwise we take that GUID, look it
* up, and return its description property. */
-TEST_STATIC CHAR16 *get_bcd_title(uint8_t *bcd, UINTN bcd_len) {
+TEST_STATIC char16_t *get_bcd_title(uint8_t *bcd, UINTN bcd_len) {
assert(bcd);
if (HIVE_CELL_OFFSET >= bcd_len)
CHAR8 order_guid[sizeof("{00000000-0000-0000-0000-000000000000}\0")];
if (displayorder_value->data_type != REG_MULTI_SZ ||
- displayorder_value->data_size != sizeof(CHAR16[sizeof(order_guid)]) ||
- (UINTN)(bcd + displayorder_value->data_offset) % sizeof(CHAR16) != 0)
+ displayorder_value->data_size != sizeof(char16_t[sizeof(order_guid)]) ||
+ (UINTN)(bcd + displayorder_value->data_offset) % sizeof(char16_t) != 0)
/* BCD is multi-boot. */
return NULL;
/* Keys are stored as ASCII in registry hives if the data fits (and GUIDS always should). */
- CHAR16 *order_guid_utf16 = (CHAR16 *) (bcd + displayorder_value->data_offset);
+ char16_t *order_guid_utf16 = (char16_t *) (bcd + displayorder_value->data_offset);
for (UINTN i = 0; i < sizeof(order_guid) - 2; i++) {
- CHAR16 c = order_guid_utf16[i];
+ char16_t c = order_guid_utf16[i];
switch (c) {
case '-':
case '{':
return NULL;
if (description_value->data_type != REG_SZ ||
- description_value->data_size < sizeof(CHAR16) ||
- description_value->data_size % sizeof(CHAR16) != 0 ||
- (UINTN)(bcd + description_value->data_offset) % sizeof(CHAR16))
+ description_value->data_size < sizeof(char16_t) ||
+ description_value->data_size % sizeof(char16_t) != 0 ||
+ (UINTN)(bcd + description_value->data_offset) % sizeof(char16_t))
return NULL;
/* The data should already be NUL-terminated. */
- CHAR16 *title = (CHAR16 *) (bcd + description_value->data_offset);
- title[description_value->data_size / sizeof(CHAR16) - 1] = '\0';
+ char16_t *title = (char16_t *) (bcd + description_value->data_offset);
+ title[description_value->data_size / sizeof(char16_t) - 1] = '\0';
return title;
}
#pragma once
#include <efi.h>
+#include <uchar.h>
-CHAR16 *get_bcd_title(uint8_t *bcd, UINTN bcd_len);
+char16_t *get_bcd_title(uint8_t *bcd, UINTN bcd_len);
};
typedef struct {
- CHAR16 *id; /* The unique identifier for this entry (typically the filename of the file defining the entry) */
- CHAR16 *title_show; /* The string to actually display (this is made unique before showing) */
- CHAR16 *title; /* The raw (human readable) title string of the entry (not necessarily unique) */
- CHAR16 *sort_key; /* The string to use as primary sort key, usually ID= from os-release, possibly suffixed */
- CHAR16 *version; /* The raw (human readable) version string of the entry */
- CHAR16 *machine_id;
+ char16_t *id; /* The unique identifier for this entry (typically the filename of the file defining the entry) */
+ char16_t *title_show; /* The string to actually display (this is made unique before showing) */
+ char16_t *title; /* The raw (human readable) title string of the entry (not necessarily unique) */
+ char16_t *sort_key; /* The string to use as primary sort key, usually ID= from os-release, possibly suffixed */
+ char16_t *version; /* The raw (human readable) version string of the entry */
+ char16_t *machine_id;
EFI_HANDLE *device;
enum loader_type type;
- CHAR16 *loader;
- CHAR16 *devicetree;
- CHAR16 *options;
- CHAR16 **initrd;
- CHAR16 key;
+ char16_t *loader;
+ char16_t *devicetree;
+ char16_t *options;
+ char16_t **initrd;
+ char16_t key;
EFI_STATUS (*call)(void);
int tries_done;
int tries_left;
- CHAR16 *path;
- CHAR16 *current_name;
- CHAR16 *next_name;
+ char16_t *path;
+ char16_t *current_name;
+ char16_t *next_name;
} ConfigEntry;
typedef struct {
uint32_t timeout_sec; /* Actual timeout used (efi_main() override > efivar > config). */
uint32_t timeout_sec_config;
uint32_t timeout_sec_efivar;
- CHAR16 *entry_default_config;
- CHAR16 *entry_default_efivar;
- CHAR16 *entry_oneshot;
- CHAR16 *entry_saved;
+ char16_t *entry_default_config;
+ char16_t *entry_default_efivar;
+ char16_t *entry_oneshot;
+ char16_t *entry_saved;
BOOLEAN editor;
BOOLEAN auto_entries;
BOOLEAN auto_firmware;
}
static BOOLEAN line_edit(
- CHAR16 **line_in,
+ char16_t **line_in,
UINTN x_max,
UINTN y_pos) {
- _cleanup_freepool_ CHAR16 *line = NULL, *print = NULL;
+ _cleanup_free_ char16_t *line = NULL, *print = NULL;
UINTN size, len, first = 0, cursor = 0, clear = 0;
assert(line_in);
len = strlen16(*line_in);
size = len + 1024;
- line = xnew(CHAR16, size);
- print = xnew(CHAR16, x_max + 1);
+ line = xnew(char16_t, size);
+ print = xnew(char16_t, x_max + 1);
strcpy16(line, strempty(*line_in));
for (;;) {
UINTN cursor_color = TEXT_ATTR_SWAP(COLOR_EDIT);
j = MIN(len - first, x_max);
- memcpy(print, line + first, j * sizeof(CHAR16));
+ memcpy(print, line + first, j * sizeof(char16_t));
while (clear > 0 && j < x_max) {
clear--;
print[j++] = ' ';
}
}
-static UINTN entry_lookup_key(Config *config, UINTN start, CHAR16 key) {
+static UINTN entry_lookup_key(Config *config, UINTN start, char16_t key) {
assert(config);
if (key == 0)
return IDX_INVALID;
}
-static CHAR16 *update_timeout_efivar(uint32_t *t, BOOLEAN inc) {
+static char16_t *update_timeout_efivar(uint32_t *t, BOOLEAN inc) {
assert(t);
switch (*t) {
if (cache < 0)
/* Basic unicode box drawing support is mandated by the spec, but it does
* not hurt to make sure it works. */
- cache = ST->ConOut->TestString(ST->ConOut, (CHAR16 *) L"─") == EFI_SUCCESS;
+ cache = ST->ConOut->TestString(ST->ConOut, (char16_t *) L"─") == EFI_SUCCESS;
return cache;
}
-static void ps_string(const CHAR16 *fmt, const void *value) {
+static void ps_string(const char16_t *fmt, const void *value) {
assert(fmt);
if (value)
Print(fmt, value);
}
-static void ps_bool(const CHAR16 *fmt, BOOLEAN value) {
+static void ps_bool(const char16_t *fmt, BOOLEAN value) {
assert(fmt);
Print(fmt, yes_no(value));
}
!IN_SET(key, KEYPRESS(0, SCAN_ESC, 0), KEYPRESS(0, 0, 'q'), KEYPRESS(0, 0, 'Q'));
}
-static void print_status(Config *config, CHAR16 *loaded_image_path) {
+static void print_status(Config *config, char16_t *loaded_image_path) {
UINTN x_max, y_max;
uint32_t screen_width = 0, screen_height = 0;
SecureBootMode secure;
- _cleanup_freepool_ CHAR16 *device_part_uuid = NULL;
+ _cleanup_free_ char16_t *device_part_uuid = NULL;
assert(config);
assert(loaded_image_path);
static BOOLEAN menu_run(
Config *config,
ConfigEntry **chosen_entry,
- CHAR16 *loaded_image_path) {
+ char16_t *loaded_image_path) {
assert(config);
assert(chosen_entry);
BOOLEAN refresh = TRUE, highlight = FALSE;
UINTN x_start = 0, y_start = 0, y_status = 0;
UINTN x_max, y_max;
- _cleanup_(strv_freep) CHAR16 **lines = NULL;
- _cleanup_freepool_ CHAR16 *clearline = NULL, *separator = NULL, *status = NULL;
+ _cleanup_(strv_freep) char16_t **lines = NULL;
+ _cleanup_free_ char16_t *clearline = NULL, *separator = NULL, *status = NULL;
uint32_t timeout_efivar_saved = config->timeout_sec_efivar;
uint32_t timeout_remain = config->timeout_sec == TIMEOUT_MENU_FORCE ? 0 : config->timeout_sec;
BOOLEAN exit = FALSE, run = TRUE, firmware_setup = FALSE;
separator = mfree(separator);
/* menu entries title lines */
- lines = xnew(CHAR16*, config->entry_count + 1);
+ lines = xnew(char16_t *, config->entry_count + 1);
for (UINTN i = 0; i < config->entry_count; i++) {
UINTN j, padding;
- lines[i] = xnew(CHAR16, line_width + 1);
+ lines[i] = xnew(char16_t, line_width + 1);
padding = (line_width - MIN(strlen16(config->entries[i]->title_show), line_width)) / 2;
for (j = 0; j < padding; j++)
}
lines[config->entry_count] = NULL;
- clearline = xnew(CHAR16, x_max + 1);
- separator = xnew(CHAR16, x_max + 1);
+ clearline = xnew(char16_t, x_max + 1);
+ separator = xnew(char16_t, x_max + 1);
for (UINTN i = 0; i < x_max; i++) {
clearline[i] = ' ';
separator[i] = unicode_supported() ? L'─' : L'-';
(i == idx_highlight) ? COLOR_HIGHLIGHT : COLOR_ENTRY,
lines[i]);
if (i == config->idx_default_efivar)
- print_at(x_start, y_start + i - idx_first,
+ print_at(x_start,
+ y_start + i - idx_first,
(i == idx_highlight) ? COLOR_HIGHLIGHT : COLOR_ENTRY,
- (CHAR16*) (unicode_supported() ? L" ►" : L"=>"));
+ unicode_supported() ? L" ►" : L"=>");
}
refresh = FALSE;
} else if (highlight) {
print_at(x_start, y_start + idx_highlight_prev - idx_first, COLOR_ENTRY, lines[idx_highlight_prev]);
print_at(x_start, y_start + idx_highlight - idx_first, COLOR_HIGHLIGHT, lines[idx_highlight]);
if (idx_highlight_prev == config->idx_default_efivar)
- print_at(x_start , y_start + idx_highlight_prev - idx_first, COLOR_ENTRY, (CHAR16*) (unicode_supported() ? L" ►" : L"=>"));
+ print_at(x_start,
+ y_start + idx_highlight_prev - idx_first,
+ COLOR_ENTRY,
+ unicode_supported() ? L" ►" : L"=>");
if (idx_highlight == config->idx_default_efivar)
- print_at(x_start, y_start + idx_highlight - idx_first, COLOR_HIGHLIGHT, (CHAR16*) (unicode_supported() ? L" ►" : L"=>"));
+ print_at(x_start,
+ y_start + idx_highlight - idx_first,
+ COLOR_HIGHLIGHT,
+ unicode_supported() ? L" ►" : L"=>");
highlight = FALSE;
}
static void config_entry_parse_tries(
ConfigEntry *entry,
- const CHAR16 *path,
- const CHAR16 *file,
- const CHAR16 *suffix) {
+ const char16_t *path,
+ const char16_t *file,
+ const char16_t *suffix) {
assert(entry);
assert(path);
}
static void config_entry_bump_counters(ConfigEntry *entry, EFI_FILE *root_dir) {
- _cleanup_freepool_ CHAR16* old_path = NULL, *new_path = NULL;
+ _cleanup_free_ char16_t* old_path = NULL, *new_path = NULL;
_cleanup_(file_closep) EFI_FILE *handle = NULL;
_cleanup_freepool_ EFI_FILE_INFO *file_info = NULL;
UINTN file_info_size;
Config *config,
EFI_HANDLE *device,
EFI_FILE *root_dir,
- const CHAR16 *path,
- const CHAR16 *file,
+ const char16_t *path,
+ const char16_t *file,
CHAR8 *content,
- const CHAR16 *loaded_image_path) {
+ const char16_t *loaded_image_path) {
_cleanup_(config_entry_freep) ConfigEntry *entry = NULL;
CHAR8 *line;
}
if (streq8((char *) key, "options")) {
- _cleanup_freepool_ CHAR16 *new = NULL;
+ _cleanup_free_ char16_t *new = NULL;
new = xstra_to_str(value);
if (entry->options) {
- CHAR16 *s;
-
- s = xpool_print(L"%s %s", entry->options, new);
+ char16_t *s = xpool_print(L"%s %s", entry->options, new);
free(entry->options);
entry->options = s;
} else
Config *config,
EFI_HANDLE *device,
EFI_FILE *root_dir,
- const CHAR16 *loaded_image_path) {
+ const char16_t *loaded_image_path) {
_cleanup_(file_closep) EFI_FILE *entries_dir = NULL;
_cleanup_freepool_ EFI_FILE_INFO *f = NULL;
return CMP(a->tries_done, b->tries_done);
}
-static UINTN config_entry_find(Config *config, const CHAR16 *pattern) {
+static UINTN config_entry_find(Config *config, const char16_t *pattern) {
assert(config);
/* We expect pattern and entry IDs to be already case folded. */
if (!config->entries[i]->version)
continue;
- _cleanup_freepool_ CHAR16 *t = config->entries[i]->title_show;
+ _cleanup_free_ char16_t *t = config->entries[i]->title_show;
config->entries[i]->title_show = xpool_print(L"%s (%s)", t, config->entries[i]->version);
}
if (!config->entries[i]->machine_id)
continue;
- _cleanup_freepool_ CHAR16 *t = config->entries[i]->title_show;
+ _cleanup_free_ char16_t *t = config->entries[i]->title_show;
config->entries[i]->title_show = xpool_print(
L"%s (%.*s)",
t,
if (unique[i])
continue;
- _cleanup_freepool_ CHAR16 *t = config->entries[i]->title_show;
+ _cleanup_free_ char16_t *t = config->entries[i]->title_show;
config->entries[i]->title_show = xpool_print(L"%s (%s)", t, config->entries[i]->id);
}
}
-static BOOLEAN is_sd_boot(EFI_FILE *root_dir, const CHAR16 *loader_path) {
+static BOOLEAN is_sd_boot(EFI_FILE *root_dir, const char16_t *loader_path) {
EFI_STATUS err;
const CHAR8 *sections[] = {
(CHAR8 *)".sdmagic",
Config *config,
EFI_HANDLE *device,
EFI_FILE *root_dir,
- const CHAR16 *loaded_image_path,
- const CHAR16 *id,
- CHAR16 key,
- const CHAR16 *title,
- const CHAR16 *loader) {
+ const char16_t *loaded_image_path,
+ const char16_t *id,
+ char16_t key,
+ const char16_t *title,
+ const char16_t *loader) {
assert(config);
assert(device);
/* check existence */
_cleanup_(file_closep) EFI_FILE *handle = NULL;
- EFI_STATUS err = root_dir->Open(root_dir, &handle, (CHAR16*) loader, EFI_FILE_MODE_READ, 0ULL);
+ EFI_STATUS err = root_dir->Open(root_dir, &handle, (char16_t *) loader, EFI_FILE_MODE_READ, 0ULL);
if (err != EFI_SUCCESS)
return NULL;
for (UINTN i = 0; i < boot_order_size / sizeof(uint16_t); i++) {
_cleanup_freepool_ CHAR8 *buf = NULL;
- CHAR16 name[sizeof(L"Boot0000")];
+ char16_t name[sizeof(L"Boot0000")];
UINTN buf_size;
SPrint(name, sizeof(name), L"Boot%04x", (uint32_t) boot_order[i]);
/* Boot#### are EFI_LOAD_OPTION. But we really are only interested
* for the description, which is at this offset. */
UINTN offset = sizeof(uint32_t) + sizeof(uint16_t);
- if (buf_size < offset + sizeof(CHAR16))
+ if (buf_size < offset + sizeof(char16_t))
continue;
- if (streq16((CHAR16 *) (buf + offset), L"Windows Boot Manager")) {
+ if (streq16((char16_t *) (buf + offset), L"Windows Boot Manager")) {
err = efivar_set_raw(
EFI_GLOBAL_GUID,
L"BootNext",
static void config_entry_add_windows(Config *config, EFI_HANDLE *device, EFI_FILE *root_dir) {
#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
_cleanup_freepool_ CHAR8 *bcd = NULL;
- CHAR16 *title = NULL;
+ char16_t *title = NULL;
EFI_STATUS err;
UINTN len;
NULL,
};
- _cleanup_freepool_ CHAR16 *os_pretty_name = NULL, *os_image_id = NULL, *os_name = NULL, *os_id = NULL,
+ _cleanup_free_ char16_t *os_pretty_name = NULL, *os_image_id = NULL, *os_name = NULL, *os_id = NULL,
*os_image_version = NULL, *os_version = NULL, *os_version_id = NULL, *os_build_id = NULL;
- const CHAR16 *good_name, *good_version, *good_sort_key;
+ const char16_t *good_name, *good_version, *good_sort_key;
_cleanup_freepool_ CHAR8 *content = NULL;
UINTN offs[_SECTION_MAX] = {};
UINTN szs[_SECTION_MAX] = {};
static EFI_STATUS initrd_prepare(
EFI_FILE *root,
const ConfigEntry *entry,
- CHAR16 **ret_options,
+ char16_t **ret_options,
void **ret_initrd,
UINTN *ret_initrd_size) {
/* Add initrd= to options for older kernels that do not support LINUX_INITRD_MEDIA. Should be dropped
* if linux_x86.c is dropped. */
- _cleanup_freepool_ CHAR16 *options = NULL;
+ _cleanup_free_ char16_t *options = NULL;
EFI_STATUS err;
UINTN size = 0;
_cleanup_freepool_ uint8_t *initrd = NULL;
STRV_FOREACH(i, entry->initrd) {
- _cleanup_freepool_ CHAR16 *o = options;
+ _cleanup_free_ char16_t *o = options;
if (o)
options = xpool_print(L"%s initrd=%s", o, *i);
else
}
if (entry->options) {
- _cleanup_freepool_ CHAR16 *o = options;
+ _cleanup_free_ char16_t *o = options;
options = xpool_print(L"%s %s", o, entry->options);
}
UINTN initrd_size = 0;
_cleanup_freepool_ void *initrd = NULL;
- _cleanup_freepool_ CHAR16 *options_initrd = NULL;
+ _cleanup_free_ char16_t *options_initrd = NULL;
err = initrd_prepare(image_root, entry, &options_initrd, &initrd, &initrd_size);
if (err != EFI_SUCCESS)
return log_error_status_stall(err, L"Error preparing initrd: %r", err);
if (err != EFI_SUCCESS)
return log_error_status_stall(err, L"Error getting LoadedImageProtocol handle: %r", err);
- CHAR16 *options = options_initrd ?: entry->options;
+ char16_t *options = options_initrd ?: entry->options;
if (options) {
loaded_image->LoadOptions = options;
loaded_image->LoadOptionsSize = strsize16(options);
static void export_variables(
EFI_LOADED_IMAGE *loaded_image,
- const CHAR16 *loaded_image_path,
+ const char16_t *loaded_image_path,
uint64_t init_usec) {
static const uint64_t loader_features =
EFI_LOADER_FEATURE_LOAD_DRIVER |
0;
- _cleanup_freepool_ CHAR16 *infostr = NULL, *typestr = NULL;
- CHAR16 uuid[37];
+ _cleanup_free_ char16_t *infostr = NULL, *typestr = NULL;
+ char16_t uuid[37];
assert(loaded_image);
assert(loaded_image_path);
static void config_load_all_entries(
Config *config,
EFI_LOADED_IMAGE *loaded_image,
- const CHAR16 *loaded_image_path,
+ const char16_t *loaded_image_path,
EFI_FILE *root_dir) {
assert(config);
EFI_LOADED_IMAGE *loaded_image;
_cleanup_(file_closep) EFI_FILE *root_dir = NULL;
_cleanup_(config_free) Config config = {};
- CHAR16 *loaded_image_path;
+ char16_t *loaded_image_path;
EFI_STATUS err;
uint64_t init_usec;
BOOLEAN menu = FALSE;
};
#define KEYPRESS(keys, scan, uni) ((((uint64_t)keys) << 32) | (((uint64_t)scan) << 16) | (uni))
-#define KEYCHAR(k) ((CHAR16)(k))
+#define KEYCHAR(k) ((char16_t)(k))
#define CHAR_CTRL(c) ((c) - 'a' + 1)
enum {
return p + 8;
}
-static CHAR8* mangle_filename(CHAR8 *p, const CHAR16 *f) {
+static CHAR8* mangle_filename(CHAR8 *p, const char16_t *f) {
CHAR8* w;
assert(p);
}
static EFI_STATUS pack_cpio_one(
- const CHAR16 *fname,
+ const char16_t *fname,
const void *contents,
UINTN contents_size,
const CHAR8 *target_dir_prefix,
EFI_STATUS pack_cpio(
EFI_LOADED_IMAGE *loaded_image,
- const CHAR16 *dropin_dir,
- const CHAR16 *match_suffix,
+ const char16_t *dropin_dir,
+ const char16_t *match_suffix,
const CHAR8 *target_dir_prefix,
uint32_t dir_mode,
uint32_t access_mode,
const uint32_t tpm_pcr[],
UINTN n_tpm_pcr,
- const CHAR16 *tpm_description,
+ const char16_t *tpm_description,
void **ret_buffer,
UINTN *ret_buffer_size) {
_cleanup_(file_closep) EFI_FILE *root = NULL, *extra_dir = NULL;
UINTN dirent_size = 0, buffer_size = 0, n_items = 0, n_allocated = 0;
- _cleanup_freepool_ CHAR16 *rel_dropin_dir = NULL;
+ _cleanup_free_ char16_t *rel_dropin_dir = NULL;
_cleanup_freepool_ EFI_FILE_INFO *dirent = NULL;
- _cleanup_(strv_freep) CHAR16 **items = NULL;
+ _cleanup_(strv_freep) char16_t **items = NULL;
_cleanup_freepool_ void *buffer = NULL;
uint32_t inode = 1; /* inode counter, so that each item gets a new inode */
EFI_STATUS err;
return log_error_status_stall(err, L"Failed to open extra directory of loaded image: %r", err);
for (;;) {
- _cleanup_freepool_ CHAR16 *d = NULL;
+ _cleanup_free_ char16_t *d = NULL;
err = readdir_harder(extra_dir, &dirent, &dirent_size);
if (err != EFI_SUCCESS)
#pragma once
#include <efi.h>
+#include <uchar.h>
EFI_STATUS pack_cpio(
EFI_LOADED_IMAGE *loaded_image,
- const CHAR16 *dropin_dir,
- const CHAR16 *match_suffix,
+ const char16_t *dropin_dir,
+ const char16_t *match_suffix,
const CHAR8 *target_dir_prefix,
uint32_t dir_mode,
uint32_t access_mode,
const uint32_t tpm_pcr[],
UINTN n_tpm_pcr,
- const CHAR16 *tpm_description,
+ const char16_t *tpm_description,
void **ret_buffer,
UINTN *ret_buffer_size);
return err;
}
-EFI_STATUS devicetree_install(struct devicetree_state *state, EFI_FILE *root_dir, CHAR16 *name) {
+EFI_STATUS devicetree_install(struct devicetree_state *state, EFI_FILE *root_dir, char16_t *name) {
_cleanup_(file_closep) EFI_FILE *handle = NULL;
_cleanup_freepool_ EFI_FILE_INFO *info = NULL;
UINTN len;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include <efi.h>
+#include <uchar.h>
+
struct devicetree_state {
EFI_PHYSICAL_ADDRESS addr;
UINTN pages;
void *orig;
};
-EFI_STATUS devicetree_install(struct devicetree_state *state, EFI_FILE *root_dir, CHAR16 *name);
+EFI_STATUS devicetree_install(struct devicetree_state *state, EFI_FILE *root_dir, char16_t *name);
EFI_STATUS devicetree_install_from_memory(
struct devicetree_state *state, const VOID *dtb_buffer, UINTN dtb_length);
void devicetree_cleanup(struct devicetree_state *state);
#include "disk.h"
#include "util.h"
-EFI_STATUS disk_get_part_uuid(EFI_HANDLE *handle, CHAR16 uuid[static 37]) {
+EFI_STATUS disk_get_part_uuid(EFI_HANDLE *handle, char16_t uuid[static 37]) {
EFI_STATUS err;
EFI_DEVICE_PATH *dp;
#pragma once
#include <efi.h>
+#include <uchar.h>
-EFI_STATUS disk_get_part_uuid(EFI_HANDLE *handle, CHAR16 uuid[static 37]);
+EFI_STATUS disk_get_part_uuid(EFI_HANDLE *handle, char16_t uuid[static 37]);
static EFI_STATUS load_one_driver(
EFI_HANDLE parent_image,
EFI_LOADED_IMAGE *loaded_image,
- const CHAR16 *fname) {
+ const char16_t *fname) {
_cleanup_(unload_imagep) EFI_HANDLE image = NULL;
_cleanup_freepool_ EFI_DEVICE_PATH *path = NULL;
- _cleanup_freepool_ CHAR16 *spath = NULL;
+ _cleanup_free_ char16_t *spath = NULL;
EFI_STATUS err;
assert(parent_image);
uint32_t pcrindex,
EFI_PHYSICAL_ADDRESS buffer,
UINTN buffer_size,
- const CHAR16 *description) {
+ const char16_t *description) {
_cleanup_freepool_ TCG_PCR_EVENT *tcg_event = NULL;
EFI_PHYSICAL_ADDRESS event_log_last;
uint32_t pcrindex,
EFI_PHYSICAL_ADDRESS buffer,
uint64_t buffer_size,
- const CHAR16 *description) {
+ const char16_t *description) {
_cleanup_freepool_ EFI_TCG2_EVENT *tcg_event = NULL;
UINTN desc_len;
return tcg2_interface_check() || tcg1_interface_check();
}
-EFI_STATUS tpm_log_event(uint32_t pcrindex, EFI_PHYSICAL_ADDRESS buffer, UINTN buffer_size, const CHAR16 *description) {
+EFI_STATUS tpm_log_event(uint32_t pcrindex, EFI_PHYSICAL_ADDRESS buffer, UINTN buffer_size, const char16_t *description) {
EFI_TCG *tpm1;
EFI_TCG2 *tpm2;
return EFI_SUCCESS;
}
-EFI_STATUS tpm_log_load_options(const CHAR16 *load_options) {
+EFI_STATUS tpm_log_load_options(const char16_t *load_options) {
EFI_STATUS err;
/* Measures a load options string into the TPM2, i.e. the kernel command line */
#pragma once
#include <efi.h>
+#include <uchar.h>
/* This TPM PCR is where we extend the kernel command line and any passed credentials here. */
#define TPM_PCR_INDEX_KERNEL_PARAMETERS 12U
#if ENABLE_TPM
BOOLEAN tpm_present(void);
-EFI_STATUS tpm_log_event(uint32_t pcrindex, EFI_PHYSICAL_ADDRESS buffer, UINTN buffer_size, const CHAR16 *description);
-EFI_STATUS tpm_log_load_options(const CHAR16 *cmdline);
+EFI_STATUS tpm_log_event(uint32_t pcrindex, EFI_PHYSICAL_ADDRESS buffer, UINTN buffer_size, const char16_t *description);
+EFI_STATUS tpm_log_load_options(const char16_t *cmdline);
#else
return FALSE;
}
-static inline EFI_STATUS tpm_log_event(uint32_t pcrindex, EFI_PHYSICAL_ADDRESS buffer, UINTN buffer_size, const CHAR16 *description) {
+static inline EFI_STATUS tpm_log_event(uint32_t pcrindex, EFI_PHYSICAL_ADDRESS buffer, UINTN buffer_size, const char16_t *description) {
return EFI_SUCCESS;
}
-static inline EFI_STATUS tpm_log_load_options(const CHAR16 *cmdline) {
+static inline EFI_STATUS tpm_log_load_options(const char16_t *cmdline) {
return EFI_SUCCESS;
}
EFI_STATUS pe_file_locate_sections(
EFI_FILE *dir,
- const CHAR16 *path,
+ const char16_t *path,
const CHAR8 **sections,
UINTN *offsets,
UINTN *sizes) {
assert(offsets);
assert(sizes);
- err = dir->Open(dir, &handle, (CHAR16*)path, EFI_FILE_MODE_READ, 0ULL);
+ err = dir->Open(dir, &handle, (char16_t *) path, EFI_FILE_MODE_READ, 0ULL);
if (err != EFI_SUCCESS)
return err;
#pragma once
#include <efidef.h>
+#include <uchar.h>
EFI_STATUS pe_memory_locate_sections(
const CHAR8 *base,
EFI_STATUS pe_file_locate_sections(
EFI_FILE *dir,
- const CHAR16 *path,
+ const char16_t *path,
const CHAR8 **sections,
UINTN *offsets,
UINTN *sizes);
if (mode != RANDOM_SEED_ALWAYS && err != EFI_SUCCESS)
return err;
- err = root_dir->Open(root_dir, &handle, (CHAR16*) L"\\loader\\random-seed", EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0ULL);
+ err = root_dir->Open(
+ root_dir,
+ &handle,
+ (char16_t *) L"\\loader\\random-seed",
+ EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE,
+ 0);
if (err != EFI_SUCCESS) {
if (err != EFI_NOT_FOUND && err != EFI_WRITE_PROTECTED)
log_error_stall(L"Failed to open random seed file: %r", err);
#include <efi.h>
#include <errno.h>
+#include <uchar.h>
typedef enum RandomSeedMode {
RANDOM_SEED_OFF,
_RANDOM_SEED_MODE_INVALID = -EINVAL,
} RandomSeedMode;
-static const CHAR16 * const random_seed_modes_table[_RANDOM_SEED_MODE_MAX] = {
+static const char16_t * const random_seed_modes_table[_RANDOM_SEED_MODE_MAX] = {
[RANDOM_SEED_OFF] = L"off",
[RANDOM_SEED_WITH_SYSTEM_TOKEN] = L"with-system-token",
[RANDOM_SEED_ALWAYS] = L"always",
static EFIAPI EFI_STATUS security_policy_authentication (const EFI_SECURITY_PROTOCOL *this, uint32_t authentication_status,
const EFI_DEVICE_PATH_PROTOCOL *device_path_const) {
EFI_STATUS err;
- _cleanup_freepool_ CHAR16 *dev_path_str = NULL;
+ _cleanup_free_ char16_t *dev_path_str = NULL;
EFI_HANDLE h;
_cleanup_freepool_ CHAR8 *file_buffer = NULL;
UINTN file_size;
}
static void export_variables(EFI_LOADED_IMAGE *loaded_image) {
- CHAR16 uuid[37];
+ char16_t uuid[37];
assert(loaded_image);
* is non-NULL explicitly.) */
if (efivar_get_raw(LOADER_GUID, L"LoaderImageIdentifier", NULL, NULL) != EFI_SUCCESS &&
loaded_image->FilePath) {
- _cleanup_freepool_ CHAR16 *s = NULL;
+ _cleanup_free_ char16_t *s = NULL;
s = DevicePathToStr(loaded_image->FilePath);
if (s)
/* if LoaderFirmwareInfo is not set, let's set it */
if (efivar_get_raw(LOADER_GUID, L"LoaderFirmwareInfo", NULL, NULL) != EFI_SUCCESS) {
- _cleanup_freepool_ CHAR16 *s = NULL;
+ _cleanup_free_ char16_t *s = NULL;
s = xpool_print(L"%s %u.%02u", ST->FirmwareVendor, ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff);
efivar_set(LOADER_GUID, L"LoaderFirmwareInfo", s, 0);
}
/* ditto for LoaderFirmwareType */
if (efivar_get_raw(LOADER_GUID, L"LoaderFirmwareType", NULL, NULL) != EFI_SUCCESS) {
- _cleanup_freepool_ CHAR16 *s = NULL;
+ _cleanup_free_ char16_t *s = NULL;
s = xpool_print(L"UEFI %u.%02u", ST->Hdr.Revision >> 16, ST->Hdr.Revision & 0xffff);
efivar_set(LOADER_GUID, L"LoaderFirmwareType", s, 0);
}
/* if we are not in secure boot mode, or none was provided, accept a custom command line and replace the built-in one */
if ((!secure_boot_enabled() || cmdline_len == 0) && loaded_image->LoadOptionsSize > 0 &&
- *(CHAR16 *) loaded_image->LoadOptions > 0x1F) {
- cmdline_len = (loaded_image->LoadOptionsSize / sizeof(CHAR16)) * sizeof(CHAR8);
+ *(char16_t *) loaded_image->LoadOptions > 0x1F) {
+ cmdline_len = (loaded_image->LoadOptionsSize / sizeof(char16_t)) * sizeof(CHAR8);
cmdline = cmdline_owned = xmalloc(cmdline_len);
for (UINTN i = 0; i < cmdline_len; i++)
- cmdline[i] = ((CHAR16 *) loaded_image->LoadOptions)[i];
+ cmdline[i] = ((char16_t *) loaded_image->LoadOptions)[i];
/* Let's measure the passed kernel command line into the TPM. Note that this possibly
* duplicates what we already did in the boot menu, if that was already used. However, since
return EFI_INVALID_PARAMETER;
}
-EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, const CHAR16 *name, const void *buf, UINTN size, uint32_t flags) {
+EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, const char16_t *name, const void *buf, UINTN size, uint32_t flags) {
assert(vendor);
assert(name);
assert(buf || size == 0);
flags |= EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
- return RT->SetVariable((CHAR16 *) name, (EFI_GUID *) vendor, flags, size, (void *) buf);
+ return RT->SetVariable((char16_t *) name, (EFI_GUID *) vendor, flags, size, (void *) buf);
}
-EFI_STATUS efivar_set(const EFI_GUID *vendor, const CHAR16 *name, const CHAR16 *value, uint32_t flags) {
+EFI_STATUS efivar_set(const EFI_GUID *vendor, const char16_t *name, const char16_t *value, uint32_t flags) {
assert(vendor);
assert(name);
return efivar_set_raw(vendor, name, value, value ? strsize16(value) : 0, flags);
}
-EFI_STATUS efivar_set_uint_string(const EFI_GUID *vendor, const CHAR16 *name, UINTN i, uint32_t flags) {
- CHAR16 str[32];
+EFI_STATUS efivar_set_uint_string(const EFI_GUID *vendor, const char16_t *name, UINTN i, uint32_t flags) {
+ char16_t str[32];
assert(vendor);
assert(name);
return efivar_set(vendor, name, str, flags);
}
-EFI_STATUS efivar_set_uint32_le(const EFI_GUID *vendor, const CHAR16 *name, uint32_t value, uint32_t flags) {
+EFI_STATUS efivar_set_uint32_le(const EFI_GUID *vendor, const char16_t *name, uint32_t value, uint32_t flags) {
uint8_t buf[4];
assert(vendor);
return efivar_set_raw(vendor, name, buf, sizeof(buf), flags);
}
-EFI_STATUS efivar_set_uint64_le(const EFI_GUID *vendor, const CHAR16 *name, uint64_t value, uint32_t flags) {
+EFI_STATUS efivar_set_uint64_le(const EFI_GUID *vendor, const char16_t *name, uint64_t value, uint32_t flags) {
uint8_t buf[8];
assert(vendor);
return efivar_set_raw(vendor, name, buf, sizeof(buf), flags);
}
-EFI_STATUS efivar_get(const EFI_GUID *vendor, const CHAR16 *name, CHAR16 **value) {
- _cleanup_freepool_ CHAR16 *buf = NULL;
+EFI_STATUS efivar_get(const EFI_GUID *vendor, const char16_t *name, char16_t **value) {
+ _cleanup_free_ char16_t *buf = NULL;
EFI_STATUS err;
- CHAR16 *val;
+ char16_t *val;
UINTN size;
assert(vendor);
return err;
/* Make sure there are no incomplete characters in the buffer */
- if ((size % sizeof(CHAR16)) != 0)
+ if ((size % sizeof(char16_t)) != 0)
return EFI_INVALID_PARAMETER;
if (!value)
return EFI_SUCCESS;
/* Return buffer directly if it happens to be NUL terminated already */
- if (size >= sizeof(CHAR16) && buf[size / sizeof(CHAR16) - 1] == 0) {
+ if (size >= sizeof(char16_t) && buf[size / sizeof(char16_t) - 1] == 0) {
*value = TAKE_PTR(buf);
return EFI_SUCCESS;
}
/* Make sure a terminating NUL is available at the end */
- val = xmalloc(size + sizeof(CHAR16));
+ val = xmalloc(size + sizeof(char16_t));
memcpy(val, buf, size);
- val[size / sizeof(CHAR16) - 1] = 0; /* NUL terminate */
+ val[size / sizeof(char16_t) - 1] = 0; /* NUL terminate */
*value = val;
return EFI_SUCCESS;
}
-EFI_STATUS efivar_get_uint_string(const EFI_GUID *vendor, const CHAR16 *name, UINTN *i) {
- _cleanup_freepool_ CHAR16 *val = NULL;
+EFI_STATUS efivar_get_uint_string(const EFI_GUID *vendor, const char16_t *name, UINTN *i) {
+ _cleanup_free_ char16_t *val = NULL;
EFI_STATUS err;
uint64_t u;
return EFI_SUCCESS;
}
-EFI_STATUS efivar_get_uint32_le(const EFI_GUID *vendor, const CHAR16 *name, uint32_t *ret) {
+EFI_STATUS efivar_get_uint32_le(const EFI_GUID *vendor, const char16_t *name, uint32_t *ret) {
_cleanup_freepool_ CHAR8 *buf = NULL;
UINTN size;
EFI_STATUS err;
return err;
}
-EFI_STATUS efivar_get_uint64_le(const EFI_GUID *vendor, const CHAR16 *name, uint64_t *ret) {
+EFI_STATUS efivar_get_uint64_le(const EFI_GUID *vendor, const char16_t *name, uint64_t *ret) {
_cleanup_freepool_ CHAR8 *buf = NULL;
UINTN size;
EFI_STATUS err;
return err;
}
-EFI_STATUS efivar_get_raw(const EFI_GUID *vendor, const CHAR16 *name, CHAR8 **buffer, UINTN *size) {
+EFI_STATUS efivar_get_raw(const EFI_GUID *vendor, const char16_t *name, CHAR8 **buffer, UINTN *size) {
_cleanup_freepool_ CHAR8 *buf = NULL;
UINTN l;
EFI_STATUS err;
assert(vendor);
assert(name);
- l = sizeof(CHAR16 *) * EFI_MAXIMUM_VARIABLE_SIZE;
+ l = sizeof(char16_t *) * EFI_MAXIMUM_VARIABLE_SIZE;
buf = xmalloc(l);
- err = RT->GetVariable((CHAR16 *) name, (EFI_GUID *) vendor, NULL, &l, buf);
+ err = RT->GetVariable((char16_t *) name, (EFI_GUID *) vendor, NULL, &l, buf);
if (err == EFI_SUCCESS) {
if (buffer)
return err;
}
-EFI_STATUS efivar_get_boolean_u8(const EFI_GUID *vendor, const CHAR16 *name, BOOLEAN *ret) {
+EFI_STATUS efivar_get_boolean_u8(const EFI_GUID *vendor, const char16_t *name, BOOLEAN *ret) {
_cleanup_freepool_ CHAR8 *b = NULL;
UINTN size;
EFI_STATUS err;
return err;
}
-void efivar_set_time_usec(const EFI_GUID *vendor, const CHAR16 *name, uint64_t usec) {
- CHAR16 str[32];
+void efivar_set_time_usec(const EFI_GUID *vendor, const char16_t *name, uint64_t usec) {
+ char16_t str[32];
assert(vendor);
assert(name);
efivar_set(vendor, name, str, 0);
}
-static INTN utf8_to_16(const CHAR8 *stra, CHAR16 *c) {
- CHAR16 unichar;
+static INTN utf8_to_16(const CHAR8 *stra, char16_t *c) {
+ char16_t unichar;
UINTN len;
assert(stra);
return len;
}
-CHAR16 *xstra_to_str(const CHAR8 *stra) {
+char16_t *xstra_to_str(const CHAR8 *stra) {
UINTN strlen;
UINTN len;
UINTN i;
- CHAR16 *str;
+ char16_t *str;
assert(stra);
len = strlen8((const char *) stra);
- str = xnew(CHAR16, len + 1);
+ str = xnew(char16_t, len + 1);
strlen = 0;
i = 0;
return str;
}
-CHAR16 *xstra_to_path(const CHAR8 *stra) {
- CHAR16 *str;
+char16_t *xstra_to_path(const CHAR8 *stra) {
+ char16_t *str;
UINTN strlen;
UINTN len;
UINTN i;
assert(stra);
len = strlen8((const char *) stra);
- str = xnew(CHAR16, len + 2);
+ str = xnew(char16_t, len + 2);
str[0] = '\\';
strlen = 1;
return str;
}
-EFI_STATUS file_read(EFI_FILE *dir, const CHAR16 *name, UINTN off, UINTN size, CHAR8 **ret, UINTN *ret_size) {
+EFI_STATUS file_read(EFI_FILE *dir, const char16_t *name, UINTN off, UINTN size, CHAR8 **ret, UINTN *ret_size) {
_cleanup_(file_closep) EFI_FILE *handle = NULL;
_cleanup_freepool_ CHAR8 *buf = NULL;
EFI_STATUS err;
assert(name);
assert(ret);
- err = dir->Open(dir, &handle, (CHAR16*) name, EFI_FILE_MODE_READ, 0ULL);
+ err = dir->Open(dir, &handle, (char16_t*) name, EFI_FILE_MODE_READ, 0ULL);
if (err != EFI_SUCCESS)
return err;
return err;
}
- /* Allocate some extra bytes to guarantee the result is NUL-terminated for CHAR8 and CHAR16 strings. */
- UINTN extra = size % sizeof(CHAR16) + sizeof(CHAR16);
+ /* Allocate some extra bytes to guarantee the result is NUL-terminated for CHAR8 and char16_t strings. */
+ UINTN extra = size % sizeof(char16_t) + sizeof(char16_t);
buf = xmalloc(size + extra);
err = handle->Read(handle, &size, buf);
return err;
}
-void log_error_stall(const CHAR16 *fmt, ...) {
+void log_error_stall(const char16_t *fmt, ...) {
va_list args;
assert(fmt);
return EFI_OUT_OF_RESOURCES;
}
-void print_at(UINTN x, UINTN y, UINTN attr, const CHAR16 *str) {
+void print_at(UINTN x, UINTN y, UINTN attr, const char16_t *str) {
assert(str);
ST->ConOut->SetCursorPosition(ST->ConOut, x, y);
ST->ConOut->SetAttribute(ST->ConOut, attr);
- ST->ConOut->OutputString(ST->ConOut, (CHAR16*)str);
+ ST->ConOut->OutputString(ST->ConOut, (char16_t *) str);
}
void clear_screen(UINTN attr) {
* the buffer was too small. Therefore, start with a buffer that should handle FAT32 max
* file name length.
* As a side effect, most readdir_harder() calls will now be slightly faster. */
- sz = sizeof(EFI_FILE_INFO) + 256 * sizeof(CHAR16);
+ sz = sizeof(EFI_FILE_INFO) + 256 * sizeof(char16_t);
*buffer = xmalloc(sz);
*buffer_size = sz;
} else
return EFI_SUCCESS;
}
-BOOLEAN is_ascii(const CHAR16 *f) {
+BOOLEAN is_ascii(const char16_t *f) {
if (!f)
return FALSE;
return TRUE;
}
-CHAR16 **strv_free(CHAR16 **v) {
+char16_t **strv_free(char16_t **v) {
if (!v)
return NULL;
- for (CHAR16 **i = v; *i; i++)
+ for (char16_t **i = v; *i; i++)
free(*i);
free(v);
EFI_STATUS open_directory(
EFI_FILE *root,
- const CHAR16 *path,
+ const char16_t *path,
EFI_FILE **ret) {
_cleanup_(file_closep) EFI_FILE *dir = NULL;
/* Opens a file, and then verifies it is actually a directory */
- err = root->Open(root, &dir, (CHAR16*) path, EFI_FILE_MODE_READ, 0ULL);
+ err = root->Open(root, &dir, (char16_t *) path, EFI_FILE_MODE_READ, 0);
if (err != EFI_SUCCESS)
return err;
return r;
}
-#define xpool_print(fmt, ...) ((CHAR16 *) ASSERT_SE_PTR(PoolPrint((fmt), ##__VA_ARGS__)))
+#define xpool_print(fmt, ...) ((char16_t *) ASSERT_SE_PTR(PoolPrint((fmt), ##__VA_ARGS__)))
#define xnew(type, n) ((type *) xmalloc_multiply(sizeof(type), (n)))
EFI_STATUS parse_boolean(const CHAR8 *v, BOOLEAN *b);
-EFI_STATUS efivar_set(const EFI_GUID *vendor, const CHAR16 *name, const CHAR16 *value, uint32_t flags);
-EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, const CHAR16 *name, const void *buf, UINTN size, uint32_t flags);
-EFI_STATUS efivar_set_uint_string(const EFI_GUID *vendor, const CHAR16 *name, UINTN i, uint32_t flags);
-EFI_STATUS efivar_set_uint32_le(const EFI_GUID *vendor, const CHAR16 *NAME, uint32_t value, uint32_t flags);
-EFI_STATUS efivar_set_uint64_le(const EFI_GUID *vendor, const CHAR16 *name, uint64_t value, uint32_t flags);
-void efivar_set_time_usec(const EFI_GUID *vendor, const CHAR16 *name, uint64_t usec);
+EFI_STATUS efivar_set(const EFI_GUID *vendor, const char16_t *name, const char16_t *value, uint32_t flags);
+EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, const char16_t *name, const void *buf, UINTN size, uint32_t flags);
+EFI_STATUS efivar_set_uint_string(const EFI_GUID *vendor, const char16_t *name, UINTN i, uint32_t flags);
+EFI_STATUS efivar_set_uint32_le(const EFI_GUID *vendor, const char16_t *NAME, uint32_t value, uint32_t flags);
+EFI_STATUS efivar_set_uint64_le(const EFI_GUID *vendor, const char16_t *name, uint64_t value, uint32_t flags);
+void efivar_set_time_usec(const EFI_GUID *vendor, const char16_t *name, uint64_t usec);
-EFI_STATUS efivar_get(const EFI_GUID *vendor, const CHAR16 *name, CHAR16 **value);
-EFI_STATUS efivar_get_raw(const EFI_GUID *vendor, const CHAR16 *name, CHAR8 **buffer, UINTN *size);
-EFI_STATUS efivar_get_uint_string(const EFI_GUID *vendor, const CHAR16 *name, UINTN *i);
-EFI_STATUS efivar_get_uint32_le(const EFI_GUID *vendor, const CHAR16 *name, uint32_t *ret);
-EFI_STATUS efivar_get_uint64_le(const EFI_GUID *vendor, const CHAR16 *name, uint64_t *ret);
-EFI_STATUS efivar_get_boolean_u8(const EFI_GUID *vendor, const CHAR16 *name, BOOLEAN *ret);
+EFI_STATUS efivar_get(const EFI_GUID *vendor, const char16_t *name, char16_t **value);
+EFI_STATUS efivar_get_raw(const EFI_GUID *vendor, const char16_t *name, CHAR8 **buffer, UINTN *size);
+EFI_STATUS efivar_get_uint_string(const EFI_GUID *vendor, const char16_t *name, UINTN *i);
+EFI_STATUS efivar_get_uint32_le(const EFI_GUID *vendor, const char16_t *name, uint32_t *ret);
+EFI_STATUS efivar_get_uint64_le(const EFI_GUID *vendor, const char16_t *name, uint64_t *ret);
+EFI_STATUS efivar_get_boolean_u8(const EFI_GUID *vendor, const char16_t *name, BOOLEAN *ret);
-CHAR16 *xstra_to_path(const CHAR8 *stra);
-CHAR16 *xstra_to_str(const CHAR8 *stra);
+char16_t *xstra_to_path(const CHAR8 *stra);
+char16_t *xstra_to_str(const CHAR8 *stra);
-EFI_STATUS file_read(EFI_FILE *dir, const CHAR16 *name, UINTN off, UINTN size, CHAR8 **content, UINTN *content_size);
+EFI_STATUS file_read(EFI_FILE *dir, const char16_t *name, UINTN off, UINTN size, CHAR8 **content, UINTN *content_size);
static inline void file_closep(EFI_FILE **handle) {
if (!*handle)
&(const EFI_GUID) { 0x4a67b082, 0x0a4c, 0x41cf, { 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f } }
#define EFI_GLOBAL_GUID &(const EFI_GUID) EFI_GLOBAL_VARIABLE
-void log_error_stall(const CHAR16 *fmt, ...);
+void log_error_stall(const char16_t *fmt, ...);
EFI_STATUS log_oom(void);
/* This works just like log_error_errno() from userspace, but requires you
err; \
})
-void print_at(UINTN x, UINTN y, UINTN attr, const CHAR16 *str);
+void print_at(UINTN x, UINTN y, UINTN attr, const char16_t *str);
void clear_screen(UINTN attr);
typedef int (*compare_pointer_func_t)(const void *a, const void *b);
EFI_STATUS readdir_harder(EFI_FILE *handle, EFI_FILE_INFO **buffer, UINTN *buffer_size);
-BOOLEAN is_ascii(const CHAR16 *f);
+BOOLEAN is_ascii(const char16_t *f);
-CHAR16 **strv_free(CHAR16 **l);
+char16_t **strv_free(char16_t **l);
-static inline void strv_freep(CHAR16 ***p) {
+static inline void strv_freep(char16_t ***p) {
strv_free(*p);
}
-EFI_STATUS open_directory(EFI_FILE *root_dir, const CHAR16 *path, EFI_FILE **ret);
+EFI_STATUS open_directory(EFI_FILE *root_dir, const char16_t *path, EFI_FILE **ret);
/* Conversion between EFI_PHYSICAL_ADDRESS and pointers is not obvious. The former is always 64bit, even on
* 32bit archs. And gcc complains if we cast a pointer to an integer of a different size. Hence let's do the