Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Possible os9.exe & toolshed.c errors

2013-07-23
2013-07-23
  • Robert Gault
    Robert Gault
    2013-07-23

    There are some lines in toolshed.c and various os9 source modules that seem suspect.
    toolshed.c starting at line 820
    / walk bitmap for 'bytes_in_bitmap * 8' times /
    There is a test for the largest free block which never resets the count when a cluster is not free. I think a new line is needed.
    / bit is set, sector not free /
    if (largest_count > largest_free_block)
    {
    largest_free_block = largest_count;
    / I think the largest count should be reset as soon as a non-free cluster is found. /
    *largest_count = 0;

    os9format.c about line 464
    / There appears to be an error here. Since bitmapSectors is already the correct number
    there is no reason to do anything except multiply it by sectorSize.
    size = NextHighestMultiple((bitmapSectors) * sectorSize, clusterSize);
    /
    size = (bitmapSectors) * sectorSize;

    I don't see why (bitmapSectors) * sectorSize is not the value needed. Cluster size should be irrelevant.

    os9gen.c about line 216
    There is no provision for allocating the correct bits in the map if the cluster size is not 1. I think a change is needed.
    / Old line that ignored DD.BIT
    _os9_allbit(opath->bitmap, startlsn, (size+255)/256);
    /
    / New line to take into account DD.BIT. /
    _os9_allbit(opath->bitmap, (startlsn+cluster_size-1)/cluster_size, (((size+255)/256)+cluster_size-1)/cluster_size);

    You also need to define a new variable for the routine at L132
    / New variable needed if DD.BIT not 1 /
    int cluster_size;