Download Print this page

Motorola EXORdisk II User Manual page 431

Advertisement

APPENDIX
G.
Directory Hashing Function
In order to speed up a directory
sea~ch
ro~
a
specific
file
name,
a
hashing function is used to map a rile's name
into one of the directory's sectors.
As a result, the number
of
sectors
that
have to be read before a match is found or
not found is minimized.
All ten
b~tes
of the file name and suffix
are
used
by
the
hashing function.
The
function
computes a
number which,
when added to
th~
physical sector number of the start of
the
directory,
is the sector number of the first sector used
in
a
linear search of the directory.
An entry in the dir-ectory will have in its first byte
a
value
of
zero,
indicating
that
this entry has never been
used; a value of
$FF,
indicating that the entry
is
deleted;
or
an
ASCII
character,
indicating
the presence of a rile
name.
Initially, all directory sectors are filled
with
zeroes ..
New
names are added
se~uentially
to the
se~tor
identified
by
the hashing
fun~tion.
New entries can
be
made
into
those
entries
which
have
a
zero
oor an
$FF
in 'their first byte.
Thus, a search for a name can stop whenever an entry is Found
~hich
has the first byte equal to zero.
A
directory
search
begins in the sector
id~ntified
by
the hashing function.
If
no
entries
within
this
sector
contain
zero
in their first byte, and iT no match is found,
the next sector in the directory is
searched.
The
sectors
~ill
continue
to
be
searched
in this round-robin fashion
until a match or an entry with first byte of zero
is
found,
or
until
all sectors have been examined.
The only time all
sectors of the directory
are
searched
is
if
ever~
entry
contains
a
valid
file
name or a deleted rile name.
Thus,
directory searches are
faster
if
the
directory
has
been
reorganized with the BACKUP command (section 3.3).
The following routine is similar to the one used in MDOS
to perform the directory hashing Function.
It is
documented
here
to allow users who wish to write disk-oriented programs
to access the directory without using
MDOS.
Page
G-Ol

Advertisement

loading

This manual is also suitable for:

Exordisk iii