Changeset 770 for Whitix/branches
- Timestamp:
- 07/09/08 18:46:57 (5 months ago)
- Location:
- Whitix/branches/fs/fs/vfs
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
Whitix/branches/fs/fs/vfs/bcache.c
r752 r770 95 95 INIT_WAITQUEUE_ENTRY(bufferWait); 96 96 97 WaitAddToQueue(&buffer->waitQueue, &bufferWait);98 99 97 do 100 98 { 99 WaitAddToQueue(&buffer->waitQueue, &bufferWait); 101 100 ThrSuspendThread(currThread); 102 103 if (!BufferLocked(buffer))104 break;105 106 101 ThrSchedule(); 107 102 }while (BufferLocked(buffer)); … … 157 152 158 153 INIT_WAITQUEUE_HEAD(&buff->waitQueue); 154 BufferLock(buff); 159 155 BlockAddToHashTable(buff); 160 156 … … 259 255 return -EFAULT; 260 256 261 /* The buffer will be unlocked in StorageEndRequest */ 262 BufferLock(buff); 257 /* Buffer should already be locked if we're coming from BlockRead */ 263 258 264 259 err=BlockSendRequestRaw(device,request); … … 308 303 309 304 request=StorageBuildRequest(buff, REQUEST_READ); 310 311 BufferLock(buff);312 305 313 306 StorageDoRequest(device,request); … … 479 472 { 480 473 struct ListHead* head=BUFFER_HASH(device, blockNum); 481 struct Buffer* curr; 474 struct Buffer* curr, *ret=NULL; 475 476 PreemptDisable(); 482 477 483 478 ListForEachEntry(curr, head, list) … … 485 480 { 486 481 BufferGet(curr); 487 return curr; 482 ret=curr; 483 goto out; 488 484 } 489 485 490 return NULL; 486 out: 487 PreemptEnable(); 488 return ret; 491 489 } 492 490 -
Whitix/branches/fs/fs/vfs/dir.c
r701 r770 372 372 return -ENOTIMPL; 373 373 } 374 375 VfsFileAccessed(file->vNode); 374 376 375 377 /* Check if an error occured during ReadDir. If not, return the total byte-count of -
Whitix/branches/fs/fs/vfs/file.c
r746 r770 48 48 return; 49 49 50 vNode->aTime=currTime; 51 SetVNodeDirty(vNode); 50 /* TODO: Check granularity of vNode times on disk. No point dirtying a vNode if 51 * the time isn't updated. */ 52 53 if (vNode->aTime.seconds < currTime.seconds) 54 { 55 vNode->aTime=currTime; 56 SetVNodeDirty(vNode); 57 } 52 58 } 53 59 … … 74 80 return; 75 81 76 vNode->mTime=currTime;77 78 82 /* Has the vNode just been created? If so, record its 79 83 creation time */ … … 81 85 vNode->cTime=currTime; 82 86 83 SetVNodeDirty(vNode); 87 /* See VfsFileAccessed comment. */ 88 if (vNode->mTime.seconds < currTime.seconds || create) 89 { 90 vNode->mTime=currTime; 91 SetVNodeDirty(vNode); 92 } 84 93 } 85 94 … … 146 155 copyOffset+=readSize; 147 156 file->position+=readSize; 157 148 158 BlockFree(buff); 149 159 } -
Whitix/branches/fs/fs/vfs/load.c
r701 r770 72 72 int err; 73 73 74 err=DoOpenFile(file, pathName,FILE_READ,0);74 err=DoOpenFile(file, pathName, FILE_READ, 0); 75 75 76 76 if (err) 77 77 return err; 78 78 79 79 if (file->vNode->mode & VFS_ATTR_DIR) 80 80 return -EISDIR; … … 377 377 ExecSetupContext(&execArgs,pathName,fds,argv); 378 378 379 /* Open exec tuable */379 /* Open executable */ 380 380 err=ExecOpen(pathName,&execArgs.exec); 381 381 if (err) … … 708 708 /* Should calculate total program header size. TODO: Memory map in. See linker code. */ 709 709 buffer=(BYTE*)malloc(512); 710 if (!DoReadFile(&args->exec, buffer,512))710 if (!DoReadFile(&args->exec, buffer, 512)) 711 711 { 712 712 KePrint("Failed to read file %s\n",args->pathName); … … 717 717 header=(struct ElfHeader*)buffer; 718 718 719 if (ElfCheckHeader(header, ELF_EXEC | ELF_DYN))720 { 721 KePrint("%s: not a valid ELF executable\n", args->pathName);719 if (ElfCheckHeader(header, ELF_EXEC | ELF_DYN)) 720 { 721 KePrint("%s: not a valid ELF executable\n", args->pathName); 722 722 err=-EINVAL; 723 723 goto freeBuffer;