You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

nvo.h 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef _IPXE_NVO_H
  2. #define _IPXE_NVO_H
  3. /** @file
  4. *
  5. * Non-volatile stored options
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <stdint.h>
  10. #include <ipxe/dhcpopts.h>
  11. #include <ipxe/settings.h>
  12. struct nvs_device;
  13. struct refcnt;
  14. /**
  15. * A block of non-volatile stored options
  16. */
  17. struct nvo_block {
  18. /** Settings block */
  19. struct settings settings;
  20. /** Underlying non-volatile storage device */
  21. struct nvs_device *nvs;
  22. /** Address within NVS device */
  23. unsigned int address;
  24. /** Length of options data */
  25. size_t len;
  26. /** Option-containing data */
  27. void *data;
  28. /**
  29. * Resize non-volatile stored option block
  30. *
  31. * @v nvo Non-volatile options block
  32. * @v len New size
  33. * @ret rc Return status code
  34. */
  35. int ( * resize ) ( struct nvo_block *nvo, size_t len );
  36. /** DHCP options block */
  37. struct dhcp_options dhcpopts;
  38. };
  39. /** Name of non-volatile options settings block */
  40. #define NVO_SETTINGS_NAME "nvo"
  41. extern int nvo_applies ( struct settings *settings,
  42. const struct setting *setting );
  43. extern void nvo_init ( struct nvo_block *nvo, struct nvs_device *nvs,
  44. size_t address, size_t len,
  45. int ( * resize ) ( struct nvo_block *nvo, size_t len ),
  46. struct refcnt *refcnt );
  47. extern int register_nvo ( struct nvo_block *nvo, struct settings *parent );
  48. extern void unregister_nvo ( struct nvo_block *nvo );
  49. #endif /* _IPXE_NVO_H */