tweaks
This commit is contained in:
parent
eaea18cb9c
commit
f0721f1be4
3 changed files with 23 additions and 23 deletions
4
BUGS
4
BUGS
|
@ -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?
|
||||
|
||||
|
|
40
fs.c
40
fs.c
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue