mirror of
https://github.com/systemd/systemd.git
synced 2024-12-26 03:22:00 +03:00
efi: add 'const' to various util.h API parameters
This commit is contained in:
parent
fe2579dd9c
commit
427ee7ec82
@ -59,7 +59,7 @@ UINT64 time_usec(VOID) {
|
||||
return 1000 * 1000 * ticks / freq;
|
||||
}
|
||||
|
||||
EFI_STATUS parse_boolean(CHAR8 *v, BOOLEAN *b) {
|
||||
EFI_STATUS parse_boolean(const CHAR8 *v, BOOLEAN *b) {
|
||||
if (strcmpa(v, (CHAR8 *)"1") == 0 ||
|
||||
strcmpa(v, (CHAR8 *)"yes") == 0 ||
|
||||
strcmpa(v, (CHAR8 *)"y") == 0 ||
|
||||
@ -79,28 +79,28 @@ EFI_STATUS parse_boolean(CHAR8 *v, BOOLEAN *b) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, CHAR16 *name, VOID *buf, UINTN size, BOOLEAN persistent) {
|
||||
EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, const CHAR16 *name, const VOID *buf, UINTN size, BOOLEAN persistent) {
|
||||
UINT32 flags;
|
||||
|
||||
flags = EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS;
|
||||
if (persistent)
|
||||
flags |= EFI_VARIABLE_NON_VOLATILE;
|
||||
|
||||
return uefi_call_wrapper(RT->SetVariable, 5, name, (EFI_GUID *)vendor, flags, size, buf);
|
||||
return uefi_call_wrapper(RT->SetVariable, 5, (CHAR16*) name, (EFI_GUID *)vendor, flags, size, (VOID*) buf);
|
||||
}
|
||||
|
||||
EFI_STATUS efivar_set(CHAR16 *name, CHAR16 *value, BOOLEAN persistent) {
|
||||
EFI_STATUS efivar_set(const CHAR16 *name, const CHAR16 *value, BOOLEAN persistent) {
|
||||
return efivar_set_raw(&loader_guid, name, value, value ? (StrLen(value)+1) * sizeof(CHAR16) : 0, persistent);
|
||||
}
|
||||
|
||||
EFI_STATUS efivar_set_int(CHAR16 *name, UINTN i, BOOLEAN persistent) {
|
||||
CHAR16 str[32];
|
||||
|
||||
SPrint(str, 32, L"%d", i);
|
||||
SPrint(str, 32, L"%u", i);
|
||||
return efivar_set(name, str, persistent);
|
||||
}
|
||||
|
||||
EFI_STATUS efivar_get(CHAR16 *name, CHAR16 **value) {
|
||||
EFI_STATUS efivar_get(const CHAR16 *name, CHAR16 **value) {
|
||||
_cleanup_freepool_ CHAR8 *buf = NULL;
|
||||
CHAR16 *val;
|
||||
UINTN size;
|
||||
@ -118,7 +118,7 @@ EFI_STATUS efivar_get(CHAR16 *name, CHAR16 **value) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS efivar_get_int(CHAR16 *name, UINTN *i) {
|
||||
EFI_STATUS efivar_get_int(const CHAR16 *name, UINTN *i) {
|
||||
_cleanup_freepool_ CHAR16 *val = NULL;
|
||||
EFI_STATUS err;
|
||||
|
||||
@ -129,7 +129,7 @@ EFI_STATUS efivar_get_int(CHAR16 *name, UINTN *i) {
|
||||
return err;
|
||||
}
|
||||
|
||||
EFI_STATUS efivar_get_raw(const EFI_GUID *vendor, CHAR16 *name, CHAR8 **buffer, UINTN *size) {
|
||||
EFI_STATUS efivar_get_raw(const EFI_GUID *vendor, const CHAR16 *name, CHAR8 **buffer, UINTN *size) {
|
||||
_cleanup_freepool_ CHAR8 *buf = NULL;
|
||||
UINTN l;
|
||||
EFI_STATUS err;
|
||||
@ -139,7 +139,7 @@ EFI_STATUS efivar_get_raw(const EFI_GUID *vendor, CHAR16 *name, CHAR8 **buffer,
|
||||
if (!buf)
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
|
||||
err = uefi_call_wrapper(RT->GetVariable, 5, name, (EFI_GUID *)vendor, NULL, &l, buf);
|
||||
err = uefi_call_wrapper(RT->GetVariable, 5, (CHAR16*) name, (EFI_GUID *)vendor, NULL, &l, buf);
|
||||
if (!EFI_ERROR(err)) {
|
||||
*buffer = buf;
|
||||
buf = NULL;
|
||||
@ -287,12 +287,12 @@ CHAR8 *strchra(CHAR8 *s, CHAR8 c) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EFI_STATUS file_read(EFI_FILE_HANDLE dir, CHAR16 *name, UINTN off, UINTN size, CHAR8 **content, UINTN *content_size) {
|
||||
EFI_STATUS file_read(EFI_FILE_HANDLE dir, const CHAR16 *name, UINTN off, UINTN size, CHAR8 **content, UINTN *content_size) {
|
||||
EFI_FILE_HANDLE handle;
|
||||
_cleanup_freepool_ CHAR8 *buf = NULL;
|
||||
EFI_STATUS err;
|
||||
|
||||
err = uefi_call_wrapper(dir->Open, 5, dir, &handle, name, EFI_FILE_MODE_READ, 0ULL);
|
||||
err = uefi_call_wrapper(dir->Open, 5, dir, &handle, (CHAR16*) name, EFI_FILE_MODE_READ, 0ULL);
|
||||
if (EFI_ERROR(err))
|
||||
return err;
|
||||
|
||||
|
@ -11,26 +11,26 @@ static inline const CHAR16 *yes_no(BOOLEAN b) {
|
||||
return b ? L"yes" : L"no";
|
||||
}
|
||||
|
||||
EFI_STATUS parse_boolean(CHAR8 *v, BOOLEAN *b);
|
||||
EFI_STATUS parse_boolean(const CHAR8 *v, BOOLEAN *b);
|
||||
|
||||
UINT64 ticks_read(void);
|
||||
UINT64 ticks_freq(void);
|
||||
UINT64 time_usec(void);
|
||||
|
||||
EFI_STATUS efivar_set(CHAR16 *name, CHAR16 *value, BOOLEAN persistent);
|
||||
EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, CHAR16 *name, VOID *buf, UINTN size, BOOLEAN persistent);
|
||||
EFI_STATUS efivar_set(const CHAR16 *name, const CHAR16 *value, BOOLEAN persistent);
|
||||
EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, const CHAR16 *name, const VOID *buf, UINTN size, BOOLEAN persistent);
|
||||
EFI_STATUS efivar_set_int(CHAR16 *name, UINTN i, BOOLEAN persistent);
|
||||
VOID efivar_set_time_usec(CHAR16 *name, UINT64 usec);
|
||||
|
||||
EFI_STATUS efivar_get(CHAR16 *name, CHAR16 **value);
|
||||
EFI_STATUS efivar_get_raw(const EFI_GUID *vendor, CHAR16 *name, CHAR8 **buffer, UINTN *size);
|
||||
EFI_STATUS efivar_get_int(CHAR16 *name, UINTN *i);
|
||||
EFI_STATUS efivar_get(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_int(const CHAR16 *name, UINTN *i);
|
||||
|
||||
CHAR8 *strchra(CHAR8 *s, CHAR8 c);
|
||||
CHAR16 *stra_to_path(CHAR8 *stra);
|
||||
CHAR16 *stra_to_str(CHAR8 *stra);
|
||||
|
||||
EFI_STATUS file_read(EFI_FILE_HANDLE dir, CHAR16 *name, UINTN off, UINTN size, CHAR8 **content, UINTN *content_size);
|
||||
EFI_STATUS file_read(EFI_FILE_HANDLE dir, const CHAR16 *name, UINTN off, UINTN size, CHAR8 **content, UINTN *content_size);
|
||||
|
||||
static inline void FreePoolp(void *p) {
|
||||
void *q = *(void**) p;
|
||||
|
Loading…
Reference in New Issue
Block a user