WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
bcache_proc.h
浏览该文件的文档.
1/* ----------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
3 * Description: LiteOS Bcache Proc Headfile
4 * Author: Huawei LiteOS Team
5 * Create: 2021-09-28
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
14 * to endorse or promote products derived from this software without specific prior written
15 * permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * --------------------------------------------------------------------------- */
28#ifndef _BCACHE_PROC_H
29#define _BCACHE_PROC_H
30
31#include "linux/seq_file.h"
32#include "proc_fs.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif /* __cplusplus */
37
38#define BCACHE_PROC_ROOT "fs"
39#define BCACHE_PROC_NAME "bcache_info"
40
41#define BCACHE_STATS_START(start) UINT64 (start) = LOS_CurrNanosec()
42#define BCACHE_STATS_READ_END(bc, sectors, start) UpdateReadStats(bc, sectors, start)
43#define BCACHE_STATS_WRITE_END(bc, sectors, start) UpdateWriteStats(bc, sectors, start)
44
45#ifdef LOSCFG_FS_FAT_CACHE_PROC
46
47struct BcacheInitInfo {
48 const struct inode *dev;
49 UINT32 sectorSize;
50 UINT32 sectorPerBlock;
51 BOOL inUse; /* Init as FALSE */
52};
53
54struct BcacheIoStats {
55 Atomic64 writeSectors;
56 Atomic64 writeCounts;
57 Atomic64 writeCosts; /* in ms */
58
59 Atomic64 readSectors;
60 Atomic64 readCounts;
61 Atomic64 readCosts; /* in ms */
62};
63
64extern UINT32 BcacheProcInit(const struct inode *devNode, const OsBcache *bcache);
65extern VOID BcacheProcDeinit(const OsBcache *bcache);
66extern VOID UpdateReadStats(const OsBcache *bc, UINT64 sectorCount, UINT64 startTime);
67extern VOID UpdateWriteStats(const OsBcache *bc, UINT64 sectorCount, UINT64 startTime);
68
69#else /* !LOSCFG_FS_FAT_CACHE_PROC */
70
71STATIC INLINE UINT32 BcacheProcInit(const struct inode *devNode, OsBcache *bcache)
72{
73 return ENOERR;
74}
75
77STATIC INLINE VOID UpdateReadStats(const OsBcache *bc, UINT64 sectorCount, UINT64 startTime) {}
78STATIC INLINE VOID UpdateWriteStats(const OsBcache *bc, UINT64 sectorCount, UINT64 startTime) {}
79
80#endif /* LOSCFG_FS_FAT_CACHE_PROC */
81
82#ifdef __cplusplus
83}
84#endif /* __cplusplus */
85#endif /* _BCACHE_PROC_H */
STATIC INLINE VOID UpdateReadStats(const OsBcache *bc, UINT64 sectorCount, UINT64 startTime)
Definition bcache_proc.h:77
STATIC INLINE UINT32 BcacheProcInit(const struct inode *devNode, OsBcache *bcache)
Definition bcache_proc.h:71
STATIC INLINE VOID BcacheProcDeinit(const OsBcache *bcache)
Definition bcache_proc.h:76
STATIC INLINE VOID UpdateWriteStats(const OsBcache *bc, UINT64 sectorCount, UINT64 startTime)
Definition bcache_proc.h:78
#define STATIC
Definition common_def.h:57
#define INLINE
Definition common_def.h:65
unsigned long long UINT64
Definition los_typedef.h:72
volatile INT64 Atomic64
Definition los_typedef.h:86
#define VOID
Definition los_typedef.h:88
unsigned int UINT32
Definition los_typedef.h:52
size_t BOOL
Definition los_typedef.h:83
Definition bcache.h:84