Skip to content

Commit

Permalink
Make some utility functions and types public
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
pvxe committed Feb 9, 2024
1 parent 0ca99d4 commit 065f762
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/efibootmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
#include <efiboot.h>
#include <inttypes.h>

#include "list.h"
#include "efi.h"
#include "parse_loader_data.h"
#include "efibootmgr.h"
Expand All @@ -63,16 +62,6 @@

int verbose;

typedef struct _var_entry {
char *name;
efi_guid_t guid;
uint8_t *data;
size_t data_size;
uint32_t attributes;
uint16_t num;
list_t list;
} var_entry_t;

/* global variables */
static LIST_HEAD(entry_list);
static LIST_HEAD(blk_list);
Expand Down Expand Up @@ -348,7 +337,7 @@ make_var(const char *prefix, list_t *var_list)
return NULL;
}

static int
int
read_order(const char *name, var_entry_t **order)
{
int rc;
Expand Down Expand Up @@ -548,7 +537,7 @@ remove_from_order(const char *name, uint16_t num)
return rc;
}

static int
int
read_u16(const char *name)
{
efi_guid_t guid = EFI_GLOBAL_GUID;
Expand Down
15 changes: 15 additions & 0 deletions src/include/efibootmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#define EFIBOOTMGR_PATH_ABBREV_NONE 3
#define EFIBOOTMGR_PATH_ABBREV_FILE 4

#include "list.h"

typedef enum {
boot,
driver,
Expand Down Expand Up @@ -98,6 +100,19 @@ typedef struct {
uint16_t index;
} efibootmgr_opt_t;

typedef struct _var_entry {
char *name;
efi_guid_t guid;
uint8_t *data;
size_t data_size;
uint32_t attributes;
uint16_t num;
list_t list;
} var_entry_t;

extern efibootmgr_opt_t opts;

int read_u16(const char *name);
int read_order(const char *name, var_entry_t **order);

#endif

0 comments on commit 065f762

Please sign in to comment.