Skip to content

Commit e0b2ea6

Browse files
committed
Make some utility functions and types public
Make read_u16 and read_order available to call outside efibootmgr.c. Make var_entry_t public to be used by other source files. Prepare efibootmgr for JSON output support by making required utility functions and types publicly available to other source files. Signed-off-by: Jose M. Guisado <jguisado@soleta.eu>
1 parent 0a85e9b commit e0b2ea6

2 files changed

Lines changed: 17 additions & 13 deletions

File tree

src/efibootmgr.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
#include <efiboot.h>
5252
#include <inttypes.h>
5353

54-
#include "list.h"
5554
#include "efi.h"
5655
#include "parse_loader_data.h"
5756
#include "efibootmgr.h"
@@ -63,16 +62,6 @@
6362

6463
int verbose;
6564

66-
typedef struct _var_entry {
67-
char *name;
68-
efi_guid_t guid;
69-
uint8_t *data;
70-
size_t data_size;
71-
uint32_t attributes;
72-
uint16_t num;
73-
list_t list;
74-
} var_entry_t;
75-
7665
/* global variables */
7766
static LIST_HEAD(entry_list);
7867
static LIST_HEAD(blk_list);
@@ -348,7 +337,7 @@ make_var(const char *prefix, list_t *var_list)
348337
return NULL;
349338
}
350339

351-
static int
340+
int
352341
read_order(const char *name, var_entry_t **order)
353342
{
354343
int rc;
@@ -548,7 +537,7 @@ remove_from_order(const char *name, uint16_t num)
548537
return rc;
549538
}
550539

551-
static int
540+
int
552541
read_u16(const char *name)
553542
{
554543
efi_guid_t guid = EFI_GLOBAL_GUID;

src/efibootmgr.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
#define EFIBOOTMGR_PATH_ABBREV_NONE 3
3636
#define EFIBOOTMGR_PATH_ABBREV_FILE 4
3737

38+
#include "list.h"
39+
3840
typedef enum {
3941
boot,
4042
driver,
@@ -97,4 +99,17 @@ typedef struct {
9799
uint16_t index;
98100
} efibootmgr_opt_t;
99101

102+
typedef struct _var_entry {
103+
char *name;
104+
efi_guid_t guid;
105+
uint8_t *data;
106+
size_t data_size;
107+
uint32_t attributes;
108+
uint16_t num;
109+
list_t list;
110+
} var_entry_t;
111+
100112
extern efibootmgr_opt_t opts;
113+
114+
int read_u16(const char *name);
115+
int read_order(const char *name, var_entry_t **order);

0 commit comments

Comments
 (0)