Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OS
U-Boot.Mirror
提交
9a49e0e1
U
U-Boot.Mirror
项目概览
OS
/
U-Boot.Mirror
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
U-Boot.Mirror
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9a49e0e1
编写于
9月 24, 2009
作者:
W
Wolfgang Denk
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
git://git.denx.de/u-boot-ubi
上级
fcdb36b8
9d7952e4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
43 addition
and
25 deletion
+43
-25
fs/ubifs/ubifs.c
fs/ubifs/ubifs.c
+43
-25
未找到文件。
fs/ubifs/ubifs.c
浏览文件 @
9a49e0e1
...
...
@@ -379,9 +379,11 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
int
ret
;
char
*
next
;
char
fpath
[
128
];
char
symlinkpath
[
128
];
char
*
name
=
fpath
;
unsigned
long
root_inum
=
1
;
unsigned
long
inum
;
int
symlink_count
=
0
;
/* Don't allow symlink recursion */
strcpy
(
fpath
,
filename
);
...
...
@@ -397,6 +399,9 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
return
inum
;
for
(;;)
{
struct
inode
*
inode
;
struct
ubifs_inode
*
ui
;
/* Extract the actual part from the pathname. */
next
=
strchr
(
name
,
'/'
);
if
(
next
)
{
...
...
@@ -406,18 +411,48 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
}
ret
=
ubifs_finddir
(
sb
,
name
,
root_inum
,
&
inum
);
if
(
!
ret
)
return
0
;
inode
=
ubifs_iget
(
sb
,
inum
);
if
(
!
inode
)
return
0
;
ui
=
ubifs_inode
(
inode
);
if
((
inode
->
i_mode
&
S_IFMT
)
==
S_IFLNK
)
{
char
link_name
[
64
];
char
buf
[
128
];
/* We have some sort of symlink recursion, bail out */
if
(
symlink_count
++
>
8
)
{
printf
(
"Symlink recursion, aborting
\n
"
);
return
0
;
}
memcpy
(
link_name
,
ui
->
data
,
ui
->
data_len
);
link_name
[
ui
->
data_len
]
=
'\0'
;
if
(
link_name
[
0
]
==
'/'
)
{
/* Absolute path, redo everything without
* the leading slash */
next
=
name
=
link_name
+
1
;
root_inum
=
1
;
continue
;
}
/* Relative to cur dir */
sprintf
(
buf
,
"%s%s"
,
link_name
,
next
==
NULL
?
""
:
next
);
memcpy
(
symlinkpath
,
buf
,
sizeof
(
buf
));
next
=
name
=
symlinkpath
;
continue
;
}
/*
* Check if directory with this name exists
*/
/* Found the node! */
if
(
!
next
||
*
next
==
'\0'
)
{
if
(
ret
)
return
inum
;
break
;
}
if
(
!
next
||
*
next
==
'\0'
)
return
inum
;
root_inum
=
inum
;
name
=
next
;
...
...
@@ -614,10 +649,10 @@ int ubifs_load(char *filename, u32 addr, u32 size)
int
err
=
0
;
int
i
;
int
count
;
char
link_name
[
64
];
struct
ubifs_inode
*
ui
;
c
->
ubi
=
ubi_open_volume
(
c
->
vi
.
ubi_num
,
c
->
vi
.
vol_id
,
UBI_READONLY
);
/* ubifs_findfile will resolve symlinks, so we know that we get
* the real file here */
inum
=
ubifs_findfile
(
ubifs_sb
,
filename
);
if
(
!
inum
)
{
err
=
-
1
;
...
...
@@ -634,23 +669,6 @@ int ubifs_load(char *filename, u32 addr, u32 size)
goto
out
;
}
/*
* Check for symbolic link
*/
ui
=
ubifs_inode
(
inode
);
if
(((
inode
->
i_mode
&
S_IFMT
)
==
S_IFLNK
)
&&
ui
->
data_len
)
{
memcpy
(
link_name
,
ui
->
data
,
ui
->
data_len
);
link_name
[
ui
->
data_len
]
=
'\0'
;
printf
(
"%s is linked to %s!
\n
"
,
filename
,
link_name
);
ubifs_iput
(
inode
);
/*
* Now we have the "real" filename, call ubifs_load()
* again (recursive call) to load this file instead
*/
return
ubifs_load
(
link_name
,
addr
,
size
);
}
/*
* If no size was specified or if size bigger than filesize
* set size to filesize
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录