Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
8d2e9a48
提交
8d2e9a48
8月 24, 2007
创建
作者:
rsc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
shuffle for formatting
上级
d7b44dbc
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
37 行增加
和
30 行删除
+37
-30
fs.c
fs.c
+18
-12
sysfile.c
sysfile.c
+19
-18
没有找到文件。
fs.c
浏览文件 @
8d2e9a48
...
@@ -247,6 +247,7 @@ iunlockput(struct inode *ip)
...
@@ -247,6 +247,7 @@ iunlockput(struct inode *ip)
iput
(
ip
);
iput
(
ip
);
}
}
//PAGEBREAK!
// Allocate a new inode with the given type on device dev.
// Allocate a new inode with the given type on device dev.
struct
inode
*
struct
inode
*
ialloc
(
uint
dev
,
short
type
)
ialloc
(
uint
dev
,
short
type
)
...
@@ -295,6 +296,7 @@ iupdate(struct inode *ip)
...
@@ -295,6 +296,7 @@ iupdate(struct inode *ip)
brelse
(
bp
);
brelse
(
bp
);
}
}
//PAGEBREAK!
// Inode contents
// Inode contents
//
//
// The contents (data) associated with each inode is stored
// The contents (data) associated with each inode is stored
...
@@ -522,6 +524,7 @@ dirlink(struct inode *dp, char *name, uint ino)
...
@@ -522,6 +524,7 @@ dirlink(struct inode *dp, char *name, uint ino)
return
0
;
return
0
;
}
}
//PAGEBREAK!
// Paths
// Paths
// Copy the next path element from path into name.
// Copy the next path element from path into name.
...
@@ -560,6 +563,21 @@ skipelem(char *path, char *name)
...
@@ -560,6 +563,21 @@ skipelem(char *path, char *name)
return
path
;
return
path
;
}
}
static
struct
inode
*
_namei
(
char
*
,
int
,
char
*
);
struct
inode
*
namei
(
char
*
path
)
{
char
name
[
DIRSIZ
];
return
_namei
(
path
,
0
,
name
);
}
struct
inode
*
nameiparent
(
char
*
path
,
char
*
name
)
{
return
_namei
(
path
,
1
,
name
);
}
// Look up and return the inode for a path name.
// Look up and return the inode for a path name.
// If parent is set, return the inode for the parent
// If parent is set, return the inode for the parent
// and write the final path element to name, which
// and write the final path element to name, which
...
@@ -602,15 +620,3 @@ _namei(char *path, int parent, char *name)
...
@@ -602,15 +620,3 @@ _namei(char *path, int parent, char *name)
return
ip
;
return
ip
;
}
}
struct
inode
*
namei
(
char
*
path
)
{
char
name
[
DIRSIZ
];
return
_namei
(
path
,
0
,
name
);
}
struct
inode
*
nameiparent
(
char
*
path
,
char
*
name
)
{
return
_namei
(
path
,
1
,
name
);
}
sysfile.c
浏览文件 @
8d2e9a48
...
@@ -74,14 +74,17 @@ sys_write(void)
...
@@ -74,14 +74,17 @@ sys_write(void)
}
}
int
int
sys_
fstat
(
void
)
sys_
dup
(
void
)
{
{
struct
file
*
f
;
struct
file
*
f
;
struct
stat
*
st
;
int
fd
;
if
(
argfd
(
0
,
0
,
&
f
)
<
0
||
argptr
(
1
,
(
void
*
)
&
st
,
sizeof
(
*
st
))
<
0
)
if
(
argfd
(
0
,
0
,
&
f
)
<
0
)
return
-
1
;
return
-
1
;
return
filestat
(
f
,
st
);
if
((
fd
=
fdalloc
(
f
))
<
0
)
return
-
1
;
fileincref
(
f
);
return
fd
;
}
}
int
int
...
@@ -97,6 +100,17 @@ sys_close(void)
...
@@ -97,6 +100,17 @@ sys_close(void)
return
0
;
return
0
;
}
}
int
sys_fstat
(
void
)
{
struct
file
*
f
;
struct
stat
*
st
;
if
(
argfd
(
0
,
0
,
&
f
)
<
0
||
argptr
(
1
,
(
void
*
)
&
st
,
sizeof
(
*
st
))
<
0
)
return
-
1
;
return
filestat
(
f
,
st
);
}
// Create the path new as a link to the same inode as old.
// Create the path new as a link to the same inode as old.
int
int
sys_link
(
void
)
sys_link
(
void
)
...
@@ -152,6 +166,7 @@ isdirempty(struct inode *dp)
...
@@ -152,6 +166,7 @@ isdirempty(struct inode *dp)
return
1
;
return
1
;
}
}
//PAGEBREAK!
int
int
sys_unlink
(
void
)
sys_unlink
(
void
)
{
{
...
@@ -345,20 +360,6 @@ sys_chdir(void)
...
@@ -345,20 +360,6 @@ sys_chdir(void)
}
}
int
int
sys_dup
(
void
)
{
struct
file
*
f
;
int
fd
;
if
(
argfd
(
0
,
0
,
&
f
)
<
0
)
return
-
1
;
if
((
fd
=
fdalloc
(
f
))
<
0
)
return
-
1
;
fileincref
(
f
);
return
fd
;
}
int
sys_exec
(
void
)
sys_exec
(
void
)
{
{
char
*
path
,
*
argv
[
20
];
char
*
path
,
*
argv
[
20
];
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论