Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
3854be77
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3854be77
编写于
12月 10, 2008
作者:
D
David Woodhouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MTD] Remove strange u_int32_t types from FTL
Signed-off-by:
N
David Woodhouse
<
David.Woodhouse@intel.com
>
上级
0f07a0be
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
69 addition
and
69 deletion
+69
-69
drivers/mtd/ftl.c
drivers/mtd/ftl.c
+50
-50
include/linux/mtd/ftl.h
include/linux/mtd/ftl.h
+19
-19
未找到文件。
drivers/mtd/ftl.c
浏览文件 @
3854be77
...
...
@@ -109,25 +109,25 @@ module_param(shuffle_freq, int, 0);
/* Each memory region corresponds to a minor device */
typedef
struct
partition_t
{
struct
mtd_blktrans_dev
mbd
;
u
_
int32_t
state
;
u
_
int32_t
*
VirtualBlockMap
;
u
_
int32_t
*
VirtualPageMap
;
u
_
int32_t
FreeTotal
;
uint32_t
state
;
uint32_t
*
VirtualBlockMap
;
uint32_t
*
VirtualPageMap
;
uint32_t
FreeTotal
;
struct
eun_info_t
{
u
_
int32_t
Offset
;
u
_
int32_t
EraseCount
;
u
_
int32_t
Free
;
u
_
int32_t
Deleted
;
uint32_t
Offset
;
uint32_t
EraseCount
;
uint32_t
Free
;
uint32_t
Deleted
;
}
*
EUNInfo
;
struct
xfer_info_t
{
u
_
int32_t
Offset
;
u
_
int32_t
EraseCount
;
u
_
int16_t
state
;
uint32_t
Offset
;
uint32_t
EraseCount
;
uint16_t
state
;
}
*
XferInfo
;
u
_
int16_t
bam_index
;
u
_
int32_t
*
bam_cache
;
u
_
int16_t
DataUnits
;
u
_
int32_t
BlocksPerUnit
;
uint16_t
bam_index
;
uint32_t
*
bam_cache
;
uint16_t
DataUnits
;
uint32_t
BlocksPerUnit
;
erase_unit_header_t
header
;
}
partition_t
;
...
...
@@ -199,8 +199,8 @@ static int scan_header(partition_t *part)
static
int
build_maps
(
partition_t
*
part
)
{
erase_unit_header_t
header
;
u
_
int16_t
xvalid
,
xtrans
,
i
;
u
_int
blocks
,
j
;
uint16_t
xvalid
,
xtrans
,
i
;
u
nsigned
blocks
,
j
;
int
hdr_ok
,
ret
=
-
1
;
ssize_t
retval
;
loff_t
offset
;
...
...
@@ -269,14 +269,14 @@ static int build_maps(partition_t *part)
/* Set up virtual page map */
blocks
=
le32_to_cpu
(
header
.
FormattedSize
)
>>
header
.
BlockSize
;
part
->
VirtualBlockMap
=
vmalloc
(
blocks
*
sizeof
(
u
_
int32_t
));
part
->
VirtualBlockMap
=
vmalloc
(
blocks
*
sizeof
(
uint32_t
));
if
(
!
part
->
VirtualBlockMap
)
goto
out_XferInfo
;
memset
(
part
->
VirtualBlockMap
,
0xff
,
blocks
*
sizeof
(
u
_
int32_t
));
memset
(
part
->
VirtualBlockMap
,
0xff
,
blocks
*
sizeof
(
uint32_t
));
part
->
BlocksPerUnit
=
(
1
<<
header
.
EraseUnitSize
)
>>
header
.
BlockSize
;
part
->
bam_cache
=
kmalloc
(
part
->
BlocksPerUnit
*
sizeof
(
u
_
int32_t
),
part
->
bam_cache
=
kmalloc
(
part
->
BlocksPerUnit
*
sizeof
(
uint32_t
),
GFP_KERNEL
);
if
(
!
part
->
bam_cache
)
goto
out_VirtualBlockMap
;
...
...
@@ -290,7 +290,7 @@ static int build_maps(partition_t *part)
offset
=
part
->
EUNInfo
[
i
].
Offset
+
le32_to_cpu
(
header
.
BAMOffset
);
ret
=
part
->
mbd
.
mtd
->
read
(
part
->
mbd
.
mtd
,
offset
,
part
->
BlocksPerUnit
*
sizeof
(
u
_
int32_t
),
&
retval
,
part
->
BlocksPerUnit
*
sizeof
(
uint32_t
),
&
retval
,
(
unsigned
char
*
)
part
->
bam_cache
);
if
(
ret
)
...
...
@@ -332,7 +332,7 @@ static int build_maps(partition_t *part)
======================================================================*/
static
int
erase_xfer
(
partition_t
*
part
,
u
_
int16_t
xfernum
)
uint16_t
xfernum
)
{
int
ret
;
struct
xfer_info_t
*
xfer
;
...
...
@@ -408,7 +408,7 @@ static int prepare_xfer(partition_t *part, int i)
erase_unit_header_t
header
;
struct
xfer_info_t
*
xfer
;
int
nbam
,
ret
;
u
_
int32_t
ctl
;
uint32_t
ctl
;
ssize_t
retlen
;
loff_t
offset
;
...
...
@@ -430,15 +430,15 @@ static int prepare_xfer(partition_t *part, int i)
}
/* Write the BAM stub */
nbam
=
(
part
->
BlocksPerUnit
*
sizeof
(
u
_
int32_t
)
+
nbam
=
(
part
->
BlocksPerUnit
*
sizeof
(
uint32_t
)
+
le32_to_cpu
(
part
->
header
.
BAMOffset
)
+
SECTOR_SIZE
-
1
)
/
SECTOR_SIZE
;
offset
=
xfer
->
Offset
+
le32_to_cpu
(
part
->
header
.
BAMOffset
);
ctl
=
cpu_to_le32
(
BLOCK_CONTROL
);
for
(
i
=
0
;
i
<
nbam
;
i
++
,
offset
+=
sizeof
(
u
_
int32_t
))
{
for
(
i
=
0
;
i
<
nbam
;
i
++
,
offset
+=
sizeof
(
uint32_t
))
{
ret
=
part
->
mbd
.
mtd
->
write
(
part
->
mbd
.
mtd
,
offset
,
sizeof
(
u
_
int32_t
),
ret
=
part
->
mbd
.
mtd
->
write
(
part
->
mbd
.
mtd
,
offset
,
sizeof
(
uint32_t
),
&
retlen
,
(
u_char
*
)
&
ctl
);
if
(
ret
)
...
...
@@ -461,18 +461,18 @@ static int prepare_xfer(partition_t *part, int i)
======================================================================*/
static
int
copy_erase_unit
(
partition_t
*
part
,
u
_
int16_t
srcunit
,
u
_
int16_t
xferunit
)
static
int
copy_erase_unit
(
partition_t
*
part
,
uint16_t
srcunit
,
uint16_t
xferunit
)
{
u_char
buf
[
SECTOR_SIZE
];
struct
eun_info_t
*
eun
;
struct
xfer_info_t
*
xfer
;
u
_
int32_t
src
,
dest
,
free
,
i
;
u
_
int16_t
unit
;
uint32_t
src
,
dest
,
free
,
i
;
uint16_t
unit
;
int
ret
;
ssize_t
retlen
;
loff_t
offset
;
u
_
int16_t
srcunitswap
=
cpu_to_le16
(
srcunit
);
uint16_t
srcunitswap
=
cpu_to_le16
(
srcunit
);
eun
=
&
part
->
EUNInfo
[
srcunit
];
xfer
=
&
part
->
XferInfo
[
xferunit
];
...
...
@@ -486,7 +486,7 @@ static int copy_erase_unit(partition_t *part, u_int16_t srcunit,
offset
=
eun
->
Offset
+
le32_to_cpu
(
part
->
header
.
BAMOffset
);
ret
=
part
->
mbd
.
mtd
->
read
(
part
->
mbd
.
mtd
,
offset
,
part
->
BlocksPerUnit
*
sizeof
(
u
_
int32_t
),
part
->
BlocksPerUnit
*
sizeof
(
uint32_t
),
&
retlen
,
(
u_char
*
)
(
part
->
bam_cache
));
/* mark the cache bad, in case we get an error later */
...
...
@@ -503,7 +503,7 @@ static int copy_erase_unit(partition_t *part, u_int16_t srcunit,
offset
=
xfer
->
Offset
+
20
;
/* Bad! */
unit
=
cpu_to_le16
(
0x7fff
);
ret
=
part
->
mbd
.
mtd
->
write
(
part
->
mbd
.
mtd
,
offset
,
sizeof
(
u
_
int16_t
),
ret
=
part
->
mbd
.
mtd
->
write
(
part
->
mbd
.
mtd
,
offset
,
sizeof
(
uint16_t
),
&
retlen
,
(
u_char
*
)
&
unit
);
if
(
ret
)
{
...
...
@@ -560,7 +560,7 @@ static int copy_erase_unit(partition_t *part, u_int16_t srcunit,
/* All clear? Then update the LogicalEUN again */
ret
=
part
->
mbd
.
mtd
->
write
(
part
->
mbd
.
mtd
,
xfer
->
Offset
+
20
,
sizeof
(
u
_
int16_t
),
ret
=
part
->
mbd
.
mtd
->
write
(
part
->
mbd
.
mtd
,
xfer
->
Offset
+
20
,
sizeof
(
uint16_t
),
&
retlen
,
(
u_char
*
)
&
srcunitswap
);
if
(
ret
)
{
...
...
@@ -605,8 +605,8 @@ static int copy_erase_unit(partition_t *part, u_int16_t srcunit,
static
int
reclaim_block
(
partition_t
*
part
)
{
u
_
int16_t
i
,
eun
,
xfer
;
u
_
int32_t
best
;
uint16_t
i
,
eun
,
xfer
;
uint32_t
best
;
int
queued
,
ret
;
DEBUG
(
0
,
"ftl_cs: reclaiming space...
\n
"
);
...
...
@@ -723,10 +723,10 @@ static void dump_lists(partition_t *part)
}
#endif
static
u
_
int32_t
find_free
(
partition_t
*
part
)
static
uint32_t
find_free
(
partition_t
*
part
)
{
u
_
int16_t
stop
,
eun
;
u
_
int32_t
blk
;
uint16_t
stop
,
eun
;
uint32_t
blk
;
size_t
retlen
;
int
ret
;
...
...
@@ -749,7 +749,7 @@ static u_int32_t find_free(partition_t *part)
ret
=
part
->
mbd
.
mtd
->
read
(
part
->
mbd
.
mtd
,
part
->
EUNInfo
[
eun
].
Offset
+
le32_to_cpu
(
part
->
header
.
BAMOffset
),
part
->
BlocksPerUnit
*
sizeof
(
u
_
int32_t
),
part
->
BlocksPerUnit
*
sizeof
(
uint32_t
),
&
retlen
,
(
u_char
*
)
(
part
->
bam_cache
));
if
(
ret
)
{
...
...
@@ -786,7 +786,7 @@ static u_int32_t find_free(partition_t *part)
static
int
ftl_read
(
partition_t
*
part
,
caddr_t
buffer
,
u_long
sector
,
u_long
nblocks
)
{
u
_
int32_t
log_addr
,
bsize
;
uint32_t
log_addr
,
bsize
;
u_long
i
;
int
ret
;
size_t
offset
,
retlen
;
...
...
@@ -829,14 +829,14 @@ static int ftl_read(partition_t *part, caddr_t buffer,
======================================================================*/
static
int
set_bam_entry
(
partition_t
*
part
,
u
_
int32_t
log_addr
,
u
_
int32_t
virt_addr
)
static
int
set_bam_entry
(
partition_t
*
part
,
uint32_t
log_addr
,
uint32_t
virt_addr
)
{
u
_
int32_t
bsize
,
blk
,
le_virt_addr
;
uint32_t
bsize
,
blk
,
le_virt_addr
;
#ifdef PSYCHO_DEBUG
u
_
int32_t
old_addr
;
uint32_t
old_addr
;
#endif
u
_
int16_t
eun
;
uint16_t
eun
;
int
ret
;
size_t
retlen
,
offset
;
...
...
@@ -845,11 +845,11 @@ static int set_bam_entry(partition_t *part, u_int32_t log_addr,
bsize
=
1
<<
part
->
header
.
EraseUnitSize
;
eun
=
log_addr
/
bsize
;
blk
=
(
log_addr
%
bsize
)
/
SECTOR_SIZE
;
offset
=
(
part
->
EUNInfo
[
eun
].
Offset
+
blk
*
sizeof
(
u
_
int32_t
)
+
offset
=
(
part
->
EUNInfo
[
eun
].
Offset
+
blk
*
sizeof
(
uint32_t
)
+
le32_to_cpu
(
part
->
header
.
BAMOffset
));
#ifdef PSYCHO_DEBUG
ret
=
part
->
mbd
.
mtd
->
read
(
part
->
mbd
.
mtd
,
offset
,
sizeof
(
u
_
int32_t
),
ret
=
part
->
mbd
.
mtd
->
read
(
part
->
mbd
.
mtd
,
offset
,
sizeof
(
uint32_t
),
&
retlen
,
(
u_char
*
)
&
old_addr
);
if
(
ret
)
{
printk
(
KERN_WARNING
"ftl: Error reading old_addr in set_bam_entry: %d
\n
"
,
ret
);
...
...
@@ -886,7 +886,7 @@ static int set_bam_entry(partition_t *part, u_int32_t log_addr,
#endif
part
->
bam_cache
[
blk
]
=
le_virt_addr
;
}
ret
=
part
->
mbd
.
mtd
->
write
(
part
->
mbd
.
mtd
,
offset
,
sizeof
(
u
_
int32_t
),
ret
=
part
->
mbd
.
mtd
->
write
(
part
->
mbd
.
mtd
,
offset
,
sizeof
(
uint32_t
),
&
retlen
,
(
u_char
*
)
&
le_virt_addr
);
if
(
ret
)
{
...
...
@@ -900,7 +900,7 @@ static int set_bam_entry(partition_t *part, u_int32_t log_addr,
static
int
ftl_write
(
partition_t
*
part
,
caddr_t
buffer
,
u_long
sector
,
u_long
nblocks
)
{
u
_
int32_t
bsize
,
log_addr
,
virt_addr
,
old_addr
,
blk
;
uint32_t
bsize
,
log_addr
,
virt_addr
,
old_addr
,
blk
;
u_long
i
;
int
ret
;
size_t
retlen
,
offset
;
...
...
include/linux/mtd/ftl.h
浏览文件 @
3854be77
...
...
@@ -32,25 +32,25 @@
#define _LINUX_FTL_H
typedef
struct
erase_unit_header_t
{
u
_
int8_t
LinkTargetTuple
[
5
];
u
_
int8_t
DataOrgTuple
[
10
];
u
_
int8_t
NumTransferUnits
;
u
_
int32_t
EraseCount
;
u
_
int16_t
LogicalEUN
;
u
_
int8_t
BlockSize
;
u
_
int8_t
EraseUnitSize
;
u
_
int16_t
FirstPhysicalEUN
;
u
_
int16_t
NumEraseUnits
;
u
_
int32_t
FormattedSize
;
u
_
int32_t
FirstVMAddress
;
u
_
int16_t
NumVMPages
;
u
_
int8_t
Flags
;
u
_
int8_t
Code
;
u
_
int32_t
SerialNumber
;
u
_
int32_t
AltEUHOffset
;
u
_
int32_t
BAMOffset
;
u
_
int8_t
Reserved
[
12
];
u
_
int8_t
EndTuple
[
2
];
uint8_t
LinkTargetTuple
[
5
];
uint8_t
DataOrgTuple
[
10
];
uint8_t
NumTransferUnits
;
uint32_t
EraseCount
;
uint16_t
LogicalEUN
;
uint8_t
BlockSize
;
uint8_t
EraseUnitSize
;
uint16_t
FirstPhysicalEUN
;
uint16_t
NumEraseUnits
;
uint32_t
FormattedSize
;
uint32_t
FirstVMAddress
;
uint16_t
NumVMPages
;
uint8_t
Flags
;
uint8_t
Code
;
uint32_t
SerialNumber
;
uint32_t
AltEUHOffset
;
uint32_t
BAMOffset
;
uint8_t
Reserved
[
12
];
uint8_t
EndTuple
[
2
];
}
erase_unit_header_t
;
/* Flags in erase_unit_header_t */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录