Changeset 445 for Whitix/branches/hybrid/fs
- Timestamp:
- 05/06/08 22:26:59 (7 months ago)
- Files:
-
- 1 modified
-
Whitix/branches/hybrid/fs/vfs/dir.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Whitix/branches/hybrid/fs/vfs/dir.c
r412 r445 60 60 } 61 61 62 /* Can't create a directory on a read-only filesystem. */ 62 63 if (dir->superBlock->flags & SB_RDONLY) 63 64 { … … 66 67 } 67 68 69 /* Check if the mkDir function actually exists. */ 68 70 if (!dir->vNodeOps || !dir->vNodeOps->mkDir) 69 71 { … … 230 232 return err; 231 233 234 /* New root must be a directory */ 232 235 if (!(dirNode->mode & VFS_ATTR_DIR)) 233 236 { … … 236 239 } 237 240 241 /* Change the current directory (and root) to the new root vNode, 242 * because we can't be sure the current directory doesn't point to a 243 * location outside that accessible by the root directory. 244 */ 238 245 VNodeRelease(current->cwd); 239 246 VNodeRelease(current->root); … … 244 251 return 0; 245 252 } 253 254 /*********************************************************************** 255 * 256 * FUNCTION: SysChangeRoot 257 * 258 * DESCRIPTION: Change the filesystem root for a particular process. 259 * 260 * PARAMETERS: dirName - name of the directory that is the new root. 261 * 262 * RETURNS: Usual error codes in error.h 263 * 264 ***********************************************************************/ 246 265 247 266 int SysChangeRoot(char* dirName) … … 288 307 int FillDir(void* entries,char* name,int nameLen,DWORD vNum) 289 308 { 290 struct FillDirInfo* curr=(struct FillDirInfo*)entries;309 struct FillDirInfo* dirEntries=(struct FillDirInfo*)entries; 291 310 int recordLen=ROUND_UP(offsetof(struct DirEntry,name)+nameLen+1); 292 311 … … 294 313 return -EFAULT; 295 314 296 curr->curr->vNodeNum=vNum; 297 curr->curr->length=recordLen; 298 curr->curr->offset=0; 315 /* Fill in the current directory entry. */ 316 dirEntries->curr->vNodeNum=vNum; 317 dirEntries->curr->length=recordLen; 318 dirEntries->curr->offset=0; 299 319 memcpy(curr->curr->name,name,nameLen); 300 320 curr->curr->name[nameLen]='\0'; 321 322 /* And update the GetDirEntries state. */ 301 323 curr->count-=recordLen; 302 324 curr->prev=curr->curr; … … 324 346 return -EBADF; 325 347 348 /* Must be able to write the directory entries to the given area of memory. */ 326 349 if (VirtCheckArea(entries,count,VER_WRITE)) 327 350 return -EFAULT; … … 346 369 } 347 370 371 /* Check if an error occured during ReadDir. If not, return the total byte-count of 372 * the ReadDir entries. 373 */ 348 374 if (fDirInfo.error) 349 375 return fDirInfo.error; … … 452 478 453 479 /* Change to current for the duration of the lookup (Exec* needs it). */ 454 455 480 if (process != current) 456 481 { … … 462 487 } 463 488 489 /* Look up the directory vNode. */ 464 490 err=NameToVNode(&dirNode,dirName,FILE_READ | FILE_FORCE_OPEN); 465 491 492 /* And change back. */ 466 493 if (process != current) 467 494 { … … 479 506 } 480 507 508 /* Update the directory path string. Used in SysGetCurrDir. */ 481 509 AddStringPath(process,dirName); 482 510 511 /* And finally, update the current directory vNode for the process. */ 483 512 VNodeRelease(process->cwd); 484 513 process->cwd=dirNode;
