Sarah Jelinek wrote:
>>>> line:
>>>>> +logicalpart_append(LogicalPartition *startlogical,
>>>>> 1436 + LogicalPartition *newlogical)
>>>>> 1437 +{
>>>>> 1438 + LogicalPartition *curlogical;
>>>>> 1439 +
>>>>> 1440 + for (curlogical = startlogical;
>>>>> 1441 + curlogical != NULL;
>>>>> 1442 + curlogical = curlogical->next) {
>>>>> 1443 + if (curlogical->next == NULL) {
>>>>> 1444 + curlogical->next = newlogical;
>>>>> 1445 + break;
>>>>> 1446 + }
>>>>> 1447 + }
>>>>> 1448 +}
>>>>
>>>> Is it possible that you have a gap in the logical partitions and
>>>> that this would look like a NULL? So you would be inserting rather
>>>> than appending a new logical partition to the list? I am asking only
>>>> because it isn't clear to me if this will always result in an append.
>>>
>>> Not sure what you mean here, If can never be a gap in the linked list,
>>> if the item is NULL then it can't point to the next item, so
>>> therefore we
>>> are at the end of the singly linked list. There can never be a gap in
>>> the list.
>>>
>>> The pointer to the start of the list here, will always contain at
>>> least one item, so therefore we will always be appending at the end.
>
> I was asking if this list could have unused space, represented as a
> logical partition in it? Sounds like the answer is no. Just checking.
>
Actually I think the answer is yes. Each item in the blkorder
linked list represents a chunk of space, including gaps (free space).
For logicals, all items in it's logical blkorder list are actually displayed to
the use (as long as they round to >= 0.1GB in size).
For primaries, potentially not all items are shown. If there are unused primary
slots to be displayed, we show the largest chunk of free(unused space) in that
slot.
e.g. very rough example, showing three primary partitions with gaps between them
Disk size 5500
id1 : Solaris : offset 1-1000, size 1000
id2 : Linux : offset 2001-3000, size 1000
id3 : WinXP : offset 4001-5000, size 1000
The blkorder linked list would contain 6 items :
1 : Solaris : offset, 0-1000, size 1000
2 : Unused : offset, 1001->2000, size 1000
3 : Linux : offset, 2001->3000, size 1000
4 : Unused : Offset, 3001->4000, size 1000
5 : WinXP : Offset, 4001->5000, size 1000
6 : Unused : Offset, 5001->5500, size 500
The gui in this instance would display, linked list items 1, 2, 3, 5. picking 2
as the largest free chunk to display.
If These were logicals, the the GUI would display all 6 items to the user.
Sense ?
Matt