Skip to content
Snippets Groups Projects
Commit f0721f1b authored by rsc's avatar rsc
Browse files

tweaks

parent eaea18cb
No related branches found
No related tags found
No related merge requests found
......@@ -12,3 +12,7 @@ formatting:
file.c filewrite leaks onto next page
need to fix PAGEBREAK mechanism
fs.c: grep XXX
sysfile.c: why does mknod take a type argument?
......@@ -524,11 +524,11 @@ dirlink(struct inode *dp, char *name, uint ino)
{
int off;
struct dirent de;
struct uinode *ip;
struct uinode *ipu;
// Check that name is not present.
if((ip = dirlookup(dp, name, 0)) != 0){
iput(ip);
if((ipu = dirlookup(dp, name, 0)) != 0){
iput(ipu);
return -1;
}
......@@ -593,43 +593,39 @@ skipelem(char *path, char *name)
static struct uinode*
_namei(char *path, int parent, char *name)
{
struct uinode *dp, *ip;
struct inode *dpl;
struct uinode *dpu, *ipu;
struct inode *dp;
uint off;
if(*path == '/')
dp = iget(ROOTDEV, 1);
dpu = iget(ROOTDEV, 1);
else
dp = idup(cp->cwd);
dpu = idup(cp->cwd);
while((path = skipelem(path, name)) != 0){
dpl = ilock(dp);
if(dpl->type != T_DIR){
iunlock(dpl);
iput(dp);
dp = ilock(dpu);
if(dp->type != T_DIR){
iput(iunlock(dp));
return 0;
}
if(parent && *path == '\0'){
// Stop one level early.
iunlock(dpl);
return dp;
iunlock(dp);
return dpu;
}
if((ip = dirlookup(dpl, name, &off)) == 0){
iunlock(dpl);
iput(dp);
iput(ip);
if((ipu = dirlookup(dp, name, &off)) == 0){
iput(iunlock(dp));
iput(ipu);
return 0;
}
iunlock(dpl);
iput(dp);
dp = ip;
iput(iunlock(dp));
dpu = ipu;
}
if(parent)
return 0;
return dp;
return dpu;
}
struct uinode*
......
......@@ -46,9 +46,9 @@ fsvar.h
ide.c
bio.c
fs.c
exec.c
file.c
sysfile.c
exec.c
# pipes
pipe.c
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment