mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 06:15:52 +00:00
- Tree cleanups proposed on the mailing list. Move all non-Core OS modules to rosapps. Tests were already moved by Fireball to rostests.
svn path=/trunk/; revision=26033
This commit is contained in:
parent
ad07a1e58f
commit
1e3d5d70e9
420 changed files with 78215 additions and 0 deletions
61
rosapps/ext2/file.c
Normal file
61
rosapps/ext2/file.c
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/ext2/super.c
|
||||
* PURPOSE: ext2 filesystem
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ntddk.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
#include "ext2fs.h"
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
#define addr_per_block (BLOCKSIZE / sizeof(ULONG))
|
||||
|
||||
ULONG Ext2BlockMap(PDEVICE_EXTENSION DeviceExt,
|
||||
struct ext2_inode* inode,
|
||||
ULONG offset)
|
||||
{
|
||||
ULONG block;
|
||||
PULONG TempBuffer;
|
||||
BOOL b;
|
||||
|
||||
DPRINT("Ext2BlockMap(DeviceExt %x, inode %x, offset %d)\n",
|
||||
DeviceExt,inode,offset);
|
||||
if (offset < EXT2_NDIR_BLOCKS)
|
||||
{
|
||||
block = inode->i_block[offset];
|
||||
DPRINT("block %d\n",block);
|
||||
return(block);
|
||||
}
|
||||
offset = offset - EXT2_NDIR_BLOCKS;
|
||||
if (offset < addr_per_block)
|
||||
{
|
||||
block = inode->i_block[EXT2_IND_BLOCK];
|
||||
TempBuffer = ExAllocatePool(NonPagedPool, BLOCKSIZE);
|
||||
b = Ext2ReadSectors(DeviceExt->StorageDevice,
|
||||
block,
|
||||
1,
|
||||
TempBuffer);
|
||||
if (!b)
|
||||
{
|
||||
DbgPrint("ext2fs:%s:%d: Disk io failed\n", __FILE__, __LINE__);
|
||||
return(0);
|
||||
}
|
||||
block = TempBuffer[offset];
|
||||
ExFreePool(TempBuffer);
|
||||
return(block);
|
||||
}
|
||||
offset = offset - addr_per_block;
|
||||
DbgPrint("Failed at %s:%d\n",__FILE__,__LINE__);
|
||||
for(;;);
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue