$g doc:style1.lay
$g jhb:smmods.lay
$a tab=0.10",0.25",0.5",2.0",3.5",4.5"
$b0 APM Note 6.? $b0 4 Oct 84 $b0 JHB
$b1 $u Files Giving Information About the System $u

$b1 The filestore provides useful systems information via a number of special
"files". These are indistinguishable from real files to the user but are generated
"on-the-fly" by the filestore.

$b1 These special files include..

$b1 $$:UNOS
$b0 $$:PORTS
$b0 $$:XNOS
$b0 $$:DIRECTORIES
$b0 $$:BITMAP.n       $t5 for each partition n
$b0 $$:TRACE
$b1 u:DIRECTORY      $t5 for each user u

$b1 The system manager administration program maintains a database giving
information about owners of directories. This lives in MANAGR:ADMIN.DAT.

$b1 $u($$:UNOS)

$b1 bytes   $t3 Field                                       $t6 Comments

$b1 3       $t3 User number (UNO)                           $t6 decimal
$b0 4       $t3 Filestore port ("Context") or -2            $t6 decimal
$b0 2       $t3 <sp><sp>
$b0 2       $t3 User Station                                $t6 hex
$b0 3       $t3 User port                                   $t6 decimal
$b0 7       $t3 User name                                   $t6 right-justified
$b0 1       $t3 Priveleged indication ('!')
$b0 7       $t3 Directory name                              $t6 right-justified
$b0 2       $t3 <sp><sp>
$b0 14      $t3 Date and time user logged on                $t6 DD/MM/YY HH:MM
$b0 2       $t3 <sp><sp>
$b0 14      $t3 Date and time UNO was last used             $t6 "
$b0 2       $t3 <sp><sp>
$b0 14      $t3 Date and time XNO last used by this UNO     $t6 "      
$b0 1       $t3 <linefeed>

$b1 78      $t3 Total                                       $t6 Fixed format

$b1 User station and port are blank for UNO = 0 [ANON] and UNO = -2 [?]

$b1 $u($$:PORTS)

$b1 Bytes   $t3 Field                                       $t6 Comments

$b1 3   $t3 Filestore port ("Context")                      $t6 Decimal
$b0 4   $t3 User Station                                    $t6 Hex
$b0 3   $t3 User port
$b0 2   $t3 <sp><sp>
$b0 14  $t3 Date and time port was attached                 $t6 DD/MM/YY HH:MM
$b0 2   $t3 <sp><sp>
$b0 14  $t3 Date and time port last used                    $t6 "
$b0 1   $t3 <linefeed>

$b1 43  $t3 Total                                           $t6 Fixed format

$n $u($$:XNOS)

$b1 3   $t3 XNO
$b0 3   $t3 UNO associated with this XNO
$b0 3   $t3 Filestore port ("Context")
$b0 1   $t3 <sp>
$b0 21  $t3 File name or "Special File"
$b0 5   $t3 Next file block to be read                      $t6 * starts at 1
$b0 5   $t3 Last extent read                                $t6 * starts at 0
$b0 6   $t3 Next disc block to be read                      $t6 *
$b0 3   $t3 Current extent                                  $t6 *
$b0 1   $t3 "/"                                             $t6 *
$b0 3   $t3 Extents in file                                 $t6 *
$b0 1   $t3 <sp>
$b0 5   $t3 Blocks in file
$b0 2   $t3 <sp><sp>
$b0 14  $t3 Time XNO was last active
$b0 1   $t3 <sp>
$b0 1   $t3 "R" (read operations) | "W" (write operations)
$b0 1   $t3 "L" (last block has gone)
$b0 1   $t3 <linefeed>

$b1 79  $t3 Total                                           $t6 ?Fixed format

$b1 $u($$:DIRECTORIES)

$b1 4   $t3 Cache Slot
$b0 3   $t3 <sp><sp><sp>
$b0 8   $t3 Directory owner                                  $t6 left-justified
$b0 1   $t3 "("
$b0 1   $t3 partition
$b0 1   $t3 "."
$b0 3   $t3 user directory number
$b0 1   $t3 ")"
$b0 5   $t3 Reference count: No. of entities referencing this directory:
$b0     $t3 1/Logged on user + 1/File open + 1/Default ??
$b0 5   $t3 <sp><sp><sp><sp><sp>
$b0 5   $t3 Time Stamp
$b0     $t3 "** Written **"
$b0 1   $t3 <linefeed>

$b1     $t3 Total

$b1 $u($$:BITMAP.n     (0 <= n <= max partition))

$b0 8000 $t3 Bitmap of available pages on the filestore disc. 0 = ??; 1 = ??

$b1 $u($$:TRACE)

$b1 4   $t3 Index of first trace record

$b1 4   $t3 "Context"                               $t6 *
$b0 4   $t3 In (=0) | Out (=1)                      $t6 *
$b0 56  $t3 Text                                    $t6 * String (55)

$b1 4   $t3 Index of last trace record

The file has TBUFFS entries (see system:config.inc) each of format
(the fields marked '*') with a leading first entry pointer and trailing last
entry pointer.

$n $u(u:DIRECTORY)

$b1 The file consists of a complete list of the files of the directory, one per
line in date order (Last accessed file first). Lines are of varying length and
terminate with a linefeed.

$b1 $u(MANAGR:ADMIN.DAT)

$b1 This is an indexed sequential file of 128-byte records comprising
a header record followed by one record for each top-level directory.
Directory records are sorted in increasing alphabetical order.

$b1 Header Record

