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 
12 #include <stdint.h>
13 #include <ipxe/dhcpopts.h>
14 #include <ipxe/settings.h>
15 
16 struct nvs_device;
17 struct refcnt;
18 
19 /**
20  * A block of non-volatile stored options
21  */
22 struct nvo_block {
23  /** Settings block */
25  /** Underlying non-volatile storage device */
26  struct nvs_device *nvs;
27  /** Address within NVS device */
28  unsigned int address;
29  /** Length of options data */
30  size_t len;
31  /** Option-containing data */
32  void *data;
33  /**
34  * Resize non-volatile stored option block
35  *
36  * @v nvo Non-volatile options block
37  * @v len New size
38  * @ret rc Return status code
39  */
40  int ( * resize ) ( struct nvo_block *nvo, size_t len );
41  /** DHCP options block */
43 };
44 
45 /** Name of non-volatile options settings block */
46 #define NVO_SETTINGS_NAME "nvo"
47 
48 extern int nvo_applies ( struct settings *settings,
49  const struct setting *setting );
50 extern void nvo_init ( struct nvo_block *nvo, struct nvs_device *nvs,
51  size_t address, size_t len,
52  int ( * resize ) ( struct nvo_block *nvo, size_t len ),
53  struct refcnt *refcnt );
54 extern int register_nvo ( struct nvo_block *nvo, struct settings *parent );
55 extern void unregister_nvo ( struct nvo_block *nvo );
56 
57 #endif /* _IPXE_NVO_H */
struct dhcp_options dhcpopts
DHCP options block.
Definition: nvo.h:42
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:273
A non-volatile storage device.
Definition: nvs.h:15
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:26
void * data
Option-containing data.
Definition: nvo.h:32
Configuration settings.
int register_nvo(struct nvo_block *nvo, struct settings *parent)
Register non-volatile stored options.
Definition: nvo.c:293
struct nvs_device * nvs
Underlying non-volatile storage device.
Definition: nvo.h:26
A block of non-volatile stored options.
Definition: nvo.h:22
int(* resize)(struct nvo_block *nvo, size_t len)
Resize non-volatile stored option block.
Definition: nvo.h:40
void unregister_nvo(struct nvo_block *nvo)
Unregister non-volatile stored options.
Definition: nvo.c:324
A settings block.
Definition: settings.h:132
DHCP options.
A setting.
Definition: settings.h:23
unsigned int address
Address within NVS device.
Definition: nvo.h:28
uint32_t len
Length.
Definition: ena.h:14
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
size_t len
Length of options data.
Definition: nvo.h:30
A DHCP options block.
Definition: dhcpopts.h:15