nvram: Add a get_max_space_size_in_bytes method.

This is useful for the Access-Controlled NVRAM HAL because
implementations may be able to achieve atomic writes if they are able to
limit the maximum space size. This method allows the module to report
that it is imposing such a limit.

BUG=27480753

Change-Id: Ia70f459d7d5fca894e52310ddb2cdcbb51bd8364
This commit is contained in:
Darren Krahn 2016-03-03 14:10:06 -08:00
parent 5f735636de
commit deda044730

View file

@ -31,7 +31,7 @@ __BEGIN_DECLS
/* The version of this module. */
#define NVRAM_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
#define NVRAM_DEVICE_API_VERSION_0_1 HARDWARE_DEVICE_API_VERSION(0, 1)
#define NVRAM_DEVICE_API_VERSION_1_1 HARDWARE_DEVICE_API_VERSION(1, 1)
struct nvram_module {
/**
@ -76,6 +76,17 @@ struct nvram_device {
nvram_result_t (*get_available_size_in_bytes)(
const struct nvram_device* device, uint64_t* available_size);
/**
* Outputs the maximum number of bytes that can be allocated for a single
* space. This will always be at least 32. If an implementation does not
* limit the maximum size it may provide the total size.
*
* device - The nvram_device instance.
* max_space_size - Receives the output. Cannot be NULL.
*/
nvram_result_t (*get_max_space_size_in_bytes)(
const struct nvram_device* device, uint64_t* max_space_size);
/**
* Outputs the maximum total number of spaces that may be allocated.
* This will always be at least 8. Outputs NV_UNLIMITED_SPACES if any