Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
3fb38dfa
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3fb38dfa
编写于
4月 02, 2008
作者:
J
Jan Kara
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
udf: Move filling of partition descriptor info into a separate function
Signed-off-by:
N
Jan Kara
<
jack@suse.cz
>
上级
2e0838fd
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
62 addition
and
56 deletion
+62
-56
fs/udf/super.c
fs/udf/super.c
+62
-56
未找到文件。
fs/udf/super.c
浏览文件 @
3fb38dfa
...
...
@@ -1024,41 +1024,14 @@ static struct udf_bitmap *udf_sb_alloc_bitmap(struct super_block *sb, u32 index)
return
bitmap
;
}
static
int
udf_load_partdesc
(
struct
super_block
*
sb
,
sector_t
block
)
static
int
udf_fill_partdesc_info
(
struct
super_block
*
sb
,
struct
partitionDesc
*
p
,
int
p_index
)
{
struct
buffer_head
*
bh
;
struct
partitionHeaderDesc
*
phd
;
struct
partitionDesc
*
p
;
struct
udf_part_map
*
map
;
struct
udf_sb_info
*
sbi
=
UDF_SB
(
sb
);
bool
found
=
false
;
int
i
;
uint16_t
partitionNumber
;
uint16_t
ident
;
int
ret
=
0
;
bh
=
udf_read_tagged
(
sb
,
block
,
block
,
&
ident
);
if
(
!
bh
)
return
1
;
if
(
ident
!=
TAG_IDENT_PD
)
goto
out_bh
;
p
=
(
struct
partitionDesc
*
)
bh
->
b_data
;
partitionNumber
=
le16_to_cpu
(
p
->
partitionNumber
);
for
(
i
=
0
;
i
<
sbi
->
s_partitions
;
i
++
)
{
map
=
&
sbi
->
s_partmaps
[
i
];
udf_debug
(
"Searching map: (%d == %d)
\n
"
,
map
->
s_partition_num
,
partitionNumber
);
found
=
map
->
s_partition_num
==
partitionNumber
;
if
(
found
)
break
;
}
struct
partitionHeaderDesc
*
phd
;
if
(
!
found
)
{
udf_debug
(
"Partition (%d) not found in partition map
\n
"
,
partitionNumber
);
goto
out_bh
;
}
map
=
&
sbi
->
s_partmaps
[
p_index
];
map
->
s_partition_len
=
le32_to_cpu
(
p
->
partitionLength
);
/* blocks */
map
->
s_partition_root
=
le32_to_cpu
(
p
->
partitionStartingLocation
);
...
...
@@ -1073,88 +1046,121 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block)
map
->
s_partition_flags
|=
UDF_PART_FLAG_OVERWRITABLE
;
udf_debug
(
"Partition (%d:%d type %x) starts at physical %d, "
"block length %d
\n
"
,
partitionNumber
,
i
,
"block length %d
\n
"
,
partitionNumber
,
p_index
,
map
->
s_partition_type
,
map
->
s_partition_root
,
map
->
s_partition_len
);
if
(
strcmp
(
p
->
partitionContents
.
ident
,
PD_PARTITION_CONTENTS_NSR02
)
&&
strcmp
(
p
->
partitionContents
.
ident
,
PD_PARTITION_CONTENTS_NSR03
))
goto
out_bh
;
return
0
;
phd
=
(
struct
partitionHeaderDesc
*
)
p
->
partitionContentsUse
;
if
(
phd
->
unallocSpaceTable
.
extLength
)
{
kernel_lb_addr
loc
=
{
.
logicalBlockNum
=
le32_to_cpu
(
phd
->
unallocSpaceTable
.
extPosition
),
.
partitionReferenceNum
=
i
,
.
partitionReferenceNum
=
p_index
,
};
map
->
s_uspace
.
s_table
=
udf_iget
(
sb
,
loc
);
if
(
!
map
->
s_uspace
.
s_table
)
{
udf_debug
(
"cannot load unallocSpaceTable (part %d)
\n
"
,
i
);
ret
=
1
;
goto
out_bh
;
p_index
);
return
1
;
}
map
->
s_partition_flags
|=
UDF_PART_FLAG_UNALLOC_TABLE
;
udf_debug
(
"unallocSpaceTable (part %d) @ %ld
\n
"
,
i
,
map
->
s_uspace
.
s_table
->
i_ino
);
p_index
,
map
->
s_uspace
.
s_table
->
i_ino
);
}
if
(
phd
->
unallocSpaceBitmap
.
extLength
)
{
struct
udf_bitmap
*
bitmap
=
udf_sb_alloc_bitmap
(
sb
,
i
);
if
(
!
bitmap
)
{
ret
=
1
;
goto
out_bh
;
}
struct
udf_bitmap
*
bitmap
=
udf_sb_alloc_bitmap
(
sb
,
p_index
);
if
(
!
bitmap
)
return
1
;
map
->
s_uspace
.
s_bitmap
=
bitmap
;
bitmap
->
s_extLength
=
le32_to_cpu
(
phd
->
unallocSpaceBitmap
.
extLength
);
bitmap
->
s_extPosition
=
le32_to_cpu
(
phd
->
unallocSpaceBitmap
.
extPosition
);
map
->
s_partition_flags
|=
UDF_PART_FLAG_UNALLOC_BITMAP
;
udf_debug
(
"unallocSpaceBitmap (part %d) @ %d
\n
"
,
i
,
udf_debug
(
"unallocSpaceBitmap (part %d) @ %d
\n
"
,
p_index
,
bitmap
->
s_extPosition
);
}
if
(
phd
->
partitionIntegrityTable
.
extLength
)
udf_debug
(
"partitionIntegrityTable (part %d)
\n
"
,
i
);
udf_debug
(
"partitionIntegrityTable (part %d)
\n
"
,
p_index
);
if
(
phd
->
freedSpaceTable
.
extLength
)
{
kernel_lb_addr
loc
=
{
.
logicalBlockNum
=
le32_to_cpu
(
phd
->
freedSpaceTable
.
extPosition
),
.
partitionReferenceNum
=
i
,
.
partitionReferenceNum
=
p_index
,
};
map
->
s_fspace
.
s_table
=
udf_iget
(
sb
,
loc
);
if
(
!
map
->
s_fspace
.
s_table
)
{
udf_debug
(
"cannot load freedSpaceTable (part %d)
\n
"
,
i
);
ret
=
1
;
goto
out_bh
;
udf_debug
(
"cannot load freedSpaceTable (part %d)
\n
"
,
p_index
)
;
return
1
;
}
map
->
s_partition_flags
|=
UDF_PART_FLAG_FREED_TABLE
;
udf_debug
(
"freedSpaceTable (part %d) @ %ld
\n
"
,
i
,
map
->
s_fspace
.
s_table
->
i_ino
);
p_index
,
map
->
s_fspace
.
s_table
->
i_ino
);
}
if
(
phd
->
freedSpaceBitmap
.
extLength
)
{
struct
udf_bitmap
*
bitmap
=
udf_sb_alloc_bitmap
(
sb
,
i
);
if
(
!
bitmap
)
{
ret
=
1
;
goto
out_bh
;
}
struct
udf_bitmap
*
bitmap
=
udf_sb_alloc_bitmap
(
sb
,
p_index
);
if
(
!
bitmap
)
return
1
;
map
->
s_fspace
.
s_bitmap
=
bitmap
;
bitmap
->
s_extLength
=
le32_to_cpu
(
phd
->
freedSpaceBitmap
.
extLength
);
bitmap
->
s_extPosition
=
le32_to_cpu
(
phd
->
freedSpaceBitmap
.
extPosition
);
map
->
s_partition_flags
|=
UDF_PART_FLAG_FREED_BITMAP
;
udf_debug
(
"freedSpaceBitmap (part %d) @ %d
\n
"
,
i
,
udf_debug
(
"freedSpaceBitmap (part %d) @ %d
\n
"
,
p_index
,
bitmap
->
s_extPosition
);
}
return
0
;
}
static
int
udf_load_partdesc
(
struct
super_block
*
sb
,
sector_t
block
)
{
struct
buffer_head
*
bh
;
struct
partitionDesc
*
p
;
struct
udf_part_map
*
map
;
struct
udf_sb_info
*
sbi
=
UDF_SB
(
sb
);
bool
found
=
false
;
int
i
;
uint16_t
partitionNumber
;
uint16_t
ident
;
int
ret
=
0
;
bh
=
udf_read_tagged
(
sb
,
block
,
block
,
&
ident
);
if
(
!
bh
)
return
1
;
if
(
ident
!=
TAG_IDENT_PD
)
goto
out_bh
;
p
=
(
struct
partitionDesc
*
)
bh
->
b_data
;
partitionNumber
=
le16_to_cpu
(
p
->
partitionNumber
);
for
(
i
=
0
;
i
<
sbi
->
s_partitions
;
i
++
)
{
map
=
&
sbi
->
s_partmaps
[
i
];
udf_debug
(
"Searching map: (%d == %d)
\n
"
,
map
->
s_partition_num
,
partitionNumber
);
found
=
map
->
s_partition_num
==
partitionNumber
;
if
(
found
)
break
;
}
if
(
!
found
)
{
udf_debug
(
"Partition (%d) not found in partition map
\n
"
,
partitionNumber
);
goto
out_bh
;
}
ret
=
udf_fill_partdesc_info
(
sb
,
p
,
i
);
out_bh:
/* In case loading failed, we handle cleanup in udf_fill_super */
brelse
(
bh
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录