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 | 	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? | ||||||
|  | 
 | ||||||
|  |  | ||||||
							
								
								
									
										40
									
								
								fs.c
									
										
									
									
									
								
							
							
						
						
									
										40
									
								
								fs.c
									
										
									
									
									
								
							|  | @ -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) | ||||||
| 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 | ||||||
| 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 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue