Changeset 526 for Whitix/branches/hybrid
- Timestamp:
- 05/24/08 09:50:24 (5 months ago)
- Location:
- Whitix/branches/hybrid/fs
- Files:
-
- 1 added
- 10 modified
-
Makefile (modified) (2 diffs)
-
vfs/Makefile (modified) (1 diff)
-
vfs/bcache.c (modified) (8 diffs)
-
vfs/dir.c (modified) (4 diffs)
-
vfs/file.c (modified) (10 diffs)
-
vfs/load.c (added)
-
vfs/pipe.c (modified) (3 diffs)
-
vfs/poll.c (modified) (1 diff)
-
vfs/super.c (modified) (12 diffs)
-
vfs/vcache.c (modified) (2 diffs)
-
vfs/vnode.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Whitix/branches/hybrid/fs/Makefile
r7 r526 2 2 include ../make.inc 3 3 4 OBJS = devfs.o 4 MODULES = devfs.sys 5 5 6 build: $( OBJS)6 build: $(MODULES) 7 7 make -C fat 8 8 make -C vfs … … 10 10 make -C isofs 11 11 12 modules_install: 13 cp *.sys ../CdRoot/System/Modules/Core 14 make -C isofs modules_install 15 make -C vfs modules_install 16 12 17 clean: 13 rm -f $( OBJS)18 rm -f $(MODULES) 14 19 make -C fat clean 15 20 make -C vfs clean -
Whitix/branches/hybrid/fs/vfs/Makefile
r333 r526 2 2 include ../../make.inc 3 3 4 OBJS = bcache.o dir.o file.o super.o vcache.o vnode.o pipe.o poll.o 4 MODULES = bcache.sys dir.sys file.sys super.sys vcache.sys vnode.sys poll.sys sdevice.sys 5 5 6 build: $(OBJS) 6 build: $(MODULES) load.sys pipe.sys 7 ld -r $(MODULES) -o vfs.sys 8 9 modules_install: 10 cp vfs.sys ../../CdRoot/System/Modules/Core 11 cp load.sys ../../CdRoot/System/Modules/Core 7 12 8 13 clean: 9 rm *.o -f14 rm *.o *.sys -f -
Whitix/branches/hybrid/fs/vfs/bcache.c
r412 r526 27 27 #include <typedefs.h> 28 28 #include <task.h> 29 #include <module.h> 29 30 #include <panic.h> 30 31 … … 225 226 { 226 227 /* I/O error */ 227 printf("BlockSendRequest: error (%d) reading %u\n",err,request->sector);228 KePrint("BlockSendRequest: error (%d) reading %u\n",err,request->sector); 228 229 err=-EIO; 229 230 }else if (err == -SIOPENDING) … … 232 233 return err; 233 234 } 235 236 SYMBOL_EXPORT(BlockSendRequestRaw); 234 237 235 238 /*********************************************************************** … … 296 299 } 297 300 301 SYMBOL_EXPORT(BlockRead); 302 298 303 int BlockWrite(struct StorageDevice* device,struct Buffer* buffer) 299 304 { … … 306 311 return 0; 307 312 } 313 314 SYMBOL_EXPORT(BlockWrite); 308 315 309 316 static void BlockDeviceFreeAll(struct StorageDevice* sDevice) … … 341 348 return 0; 342 349 } 350 351 SYMBOL_EXPORT(BlockSetSize); 343 352 344 353 int DoBlockWrite(struct StorageDevice* sDevice,struct Buffer* buffer); … … 384 393 385 394 if (buffer->refs < 0) 386 printf("BlockFree: freeing free buffer\n"); 387 388 return 0; 389 } 395 KePrint("BlockFree: freeing free buffer\n"); 396 397 return 0; 398 } 399 400 SYMBOL_EXPORT(BlockFree); 390 401 391 402 int DoBlockWrite(struct StorageDevice* sDevice,struct Buffer* buffer) … … 401 412 */ 402 413 403 void BufferFlusher()414 static void BufferFlusher() 404 415 { 405 416 struct StorageDevice* sDevice; -
Whitix/branches/hybrid/fs/vfs/dir.c
r446 r526 22 22 #include <malloc.h> 23 23 #include <user_acc.h> 24 #include <module.h> 24 25 25 26 /*********************************************************************** … … 329 330 } 330 331 332 SYMBOL_EXPORT(FillDir); 333 331 334 int SysGetDirEntries(int fd,void* entries,DWORD count) 332 335 { … … 354 357 if (!(vNode->mode & VFS_ATTR_DIR)) 355 358 { 356 printf("SysGetDirEntries : not a directory\n");359 KePrint("SysGetDirEntries : not a directory\n"); 357 360 return -ENOTDIR; 358 361 } … … 365 368 else 366 369 { 367 printf("GetDirEntries is not yet implemented for fs\n");370 KePrint("GetDirEntries is not yet implemented for fs\n"); 368 371 return -ENOTIMPL; 369 372 } -
Whitix/branches/hybrid/fs/vfs/file.c
r500 r526 96 96 if (res == -1) 97 97 { 98 printf("FileGenericRead: block map failed, file->position = %d, file->size = %d, file->id = %#X\n",98 KePrint("FileGenericRead: block map failed, file->position = %d, file->size = %d, file->id = %#X\n", 99 99 file->position,file->vNode->size,file->vNode->id); 100 100 IrqRestoreFlags(flags); … … 106 106 if (!buff) 107 107 { 108 printf("Failed to read in FileGenericRead!\n");108 KePrint("Failed to read in FileGenericRead!\n"); 109 109 IrqRestoreFlags(flags); 110 110 return -EIO; … … 122 122 return copyOffset; 123 123 } 124 125 SYMBOL_EXPORT(FileGenericRead); 124 126 125 127 /*********************************************************************** … … 193 195 } 194 196 197 SYMBOL_EXPORT(DoOpenFile); 198 195 199 int DoReadFile(struct File* file,BYTE* buffer,DWORD size) 196 200 { … … 213 217 return -ENOTIMPL; 214 218 } 219 220 SYMBOL_EXPORT(DoReadFile); 215 221 216 222 int DoWriteFile(struct File* file,BYTE* buffer,DWORD size) … … 244 250 return -ENOTIMPL; 245 251 } 252 253 SYMBOL_EXPORT(DoWriteFile); 246 254 247 255 int DoSeekFile(struct File* file,int distance,int whence) … … 272 280 } 273 281 282 SYMBOL_EXPORT(DoSeekFile); 283 274 284 /*********************************************************************** 275 285 * … … 303 313 } 304 314 315 SYMBOL_EXPORT(DoCloseFile); 316 305 317 int FileNameMaxLength(char* path) 306 318 { … … 308 320 int len; 309 321 310 area=VmLookupAddress(current, (DWORD)path);322 area=VmLookupAddress(current, (DWORD)path); 311 323 if (!area) 312 324 return -EFAULT; … … 375 387 return ret; 376 388 } 389 390 SYMBOL_EXPORT(GetName); 377 391 378 392 int VfsGetFreeFd(struct Process* process) -
Whitix/branches/hybrid/fs/vfs/pipe.c
r502 r526 24 24 int PipeRead(struct File* file,BYTE* buffer,DWORD size) 25 25 { 26 printf("PipeRead\n");26 KePrint("PipeRead\n"); 27 27 return 0; 28 28 } … … 30 30 int PipeWrite(struct File* file,BYTE* buffer,DWORD size) 31 31 { 32 printf("PipeWrite\n");32 KePrint("PipeWrite\n"); 33 33 return 0; 34 34 } … … 42 42 int PipeClose(struct File* file) 43 43 { 44 printf("PipeClose\n");44 KePrint("PipeClose\n"); 45 45 return 0; 46 46 } -
Whitix/branches/hybrid/fs/vfs/poll.c
r412 r526 74 74 if (!FileGet(pollArray[i].fd)) 75 75 { 76 printf("Bad Fd? , %#X\n", current->files[pollArray[i].fd].vNode); while (1);76 KePrint("Bad Fd? , %#X\n", current->files[pollArray[i].fd].vNode); while (1); 77 77 return -EBADF; 78 78 } -
Whitix/branches/hybrid/fs/vfs/super.c
r412 r526 20 20 #include <fs/vfs.h> 21 21 #include <malloc.h> 22 #include <module.h> 22 23 #include <error.h> 23 24 #include <sdevice.h> 24 25 #include <task.h> 25 26 #include <fs/devfs.h> 27 #include <fs/exports.h> 26 28 #include <slab.h> 27 29 #include <panic.h> 30 #include <sys.h> 28 31 29 32 /* The root filesystem is mounted manually (i.e. not calling VfsMount) and the current->root=vnode. */ … … 155 158 VNodeRelease(mountNode); 156 159 VNodeRelease(deviceNode); 157 printf("VfsMount: Failed to mount %s\n",mountPoint);160 KePrint("VfsMount: Failed to mount %s\n",mountPoint); 158 161 return -ENOENT; 159 162 } … … 170 173 } 171 174 175 SYMBOL_EXPORT(VfsMount); 176 172 177 /*********************************************************************** 173 178 * … … 315 320 } 316 321 322 SYMBOL_EXPORT(VfsRegisterFileSystem); 323 317 324 int VfsDeregisterFileSystem(struct FileSystem* fs) 318 325 { … … 320 327 return 0; 321 328 } 329 330 SYMBOL_EXPORT(VfsDeregisterFileSystem); 322 331 323 332 /*********************************************************************** … … 338 347 struct FileSystem* curr; 339 348 340 printf("VFS: Mounting the root filesystem\n");349 KePrint("VFS: Mounting the root filesystem\n"); 341 350 342 351 if (!storageDev) … … 345 354 /* No clue what filesystem the storage device is, so try all filesystems */ 346 355 ListForEachEntry(curr,&fsList,list) 356 { 347 357 if ((superBlock=curr->readSuper(storageDev,0,NULL))) 348 358 break; 359 } 349 360 350 361 if (!superBlock) … … 362 373 strcpy(current->sCwd,"/"); 363 374 364 printf("VFS: Sucessfully mounted the root filesystem (%s)\n",curr->name); 365 366 return 0; 367 } 375 KePrint("VFS: Sucessfully mounted the root filesystem (%s)\n",curr->name); 376 377 return 0; 378 } 379 380 SYMBOL_EXPORT(VfsMountRoot); 368 381 369 382 /*********************************************************************** … … 381 394 { 382 395 struct VfsSuperBlock* retVal=(struct VfsSuperBlock*)MemCacheAlloc(sbCache); 396 383 397 if (!retVal) 384 398 return NULL; … … 395 409 } 396 410 411 SYMBOL_EXPORT(VfsAllocSuper); 412 397 413 void VfsFreeSuper(struct VfsSuperBlock* superBlock) 398 414 { … … 406 422 MemCacheFree(sbCache,superBlock); 407 423 } 424 425 SYMBOL_EXPORT(VfsFreeSuper); 426 427 #define SYSCALL_FS_BASE 0x0 428 429 struct SysCall fsSystemCalls[]= 430 { 431 { SysOpen, 12 }, 432 { SysCreateDir, 8 }, 433 { SysClose, 4 }, 434 { SysRemove, 4 }, 435 { SysRemoveDir, 4 }, 436 { SysFileAccess, 8 }, 437 { SysFileDup, 4 }, 438 { SysFileSync, 4 }, 439 { SysFileSystemSync, 0 }, 440 { SysTruncate, 8 }, 441 { SysMove, 8 }, 442 { SysWrite, 12 }, 443 { SysRead, 12 }, 444 { SysSeek, 12 }, 445 { SysChangeDir, 4 }, 446 { SysChangeRoot, 4 }, 447 { SysMount, 16 }, 448 { SysUnmount, 4 }, 449 { SysGetDirEntries, 12 }, 450 { SysGetCurrDir, 8 }, 451 { SysStat, 8 }, 452 { 0, 0 }, 453 }; 408 454 409 455 int VfsInit() … … 417 463 return -ENOMEM; 418 464 419 return 0; 420 } 421 465 /* Register system calls for the whole virtual filesystem layer. */ 466 SysRegisterRange(SYSCALL_FS_BASE, fsSystemCalls); 467 468 return 0; 469 } 470 471 ModuleInit(VfsInit); 472 -
Whitix/branches/hybrid/fs/vfs/vcache.c
r501 r526 258 258 if (!vNode->refs) 259 259 { 260 printf("VNodeRelease: Trying to free free vNode (%#X on %s)\n",vNode->id,vNode->superBlock->sDevice->name);260 KePrint("VNodeRelease: Trying to free free vNode (%#X on %s)\n",vNode->id,vNode->superBlock->sDevice->name); 261 261 return; 262 262 } … … 291 291 MemCacheFree(vNodeCache,vNode); 292 292 } 293 294 SYMBOL_EXPORT(VNodeRelease); 293 295 294 296 /* Should be a spinlock for SMP */ -
Whitix/branches/hybrid/fs/vfs/vnode.c
r412 r526 19 19 #include <fs/vfs.h> 20 20 #include <error.h> 21 #include <module.h> 21 22 #include <task.h> 22 23 #include <typedefs.h> … … 259 260 } 260 261 262 SYMBOL_EXPORT(NameToVNode); 263 261 264 /* TODO: Get BlockRead code to read into same physical page of memory. */ 262 265 … … 291 294 if (!buff) 292 295 { 293 printf("FileGenericReadPage: failed to read\n");296 KePrint("FileGenericReadPage: failed to read\n"); 294 297 return -EIO; 295 298 } … … 304 307 return 0; 305 308 } 309 310 SYMBOL_EXPORT(FileGenericReadPage); 311
