Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
05e97551
提交
05e97551
8月 12, 2006
创建
作者:
rtm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
zero out all of dirent.name when creating
don't increase length of directory
上级
cd93074e
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
20 行增加
和
17 行删除
+20
-17
Notes
Notes
+2
-2
bio.c
bio.c
+2
-2
defs.h
defs.h
+1
-1
fs.c
fs.c
+15
-12
没有找到文件。
Notes
浏览文件 @
05e97551
...
@@ -363,5 +363,5 @@ more than one directory content block
...
@@ -363,5 +363,5 @@ more than one directory content block
sh arguments
sh arguments
sh redirection
sh redirection
indirect blocks
indirect blocks
two bugs in unlink
two bugs in unlink
: don't just return if nlink > 0,
how come unlink xxx fails? iput problem?
and search for name, not inum
bio.c
浏览文件 @
05e97551
...
@@ -90,13 +90,13 @@ bread(uint dev, uint sector)
...
@@ -90,13 +90,13 @@ bread(uint dev, uint sector)
}
}
void
void
bwrite
(
uint
dev
,
struct
buf
*
b
,
uint
sector
)
bwrite
(
struct
buf
*
b
,
uint
sector
)
{
{
void
*
c
;
void
*
c
;
extern
struct
spinlock
ide_lock
;
extern
struct
spinlock
ide_lock
;
acquire
(
&
ide_lock
);
acquire
(
&
ide_lock
);
c
=
ide_start_rw
(
dev
&
0xff
,
sector
,
b
->
data
,
1
,
0
);
c
=
ide_start_rw
(
b
->
dev
&
0xff
,
sector
,
b
->
data
,
1
,
0
);
sleep
(
c
,
&
ide_lock
);
sleep
(
c
,
&
ide_lock
);
ide_finish
(
c
);
ide_finish
(
c
);
b
->
flags
|=
B_VALID
;
b
->
flags
|=
B_VALID
;
...
...
defs.h
浏览文件 @
05e97551
...
@@ -106,7 +106,7 @@ void binit(void);
...
@@ -106,7 +106,7 @@ void binit(void);
struct
buf
;
struct
buf
;
struct
buf
*
getblk
(
uint
dev
,
uint
sector
);
struct
buf
*
getblk
(
uint
dev
,
uint
sector
);
struct
buf
*
bread
(
uint
,
uint
);
struct
buf
*
bread
(
uint
,
uint
);
void
bwrite
(
uint
,
struct
buf
*
,
uint
);
void
bwrite
(
struct
buf
*
,
uint
);
void
brelse
(
struct
buf
*
);
void
brelse
(
struct
buf
*
);
// fs.c
// fs.c
...
...
fs.c
浏览文件 @
05e97551
...
@@ -56,7 +56,7 @@ balloc(uint dev)
...
@@ -56,7 +56,7 @@ balloc(uint dev)
cprintf
(
"balloc: allocate block %d
\n
"
,
b
);
cprintf
(
"balloc: allocate block %d
\n
"
,
b
);
bp
->
data
[
bi
/
8
]
|=
0x1
<<
(
bi
%
8
);
bp
->
data
[
bi
/
8
]
|=
0x1
<<
(
bi
%
8
);
bwrite
(
dev
,
bp
,
BBLOCK
(
b
,
ninodes
));
// mark it allocated on disk
bwrite
(
bp
,
BBLOCK
(
b
,
ninodes
));
// mark it allocated on disk
brelse
(
bp
);
brelse
(
bp
);
return
b
;
return
b
;
}
}
...
@@ -80,7 +80,7 @@ bfree(int dev, uint b)
...
@@ -80,7 +80,7 @@ bfree(int dev, uint b)
bi
=
b
%
BPB
;
bi
=
b
%
BPB
;
m
=
~
(
0x1
<<
(
bi
%
8
));
m
=
~
(
0x1
<<
(
bi
%
8
));
bp
->
data
[
bi
/
8
]
&=
m
;
bp
->
data
[
bi
/
8
]
&=
m
;
bwrite
(
dev
,
bp
,
BBLOCK
(
b
,
ninodes
));
// mark it free on disk
bwrite
(
bp
,
BBLOCK
(
b
,
ninodes
));
// mark it free on disk
brelse
(
bp
);
brelse
(
bp
);
}
}
...
@@ -147,7 +147,7 @@ iupdate (struct inode *ip)
...
@@ -147,7 +147,7 @@ iupdate (struct inode *ip)
dip
->
nlink
=
ip
->
nlink
;
dip
->
nlink
=
ip
->
nlink
;
dip
->
size
=
ip
->
size
;
dip
->
size
=
ip
->
size
;
memmove
(
dip
->
addrs
,
ip
->
addrs
,
sizeof
(
ip
->
addrs
));
memmove
(
dip
->
addrs
,
ip
->
addrs
,
sizeof
(
ip
->
addrs
));
bwrite
(
ip
->
dev
,
bp
,
IBLOCK
(
ip
->
inum
));
// mark it allocated on the disk
bwrite
(
bp
,
IBLOCK
(
ip
->
inum
));
// mark it allocated on the disk
brelse
(
bp
);
brelse
(
bp
);
}
}
...
@@ -181,7 +181,7 @@ ialloc(uint dev, short type)
...
@@ -181,7 +181,7 @@ ialloc(uint dev, short type)
cprintf
(
"ialloc: %d
\n
"
,
inum
);
cprintf
(
"ialloc: %d
\n
"
,
inum
);
dip
->
type
=
type
;
dip
->
type
=
type
;
bwrite
(
dev
,
bp
,
IBLOCK
(
inum
));
// mark it allocated on the disk
bwrite
(
bp
,
IBLOCK
(
inum
));
// mark it allocated on the disk
brelse
(
bp
);
brelse
(
bp
);
ip
=
iget
(
dev
,
inum
);
ip
=
iget
(
dev
,
inum
);
return
ip
;
return
ip
;
...
@@ -353,7 +353,7 @@ writei(struct inode *ip, char *addr, uint off, uint n)
...
@@ -353,7 +353,7 @@ writei(struct inode *ip, char *addr, uint off, uint n)
m
=
min
(
BSIZE
-
off
%
BSIZE
,
n
-
r
);
m
=
min
(
BSIZE
-
off
%
BSIZE
,
n
-
r
);
bp
=
bread
(
ip
->
dev
,
bmap
(
ip
,
off
/
BSIZE
));
bp
=
bread
(
ip
->
dev
,
bmap
(
ip
,
off
/
BSIZE
));
memmove
(
bp
->
data
+
off
%
BSIZE
,
addr
,
m
);
memmove
(
bp
->
data
+
off
%
BSIZE
,
addr
,
m
);
bwrite
(
ip
->
dev
,
bp
,
bmap
(
ip
,
off
/
BSIZE
));
bwrite
(
bp
,
bmap
(
ip
,
off
/
BSIZE
));
brelse
(
bp
);
brelse
(
bp
);
r
+=
m
;
r
+=
m
;
off
+=
m
;
off
+=
m
;
...
@@ -484,13 +484,16 @@ mknod(char *cp, short type, short major, short minor)
...
@@ -484,13 +484,16 @@ mknod(char *cp, short type, short major, short minor)
found:
found:
ep
->
inum
=
ip
->
inum
;
ep
->
inum
=
ip
->
inum
;
for
(
i
=
0
;
i
<
DIRSIZ
&&
cp
[
i
];
i
++
)
ep
->
name
[
i
]
=
cp
[
i
];
for
(
i
=
0
;
i
<
DIRSIZ
&&
cp
[
i
];
i
++
)
bwrite
(
dp
->
dev
,
bp
,
bmap
(
dp
,
off
/
BSIZE
));
// write directory block
ep
->
name
[
i
]
=
cp
[
i
];
for
(
;
i
<
DIRSIZ
;
i
++
)
ep
->
name
[
i
]
=
'\0'
;
bwrite
(
bp
,
bmap
(
dp
,
off
/
BSIZE
));
// write directory block
brelse
(
bp
);
brelse
(
bp
);
dp
->
size
+=
sizeof
(
struct
dirent
);
// update directory inode
i
update
(
dp
);
i
put
(
dp
);
iput
(
dp
);
return
ip
;
return
ip
;
}
}
int
int
...
@@ -531,7 +534,7 @@ unlink(char *cp)
...
@@ -531,7 +534,7 @@ unlink(char *cp)
found:
found:
ep
->
inum
=
0
;
ep
->
inum
=
0
;
bwrite
(
dp
->
dev
,
bp
,
bmap
(
dp
,
off
/
BSIZE
));
// write directory block
bwrite
(
bp
,
bmap
(
dp
,
off
/
BSIZE
));
// write directory block
brelse
(
bp
);
brelse
(
bp
);
iupdate
(
dp
);
iupdate
(
dp
);
iput
(
dp
);
iput
(
dp
);
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论