<<============================================================>>        00010000
<<                                                            >>        00012000
<<                      INCLDFS1 - B2                         >>        00014000
<<                                                            >>        00016000
<<  This include file defines the disc free space management  >>        00018000
<<  data segment.                                             >>        00020000
<<                                                            >>        00022000
<<============================================================>>        00024000
                                                                        00026000
                                                                        00028000
   <<--------------------------------------------------------->>        00030000
   << These variables contain information on the data segment >>        00032000
   << and free space map for the particular ldev.  They are   >>        00034000
   << initialized when the data segment is created and never  >>        00036000
   << change.                                                 >>        00038000
   <<--------------------------------------------------------->>        00040000
                                                                        00042000
   << Ldev number of disc drive >>                                      00044000
                                                                        00046000
   INTEGER ds'ldev = DB + %0;                                           00048000
                                                                        00050000
   << DST num. of this data segment >>                                  00052000
                                                                        00054000
   INTEGER ds'dst = ds'ldev + 1;                                        00056000
                                                                        00058000
   << Logical (usable) size of disc in sectors.               >>        00060000
                                                                        00062000
   DOUBLE ds'disc'size = ds'dst + 1;                                    00064000
                                                                        00066000
   << The page number of the last page of the disc free space >>        00068000
   << bit map. (size in pages minus 1)                        >>        00070000
                                                                        00072000
   INTEGER ds'last'page'of'map = ds'disc'size + 2;                      00074000
                                                                        00076000
   << The index of the last bit map buffer in the data        >>        00078000
   << segment. (number of buffers minus one)                  >>        00080000
                                                                        00082000
   INTEGER ds'last'buffer'index = ds'last'page'of'map + 1;              00084000
                                                                        00086000
   << Disc address of bit map. >>                                       00088000
                                                                        00090000
   DOUBLE ds'map'address = ds'last'buffer'index + 1;                    00092000
                                                                        00094000
                                                                        00096000
   <<--------------------------------------------------------->>        00098000
   << The following are involved with the locking of the disc >>        00100000
   << free space data segment.                                >>        00102000
   <<--------------------------------------------------------->>        00104000
                                                                        00106000
   << This has the PIN of the process that has the data seg   >>        00108000
   << locked or zero if it is not locked.                     >>        00110000
                                                                        00112000
   LOGICAL ds'lock = ds'map'address + 2;                                00114000
                                                                        00116000
   << This is the lock count, it is the number of times that  >>        00118000
   << the process that has the data segment lock has locked   >>        00120000
   << it.  This can be used to prevent other process from     >>        00122000
   << accessing the free space map of a given disc between    >>        00124000
   << calls to get or return space.  STORE/RESTORE may use    >>        00126000
   << this in the future.                                     >>        00128000
                                                                        00130000
   INTEGER ds'lock'count = ds'lock + 1;                                 00132000
                                                                        00134000
   << These two variables are the head and tail of the queue  >>        00136000
   << of processes waiting on the data segment. They are      >>        00138000
   << linked through the PCBs for each process. The head is   >>        00140000
   << zero if no process is waiting on the lock.              >>        00142000
                                                                        00144000
   LOGICAL ds'queue'head = ds'lock'count + 1;                           00146000
                                                                        00148000
   LOGICAL ds'queue'tail = ds'queue'head + 1;                           00150000
                                                                        00152000
                                                                        00154000
   <<--------------------------------------------------------->>        00156000
   << The following are pointers to arrays that are set up    >>        00158000
   << starting at ds'array'area.                              >>        00160000
   <<--------------------------------------------------------->>        00162000
                                                                        00164000
   << The pointer to the descriptor table, which is composed  >>        00166000
   << of three work entries for each page of the map.         >>        00168000
                                                                        00170000
   INTEGER POINTER ds'descriptor'table = ds'queue'tail + 1;             00172000
                                                                        00174000
   << This array has an entry for each buffer and indicates   >>        00176000
   << the page that is currently in the buffer or if the      >>        00178000
   << buffer is currently empty. A value of "empty'buffer",   >>        00180000
   << (minus one), indicates an empty.                        >>        00182000
                                                                        00184000
   INTEGER POINTER ds'buffer'page'number = ds'descriptor'table + 1;     00186000
                                                                        00188000
   << This array is used to indicate if the buffer is dirty   >>        00190000
   << or clean, it has an entry for each page and a value of  >>        00192000
   << TRUE indicates the buffer is dirty and FALSE says it is >>        00194000
   << clean.                                                  >>        00196000
                                                                        00198000
   LOGICAL POINTER ds'buffer'dirty = ds'buffer'page'number + 1;         00200000
                                                                        00202000
   << This is the pointer to the beginning of the buffer      >>        00204000
   << area.                                                   >>        00206000
                                                                        00208000
   LOGICAL POINTER ds'buffer'area = ds'buffer'dirty + 1;                00210000
                                                                        00212000
   <<--------------------------------------------------------->>        00214000
   << The following variables are used to speed the search of >>        00216000
   << the descriptor table.                                   >>        00218000
   <<--------------------------------------------------------->>        00220000
                                                                        00222000
   << The following has the page number of the first page     >>        00224000
   << that has a block that is equal of greater in size than  >>        00226000
   << "threshold'size". This is use to speed the search for   >>        00228000
   << blocks that are not unusually small.                    >>        00230000
                                                                        00232000
   INTEGER ds'first'threshold'page = ds'buffer'area + 1;                00234000
                                                                        00236000
   << These variables keep track of the last block allocated  >>        00238000
   << on this disc.  If the size of the block that is being   >>        00240000
   << requasted is greater than or equal to the last block    >>        00242000
   << allocated on this disc, then a block of the right size  >>        00244000
   << will not be available before the page that the last     >>        00246000
   << allocation occured on.  The don't know state is set     >>        00248000
   << by assigning the size of last allocation to be the size >>        00250000
   << of the disc.                                            >>        00252000
                                                                        00254000
   DOUBLE ds'size'of'last'allocation = ds'first'threshold'page + 1;     00256000
                                                                        00258000
   INTEGER ds'last'page'allocated'from =                                00260000
                            ds'size'of'last'allocation + 2;             00262000
                                                                        00264000
   <<--------------------------------------------------------->>        00266000
   << This variable is a pointer to the next buffer to use is >>        00268000
   << there are no empty buffers.                             >>        00270000
   <<--------------------------------------------------------->>        00272000
                                                                        00274000
   INTEGER ds'next'buffer'index = ds'last'page'allocated'from + 1;      00276000
                                                                        00278000
   <<--------------------------------------------------------->>        00280000
   << The following are a set of variables used so that pro-  >>        00282000
   << cedures can pass information between each other in      >>        00284000
   << spilt stack mode.                                       >>        00286000
   <<--------------------------------------------------------->>        00288000
                                                                        00290000
   INTEGER ds'page'number = ds'next'buffer'index + 1;                   00292000
   INTEGER ds'word'number = ds'page'number + 1;                         00294000
   INTEGER ds'bit'number  = ds'word'number + 1;                         00296000
                                                                        00298000
   LOGICAL POINTER ds'page'ptr = ds'bit'number + 1;                     00300000
                                                                        00302000
   INTEGER ds'starting'word'number = ds'page'ptr + 1;                   00304000
   INTEGER ds'starting'bit'number = ds'starting'word'number + 1;        00306000
                                                                        00308000
   DOUBLE ds'number'of'sectors = ds'starting'bit'number + 1;            00310000
   INTEGER ds'bit'count = ds'number'of'sectors + 2;                     00312000
                                                                        00314000
   INTEGER ds'entry'type = ds'bit'count + 1;                            00316000
                                                                        00318000
   INTEGER ds'buffer'index = ds'entry'type + 1;                         00320000
                                                                        00322000
   DOUBLE ds'disc'address = ds'buffer'index + 1;                        00324000
                                                                        00326000
   <<--------------------------------------------------------->>        00328000
   << The following are used for error information.           >>        00330000
   <<--------------------------------------------------------->>        00332000
                                                                        00334000
   << This is used to pass error information between          >>        00336000
   << procedures.  If a fatal error occures the status will   >>        00338000
   << be left in this word and may be checked as a way of     >>        00340000
   << determining if a allocation has been disabled on this   >>        00342000
   << device.  Thus if this word has a value greater than     >>        00344000
   << "fatal'dfs'error", it indicates to all processes that   >>        00346000
   << allocation has been disabled on this device.  This is   >>        00348000
   << in addition to the word in the LDTX, an is used only by >>        00350000
   << Lock'Dfs'Data'Seg to check if allocation is disabled    >>        00352000
   << while DB is at the data segment.                        >>        00354000
                                                                        00356000
   LOGICAL ds'error'status = ds'disc'address + 2;                       00358000
                                                                        00360000
   <<--------------------------------------------------------->>        00362000
   << This marks the start of the area that is used for the   >>        00364000
   << arrays and buffers, which are set when the data segment >>        00366000
   << is created.                                             >>        00368000
   <<--------------------------------------------------------->>        00370000
                                                                        00372000
   ARRAY ds'array'area (*) = ds'error'status + 1;                       00374000
                                                                        00376000
                                                                        00378000
<<============================================================>>        00380000
<<                                                            >>        00382000
<<                    End of INCLDFS1                         >>        00384000
<<                                                            >>        00386000
<<============================================================>>        00388000
