Interface: tos.interfaces.BlockWrite

interface BlockWrite

Write interface for the block storage abstraction described in TEP103.

Author:
Jonathan Hui <jhui@archrock.com>
Version:
$Revision: 1.6 $ $Date: 2008/06/04 03:00:25 $

Commands
command error_t erase() Initiate an erase operation.
command error_t sync() Initiate a sync operation to finalize writes to the volume.
command error_t write(storage_addr_t addr, void *buf, storage_len_t len) Initiate a write operation within a given volume.

Events
event void eraseDone(error_t error) Signals the completion of an erase operation.
event void syncDone(error_t error) Signals the completion of a sync operation.
event void writeDone(storage_addr_t addr, void *buf, storage_len_t len, error_t error) Signals the completion of a write operation.

Commands - Details

erase

command error_t erase()

Initiate an erase operation. On SUCCESS, the eraseDone event will signal completion of the operation.

Returns:
  • SUCCESS if the request was accepted,
  • EBUSY if a request is already being processed.

  • sync

    command error_t sync()

    Initiate a sync operation to finalize writes to the volume. A sync operation must be issued to ensure that data is stored in non-volatile storage. On SUCCES, the syncDone event will signal completion of the operation.

    Returns:
  • SUCCESS if the request was accepted,
  • EBUSY if a request is already being processed.

  • write

    command error_t write(storage_addr_t addr, void *buf, storage_len_t len)

    Initiate a write operation within a given volume. On SUCCESS, the writeDone event will signal completion of the operation.

    Between two erases, no byte may be written more than once.

    Parameters:
    addr - starting address to begin write.
    'void* COUNT(len) buf' buffer to write data from.
    len - number of bytes to write.
    Returns:
  • SUCCESS if the request was accepted,
  • EINVAL if the parameters are invalid
  • EBUSY if a request is already being processed.
  • Events - Details

    eraseDone

    event void eraseDone(error_t error)

    Signals the completion of an erase operation.

    Parameters:
    error - SUCCESS if the operation was successful, FAIL if it failed

    syncDone

    event void syncDone(error_t error)

    Signals the completion of a sync operation. All written data is flushed to non-volatile storage after this event.

    Parameters:
    error - SUCCESS if the operation was successful, FAIL if it failed

    writeDone

    event void writeDone(storage_addr_t addr, void *buf, storage_len_t len, error_t error)

    Signals the completion of a write operation. However, data is not guaranteed to survive a power-cycle unless a sync operation has been completed.

    Parameters:
    addr - starting address of write.
    'void* COUNT(len) buf' buffer that written data was read from.
    len - number of bytes written.
    error - SUCCESS if the operation was successful, FAIL if it failed