Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 544 of file Inode.c.
Referenced by ext2_add_entry().
{ PEXT2_BDL ext2_bdl = NULL; ULONG blocks, i; bool bRet = true; EXT2_INODE inode; ULONG dwTotal = 0; ULONG dwBlk = 0; ULONG TotalBlks; blocks = (size + offset + Ext2Sys->blocksize - 1) / Ext2Sys->blocksize; if (!ext2_load_inode(Ext2Sys, ino, &inode)) { return false; } TotalBlks = inode.i_blocks / (Ext2Sys->blocksize / SECTOR_SIZE); TotalBlks = Ext2DataBlocks(Ext2Sys, TotalBlks); if (blocks > TotalBlks) { for (i=0; i < (blocks - TotalBlks); i++) { if (ext2_alloc_block(Ext2Sys, 0, &dwBlk) ) { ext2_expand_inode(Ext2Sys, &inode, dwBlk); inode.i_blocks += (Ext2Sys->blocksize/SECTOR_SIZE); } } } blocks = ext2_build_bdl(Ext2Sys, &inode, offset, size, &ext2_bdl); if (blocks <= 0) return false; for(i = 0; i < blocks; i++) { bRet = NT_SUCCESS(Ext2WriteDisk( Ext2Sys, ext2_bdl[i].Lba, ext2_bdl[i].Length, (PUCHAR)Buffer + ext2_bdl[i].Offset )); if (!bRet) { goto errorout; } dwTotal += ext2_bdl[i].Length; } *dwReturn = dwTotal; if (size + offset > inode.i_size) { inode.i_size = size + offset; } ext2_save_inode(Ext2Sys, ino, &inode); errorout: if (ext2_bdl) RtlFreeHeap(RtlGetProcessHeap(), 0, ext2_bdl); return bRet; }