class InMemoryNdm

Defined at line 25 of file ../../src/storage/volume_image/ftl/ftl_test_helper.h

Provides a in memory NDM driver usable for unit testing.

Public Methods

const char * Attach (const ftl::Volume * ftl_volume)

Creates a new volume. Note that multiple volumes are not supported.

|ftl_volume| (if provided) will be notified with the volume details.

Returns an error string, or nullptr on success.

Defined at line 16 of file ../../src/storage/volume_image/ftl/ftl_test_helper.cc

void InMemoryNdm (InMemoryRawNand * raw_nand, uint64_t page_size, uint64_t oob_size, uint32_t max_bad_blocks)

The options in raw_nand should be prepopulated as desired, and optionally

page_data and page_oob. page_size and oob_size should have the

corresponding sizes to match with the sizes used in raw_nand, where

page_size is the size of volume pages and oob_size is the size of the

corresponding out of band data used by the FTL. max_bad_blocks is the

maximum number of bad blocks to support in the ndm, more means a smaller

overall volume as spare blocks at the end of the volume are set aside to

account for this.

Defined at line 35 of file ../../src/storage/volume_image/ftl/ftl_test_helper.h

int NandRead (uint32_t start_page, uint32_t page_count, void * page_buffer, void * oob_buffer)

Reads |page_count| pages starting at |start_page|, placing the results on

|page_buffer| and |oob_buffer|. Either pointer can be nullptr if that

part is not desired.

Returns kNdmOk, kNdmUncorrectableEcc, kNdmFatalError or kNdmUnsafeEcc.

Defined at line 35 of file ../../src/storage/volume_image/ftl/ftl_test_helper.cc

const char * Init ()

Performs driver initialization. Returns an error string, or nullptr on

success.

Defined at line 45 of file ../../src/storage/volume_image/ftl/ftl_test_helper.h

bool Detach ()

Destroy the volume created with Attach(). Returns true on success.

Defined at line 53 of file ../../src/storage/volume_image/ftl/ftl_test_helper.h

int IsBadBlock (uint32_t page_num)

Returns whether the block containing |page_num| was factory-marked as bad.

Returns kTrue, kFalse or kNdmError.

Defined at line 74 of file ../../src/storage/volume_image/ftl/ftl_test_helper.h

int NandWrite (uint32_t start_page, uint32_t page_count, const void * page_buffer, const void * oob_buffer)

Writes |page_count| pages starting at |start_page|, using the data from

|page_buffer| and |oob_buffer|.

Returns kNdmOk, kNdmError or kNdmFatalError. kNdmError triggers marking

the block as bad.

Defined at line 74 of file ../../src/storage/volume_image/ftl/ftl_test_helper.cc

uint32_t PageSize ()

Defined at line 80 of file ../../src/storage/volume_image/ftl/ftl_test_helper.h

uint8_t SpareSize ()

Defined at line 81 of file ../../src/storage/volume_image/ftl/ftl_test_helper.h

int NandErase (uint32_t page_num)

Erases the block containing |page_num|.

Returns kNdmOk or kNdmError. kNdmError triggers marking the block as bad.

Defined at line 99 of file ../../src/storage/volume_image/ftl/ftl_test_helper.cc

bool IsEmptyPage (uint32_t page_num, const uint8_t * data, const uint8_t * spare)

Returns whether a given page is empty or not. |data| and |spare| store

the contents of the page.

Defined at line 110 of file ../../src/storage/volume_image/ftl/ftl_test_helper.cc