Skip to contentSkip to conversation

In LVM, problem with memory allocation to a new data structure...

linux-lvm 조완근 1 participant 1 message Jun 22, 2006

lore
Share & tools
lore

조완근

author
#0 lore raw

In my work with LVM source code, I made a new data structure "struct extent" in lib/metadata/metadata.h file, and then I added new member variables in "struct physical_volume". One of the new member variables is a pointer variable to an array of "struct extent" objects. I got the memory allocated to the pointer by using just malloc() function.

 

The source is compiled without any errors. But in execution, when the new array of "struct extent" objects is allocated, it works well. But later, when I access the physical volume object again, the new members have all zeros, instead of the values I gave before. Where have the values gone??

 

My question is

 (1) How can I add new member variables in the metadata data structures?

 (2) and What do I have to use for memory allocation to the new variables?

 

I'm very happy that there are you guys who can answer to my questions. Thank you!!