• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _GPXE_NVO_H
2 #define _GPXE_NVO_H
3 
4 /** @file
5  *
6  * Non-volatile stored options
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER );
11 
12 #include <stdint.h>
13 #include <gpxe/dhcpopts.h>
14 #include <gpxe/settings.h>
15 
16 struct nvs_device;
17 struct refcnt;
18 
19 /**
20  * A fragment of a non-volatile storage device used for stored options
21  */
22 struct nvo_fragment {
23 	/** Starting address of fragment within NVS device */
24 	unsigned int address;
25 	/** Length of fragment */
26 	size_t len;
27 };
28 
29 /**
30  * A block of non-volatile stored options
31  */
32 struct nvo_block {
33 	/** Settings block */
34 	struct settings settings;
35 	/** Underlying non-volatile storage device */
36 	struct nvs_device *nvs;
37 	/** List of option-containing fragments
38 	 *
39 	 * The list is terminated by a fragment with a length of zero.
40 	 */
41 	struct nvo_fragment *fragments;
42 	/** Total length of option-containing fragments */
43 	size_t total_len;
44 	/** Option-containing data */
45 	void *data;
46 	/** DHCP options block */
47 	struct dhcp_options dhcpopts;
48 };
49 
50 extern void nvo_init ( struct nvo_block *nvo, struct nvs_device *nvs,
51 		       struct nvo_fragment *fragments, struct refcnt *refcnt );
52 extern int register_nvo ( struct nvo_block *nvo, struct settings *parent );
53 extern void unregister_nvo ( struct nvo_block *nvo );
54 
55 #endif /* _GPXE_NVO_H */
56