$b0   4  $t3 Number of directory records in file (not counting header)
$b0 104  $t3 Index into file. This is an integerarray A('A'-'Z') 
         $t3 Entries are record numbers, counting from the header (= 0)
         $t3 and indicate the point from which a search should start.
$b0  10  $t3 Spare

$b1 Directory Records

$b0   8  $t3 Directory ID                      $t6 String (7)

$b1  36  $t3 {Prenames                         $t6 String (35)
$b0  16  $t3 {Surname                          $t6 String (15)
$b0 or..
$b1  52  $t3 {Description                      $t6 String (51)

$b1  16  $t3 Supervisor                        $t6 String (15)
$b0   2  $t3 Group                             $t6 Shortinteger
$b0   2  $t3 Bitmap of F'stores this no. is on.$t6 Shortinteger
$b0  10  $t3 Creation Date                     $t6 String (9)
$b0  10  $t3 Date after which directory may be deleted $t6 String (9)
$b0  28  $t3 Mail Address of owner or supervisor $t6 String (27)

$b1 The Description option is used for systems directories. All "Description" 
strings start with '!'.

$b1 The Dates are string(8)s with one extra byte for alignment.

$b1 Groups:
$b0 0: Unknown                          $t5 1: Essential systems directories
$b0 2: Additional Systems directories   $t5 3: Staff
$b0 4: Postgrads                        $t5 5: CS4
$b0 6: CS3                              $t5 7: CS2
$b0 8: CS1                              $t5 9: IS1
$b0 10: Visitors                         $t5 11: Public directories
$b0 12: Other Departments                $t5 13: ERCC

$b0 Bit 15: "Trusted" bit                $t5 Bit 14: "Ex-" bit
$b0 Bit 13: Laser printer bit            $t5 Bit 12: Female Bit

$b1 FS accredit bits
$b0 Bit 0: alpha                         $t5 Bit 1: bravo
$b0 Bit 2: charlie                       $t5 Bit 3: portable
$b0 Bit 4: vax                           $t5 Bit 5: old
$b1
The Include file MANAGR:ADDEFS.INC contains specs for the above record formats.
MANAGR:ADMIN.INC contains the routines FIND DIR and SHOW DIR which access the
database.   NOTE: The format of the database is a quick fudge and is far from
ideal.  Anyone writing utilites which use it are advised to contact JHB first:
The format may change with little notice and access should be channeled through
MANAGR:ADMIN.INC where possible, which may entail adding new routines.

$b1 $u(MANAGR:NS.DAT)

*** Note *** This facility is still under development and may change without
notice.  If you are writing software to use it you are advised to notify JHB.

This file is a pair of tables, indexed by station number giving a short and
long destription of the APM at the specified station number. The short table
is intended for quick name <-> address translation and the long one is a 
database for housekeeping and general reference.

The table comprises 128 8-byte fields followed by 128 64-byte fields.

All "strings" are stored as bytearrays padded to right with characters <= ' '
with no length byte.  (To save space)

The 8-byte fields are simply the station short names in station number order.
APMs are designated by names starting with an '@' character.

The 64-byte fields are records of type NS LFM (specified in MANAGR:NSDEFS.INC)
in station number order..


$b1 bytes   $t3 Field                                           $t6 Comments
$b0 1   $t3   "In" or "On" designation                        $t6 see note [5]
$b0 1   $t3   "Room" designation                              $t6 see note [5]
$b0  31   $t3   Long text name of station                     $t6  Bytearray padded
$b0 1   $t3   Case Number                                     $t6 see note [6]
$b0 8   $t3   Spare
$b0 4   $t3   Supplementary address information (eg Room number)$t6  Bytearray padded
$b0  18   $t3   Backplane Map.                                  $t6 see note [7]

$b1 64     $t3 Total


$b1 [5]     $t3 These fields taken with the long text name give a "user-friendly"
description of the location.  "In"/"On" takes values..
$b0 'I'   $t3  In
$b0 'O'   $t3  On
$b0 'A'   $t3  At
$b0 ' '   $t3  No special description

$b1 "Room" takes values..
$b0 'R'   $t3  to indicate the description refers to someone's room 
$b0 'T'   $t3  to indicate it is the something-or-other
$b0 ' '   $t3  No special description

$b1 Examples..
$b0 'I''R'  John Butler   ->    In John Butler's Room
$b0 'O''T'  Test Rig      ->    On the Test Rig


$b1 [6]     Note to systems staff - This field may cause alignment problems if moved
$b0 [7]     The backplane map should indicate what is in each of the 16 backplane
slots plus an indication of what mouse and display is being used.
Position is irrelevant.    Each entry can take the value..

$b1 'A'   $t3  0.5 Mb Memory Board
$b0 'B'   $t3  1.0 Mb Memory Board
$b0 'C'   $t3  Processor Board (8 MHz)
$b0 'D'   $t3  Processor Board (10 MHz)
$b0 'E'   $t3  Ethernet Board
$b0 'G'   $t3  Level 1 Graphics
$b0 'H'   $t3  Level 1.5 Graphics
$b0 'J'   $t3  Level 2 Graphics
$b0 'L'   $t3  2.0 Mb Memory Board
$b0 'M'   $t3  Mouse
$b0 'X'   $t3  MIT Graphics Monitor
$b0 'Y'   $t3  DJR/MIT Monitor

$b1
MANAGR:NS.INC contains a set of routines for accessing the file. It is suggested
that all NS.DAT access be channeled through these routines (adding new ones if
necessary) so the file format can be changed without too much difficulty.
(Which will be necessary if ISO-style Ethernet addresses are to be handled or
if the A.T. Ethernet address space overlaps that of KB.


$e
