2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: services/fs/ext2/super.c
5 * PURPOSE: ext2 filesystem
6 * PROGRAMMER: David Welch (welch@mcmail.com)
10 /* INCLUDES *****************************************************************/
12 #include <ddk/ntddk.h>
15 #include <internal/debug.h>
19 /* FUNCTIONS ****************************************************************/
21 #define addr_per_block (BLOCKSIZE / sizeof(ULONG))
23 ULONG
Ext2BlockMap(PDEVICE_EXTENSION DeviceExt
,
24 struct ext2_inode
* inode
,
31 DPRINT("Ext2BlockMap(DeviceExt %x, inode %x, offset %d)\n",
32 DeviceExt
,inode
,offset
);
33 if (offset
< EXT2_NDIR_BLOCKS
)
35 block
= inode
->i_block
[offset
];
36 DPRINT("block %d\n",block
);
39 offset
= offset
- EXT2_NDIR_BLOCKS
;
40 if (offset
< addr_per_block
)
42 block
= inode
->i_block
[EXT2_IND_BLOCK
];
43 TempBuffer
= ExAllocatePool(NonPagedPool
, BLOCKSIZE
);
44 b
= Ext2ReadSectors(DeviceExt
->StorageDevice
,
50 DbgPrint("ext2fs:%s:%d: Disk io failed\n", __FILE__
, __LINE__
);
53 block
= TempBuffer
[offset
];
54 ExFreePool(TempBuffer
);
57 offset
= offset
- addr_per_block
;
58 DbgPrint("Failed at %s:%d\n",__FILE__
,__LINE__
);