aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libefivar/Makefile8
-rw-r--r--lib/libefivar/efivar.c11
-rw-r--r--sys/boot/efi/include/efichar.h (renamed from lib/libefivar/libefivar_int.h)10
-rw-r--r--sys/boot/efi/libefi/efichar.c (renamed from lib/libefivar/libefivar.c)8
4 files changed, 20 insertions, 17 deletions
diff --git a/lib/libefivar/Makefile b/lib/libefivar/Makefile
index c3ad3615e9d6..808087818eb6 100644
--- a/lib/libefivar/Makefile
+++ b/lib/libefivar/Makefile
@@ -26,13 +26,19 @@
.include <src.opts.mk>
+EFIBOOT=${SRCTOP}/sys/boot/efi
+
+.PATH: ${EFIBOOT}/libefi
+
PACKAGE=lib${LIB}
LIB= efivar
-SRCS= efivar.c libefivar.c
+SRCS= efivar.c efichar.c
INCS= efivar.h
SHLIB_MAJOR= 1
MAN= efivar.3
+CFLAGS+= -I${EFIBOOT}/include
+
MLINKS+=efivar.3 efi_set_variables_supported.3 \
efivar.3 efi_del_variable.3 \
efivar.3 efi_get_variable.3 \
diff --git a/lib/libefivar/efivar.c b/lib/libefivar/efivar.c
index ad638a33e4aa..bce4a1449ab2 100644
--- a/lib/libefivar/efivar.c
+++ b/lib/libefivar/efivar.c
@@ -36,8 +36,7 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <string.h>
-#include "efivar.h"
-#include "libefivar_int.h"
+#include "efichar.h"
static int efi_fd = -2;
@@ -174,7 +173,7 @@ efi_get_variable(efi_guid_t guid, const char *name,
return -1;
efi_var_reset(&var);
- rv = libefi_utf8_to_ucs2(name, &var.name, &var.namesize);
+ rv = utf8_to_ucs2(name, &var.name, &var.namesize);
if (rv != 0)
goto errout;
var.vendor = guid;
@@ -237,7 +236,7 @@ again:
*buf = 0;
/* GUID zeroed in var_reset */
} else {
- rv = libefi_utf8_to_ucs2(*name, &var.name, &size);
+ rv = utf8_to_ucs2(*name, &var.name, &size);
if (rv != 0)
goto errout;
var.vendor = **guid;
@@ -261,7 +260,7 @@ again:
if (rv == 0) {
*name = NULL; /* XXX */
var.name[var.namesize / sizeof(efi_char)] = 0; /* EFI doesn't NUL terminate */
- rv = libefi_ucs2_to_utf8(var.name, name);
+ rv = ucs2_to_utf8(var.name, name);
if (rv != 0)
goto errout;
retguid = var.vendor;
@@ -359,7 +358,7 @@ efi_set_variable(efi_guid_t guid, const char *name,
return -1;
efi_var_reset(&var);
- rv = libefi_utf8_to_ucs2(name, &var.name, &var.namesize);
+ rv = utf8_to_ucs2(name, &var.name, &var.namesize);
if (rv != 0)
goto errout;
var.vendor = guid;
diff --git a/lib/libefivar/libefivar_int.h b/sys/boot/efi/include/efichar.h
index 276ab19dcffb..49952e9778a4 100644
--- a/lib/libefivar/libefivar_int.h
+++ b/sys/boot/efi/include/efichar.h
@@ -26,10 +26,10 @@
* $FreeBSD$
*/
-#ifndef _LIBEFI_INT_H_
-#define _LIBEFI_INT_H_
+#ifndef _BOOT_EFI_EFICHAR_H_
+#define _BOOT_EFI_EFICHAR_H_
-int libefi_ucs2_to_utf8(const efi_char *, char **);
-int libefi_utf8_to_ucs2(const char *, efi_char **, size_t *);
+int ucs2_to_utf8(const efi_char *, char **);
+int utf8_to_ucs2(const char *, efi_char **, size_t *);
-#endif /* _LIBEFI_INT_H_ */
+#endif /* _BOOT_EFI_EFICHAR_H_ */
diff --git a/lib/libefivar/libefivar.c b/sys/boot/efi/libefi/efichar.c
index 951c484f5e3a..20022710b932 100644
--- a/lib/libefivar/libefivar.c
+++ b/sys/boot/efi/libefi/efichar.c
@@ -36,9 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/efi.h>
#include <machine/efi.h>
-#include "libefivar_int.h"
-
-#include <stdio.h>
+#include "efichar.h"
/*
* If nm were converted to utf8, what what would strlen
@@ -65,7 +63,7 @@ utf8_len_of_ucs2(const efi_char *nm)
}
int
-libefi_ucs2_to_utf8(const efi_char *nm, char **name)
+ucs2_to_utf8(const efi_char *nm, char **name)
{
size_t len, sz;
efi_char c;
@@ -113,7 +111,7 @@ libefi_ucs2_to_utf8(const efi_char *nm, char **name)
}
int
-libefi_utf8_to_ucs2(const char *name, efi_char **nmp, size_t *len)
+utf8_to_ucs2(const char *name, efi_char **nmp, size_t *len)
{
efi_char *nm;
size_t sz;