Changeset 802
- Timestamp:
- 07/14/08 20:34:56 (2 months ago)
- Files:
-
- 1 modified
-
Whitix/branches/fs/fs/ext3/balloc.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Whitix/branches/fs/fs/ext3/balloc.c
r780 r802 1 /* This file is part of Whitix. 2 * 3 * Whitix is free software; you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation; either version 2 of the License, or 6 * (at your option) any later version. 7 * 8 * Whitix is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with Whitix; if not, write to the Free Software 15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 * 17 */ 18 1 19 #include <bitmap.h> 2 20 3 21 #include "ext3.h" 22 23 /******************************************************************************* 24 * 25 * FUNCTION: Ext3GetGroupDesc 26 * 27 * DESCRIPTION: Get the on-disk group descriptor with index 'groupNo'. 28 * 29 * PARAMETERS: superBlock - superblock of the filesystem that contains the 30 * descriptors. 31 * groupNo - index of the group. 32 * buffer - return the buffer containing the group on-disk, 33 * in case the calling function wants to update the 34 * buffer and call JournalDirtyMetadata. (OPTIONAL) 35 * 36 * RETURNS: A pointer to the group descriptor in the buffer. 37 * 38 ******************************************************************************/ 4 39 5 40 struct Ext3GroupDesc* Ext3GetGroupDesc(struct VfsSuperBlock* superBlock, DWORD groupNo, … … 8 43 struct Ext3GroupDesc* descP; 9 44 DWORD groupDesc, desc; 10 45 struct Ext3SbInfo* sbInfo=EXT3_SUPERINFO(superBlock); 46 47 /* 48 * The group descriptors are located after the superblock on disk, and are 49 * read in when the superblock is mounted. 50 */ 51 52 if (groupNo >= sbInfo->groupCount) 53 return NULL; 54 55 /* Sector index of the group */ 11 56 groupDesc=groupNo/DESCS_PER_BLOCK(superBlock); 57 58 /* Offset within the group */ 12 59 desc = groupNo % DESCS_PER_BLOCK(superBlock); 13 60 14 descP=(struct Ext3GroupDesc*) EXT3_SUPERINFO(superBlock)->descs[groupDesc]->data;61 descP=(struct Ext3GroupDesc*)(EXT3_SUPERINFO(superBlock)->descs[groupDesc]->data); 15 62 16 63 if (buffer) … … 19 66 return descP+desc; 20 67 } 68 69 /******************************************************************************* 70 * 71 * FUNCTION: Ext3BlockLoadBitmap 72 * 73 * DESCRIPTION: Load the block bitmap pointed to by the group descriptor at index 74 * blockGroup. 75 * 76 * PARAMETERS: superBlock - superblock of the filesystem that contains the 77 * descriptor. 78 * groupNo - index of the group. 79 * 80 * RETURNS: A buffer pointer to the block bitmap. 81 * 82 ******************************************************************************/ 21 83 22 84 struct Buffer* Ext3BlockLoadBitmap(struct VfsSuperBlock* superBlock, int blockGroup) … … 222 284 offset=blockNo % sbInfo->blocksPerGrp; 223 285 224 KePrint("group = %u\n", group); 286 if (group >= sbInfo->groupCount) 287 { 288 KePrint("Ext3BlockFree: blockNo = %d, %u %u", blockNo, group, sbInfo->groupCount); 289 return -EIO; 290 } 225 291 226 292 desc=Ext3GetGroupDesc(superBlock, group, &groupBuffer);
