Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CSEP551
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Krishna Vinnakota
CSEP551
Commits
8d2e9a48
Commit
8d2e9a48
authored
17 years ago
by
rsc
Browse files
Options
Downloads
Patches
Plain Diff
shuffle for formatting
parent
d7b44dbc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fs.c
+18
-12
18 additions, 12 deletions
fs.c
sysfile.c
+19
-18
19 additions, 18 deletions
sysfile.c
with
37 additions
and
30 deletions
fs.c
+
18
−
12
View file @
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
);
}
This diff is collapsed.
Click to expand it.
sysfile.c
+
19
−
18
View file @
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
)
{
{
...
@@ -344,20 +359,6 @@ sys_chdir(void)
...
@@ -344,20 +359,6 @@ sys_chdir(void)
return
0
;
return
0
;
}
}
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
int
sys_exec
(
void
)
sys_exec
(
void
)
{
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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