提交 f0721f1b 创建 作者: rsc's avatar rsc

tweaks

上级 eaea18cb
...@@ -12,3 +12,7 @@ formatting: ...@@ -12,3 +12,7 @@ formatting:
file.c filewrite leaks onto next page file.c filewrite leaks onto next page
need to fix PAGEBREAK mechanism 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) ...@@ -524,11 +524,11 @@ dirlink(struct inode *dp, char *name, uint ino)
{ {
int off; int off;
struct dirent de; struct dirent de;
struct uinode *ip; struct uinode *ipu;
// Check that name is not present. // Check that name is not present.
if((ip = dirlookup(dp, name, 0)) != 0){ if((ipu = dirlookup(dp, name, 0)) != 0){
iput(ip); iput(ipu);
return -1; return -1;
} }
...@@ -593,43 +593,39 @@ skipelem(char *path, char *name) ...@@ -593,43 +593,39 @@ skipelem(char *path, char *name)
static struct uinode* static struct uinode*
_namei(char *path, int parent, char *name) _namei(char *path, int parent, char *name)
{ {
struct uinode *dp, *ip; struct uinode *dpu, *ipu;
struct inode *dpl; struct inode *dp;
uint off; uint off;
if(*path == '/') if(*path == '/')
dp = iget(ROOTDEV, 1); dpu = iget(ROOTDEV, 1);
else else
dp = idup(cp->cwd); dpu = idup(cp->cwd);
while((path = skipelem(path, name)) != 0){ while((path = skipelem(path, name)) != 0){
dpl = ilock(dp); dp = ilock(dpu);
if(dpl->type != T_DIR){ if(dp->type != T_DIR){
iunlock(dpl); iput(iunlock(dp));
iput(dp);
return 0; return 0;
} }
if(parent && *path == '\0'){ if(parent && *path == '\0'){
// Stop one level early. // Stop one level early.
iunlock(dpl); iunlock(dp);
return dp; return dpu;
} }
if((ip = dirlookup(dpl, name, &off)) == 0){ if((ipu = dirlookup(dp, name, &off)) == 0){
iunlock(dpl); iput(iunlock(dp));
iput(dp); iput(ipu);
iput(ip);
return 0; return 0;
} }
iput(iunlock(dp));
iunlock(dpl); dpu = ipu;
iput(dp);
dp = ip;
} }
if(parent) if(parent)
return 0; return 0;
return dp; return dpu;
} }
struct uinode* struct uinode*
......
...@@ -46,9 +46,9 @@ fsvar.h ...@@ -46,9 +46,9 @@ fsvar.h
ide.c ide.c
bio.c bio.c
fs.c fs.c
exec.c
file.c file.c
sysfile.c sysfile.c
exec.c
# pipes # pipes
pipe.c pipe.c
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论