Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / nvo.h
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 );
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 */
24         struct settings settings;
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 */
42         struct dhcp_options dhcpopts;
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 */