I have a structure
struct buffer
{
int addr1;
int value;
struct A* p_next
}
buffer head;
Ex:
head.addr1 = 0x1;
head.value = 0x12;
addr1 represents the start of the buffer and value represents the size of the buffer. Therefore the head instance of the structure represents a buffer with starting addr = 0x1 and length as 0x10.
Now , how do I create the multiple buffer linked list of sizes of each starting with the first buffer address as 0x1 and the size of each buffer evenly distributed among nodes. The created buffer instances should form a linked list.
The number of nodes are provided to the function and the size of the value in the above structure is such that it is distributed among the buffers correctly.
Ex: A-->B-->C-->D
A: addr:0x1
value:0x4
B: addr:0x5 etc.
The values are just a case. Please help me with a generic solution of the problem.
Thanks In advance
Aucun commentaire:
Enregistrer un commentaire