Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
731ffe8e
提交
731ffe8e
5月 24, 2011
创建
作者:
Robert Morris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
start of name cache
上级
e3f5ef60
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
35 行增加
和
18 行删除
+35
-18
Makefile
Makefile
+1
-0
defs.h
defs.h
+7
-0
fs.c
fs.c
+21
-16
kalloc.c
kalloc.c
+5
-1
proc.c
proc.c
+1
-1
没有找到文件。
Makefile
浏览文件 @
731ffe8e
...
...
@@ -5,6 +5,7 @@ OBJS = \
exec.o
\
file.o
\
fs.o
\
namecache.o
\
ide.o
\
ioapic.o
\
kalloc.o
\
...
...
defs.h
浏览文件 @
731ffe8e
...
...
@@ -43,6 +43,7 @@ int filewrite(struct file*, char*, int n);
int
dirlink
(
struct
inode
*
,
char
*
,
uint
);
struct
inode
*
dirlookup
(
struct
inode
*
,
char
*
,
uint
*
);
struct
inode
*
ialloc
(
uint
,
short
);
struct
inode
*
iget
(
uint
dev
,
uint
inum
);
struct
inode
*
idup
(
struct
inode
*
);
void
iinit
(
void
);
void
ilock
(
struct
inode
*
);
...
...
@@ -197,6 +198,12 @@ int copyin(struct vmap *, uint, void*, uint);
int
pagefault
(
struct
vmap
*
,
uint
,
uint
);
void
clearpages
(
pde_t
*
pgdir
,
void
*
begin
,
void
*
end
);
// namecache.c
void
nc_init
();
struct
inode
*
nc_lookup
(
struct
inode
*
,
char
*
);
void
nc_insert
(
struct
inode
*
,
char
*
,
struct
inode
*
);
// number of elements in fixed-size array
#define NELEM(x) (sizeof(x)/sizeof((x)[0]))
#define NULL 0
fs.c
浏览文件 @
731ffe8e
...
...
@@ -146,8 +146,6 @@ iinit(void)
}
}
static
struct
inode
*
iget
(
uint
dev
,
uint
inum
);
//PAGEBREAK!
// Allocate a new inode with the given type on device dev.
struct
inode
*
...
...
@@ -195,7 +193,7 @@ iupdate(struct inode *ip)
// Find the inode with number inum on device dev
// and return the in-memory copy.
st
atic
st
ruct
inode
*
struct
inode
*
iget
(
uint
dev
,
uint
inum
)
{
struct
inode
*
ip
,
*
empty
;
...
...
@@ -587,21 +585,28 @@ namex(char *path, int nameiparent, char *name)
ip
=
idup
(
proc
->
cwd
);
while
((
path
=
skipelem
(
path
,
name
))
!=
0
){
ilock
(
ip
);
if
(
ip
->
type
!=
T_DIR
){
iunlockput
(
ip
);
return
0
;
}
if
(
nameiparent
&&
*
path
==
'\0'
){
// Stop one level early.
iunlock
(
ip
);
return
ip
;
}
if
((
next
=
dirlookup
(
ip
,
name
,
0
))
==
0
){
// XXX do we need to ilock(ip)?
// hopefully not, would be nice to have
// lock-free namecache hits.
next
=
nc_lookup
(
ip
,
name
);
if
(
next
==
0
){
ilock
(
ip
);
if
(
ip
->
type
!=
T_DIR
){
iunlockput
(
ip
);
return
0
;
}
if
(
nameiparent
&&
*
path
==
'\0'
){
// Stop one level early.
iunlock
(
ip
);
return
ip
;
}
if
((
next
=
dirlookup
(
ip
,
name
,
0
))
==
0
){
iunlockput
(
ip
);
return
0
;
}
nc_insert
(
ip
,
name
,
next
);
iunlockput
(
ip
);
return
0
;
}
iunlockput
(
ip
);
ip
=
next
;
}
if
(
nameiparent
){
...
...
kalloc.c
浏览文件 @
731ffe8e
...
...
@@ -105,8 +105,12 @@ kalloc(void)
}
if
(
r
==
0
)
{
cprintf
(
"kalloc: out of memory"
);
kmemprint
();
return
0
;
#if 0
panic("out of memory");
#endif
}
mtrace_label_register
(
mtrace_label_block
,
...
...
@@ -182,7 +186,7 @@ morecore(uint nu)
nu
=
512
;
// we allocate nu * sizeof(Header)
}
p
=
kalloc
();
if
(
p
==
(
char
*
)
-
1
)
if
(
p
==
0
)
return
0
;
hp
=
(
Header
*
)
p
;
hp
->
s
.
size
=
nu
;
...
...
proc.c
浏览文件 @
731ffe8e
...
...
@@ -69,7 +69,7 @@ allocproc(void)
// Allocate kernel stack if possible.
if
((
p
->
kstack
=
kalloc
())
==
0
){
p
->
state
=
UNUSED
;
kmfree
(
p
)
;
return
0
;
}
sp
=
p
->
kstack
+
KSTACKSIZE
;
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论