WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
bcache.h 文件参考
#include "pthread.h"
#include "linux/rbtree.h"
#include "los_list.h"
#include "los_atomic.h"
#include "inode/inode.h"
bcache.h 的引用(Include)关系图:

浏览源代码.

结构体

struct  OsBcacheBlock
 
struct  tagOsBcache
 

宏定义

#define ALIGN_LIB(x)   (((x) + (HALARC_ALIGNMENT - 1)) & ~(HALARC_ALIGNMENT - 1))
 
#define ALIGN_DISP(x)   (HALARC_ALIGNMENT - ((x) & (HALARC_ALIGNMENT - 1)))
 
#define UNSIGNED_INTEGER_BITS   32
 
#define UNINT_MAX_SHIFT_BITS   31
 
#define UNINT_LOG2_SHIFT   5
 
#define EVEN_JUDGED   2
 
#define PERCENTAGE   100
 

类型定义

typedef INT32(* BcacheReadFun) (struct inode *, UINT8 *, UINT32, UINT64)
 
typedef INT32(* BcacheWriteFun) (struct inode *, const UINT8 *, UINT32, UINT64)
 
typedef INT32(* BcacheWritevFun) (struct inode *, const struct iovec *, UINT32, UINT64)
 
typedef struct tagOsBcache OsBcache
 

函数

INT32 BlockCacheRead (OsBcache *bc, UINT8 *buf, UINT32 *len, UINT64 num, UINT64 pos)
 
INT32 BlockCacheWrite (OsBcache *bc, const UINT8 *buf, UINT32 *len, UINT64 num, UINT64 pos)
 
INT32 BlockCacheSync (OsBcache *bc)
 
OsBcacheBlockCacheInit (struct inode *devNode, UINT32 sectorSize, UINT32 sectorPerBlock, UINT32 blockNum, UINT64 blockCount)
 
VOID BlockCacheDeinit (OsBcache *bc)
 
INT32 OsSdSync (INT32 id)
 

宏定义说明

◆ ALIGN_DISP

#define ALIGN_DISP (   x)    (HALARC_ALIGNMENT - ((x) & (HALARC_ALIGNMENT - 1)))

◆ ALIGN_LIB

#define ALIGN_LIB (   x)    (((x) + (HALARC_ALIGNMENT - 1)) & ~(HALARC_ALIGNMENT - 1))

◆ EVEN_JUDGED

#define EVEN_JUDGED   2

◆ PERCENTAGE

#define PERCENTAGE   100

◆ UNINT_LOG2_SHIFT

#define UNINT_LOG2_SHIFT   5

◆ UNINT_MAX_SHIFT_BITS

#define UNINT_MAX_SHIFT_BITS   31

◆ UNSIGNED_INTEGER_BITS

#define UNSIGNED_INTEGER_BITS   32

类型定义说明

◆ BcacheReadFun

typedef INT32(* BcacheReadFun) (struct inode *, UINT8 *, UINT32, UINT64)

◆ BcacheWriteFun

typedef INT32(* BcacheWriteFun) (struct inode *, const UINT8 *, UINT32, UINT64)

◆ BcacheWritevFun

typedef INT32(* BcacheWritevFun) (struct inode *, const struct iovec *, UINT32, UINT64)

◆ OsBcache

typedef struct tagOsBcache OsBcache

函数说明

◆ BlockCacheDeinit()

VOID BlockCacheDeinit ( OsBcache bc)
Description:
The BlockCacheDeinit() function shall deinit the bcache and release resources.
参数
bc[IN] block cache instance
注意
  • None.
返回值
VOIDNone.
Dependency:
自从
Huawei LiteOS V200R001C00

◆ BlockCacheInit()

OsBcache * BlockCacheInit ( struct inode *  devNode,
UINT32  sectorSize,
UINT32  sectorPerBlock,
UINT32  blockNum,
UINT64  blockCount 
)
Description:
The BlockCacheInit() function shall alloc memory for bcache and init it.
参数
devNode[IN] dev node instance
sectorSize[IN] size of a sector
sectorPerBlock[IN] sector count per block in bcache
blockNum[IN] block number of bcache
blockCount[IN] block count of the disk
注意
  • None.
返回值
OsBcache* init succeded
NULLinit failed
Dependency:
自从
Huawei LiteOS V200R001C00

◆ BlockCacheRead()

INT32 BlockCacheRead ( OsBcache bc,
UINT8 buf,
UINT32 len,
UINT64  num,
UINT64  pos 
)
Description:
The BlockCacheRead() function shall read data from the bcache, and if it doesn't hit, read the data from disk.
参数
bc[IN] block cache instance
buf[OUT] data buffer ptr
len[IN] number of bytes to read
num[IN] starting block number
pos[IN] starting position inside starting block
注意
  • The block number is automatically adjusted if position is greater than block size.
返回值
#0read succeded
INT32read failed
Dependency:
自从
Huawei LiteOS V200R001C00

◆ BlockCacheSync()

INT32 BlockCacheSync ( OsBcache bc)
Description:
The BlockCacheSync() function shall write-back all dirty data in the bcache into the disk.
参数
bc[IN] block cache instance
注意
  • None.
返回值
#0sync succeded
INT32sync failed
Dependency:
自从
Huawei LiteOS V200R001C00

◆ BlockCacheWrite()

INT32 BlockCacheWrite ( OsBcache bc,
const UINT8 buf,
UINT32 len,
UINT64  num,
UINT64  pos 
)
Description:
The BlockCacheWrite() function shall write data to the bcache.
参数
bc[IN] block cache instance
buf[IN] data buffer ptr
len[IN] number of bytes to write
num[IN] starting block number
pos[IN] starting position inside starting block
注意
  • The block number is automatically adjusted if position is greater than block size.
返回值
#0write succeded
INT32write failed
Dependency:
自从
Huawei LiteOS V200R001C00

◆ OsSdSync()

INT32 OsSdSync ( INT32  id)