some of the licenses, he/she can delete appropriate line.
Warning, if you delete all lines, you are not allowed to
distribute source code and/or binaries utilizing code.
-
+
See files COPYING and README for details.
*******************************************************************/
#define KVPB_DESC_RO 0x08
#define KVPB_DESC_CHUNKWO 0x10
#define KVPB_DESC_ALIGN4 0x40
-#define KVPB_DESC_FLASH 0x80
+#define KVPB_DESC_FLASH 0x80
#ifdef KVPB_MINIMALIZED
typedef uint16_t kvpb_sum_t;
* %KVPB_DESC_USE2ND - data will be read from the second copy because first one is damaged;
* %KVPB_DESC_VALID - at least one region is valid;
* %KVPB_DESC_RO - because of some problems, only read access is allowed
- * %KVPB_DESC_CHUNKWO - chunk can be written only once between erase operations
+ * %KVPB_DESC_CHUNKWO - chunk can be written only once between erase operations
* %KVPB_DESC_ALIGN4 - data has to be aligned to four bytes
* %KVPB_DESC_FLASH - flash memory is used for data storage
* @psum1: Pointer to the control checksum of the first data region
} kvpb_block_t;
-#define kvpb_region_base(block,regidx) (((block)->base+(regidx*(block)->size)))
+#define kvpb_region_base(block,regidx) \
+ ((((KVPB_DPTRTYPE uint8_t *)(block)->base)+(regidx*(block)->size)))
#ifndef KVPB_MINIMALIZED
#ifndef kvpb_chunk_size
#define kvpb_chunk_size(store) ((store)->chunk_size<4?4:(store)->chunk_size)
#endif /*kvpb_chunk_size*/
#define kvpb_chunk_size_mask(store) (kvpb_chunk_size(store)-1)
-
+
/**
* kvpb_chunk_align - Round up KVPB size to minimal store chunk size multiple
* @store: Pointer to the KVPB access information/state structure
/**
* kvpb_psum_align - Round up KVPB size to minimal store chunk size multiple
* @store: Pointer to the KVPB access information/state structure
- * @psum: Pointer to proposed location of next check sum location
+ * @psum: Pointer to proposed location of next check sum location
*
* Return Value: Pointer to next check sum location rounded down to next slot.
* File: keyvalpb.h
*/
static inline int kvpb_block_erase(struct kvpb_block *store, void *base,int size)
{
- return store->erase(store, base,size) ;
+ return store->erase(store, base,size) ;
}
/**
((KVPB_DPTRTYPE kvpb_sum_t*)((unsigned)(x)&~kvpb_chunk_size_mask(store)))
#define kvpb_psum_valid_loc(store,x) \
((kvpb_sum_t*)((char*)(x)+0*kvpb_chunk_size(store)))
+#ifndef kvpb_block_copy
#define kvpb_block_erase(store, base, size) flash_erase(base, size)
- #define kvpb_block_copy(store, des, src, len) flash_copy(des, src, len)
- #define kvpb_block_flush(store) flash_flush()
+ #define kvpb_block_copy(store, des, src, len) flash_copy(des, src, len)
+ #define kvpb_block_flush(store) flash_flush()
+
/* forward declarations for external procedures */
int flash_erase(void *base,int size);
int flash_copy(void *des,const void *src,int len);
#ifndef flash_flush
int flash_flush(void);
#endif /* flash_flush */
+#endif /* kvpb_block_copy */
#endif /* KVPB_MINIMALIZED */
/**
#define kvpb_find(block, keyid, mode, key) __kvpb_find(keyid, mode, key)
#define kvpb_get_key(block, keyid, size, buf) __kvpb_get_key(keyid, size, buf)
#define kvpb_set_key(block, keyid, size, buf) __kvpb_set_key(keyid, size, buf)
-#define kvpb_err_keys(block,keyid) kvpb_set_key(block,keyid,0,NULL)
+#define kvpb_err_keys(block,keyid) kvpb_set_key(block,keyid,0,NULL)
#define kvpb_check(block, mode) __kvpb_check(mode)
#define kvpb_compact_region(block, mode, keyid) __kvpb_compact_region(mode, keyid)
#define kvpb_get_cfk(block,mode,size) __kvpb_get_cfk(mode,size)
*/
#define kvpb_for_each(root, key,mode) \
for(key=kvpb_first(root,mode);key;\
- key=kvpb_next(key))
+ key=kvpb_next(root, key))
/**
* kvpb_for_each - Iterate over all key value pairs matching given key ID