BeRTOS
Data Structures | Functions
KFile interface over KBlock
BeRTOS core functionality

KFile interface over a KBlock. More...

Data Structures

struct  KFileBlock
 KFileBlock context. More...

Functions

void kfileblock_init (KFileBlock *fb, KBlock *blk)
 Init a KFile over KBlock.

Detailed Description

KFile interface over a KBlock.

With this module, you can access a KBlock device with the handy KFile interface. In order to achieve this, the block device must support partial block write.

Error codes returned by kfile_error() are specific of the underlying KBlock implementation.

Make sure you have trimmed the KBlock to avoid overwriting something. Example:

 // init a derived instance of KBlock
 // any will do.
 Flash flash;
 flash_init(&flash, 0);
 kblock_trim(&flash.blk, trim_start, internal_flash.blk.blk_cnt - trim_start);

 // now create and initialize the kfile_block instance
 KFileBlock kfb;
 kfileblock_init(&kfb, &flash.blk);

 // now you can access the Flash in a file like fashion
 kfile_read(&kfb.fd, buf, 20);
Author:
Francesco Sacchi <batt@develer.com>
Daniele Basile <asterix@develer.com>

Function Documentation

void kfileblock_init ( KFileBlock fb,
KBlock blk 
)

Init a KFile over KBlock.

After this you can access your KBlock device with a handy KFile interface.

Note:
The block device must support partial block write in order to support random write access.
Parameters:
fbKFileBlock context.
blkblock device to be accessed with a KFile interface.

Definition at line 116 of file kfile_block.c.