iPXE
nvo.h
Go to the documentation of this file.
00001 #ifndef _IPXE_NVO_H
00002 #define _IPXE_NVO_H
00003 
00004 /** @file
00005  *
00006  * Non-volatile stored options
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 #include <stdint.h>
00013 #include <ipxe/dhcpopts.h>
00014 #include <ipxe/settings.h>
00015 
00016 struct nvs_device;
00017 struct refcnt;
00018 
00019 /**
00020  * A block of non-volatile stored options
00021  */
00022 struct nvo_block {
00023         /** Settings block */
00024         struct settings settings;
00025         /** Underlying non-volatile storage device */
00026         struct nvs_device *nvs;
00027         /** Address within NVS device */
00028         unsigned int address;
00029         /** Length of options data */
00030         size_t len;
00031         /** Option-containing data */
00032         void *data;
00033         /**
00034          * Resize non-volatile stored option block
00035          *
00036          * @v nvo               Non-volatile options block
00037          * @v len               New size
00038          * @ret rc              Return status code
00039          */
00040         int ( * resize ) ( struct nvo_block *nvo, size_t len );
00041         /** DHCP options block */
00042         struct dhcp_options dhcpopts;
00043 };
00044 
00045 /** Name of non-volatile options settings block */
00046 #define NVO_SETTINGS_NAME "nvo"
00047 
00048 extern int nvo_applies ( struct settings *settings,
00049                          const struct setting *setting );
00050 extern void nvo_init ( struct nvo_block *nvo, struct nvs_device *nvs,
00051                        size_t address, size_t len,
00052                        int ( * resize ) ( struct nvo_block *nvo, size_t len ),
00053                        struct refcnt *refcnt );
00054 extern int register_nvo ( struct nvo_block *nvo, struct settings *parent );
00055 extern void unregister_nvo ( struct nvo_block *nvo );
00056 
00057 #endif /* _IPXE_NVO_H */