git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kernel/x86 - Moved MP Table parsing into its own file
[tpg/acess2.git]
/
KernelLand
/
Modules
/
Storage
/
LVM
/
volumes.c
diff --git
a/KernelLand/Modules/Storage/LVM/volumes.c
b/KernelLand/Modules/Storage/LVM/volumes.c
index
fdac4fd
..
cf1a60d
100644
(file)
--- a/
KernelLand/Modules/Storage/LVM/volumes.c
+++ b/
KernelLand/Modules/Storage/LVM/volumes.c
@@
-30,6
+30,12
@@
int LVM_AddVolume(const tLVM_VolType *Type, const char *Name, void *Ptr, size_t
tLVM_Format *fmt;
void *first_block;
tLVM_Format *fmt;
void *first_block;
+ if( BlockCount == 0 || BlockSize == 0 ) {
+ Log_Error("LVM", "BlockSize(0x%x)/BlockCount(0x%x) invalid in LVM_AddVolume",
+ BlockSize, BlockCount);
+ return 1;
+ }
+
dummy_vol.Type = Type;
dummy_vol.Ptr = Ptr;
dummy_vol.BlockCount = BlockCount;
dummy_vol.Type = Type;
dummy_vol.Ptr = Ptr;
dummy_vol.BlockCount = BlockCount;
@@
-37,6
+43,10
@@
int LVM_AddVolume(const tLVM_VolType *Type, const char *Name, void *Ptr, size_t
// Read the first block of the volume
first_block = malloc(BlockSize);
// Read the first block of the volume
first_block = malloc(BlockSize);
+ if( !first_block ) {
+ Log_Error("VLM", "LVM_AddVolume - malloc error on %i bytes", BlockSize);
+ return -1;
+ }
Type->Read(Ptr, 0, 1, first_block);
// Determine Format
Type->Read(Ptr, 0, 1, first_block);
// Determine Format
@@
-49,11
+59,14
@@
int LVM_AddVolume(const tLVM_VolType *Type, const char *Name, void *Ptr, size_t
// Create real volume descriptor
// TODO: If this needs to be rescanned later, having the subvolume list separate might be an idea
real_vol = malloc( sizeof(tLVM_Vol) + strlen(Name) + 1 + sizeof(tLVM_SubVolume*) * dummy_vol.nSubVolumes );
// Create real volume descriptor
// TODO: If this needs to be rescanned later, having the subvolume list separate might be an idea
real_vol = malloc( sizeof(tLVM_Vol) + strlen(Name) + 1 + sizeof(tLVM_SubVolume*) * dummy_vol.nSubVolumes );
+ real_vol->Next = NULL;
real_vol->Type = Type;
real_vol->Ptr = Ptr;
real_vol->Type = Type;
real_vol->Ptr = Ptr;
+ real_vol->BlockSize = BlockSize;
real_vol->BlockCount = BlockCount;
real_vol->nSubVolumes = dummy_vol.nSubVolumes;
real_vol->SubVolumes = (void*)( real_vol->Name + strlen(Name) + 1 );
real_vol->BlockCount = BlockCount;
real_vol->nSubVolumes = dummy_vol.nSubVolumes;
real_vol->SubVolumes = (void*)( real_vol->Name + strlen(Name) + 1 );
+ real_vol->BlockSize = BlockSize;
strcpy(real_vol->Name, Name);
memset(real_vol->SubVolumes, 0, sizeof(tLVM_SubVolume*) * real_vol->nSubVolumes);
// - VFS Nodes
strcpy(real_vol->Name, Name);
memset(real_vol->SubVolumes, 0, sizeof(tLVM_SubVolume*) * real_vol->nSubVolumes);
// - VFS Nodes
UCC
git Repository :: git.ucc.asn.au