[Info-vax] Empty blocks in FILES-11 directory files.

Mark Daniel mark.daniel at wasd.vsm.com.au
Sun Sep 25 18:53:54 EDT 2022


On 25/9/2022 5:01 pm, Volker Halle wrote:
> Mark,
> 
> does your utility read until the 'End of file block' or the 'Highest block' of the directory file ?

I responded as 'highest block' but as you pointed out it only read to 
the final byte in the file, not to the end-of-block or allocation.

> Free blocks should only be at the end of the directory file - after the EFBLK.
> 
> The logical end of the directory would be the last 'directory record' in the 'End of file block'of the directory file, i.e. a directory record with DIR$W_SIZE=-1 marks the end of directory records in the current block and therefore the end of the directory in the 'End of file block'

This is the bit I missed!!

    The "DIR$W_SIZE=-1 marks the end of directory records in the
    current block and therefore the end of the directory in the
    'End of file block'

After reading the end of record (-1) the code did not check whether this 
was the EFBLK.  It "continue"d (literally) on its merry way trying to 
read more records.

             /* continue to parse if not at end of content */
             if (rptr < dzptr) continue;

             /* end of records (file names) */
             odsptr->DirectTheLength =
                odsptr->DirectTheRecord =
                odsptr->DirectSubRecord = 0;
             if (odsptr->DirectWildcard[0])
                status = RMS$_NMF;
             else
                status = RMS$_FNF;
             break;

The code now explicitly tests for EBLK (in its own inimitable fashion).

             if (rlen == (uint)0xffff && dzptr - rptr <= 512)
             {
                /* end of records in end file block */
                odsptr->DirectTheLength =
                   odsptr->DirectTheRecord =
                   odsptr->DirectSubRecord = 0;
                if (odsptr->DirectWildcard[0])
                   status = RMS$_NMF;
                else
                   status = RMS$_FNF;
                break;
             }

The |EmtypBlockCount| was always a misnomer, perhaps better as 
|EmptyRecordCount| because that is what it was ticking over.  But still 
a kludge and a result of missing the EFBLK factor.  The kludge worked 
until it didn't.

The generic file read originally referred to, does allocate what it 
considers a whole number of blocks (of zeroed memory), from an earlier post

>    /* round-up ensure we have a full complement of blocks allocated */
>    odsptr->DataPtr = (char*)VmGet (((SizeInBytes/512)+1)*512);

which would (perhaps) explain the variable number of "empty records" 
(less misleading name for the variable) following the end-of-records 
sentinel in the end-of-file block.

> $ DUMP/DIR directory_file.DIR should show the last record as:  'xxx End of records (-1)'  in the EOF block.
> 
> The function to 'shuffle' a directory (extend or compress) is called  SHUFFLE_DIR, found in module [F11X]SHFDIR
> 
> Directory files are and must be contiguous. DUMP/HEADER directory.DIR shows:
> 
>      File characteristics:                 Contiguous, Directory
> 
> This allows more efficient reads/writes and prevents window turns, when already executing inside the XQP.
> 
> Volker.

-- 
Anyone, who using social-media, forms an opinion regarding anything 
other than the relative cuteness of this or that puppy-dog, needs 
seriously to examine their critical thinking.





More information about the Info-vax mailing list