iPXE
nvo.h
Go to the documentation of this file.
1 #ifndef _IPXE_NVO_H
2 #define _IPXE_NVO_H
3 
4 /** @file
5  *
6  * Non-volatile stored options
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 FILE_SECBOOT ( PERMITTED );
12 
13 #include <stdint.h>
14 #include <ipxe/dhcpopts.h>
15 #include <ipxe/settings.h>
16 
17 struct nvs_device;
18 struct refcnt;
19 
20 /**
21  * A block of non-volatile stored options
22  */
23 struct nvo_block {
24  /** Settings block */
26  /** Underlying non-volatile storage device */
27  struct nvs_device *nvs;
28  /** Address within NVS device */
29  unsigned int address;
30  /** Length of options data */
31  size_t len;
32  /** Option-containing data */
33  void *data;
34  /**
35  * Resize non-volatile stored option block
36  *
37  * @v nvo Non-volatile options block
38  * @v len New size
39  * @ret rc Return status code
40  */
41  int ( * resize ) ( struct nvo_block *nvo, size_t len );
42  /** DHCP options block */
44 };
45 
46 /** Name of non-volatile options settings block */
47 #define NVO_SETTINGS_NAME "nvo"
48 
49 extern int nvo_applies ( struct settings *settings,
50  const struct setting *setting );
51 extern void nvo_init ( struct nvo_block *nvo, struct nvs_device *nvs,
52  size_t address, size_t len,
53  int ( * resize ) ( struct nvo_block *nvo, size_t len ),
54  struct refcnt *refcnt );
55 extern int register_nvo ( struct nvo_block *nvo, struct settings *parent );
56 extern void unregister_nvo ( struct nvo_block *nvo );
57 
58 #endif /* _IPXE_NVO_H */
struct dhcp_options dhcpopts
DHCP options block.
Definition: nvo.h:43
void nvo_init(struct nvo_block *nvo, struct nvs_device *nvs, size_t address, size_t len, int(*resize)(struct nvo_block *nvo, size_t len), struct refcnt *refcnt)
Initialise non-volatile stored options.
Definition: nvo.c:274
FILE_SECBOOT(PERMITTED)
A non-volatile storage device.
Definition: nvs.h:16
uint64_t address
Base address.
Definition: ena.h:24
int nvo_applies(struct settings *settings, const struct setting *setting)
A reference counter.
Definition: refcnt.h:27
void * data
Option-containing data.
Definition: nvo.h:33
ring len
Length.
Definition: dwmac.h:231
Configuration settings.
int register_nvo(struct nvo_block *nvo, struct settings *parent)
Register non-volatile stored options.
Definition: nvo.c:294
struct nvs_device * nvs
Underlying non-volatile storage device.
Definition: nvo.h:27
A block of non-volatile stored options.
Definition: nvo.h:23
int(* resize)(struct nvo_block *nvo, size_t len)
Resize non-volatile stored option block.
Definition: nvo.h:41
void unregister_nvo(struct nvo_block *nvo)
Unregister non-volatile stored options.
Definition: nvo.c:325
A settings block.
Definition: settings.h:133
DHCP options.
A setting.
Definition: settings.h:24
unsigned int address
Address within NVS device.
Definition: nvo.h:29
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
size_t len
Length of options data.
Definition: nvo.h:31
A DHCP options block.
Definition: dhcpopts.h:16