Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
e38872d3
提交
e38872d3
1月 24, 2012
创建
作者:
Silas Boyd-Wickizer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
In fs.c, return an error if an element is longer than DIRSIZ.
The old code would truncate element names to DIRSIZ and leave out NULL. The new ns code, however, depends on NULL terminated strings.
上级
abcc56d3
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
14 行增加
和
12 行删除
+14
-12
TODO
TODO
+1
-3
fs.c
fs.c
+13
-9
没有找到文件。
TODO
浏览文件 @
e38872d3
* stat.size is u32
* get gcc asm labels working for cpu, proc, kmem
- (I couldn't stop gcc from generating RIP-relative movs)
* get something like asm labels working in clang
- (is there a way to use address_space(256) attributes?)
* on real hw, apicid != logical ID, but this breaks things.
* allocate memory using PBASE
- adjust p2v and v2p
* bring mtrace back
* finish syscall/sysret implementation
* make uart console work over IPMI SOL
* make syslinux/pxelinux work over IPMI SOL
...
...
fs.c
浏览文件 @
e38872d3
...
...
@@ -667,10 +667,13 @@ dirlink(struct inode *dp, char *name, u32 inum)
// Paths
// Copy the next path element from path into name.
//
Return a
pointer to the element following the copied one.
//
Update the
pointer to the element following the copied one.
// The returned path has no leading slashes,
// so the caller can check *path=='\0' to see if the name is the last one.
//
// If copied into name, return 1.
// If no name to remove, return 0.
// If the name is longer than DIRSIZ, return -1;
//
// Examples:
// skipelem("a/bb/c", name) = "bb/c", setting name = "a"
...
...
@@ -678,9 +681,10 @@ dirlink(struct inode *dp, char *name, u32 inum)
// skipelem("a", name) = "", setting name = "a"
// skipelem("", name) = skipelem("////", name) = 0
//
static
char
*
skipelem
(
char
*
path
,
char
*
name
)
static
int
skipelem
(
char
*
*
r
path
,
char
*
name
)
{
char
*
path
=
*
rpath
;
char
*
s
;
int
len
;
...
...
@@ -693,14 +697,15 @@ skipelem(char *path, char *name)
path
++
;
len
=
path
-
s
;
if
(
len
>=
DIRSIZ
)
memmove
(
name
,
s
,
DIRSIZ
)
;
return
-
1
;
else
{
memmove
(
name
,
s
,
len
);
name
[
len
]
=
0
;
}
while
(
*
path
==
'/'
)
path
++
;
return
path
;
*
rpath
=
path
;
return
1
;
}
// Look up and return the inode for a path name.
...
...
@@ -710,8 +715,7 @@ static struct inode*
namex
(
char
*
path
,
int
nameiparent
,
char
*
name
)
{
struct
inode
*
ip
,
*
next
;
//cprintf("namex %s\n", path);
int
r
;
gc_begin_epoch
();
if
(
*
path
==
'/'
)
...
...
@@ -719,7 +723,7 @@ namex(char *path, int nameiparent, char *name)
else
ip
=
idup
(
myproc
()
->
cwd
);
while
((
path
=
skipelem
(
path
,
name
))
!=
0
){
while
((
r
=
skipelem
(
&
path
,
name
))
==
1
){
next
=
0
;
if
(
next
==
0
){
if
(
ip
->
type
==
0
)
...
...
@@ -743,7 +747,7 @@ namex(char *path, int nameiparent, char *name)
}
ip
=
next
;
}
if
(
nameiparent
){
if
(
r
==
-
1
||
nameiparent
){
iput
(
ip
);
gc_end_epoch
();
return
0
;
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论