Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
黄净栩
oslab-xv6
Commits
7834cca6
Commit
7834cca6
authored
17 years ago
by
rsc
Browse files
Options
Download
Patches
Plain Diff
remove _ from pipe; be like file
parent
76f09d7d
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
defs.h
+4
-4
defs.h
file.c
+3
-3
file.c
pipe.c
+4
-4
pipe.c
sysfile.c
+1
-1
sysfile.c
with
12 additions
and
12 deletions
+12
-12
defs.h
+
4
−
4
View file @
7834cca6
...
...
@@ -92,10 +92,10 @@ void irq_enable(int);
void
pic_init
(
void
);
// pipe.c
int
pipe
_
alloc
(
struct
file
**
,
struct
file
**
);
void
pipe
_
close
(
struct
pipe
*
,
int
);
int
pipe
_
read
(
struct
pipe
*
,
char
*
,
int
);
int
pipe
_
write
(
struct
pipe
*
,
char
*
,
int
);
int
pipealloc
(
struct
file
**
,
struct
file
**
);
void
pipeclose
(
struct
pipe
*
,
int
);
int
piperead
(
struct
pipe
*
,
char
*
,
int
);
int
pipewrite
(
struct
pipe
*
,
char
*
,
int
);
// proc.c
struct
proc
*
copyproc
(
struct
proc
*
);
...
...
This diff is collapsed.
Click to expand it.
file.c
+
3
−
3
View file @
7834cca6
...
...
@@ -65,7 +65,7 @@ fileclose(struct file *f)
release
(
&
file_table_lock
);
if
(
ff
.
type
==
FD_PIPE
)
pipe
_
close
(
ff
.
pipe
,
ff
.
writable
);
pipeclose
(
ff
.
pipe
,
ff
.
writable
);
else
if
(
ff
.
type
==
FD_INODE
)
iput
(
ff
.
ip
);
else
...
...
@@ -94,7 +94,7 @@ fileread(struct file *f, char *addr, int n)
if
(
f
->
readable
==
0
)
return
-
1
;
if
(
f
->
type
==
FD_PIPE
)
return
pipe
_
read
(
f
->
pipe
,
addr
,
n
);
return
piperead
(
f
->
pipe
,
addr
,
n
);
if
(
f
->
type
==
FD_INODE
){
ilock
(
f
->
ip
);
if
((
r
=
readi
(
f
->
ip
,
addr
,
f
->
off
,
n
))
>
0
)
...
...
@@ -114,7 +114,7 @@ filewrite(struct file *f, char *addr, int n)
if
(
f
->
writable
==
0
)
return
-
1
;
if
(
f
->
type
==
FD_PIPE
)
return
pipe
_
write
(
f
->
pipe
,
addr
,
n
);
return
pipewrite
(
f
->
pipe
,
addr
,
n
);
if
(
f
->
type
==
FD_INODE
){
ilock
(
f
->
ip
);
if
((
r
=
writei
(
f
->
ip
,
addr
,
f
->
off
,
n
))
>
0
)
...
...
This diff is collapsed.
Click to expand it.
pipe.c
+
4
−
4
View file @
7834cca6
...
...
@@ -18,7 +18,7 @@ struct pipe {
};
int
pipe
_
alloc
(
struct
file
**
f0
,
struct
file
**
f1
)
pipealloc
(
struct
file
**
f0
,
struct
file
**
f1
)
{
struct
pipe
*
p
;
...
...
@@ -58,7 +58,7 @@ pipe_alloc(struct file **f0, struct file **f1)
}
void
pipe
_
close
(
struct
pipe
*
p
,
int
writable
)
pipeclose
(
struct
pipe
*
p
,
int
writable
)
{
acquire
(
&
p
->
lock
);
if
(
writable
){
...
...
@@ -76,7 +76,7 @@ pipe_close(struct pipe *p, int writable)
//PAGEBREAK: 20
int
pipe
_
write
(
struct
pipe
*
p
,
char
*
addr
,
int
n
)
pipewrite
(
struct
pipe
*
p
,
char
*
addr
,
int
n
)
{
int
i
;
...
...
@@ -99,7 +99,7 @@ pipe_write(struct pipe *p, char *addr, int n)
}
int
pipe
_
read
(
struct
pipe
*
p
,
char
*
addr
,
int
n
)
piperead
(
struct
pipe
*
p
,
char
*
addr
,
int
n
)
{
int
i
;
...
...
This diff is collapsed.
Click to expand it.
sysfile.c
+
1
−
1
View file @
7834cca6
...
...
@@ -379,7 +379,7 @@ sys_pipe(void)
if
(
argptr
(
0
,
(
void
*
)
&
fd
,
2
*
sizeof
(
fd
[
0
]))
<
0
)
return
-
1
;
if
(
pipe
_
alloc
(
&
rf
,
&
wf
)
<
0
)
if
(
pipealloc
(
&
rf
,
&
wf
)
<
0
)
return
-
1
;
fd0
=
-
1
;
if
((
fd0
=
fdalloc
(
rf
))
<
0
||
(
fd1
=
fdalloc
(
wf
))
<
0
){
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets